1
0

Kernel-Collections.deploy.js 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025
  1. smalltalk.addPackage('Kernel-Collections', {});
  2. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  3. smalltalk.addMethod(
  4. "__eq",
  5. smalltalk.method({
  6. selector: "=",
  7. fn: function (anAssociation){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $1;
  10. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  11. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  12. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
  13. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  14. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation}, smalltalk.Association)})}
  17. }),
  18. smalltalk.Association);
  19. smalltalk.addMethod(
  20. "_key",
  21. smalltalk.method({
  22. selector: "key",
  23. fn: function (){
  24. var self=this;
  25. return smalltalk.withContext(function($ctx1) { var $1;
  26. $1=self["@key"];
  27. return $1;
  28. }, function($ctx1) {$ctx1.fill(self,"key",{}, smalltalk.Association)})}
  29. }),
  30. smalltalk.Association);
  31. smalltalk.addMethod(
  32. "_key_",
  33. smalltalk.method({
  34. selector: "key:",
  35. fn: function (aKey){
  36. var self=this;
  37. return smalltalk.withContext(function($ctx1) { self["@key"]=aKey;
  38. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey}, smalltalk.Association)})}
  39. }),
  40. smalltalk.Association);
  41. smalltalk.addMethod(
  42. "_printString",
  43. smalltalk.method({
  44. selector: "printString",
  45. fn: function (){
  46. var self=this;
  47. return smalltalk.withContext(function($ctx1) { var $1;
  48. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  49. return smalltalk.withContext(function($ctx2) { return _st(self)._storeOn_(aStream);
  50. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  51. return $1;
  52. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Association)})}
  53. }),
  54. smalltalk.Association);
  55. smalltalk.addMethod(
  56. "_storeOn_",
  57. smalltalk.method({
  58. selector: "storeOn:",
  59. fn: function (aStream){
  60. var self=this;
  61. return smalltalk.withContext(function($ctx1) { _st(self["@key"])._storeOn_(aStream);
  62. _st(aStream)._nextPutAll_("->");
  63. _st(self["@value"])._storeOn_(aStream);
  64. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.Association)})}
  65. }),
  66. smalltalk.Association);
  67. smalltalk.addMethod(
  68. "_value",
  69. smalltalk.method({
  70. selector: "value",
  71. fn: function (){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx1) { var $1;
  74. $1=self["@value"];
  75. return $1;
  76. }, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.Association)})}
  77. }),
  78. smalltalk.Association);
  79. smalltalk.addMethod(
  80. "_value_",
  81. smalltalk.method({
  82. selector: "value:",
  83. fn: function (aValue){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) { self["@value"]=aValue;
  86. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue}, smalltalk.Association)})}
  87. }),
  88. smalltalk.Association);
  89. smalltalk.addMethod(
  90. "_key_value_",
  91. smalltalk.method({
  92. selector: "key:value:",
  93. fn: function (aKey,aValue){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  96. $2=_st(self)._new();
  97. _st($2)._key_(aKey);
  98. _st($2)._value_(aValue);
  99. $3=_st($2)._yourself();
  100. $1=$3;
  101. return $1;
  102. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue}, smalltalk.Association.klass)})}
  103. }),
  104. smalltalk.Association.klass);
  105. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  106. smalltalk.addMethod(
  107. "__comma",
  108. smalltalk.method({
  109. selector: ",",
  110. fn: function (aCollection){
  111. var self=this;
  112. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  113. $2=_st(self)._copy();
  114. _st($2)._addAll_(aCollection);
  115. $3=_st($2)._yourself();
  116. $1=$3;
  117. return $1;
  118. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.Collection)})}
  119. }),
  120. smalltalk.Collection);
  121. smalltalk.addMethod(
  122. "_add_",
  123. smalltalk.method({
  124. selector: "add:",
  125. fn: function (anObject){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  128. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Collection)})}
  129. }),
  130. smalltalk.Collection);
  131. smalltalk.addMethod(
  132. "_addAll_",
  133. smalltalk.method({
  134. selector: "addAll:",
  135. fn: function (aCollection){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) { var $1;
  138. _st(aCollection)._do_((function(each){
  139. return smalltalk.withContext(function($ctx2) { return _st(self)._add_(each);
  140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  141. $1=aCollection;
  142. return $1;
  143. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection}, smalltalk.Collection)})}
  144. }),
  145. smalltalk.Collection);
  146. smalltalk.addMethod(
  147. "_asArray",
  148. smalltalk.method({
  149. selector: "asArray",
  150. fn: function (){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) { var $1;
  153. $1=_st((smalltalk.Array || Array))._withAll_(self);
  154. return $1;
  155. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Collection)})}
  156. }),
  157. smalltalk.Collection);
  158. smalltalk.addMethod(
  159. "_asJSON",
  160. smalltalk.method({
  161. selector: "asJSON",
  162. fn: function (){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) { var $1;
  165. $1=_st(_st(self)._asArray())._collect_((function(each){
  166. return smalltalk.withContext(function($ctx2) { return _st(each)._asJSON();
  167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  168. return $1;
  169. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Collection)})}
  170. }),
  171. smalltalk.Collection);
  172. smalltalk.addMethod(
  173. "_asOrderedCollection",
  174. smalltalk.method({
  175. selector: "asOrderedCollection",
  176. fn: function (){
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) { var $1;
  179. $1=_st(self)._asArray();
  180. return $1;
  181. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{}, smalltalk.Collection)})}
  182. }),
  183. smalltalk.Collection);
  184. smalltalk.addMethod(
  185. "_asSet",
  186. smalltalk.method({
  187. selector: "asSet",
  188. fn: function (){
  189. var self=this;
  190. return smalltalk.withContext(function($ctx1) { var $1;
  191. $1=_st((smalltalk.Set || Set))._withAll_(self);
  192. return $1;
  193. }, function($ctx1) {$ctx1.fill(self,"asSet",{}, smalltalk.Collection)})}
  194. }),
  195. smalltalk.Collection);
  196. smalltalk.addMethod(
  197. "_collect_",
  198. smalltalk.method({
  199. selector: "collect:",
  200. fn: function (aBlock){
  201. var self=this;
  202. var stream;
  203. return smalltalk.withContext(function($ctx1) { var $1;
  204. stream=_st(_st(_st(self)._class())._new())._writeStream();
  205. _st(self)._do_((function(each){
  206. return smalltalk.withContext(function($ctx2) { return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  208. $1=_st(stream)._contents();
  209. return $1;
  210. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})}
  211. }),
  212. smalltalk.Collection);
  213. smalltalk.addMethod(
  214. "_copyWith_",
  215. smalltalk.method({
  216. selector: "copyWith:",
  217. fn: function (anObject){
  218. var self=this;
  219. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  220. $2=_st(self)._copy();
  221. _st($2)._add_(anObject);
  222. $3=_st($2)._yourself();
  223. $1=$3;
  224. return $1;
  225. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject}, smalltalk.Collection)})}
  226. }),
  227. smalltalk.Collection);
  228. smalltalk.addMethod(
  229. "_copyWithAll_",
  230. smalltalk.method({
  231. selector: "copyWithAll:",
  232. fn: function (aCollection){
  233. var self=this;
  234. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  235. $2=_st(self)._copy();
  236. _st($2)._addAll_(aCollection);
  237. $3=_st($2)._yourself();
  238. $1=$3;
  239. return $1;
  240. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection}, smalltalk.Collection)})}
  241. }),
  242. smalltalk.Collection);
  243. smalltalk.addMethod(
  244. "_copyWithoutAll_",
  245. smalltalk.method({
  246. selector: "copyWithoutAll:",
  247. fn: function (aCollection){
  248. var self=this;
  249. return smalltalk.withContext(function($ctx1) { var $1;
  250. $1=_st(self)._reject_((function(each){
  251. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._includes_(each);
  252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  253. return $1;
  254. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection}, smalltalk.Collection)})}
  255. }),
  256. smalltalk.Collection);
  257. smalltalk.addMethod(
  258. "_detect_",
  259. smalltalk.method({
  260. selector: "detect:",
  261. fn: function (aBlock){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) { var $1;
  264. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  265. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  267. return $1;
  268. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Collection)})}
  269. }),
  270. smalltalk.Collection);
  271. smalltalk.addMethod(
  272. "_detect_ifNone_",
  273. smalltalk.method({
  274. selector: "detect:ifNone:",
  275. fn: function (aBlock,anotherBlock){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) {
  278. for(var i = 0; i < self.length; i++)
  279. if(aBlock(self[i]))
  280. return self[i];
  281. return anotherBlock();
  282. ;
  283. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Collection)})}
  284. }),
  285. smalltalk.Collection);
  286. smalltalk.addMethod(
  287. "_do_",
  288. smalltalk.method({
  289. selector: "do:",
  290. fn: function (aBlock){
  291. var self=this;
  292. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i]);};
  293. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Collection)})}
  294. }),
  295. smalltalk.Collection);
  296. smalltalk.addMethod(
  297. "_do_separatedBy_",
  298. smalltalk.method({
  299. selector: "do:separatedBy:",
  300. fn: function (aBlock,anotherBlock){
  301. var self=this;
  302. var first;
  303. return smalltalk.withContext(function($ctx1) { var $1,$3,$2;
  304. first=true;
  305. $1=self;
  306. $2=(function(each){
  307. return smalltalk.withContext(function($ctx2) { $3=first;
  308. if(smalltalk.assert($3)){
  309. first=false;
  310. first;
  311. } else {
  312. _st(anotherBlock)._value();
  313. };
  314. return _st(aBlock)._value_(each);
  315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  316. _st($1)._do_($2);
  317. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,first:first}, smalltalk.Collection)})}
  318. }),
  319. smalltalk.Collection);
  320. smalltalk.addMethod(
  321. "_errorNotFound",
  322. smalltalk.method({
  323. selector: "errorNotFound",
  324. fn: function (){
  325. var self=this;
  326. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is not in the collection");
  327. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{}, smalltalk.Collection)})}
  328. }),
  329. smalltalk.Collection);
  330. smalltalk.addMethod(
  331. "_ifEmpty_",
  332. smalltalk.method({
  333. selector: "ifEmpty:",
  334. fn: function (aBlock){
  335. var self=this;
  336. return smalltalk.withContext(function($ctx1) { var $2,$1;
  337. $2=_st(self)._isEmpty();
  338. if(smalltalk.assert($2)){
  339. $1=_st(aBlock)._value();
  340. } else {
  341. $1=self;
  342. };
  343. return $1;
  344. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock}, smalltalk.Collection)})}
  345. }),
  346. smalltalk.Collection);
  347. smalltalk.addMethod(
  348. "_ifNotEmpty_",
  349. smalltalk.method({
  350. selector: "ifNotEmpty:",
  351. fn: function (aBlock){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) { var $1;
  354. $1=_st(self)._notEmpty();
  355. _st($1)._ifTrue_(aBlock);
  356. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock}, smalltalk.Collection)})}
  357. }),
  358. smalltalk.Collection);
  359. smalltalk.addMethod(
  360. "_includes_",
  361. smalltalk.method({
  362. selector: "includes:",
  363. fn: function (anObject){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. var i = self.length;
  367. while (i--) {
  368. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  369. }
  370. return false
  371. ;
  372. return self}, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Collection)})}
  373. }),
  374. smalltalk.Collection);
  375. smalltalk.addMethod(
  376. "_inject_into_",
  377. smalltalk.method({
  378. selector: "inject:into:",
  379. fn: function (anObject,aBlock){
  380. var self=this;
  381. var result;
  382. return smalltalk.withContext(function($ctx1) { var $1;
  383. result=anObject;
  384. _st(self)._do_((function(each){
  385. return smalltalk.withContext(function($ctx2) { result=_st(aBlock)._value_value_(result,each);
  386. return result;
  387. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  388. $1=result;
  389. return $1;
  390. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result}, smalltalk.Collection)})}
  391. }),
  392. smalltalk.Collection);
  393. smalltalk.addMethod(
  394. "_intersection_",
  395. smalltalk.method({
  396. selector: "intersection:",
  397. fn: function (aCollection){
  398. var self=this;
  399. var set,outputSet;
  400. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  401. set=_st(self)._asSet();
  402. outputSet=_st((smalltalk.Set || Set))._new();
  403. $1=aCollection;
  404. $2=(function(each){
  405. return smalltalk.withContext(function($ctx2) { $3=_st(_st(set)._includes_(each))._and_((function(){
  406. return smalltalk.withContext(function($ctx3) { return _st(_st(outputSet)._includes_(each))._not();
  407. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  408. if(smalltalk.assert($3)){
  409. return _st(outputSet)._add_(each);
  410. };
  411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  412. _st($1)._do_($2);
  413. $4=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
  414. return $4;
  415. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet}, smalltalk.Collection)})}
  416. }),
  417. smalltalk.Collection);
  418. smalltalk.addMethod(
  419. "_isEmpty",
  420. smalltalk.method({
  421. selector: "isEmpty",
  422. fn: function (){
  423. var self=this;
  424. return smalltalk.withContext(function($ctx1) { var $1;
  425. $1=_st(_st(self)._size()).__eq((0));
  426. return $1;
  427. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Collection)})}
  428. }),
  429. smalltalk.Collection);
  430. smalltalk.addMethod(
  431. "_notEmpty",
  432. smalltalk.method({
  433. selector: "notEmpty",
  434. fn: function (){
  435. var self=this;
  436. return smalltalk.withContext(function($ctx1) { var $1;
  437. $1=_st(_st(self)._isEmpty())._not();
  438. return $1;
  439. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{}, smalltalk.Collection)})}
  440. }),
  441. smalltalk.Collection);
  442. smalltalk.addMethod(
  443. "_occurrencesOf_",
  444. smalltalk.method({
  445. selector: "occurrencesOf:",
  446. fn: function (anObject){
  447. var self=this;
  448. var tally;
  449. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  450. tally=(0);
  451. $1=self;
  452. $2=(function(each){
  453. return smalltalk.withContext(function($ctx2) { $3=_st(anObject).__eq(each);
  454. if(smalltalk.assert($3)){
  455. tally=_st(tally).__plus((1));
  456. return tally;
  457. };
  458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  459. _st($1)._do_($2);
  460. $4=tally;
  461. return $4;
  462. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally}, smalltalk.Collection)})}
  463. }),
  464. smalltalk.Collection);
  465. smalltalk.addMethod(
  466. "_printString",
  467. smalltalk.method({
  468. selector: "printString",
  469. fn: function (){
  470. var self=this;
  471. return smalltalk.withContext(function($ctx1) { var $1;
  472. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  473. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma(" ("));
  474. _st(self)._do_separatedBy_((function(each){
  475. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(_st(each)._printString());
  476. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  477. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" ");
  478. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  479. return _st(aStream)._nextPutAll_(")");
  480. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  481. return $1;
  482. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Collection)})}
  483. }),
  484. smalltalk.Collection);
  485. smalltalk.addMethod(
  486. "_readStream",
  487. smalltalk.method({
  488. selector: "readStream",
  489. fn: function (){
  490. var self=this;
  491. return smalltalk.withContext(function($ctx1) { var $1;
  492. $1=_st(self)._stream();
  493. return $1;
  494. }, function($ctx1) {$ctx1.fill(self,"readStream",{}, smalltalk.Collection)})}
  495. }),
  496. smalltalk.Collection);
  497. smalltalk.addMethod(
  498. "_reject_",
  499. smalltalk.method({
  500. selector: "reject:",
  501. fn: function (aBlock){
  502. var self=this;
  503. return smalltalk.withContext(function($ctx1) { var $1;
  504. $1=_st(self)._select_((function(each){
  505. return smalltalk.withContext(function($ctx2) { return _st(_st(aBlock)._value_(each)).__eq(false);
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  507. return $1;
  508. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock}, smalltalk.Collection)})}
  509. }),
  510. smalltalk.Collection);
  511. smalltalk.addMethod(
  512. "_remove_",
  513. smalltalk.method({
  514. selector: "remove:",
  515. fn: function (anObject){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) { var $1;
  518. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  519. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  521. return $1;
  522. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Collection)})}
  523. }),
  524. smalltalk.Collection);
  525. smalltalk.addMethod(
  526. "_remove_ifAbsent_",
  527. smalltalk.method({
  528. selector: "remove:ifAbsent:",
  529. fn: function (anObject,aBlock){
  530. var self=this;
  531. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  532. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Collection)})}
  533. }),
  534. smalltalk.Collection);
  535. smalltalk.addMethod(
  536. "_select_",
  537. smalltalk.method({
  538. selector: "select:",
  539. fn: function (aBlock){
  540. var self=this;
  541. var stream;
  542. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  543. stream=_st(_st(_st(self)._class())._new())._writeStream();
  544. $1=self;
  545. $2=(function(each){
  546. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(each);
  547. if(smalltalk.assert($3)){
  548. return _st(stream)._nextPut_(each);
  549. };
  550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  551. _st($1)._do_($2);
  552. $4=_st(stream)._contents();
  553. return $4;
  554. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})}
  555. }),
  556. smalltalk.Collection);
  557. smalltalk.addMethod(
  558. "_size",
  559. smalltalk.method({
  560. selector: "size",
  561. fn: function (){
  562. var self=this;
  563. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  564. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Collection)})}
  565. }),
  566. smalltalk.Collection);
  567. smalltalk.addMethod(
  568. "_stream",
  569. smalltalk.method({
  570. selector: "stream",
  571. fn: function (){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) { var $1;
  574. $1=_st(_st(self)._streamClass())._on_(self);
  575. return $1;
  576. }, function($ctx1) {$ctx1.fill(self,"stream",{}, smalltalk.Collection)})}
  577. }),
  578. smalltalk.Collection);
  579. smalltalk.addMethod(
  580. "_streamClass",
  581. smalltalk.method({
  582. selector: "streamClass",
  583. fn: function (){
  584. var self=this;
  585. return smalltalk.withContext(function($ctx1) { var $1;
  586. $1=_st(_st(self)._class())._streamClass();
  587. return $1;
  588. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection)})}
  589. }),
  590. smalltalk.Collection);
  591. smalltalk.addMethod(
  592. "_writeStream",
  593. smalltalk.method({
  594. selector: "writeStream",
  595. fn: function (){
  596. var self=this;
  597. return smalltalk.withContext(function($ctx1) { var $1;
  598. $1=_st(self)._stream();
  599. return $1;
  600. }, function($ctx1) {$ctx1.fill(self,"writeStream",{}, smalltalk.Collection)})}
  601. }),
  602. smalltalk.Collection);
  603. smalltalk.addMethod(
  604. "_new_",
  605. smalltalk.method({
  606. selector: "new:",
  607. fn: function (anInteger){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) { var $1;
  610. $1=_st(self)._new();
  611. return $1;
  612. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Collection.klass)})}
  613. }),
  614. smalltalk.Collection.klass);
  615. smalltalk.addMethod(
  616. "_streamClass",
  617. smalltalk.method({
  618. selector: "streamClass",
  619. fn: function (){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) { var $1;
  622. $1=(smalltalk.Stream || Stream);
  623. return $1;
  624. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection.klass)})}
  625. }),
  626. smalltalk.Collection.klass);
  627. smalltalk.addMethod(
  628. "_with_",
  629. smalltalk.method({
  630. selector: "with:",
  631. fn: function (anObject){
  632. var self=this;
  633. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  634. $2=_st(self)._new();
  635. _st($2)._add_(anObject);
  636. $3=_st($2)._yourself();
  637. $1=$3;
  638. return $1;
  639. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Collection.klass)})}
  640. }),
  641. smalltalk.Collection.klass);
  642. smalltalk.addMethod(
  643. "_with_with_",
  644. smalltalk.method({
  645. selector: "with:with:",
  646. fn: function (anObject,anotherObject){
  647. var self=this;
  648. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  649. $2=_st(self)._new();
  650. _st($2)._add_(anObject);
  651. _st($2)._add_(anotherObject);
  652. $3=_st($2)._yourself();
  653. $1=$3;
  654. return $1;
  655. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject}, smalltalk.Collection.klass)})}
  656. }),
  657. smalltalk.Collection.klass);
  658. smalltalk.addMethod(
  659. "_with_with_with_",
  660. smalltalk.method({
  661. selector: "with:with:with:",
  662. fn: function (firstObject,secondObject,thirdObject){
  663. var self=this;
  664. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  665. $2=_st(self)._new();
  666. _st($2)._add_(firstObject);
  667. _st($2)._add_(secondObject);
  668. _st($2)._add_(thirdObject);
  669. $3=_st($2)._yourself();
  670. $1=$3;
  671. return $1;
  672. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject}, smalltalk.Collection.klass)})}
  673. }),
  674. smalltalk.Collection.klass);
  675. smalltalk.addMethod(
  676. "_withAll_",
  677. smalltalk.method({
  678. selector: "withAll:",
  679. fn: function (aCollection){
  680. var self=this;
  681. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  682. $2=_st(self)._new();
  683. _st($2)._addAll_(aCollection);
  684. $3=_st($2)._yourself();
  685. $1=$3;
  686. return $1;
  687. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection}, smalltalk.Collection.klass)})}
  688. }),
  689. smalltalk.Collection.klass);
  690. smalltalk.addClass('HashedCollection', smalltalk.Collection, [], 'Kernel-Collections');
  691. smalltalk.addMethod(
  692. "__comma",
  693. smalltalk.method({
  694. selector: ",",
  695. fn: function (aCollection){
  696. var self=this;
  697. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  698. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.HashedCollection)})}
  699. }),
  700. smalltalk.HashedCollection);
  701. smalltalk.addMethod(
  702. "__eq",
  703. smalltalk.method({
  704. selector: "=",
  705. fn: function (aHashedCollection){
  706. var self=this;
  707. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  708. $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
  709. if(! smalltalk.assert($1)){
  710. return false;
  711. };
  712. $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
  713. if(! smalltalk.assert($2)){
  714. return false;
  715. };
  716. $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
  717. return $3;
  718. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})}
  719. }),
  720. smalltalk.HashedCollection);
  721. smalltalk.addMethod(
  722. "_add_",
  723. smalltalk.method({
  724. selector: "add:",
  725. fn: function (anAssociation){
  726. var self=this;
  727. return smalltalk.withContext(function($ctx1) { _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  728. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation}, smalltalk.HashedCollection)})}
  729. }),
  730. smalltalk.HashedCollection);
  731. smalltalk.addMethod(
  732. "_addAll_",
  733. smalltalk.method({
  734. selector: "addAll:",
  735. fn: function (aHashedCollection){
  736. var self=this;
  737. return smalltalk.withContext(function($ctx1) { var $1;
  738. smalltalk.Collection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  739. $1=aHashedCollection;
  740. return $1;
  741. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})}
  742. }),
  743. smalltalk.HashedCollection);
  744. smalltalk.addMethod(
  745. "_asDictionary",
  746. smalltalk.method({
  747. selector: "asDictionary",
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) { var $1;
  751. $1=_st((smalltalk.Dictionary || Dictionary))._fromPairs_(_st(self)._associations());
  752. return $1;
  753. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{}, smalltalk.HashedCollection)})}
  754. }),
  755. smalltalk.HashedCollection);
  756. smalltalk.addMethod(
  757. "_asJSON",
  758. smalltalk.method({
  759. selector: "asJSON",
  760. fn: function (){
  761. var self=this;
  762. var c;
  763. return smalltalk.withContext(function($ctx1) { var $1;
  764. c=_st(_st(self)._class())._new();
  765. _st(self)._keysAndValuesDo_((function(key,value){
  766. return smalltalk.withContext(function($ctx2) { return _st(c)._at_put_(key,_st(value)._asJSON());
  767. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  768. $1=c;
  769. return $1;
  770. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c}, smalltalk.HashedCollection)})}
  771. }),
  772. smalltalk.HashedCollection);
  773. smalltalk.addMethod(
  774. "_associations",
  775. smalltalk.method({
  776. selector: "associations",
  777. fn: function (){
  778. var self=this;
  779. var associations;
  780. return smalltalk.withContext(function($ctx1) { var $1;
  781. associations=[];
  782. _st(_st(self)._keys())._do_((function(each){
  783. return smalltalk.withContext(function($ctx2) { return _st(associations)._add_(_st((smalltalk.Association || Association))._key_value_(each,_st(self)._at_(each)));
  784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  785. $1=associations;
  786. return $1;
  787. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations}, smalltalk.HashedCollection)})}
  788. }),
  789. smalltalk.HashedCollection);
  790. smalltalk.addMethod(
  791. "_associationsDo_",
  792. smalltalk.method({
  793. selector: "associationsDo:",
  794. fn: function (aBlock){
  795. var self=this;
  796. return smalltalk.withContext(function($ctx1) { _st(_st(self)._associations())._do_(aBlock);
  797. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})}
  798. }),
  799. smalltalk.HashedCollection);
  800. smalltalk.addMethod(
  801. "_at_",
  802. smalltalk.method({
  803. selector: "at:",
  804. fn: function (aKey){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) { var $1;
  807. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  808. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  810. return $1;
  811. }, function($ctx1) {$ctx1.fill(self,"at:",{aKey:aKey}, smalltalk.HashedCollection)})}
  812. }),
  813. smalltalk.HashedCollection);
  814. smalltalk.addMethod(
  815. "_at_ifAbsent_",
  816. smalltalk.method({
  817. selector: "at:ifAbsent:",
  818. fn: function (aKey,aBlock){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) { var $2,$1;
  821. $2=_st(self)._includesKey_(aKey);
  822. $1=_st($2)._ifTrue_ifFalse_((function(){
  823. return smalltalk.withContext(function($ctx2) { return _st(self)._basicAt_(aKey);
  824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  825. return $1;
  826. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})}
  827. }),
  828. smalltalk.HashedCollection);
  829. smalltalk.addMethod(
  830. "_at_ifAbsentPut_",
  831. smalltalk.method({
  832. selector: "at:ifAbsentPut:",
  833. fn: function (aKey,aBlock){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) { var $1;
  836. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  837. return smalltalk.withContext(function($ctx2) { return _st(self)._at_put_(aKey,_st(aBlock)._value());
  838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  839. return $1;
  840. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})}
  841. }),
  842. smalltalk.HashedCollection);
  843. smalltalk.addMethod(
  844. "_at_ifPresent_",
  845. smalltalk.method({
  846. selector: "at:ifPresent:",
  847. fn: function (aKey,aBlock){
  848. var self=this;
  849. return smalltalk.withContext(function($ctx1) { var $2,$1;
  850. $2=_st(self)._includesKey_(aKey);
  851. if(smalltalk.assert($2)){
  852. $1=_st(aBlock)._value_(_st(self)._at_(aKey));
  853. } else {
  854. $1=nil;
  855. };
  856. return $1;
  857. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})}
  858. }),
  859. smalltalk.HashedCollection);
  860. smalltalk.addMethod(
  861. "_at_ifPresent_ifAbsent_",
  862. smalltalk.method({
  863. selector: "at:ifPresent:ifAbsent:",
  864. fn: function (aKey,aBlock,anotherBlock){
  865. var self=this;
  866. return smalltalk.withContext(function($ctx1) { var $2,$1;
  867. $2=_st(self)._includesKey_(aKey);
  868. $1=_st($2)._ifTrue_ifFalse_((function(){
  869. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._at_(aKey));
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  871. return $1;
  872. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})}
  873. }),
  874. smalltalk.HashedCollection);
  875. smalltalk.addMethod(
  876. "_at_put_",
  877. smalltalk.method({
  878. selector: "at:put:",
  879. fn: function (aKey,aValue){
  880. var self=this;
  881. return smalltalk.withContext(function($ctx1) { var $1;
  882. $1=_st(self)._basicAt_put_(aKey,aValue);
  883. return $1;
  884. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.HashedCollection)})}
  885. }),
  886. smalltalk.HashedCollection);
  887. smalltalk.addMethod(
  888. "_collect_",
  889. smalltalk.method({
  890. selector: "collect:",
  891. fn: function (aBlock){
  892. var self=this;
  893. var newDict;
  894. return smalltalk.withContext(function($ctx1) { var $1;
  895. newDict=_st(_st(self)._class())._new();
  896. _st(self)._keysAndValuesDo_((function(key,value){
  897. return smalltalk.withContext(function($ctx2) { return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  898. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  899. $1=newDict;
  900. return $1;
  901. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})}
  902. }),
  903. smalltalk.HashedCollection);
  904. smalltalk.addMethod(
  905. "_copyFrom_to_",
  906. smalltalk.method({
  907. selector: "copyFrom:to:",
  908. fn: function (anIndex,anotherIndex){
  909. var self=this;
  910. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  911. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.HashedCollection)})}
  912. }),
  913. smalltalk.HashedCollection);
  914. smalltalk.addMethod(
  915. "_deepCopy",
  916. smalltalk.method({
  917. selector: "deepCopy",
  918. fn: function (){
  919. var self=this;
  920. var copy;
  921. return smalltalk.withContext(function($ctx1) { var $1;
  922. copy=_st(_st(self)._class())._new();
  923. _st(self)._associationsDo_((function(each){
  924. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(_st(each)._value())._deepCopy());
  925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  926. $1=copy;
  927. return $1;
  928. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy}, smalltalk.HashedCollection)})}
  929. }),
  930. smalltalk.HashedCollection);
  931. smalltalk.addMethod(
  932. "_detect_ifNone_",
  933. smalltalk.method({
  934. selector: "detect:ifNone:",
  935. fn: function (aBlock,anotherBlock){
  936. var self=this;
  937. return smalltalk.withContext(function($ctx1) { var $1;
  938. $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
  939. return $1;
  940. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})}
  941. }),
  942. smalltalk.HashedCollection);
  943. smalltalk.addMethod(
  944. "_do_",
  945. smalltalk.method({
  946. selector: "do:",
  947. fn: function (aBlock){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) { _st(_st(self)._values())._do_(aBlock);
  950. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.HashedCollection)})}
  951. }),
  952. smalltalk.HashedCollection);
  953. smalltalk.addMethod(
  954. "_includes_",
  955. smalltalk.method({
  956. selector: "includes:",
  957. fn: function (anObject){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) { var $1;
  960. $1=_st(_st(self)._values())._includes_(anObject);
  961. return $1;
  962. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.HashedCollection)})}
  963. }),
  964. smalltalk.HashedCollection);
  965. smalltalk.addMethod(
  966. "_includesKey_",
  967. smalltalk.method({
  968. selector: "includesKey:",
  969. fn: function (aKey){
  970. var self=this;
  971. return smalltalk.withContext(function($ctx1) { return self.hasOwnProperty(aKey);
  972. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.HashedCollection)})}
  973. }),
  974. smalltalk.HashedCollection);
  975. smalltalk.addMethod(
  976. "_keys",
  977. smalltalk.method({
  978. selector: "keys",
  979. fn: function (){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. if ('function'===typeof Object.keys) return Object.keys(self);
  983. var keys = [];
  984. for(var i in self) {
  985. if(self.hasOwnProperty(i)) {
  986. keys.push(i);
  987. }
  988. };
  989. return keys;
  990. ;
  991. return self}, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.HashedCollection)})}
  992. }),
  993. smalltalk.HashedCollection);
  994. smalltalk.addMethod(
  995. "_keysAndValuesDo_",
  996. smalltalk.method({
  997. selector: "keysAndValuesDo:",
  998. fn: function (aBlock){
  999. var self=this;
  1000. return smalltalk.withContext(function($ctx1) { _st(self)._associationsDo_((function(each){
  1001. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(_st(each)._key(),_st(each)._value());
  1002. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1003. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})}
  1004. }),
  1005. smalltalk.HashedCollection);
  1006. smalltalk.addMethod(
  1007. "_printString",
  1008. smalltalk.method({
  1009. selector: "printString",
  1010. fn: function (){
  1011. var self=this;
  1012. return smalltalk.withContext(function($ctx1) { var $1;
  1013. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  1014. return smalltalk.withContext(function($ctx2) { _st(aStream)._nextPutAll_(_st(_st("a ").__comma(_st(_st(self)._class())._name())).__comma("("));
  1015. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1016. return smalltalk.withContext(function($ctx3) { return _st(each)._storeOn_(aStream);
  1017. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  1018. return smalltalk.withContext(function($ctx3) { return _st(aStream)._nextPutAll_(" , ");
  1019. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1020. return _st(aStream)._nextPutAll_(")");
  1021. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  1022. return $1;
  1023. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HashedCollection)})}
  1024. }),
  1025. smalltalk.HashedCollection);
  1026. smalltalk.addMethod(
  1027. "_remove_ifAbsent_",
  1028. smalltalk.method({
  1029. selector: "remove:ifAbsent:",
  1030. fn: function (aKey,aBlock){
  1031. var self=this;
  1032. return smalltalk.withContext(function($ctx1) { var $1;
  1033. $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
  1034. return $1;
  1035. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})}
  1036. }),
  1037. smalltalk.HashedCollection);
  1038. smalltalk.addMethod(
  1039. "_removeKey_",
  1040. smalltalk.method({
  1041. selector: "removeKey:",
  1042. fn: function (aKey){
  1043. var self=this;
  1044. return smalltalk.withContext(function($ctx1) { var $1;
  1045. $1=_st(self)._remove_(aKey);
  1046. return $1;
  1047. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey}, smalltalk.HashedCollection)})}
  1048. }),
  1049. smalltalk.HashedCollection);
  1050. smalltalk.addMethod(
  1051. "_removeKey_ifAbsent_",
  1052. smalltalk.method({
  1053. selector: "removeKey:ifAbsent:",
  1054. fn: function (aKey,aBlock){
  1055. var self=this;
  1056. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1057. $2=_st(self)._includesKey_(aKey);
  1058. if(smalltalk.assert($2)){
  1059. $1=_st(self)._basicDelete_(aKey);
  1060. } else {
  1061. $1=_st(aBlock)._value();
  1062. };
  1063. return $1;
  1064. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})}
  1065. }),
  1066. smalltalk.HashedCollection);
  1067. smalltalk.addMethod(
  1068. "_select_",
  1069. smalltalk.method({
  1070. selector: "select:",
  1071. fn: function (aBlock){
  1072. var self=this;
  1073. var newDict;
  1074. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  1075. newDict=_st(_st(self)._class())._new();
  1076. $1=self;
  1077. $2=(function(key,value){
  1078. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(value);
  1079. if(smalltalk.assert($3)){
  1080. return _st(newDict)._at_put_(key,value);
  1081. };
  1082. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})});
  1083. _st($1)._keysAndValuesDo_($2);
  1084. $4=newDict;
  1085. return $4;
  1086. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})}
  1087. }),
  1088. smalltalk.HashedCollection);
  1089. smalltalk.addMethod(
  1090. "_shallowCopy",
  1091. smalltalk.method({
  1092. selector: "shallowCopy",
  1093. fn: function (){
  1094. var self=this;
  1095. var copy;
  1096. return smalltalk.withContext(function($ctx1) { var $1;
  1097. copy=_st(_st(self)._class())._new();
  1098. _st(self)._associationsDo_((function(each){
  1099. return smalltalk.withContext(function($ctx2) { return _st(copy)._at_put_(_st(each)._key(),_st(each)._value());
  1100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1101. $1=copy;
  1102. return $1;
  1103. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy}, smalltalk.HashedCollection)})}
  1104. }),
  1105. smalltalk.HashedCollection);
  1106. smalltalk.addMethod(
  1107. "_size",
  1108. smalltalk.method({
  1109. selector: "size",
  1110. fn: function (){
  1111. var self=this;
  1112. return smalltalk.withContext(function($ctx1) { var $1;
  1113. $1=_st(_st(self)._keys())._size();
  1114. return $1;
  1115. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.HashedCollection)})}
  1116. }),
  1117. smalltalk.HashedCollection);
  1118. smalltalk.addMethod(
  1119. "_storeOn_",
  1120. smalltalk.method({
  1121. selector: "storeOn:",
  1122. fn: function (aStream){
  1123. var self=this;
  1124. return smalltalk.withContext(function($ctx1) { _st(aStream)._nextPutAll_("#{");
  1125. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1126. return smalltalk.withContext(function($ctx2) { return _st(each)._storeOn_(aStream);
  1127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  1128. return smalltalk.withContext(function($ctx2) { return _st(aStream)._nextPutAll_(". ");
  1129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1130. _st(aStream)._nextPutAll_("}");
  1131. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.HashedCollection)})}
  1132. }),
  1133. smalltalk.HashedCollection);
  1134. smalltalk.addMethod(
  1135. "_values",
  1136. smalltalk.method({
  1137. selector: "values",
  1138. fn: function (){
  1139. var self=this;
  1140. return smalltalk.withContext(function($ctx1) { var $1;
  1141. $1=_st(_st(self)._keys())._collect_((function(each){
  1142. return smalltalk.withContext(function($ctx2) { return _st(self)._at_(each);
  1143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1144. return $1;
  1145. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.HashedCollection)})}
  1146. }),
  1147. smalltalk.HashedCollection);
  1148. smalltalk.addMethod(
  1149. "_fromPairs_",
  1150. smalltalk.method({
  1151. selector: "fromPairs:",
  1152. fn: function (aCollection){
  1153. var self=this;
  1154. var dict;
  1155. return smalltalk.withContext(function($ctx1) { var $1;
  1156. dict=_st(self)._new();
  1157. _st(aCollection)._do_((function(each){
  1158. return smalltalk.withContext(function($ctx2) { return _st(dict)._add_(each);
  1159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1160. $1=dict;
  1161. return $1;
  1162. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict}, smalltalk.HashedCollection.klass)})}
  1163. }),
  1164. smalltalk.HashedCollection.klass);
  1165. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  1166. smalltalk.addMethod(
  1167. "_asHashedCollection",
  1168. smalltalk.method({
  1169. selector: "asHashedCollection",
  1170. fn: function (){
  1171. var self=this;
  1172. return smalltalk.withContext(function($ctx1) { var $1;
  1173. $1=_st((smalltalk.HashedCollection || HashedCollection))._fromPairs_(_st(self)._associations());
  1174. return $1;
  1175. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{}, smalltalk.Dictionary)})}
  1176. }),
  1177. smalltalk.Dictionary);
  1178. smalltalk.addMethod(
  1179. "_asJSON",
  1180. smalltalk.method({
  1181. selector: "asJSON",
  1182. fn: function (){
  1183. var self=this;
  1184. return smalltalk.withContext(function($ctx1) { var $1;
  1185. $1=_st(_st(self)._asHashedCollection())._asJSON();
  1186. return $1;
  1187. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Dictionary)})}
  1188. }),
  1189. smalltalk.Dictionary);
  1190. smalltalk.addMethod(
  1191. "_at_ifAbsent_",
  1192. smalltalk.method({
  1193. selector: "at:ifAbsent:",
  1194. fn: function (aKey,aBlock){
  1195. var self=this;
  1196. return smalltalk.withContext(function($ctx1) {
  1197. var index;
  1198. for(var i=0;i<self['@keys'].length;i++){
  1199. if(self['@keys'][i].__eq(aKey)) {index = i;}
  1200. };
  1201. if(typeof index === 'undefined') {
  1202. return aBlock();
  1203. } else {
  1204. return self['@values'][index];
  1205. }
  1206. ;
  1207. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})}
  1208. }),
  1209. smalltalk.Dictionary);
  1210. smalltalk.addMethod(
  1211. "_at_put_",
  1212. smalltalk.method({
  1213. selector: "at:put:",
  1214. fn: function (aKey,aValue){
  1215. var self=this;
  1216. return smalltalk.withContext(function($ctx1) {
  1217. var index = self['@keys'].indexOf(aKey);
  1218. if(index === -1) {
  1219. self['@values'].push(aValue);
  1220. self['@keys'].push(aKey);
  1221. } else {
  1222. self['@values'][index] = aValue;
  1223. };
  1224. return aValue;
  1225. ;
  1226. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.Dictionary)})}
  1227. }),
  1228. smalltalk.Dictionary);
  1229. smalltalk.addMethod(
  1230. "_includesKey_",
  1231. smalltalk.method({
  1232. selector: "includesKey:",
  1233. fn: function (aKey){
  1234. var self=this;
  1235. return smalltalk.withContext(function($ctx1) { var $1;
  1236. $1=_st(self["@keys"])._includes_(aKey);
  1237. return $1;
  1238. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.Dictionary)})}
  1239. }),
  1240. smalltalk.Dictionary);
  1241. smalltalk.addMethod(
  1242. "_initialize",
  1243. smalltalk.method({
  1244. selector: "initialize",
  1245. fn: function (){
  1246. var self=this;
  1247. return smalltalk.withContext(function($ctx1) { smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  1248. self["@keys"]=[];
  1249. self["@values"]=[];
  1250. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Dictionary)})}
  1251. }),
  1252. smalltalk.Dictionary);
  1253. smalltalk.addMethod(
  1254. "_keyAtValue_",
  1255. smalltalk.method({
  1256. selector: "keyAtValue:",
  1257. fn: function (anObject){
  1258. var self=this;
  1259. return smalltalk.withContext(function($ctx1) { var $1;
  1260. $1=_st(_st(_st(self)._associations())._detect_ifNone_((function(k,v){
  1261. return smalltalk.withContext(function($ctx2) { return _st(v).__eq_eq(anObject);
  1262. }, function($ctx2) {$ctx2.fillBlock({k:k,v:v},$ctx1)})}),(function(){
  1263. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Not found");
  1264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._key();
  1265. return $1;
  1266. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject}, smalltalk.Dictionary)})}
  1267. }),
  1268. smalltalk.Dictionary);
  1269. smalltalk.addMethod(
  1270. "_keys",
  1271. smalltalk.method({
  1272. selector: "keys",
  1273. fn: function (){
  1274. var self=this;
  1275. return smalltalk.withContext(function($ctx1) { var $1;
  1276. $1=_st(self["@keys"])._copy();
  1277. return $1;
  1278. }, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.Dictionary)})}
  1279. }),
  1280. smalltalk.Dictionary);
  1281. smalltalk.addMethod(
  1282. "_removeKey_ifAbsent_",
  1283. smalltalk.method({
  1284. selector: "removeKey:ifAbsent:",
  1285. fn: function (aKey,aBlock){
  1286. var self=this;
  1287. return smalltalk.withContext(function($ctx1) {
  1288. var index = self['@keys'].indexOf(aKey);
  1289. if(index === -1) {
  1290. return aBlock()
  1291. } else {
  1292. var value;
  1293. self['@keys'].splice(index, 1);
  1294. value = self['@values'].splice(index, 1);
  1295. return value[0];
  1296. };
  1297. ;
  1298. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})}
  1299. }),
  1300. smalltalk.Dictionary);
  1301. smalltalk.addMethod(
  1302. "_valueAt_",
  1303. smalltalk.method({
  1304. selector: "valueAt:",
  1305. fn: function (anObject){
  1306. var self=this;
  1307. return smalltalk.withContext(function($ctx1) { var $1;
  1308. $1=_st(self)._associationsDo_((2));
  1309. return $1;
  1310. }, function($ctx1) {$ctx1.fill(self,"valueAt:",{anObject:anObject}, smalltalk.Dictionary)})}
  1311. }),
  1312. smalltalk.Dictionary);
  1313. smalltalk.addMethod(
  1314. "_values",
  1315. smalltalk.method({
  1316. selector: "values",
  1317. fn: function (){
  1318. var self=this;
  1319. return smalltalk.withContext(function($ctx1) { var $1;
  1320. $1=_st(self["@values"])._copy();
  1321. return $1;
  1322. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.Dictionary)})}
  1323. }),
  1324. smalltalk.Dictionary);
  1325. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  1326. smalltalk.addMethod(
  1327. "__eq",
  1328. smalltalk.method({
  1329. selector: "=",
  1330. fn: function (aCollection){
  1331. var self=this;
  1332. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  1333. var $early={};
  1334. try {
  1335. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  1336. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._size()).__eq(_st(aCollection)._size());
  1337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1338. if(! smalltalk.assert($1)){
  1339. return false;
  1340. };
  1341. $2=self;
  1342. $3=(function(each,i){
  1343. return smalltalk.withContext(function($ctx2) { $4=_st(_st(aCollection)._at_(i)).__eq(each);
  1344. if(! smalltalk.assert($4)){
  1345. throw $early=[false];
  1346. };
  1347. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})});
  1348. _st($2)._withIndexDo_($3);
  1349. return true;
  1350. }
  1351. catch(e) {if(e===$early)return e[0]; throw e}
  1352. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.SequenceableCollection)})}
  1353. }),
  1354. smalltalk.SequenceableCollection);
  1355. smalltalk.addMethod(
  1356. "_addLast_",
  1357. smalltalk.method({
  1358. selector: "addLast:",
  1359. fn: function (anObject){
  1360. var self=this;
  1361. return smalltalk.withContext(function($ctx1) { _st(self)._add_(anObject);
  1362. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject}, smalltalk.SequenceableCollection)})}
  1363. }),
  1364. smalltalk.SequenceableCollection);
  1365. smalltalk.addMethod(
  1366. "_allButFirst",
  1367. smalltalk.method({
  1368. selector: "allButFirst",
  1369. fn: function (){
  1370. var self=this;
  1371. return smalltalk.withContext(function($ctx1) { var $1;
  1372. $1=_st(self)._copyFrom_to_((2),_st(self)._size());
  1373. return $1;
  1374. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{}, smalltalk.SequenceableCollection)})}
  1375. }),
  1376. smalltalk.SequenceableCollection);
  1377. smalltalk.addMethod(
  1378. "_allButLast",
  1379. smalltalk.method({
  1380. selector: "allButLast",
  1381. fn: function (){
  1382. var self=this;
  1383. return smalltalk.withContext(function($ctx1) { var $1;
  1384. $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
  1385. return $1;
  1386. }, function($ctx1) {$ctx1.fill(self,"allButLast",{}, smalltalk.SequenceableCollection)})}
  1387. }),
  1388. smalltalk.SequenceableCollection);
  1389. smalltalk.addMethod(
  1390. "_at_",
  1391. smalltalk.method({
  1392. selector: "at:",
  1393. fn: function (anIndex){
  1394. var self=this;
  1395. return smalltalk.withContext(function($ctx1) { var $1;
  1396. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  1397. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  1398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1399. return $1;
  1400. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex}, smalltalk.SequenceableCollection)})}
  1401. }),
  1402. smalltalk.SequenceableCollection);
  1403. smalltalk.addMethod(
  1404. "_at_ifAbsent_",
  1405. smalltalk.method({
  1406. selector: "at:ifAbsent:",
  1407. fn: function (anIndex,aBlock){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  1410. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.SequenceableCollection)})}
  1411. }),
  1412. smalltalk.SequenceableCollection);
  1413. smalltalk.addMethod(
  1414. "_at_put_",
  1415. smalltalk.method({
  1416. selector: "at:put:",
  1417. fn: function (anIndex,anObject){
  1418. var self=this;
  1419. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  1420. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.SequenceableCollection)})}
  1421. }),
  1422. smalltalk.SequenceableCollection);
  1423. smalltalk.addMethod(
  1424. "_atRandom",
  1425. smalltalk.method({
  1426. selector: "atRandom",
  1427. fn: function (){
  1428. var self=this;
  1429. return smalltalk.withContext(function($ctx1) { var $1;
  1430. $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
  1431. return $1;
  1432. }, function($ctx1) {$ctx1.fill(self,"atRandom",{}, smalltalk.SequenceableCollection)})}
  1433. }),
  1434. smalltalk.SequenceableCollection);
  1435. smalltalk.addMethod(
  1436. "_copyFrom_to_",
  1437. smalltalk.method({
  1438. selector: "copyFrom:to:",
  1439. fn: function (anIndex,anotherIndex){
  1440. var self=this;
  1441. var range,newCollection;
  1442. return smalltalk.withContext(function($ctx1) { var $1;
  1443. range=_st(anIndex)._to_(anotherIndex);
  1444. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  1445. _st(range)._withIndexDo_((function(each,i){
  1446. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  1447. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  1448. $1=newCollection;
  1449. return $1;
  1450. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection}, smalltalk.SequenceableCollection)})}
  1451. }),
  1452. smalltalk.SequenceableCollection);
  1453. smalltalk.addMethod(
  1454. "_deepCopy",
  1455. smalltalk.method({
  1456. selector: "deepCopy",
  1457. fn: function (){
  1458. var self=this;
  1459. var newCollection;
  1460. return smalltalk.withContext(function($ctx1) { var $1;
  1461. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  1462. _st(self)._withIndexDo_((function(each,index){
  1463. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  1464. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1465. $1=newCollection;
  1466. return $1;
  1467. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})}
  1468. }),
  1469. smalltalk.SequenceableCollection);
  1470. smalltalk.addMethod(
  1471. "_first",
  1472. smalltalk.method({
  1473. selector: "first",
  1474. fn: function (){
  1475. var self=this;
  1476. return smalltalk.withContext(function($ctx1) { var $1;
  1477. $1=_st(self)._at_((1));
  1478. return $1;
  1479. }, function($ctx1) {$ctx1.fill(self,"first",{}, smalltalk.SequenceableCollection)})}
  1480. }),
  1481. smalltalk.SequenceableCollection);
  1482. smalltalk.addMethod(
  1483. "_first_",
  1484. smalltalk.method({
  1485. selector: "first:",
  1486. fn: function (n){
  1487. var self=this;
  1488. return smalltalk.withContext(function($ctx1) { var $1;
  1489. $1=_st(self)._copyFrom_to_((1),n);
  1490. return $1;
  1491. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n}, smalltalk.SequenceableCollection)})}
  1492. }),
  1493. smalltalk.SequenceableCollection);
  1494. smalltalk.addMethod(
  1495. "_fourth",
  1496. smalltalk.method({
  1497. selector: "fourth",
  1498. fn: function (){
  1499. var self=this;
  1500. return smalltalk.withContext(function($ctx1) { var $1;
  1501. $1=_st(self)._at_((4));
  1502. return $1;
  1503. }, function($ctx1) {$ctx1.fill(self,"fourth",{}, smalltalk.SequenceableCollection)})}
  1504. }),
  1505. smalltalk.SequenceableCollection);
  1506. smalltalk.addMethod(
  1507. "_indexOf_",
  1508. smalltalk.method({
  1509. selector: "indexOf:",
  1510. fn: function (anObject){
  1511. var self=this;
  1512. return smalltalk.withContext(function($ctx1) { var $1;
  1513. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  1514. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  1515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1516. return $1;
  1517. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject}, smalltalk.SequenceableCollection)})}
  1518. }),
  1519. smalltalk.SequenceableCollection);
  1520. smalltalk.addMethod(
  1521. "_indexOf_ifAbsent_",
  1522. smalltalk.method({
  1523. selector: "indexOf:ifAbsent:",
  1524. fn: function (anObject,aBlock){
  1525. var self=this;
  1526. return smalltalk.withContext(function($ctx1) {
  1527. for(var i=0;i<self.length;i++) {
  1528. if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
  1529. };
  1530. return aBlock();
  1531. ;
  1532. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.SequenceableCollection)})}
  1533. }),
  1534. smalltalk.SequenceableCollection);
  1535. smalltalk.addMethod(
  1536. "_indexOf_startingAt_",
  1537. smalltalk.method({
  1538. selector: "indexOf:startingAt:",
  1539. fn: function (anObject,start){
  1540. var self=this;
  1541. return smalltalk.withContext(function($ctx1) { var $1;
  1542. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  1543. return smalltalk.withContext(function($ctx2) { return (0);
  1544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1545. return $1;
  1546. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start}, smalltalk.SequenceableCollection)})}
  1547. }),
  1548. smalltalk.SequenceableCollection);
  1549. smalltalk.addMethod(
  1550. "_indexOf_startingAt_ifAbsent_",
  1551. smalltalk.method({
  1552. selector: "indexOf:startingAt:ifAbsent:",
  1553. fn: function (anObject,start,aBlock){
  1554. var self=this;
  1555. return smalltalk.withContext(function($ctx1) {
  1556. for(var i=start-1;i<self.length;i++){
  1557. if(self[i].__eq(anObject)) {return i+1}
  1558. }
  1559. return aBlock();
  1560. ;
  1561. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock}, smalltalk.SequenceableCollection)})}
  1562. }),
  1563. smalltalk.SequenceableCollection);
  1564. smalltalk.addMethod(
  1565. "_last",
  1566. smalltalk.method({
  1567. selector: "last",
  1568. fn: function (){
  1569. var self=this;
  1570. return smalltalk.withContext(function($ctx1) { var $1;
  1571. $1=_st(self)._at_(_st(self)._size());
  1572. return $1;
  1573. }, function($ctx1) {$ctx1.fill(self,"last",{}, smalltalk.SequenceableCollection)})}
  1574. }),
  1575. smalltalk.SequenceableCollection);
  1576. smalltalk.addMethod(
  1577. "_removeLast",
  1578. smalltalk.method({
  1579. selector: "removeLast",
  1580. fn: function (){
  1581. var self=this;
  1582. return smalltalk.withContext(function($ctx1) { _st(self)._remove_(_st(self)._last());
  1583. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{}, smalltalk.SequenceableCollection)})}
  1584. }),
  1585. smalltalk.SequenceableCollection);
  1586. smalltalk.addMethod(
  1587. "_reversed",
  1588. smalltalk.method({
  1589. selector: "reversed",
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  1593. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.SequenceableCollection)})}
  1594. }),
  1595. smalltalk.SequenceableCollection);
  1596. smalltalk.addMethod(
  1597. "_second",
  1598. smalltalk.method({
  1599. selector: "second",
  1600. fn: function (){
  1601. var self=this;
  1602. return smalltalk.withContext(function($ctx1) { var $1;
  1603. $1=_st(self)._at_((2));
  1604. return $1;
  1605. }, function($ctx1) {$ctx1.fill(self,"second",{}, smalltalk.SequenceableCollection)})}
  1606. }),
  1607. smalltalk.SequenceableCollection);
  1608. smalltalk.addMethod(
  1609. "_shallowCopy",
  1610. smalltalk.method({
  1611. selector: "shallowCopy",
  1612. fn: function (){
  1613. var self=this;
  1614. var newCollection;
  1615. return smalltalk.withContext(function($ctx1) { var $1;
  1616. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  1617. _st(self)._withIndexDo_((function(each,index){
  1618. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,each);
  1619. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  1620. $1=newCollection;
  1621. return $1;
  1622. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})}
  1623. }),
  1624. smalltalk.SequenceableCollection);
  1625. smalltalk.addMethod(
  1626. "_third",
  1627. smalltalk.method({
  1628. selector: "third",
  1629. fn: function (){
  1630. var self=this;
  1631. return smalltalk.withContext(function($ctx1) { var $1;
  1632. $1=_st(self)._at_((3));
  1633. return $1;
  1634. }, function($ctx1) {$ctx1.fill(self,"third",{}, smalltalk.SequenceableCollection)})}
  1635. }),
  1636. smalltalk.SequenceableCollection);
  1637. smalltalk.addMethod(
  1638. "_withIndexDo_",
  1639. smalltalk.method({
  1640. selector: "withIndexDo:",
  1641. fn: function (aBlock){
  1642. var self=this;
  1643. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  1644. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.SequenceableCollection)})}
  1645. }),
  1646. smalltalk.SequenceableCollection);
  1647. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1648. smalltalk.addMethod(
  1649. "_add_",
  1650. smalltalk.method({
  1651. selector: "add:",
  1652. fn: function (anObject){
  1653. var self=this;
  1654. return smalltalk.withContext(function($ctx1) { self.push(anObject); return anObject;;
  1655. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Array)})}
  1656. }),
  1657. smalltalk.Array);
  1658. smalltalk.addMethod(
  1659. "_asJavascript",
  1660. smalltalk.method({
  1661. selector: "asJavascript",
  1662. fn: function (){
  1663. var self=this;
  1664. return smalltalk.withContext(function($ctx1) { var $1;
  1665. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  1666. return smalltalk.withContext(function($ctx2) { return _st(each)._asJavascript();
  1667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  1668. return $1;
  1669. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Array)})}
  1670. }),
  1671. smalltalk.Array);
  1672. smalltalk.addMethod(
  1673. "_at_ifAbsent_",
  1674. smalltalk.method({
  1675. selector: "at:ifAbsent:",
  1676. fn: function (anIndex,aBlock){
  1677. var self=this;
  1678. return smalltalk.withContext(function($ctx1) {
  1679. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  1680. return self[anIndex - 1];
  1681. ;
  1682. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Array)})}
  1683. }),
  1684. smalltalk.Array);
  1685. smalltalk.addMethod(
  1686. "_at_put_",
  1687. smalltalk.method({
  1688. selector: "at:put:",
  1689. fn: function (anIndex,anObject){
  1690. var self=this;
  1691. return smalltalk.withContext(function($ctx1) { return self[anIndex - 1] = anObject;
  1692. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.Array)})}
  1693. }),
  1694. smalltalk.Array);
  1695. smalltalk.addMethod(
  1696. "_join_",
  1697. smalltalk.method({
  1698. selector: "join:",
  1699. fn: function (aString){
  1700. var self=this;
  1701. return smalltalk.withContext(function($ctx1) { return self.join(aString);
  1702. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString}, smalltalk.Array)})}
  1703. }),
  1704. smalltalk.Array);
  1705. smalltalk.addMethod(
  1706. "_remove_ifAbsent_",
  1707. smalltalk.method({
  1708. selector: "remove:ifAbsent:",
  1709. fn: function (anObject,aBlock){
  1710. var self=this;
  1711. return smalltalk.withContext(function($ctx1) {
  1712. for(var i=0;i<self.length;i++) {
  1713. if(self[i] == anObject) {
  1714. self.splice(i,1);
  1715. return self;
  1716. }
  1717. };
  1718. aBlock._value();
  1719. ;
  1720. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Array)})}
  1721. }),
  1722. smalltalk.Array);
  1723. smalltalk.addMethod(
  1724. "_removeFrom_to_",
  1725. smalltalk.method({
  1726. selector: "removeFrom:to:",
  1727. fn: function (aNumber,anotherNumber){
  1728. var self=this;
  1729. return smalltalk.withContext(function($ctx1) { self.splice(aNumber - 1,anotherNumber - 1);
  1730. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber}, smalltalk.Array)})}
  1731. }),
  1732. smalltalk.Array);
  1733. smalltalk.addMethod(
  1734. "_reversed",
  1735. smalltalk.method({
  1736. selector: "reversed",
  1737. fn: function (){
  1738. var self=this;
  1739. return smalltalk.withContext(function($ctx1) { return self._copy().reverse();
  1740. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.Array)})}
  1741. }),
  1742. smalltalk.Array);
  1743. smalltalk.addMethod(
  1744. "_size",
  1745. smalltalk.method({
  1746. selector: "size",
  1747. fn: function (){
  1748. var self=this;
  1749. return smalltalk.withContext(function($ctx1) { return self.length;
  1750. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Array)})}
  1751. }),
  1752. smalltalk.Array);
  1753. smalltalk.addMethod(
  1754. "_sort",
  1755. smalltalk.method({
  1756. selector: "sort",
  1757. fn: function (){
  1758. var self=this;
  1759. return smalltalk.withContext(function($ctx1) { var $1;
  1760. $1=_st(self)._basicPerform_("sort");
  1761. return $1;
  1762. }, function($ctx1) {$ctx1.fill(self,"sort",{}, smalltalk.Array)})}
  1763. }),
  1764. smalltalk.Array);
  1765. smalltalk.addMethod(
  1766. "_sort_",
  1767. smalltalk.method({
  1768. selector: "sort:",
  1769. fn: function (aBlock){
  1770. var self=this;
  1771. return smalltalk.withContext(function($ctx1) {
  1772. return self.sort(function(a, b) {
  1773. if(aBlock(a,b)) {return -1} else {return 1}
  1774. })
  1775. ;
  1776. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock}, smalltalk.Array)})}
  1777. }),
  1778. smalltalk.Array);
  1779. smalltalk.addMethod(
  1780. "_sorted",
  1781. smalltalk.method({
  1782. selector: "sorted",
  1783. fn: function (){
  1784. var self=this;
  1785. return smalltalk.withContext(function($ctx1) { var $1;
  1786. $1=_st(_st(self)._copy())._sort();
  1787. return $1;
  1788. }, function($ctx1) {$ctx1.fill(self,"sorted",{}, smalltalk.Array)})}
  1789. }),
  1790. smalltalk.Array);
  1791. smalltalk.addMethod(
  1792. "_sorted_",
  1793. smalltalk.method({
  1794. selector: "sorted:",
  1795. fn: function (aBlock){
  1796. var self=this;
  1797. return smalltalk.withContext(function($ctx1) { var $1;
  1798. $1=_st(_st(self)._copy())._sort_(aBlock);
  1799. return $1;
  1800. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock}, smalltalk.Array)})}
  1801. }),
  1802. smalltalk.Array);
  1803. smalltalk.addMethod(
  1804. "_new_",
  1805. smalltalk.method({
  1806. selector: "new:",
  1807. fn: function (anInteger){
  1808. var self=this;
  1809. return smalltalk.withContext(function($ctx1) { return new Array(anInteger);
  1810. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Array.klass)})}
  1811. }),
  1812. smalltalk.Array.klass);
  1813. smalltalk.addMethod(
  1814. "_with_",
  1815. smalltalk.method({
  1816. selector: "with:",
  1817. fn: function (anObject){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1820. $2=_st(self)._new_((1));
  1821. _st($2)._at_put_((1),anObject);
  1822. $3=_st($2)._yourself();
  1823. $1=$3;
  1824. return $1;
  1825. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Array.klass)})}
  1826. }),
  1827. smalltalk.Array.klass);
  1828. smalltalk.addMethod(
  1829. "_with_with_",
  1830. smalltalk.method({
  1831. selector: "with:with:",
  1832. fn: function (anObject,anObject2){
  1833. var self=this;
  1834. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1835. $2=_st(self)._new_((2));
  1836. _st($2)._at_put_((1),anObject);
  1837. _st($2)._at_put_((2),anObject2);
  1838. $3=_st($2)._yourself();
  1839. $1=$3;
  1840. return $1;
  1841. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2}, smalltalk.Array.klass)})}
  1842. }),
  1843. smalltalk.Array.klass);
  1844. smalltalk.addMethod(
  1845. "_with_with_with_",
  1846. smalltalk.method({
  1847. selector: "with:with:with:",
  1848. fn: function (anObject,anObject2,anObject3){
  1849. var self=this;
  1850. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1851. $2=_st(self)._new_((3));
  1852. _st($2)._at_put_((1),anObject);
  1853. _st($2)._at_put_((2),anObject2);
  1854. _st($2)._at_put_((3),anObject3);
  1855. $3=_st($2)._yourself();
  1856. $1=$3;
  1857. return $1;
  1858. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.Array.klass)})}
  1859. }),
  1860. smalltalk.Array.klass);
  1861. smalltalk.addMethod(
  1862. "_withAll_",
  1863. smalltalk.method({
  1864. selector: "withAll:",
  1865. fn: function (aCollection){
  1866. var self=this;
  1867. var instance,index;
  1868. return smalltalk.withContext(function($ctx1) { var $1;
  1869. index=(1);
  1870. instance=_st(self)._new_(_st(aCollection)._size());
  1871. _st(aCollection)._do_((function(each){
  1872. return smalltalk.withContext(function($ctx2) { _st(instance)._at_put_(index,each);
  1873. index=_st(index).__plus((1));
  1874. return index;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1876. $1=instance;
  1877. return $1;
  1878. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index}, smalltalk.Array.klass)})}
  1879. }),
  1880. smalltalk.Array.klass);
  1881. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1882. smalltalk.addMethod(
  1883. "__comma",
  1884. smalltalk.method({
  1885. selector: ",",
  1886. fn: function (aString){
  1887. var self=this;
  1888. return smalltalk.withContext(function($ctx1) { var $1;
  1889. $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
  1890. return $1;
  1891. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.CharacterArray)})}
  1892. }),
  1893. smalltalk.CharacterArray);
  1894. smalltalk.addMethod(
  1895. "_add_",
  1896. smalltalk.method({
  1897. selector: "add:",
  1898. fn: function (anObject){
  1899. var self=this;
  1900. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  1901. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.CharacterArray)})}
  1902. }),
  1903. smalltalk.CharacterArray);
  1904. smalltalk.addMethod(
  1905. "_asLowercase",
  1906. smalltalk.method({
  1907. selector: "asLowercase",
  1908. fn: function (){
  1909. var self=this;
  1910. return smalltalk.withContext(function($ctx1) { var $1;
  1911. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
  1912. return $1;
  1913. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.CharacterArray)})}
  1914. }),
  1915. smalltalk.CharacterArray);
  1916. smalltalk.addMethod(
  1917. "_asNumber",
  1918. smalltalk.method({
  1919. selector: "asNumber",
  1920. fn: function (){
  1921. var self=this;
  1922. return smalltalk.withContext(function($ctx1) { var $1;
  1923. $1=_st(_st(self)._asString())._asNumber();
  1924. return $1;
  1925. }, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.CharacterArray)})}
  1926. }),
  1927. smalltalk.CharacterArray);
  1928. smalltalk.addMethod(
  1929. "_asString",
  1930. smalltalk.method({
  1931. selector: "asString",
  1932. fn: function (){
  1933. var self=this;
  1934. return smalltalk.withContext(function($ctx1) { var $1;
  1935. $1=_st(self)._subclassResponsibility();
  1936. return $1;
  1937. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.CharacterArray)})}
  1938. }),
  1939. smalltalk.CharacterArray);
  1940. smalltalk.addMethod(
  1941. "_asSymbol",
  1942. smalltalk.method({
  1943. selector: "asSymbol",
  1944. fn: function (){
  1945. var self=this;
  1946. return smalltalk.withContext(function($ctx1) { var $1;
  1947. $1=_st(self)._subclassResponsibility();
  1948. return $1;
  1949. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.CharacterArray)})}
  1950. }),
  1951. smalltalk.CharacterArray);
  1952. smalltalk.addMethod(
  1953. "_asUppercase",
  1954. smalltalk.method({
  1955. selector: "asUppercase",
  1956. fn: function (){
  1957. var self=this;
  1958. return smalltalk.withContext(function($ctx1) { var $1;
  1959. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
  1960. return $1;
  1961. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.CharacterArray)})}
  1962. }),
  1963. smalltalk.CharacterArray);
  1964. smalltalk.addMethod(
  1965. "_at_put_",
  1966. smalltalk.method({
  1967. selector: "at:put:",
  1968. fn: function (anIndex,anObject){
  1969. var self=this;
  1970. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  1971. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.CharacterArray)})}
  1972. }),
  1973. smalltalk.CharacterArray);
  1974. smalltalk.addMethod(
  1975. "_errorReadOnly",
  1976. smalltalk.method({
  1977. selector: "errorReadOnly",
  1978. fn: function (){
  1979. var self=this;
  1980. return smalltalk.withContext(function($ctx1) { _st(self)._error_("Object is read-only");
  1981. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{}, smalltalk.CharacterArray)})}
  1982. }),
  1983. smalltalk.CharacterArray);
  1984. smalltalk.addMethod(
  1985. "_printString",
  1986. smalltalk.method({
  1987. selector: "printString",
  1988. fn: function (){
  1989. var self=this;
  1990. return smalltalk.withContext(function($ctx1) { var $1;
  1991. $1=_st(_st(self)._asString())._printString();
  1992. return $1;
  1993. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.CharacterArray)})}
  1994. }),
  1995. smalltalk.CharacterArray);
  1996. smalltalk.addMethod(
  1997. "_remove_",
  1998. smalltalk.method({
  1999. selector: "remove:",
  2000. fn: function (anObject){
  2001. var self=this;
  2002. return smalltalk.withContext(function($ctx1) { _st(self)._errorReadOnly();
  2003. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.CharacterArray)})}
  2004. }),
  2005. smalltalk.CharacterArray);
  2006. smalltalk.addMethod(
  2007. "_fromString_",
  2008. smalltalk.method({
  2009. selector: "fromString:",
  2010. fn: function (aString){
  2011. var self=this;
  2012. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2013. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.CharacterArray.klass)})}
  2014. }),
  2015. smalltalk.CharacterArray.klass);
  2016. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2017. smalltalk.addMethod(
  2018. "__comma",
  2019. smalltalk.method({
  2020. selector: ",",
  2021. fn: function (aString){
  2022. var self=this;
  2023. return smalltalk.withContext(function($ctx1) { return self + aString;
  2024. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.String)})}
  2025. }),
  2026. smalltalk.String);
  2027. smalltalk.addMethod(
  2028. "__lt",
  2029. smalltalk.method({
  2030. selector: "<",
  2031. fn: function (aString){
  2032. var self=this;
  2033. return smalltalk.withContext(function($ctx1) { return String(self) < aString._asString();
  2034. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString}, smalltalk.String)})}
  2035. }),
  2036. smalltalk.String);
  2037. smalltalk.addMethod(
  2038. "__lt_eq",
  2039. smalltalk.method({
  2040. selector: "<=",
  2041. fn: function (aString){
  2042. var self=this;
  2043. return smalltalk.withContext(function($ctx1) { return String(self) <= aString._asString();
  2044. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString}, smalltalk.String)})}
  2045. }),
  2046. smalltalk.String);
  2047. smalltalk.addMethod(
  2048. "__eq",
  2049. smalltalk.method({
  2050. selector: "=",
  2051. fn: function (aString){
  2052. var self=this;
  2053. return smalltalk.withContext(function($ctx1) {
  2054. if(! aString._isString || ! aString._isString()) {
  2055. return false;
  2056. }
  2057. return String(self) === String(aString)
  2058. ;
  2059. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString}, smalltalk.String)})}
  2060. }),
  2061. smalltalk.String);
  2062. smalltalk.addMethod(
  2063. "__eq_eq",
  2064. smalltalk.method({
  2065. selector: "==",
  2066. fn: function (aString){
  2067. var self=this;
  2068. return smalltalk.withContext(function($ctx1) { var $1;
  2069. $1=_st(self).__eq(aString);
  2070. return $1;
  2071. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString}, smalltalk.String)})}
  2072. }),
  2073. smalltalk.String);
  2074. smalltalk.addMethod(
  2075. "__gt",
  2076. smalltalk.method({
  2077. selector: ">",
  2078. fn: function (aString){
  2079. var self=this;
  2080. return smalltalk.withContext(function($ctx1) { return String(self) > aString._asString();
  2081. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString}, smalltalk.String)})}
  2082. }),
  2083. smalltalk.String);
  2084. smalltalk.addMethod(
  2085. "__gt_eq",
  2086. smalltalk.method({
  2087. selector: ">=",
  2088. fn: function (aString){
  2089. var self=this;
  2090. return smalltalk.withContext(function($ctx1) { return String(self) >= aString._asString();
  2091. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString}, smalltalk.String)})}
  2092. }),
  2093. smalltalk.String);
  2094. smalltalk.addMethod(
  2095. "_asJSON",
  2096. smalltalk.method({
  2097. selector: "asJSON",
  2098. fn: function (){
  2099. var self=this;
  2100. return smalltalk.withContext(function($ctx1) { var $1;
  2101. $1=self;
  2102. return $1;
  2103. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.String)})}
  2104. }),
  2105. smalltalk.String);
  2106. smalltalk.addMethod(
  2107. "_asJavaScriptSelector",
  2108. smalltalk.method({
  2109. selector: "asJavaScriptSelector",
  2110. fn: function (){
  2111. var self=this;
  2112. return smalltalk.withContext(function($ctx1) { var $1;
  2113. $1=_st(_st(_st(self)._asSelector())._replace_with_("^_",""))._replace_with_("_.*","");
  2114. return $1;
  2115. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{}, smalltalk.String)})}
  2116. }),
  2117. smalltalk.String);
  2118. smalltalk.addMethod(
  2119. "_asJavascript",
  2120. smalltalk.method({
  2121. selector: "asJavascript",
  2122. fn: function (){
  2123. var self=this;
  2124. return smalltalk.withContext(function($ctx1) {
  2125. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2126. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  2127. else
  2128. return "\"" + self + "\"";
  2129. ;
  2130. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.String)})}
  2131. }),
  2132. smalltalk.String);
  2133. smalltalk.addMethod(
  2134. "_asLowercase",
  2135. smalltalk.method({
  2136. selector: "asLowercase",
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) { return self.toLowerCase();
  2140. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.String)})}
  2141. }),
  2142. smalltalk.String);
  2143. smalltalk.addMethod(
  2144. "_asNumber",
  2145. smalltalk.method({
  2146. selector: "asNumber",
  2147. fn: function (){
  2148. var self=this;
  2149. return smalltalk.withContext(function($ctx1) { return Number(self);
  2150. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.String)})}
  2151. }),
  2152. smalltalk.String);
  2153. smalltalk.addMethod(
  2154. "_asRegexp",
  2155. smalltalk.method({
  2156. selector: "asRegexp",
  2157. fn: function (){
  2158. var self=this;
  2159. return smalltalk.withContext(function($ctx1) { var $1;
  2160. $1=_st((smalltalk.RegularExpression || RegularExpression))._fromString_(self);
  2161. return $1;
  2162. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{}, smalltalk.String)})}
  2163. }),
  2164. smalltalk.String);
  2165. smalltalk.addMethod(
  2166. "_asSelector",
  2167. smalltalk.method({
  2168. selector: "asSelector",
  2169. fn: function (){
  2170. var self=this;
  2171. return smalltalk.withContext(function($ctx1) { return smalltalk.selector(self);
  2172. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.String)})}
  2173. }),
  2174. smalltalk.String);
  2175. smalltalk.addMethod(
  2176. "_asString",
  2177. smalltalk.method({
  2178. selector: "asString",
  2179. fn: function (){
  2180. var self=this;
  2181. return smalltalk.withContext(function($ctx1) { var $1;
  2182. $1=self;
  2183. return $1;
  2184. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.String)})}
  2185. }),
  2186. smalltalk.String);
  2187. smalltalk.addMethod(
  2188. "_asSymbol",
  2189. smalltalk.method({
  2190. selector: "asSymbol",
  2191. fn: function (){
  2192. var self=this;
  2193. return smalltalk.withContext(function($ctx1) { var $1;
  2194. $1=_st((smalltalk.Symbol || Symbol))._lookup_(self);
  2195. return $1;
  2196. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.String)})}
  2197. }),
  2198. smalltalk.String);
  2199. smalltalk.addMethod(
  2200. "_asUppercase",
  2201. smalltalk.method({
  2202. selector: "asUppercase",
  2203. fn: function (){
  2204. var self=this;
  2205. return smalltalk.withContext(function($ctx1) { return self.toUpperCase();
  2206. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.String)})}
  2207. }),
  2208. smalltalk.String);
  2209. smalltalk.addMethod(
  2210. "_asciiValue",
  2211. smalltalk.method({
  2212. selector: "asciiValue",
  2213. fn: function (){
  2214. var self=this;
  2215. return smalltalk.withContext(function($ctx1) { return self.charCodeAt(0);;
  2216. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{}, smalltalk.String)})}
  2217. }),
  2218. smalltalk.String);
  2219. smalltalk.addMethod(
  2220. "_at_ifAbsent_",
  2221. smalltalk.method({
  2222. selector: "at:ifAbsent:",
  2223. fn: function (anIndex,aBlock){
  2224. var self=this;
  2225. return smalltalk.withContext(function($ctx1) { return String(self).charAt(anIndex - 1) || aBlock();
  2226. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.String)})}
  2227. }),
  2228. smalltalk.String);
  2229. smalltalk.addMethod(
  2230. "_copyFrom_to_",
  2231. smalltalk.method({
  2232. selector: "copyFrom:to:",
  2233. fn: function (anIndex,anotherIndex){
  2234. var self=this;
  2235. return smalltalk.withContext(function($ctx1) { return self.substring(anIndex - 1, anotherIndex);
  2236. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.String)})}
  2237. }),
  2238. smalltalk.String);
  2239. smalltalk.addMethod(
  2240. "_deepCopy",
  2241. smalltalk.method({
  2242. selector: "deepCopy",
  2243. fn: function (){
  2244. var self=this;
  2245. return smalltalk.withContext(function($ctx1) { var $1;
  2246. $1=_st(self)._shallowCopy();
  2247. return $1;
  2248. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.String)})}
  2249. }),
  2250. smalltalk.String);
  2251. smalltalk.addMethod(
  2252. "_do_",
  2253. smalltalk.method({
  2254. selector: "do:",
  2255. fn: function (aBlock){
  2256. var self=this;
  2257. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  2258. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.String)})}
  2259. }),
  2260. smalltalk.String);
  2261. smalltalk.addMethod(
  2262. "_escaped",
  2263. smalltalk.method({
  2264. selector: "escaped",
  2265. fn: function (){
  2266. var self=this;
  2267. return smalltalk.withContext(function($ctx1) { return escape(self);
  2268. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{}, smalltalk.String)})}
  2269. }),
  2270. smalltalk.String);
  2271. smalltalk.addMethod(
  2272. "_includesSubString_",
  2273. smalltalk.method({
  2274. selector: "includesSubString:",
  2275. fn: function (subString){
  2276. var self=this;
  2277. return smalltalk.withContext(function($ctx1) { return self.indexOf(subString) != -1 ;
  2278. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString}, smalltalk.String)})}
  2279. }),
  2280. smalltalk.String);
  2281. smalltalk.addMethod(
  2282. "_isString",
  2283. smalltalk.method({
  2284. selector: "isString",
  2285. fn: function (){
  2286. var self=this;
  2287. return smalltalk.withContext(function($ctx1) { return true;
  2288. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.String)})}
  2289. }),
  2290. smalltalk.String);
  2291. smalltalk.addMethod(
  2292. "_join_",
  2293. smalltalk.method({
  2294. selector: "join:",
  2295. fn: function (aCollection){
  2296. var self=this;
  2297. return smalltalk.withContext(function($ctx1) { var $1;
  2298. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  2299. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._do_separatedBy_((function(each){
  2300. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(_st(each)._asString());
  2301. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  2302. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(self);
  2303. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2304. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  2305. return $1;
  2306. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection}, smalltalk.String)})}
  2307. }),
  2308. smalltalk.String);
  2309. smalltalk.addMethod(
  2310. "_lineIndicesDo_",
  2311. smalltalk.method({
  2312. selector: "lineIndicesDo:",
  2313. fn: function (aBlock){
  2314. var self=this;
  2315. var cr,lf,start,sz,nextLF,nextCR;
  2316. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$8,$7,$2;
  2317. var $early={};
  2318. try {
  2319. start=(1);
  2320. sz=_st(self)._size();
  2321. cr=_st((smalltalk.String || String))._cr();
  2322. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  2323. lf=_st((smalltalk.String || String))._lf();
  2324. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  2325. $1=(function(){
  2326. return smalltalk.withContext(function($ctx2) { return _st(start).__lt_eq(sz);
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  2328. $2=(function(){
  2329. return smalltalk.withContext(function($ctx2) { $3=_st(_st(nextLF).__eq((0)))._and_((function(){
  2330. return smalltalk.withContext(function($ctx3) { return _st(nextCR).__eq((0));
  2331. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2332. if(smalltalk.assert($3)){
  2333. _st(aBlock)._value_value_value_(start,sz,sz);
  2334. $4=self;
  2335. throw $early=[$4];
  2336. };
  2337. $5=_st(_st(nextCR).__eq((0)))._or_((function(){
  2338. return smalltalk.withContext(function($ctx3) { return _st(_st((0)).__lt(nextLF))._and_((function(){
  2339. return smalltalk.withContext(function($ctx4) { return _st(nextLF).__lt(nextCR);
  2340. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  2341. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2342. $6=(function(){
  2343. return smalltalk.withContext(function($ctx3) { _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  2344. start=_st((1)).__plus(nextLF);
  2345. start;
  2346. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2347. return nextLF;
  2348. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  2349. $7=(function(){
  2350. return smalltalk.withContext(function($ctx3) { $8=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  2351. if(smalltalk.assert($8)){
  2352. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  2353. start=_st((1)).__plus(nextLF);
  2354. start;
  2355. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2356. nextCR;
  2357. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2358. return nextLF;
  2359. } else {
  2360. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  2361. start=_st((1)).__plus(nextCR);
  2362. start;
  2363. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2364. return nextCR;
  2365. };
  2366. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  2367. return _st($5)._ifTrue_ifFalse_($6,$7);
  2368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  2369. _st($1)._whileTrue_($2);
  2370. return self}
  2371. catch(e) {if(e===$early)return e[0]; throw e}
  2372. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR}, smalltalk.String)})}
  2373. }),
  2374. smalltalk.String);
  2375. smalltalk.addMethod(
  2376. "_lineNumber_",
  2377. smalltalk.method({
  2378. selector: "lineNumber:",
  2379. fn: function (anIndex){
  2380. var self=this;
  2381. var lineCount;
  2382. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  2383. var $early={};
  2384. try {
  2385. lineCount=(0);
  2386. $1=self;
  2387. $2=(function(start,endWithoutDelimiters,end){
  2388. return smalltalk.withContext(function($ctx2) { lineCount=_st(lineCount).__plus((1));
  2389. $3=_st(lineCount).__eq(anIndex);
  2390. if(smalltalk.assert($3)){
  2391. $4=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  2392. throw $early=[$4];
  2393. };
  2394. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})});
  2395. _st($1)._lineIndicesDo_($2);
  2396. return nil;
  2397. }
  2398. catch(e) {if(e===$early)return e[0]; throw e}
  2399. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount}, smalltalk.String)})}
  2400. }),
  2401. smalltalk.String);
  2402. smalltalk.addMethod(
  2403. "_lines",
  2404. smalltalk.method({
  2405. selector: "lines",
  2406. fn: function (){
  2407. var self=this;
  2408. var lines;
  2409. return smalltalk.withContext(function($ctx1) { var $1;
  2410. lines=_st((smalltalk.Array || Array))._new();
  2411. _st(self)._linesDo_((function(aLine){
  2412. return smalltalk.withContext(function($ctx2) { return _st(lines)._add_(aLine);
  2413. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  2414. $1=lines;
  2415. return $1;
  2416. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines}, smalltalk.String)})}
  2417. }),
  2418. smalltalk.String);
  2419. smalltalk.addMethod(
  2420. "_linesDo_",
  2421. smalltalk.method({
  2422. selector: "linesDo:",
  2423. fn: function (aBlock){
  2424. var self=this;
  2425. return smalltalk.withContext(function($ctx1) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  2426. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  2427. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  2428. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock}, smalltalk.String)})}
  2429. }),
  2430. smalltalk.String);
  2431. smalltalk.addMethod(
  2432. "_match_",
  2433. smalltalk.method({
  2434. selector: "match:",
  2435. fn: function (aRegexp){
  2436. var self=this;
  2437. return smalltalk.withContext(function($ctx1) { return self.search(aRegexp) != -1;
  2438. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp}, smalltalk.String)})}
  2439. }),
  2440. smalltalk.String);
  2441. smalltalk.addMethod(
  2442. "_matchesOf_",
  2443. smalltalk.method({
  2444. selector: "matchesOf:",
  2445. fn: function (aRegularExpression){
  2446. var self=this;
  2447. return smalltalk.withContext(function($ctx1) { return self.match(aRegularExpression);
  2448. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression}, smalltalk.String)})}
  2449. }),
  2450. smalltalk.String);
  2451. smalltalk.addMethod(
  2452. "_printNl",
  2453. smalltalk.method({
  2454. selector: "printNl",
  2455. fn: function (){
  2456. var self=this;
  2457. return smalltalk.withContext(function($ctx1) { console.log(self);
  2458. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.String)})}
  2459. }),
  2460. smalltalk.String);
  2461. smalltalk.addMethod(
  2462. "_printString",
  2463. smalltalk.method({
  2464. selector: "printString",
  2465. fn: function (){
  2466. var self=this;
  2467. return smalltalk.withContext(function($ctx1) { var $1;
  2468. $1=_st(_st("'").__comma(self)).__comma("'");
  2469. return $1;
  2470. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.String)})}
  2471. }),
  2472. smalltalk.String);
  2473. smalltalk.addMethod(
  2474. "_replace_with_",
  2475. smalltalk.method({
  2476. selector: "replace:with:",
  2477. fn: function (aString,anotherString){
  2478. var self=this;
  2479. return smalltalk.withContext(function($ctx1) { var $1;
  2480. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(aString,"g"),anotherString);
  2481. return $1;
  2482. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString}, smalltalk.String)})}
  2483. }),
  2484. smalltalk.String);
  2485. smalltalk.addMethod(
  2486. "_replaceRegexp_with_",
  2487. smalltalk.method({
  2488. selector: "replaceRegexp:with:",
  2489. fn: function (aRegexp,aString){
  2490. var self=this;
  2491. return smalltalk.withContext(function($ctx1) { return self.replace(aRegexp, aString);
  2492. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString}, smalltalk.String)})}
  2493. }),
  2494. smalltalk.String);
  2495. smalltalk.addMethod(
  2496. "_reversed",
  2497. smalltalk.method({
  2498. selector: "reversed",
  2499. fn: function (){
  2500. var self=this;
  2501. return smalltalk.withContext(function($ctx1) { return self.split("").reverse().join("");
  2502. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.String)})}
  2503. }),
  2504. smalltalk.String);
  2505. smalltalk.addMethod(
  2506. "_shallowCopy",
  2507. smalltalk.method({
  2508. selector: "shallowCopy",
  2509. fn: function (){
  2510. var self=this;
  2511. return smalltalk.withContext(function($ctx1) { var $1;
  2512. $1=_st(_st(self)._class())._fromString_(self);
  2513. return $1;
  2514. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.String)})}
  2515. }),
  2516. smalltalk.String);
  2517. smalltalk.addMethod(
  2518. "_size",
  2519. smalltalk.method({
  2520. selector: "size",
  2521. fn: function (){
  2522. var self=this;
  2523. return smalltalk.withContext(function($ctx1) { return self.length;
  2524. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.String)})}
  2525. }),
  2526. smalltalk.String);
  2527. smalltalk.addMethod(
  2528. "_tokenize_",
  2529. smalltalk.method({
  2530. selector: "tokenize:",
  2531. fn: function (aString){
  2532. var self=this;
  2533. return smalltalk.withContext(function($ctx1) { return self.split(aString);
  2534. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString}, smalltalk.String)})}
  2535. }),
  2536. smalltalk.String);
  2537. smalltalk.addMethod(
  2538. "_trimBoth",
  2539. smalltalk.method({
  2540. selector: "trimBoth",
  2541. fn: function (){
  2542. var self=this;
  2543. return smalltalk.withContext(function($ctx1) { var $1;
  2544. $1=_st(self)._trimBoth_("\x5cs");
  2545. return $1;
  2546. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{}, smalltalk.String)})}
  2547. }),
  2548. smalltalk.String);
  2549. smalltalk.addMethod(
  2550. "_trimBoth_",
  2551. smalltalk.method({
  2552. selector: "trimBoth:",
  2553. fn: function (separators){
  2554. var self=this;
  2555. return smalltalk.withContext(function($ctx1) { var $1;
  2556. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  2557. return $1;
  2558. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators}, smalltalk.String)})}
  2559. }),
  2560. smalltalk.String);
  2561. smalltalk.addMethod(
  2562. "_trimLeft",
  2563. smalltalk.method({
  2564. selector: "trimLeft",
  2565. fn: function (){
  2566. var self=this;
  2567. return smalltalk.withContext(function($ctx1) { var $1;
  2568. $1=_st(self)._trimLeft_("\x5cs");
  2569. return $1;
  2570. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{}, smalltalk.String)})}
  2571. }),
  2572. smalltalk.String);
  2573. smalltalk.addMethod(
  2574. "_trimLeft_",
  2575. smalltalk.method({
  2576. selector: "trimLeft:",
  2577. fn: function (separators){
  2578. var self=this;
  2579. return smalltalk.withContext(function($ctx1) { var $1;
  2580. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  2581. return $1;
  2582. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators}, smalltalk.String)})}
  2583. }),
  2584. smalltalk.String);
  2585. smalltalk.addMethod(
  2586. "_trimRight",
  2587. smalltalk.method({
  2588. selector: "trimRight",
  2589. fn: function (){
  2590. var self=this;
  2591. return smalltalk.withContext(function($ctx1) { var $1;
  2592. $1=_st(self)._trimRight_("\x5cs");
  2593. return $1;
  2594. }, function($ctx1) {$ctx1.fill(self,"trimRight",{}, smalltalk.String)})}
  2595. }),
  2596. smalltalk.String);
  2597. smalltalk.addMethod(
  2598. "_trimRight_",
  2599. smalltalk.method({
  2600. selector: "trimRight:",
  2601. fn: function (separators){
  2602. var self=this;
  2603. return smalltalk.withContext(function($ctx1) { var $1;
  2604. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  2605. return $1;
  2606. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators}, smalltalk.String)})}
  2607. }),
  2608. smalltalk.String);
  2609. smalltalk.addMethod(
  2610. "_unescaped",
  2611. smalltalk.method({
  2612. selector: "unescaped",
  2613. fn: function (){
  2614. var self=this;
  2615. return smalltalk.withContext(function($ctx1) { return unescape(self);
  2616. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{}, smalltalk.String)})}
  2617. }),
  2618. smalltalk.String);
  2619. smalltalk.addMethod(
  2620. "_withIndexDo_",
  2621. smalltalk.method({
  2622. selector: "withIndexDo:",
  2623. fn: function (aBlock){
  2624. var self=this;
  2625. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  2626. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.String)})}
  2627. }),
  2628. smalltalk.String);
  2629. smalltalk.addMethod(
  2630. "_cr",
  2631. smalltalk.method({
  2632. selector: "cr",
  2633. fn: function (){
  2634. var self=this;
  2635. return smalltalk.withContext(function($ctx1) { return '\r';
  2636. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.String.klass)})}
  2637. }),
  2638. smalltalk.String.klass);
  2639. smalltalk.addMethod(
  2640. "_crlf",
  2641. smalltalk.method({
  2642. selector: "crlf",
  2643. fn: function (){
  2644. var self=this;
  2645. return smalltalk.withContext(function($ctx1) { return '\r\n';
  2646. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.String.klass)})}
  2647. }),
  2648. smalltalk.String.klass);
  2649. smalltalk.addMethod(
  2650. "_fromCharCode_",
  2651. smalltalk.method({
  2652. selector: "fromCharCode:",
  2653. fn: function (anInteger){
  2654. var self=this;
  2655. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(anInteger);
  2656. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger}, smalltalk.String.klass)})}
  2657. }),
  2658. smalltalk.String.klass);
  2659. smalltalk.addMethod(
  2660. "_fromString_",
  2661. smalltalk.method({
  2662. selector: "fromString:",
  2663. fn: function (aString){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) { return new self.fn(aString);
  2666. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.String.klass)})}
  2667. }),
  2668. smalltalk.String.klass);
  2669. smalltalk.addMethod(
  2670. "_lf",
  2671. smalltalk.method({
  2672. selector: "lf",
  2673. fn: function (){
  2674. var self=this;
  2675. return smalltalk.withContext(function($ctx1) { return '\n';
  2676. return self}, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.String.klass)})}
  2677. }),
  2678. smalltalk.String.klass);
  2679. smalltalk.addMethod(
  2680. "_space",
  2681. smalltalk.method({
  2682. selector: "space",
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) { return ' ';
  2686. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.String.klass)})}
  2687. }),
  2688. smalltalk.String.klass);
  2689. smalltalk.addMethod(
  2690. "_streamClass",
  2691. smalltalk.method({
  2692. selector: "streamClass",
  2693. fn: function (){
  2694. var self=this;
  2695. return smalltalk.withContext(function($ctx1) { var $1;
  2696. $1=(smalltalk.StringStream || StringStream);
  2697. return $1;
  2698. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.String.klass)})}
  2699. }),
  2700. smalltalk.String.klass);
  2701. smalltalk.addMethod(
  2702. "_streamContents_",
  2703. smalltalk.method({
  2704. selector: "streamContents:",
  2705. fn: function (blockWithArg){
  2706. var self=this;
  2707. var stream;
  2708. return smalltalk.withContext(function($ctx1) { var $1;
  2709. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  2710. _st(blockWithArg)._value_(stream);
  2711. $1=_st(stream)._contents();
  2712. return $1;
  2713. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream}, smalltalk.String.klass)})}
  2714. }),
  2715. smalltalk.String.klass);
  2716. smalltalk.addMethod(
  2717. "_tab",
  2718. smalltalk.method({
  2719. selector: "tab",
  2720. fn: function (){
  2721. var self=this;
  2722. return smalltalk.withContext(function($ctx1) { return '\t';
  2723. return self}, function($ctx1) {$ctx1.fill(self,"tab",{}, smalltalk.String.klass)})}
  2724. }),
  2725. smalltalk.String.klass);
  2726. smalltalk.addMethod(
  2727. "_value_",
  2728. smalltalk.method({
  2729. selector: "value:",
  2730. fn: function (aUTFCharCode){
  2731. var self=this;
  2732. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(aUTFCharCode);;
  2733. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode}, smalltalk.String.klass)})}
  2734. }),
  2735. smalltalk.String.klass);
  2736. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2737. smalltalk.addMethod(
  2738. "__lt",
  2739. smalltalk.method({
  2740. selector: "<",
  2741. fn: function (aSymbol){
  2742. var self=this;
  2743. return smalltalk.withContext(function($ctx1) { var $1;
  2744. $1=_st(_st(self)._asString()).__lt(_st(aSymbol)._asString());
  2745. return $1;
  2746. }, function($ctx1) {$ctx1.fill(self,"<",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2747. }),
  2748. smalltalk.Symbol);
  2749. smalltalk.addMethod(
  2750. "__lt_eq",
  2751. smalltalk.method({
  2752. selector: "<=",
  2753. fn: function (aSymbol){
  2754. var self=this;
  2755. return smalltalk.withContext(function($ctx1) { var $1;
  2756. $1=_st(_st(self)._asString()).__lt_eq(_st(aSymbol)._asString());
  2757. return $1;
  2758. }, function($ctx1) {$ctx1.fill(self,"<=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2759. }),
  2760. smalltalk.Symbol);
  2761. smalltalk.addMethod(
  2762. "__eq",
  2763. smalltalk.method({
  2764. selector: "=",
  2765. fn: function (aSymbol){
  2766. var self=this;
  2767. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2768. $1=_st(_st(aSymbol)._class()).__eq(_st(self)._class());
  2769. if(! smalltalk.assert($1)){
  2770. return false;
  2771. };
  2772. $2=_st(_st(self)._asString()).__eq(_st(aSymbol)._asString());
  2773. return $2;
  2774. }, function($ctx1) {$ctx1.fill(self,"=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2775. }),
  2776. smalltalk.Symbol);
  2777. smalltalk.addMethod(
  2778. "__gt",
  2779. smalltalk.method({
  2780. selector: ">",
  2781. fn: function (aSymbol){
  2782. var self=this;
  2783. return smalltalk.withContext(function($ctx1) { var $1;
  2784. $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString());
  2785. return $1;
  2786. }, function($ctx1) {$ctx1.fill(self,">",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2787. }),
  2788. smalltalk.Symbol);
  2789. smalltalk.addMethod(
  2790. "__gt_eq",
  2791. smalltalk.method({
  2792. selector: ">=",
  2793. fn: function (aSymbol){
  2794. var self=this;
  2795. return smalltalk.withContext(function($ctx1) { var $1;
  2796. $1=_st(_st(self)._asString()).__gt_eq(_st(aSymbol)._asString());
  2797. return $1;
  2798. }, function($ctx1) {$ctx1.fill(self,">=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2799. }),
  2800. smalltalk.Symbol);
  2801. smalltalk.addMethod(
  2802. "_asJSON",
  2803. smalltalk.method({
  2804. selector: "asJSON",
  2805. fn: function (){
  2806. var self=this;
  2807. return smalltalk.withContext(function($ctx1) { var $1;
  2808. $1=_st(_st(self)._asString())._asJSON();
  2809. return $1;
  2810. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Symbol)})}
  2811. }),
  2812. smalltalk.Symbol);
  2813. smalltalk.addMethod(
  2814. "_asJavascript",
  2815. smalltalk.method({
  2816. selector: "asJavascript",
  2817. fn: function (){
  2818. var self=this;
  2819. return smalltalk.withContext(function($ctx1) { var $1;
  2820. $1=_st(_st("smalltalk.symbolFor(\x22").__comma(_st(self)._asString())).__comma("\x22)");
  2821. return $1;
  2822. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Symbol)})}
  2823. }),
  2824. smalltalk.Symbol);
  2825. smalltalk.addMethod(
  2826. "_asSelector",
  2827. smalltalk.method({
  2828. selector: "asSelector",
  2829. fn: function (){
  2830. var self=this;
  2831. return smalltalk.withContext(function($ctx1) { var $1;
  2832. $1=_st(_st(self)._asString())._asSelector();
  2833. return $1;
  2834. }, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.Symbol)})}
  2835. }),
  2836. smalltalk.Symbol);
  2837. smalltalk.addMethod(
  2838. "_asString",
  2839. smalltalk.method({
  2840. selector: "asString",
  2841. fn: function (){
  2842. var self=this;
  2843. return smalltalk.withContext(function($ctx1) { return self.value;
  2844. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Symbol)})}
  2845. }),
  2846. smalltalk.Symbol);
  2847. smalltalk.addMethod(
  2848. "_asSuperSelector",
  2849. smalltalk.method({
  2850. selector: "asSuperSelector",
  2851. fn: function (){
  2852. var self=this;
  2853. return smalltalk.withContext(function($ctx1) { var $1;
  2854. $1=_st(_st(self)._asString())._asSuperSelector();
  2855. return $1;
  2856. }, function($ctx1) {$ctx1.fill(self,"asSuperSelector",{}, smalltalk.Symbol)})}
  2857. }),
  2858. smalltalk.Symbol);
  2859. smalltalk.addMethod(
  2860. "_asSymbol",
  2861. smalltalk.method({
  2862. selector: "asSymbol",
  2863. fn: function (){
  2864. var self=this;
  2865. return smalltalk.withContext(function($ctx1) { var $1;
  2866. $1=self;
  2867. return $1;
  2868. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.Symbol)})}
  2869. }),
  2870. smalltalk.Symbol);
  2871. smalltalk.addMethod(
  2872. "_at_ifAbsent_",
  2873. smalltalk.method({
  2874. selector: "at:ifAbsent:",
  2875. fn: function (anIndex,aBlock){
  2876. var self=this;
  2877. return smalltalk.withContext(function($ctx1) { var $1;
  2878. $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock);
  2879. return $1;
  2880. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Symbol)})}
  2881. }),
  2882. smalltalk.Symbol);
  2883. smalltalk.addMethod(
  2884. "_collect_",
  2885. smalltalk.method({
  2886. selector: "collect:",
  2887. fn: function (aBlock){
  2888. var self=this;
  2889. return smalltalk.withContext(function($ctx1) { var $1;
  2890. $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol();
  2891. return $1;
  2892. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2893. }),
  2894. smalltalk.Symbol);
  2895. smalltalk.addMethod(
  2896. "_copyFrom_to_",
  2897. smalltalk.method({
  2898. selector: "copyFrom:to:",
  2899. fn: function (anIndex,anotherIndex){
  2900. var self=this;
  2901. return smalltalk.withContext(function($ctx1) { var $1;
  2902. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex));
  2903. return $1;
  2904. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.Symbol)})}
  2905. }),
  2906. smalltalk.Symbol);
  2907. smalltalk.addMethod(
  2908. "_deepCopy",
  2909. smalltalk.method({
  2910. selector: "deepCopy",
  2911. fn: function (){
  2912. var self=this;
  2913. return smalltalk.withContext(function($ctx1) { var $1;
  2914. $1=self;
  2915. return $1;
  2916. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Symbol)})}
  2917. }),
  2918. smalltalk.Symbol);
  2919. smalltalk.addMethod(
  2920. "_detect_",
  2921. smalltalk.method({
  2922. selector: "detect:",
  2923. fn: function (aBlock){
  2924. var self=this;
  2925. return smalltalk.withContext(function($ctx1) { var $1;
  2926. $1=_st(_st(self)._asString())._detect_(aBlock);
  2927. return $1;
  2928. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2929. }),
  2930. smalltalk.Symbol);
  2931. smalltalk.addMethod(
  2932. "_do_",
  2933. smalltalk.method({
  2934. selector: "do:",
  2935. fn: function (aBlock){
  2936. var self=this;
  2937. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._do_(aBlock);
  2938. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2939. }),
  2940. smalltalk.Symbol);
  2941. smalltalk.addMethod(
  2942. "_isSymbol",
  2943. smalltalk.method({
  2944. selector: "isSymbol",
  2945. fn: function (){
  2946. var self=this;
  2947. return smalltalk.withContext(function($ctx1) { return true;
  2948. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Symbol)})}
  2949. }),
  2950. smalltalk.Symbol);
  2951. smalltalk.addMethod(
  2952. "_printString",
  2953. smalltalk.method({
  2954. selector: "printString",
  2955. fn: function (){
  2956. var self=this;
  2957. return smalltalk.withContext(function($ctx1) { var $1;
  2958. $1=_st("#").__comma(_st(self)._asString());
  2959. return $1;
  2960. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Symbol)})}
  2961. }),
  2962. smalltalk.Symbol);
  2963. smalltalk.addMethod(
  2964. "_select_",
  2965. smalltalk.method({
  2966. selector: "select:",
  2967. fn: function (aBlock){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) { var $1;
  2970. $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol();
  2971. return $1;
  2972. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2973. }),
  2974. smalltalk.Symbol);
  2975. smalltalk.addMethod(
  2976. "_shallowCopy",
  2977. smalltalk.method({
  2978. selector: "shallowCopy",
  2979. fn: function (){
  2980. var self=this;
  2981. return smalltalk.withContext(function($ctx1) { var $1;
  2982. $1=self;
  2983. return $1;
  2984. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Symbol)})}
  2985. }),
  2986. smalltalk.Symbol);
  2987. smalltalk.addMethod(
  2988. "_size",
  2989. smalltalk.method({
  2990. selector: "size",
  2991. fn: function (){
  2992. var self=this;
  2993. return smalltalk.withContext(function($ctx1) { var $1;
  2994. $1=_st(_st(self)._asString())._size();
  2995. return $1;
  2996. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Symbol)})}
  2997. }),
  2998. smalltalk.Symbol);
  2999. smalltalk.addMethod(
  3000. "_value_",
  3001. smalltalk.method({
  3002. selector: "value:",
  3003. fn: function (anObject){
  3004. var self=this;
  3005. return smalltalk.withContext(function($ctx1) { var $1;
  3006. $1=_st(anObject)._perform_(self);
  3007. return $1;
  3008. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject}, smalltalk.Symbol)})}
  3009. }),
  3010. smalltalk.Symbol);
  3011. smalltalk.addMethod(
  3012. "_withIndexDo_",
  3013. smalltalk.method({
  3014. selector: "withIndexDo:",
  3015. fn: function (aBlock){
  3016. var self=this;
  3017. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._withIndexDo_(aBlock);
  3018. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.Symbol)})}
  3019. }),
  3020. smalltalk.Symbol);
  3021. smalltalk.addMethod(
  3022. "_basicNew",
  3023. smalltalk.method({
  3024. selector: "basicNew",
  3025. fn: function (){
  3026. var self=this;
  3027. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  3028. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Symbol.klass)})}
  3029. }),
  3030. smalltalk.Symbol.klass);
  3031. smalltalk.addMethod(
  3032. "_fromString_",
  3033. smalltalk.method({
  3034. selector: "fromString:",
  3035. fn: function (aString){
  3036. var self=this;
  3037. return smalltalk.withContext(function($ctx1) { var $1;
  3038. $1=_st(self)._lookup_(aString);
  3039. return $1;
  3040. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Symbol.klass)})}
  3041. }),
  3042. smalltalk.Symbol.klass);
  3043. smalltalk.addMethod(
  3044. "_lookup_",
  3045. smalltalk.method({
  3046. selector: "lookup:",
  3047. fn: function (aString){
  3048. var self=this;
  3049. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor(aString);;
  3050. return self}, function($ctx1) {$ctx1.fill(self,"lookup:",{aString:aString}, smalltalk.Symbol.klass)})}
  3051. }),
  3052. smalltalk.Symbol.klass);
  3053. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  3054. smalltalk.addMethod(
  3055. "__eq",
  3056. smalltalk.method({
  3057. selector: "=",
  3058. fn: function (aCollection){
  3059. var self=this;
  3060. return smalltalk.withContext(function($ctx1) { var $1;
  3061. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  3062. return smalltalk.withContext(function($ctx2) { return _st(self["@elements"]).__eq(_st(aCollection)._asArray());
  3063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3064. return $1;
  3065. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.Set)})}
  3066. }),
  3067. smalltalk.Set);
  3068. smalltalk.addMethod(
  3069. "_add_",
  3070. smalltalk.method({
  3071. selector: "add:",
  3072. fn: function (anObject){
  3073. var self=this;
  3074. return smalltalk.withContext(function($ctx1) {
  3075. var found;
  3076. for(var i=0; i < self['@elements'].length; i++) {
  3077. if(anObject == self['@elements'][i]) {
  3078. found = true;
  3079. break;
  3080. }
  3081. }
  3082. if(!found) {self['@elements'].push(anObject)}
  3083. ;
  3084. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Set)})}
  3085. }),
  3086. smalltalk.Set);
  3087. smalltalk.addMethod(
  3088. "_asArray",
  3089. smalltalk.method({
  3090. selector: "asArray",
  3091. fn: function (){
  3092. var self=this;
  3093. return smalltalk.withContext(function($ctx1) { var $1;
  3094. $1=_st(self["@elements"])._copy();
  3095. return $1;
  3096. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Set)})}
  3097. }),
  3098. smalltalk.Set);
  3099. smalltalk.addMethod(
  3100. "_detect_ifNone_",
  3101. smalltalk.method({
  3102. selector: "detect:ifNone:",
  3103. fn: function (aBlock,anotherBlock){
  3104. var self=this;
  3105. return smalltalk.withContext(function($ctx1) { var $1;
  3106. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  3107. return $1;
  3108. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Set)})}
  3109. }),
  3110. smalltalk.Set);
  3111. smalltalk.addMethod(
  3112. "_do_",
  3113. smalltalk.method({
  3114. selector: "do:",
  3115. fn: function (aBlock){
  3116. var self=this;
  3117. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._do_(aBlock);
  3118. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Set)})}
  3119. }),
  3120. smalltalk.Set);
  3121. smalltalk.addMethod(
  3122. "_includes_",
  3123. smalltalk.method({
  3124. selector: "includes:",
  3125. fn: function (anObject){
  3126. var self=this;
  3127. return smalltalk.withContext(function($ctx1) { var $1;
  3128. $1=_st(self["@elements"])._includes_(anObject);
  3129. return $1;
  3130. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Set)})}
  3131. }),
  3132. smalltalk.Set);
  3133. smalltalk.addMethod(
  3134. "_initialize",
  3135. smalltalk.method({
  3136. selector: "initialize",
  3137. fn: function (){
  3138. var self=this;
  3139. return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  3140. self["@elements"]=[];
  3141. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Set)})}
  3142. }),
  3143. smalltalk.Set);
  3144. smalltalk.addMethod(
  3145. "_remove_",
  3146. smalltalk.method({
  3147. selector: "remove:",
  3148. fn: function (anObject){
  3149. var self=this;
  3150. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._remove_(anObject);
  3151. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Set)})}
  3152. }),
  3153. smalltalk.Set);
  3154. smalltalk.addMethod(
  3155. "_select_",
  3156. smalltalk.method({
  3157. selector: "select:",
  3158. fn: function (aBlock){
  3159. var self=this;
  3160. var collection;
  3161. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3162. collection=_st(_st(self)._class())._new();
  3163. $1=self;
  3164. $2=(function(each){
  3165. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(each);
  3166. if(smalltalk.assert($3)){
  3167. return _st(collection)._add_(each);
  3168. };
  3169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  3170. _st($1)._do_($2);
  3171. $4=collection;
  3172. return $4;
  3173. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection}, smalltalk.Set)})}
  3174. }),
  3175. smalltalk.Set);
  3176. smalltalk.addMethod(
  3177. "_size",
  3178. smalltalk.method({
  3179. selector: "size",
  3180. fn: function (){
  3181. var self=this;
  3182. return smalltalk.withContext(function($ctx1) { var $1;
  3183. $1=_st(self["@elements"])._size();
  3184. return $1;
  3185. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Set)})}
  3186. }),
  3187. smalltalk.Set);
  3188. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  3189. smalltalk.addMethod(
  3190. "_back_",
  3191. smalltalk.method({
  3192. selector: "back:",
  3193. fn: function (anObject){
  3194. var self=this;
  3195. return smalltalk.withContext(function($ctx1) { _st(self["@write"])._add_(anObject);
  3196. return self}, function($ctx1) {$ctx1.fill(self,"back:",{anObject:anObject}, smalltalk.Queue)})}
  3197. }),
  3198. smalltalk.Queue);
  3199. smalltalk.addMethod(
  3200. "_front",
  3201. smalltalk.method({
  3202. selector: "front",
  3203. fn: function (){
  3204. var self=this;
  3205. return smalltalk.withContext(function($ctx1) { var $1;
  3206. $1=_st(self)._frontIfAbsent_((function(){
  3207. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Cannot read from empty Queue.");
  3208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3209. return $1;
  3210. }, function($ctx1) {$ctx1.fill(self,"front",{}, smalltalk.Queue)})}
  3211. }),
  3212. smalltalk.Queue);
  3213. smalltalk.addMethod(
  3214. "_frontIfAbsent_",
  3215. smalltalk.method({
  3216. selector: "frontIfAbsent:",
  3217. fn: function (aBlock){
  3218. var self=this;
  3219. var result;
  3220. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$6,$7,$5,$3,$8;
  3221. var $early={};
  3222. try {
  3223. $1=self["@read"];
  3224. $2=self["@readIndex"];
  3225. $3=(function(){
  3226. return smalltalk.withContext(function($ctx2) { $4=_st(self["@write"])._isEmpty();
  3227. $5=(function(){
  3228. return smalltalk.withContext(function($ctx3) { $6=_st(self["@readIndex"]).__gt((1));
  3229. if(smalltalk.assert($6)){
  3230. self["@read"]=[];
  3231. self["@read"];
  3232. self["@readIndex"]=(1);
  3233. self["@readIndex"];
  3234. };
  3235. $7=_st(aBlock)._value();
  3236. throw $early=[$7];
  3237. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  3238. _st($4)._ifTrue_($5);
  3239. self["@read"]=self["@write"];
  3240. self["@read"];
  3241. self["@readIndex"]=(1);
  3242. self["@readIndex"];
  3243. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3244. self["@write"];
  3245. return _st(self["@read"])._first();
  3246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3247. result=_st($1)._at_ifAbsent_($2,$3);
  3248. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  3249. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  3250. $8=result;
  3251. return $8;
  3252. }
  3253. catch(e) {if(e===$early)return e[0]; throw e}
  3254. }, function($ctx1) {$ctx1.fill(self,"frontIfAbsent:",{aBlock:aBlock,result:result}, smalltalk.Queue)})}
  3255. }),
  3256. smalltalk.Queue);
  3257. smalltalk.addMethod(
  3258. "_initialize",
  3259. smalltalk.method({
  3260. selector: "initialize",
  3261. fn: function (){
  3262. var self=this;
  3263. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  3264. self["@read"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3265. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3266. self["@readIndex"]=(1);
  3267. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Queue)})}
  3268. }),
  3269. smalltalk.Queue);
  3270. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  3271. smalltalk.addMethod(
  3272. "_compile_",
  3273. smalltalk.method({
  3274. selector: "compile:",
  3275. fn: function (aString){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx1) { return self.compile(aString);
  3278. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.RegularExpression)})}
  3279. }),
  3280. smalltalk.RegularExpression);
  3281. smalltalk.addMethod(
  3282. "_exec_",
  3283. smalltalk.method({
  3284. selector: "exec:",
  3285. fn: function (aString){
  3286. var self=this;
  3287. return smalltalk.withContext(function($ctx1) { return self.exec(aString) || nil;
  3288. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString}, smalltalk.RegularExpression)})}
  3289. }),
  3290. smalltalk.RegularExpression);
  3291. smalltalk.addMethod(
  3292. "_test_",
  3293. smalltalk.method({
  3294. selector: "test:",
  3295. fn: function (aString){
  3296. var self=this;
  3297. return smalltalk.withContext(function($ctx1) { return self.test(aString);
  3298. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString}, smalltalk.RegularExpression)})}
  3299. }),
  3300. smalltalk.RegularExpression);
  3301. smalltalk.addMethod(
  3302. "_fromString_",
  3303. smalltalk.method({
  3304. selector: "fromString:",
  3305. fn: function (aString){
  3306. var self=this;
  3307. return smalltalk.withContext(function($ctx1) { var $1;
  3308. $1=_st(self)._fromString_flag_(aString,"");
  3309. return $1;
  3310. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.RegularExpression.klass)})}
  3311. }),
  3312. smalltalk.RegularExpression.klass);
  3313. smalltalk.addMethod(
  3314. "_fromString_flag_",
  3315. smalltalk.method({
  3316. selector: "fromString:flag:",
  3317. fn: function (aString,anotherString){
  3318. var self=this;
  3319. return smalltalk.withContext(function($ctx1) { return new RegExp(aString, anotherString);
  3320. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString}, smalltalk.RegularExpression.klass)})}
  3321. }),
  3322. smalltalk.RegularExpression.klass);
  3323. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  3324. smalltalk.addMethod(
  3325. "_atEnd",
  3326. smalltalk.method({
  3327. selector: "atEnd",
  3328. fn: function (){
  3329. var self=this;
  3330. return smalltalk.withContext(function($ctx1) { var $1;
  3331. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  3332. return $1;
  3333. }, function($ctx1) {$ctx1.fill(self,"atEnd",{}, smalltalk.Stream)})}
  3334. }),
  3335. smalltalk.Stream);
  3336. smalltalk.addMethod(
  3337. "_atStart",
  3338. smalltalk.method({
  3339. selector: "atStart",
  3340. fn: function (){
  3341. var self=this;
  3342. return smalltalk.withContext(function($ctx1) { var $1;
  3343. $1=_st(_st(self)._position()).__eq((0));
  3344. return $1;
  3345. }, function($ctx1) {$ctx1.fill(self,"atStart",{}, smalltalk.Stream)})}
  3346. }),
  3347. smalltalk.Stream);
  3348. smalltalk.addMethod(
  3349. "_close",
  3350. smalltalk.method({
  3351. selector: "close",
  3352. fn: function (){
  3353. var self=this;
  3354. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"close",{}, smalltalk.Stream)})}
  3355. }),
  3356. smalltalk.Stream);
  3357. smalltalk.addMethod(
  3358. "_collection",
  3359. smalltalk.method({
  3360. selector: "collection",
  3361. fn: function (){
  3362. var self=this;
  3363. return smalltalk.withContext(function($ctx1) { var $1;
  3364. $1=self["@collection"];
  3365. return $1;
  3366. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.Stream)})}
  3367. }),
  3368. smalltalk.Stream);
  3369. smalltalk.addMethod(
  3370. "_contents",
  3371. smalltalk.method({
  3372. selector: "contents",
  3373. fn: function (){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) { var $1;
  3376. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  3377. return $1;
  3378. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.Stream)})}
  3379. }),
  3380. smalltalk.Stream);
  3381. smalltalk.addMethod(
  3382. "_do_",
  3383. smalltalk.method({
  3384. selector: "do:",
  3385. fn: function (aBlock){
  3386. var self=this;
  3387. return smalltalk.withContext(function($ctx1) { _st((function(){
  3388. return smalltalk.withContext(function($ctx2) { return _st(self)._atEnd();
  3389. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  3390. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._next());
  3391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3392. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Stream)})}
  3393. }),
  3394. smalltalk.Stream);
  3395. smalltalk.addMethod(
  3396. "_flush",
  3397. smalltalk.method({
  3398. selector: "flush",
  3399. fn: function (){
  3400. var self=this;
  3401. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"flush",{}, smalltalk.Stream)})}
  3402. }),
  3403. smalltalk.Stream);
  3404. smalltalk.addMethod(
  3405. "_isEmpty",
  3406. smalltalk.method({
  3407. selector: "isEmpty",
  3408. fn: function (){
  3409. var self=this;
  3410. return smalltalk.withContext(function($ctx1) { var $1;
  3411. $1=_st(_st(self)._size()).__eq((0));
  3412. return $1;
  3413. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Stream)})}
  3414. }),
  3415. smalltalk.Stream);
  3416. smalltalk.addMethod(
  3417. "_next",
  3418. smalltalk.method({
  3419. selector: "next",
  3420. fn: function (){
  3421. var self=this;
  3422. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3423. $2=_st(self)._atEnd();
  3424. if(smalltalk.assert($2)){
  3425. $1=nil;
  3426. } else {
  3427. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3428. $1=_st(self["@collection"])._at_(_st(self)._position());
  3429. };
  3430. return $1;
  3431. }, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Stream)})}
  3432. }),
  3433. smalltalk.Stream);
  3434. smalltalk.addMethod(
  3435. "_next_",
  3436. smalltalk.method({
  3437. selector: "next:",
  3438. fn: function (anInteger){
  3439. var self=this;
  3440. var tempCollection;
  3441. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3442. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3443. $1=anInteger;
  3444. $2=(function(){
  3445. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  3446. if(! smalltalk.assert($3)){
  3447. return _st(tempCollection)._add_(_st(self)._next());
  3448. };
  3449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3450. _st($1)._timesRepeat_($2);
  3451. $4=tempCollection;
  3452. return $4;
  3453. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.Stream)})}
  3454. }),
  3455. smalltalk.Stream);
  3456. smalltalk.addMethod(
  3457. "_nextPut_",
  3458. smalltalk.method({
  3459. selector: "nextPut:",
  3460. fn: function (anObject){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3463. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  3464. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3465. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject}, smalltalk.Stream)})}
  3466. }),
  3467. smalltalk.Stream);
  3468. smalltalk.addMethod(
  3469. "_nextPutAll_",
  3470. smalltalk.method({
  3471. selector: "nextPutAll:",
  3472. fn: function (aCollection){
  3473. var self=this;
  3474. return smalltalk.withContext(function($ctx1) { _st(aCollection)._do_((function(each){
  3475. return smalltalk.withContext(function($ctx2) { return _st(self)._nextPut_(each);
  3476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3477. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection}, smalltalk.Stream)})}
  3478. }),
  3479. smalltalk.Stream);
  3480. smalltalk.addMethod(
  3481. "_peek",
  3482. smalltalk.method({
  3483. selector: "peek",
  3484. fn: function (){
  3485. var self=this;
  3486. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3487. $2=_st(self)._atEnd();
  3488. if(! smalltalk.assert($2)){
  3489. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  3490. };
  3491. return $1;
  3492. }, function($ctx1) {$ctx1.fill(self,"peek",{}, smalltalk.Stream)})}
  3493. }),
  3494. smalltalk.Stream);
  3495. smalltalk.addMethod(
  3496. "_position",
  3497. smalltalk.method({
  3498. selector: "position",
  3499. fn: function (){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3502. $2=self["@position"];
  3503. if(($receiver = $2) == nil || $receiver == undefined){
  3504. self["@position"]=(0);
  3505. $1=self["@position"];
  3506. } else {
  3507. $1=$2;
  3508. };
  3509. return $1;
  3510. }, function($ctx1) {$ctx1.fill(self,"position",{}, smalltalk.Stream)})}
  3511. }),
  3512. smalltalk.Stream);
  3513. smalltalk.addMethod(
  3514. "_position_",
  3515. smalltalk.method({
  3516. selector: "position:",
  3517. fn: function (anInteger){
  3518. var self=this;
  3519. return smalltalk.withContext(function($ctx1) { self["@position"]=anInteger;
  3520. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger}, smalltalk.Stream)})}
  3521. }),
  3522. smalltalk.Stream);
  3523. smalltalk.addMethod(
  3524. "_reset",
  3525. smalltalk.method({
  3526. selector: "reset",
  3527. fn: function (){
  3528. var self=this;
  3529. return smalltalk.withContext(function($ctx1) { _st(self)._position_((0));
  3530. return self}, function($ctx1) {$ctx1.fill(self,"reset",{}, smalltalk.Stream)})}
  3531. }),
  3532. smalltalk.Stream);
  3533. smalltalk.addMethod(
  3534. "_resetContents",
  3535. smalltalk.method({
  3536. selector: "resetContents",
  3537. fn: function (){
  3538. var self=this;
  3539. return smalltalk.withContext(function($ctx1) { _st(self)._reset();
  3540. _st(self)._setStreamSize_((0));
  3541. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{}, smalltalk.Stream)})}
  3542. }),
  3543. smalltalk.Stream);
  3544. smalltalk.addMethod(
  3545. "_setCollection_",
  3546. smalltalk.method({
  3547. selector: "setCollection:",
  3548. fn: function (aCollection){
  3549. var self=this;
  3550. return smalltalk.withContext(function($ctx1) { self["@collection"]=aCollection;
  3551. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection}, smalltalk.Stream)})}
  3552. }),
  3553. smalltalk.Stream);
  3554. smalltalk.addMethod(
  3555. "_setStreamSize_",
  3556. smalltalk.method({
  3557. selector: "setStreamSize:",
  3558. fn: function (anInteger){
  3559. var self=this;
  3560. return smalltalk.withContext(function($ctx1) { self["@streamSize"]=anInteger;
  3561. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger}, smalltalk.Stream)})}
  3562. }),
  3563. smalltalk.Stream);
  3564. smalltalk.addMethod(
  3565. "_setToEnd",
  3566. smalltalk.method({
  3567. selector: "setToEnd",
  3568. fn: function (){
  3569. var self=this;
  3570. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(self)._size());
  3571. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{}, smalltalk.Stream)})}
  3572. }),
  3573. smalltalk.Stream);
  3574. smalltalk.addMethod(
  3575. "_size",
  3576. smalltalk.method({
  3577. selector: "size",
  3578. fn: function (){
  3579. var self=this;
  3580. return smalltalk.withContext(function($ctx1) { var $1;
  3581. $1=_st(self)._streamSize();
  3582. return $1;
  3583. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Stream)})}
  3584. }),
  3585. smalltalk.Stream);
  3586. smalltalk.addMethod(
  3587. "_skip_",
  3588. smalltalk.method({
  3589. selector: "skip:",
  3590. fn: function (anInteger){
  3591. var self=this;
  3592. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  3593. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger}, smalltalk.Stream)})}
  3594. }),
  3595. smalltalk.Stream);
  3596. smalltalk.addMethod(
  3597. "_streamSize",
  3598. smalltalk.method({
  3599. selector: "streamSize",
  3600. fn: function (){
  3601. var self=this;
  3602. return smalltalk.withContext(function($ctx1) { var $1;
  3603. $1=self["@streamSize"];
  3604. return $1;
  3605. }, function($ctx1) {$ctx1.fill(self,"streamSize",{}, smalltalk.Stream)})}
  3606. }),
  3607. smalltalk.Stream);
  3608. smalltalk.addMethod(
  3609. "_on_",
  3610. smalltalk.method({
  3611. selector: "on:",
  3612. fn: function (aCollection){
  3613. var self=this;
  3614. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  3615. $2=_st(self)._new();
  3616. _st($2)._setCollection_(aCollection);
  3617. _st($2)._setStreamSize_(_st(aCollection)._size());
  3618. $3=_st($2)._yourself();
  3619. $1=$3;
  3620. return $1;
  3621. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection}, smalltalk.Stream.klass)})}
  3622. }),
  3623. smalltalk.Stream.klass);
  3624. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  3625. smalltalk.addMethod(
  3626. "_cr",
  3627. smalltalk.method({
  3628. selector: "cr",
  3629. fn: function (){
  3630. var self=this;
  3631. return smalltalk.withContext(function($ctx1) { var $1;
  3632. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  3633. return $1;
  3634. }, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.StringStream)})}
  3635. }),
  3636. smalltalk.StringStream);
  3637. smalltalk.addMethod(
  3638. "_crlf",
  3639. smalltalk.method({
  3640. selector: "crlf",
  3641. fn: function (){
  3642. var self=this;
  3643. return smalltalk.withContext(function($ctx1) { var $1;
  3644. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  3645. return $1;
  3646. }, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.StringStream)})}
  3647. }),
  3648. smalltalk.StringStream);
  3649. smalltalk.addMethod(
  3650. "_lf",
  3651. smalltalk.method({
  3652. selector: "lf",
  3653. fn: function (){
  3654. var self=this;
  3655. return smalltalk.withContext(function($ctx1) { var $1;
  3656. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  3657. return $1;
  3658. }, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.StringStream)})}
  3659. }),
  3660. smalltalk.StringStream);
  3661. smalltalk.addMethod(
  3662. "_next_",
  3663. smalltalk.method({
  3664. selector: "next:",
  3665. fn: function (anInteger){
  3666. var self=this;
  3667. var tempCollection;
  3668. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3669. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3670. $1=anInteger;
  3671. $2=(function(){
  3672. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  3673. if(! smalltalk.assert($3)){
  3674. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  3675. return tempCollection;
  3676. };
  3677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3678. _st($1)._timesRepeat_($2);
  3679. $4=tempCollection;
  3680. return $4;
  3681. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.StringStream)})}
  3682. }),
  3683. smalltalk.StringStream);
  3684. smalltalk.addMethod(
  3685. "_nextPut_",
  3686. smalltalk.method({
  3687. selector: "nextPut:",
  3688. fn: function (aString){
  3689. var self=this;
  3690. return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString);
  3691. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString}, smalltalk.StringStream)})}
  3692. }),
  3693. smalltalk.StringStream);
  3694. smalltalk.addMethod(
  3695. "_nextPutAll_",
  3696. smalltalk.method({
  3697. selector: "nextPutAll:",
  3698. fn: function (aString){
  3699. var self=this;
  3700. return smalltalk.withContext(function($ctx1) { _st(self)._setCollection_(_st(_st(_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position())).__comma(aString)).__comma(_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size())));
  3701. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  3702. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3703. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString}, smalltalk.StringStream)})}
  3704. }),
  3705. smalltalk.StringStream);
  3706. smalltalk.addMethod(
  3707. "_space",
  3708. smalltalk.method({
  3709. selector: "space",
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(" ");
  3713. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.StringStream)})}
  3714. }),
  3715. smalltalk.StringStream);