Kernel-Collections.deploy.js 115 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012
  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. "_asSelector",
  2155. smalltalk.method({
  2156. selector: "asSelector",
  2157. fn: function (){
  2158. var self=this;
  2159. return smalltalk.withContext(function($ctx1) { return smalltalk.selector(self);
  2160. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.String)})}
  2161. }),
  2162. smalltalk.String);
  2163. smalltalk.addMethod(
  2164. "_asString",
  2165. smalltalk.method({
  2166. selector: "asString",
  2167. fn: function (){
  2168. var self=this;
  2169. return smalltalk.withContext(function($ctx1) { var $1;
  2170. $1=self;
  2171. return $1;
  2172. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.String)})}
  2173. }),
  2174. smalltalk.String);
  2175. smalltalk.addMethod(
  2176. "_asSymbol",
  2177. smalltalk.method({
  2178. selector: "asSymbol",
  2179. fn: function (){
  2180. var self=this;
  2181. return smalltalk.withContext(function($ctx1) { var $1;
  2182. $1=_st((smalltalk.Symbol || Symbol))._lookup_(self);
  2183. return $1;
  2184. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.String)})}
  2185. }),
  2186. smalltalk.String);
  2187. smalltalk.addMethod(
  2188. "_asUppercase",
  2189. smalltalk.method({
  2190. selector: "asUppercase",
  2191. fn: function (){
  2192. var self=this;
  2193. return smalltalk.withContext(function($ctx1) { return self.toUpperCase();
  2194. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.String)})}
  2195. }),
  2196. smalltalk.String);
  2197. smalltalk.addMethod(
  2198. "_asciiValue",
  2199. smalltalk.method({
  2200. selector: "asciiValue",
  2201. fn: function (){
  2202. var self=this;
  2203. return smalltalk.withContext(function($ctx1) { return self.charCodeAt(0);;
  2204. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{}, smalltalk.String)})}
  2205. }),
  2206. smalltalk.String);
  2207. smalltalk.addMethod(
  2208. "_at_ifAbsent_",
  2209. smalltalk.method({
  2210. selector: "at:ifAbsent:",
  2211. fn: function (anIndex,aBlock){
  2212. var self=this;
  2213. return smalltalk.withContext(function($ctx1) { return String(self).charAt(anIndex - 1) || aBlock();
  2214. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.String)})}
  2215. }),
  2216. smalltalk.String);
  2217. smalltalk.addMethod(
  2218. "_copyFrom_to_",
  2219. smalltalk.method({
  2220. selector: "copyFrom:to:",
  2221. fn: function (anIndex,anotherIndex){
  2222. var self=this;
  2223. return smalltalk.withContext(function($ctx1) { return self.substring(anIndex - 1, anotherIndex);
  2224. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.String)})}
  2225. }),
  2226. smalltalk.String);
  2227. smalltalk.addMethod(
  2228. "_deepCopy",
  2229. smalltalk.method({
  2230. selector: "deepCopy",
  2231. fn: function (){
  2232. var self=this;
  2233. return smalltalk.withContext(function($ctx1) { var $1;
  2234. $1=_st(self)._shallowCopy();
  2235. return $1;
  2236. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.String)})}
  2237. }),
  2238. smalltalk.String);
  2239. smalltalk.addMethod(
  2240. "_do_",
  2241. smalltalk.method({
  2242. selector: "do:",
  2243. fn: function (aBlock){
  2244. var self=this;
  2245. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  2246. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.String)})}
  2247. }),
  2248. smalltalk.String);
  2249. smalltalk.addMethod(
  2250. "_escaped",
  2251. smalltalk.method({
  2252. selector: "escaped",
  2253. fn: function (){
  2254. var self=this;
  2255. return smalltalk.withContext(function($ctx1) { return escape(self);
  2256. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{}, smalltalk.String)})}
  2257. }),
  2258. smalltalk.String);
  2259. smalltalk.addMethod(
  2260. "_includesSubString_",
  2261. smalltalk.method({
  2262. selector: "includesSubString:",
  2263. fn: function (subString){
  2264. var self=this;
  2265. return smalltalk.withContext(function($ctx1) { return self.indexOf(subString) != -1 ;
  2266. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString}, smalltalk.String)})}
  2267. }),
  2268. smalltalk.String);
  2269. smalltalk.addMethod(
  2270. "_isString",
  2271. smalltalk.method({
  2272. selector: "isString",
  2273. fn: function (){
  2274. var self=this;
  2275. return smalltalk.withContext(function($ctx1) { return true;
  2276. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.String)})}
  2277. }),
  2278. smalltalk.String);
  2279. smalltalk.addMethod(
  2280. "_join_",
  2281. smalltalk.method({
  2282. selector: "join:",
  2283. fn: function (aCollection){
  2284. var self=this;
  2285. return smalltalk.withContext(function($ctx1) { var $1;
  2286. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  2287. return smalltalk.withContext(function($ctx2) { return _st(aCollection)._do_separatedBy_((function(each){
  2288. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(_st(each)._asString());
  2289. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  2290. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(self);
  2291. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2292. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  2293. return $1;
  2294. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection}, smalltalk.String)})}
  2295. }),
  2296. smalltalk.String);
  2297. smalltalk.addMethod(
  2298. "_lineIndicesDo_",
  2299. smalltalk.method({
  2300. selector: "lineIndicesDo:",
  2301. fn: function (aBlock){
  2302. var self=this;
  2303. var cr,lf,start,sz,nextLF,nextCR;
  2304. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$6,$8,$7,$2;
  2305. var $early={};
  2306. try {
  2307. start=(1);
  2308. sz=_st(self)._size();
  2309. cr=_st((smalltalk.String || String))._cr();
  2310. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  2311. lf=_st((smalltalk.String || String))._lf();
  2312. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  2313. $1=(function(){
  2314. return smalltalk.withContext(function($ctx2) { return _st(start).__lt_eq(sz);
  2315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  2316. $2=(function(){
  2317. return smalltalk.withContext(function($ctx2) { $3=_st(_st(nextLF).__eq((0)))._and_((function(){
  2318. return smalltalk.withContext(function($ctx3) { return _st(nextCR).__eq((0));
  2319. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2320. if(smalltalk.assert($3)){
  2321. _st(aBlock)._value_value_value_(start,sz,sz);
  2322. $4=self;
  2323. throw $early=[$4];
  2324. };
  2325. $5=_st(_st(nextCR).__eq((0)))._or_((function(){
  2326. return smalltalk.withContext(function($ctx3) { return _st(_st((0)).__lt(nextLF))._and_((function(){
  2327. return smalltalk.withContext(function($ctx4) { return _st(nextLF).__lt(nextCR);
  2328. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  2329. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  2330. $6=(function(){
  2331. return smalltalk.withContext(function($ctx3) { _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  2332. start=_st((1)).__plus(nextLF);
  2333. start;
  2334. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2335. return nextLF;
  2336. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  2337. $7=(function(){
  2338. return smalltalk.withContext(function($ctx3) { $8=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  2339. if(smalltalk.assert($8)){
  2340. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  2341. start=_st((1)).__plus(nextLF);
  2342. start;
  2343. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2344. nextCR;
  2345. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2346. return nextLF;
  2347. } else {
  2348. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  2349. start=_st((1)).__plus(nextCR);
  2350. start;
  2351. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2352. return nextCR;
  2353. };
  2354. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  2355. return _st($5)._ifTrue_ifFalse_($6,$7);
  2356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  2357. _st($1)._whileTrue_($2);
  2358. return self}
  2359. catch(e) {if(e===$early)return e[0]; throw e}
  2360. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR}, smalltalk.String)})}
  2361. }),
  2362. smalltalk.String);
  2363. smalltalk.addMethod(
  2364. "_lineNumber_",
  2365. smalltalk.method({
  2366. selector: "lineNumber:",
  2367. fn: function (anIndex){
  2368. var self=this;
  2369. var lineCount;
  2370. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  2371. var $early={};
  2372. try {
  2373. lineCount=(0);
  2374. $1=self;
  2375. $2=(function(start,endWithoutDelimiters,end){
  2376. return smalltalk.withContext(function($ctx2) { lineCount=_st(lineCount).__plus((1));
  2377. $3=_st(lineCount).__eq(anIndex);
  2378. if(smalltalk.assert($3)){
  2379. $4=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  2380. throw $early=[$4];
  2381. };
  2382. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})});
  2383. _st($1)._lineIndicesDo_($2);
  2384. return nil;
  2385. }
  2386. catch(e) {if(e===$early)return e[0]; throw e}
  2387. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount}, smalltalk.String)})}
  2388. }),
  2389. smalltalk.String);
  2390. smalltalk.addMethod(
  2391. "_lines",
  2392. smalltalk.method({
  2393. selector: "lines",
  2394. fn: function (){
  2395. var self=this;
  2396. var lines;
  2397. return smalltalk.withContext(function($ctx1) { var $1;
  2398. lines=_st((smalltalk.Array || Array))._new();
  2399. _st(self)._linesDo_((function(aLine){
  2400. return smalltalk.withContext(function($ctx2) { return _st(lines)._add_(aLine);
  2401. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  2402. $1=lines;
  2403. return $1;
  2404. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines}, smalltalk.String)})}
  2405. }),
  2406. smalltalk.String);
  2407. smalltalk.addMethod(
  2408. "_linesDo_",
  2409. smalltalk.method({
  2410. selector: "linesDo:",
  2411. fn: function (aBlock){
  2412. var self=this;
  2413. return smalltalk.withContext(function($ctx1) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  2414. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  2415. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  2416. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock}, smalltalk.String)})}
  2417. }),
  2418. smalltalk.String);
  2419. smalltalk.addMethod(
  2420. "_match_",
  2421. smalltalk.method({
  2422. selector: "match:",
  2423. fn: function (aRegexp){
  2424. var self=this;
  2425. return smalltalk.withContext(function($ctx1) { return self.search(aRegexp) != -1;
  2426. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp}, smalltalk.String)})}
  2427. }),
  2428. smalltalk.String);
  2429. smalltalk.addMethod(
  2430. "_matchesOf_",
  2431. smalltalk.method({
  2432. selector: "matchesOf:",
  2433. fn: function (aRegularExpression){
  2434. var self=this;
  2435. return smalltalk.withContext(function($ctx1) { return self.match(aRegularExpression);
  2436. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression}, smalltalk.String)})}
  2437. }),
  2438. smalltalk.String);
  2439. smalltalk.addMethod(
  2440. "_printNl",
  2441. smalltalk.method({
  2442. selector: "printNl",
  2443. fn: function (){
  2444. var self=this;
  2445. return smalltalk.withContext(function($ctx1) { console.log(self);
  2446. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.String)})}
  2447. }),
  2448. smalltalk.String);
  2449. smalltalk.addMethod(
  2450. "_printString",
  2451. smalltalk.method({
  2452. selector: "printString",
  2453. fn: function (){
  2454. var self=this;
  2455. return smalltalk.withContext(function($ctx1) { var $1;
  2456. $1=_st(_st("'").__comma(self)).__comma("'");
  2457. return $1;
  2458. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.String)})}
  2459. }),
  2460. smalltalk.String);
  2461. smalltalk.addMethod(
  2462. "_replace_with_",
  2463. smalltalk.method({
  2464. selector: "replace:with:",
  2465. fn: function (aString,anotherString){
  2466. var self=this;
  2467. return smalltalk.withContext(function($ctx1) { var $1;
  2468. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(aString,"g"),anotherString);
  2469. return $1;
  2470. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString}, smalltalk.String)})}
  2471. }),
  2472. smalltalk.String);
  2473. smalltalk.addMethod(
  2474. "_replaceRegexp_with_",
  2475. smalltalk.method({
  2476. selector: "replaceRegexp:with:",
  2477. fn: function (aRegexp,aString){
  2478. var self=this;
  2479. return smalltalk.withContext(function($ctx1) { return self.replace(aRegexp, aString);
  2480. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString}, smalltalk.String)})}
  2481. }),
  2482. smalltalk.String);
  2483. smalltalk.addMethod(
  2484. "_reversed",
  2485. smalltalk.method({
  2486. selector: "reversed",
  2487. fn: function (){
  2488. var self=this;
  2489. return smalltalk.withContext(function($ctx1) { return self.split("").reverse().join("");
  2490. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.String)})}
  2491. }),
  2492. smalltalk.String);
  2493. smalltalk.addMethod(
  2494. "_shallowCopy",
  2495. smalltalk.method({
  2496. selector: "shallowCopy",
  2497. fn: function (){
  2498. var self=this;
  2499. return smalltalk.withContext(function($ctx1) { var $1;
  2500. $1=_st(_st(self)._class())._fromString_(self);
  2501. return $1;
  2502. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.String)})}
  2503. }),
  2504. smalltalk.String);
  2505. smalltalk.addMethod(
  2506. "_size",
  2507. smalltalk.method({
  2508. selector: "size",
  2509. fn: function (){
  2510. var self=this;
  2511. return smalltalk.withContext(function($ctx1) { return self.length;
  2512. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.String)})}
  2513. }),
  2514. smalltalk.String);
  2515. smalltalk.addMethod(
  2516. "_tokenize_",
  2517. smalltalk.method({
  2518. selector: "tokenize:",
  2519. fn: function (aString){
  2520. var self=this;
  2521. return smalltalk.withContext(function($ctx1) { return self.split(aString);
  2522. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString}, smalltalk.String)})}
  2523. }),
  2524. smalltalk.String);
  2525. smalltalk.addMethod(
  2526. "_trimBoth",
  2527. smalltalk.method({
  2528. selector: "trimBoth",
  2529. fn: function (){
  2530. var self=this;
  2531. return smalltalk.withContext(function($ctx1) { var $1;
  2532. $1=_st(self)._trimBoth_("\x5cs");
  2533. return $1;
  2534. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{}, smalltalk.String)})}
  2535. }),
  2536. smalltalk.String);
  2537. smalltalk.addMethod(
  2538. "_trimBoth_",
  2539. smalltalk.method({
  2540. selector: "trimBoth:",
  2541. fn: function (separators){
  2542. var self=this;
  2543. return smalltalk.withContext(function($ctx1) { var $1;
  2544. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  2545. return $1;
  2546. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators}, smalltalk.String)})}
  2547. }),
  2548. smalltalk.String);
  2549. smalltalk.addMethod(
  2550. "_trimLeft",
  2551. smalltalk.method({
  2552. selector: "trimLeft",
  2553. fn: function (){
  2554. var self=this;
  2555. return smalltalk.withContext(function($ctx1) { var $1;
  2556. $1=_st(self)._trimLeft_("\x5cs");
  2557. return $1;
  2558. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{}, smalltalk.String)})}
  2559. }),
  2560. smalltalk.String);
  2561. smalltalk.addMethod(
  2562. "_trimLeft_",
  2563. smalltalk.method({
  2564. selector: "trimLeft:",
  2565. fn: function (separators){
  2566. var self=this;
  2567. return smalltalk.withContext(function($ctx1) { var $1;
  2568. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  2569. return $1;
  2570. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators}, smalltalk.String)})}
  2571. }),
  2572. smalltalk.String);
  2573. smalltalk.addMethod(
  2574. "_trimRight",
  2575. smalltalk.method({
  2576. selector: "trimRight",
  2577. fn: function (){
  2578. var self=this;
  2579. return smalltalk.withContext(function($ctx1) { var $1;
  2580. $1=_st(self)._trimRight_("\x5cs");
  2581. return $1;
  2582. }, function($ctx1) {$ctx1.fill(self,"trimRight",{}, smalltalk.String)})}
  2583. }),
  2584. smalltalk.String);
  2585. smalltalk.addMethod(
  2586. "_trimRight_",
  2587. smalltalk.method({
  2588. selector: "trimRight:",
  2589. fn: function (separators){
  2590. var self=this;
  2591. return smalltalk.withContext(function($ctx1) { var $1;
  2592. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  2593. return $1;
  2594. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators}, smalltalk.String)})}
  2595. }),
  2596. smalltalk.String);
  2597. smalltalk.addMethod(
  2598. "_unescaped",
  2599. smalltalk.method({
  2600. selector: "unescaped",
  2601. fn: function (){
  2602. var self=this;
  2603. return smalltalk.withContext(function($ctx1) { return unescape(self);
  2604. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{}, smalltalk.String)})}
  2605. }),
  2606. smalltalk.String);
  2607. smalltalk.addMethod(
  2608. "_withIndexDo_",
  2609. smalltalk.method({
  2610. selector: "withIndexDo:",
  2611. fn: function (aBlock){
  2612. var self=this;
  2613. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  2614. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.String)})}
  2615. }),
  2616. smalltalk.String);
  2617. smalltalk.addMethod(
  2618. "_cr",
  2619. smalltalk.method({
  2620. selector: "cr",
  2621. fn: function (){
  2622. var self=this;
  2623. return smalltalk.withContext(function($ctx1) { return '\r';
  2624. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.String.klass)})}
  2625. }),
  2626. smalltalk.String.klass);
  2627. smalltalk.addMethod(
  2628. "_crlf",
  2629. smalltalk.method({
  2630. selector: "crlf",
  2631. fn: function (){
  2632. var self=this;
  2633. return smalltalk.withContext(function($ctx1) { return '\r\n';
  2634. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.String.klass)})}
  2635. }),
  2636. smalltalk.String.klass);
  2637. smalltalk.addMethod(
  2638. "_fromCharCode_",
  2639. smalltalk.method({
  2640. selector: "fromCharCode:",
  2641. fn: function (anInteger){
  2642. var self=this;
  2643. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(anInteger);
  2644. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger}, smalltalk.String.klass)})}
  2645. }),
  2646. smalltalk.String.klass);
  2647. smalltalk.addMethod(
  2648. "_fromString_",
  2649. smalltalk.method({
  2650. selector: "fromString:",
  2651. fn: function (aString){
  2652. var self=this;
  2653. return smalltalk.withContext(function($ctx1) { return new self.fn(aString);
  2654. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.String.klass)})}
  2655. }),
  2656. smalltalk.String.klass);
  2657. smalltalk.addMethod(
  2658. "_lf",
  2659. smalltalk.method({
  2660. selector: "lf",
  2661. fn: function (){
  2662. var self=this;
  2663. return smalltalk.withContext(function($ctx1) { return '\n';
  2664. return self}, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.String.klass)})}
  2665. }),
  2666. smalltalk.String.klass);
  2667. smalltalk.addMethod(
  2668. "_space",
  2669. smalltalk.method({
  2670. selector: "space",
  2671. fn: function (){
  2672. var self=this;
  2673. return smalltalk.withContext(function($ctx1) { return ' ';
  2674. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.String.klass)})}
  2675. }),
  2676. smalltalk.String.klass);
  2677. smalltalk.addMethod(
  2678. "_streamClass",
  2679. smalltalk.method({
  2680. selector: "streamClass",
  2681. fn: function (){
  2682. var self=this;
  2683. return smalltalk.withContext(function($ctx1) { var $1;
  2684. $1=(smalltalk.StringStream || StringStream);
  2685. return $1;
  2686. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.String.klass)})}
  2687. }),
  2688. smalltalk.String.klass);
  2689. smalltalk.addMethod(
  2690. "_streamContents_",
  2691. smalltalk.method({
  2692. selector: "streamContents:",
  2693. fn: function (blockWithArg){
  2694. var self=this;
  2695. var stream;
  2696. return smalltalk.withContext(function($ctx1) { var $1;
  2697. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  2698. _st(blockWithArg)._value_(stream);
  2699. $1=_st(stream)._contents();
  2700. return $1;
  2701. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream}, smalltalk.String.klass)})}
  2702. }),
  2703. smalltalk.String.klass);
  2704. smalltalk.addMethod(
  2705. "_tab",
  2706. smalltalk.method({
  2707. selector: "tab",
  2708. fn: function (){
  2709. var self=this;
  2710. return smalltalk.withContext(function($ctx1) { return '\t';
  2711. return self}, function($ctx1) {$ctx1.fill(self,"tab",{}, smalltalk.String.klass)})}
  2712. }),
  2713. smalltalk.String.klass);
  2714. smalltalk.addMethod(
  2715. "_value_",
  2716. smalltalk.method({
  2717. selector: "value:",
  2718. fn: function (aUTFCharCode){
  2719. var self=this;
  2720. return smalltalk.withContext(function($ctx1) { return String.fromCharCode(aUTFCharCode);;
  2721. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode}, smalltalk.String.klass)})}
  2722. }),
  2723. smalltalk.String.klass);
  2724. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2725. smalltalk.addMethod(
  2726. "__lt",
  2727. smalltalk.method({
  2728. selector: "<",
  2729. fn: function (aSymbol){
  2730. var self=this;
  2731. return smalltalk.withContext(function($ctx1) { var $1;
  2732. $1=_st(_st(self)._asString()).__lt(_st(aSymbol)._asString());
  2733. return $1;
  2734. }, function($ctx1) {$ctx1.fill(self,"<",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2735. }),
  2736. smalltalk.Symbol);
  2737. smalltalk.addMethod(
  2738. "__lt_eq",
  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_eq(_st(aSymbol)._asString());
  2745. return $1;
  2746. }, function($ctx1) {$ctx1.fill(self,"<=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2747. }),
  2748. smalltalk.Symbol);
  2749. smalltalk.addMethod(
  2750. "__eq",
  2751. smalltalk.method({
  2752. selector: "=",
  2753. fn: function (aSymbol){
  2754. var self=this;
  2755. return smalltalk.withContext(function($ctx1) { var $1,$2;
  2756. $1=_st(_st(aSymbol)._class()).__eq(_st(self)._class());
  2757. if(! smalltalk.assert($1)){
  2758. return false;
  2759. };
  2760. $2=_st(_st(self)._asString()).__eq(_st(aSymbol)._asString());
  2761. return $2;
  2762. }, function($ctx1) {$ctx1.fill(self,"=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2763. }),
  2764. smalltalk.Symbol);
  2765. smalltalk.addMethod(
  2766. "__gt",
  2767. smalltalk.method({
  2768. selector: ">",
  2769. fn: function (aSymbol){
  2770. var self=this;
  2771. return smalltalk.withContext(function($ctx1) { var $1;
  2772. $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString());
  2773. return $1;
  2774. }, function($ctx1) {$ctx1.fill(self,">",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2775. }),
  2776. smalltalk.Symbol);
  2777. smalltalk.addMethod(
  2778. "__gt_eq",
  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_eq(_st(aSymbol)._asString());
  2785. return $1;
  2786. }, function($ctx1) {$ctx1.fill(self,">=",{aSymbol:aSymbol}, smalltalk.Symbol)})}
  2787. }),
  2788. smalltalk.Symbol);
  2789. smalltalk.addMethod(
  2790. "_asJSON",
  2791. smalltalk.method({
  2792. selector: "asJSON",
  2793. fn: function (){
  2794. var self=this;
  2795. return smalltalk.withContext(function($ctx1) { var $1;
  2796. $1=_st(_st(self)._asString())._asJSON();
  2797. return $1;
  2798. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Symbol)})}
  2799. }),
  2800. smalltalk.Symbol);
  2801. smalltalk.addMethod(
  2802. "_asJavascript",
  2803. smalltalk.method({
  2804. selector: "asJavascript",
  2805. fn: function (){
  2806. var self=this;
  2807. return smalltalk.withContext(function($ctx1) { var $1;
  2808. $1=_st(_st("smalltalk.symbolFor(\x22").__comma(_st(self)._asString())).__comma("\x22)");
  2809. return $1;
  2810. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Symbol)})}
  2811. }),
  2812. smalltalk.Symbol);
  2813. smalltalk.addMethod(
  2814. "_asSelector",
  2815. smalltalk.method({
  2816. selector: "asSelector",
  2817. fn: function (){
  2818. var self=this;
  2819. return smalltalk.withContext(function($ctx1) { var $1;
  2820. $1=_st(_st(self)._asString())._asSelector();
  2821. return $1;
  2822. }, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.Symbol)})}
  2823. }),
  2824. smalltalk.Symbol);
  2825. smalltalk.addMethod(
  2826. "_asString",
  2827. smalltalk.method({
  2828. selector: "asString",
  2829. fn: function (){
  2830. var self=this;
  2831. return smalltalk.withContext(function($ctx1) { return self.value;
  2832. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Symbol)})}
  2833. }),
  2834. smalltalk.Symbol);
  2835. smalltalk.addMethod(
  2836. "_asSuperSelector",
  2837. smalltalk.method({
  2838. selector: "asSuperSelector",
  2839. fn: function (){
  2840. var self=this;
  2841. return smalltalk.withContext(function($ctx1) { var $1;
  2842. $1=_st(_st(self)._asString())._asSuperSelector();
  2843. return $1;
  2844. }, function($ctx1) {$ctx1.fill(self,"asSuperSelector",{}, smalltalk.Symbol)})}
  2845. }),
  2846. smalltalk.Symbol);
  2847. smalltalk.addMethod(
  2848. "_asSymbol",
  2849. smalltalk.method({
  2850. selector: "asSymbol",
  2851. fn: function (){
  2852. var self=this;
  2853. return smalltalk.withContext(function($ctx1) { var $1;
  2854. $1=self;
  2855. return $1;
  2856. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.Symbol)})}
  2857. }),
  2858. smalltalk.Symbol);
  2859. smalltalk.addMethod(
  2860. "_at_ifAbsent_",
  2861. smalltalk.method({
  2862. selector: "at:ifAbsent:",
  2863. fn: function (anIndex,aBlock){
  2864. var self=this;
  2865. return smalltalk.withContext(function($ctx1) { var $1;
  2866. $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock);
  2867. return $1;
  2868. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Symbol)})}
  2869. }),
  2870. smalltalk.Symbol);
  2871. smalltalk.addMethod(
  2872. "_collect_",
  2873. smalltalk.method({
  2874. selector: "collect:",
  2875. fn: function (aBlock){
  2876. var self=this;
  2877. return smalltalk.withContext(function($ctx1) { var $1;
  2878. $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol();
  2879. return $1;
  2880. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2881. }),
  2882. smalltalk.Symbol);
  2883. smalltalk.addMethod(
  2884. "_copyFrom_to_",
  2885. smalltalk.method({
  2886. selector: "copyFrom:to:",
  2887. fn: function (anIndex,anotherIndex){
  2888. var self=this;
  2889. return smalltalk.withContext(function($ctx1) { var $1;
  2890. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex));
  2891. return $1;
  2892. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.Symbol)})}
  2893. }),
  2894. smalltalk.Symbol);
  2895. smalltalk.addMethod(
  2896. "_deepCopy",
  2897. smalltalk.method({
  2898. selector: "deepCopy",
  2899. fn: function (){
  2900. var self=this;
  2901. return smalltalk.withContext(function($ctx1) { var $1;
  2902. $1=self;
  2903. return $1;
  2904. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Symbol)})}
  2905. }),
  2906. smalltalk.Symbol);
  2907. smalltalk.addMethod(
  2908. "_detect_",
  2909. smalltalk.method({
  2910. selector: "detect:",
  2911. fn: function (aBlock){
  2912. var self=this;
  2913. return smalltalk.withContext(function($ctx1) { var $1;
  2914. $1=_st(_st(self)._asString())._detect_(aBlock);
  2915. return $1;
  2916. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2917. }),
  2918. smalltalk.Symbol);
  2919. smalltalk.addMethod(
  2920. "_do_",
  2921. smalltalk.method({
  2922. selector: "do:",
  2923. fn: function (aBlock){
  2924. var self=this;
  2925. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._do_(aBlock);
  2926. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2927. }),
  2928. smalltalk.Symbol);
  2929. smalltalk.addMethod(
  2930. "_isSymbol",
  2931. smalltalk.method({
  2932. selector: "isSymbol",
  2933. fn: function (){
  2934. var self=this;
  2935. return smalltalk.withContext(function($ctx1) { return true;
  2936. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Symbol)})}
  2937. }),
  2938. smalltalk.Symbol);
  2939. smalltalk.addMethod(
  2940. "_printString",
  2941. smalltalk.method({
  2942. selector: "printString",
  2943. fn: function (){
  2944. var self=this;
  2945. return smalltalk.withContext(function($ctx1) { var $1;
  2946. $1=_st("#").__comma(_st(self)._asString());
  2947. return $1;
  2948. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Symbol)})}
  2949. }),
  2950. smalltalk.Symbol);
  2951. smalltalk.addMethod(
  2952. "_select_",
  2953. smalltalk.method({
  2954. selector: "select:",
  2955. fn: function (aBlock){
  2956. var self=this;
  2957. return smalltalk.withContext(function($ctx1) { var $1;
  2958. $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol();
  2959. return $1;
  2960. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock}, smalltalk.Symbol)})}
  2961. }),
  2962. smalltalk.Symbol);
  2963. smalltalk.addMethod(
  2964. "_shallowCopy",
  2965. smalltalk.method({
  2966. selector: "shallowCopy",
  2967. fn: function (){
  2968. var self=this;
  2969. return smalltalk.withContext(function($ctx1) { var $1;
  2970. $1=self;
  2971. return $1;
  2972. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Symbol)})}
  2973. }),
  2974. smalltalk.Symbol);
  2975. smalltalk.addMethod(
  2976. "_size",
  2977. smalltalk.method({
  2978. selector: "size",
  2979. fn: function (){
  2980. var self=this;
  2981. return smalltalk.withContext(function($ctx1) { var $1;
  2982. $1=_st(_st(self)._asString())._size();
  2983. return $1;
  2984. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Symbol)})}
  2985. }),
  2986. smalltalk.Symbol);
  2987. smalltalk.addMethod(
  2988. "_value_",
  2989. smalltalk.method({
  2990. selector: "value:",
  2991. fn: function (anObject){
  2992. var self=this;
  2993. return smalltalk.withContext(function($ctx1) { var $1;
  2994. $1=_st(anObject)._perform_(self);
  2995. return $1;
  2996. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject}, smalltalk.Symbol)})}
  2997. }),
  2998. smalltalk.Symbol);
  2999. smalltalk.addMethod(
  3000. "_withIndexDo_",
  3001. smalltalk.method({
  3002. selector: "withIndexDo:",
  3003. fn: function (aBlock){
  3004. var self=this;
  3005. return smalltalk.withContext(function($ctx1) { _st(_st(self)._asString())._withIndexDo_(aBlock);
  3006. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.Symbol)})}
  3007. }),
  3008. smalltalk.Symbol);
  3009. smalltalk.addMethod(
  3010. "_basicNew",
  3011. smalltalk.method({
  3012. selector: "basicNew",
  3013. fn: function (){
  3014. var self=this;
  3015. return smalltalk.withContext(function($ctx1) { _st(self)._shouldNotImplement();
  3016. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Symbol.klass)})}
  3017. }),
  3018. smalltalk.Symbol.klass);
  3019. smalltalk.addMethod(
  3020. "_fromString_",
  3021. smalltalk.method({
  3022. selector: "fromString:",
  3023. fn: function (aString){
  3024. var self=this;
  3025. return smalltalk.withContext(function($ctx1) { var $1;
  3026. $1=_st(self)._lookup_(aString);
  3027. return $1;
  3028. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Symbol.klass)})}
  3029. }),
  3030. smalltalk.Symbol.klass);
  3031. smalltalk.addMethod(
  3032. "_lookup_",
  3033. smalltalk.method({
  3034. selector: "lookup:",
  3035. fn: function (aString){
  3036. var self=this;
  3037. return smalltalk.withContext(function($ctx1) { return smalltalk.symbolFor(aString);;
  3038. return self}, function($ctx1) {$ctx1.fill(self,"lookup:",{aString:aString}, smalltalk.Symbol.klass)})}
  3039. }),
  3040. smalltalk.Symbol.klass);
  3041. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  3042. smalltalk.addMethod(
  3043. "__eq",
  3044. smalltalk.method({
  3045. selector: "=",
  3046. fn: function (aCollection){
  3047. var self=this;
  3048. return smalltalk.withContext(function($ctx1) { var $1;
  3049. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  3050. return smalltalk.withContext(function($ctx2) { return _st(self["@elements"]).__eq(_st(aCollection)._asArray());
  3051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3052. return $1;
  3053. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.Set)})}
  3054. }),
  3055. smalltalk.Set);
  3056. smalltalk.addMethod(
  3057. "_add_",
  3058. smalltalk.method({
  3059. selector: "add:",
  3060. fn: function (anObject){
  3061. var self=this;
  3062. return smalltalk.withContext(function($ctx1) {
  3063. var found;
  3064. for(var i=0; i < self['@elements'].length; i++) {
  3065. if(anObject == self['@elements'][i]) {
  3066. found = true;
  3067. break;
  3068. }
  3069. }
  3070. if(!found) {self['@elements'].push(anObject)}
  3071. ;
  3072. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Set)})}
  3073. }),
  3074. smalltalk.Set);
  3075. smalltalk.addMethod(
  3076. "_asArray",
  3077. smalltalk.method({
  3078. selector: "asArray",
  3079. fn: function (){
  3080. var self=this;
  3081. return smalltalk.withContext(function($ctx1) { var $1;
  3082. $1=_st(self["@elements"])._copy();
  3083. return $1;
  3084. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Set)})}
  3085. }),
  3086. smalltalk.Set);
  3087. smalltalk.addMethod(
  3088. "_detect_ifNone_",
  3089. smalltalk.method({
  3090. selector: "detect:ifNone:",
  3091. fn: function (aBlock,anotherBlock){
  3092. var self=this;
  3093. return smalltalk.withContext(function($ctx1) { var $1;
  3094. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  3095. return $1;
  3096. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Set)})}
  3097. }),
  3098. smalltalk.Set);
  3099. smalltalk.addMethod(
  3100. "_do_",
  3101. smalltalk.method({
  3102. selector: "do:",
  3103. fn: function (aBlock){
  3104. var self=this;
  3105. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._do_(aBlock);
  3106. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Set)})}
  3107. }),
  3108. smalltalk.Set);
  3109. smalltalk.addMethod(
  3110. "_includes_",
  3111. smalltalk.method({
  3112. selector: "includes:",
  3113. fn: function (anObject){
  3114. var self=this;
  3115. return smalltalk.withContext(function($ctx1) { var $1;
  3116. $1=_st(self["@elements"])._includes_(anObject);
  3117. return $1;
  3118. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Set)})}
  3119. }),
  3120. smalltalk.Set);
  3121. smalltalk.addMethod(
  3122. "_initialize",
  3123. smalltalk.method({
  3124. selector: "initialize",
  3125. fn: function (){
  3126. var self=this;
  3127. return smalltalk.withContext(function($ctx1) { smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  3128. self["@elements"]=[];
  3129. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Set)})}
  3130. }),
  3131. smalltalk.Set);
  3132. smalltalk.addMethod(
  3133. "_remove_",
  3134. smalltalk.method({
  3135. selector: "remove:",
  3136. fn: function (anObject){
  3137. var self=this;
  3138. return smalltalk.withContext(function($ctx1) { _st(self["@elements"])._remove_(anObject);
  3139. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Set)})}
  3140. }),
  3141. smalltalk.Set);
  3142. smalltalk.addMethod(
  3143. "_select_",
  3144. smalltalk.method({
  3145. selector: "select:",
  3146. fn: function (aBlock){
  3147. var self=this;
  3148. var collection;
  3149. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3150. collection=_st(_st(self)._class())._new();
  3151. $1=self;
  3152. $2=(function(each){
  3153. return smalltalk.withContext(function($ctx2) { $3=_st(aBlock)._value_(each);
  3154. if(smalltalk.assert($3)){
  3155. return _st(collection)._add_(each);
  3156. };
  3157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  3158. _st($1)._do_($2);
  3159. $4=collection;
  3160. return $4;
  3161. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection}, smalltalk.Set)})}
  3162. }),
  3163. smalltalk.Set);
  3164. smalltalk.addMethod(
  3165. "_size",
  3166. smalltalk.method({
  3167. selector: "size",
  3168. fn: function (){
  3169. var self=this;
  3170. return smalltalk.withContext(function($ctx1) { var $1;
  3171. $1=_st(self["@elements"])._size();
  3172. return $1;
  3173. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Set)})}
  3174. }),
  3175. smalltalk.Set);
  3176. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  3177. smalltalk.addMethod(
  3178. "_back_",
  3179. smalltalk.method({
  3180. selector: "back:",
  3181. fn: function (anObject){
  3182. var self=this;
  3183. return smalltalk.withContext(function($ctx1) { _st(self["@write"])._add_(anObject);
  3184. return self}, function($ctx1) {$ctx1.fill(self,"back:",{anObject:anObject}, smalltalk.Queue)})}
  3185. }),
  3186. smalltalk.Queue);
  3187. smalltalk.addMethod(
  3188. "_front",
  3189. smalltalk.method({
  3190. selector: "front",
  3191. fn: function (){
  3192. var self=this;
  3193. return smalltalk.withContext(function($ctx1) { var $1;
  3194. $1=_st(self)._frontIfAbsent_((function(){
  3195. return smalltalk.withContext(function($ctx2) { return _st(self)._error_("Cannot read from empty Queue.");
  3196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3197. return $1;
  3198. }, function($ctx1) {$ctx1.fill(self,"front",{}, smalltalk.Queue)})}
  3199. }),
  3200. smalltalk.Queue);
  3201. smalltalk.addMethod(
  3202. "_frontIfAbsent_",
  3203. smalltalk.method({
  3204. selector: "frontIfAbsent:",
  3205. fn: function (aBlock){
  3206. var self=this;
  3207. var result;
  3208. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$6,$7,$5,$3,$8;
  3209. var $early={};
  3210. try {
  3211. $1=self["@read"];
  3212. $2=self["@readIndex"];
  3213. $3=(function(){
  3214. return smalltalk.withContext(function($ctx2) { $4=_st(self["@write"])._isEmpty();
  3215. $5=(function(){
  3216. return smalltalk.withContext(function($ctx3) { $6=_st(self["@readIndex"]).__gt((1));
  3217. if(smalltalk.assert($6)){
  3218. self["@read"]=[];
  3219. self["@read"];
  3220. self["@readIndex"]=(1);
  3221. self["@readIndex"];
  3222. };
  3223. $7=_st(aBlock)._value();
  3224. throw $early=[$7];
  3225. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})});
  3226. _st($4)._ifTrue_($5);
  3227. self["@read"]=self["@write"];
  3228. self["@read"];
  3229. self["@readIndex"]=(1);
  3230. self["@readIndex"];
  3231. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3232. self["@write"];
  3233. return _st(self["@read"])._first();
  3234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3235. result=_st($1)._at_ifAbsent_($2,$3);
  3236. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  3237. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  3238. $8=result;
  3239. return $8;
  3240. }
  3241. catch(e) {if(e===$early)return e[0]; throw e}
  3242. }, function($ctx1) {$ctx1.fill(self,"frontIfAbsent:",{aBlock:aBlock,result:result}, smalltalk.Queue)})}
  3243. }),
  3244. smalltalk.Queue);
  3245. smalltalk.addMethod(
  3246. "_initialize",
  3247. smalltalk.method({
  3248. selector: "initialize",
  3249. fn: function (){
  3250. var self=this;
  3251. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  3252. self["@read"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3253. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  3254. self["@readIndex"]=(1);
  3255. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Queue)})}
  3256. }),
  3257. smalltalk.Queue);
  3258. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  3259. smalltalk.addMethod(
  3260. "_compile_",
  3261. smalltalk.method({
  3262. selector: "compile:",
  3263. fn: function (aString){
  3264. var self=this;
  3265. return smalltalk.withContext(function($ctx1) { return self.compile(aString);
  3266. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.RegularExpression)})}
  3267. }),
  3268. smalltalk.RegularExpression);
  3269. smalltalk.addMethod(
  3270. "_exec_",
  3271. smalltalk.method({
  3272. selector: "exec:",
  3273. fn: function (aString){
  3274. var self=this;
  3275. return smalltalk.withContext(function($ctx1) { return self.exec(aString) || nil;
  3276. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString}, smalltalk.RegularExpression)})}
  3277. }),
  3278. smalltalk.RegularExpression);
  3279. smalltalk.addMethod(
  3280. "_test_",
  3281. smalltalk.method({
  3282. selector: "test:",
  3283. fn: function (aString){
  3284. var self=this;
  3285. return smalltalk.withContext(function($ctx1) { return self.test(aString);
  3286. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString}, smalltalk.RegularExpression)})}
  3287. }),
  3288. smalltalk.RegularExpression);
  3289. smalltalk.addMethod(
  3290. "_fromString_",
  3291. smalltalk.method({
  3292. selector: "fromString:",
  3293. fn: function (aString){
  3294. var self=this;
  3295. return smalltalk.withContext(function($ctx1) { var $1;
  3296. $1=_st(self)._fromString_flag_(aString,"");
  3297. return $1;
  3298. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.RegularExpression.klass)})}
  3299. }),
  3300. smalltalk.RegularExpression.klass);
  3301. smalltalk.addMethod(
  3302. "_fromString_flag_",
  3303. smalltalk.method({
  3304. selector: "fromString:flag:",
  3305. fn: function (aString,anotherString){
  3306. var self=this;
  3307. return smalltalk.withContext(function($ctx1) { return new RegExp(aString, anotherString);
  3308. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString}, smalltalk.RegularExpression.klass)})}
  3309. }),
  3310. smalltalk.RegularExpression.klass);
  3311. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  3312. smalltalk.addMethod(
  3313. "_atEnd",
  3314. smalltalk.method({
  3315. selector: "atEnd",
  3316. fn: function (){
  3317. var self=this;
  3318. return smalltalk.withContext(function($ctx1) { var $1;
  3319. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  3320. return $1;
  3321. }, function($ctx1) {$ctx1.fill(self,"atEnd",{}, smalltalk.Stream)})}
  3322. }),
  3323. smalltalk.Stream);
  3324. smalltalk.addMethod(
  3325. "_atStart",
  3326. smalltalk.method({
  3327. selector: "atStart",
  3328. fn: function (){
  3329. var self=this;
  3330. return smalltalk.withContext(function($ctx1) { var $1;
  3331. $1=_st(_st(self)._position()).__eq((0));
  3332. return $1;
  3333. }, function($ctx1) {$ctx1.fill(self,"atStart",{}, smalltalk.Stream)})}
  3334. }),
  3335. smalltalk.Stream);
  3336. smalltalk.addMethod(
  3337. "_close",
  3338. smalltalk.method({
  3339. selector: "close",
  3340. fn: function (){
  3341. var self=this;
  3342. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"close",{}, smalltalk.Stream)})}
  3343. }),
  3344. smalltalk.Stream);
  3345. smalltalk.addMethod(
  3346. "_collection",
  3347. smalltalk.method({
  3348. selector: "collection",
  3349. fn: function (){
  3350. var self=this;
  3351. return smalltalk.withContext(function($ctx1) { var $1;
  3352. $1=self["@collection"];
  3353. return $1;
  3354. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.Stream)})}
  3355. }),
  3356. smalltalk.Stream);
  3357. smalltalk.addMethod(
  3358. "_contents",
  3359. smalltalk.method({
  3360. selector: "contents",
  3361. fn: function (){
  3362. var self=this;
  3363. return smalltalk.withContext(function($ctx1) { var $1;
  3364. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  3365. return $1;
  3366. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.Stream)})}
  3367. }),
  3368. smalltalk.Stream);
  3369. smalltalk.addMethod(
  3370. "_do_",
  3371. smalltalk.method({
  3372. selector: "do:",
  3373. fn: function (aBlock){
  3374. var self=this;
  3375. return smalltalk.withContext(function($ctx1) { _st((function(){
  3376. return smalltalk.withContext(function($ctx2) { return _st(self)._atEnd();
  3377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  3378. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_(_st(self)._next());
  3379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3380. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Stream)})}
  3381. }),
  3382. smalltalk.Stream);
  3383. smalltalk.addMethod(
  3384. "_flush",
  3385. smalltalk.method({
  3386. selector: "flush",
  3387. fn: function (){
  3388. var self=this;
  3389. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"flush",{}, smalltalk.Stream)})}
  3390. }),
  3391. smalltalk.Stream);
  3392. smalltalk.addMethod(
  3393. "_isEmpty",
  3394. smalltalk.method({
  3395. selector: "isEmpty",
  3396. fn: function (){
  3397. var self=this;
  3398. return smalltalk.withContext(function($ctx1) { var $1;
  3399. $1=_st(_st(self)._size()).__eq((0));
  3400. return $1;
  3401. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Stream)})}
  3402. }),
  3403. smalltalk.Stream);
  3404. smalltalk.addMethod(
  3405. "_next",
  3406. smalltalk.method({
  3407. selector: "next",
  3408. fn: function (){
  3409. var self=this;
  3410. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3411. $2=_st(self)._atEnd();
  3412. if(smalltalk.assert($2)){
  3413. $1=nil;
  3414. } else {
  3415. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3416. $1=_st(self["@collection"])._at_(_st(self)._position());
  3417. };
  3418. return $1;
  3419. }, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Stream)})}
  3420. }),
  3421. smalltalk.Stream);
  3422. smalltalk.addMethod(
  3423. "_next_",
  3424. smalltalk.method({
  3425. selector: "next:",
  3426. fn: function (anInteger){
  3427. var self=this;
  3428. var tempCollection;
  3429. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3430. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3431. $1=anInteger;
  3432. $2=(function(){
  3433. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  3434. if(! smalltalk.assert($3)){
  3435. return _st(tempCollection)._add_(_st(self)._next());
  3436. };
  3437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3438. _st($1)._timesRepeat_($2);
  3439. $4=tempCollection;
  3440. return $4;
  3441. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.Stream)})}
  3442. }),
  3443. smalltalk.Stream);
  3444. smalltalk.addMethod(
  3445. "_nextPut_",
  3446. smalltalk.method({
  3447. selector: "nextPut:",
  3448. fn: function (anObject){
  3449. var self=this;
  3450. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3451. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  3452. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3453. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject}, smalltalk.Stream)})}
  3454. }),
  3455. smalltalk.Stream);
  3456. smalltalk.addMethod(
  3457. "_nextPutAll_",
  3458. smalltalk.method({
  3459. selector: "nextPutAll:",
  3460. fn: function (aCollection){
  3461. var self=this;
  3462. return smalltalk.withContext(function($ctx1) { _st(aCollection)._do_((function(each){
  3463. return smalltalk.withContext(function($ctx2) { return _st(self)._nextPut_(each);
  3464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  3465. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection}, smalltalk.Stream)})}
  3466. }),
  3467. smalltalk.Stream);
  3468. smalltalk.addMethod(
  3469. "_peek",
  3470. smalltalk.method({
  3471. selector: "peek",
  3472. fn: function (){
  3473. var self=this;
  3474. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3475. $2=_st(self)._atEnd();
  3476. if(! smalltalk.assert($2)){
  3477. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  3478. };
  3479. return $1;
  3480. }, function($ctx1) {$ctx1.fill(self,"peek",{}, smalltalk.Stream)})}
  3481. }),
  3482. smalltalk.Stream);
  3483. smalltalk.addMethod(
  3484. "_position",
  3485. smalltalk.method({
  3486. selector: "position",
  3487. fn: function (){
  3488. var self=this;
  3489. return smalltalk.withContext(function($ctx1) { var $2,$1;
  3490. $2=self["@position"];
  3491. if(($receiver = $2) == nil || $receiver == undefined){
  3492. self["@position"]=(0);
  3493. $1=self["@position"];
  3494. } else {
  3495. $1=$2;
  3496. };
  3497. return $1;
  3498. }, function($ctx1) {$ctx1.fill(self,"position",{}, smalltalk.Stream)})}
  3499. }),
  3500. smalltalk.Stream);
  3501. smalltalk.addMethod(
  3502. "_position_",
  3503. smalltalk.method({
  3504. selector: "position:",
  3505. fn: function (anInteger){
  3506. var self=this;
  3507. return smalltalk.withContext(function($ctx1) { self["@position"]=anInteger;
  3508. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger}, smalltalk.Stream)})}
  3509. }),
  3510. smalltalk.Stream);
  3511. smalltalk.addMethod(
  3512. "_reset",
  3513. smalltalk.method({
  3514. selector: "reset",
  3515. fn: function (){
  3516. var self=this;
  3517. return smalltalk.withContext(function($ctx1) { _st(self)._position_((0));
  3518. return self}, function($ctx1) {$ctx1.fill(self,"reset",{}, smalltalk.Stream)})}
  3519. }),
  3520. smalltalk.Stream);
  3521. smalltalk.addMethod(
  3522. "_resetContents",
  3523. smalltalk.method({
  3524. selector: "resetContents",
  3525. fn: function (){
  3526. var self=this;
  3527. return smalltalk.withContext(function($ctx1) { _st(self)._reset();
  3528. _st(self)._setStreamSize_((0));
  3529. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{}, smalltalk.Stream)})}
  3530. }),
  3531. smalltalk.Stream);
  3532. smalltalk.addMethod(
  3533. "_setCollection_",
  3534. smalltalk.method({
  3535. selector: "setCollection:",
  3536. fn: function (aCollection){
  3537. var self=this;
  3538. return smalltalk.withContext(function($ctx1) { self["@collection"]=aCollection;
  3539. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection}, smalltalk.Stream)})}
  3540. }),
  3541. smalltalk.Stream);
  3542. smalltalk.addMethod(
  3543. "_setStreamSize_",
  3544. smalltalk.method({
  3545. selector: "setStreamSize:",
  3546. fn: function (anInteger){
  3547. var self=this;
  3548. return smalltalk.withContext(function($ctx1) { self["@streamSize"]=anInteger;
  3549. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger}, smalltalk.Stream)})}
  3550. }),
  3551. smalltalk.Stream);
  3552. smalltalk.addMethod(
  3553. "_setToEnd",
  3554. smalltalk.method({
  3555. selector: "setToEnd",
  3556. fn: function (){
  3557. var self=this;
  3558. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(self)._size());
  3559. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{}, smalltalk.Stream)})}
  3560. }),
  3561. smalltalk.Stream);
  3562. smalltalk.addMethod(
  3563. "_size",
  3564. smalltalk.method({
  3565. selector: "size",
  3566. fn: function (){
  3567. var self=this;
  3568. return smalltalk.withContext(function($ctx1) { var $1;
  3569. $1=_st(self)._streamSize();
  3570. return $1;
  3571. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Stream)})}
  3572. }),
  3573. smalltalk.Stream);
  3574. smalltalk.addMethod(
  3575. "_skip_",
  3576. smalltalk.method({
  3577. selector: "skip:",
  3578. fn: function (anInteger){
  3579. var self=this;
  3580. return smalltalk.withContext(function($ctx1) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  3581. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger}, smalltalk.Stream)})}
  3582. }),
  3583. smalltalk.Stream);
  3584. smalltalk.addMethod(
  3585. "_streamSize",
  3586. smalltalk.method({
  3587. selector: "streamSize",
  3588. fn: function (){
  3589. var self=this;
  3590. return smalltalk.withContext(function($ctx1) { var $1;
  3591. $1=self["@streamSize"];
  3592. return $1;
  3593. }, function($ctx1) {$ctx1.fill(self,"streamSize",{}, smalltalk.Stream)})}
  3594. }),
  3595. smalltalk.Stream);
  3596. smalltalk.addMethod(
  3597. "_on_",
  3598. smalltalk.method({
  3599. selector: "on:",
  3600. fn: function (aCollection){
  3601. var self=this;
  3602. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  3603. $2=_st(self)._new();
  3604. _st($2)._setCollection_(aCollection);
  3605. _st($2)._setStreamSize_(_st(aCollection)._size());
  3606. $3=_st($2)._yourself();
  3607. $1=$3;
  3608. return $1;
  3609. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection}, smalltalk.Stream.klass)})}
  3610. }),
  3611. smalltalk.Stream.klass);
  3612. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  3613. smalltalk.addMethod(
  3614. "_cr",
  3615. smalltalk.method({
  3616. selector: "cr",
  3617. fn: function (){
  3618. var self=this;
  3619. return smalltalk.withContext(function($ctx1) { var $1;
  3620. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  3621. return $1;
  3622. }, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.StringStream)})}
  3623. }),
  3624. smalltalk.StringStream);
  3625. smalltalk.addMethod(
  3626. "_crlf",
  3627. smalltalk.method({
  3628. selector: "crlf",
  3629. fn: function (){
  3630. var self=this;
  3631. return smalltalk.withContext(function($ctx1) { var $1;
  3632. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  3633. return $1;
  3634. }, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.StringStream)})}
  3635. }),
  3636. smalltalk.StringStream);
  3637. smalltalk.addMethod(
  3638. "_lf",
  3639. smalltalk.method({
  3640. selector: "lf",
  3641. fn: function (){
  3642. var self=this;
  3643. return smalltalk.withContext(function($ctx1) { var $1;
  3644. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  3645. return $1;
  3646. }, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.StringStream)})}
  3647. }),
  3648. smalltalk.StringStream);
  3649. smalltalk.addMethod(
  3650. "_next_",
  3651. smalltalk.method({
  3652. selector: "next:",
  3653. fn: function (anInteger){
  3654. var self=this;
  3655. var tempCollection;
  3656. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4;
  3657. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3658. $1=anInteger;
  3659. $2=(function(){
  3660. return smalltalk.withContext(function($ctx2) { $3=_st(self)._atEnd();
  3661. if(! smalltalk.assert($3)){
  3662. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  3663. return tempCollection;
  3664. };
  3665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  3666. _st($1)._timesRepeat_($2);
  3667. $4=tempCollection;
  3668. return $4;
  3669. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.StringStream)})}
  3670. }),
  3671. smalltalk.StringStream);
  3672. smalltalk.addMethod(
  3673. "_nextPut_",
  3674. smalltalk.method({
  3675. selector: "nextPut:",
  3676. fn: function (aString){
  3677. var self=this;
  3678. return smalltalk.withContext(function($ctx1) { _st(self)._nextPutAll_(aString);
  3679. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString}, smalltalk.StringStream)})}
  3680. }),
  3681. smalltalk.StringStream);
  3682. smalltalk.addMethod(
  3683. "_nextPutAll_",
  3684. smalltalk.method({
  3685. selector: "nextPutAll:",
  3686. fn: function (aString){
  3687. var self=this;
  3688. 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())));
  3689. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  3690. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3691. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString}, smalltalk.StringStream)})}
  3692. }),
  3693. smalltalk.StringStream);
  3694. smalltalk.addMethod(
  3695. "_space",
  3696. smalltalk.method({
  3697. selector: "space",
  3698. fn: function (){
  3699. var self=this;
  3700. return smalltalk.withContext(function($ctx1) { _st(self)._nextPut_(" ");
  3701. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.StringStream)})}
  3702. }),
  3703. smalltalk.StringStream);