2
0

Kernel.deploy.js 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204
  1. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel');
  2. smalltalk.addMethod(
  3. '__eq',
  4. smalltalk.method({
  5. selector: '=',
  6. fn: function (anObject){
  7. var self=this;
  8. return self == anObject;
  9. return self;}
  10. }),
  11. smalltalk.Object);
  12. smalltalk.addMethod(
  13. '_~_eq',
  14. smalltalk.method({
  15. selector: '~=',
  16. fn: function (anObject){
  17. var self=this;
  18. return smalltalk.send(smalltalk.send(self, "__eq", [anObject]), "__eq_eq", [false]);
  19. return self;}
  20. }),
  21. smalltalk.Object);
  22. smalltalk.addMethod(
  23. '_initialize',
  24. smalltalk.method({
  25. selector: 'initialize',
  26. fn: function (){
  27. var self=this;
  28. return self;}
  29. }),
  30. smalltalk.Object);
  31. smalltalk.addMethod(
  32. '_yourself',
  33. smalltalk.method({
  34. selector: 'yourself',
  35. fn: function (){
  36. var self=this;
  37. return self;
  38. return self;}
  39. }),
  40. smalltalk.Object);
  41. smalltalk.addMethod(
  42. '_class',
  43. smalltalk.method({
  44. selector: 'class',
  45. fn: function (){
  46. var self=this;
  47. return self.klass;
  48. return self;}
  49. }),
  50. smalltalk.Object);
  51. smalltalk.addMethod(
  52. '_size',
  53. smalltalk.method({
  54. selector: 'size',
  55. fn: function (){
  56. var self=this;
  57. smalltalk.send(self, "_error_", ["Object not indexable"]);
  58. return self;}
  59. }),
  60. smalltalk.Object);
  61. smalltalk.addMethod(
  62. '_copy',
  63. smalltalk.method({
  64. selector: 'copy',
  65. fn: function (){
  66. var self=this;
  67. return smalltalk.send(smalltalk.send(self, "_shallowCopy", []), "_postCopy", []);
  68. return self;}
  69. }),
  70. smalltalk.Object);
  71. smalltalk.addMethod(
  72. '_shallowCopy',
  73. smalltalk.method({
  74. selector: 'shallowCopy',
  75. fn: function (){
  76. var self=this;
  77. var copy = self.klass._new();
  78. for(var i in self) {
  79. if(/^@.+/.test(i)) {
  80. copy[i] = self[i];
  81. }
  82. }
  83. return copy;
  84. ;
  85. return self;}
  86. }),
  87. smalltalk.Object);
  88. smalltalk.addMethod(
  89. '_deepCopy',
  90. smalltalk.method({
  91. selector: 'deepCopy',
  92. fn: function (){
  93. var self=this;
  94. var copy = self.klass._new();
  95. for(var i in self) {
  96. if(/^@.+/.test(i)) {
  97. copy[i] = self[i]._deepCopy();
  98. }
  99. }
  100. return copy;
  101. ;
  102. return self;}
  103. }),
  104. smalltalk.Object);
  105. smalltalk.addMethod(
  106. '_postCopy',
  107. smalltalk.method({
  108. selector: 'postCopy',
  109. fn: function (){
  110. var self=this;
  111. return self;}
  112. }),
  113. smalltalk.Object);
  114. smalltalk.addMethod(
  115. '__minus_gt',
  116. smalltalk.method({
  117. selector: '->',
  118. fn: function (anObject){
  119. var self=this;
  120. return smalltalk.send(smalltalk.Association, "_key_value_", [self, anObject]);
  121. return self;}
  122. }),
  123. smalltalk.Object);
  124. smalltalk.addMethod(
  125. '_asString',
  126. smalltalk.method({
  127. selector: 'asString',
  128. fn: function (){
  129. var self=this;
  130. return smalltalk.send(self, "_printString", []);
  131. return self;}
  132. }),
  133. smalltalk.Object);
  134. smalltalk.addMethod(
  135. '_asJavascript',
  136. smalltalk.method({
  137. selector: 'asJavascript',
  138. fn: function (){
  139. var self=this;
  140. return smalltalk.send(self, "_asString", []);
  141. return self;}
  142. }),
  143. smalltalk.Object);
  144. smalltalk.addMethod(
  145. '_perform_',
  146. smalltalk.method({
  147. selector: 'perform:',
  148. fn: function (aSymbol){
  149. var self=this;
  150. return smalltalk.send(self, "_perform_withArguments_", [aSymbol, []]);
  151. return self;}
  152. }),
  153. smalltalk.Object);
  154. smalltalk.addMethod(
  155. '_perform_withArguments_',
  156. smalltalk.method({
  157. selector: 'perform:withArguments:',
  158. fn: function (aSymbol, aCollection){
  159. var self=this;
  160. return smalltalk.send(self, "_basicPerform_withArguments_", [smalltalk.send(aSymbol, "_asSelector", []), aCollection]);
  161. return self;}
  162. }),
  163. smalltalk.Object);
  164. smalltalk.addMethod(
  165. '_instVarAt_',
  166. smalltalk.method({
  167. selector: 'instVarAt:',
  168. fn: function (aString){
  169. var self=this;
  170. return self['@'+aString];
  171. return self;}
  172. }),
  173. smalltalk.Object);
  174. smalltalk.addMethod(
  175. '_instVarAt_put_',
  176. smalltalk.method({
  177. selector: 'instVarAt:put:',
  178. fn: function (aString, anObject){
  179. var self=this;
  180. self['@' + aString] = anObject;
  181. return self;}
  182. }),
  183. smalltalk.Object);
  184. smalltalk.addMethod(
  185. '_basicAt_',
  186. smalltalk.method({
  187. selector: 'basicAt:',
  188. fn: function (aString){
  189. var self=this;
  190. return self[aString];
  191. return self;}
  192. }),
  193. smalltalk.Object);
  194. smalltalk.addMethod(
  195. '_basicAt_put_',
  196. smalltalk.method({
  197. selector: 'basicAt:put:',
  198. fn: function (aString, anObject){
  199. var self=this;
  200. return self[aString] = anObject;
  201. return self;}
  202. }),
  203. smalltalk.Object);
  204. smalltalk.addMethod(
  205. '_error_',
  206. smalltalk.method({
  207. selector: 'error:',
  208. fn: function (aString){
  209. var self=this;
  210. smalltalk.send(smalltalk.Error, "_signal_", [aString]);
  211. return self;}
  212. }),
  213. smalltalk.Object);
  214. smalltalk.addMethod(
  215. '_subclassResponsibility',
  216. smalltalk.method({
  217. selector: 'subclassResponsibility',
  218. fn: function (){
  219. var self=this;
  220. smalltalk.send(self, "_error_", ["This method is a responsibility of a subclass"]);
  221. return self;}
  222. }),
  223. smalltalk.Object);
  224. smalltalk.addMethod(
  225. '_shouldNotImplement',
  226. smalltalk.method({
  227. selector: 'shouldNotImplement',
  228. fn: function (){
  229. var self=this;
  230. smalltalk.send(self, "_error_", [smalltalk.send("This method should not be implemented in ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])])]);
  231. return self;}
  232. }),
  233. smalltalk.Object);
  234. smalltalk.addMethod(
  235. '_try_catch_',
  236. smalltalk.method({
  237. selector: 'try:catch:',
  238. fn: function (aBlock, anotherBlock){
  239. var self=this;
  240. try{aBlock()} catch(e) {anotherBlock(e)};
  241. return self;}
  242. }),
  243. smalltalk.Object);
  244. smalltalk.addMethod(
  245. '_printString',
  246. smalltalk.method({
  247. selector: 'printString',
  248. fn: function (){
  249. var self=this;
  250. return smalltalk.send("a ", "__comma", [smalltalk.send(smalltalk.send(self, "_class", []), "_name", [])]);
  251. return self;}
  252. }),
  253. smalltalk.Object);
  254. smalltalk.addMethod(
  255. '_printNl',
  256. smalltalk.method({
  257. selector: 'printNl',
  258. fn: function (){
  259. var self=this;
  260. console.log(self);
  261. return self;}
  262. }),
  263. smalltalk.Object);
  264. smalltalk.addMethod(
  265. '_isKindOf_',
  266. smalltalk.method({
  267. selector: 'isKindOf:',
  268. fn: function (aClass){
  269. var self=this;
  270. return smalltalk.send(smalltalk.send(self, "_isMemberOf_", [aClass]), "_ifTrue_ifFalse_", [(function(){return true;}), (function(){return smalltalk.send(smalltalk.send(self, "_class", []), "_inheritsFrom_", [aClass]);})]);
  271. return self;}
  272. }),
  273. smalltalk.Object);
  274. smalltalk.addMethod(
  275. '_isMemberOf_',
  276. smalltalk.method({
  277. selector: 'isMemberOf:',
  278. fn: function (aClass){
  279. var self=this;
  280. return smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [aClass]);
  281. return self;}
  282. }),
  283. smalltalk.Object);
  284. smalltalk.addMethod(
  285. '_ifNil_',
  286. smalltalk.method({
  287. selector: 'ifNil:',
  288. fn: function (aBlock){
  289. var self=this;
  290. return self;
  291. return self;}
  292. }),
  293. smalltalk.Object);
  294. smalltalk.addMethod(
  295. '_ifNil_ifNotNil_',
  296. smalltalk.method({
  297. selector: 'ifNil:ifNotNil:',
  298. fn: function (aBlock, anotherBlock){
  299. var self=this;
  300. return smalltalk.send(anotherBlock, "_value", []);
  301. return self;}
  302. }),
  303. smalltalk.Object);
  304. smalltalk.addMethod(
  305. '_ifNotNil_',
  306. smalltalk.method({
  307. selector: 'ifNotNil:',
  308. fn: function (aBlock){
  309. var self=this;
  310. return smalltalk.send(aBlock, "_value", []);
  311. return self;}
  312. }),
  313. smalltalk.Object);
  314. smalltalk.addMethod(
  315. '_ifNotNil_ifNil_',
  316. smalltalk.method({
  317. selector: 'ifNotNil:ifNil:',
  318. fn: function (aBlock, anotherBlock){
  319. var self=this;
  320. return smalltalk.send(aBlock, "_value", []);
  321. return self;}
  322. }),
  323. smalltalk.Object);
  324. smalltalk.addMethod(
  325. '_isNil',
  326. smalltalk.method({
  327. selector: 'isNil',
  328. fn: function (){
  329. var self=this;
  330. return false;
  331. return self;}
  332. }),
  333. smalltalk.Object);
  334. smalltalk.addMethod(
  335. '_notNil',
  336. smalltalk.method({
  337. selector: 'notNil',
  338. fn: function (){
  339. var self=this;
  340. return smalltalk.send(smalltalk.send(self, "_isNil", []), "_not", []);
  341. return self;}
  342. }),
  343. smalltalk.Object);
  344. smalltalk.addMethod(
  345. '_isClass',
  346. smalltalk.method({
  347. selector: 'isClass',
  348. fn: function (){
  349. var self=this;
  350. return false;
  351. return self;}
  352. }),
  353. smalltalk.Object);
  354. smalltalk.addMethod(
  355. '_isMetaclass',
  356. smalltalk.method({
  357. selector: 'isMetaclass',
  358. fn: function (){
  359. var self=this;
  360. return false;
  361. return self;}
  362. }),
  363. smalltalk.Object);
  364. smalltalk.addMethod(
  365. '_isNumber',
  366. smalltalk.method({
  367. selector: 'isNumber',
  368. fn: function (){
  369. var self=this;
  370. return false;
  371. return self;}
  372. }),
  373. smalltalk.Object);
  374. smalltalk.addMethod(
  375. '_isString',
  376. smalltalk.method({
  377. selector: 'isString',
  378. fn: function (){
  379. var self=this;
  380. return false;
  381. return self;}
  382. }),
  383. smalltalk.Object);
  384. smalltalk.addMethod(
  385. '_isParseFailure',
  386. smalltalk.method({
  387. selector: 'isParseFailure',
  388. fn: function (){
  389. var self=this;
  390. return false;
  391. return self;}
  392. }),
  393. smalltalk.Object);
  394. smalltalk.addMethod(
  395. '_basicPerform_',
  396. smalltalk.method({
  397. selector: 'basicPerform:',
  398. fn: function (aSymbol){
  399. var self=this;
  400. return smalltalk.send(self, "_basicPerform_withArguments_", [aSymbol, []]);
  401. return self;}
  402. }),
  403. smalltalk.Object);
  404. smalltalk.addMethod(
  405. '_basicPerform_withArguments_',
  406. smalltalk.method({
  407. selector: 'basicPerform:withArguments:',
  408. fn: function (aSymbol, aCollection){
  409. var self=this;
  410. return self[aSymbol].apply(self, aCollection);;
  411. return self;}
  412. }),
  413. smalltalk.Object);
  414. smalltalk.addMethod(
  415. '_basicDelete_',
  416. smalltalk.method({
  417. selector: 'basicDelete:',
  418. fn: function (aString){
  419. var self=this;
  420. delete self[aString];
  421. return self;}
  422. }),
  423. smalltalk.Object);
  424. smalltalk.addMethod(
  425. '_doesNotUnderstand_',
  426. smalltalk.method({
  427. selector: 'doesNotUnderstand:',
  428. fn: function (aMessage){
  429. var self=this;
  430. (function($rec){smalltalk.send($rec, "_receiver_", [self]);smalltalk.send($rec, "_message_", [aMessage]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(smalltalk.MessageNotUnderstood, "_new", []));
  431. return self;}
  432. }),
  433. smalltalk.Object);
  434. smalltalk.addMethod(
  435. '_asJSON',
  436. smalltalk.method({
  437. selector: 'asJSON',
  438. fn: function (){
  439. var self=this;
  440. return JSON.stringify(self._asJSONObject());
  441. return self;}
  442. }),
  443. smalltalk.Object);
  444. smalltalk.addMethod(
  445. '_asJSONObject',
  446. smalltalk.method({
  447. selector: 'asJSONObject',
  448. fn: function (){
  449. var self=this;
  450. var object=nil;
  451. object=smalltalk.send(smalltalk.Object, "_new", []);
  452. smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_instanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(object, "_basicAt_put_", [each, smalltalk.send(smalltalk.send(self, "_instVarAt_", [each]), "_asJSONObject", [])]);})]);
  453. return object;
  454. return self;}
  455. }),
  456. smalltalk.Object);
  457. smalltalk.addMethod(
  458. '_halt',
  459. smalltalk.method({
  460. selector: 'halt',
  461. fn: function (){
  462. var self=this;
  463. smalltalk.send(self, "_error_", ["Halt encountered"]);
  464. return self;}
  465. }),
  466. smalltalk.Object);
  467. smalltalk.addMethod(
  468. '_initialize',
  469. smalltalk.method({
  470. selector: 'initialize',
  471. fn: function (){
  472. var self=this;
  473. return self;}
  474. }),
  475. smalltalk.Object.klass);
  476. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel');
  477. smalltalk.addMethod(
  478. '_classes',
  479. smalltalk.method({
  480. selector: 'classes',
  481. fn: function (){
  482. var self=this;
  483. return self.classes();
  484. return self;}
  485. }),
  486. smalltalk.Smalltalk);
  487. smalltalk.addMethod(
  488. '_readJSON_',
  489. smalltalk.method({
  490. selector: 'readJSON:',
  491. fn: function (anObject){
  492. var self=this;
  493. return self.readJSObject(anObject);
  494. return self;}
  495. }),
  496. smalltalk.Smalltalk);
  497. smalltalk.addMethod(
  498. '_at_',
  499. smalltalk.method({
  500. selector: 'at:',
  501. fn: function (aString){
  502. var self=this;
  503. return self[aString];
  504. return self;}
  505. }),
  506. smalltalk.Smalltalk);
  507. smalltalk.addMethod(
  508. '_removeClass_',
  509. smalltalk.method({
  510. selector: 'removeClass:',
  511. fn: function (aClass){
  512. var self=this;
  513. smalltalk.send(smalltalk.send(aClass, "_isMetaclass", []), "_ifTrue_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [unescape("%20is%20a%20Metaclass%20and%20cannot%20be%20removed%21")])]);})]);
  514. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);})]);
  515. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);})]);
  516. smalltalk.send(self, "_basicDelete_", [smalltalk.send(aClass, "_name", [])]);
  517. return self;}
  518. }),
  519. smalltalk.Smalltalk);
  520. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  521. smalltalk.addMethod(
  522. '_current',
  523. smalltalk.method({
  524. selector: 'current',
  525. fn: function (){
  526. var self=this;
  527. return smalltalk;
  528. return self;}
  529. }),
  530. smalltalk.Smalltalk.klass);
  531. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel');
  532. smalltalk.addMethod(
  533. '_new',
  534. smalltalk.method({
  535. selector: 'new',
  536. fn: function (){
  537. var self=this;
  538. return smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
  539. return self;}
  540. }),
  541. smalltalk.Behavior);
  542. smalltalk.addMethod(
  543. '_basicNew',
  544. smalltalk.method({
  545. selector: 'basicNew',
  546. fn: function (){
  547. var self=this;
  548. return new self.fn();
  549. return self;}
  550. }),
  551. smalltalk.Behavior);
  552. smalltalk.addMethod(
  553. '_name',
  554. smalltalk.method({
  555. selector: 'name',
  556. fn: function (){
  557. var self=this;
  558. return self.className || nil;
  559. return self;}
  560. }),
  561. smalltalk.Behavior);
  562. smalltalk.addMethod(
  563. '_superclass',
  564. smalltalk.method({
  565. selector: 'superclass',
  566. fn: function (){
  567. var self=this;
  568. return self.superclass || nil;
  569. return self;}
  570. }),
  571. smalltalk.Behavior);
  572. smalltalk.addMethod(
  573. '_subclasses',
  574. smalltalk.method({
  575. selector: 'subclasses',
  576. fn: function (){
  577. var self=this;
  578. return smalltalk.subclasses(self);
  579. return self;}
  580. }),
  581. smalltalk.Behavior);
  582. smalltalk.addMethod(
  583. '_allSubclasses',
  584. smalltalk.method({
  585. selector: 'allSubclasses',
  586. fn: function (){
  587. var self=this;
  588. var result=nil;
  589. result=smalltalk.send(self, "_subclasses", []);
  590. smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
  591. return result;
  592. return self;}
  593. }),
  594. smalltalk.Behavior);
  595. smalltalk.addMethod(
  596. '_withAllSubclasses',
  597. smalltalk.method({
  598. selector: 'withAllSubclasses',
  599. fn: function (){
  600. var self=this;
  601. return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_allSubclasses", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.Array, "_with_", [self]));
  602. return self;}
  603. }),
  604. smalltalk.Behavior);
  605. smalltalk.addMethod(
  606. '_prototype',
  607. smalltalk.method({
  608. selector: 'prototype',
  609. fn: function (){
  610. var self=this;
  611. return self.fn.prototype;
  612. return self;}
  613. }),
  614. smalltalk.Behavior);
  615. smalltalk.addMethod(
  616. '_methodDictionary',
  617. smalltalk.method({
  618. selector: 'methodDictionary',
  619. fn: function (){
  620. var self=this;
  621. var dict = smalltalk.Dictionary._new();
  622. var methods = self.fn.prototype.methods;
  623. for(var i in methods) {
  624. if(methods[i].selector) {
  625. dict._at_put_(methods[i].selector, methods[i]);
  626. }
  627. };
  628. return dict;
  629. return self;}
  630. }),
  631. smalltalk.Behavior);
  632. smalltalk.addMethod(
  633. '_methodsFor_',
  634. smalltalk.method({
  635. selector: 'methodsFor:',
  636. fn: function (aString){
  637. var self=this;
  638. return (function($rec){smalltalk.send($rec, "_class_category_", [self, aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.ClassCategoryReader, "_new", []));
  639. return self;}
  640. }),
  641. smalltalk.Behavior);
  642. smalltalk.addMethod(
  643. '_addCompiledMethod_',
  644. smalltalk.method({
  645. selector: 'addCompiledMethod:',
  646. fn: function (aMethod){
  647. var self=this;
  648. smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  649. return self;}
  650. }),
  651. smalltalk.Behavior);
  652. smalltalk.addMethod(
  653. '_instanceVariableNames',
  654. smalltalk.method({
  655. selector: 'instanceVariableNames',
  656. fn: function (){
  657. var self=this;
  658. return self.iVarNames;
  659. return self;}
  660. }),
  661. smalltalk.Behavior);
  662. smalltalk.addMethod(
  663. '_comment',
  664. smalltalk.method({
  665. selector: 'comment',
  666. fn: function (){
  667. var self=this;
  668. return smalltalk.send(smalltalk.send(self, "_basicAt_", ["comment"]), "_ifNil_", [(function(){return "";})]);
  669. return self;}
  670. }),
  671. smalltalk.Behavior);
  672. smalltalk.addMethod(
  673. '_comment_',
  674. smalltalk.method({
  675. selector: 'comment:',
  676. fn: function (aString){
  677. var self=this;
  678. smalltalk.send(self, "_basicAt_put_", ["comment", aString]);
  679. return self;}
  680. }),
  681. smalltalk.Behavior);
  682. smalltalk.addMethod(
  683. '_commentStamp',
  684. smalltalk.method({
  685. selector: 'commentStamp',
  686. fn: function (){
  687. var self=this;
  688. return (function($rec){smalltalk.send($rec, "_class_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.ClassCommentReader, "_new", []));
  689. return self;}
  690. }),
  691. smalltalk.Behavior);
  692. smalltalk.addMethod(
  693. '_removeCompiledMethod_',
  694. smalltalk.method({
  695. selector: 'removeCompiledMethod:',
  696. fn: function (aMethod){
  697. var self=this;
  698. delete self.fn.prototype[aMethod.selector._asSelector()];
  699. delete self.fn.prototype.methods[aMethod.selector];
  700. smalltalk.init(self);;
  701. return self;}
  702. }),
  703. smalltalk.Behavior);
  704. smalltalk.addMethod(
  705. '_inheritsFrom_',
  706. smalltalk.method({
  707. selector: 'inheritsFrom:',
  708. fn: function (aClass){
  709. var self=this;
  710. return smalltalk.send(smalltalk.send(aClass, "_allSubclasses", []), "_includes_", [self]);
  711. return self;}
  712. }),
  713. smalltalk.Behavior);
  714. smalltalk.addMethod(
  715. '_protocols',
  716. smalltalk.method({
  717. selector: 'protocols',
  718. fn: function (){
  719. var self=this;
  720. var protocols=nil;
  721. protocols=smalltalk.send(smalltalk.Array, "_new", []);
  722. smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(protocols, "_includes_", [smalltalk.send(each, "_category", [])]), "_ifFalse_", [(function(){return smalltalk.send(protocols, "_add_", [smalltalk.send(each, "_category", [])]);})]);})]);
  723. return smalltalk.send(protocols, "_sort", []);
  724. return self;}
  725. }),
  726. smalltalk.Behavior);
  727. smalltalk.addMethod(
  728. '_protocolsDo_',
  729. smalltalk.method({
  730. selector: 'protocolsDo:',
  731. fn: function (aBlock){
  732. var self=this;
  733. var methodsByCategory=nil;
  734. methodsByCategory=smalltalk.send(smalltalk.Dictionary, "_new", []);
  735. smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_values", []), "_do_", [(function(m){return smalltalk.send(smalltalk.send(methodsByCategory, "_at_ifAbsentPut_", [smalltalk.send(m, "_category", []), (function(){return smalltalk.send(smalltalk.Array, "_new", []);})]), "_add_", [m]);})]);
  736. smalltalk.send(smalltalk.send(self, "_protocols", []), "_do_", [(function(category){return smalltalk.send(aBlock, "_value_value_", [category, smalltalk.send(methodsByCategory, "_at_", [category])]);})]);
  737. return self;}
  738. }),
  739. smalltalk.Behavior);
  740. smalltalk.addMethod(
  741. '_allInstanceVariableNames',
  742. smalltalk.method({
  743. selector: 'allInstanceVariableNames',
  744. fn: function (){
  745. var self=this;
  746. var result=nil;
  747. result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []);
  748. smalltalk.send(smalltalk.send(self, "_superclass", []), "_ifNotNil_", [(function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})]);
  749. return result;
  750. return self;}
  751. }),
  752. smalltalk.Behavior);
  753. smalltalk.addMethod(
  754. '_methodAt_',
  755. smalltalk.method({
  756. selector: 'methodAt:',
  757. fn: function (aString){
  758. var self=this;
  759. return smalltalk.methods(self)[aString];
  760. return self;}
  761. }),
  762. smalltalk.Behavior);
  763. smalltalk.addMethod(
  764. '_methodsFor_stamp_',
  765. smalltalk.method({
  766. selector: 'methodsFor:stamp:',
  767. fn: function (aString, aStamp){
  768. var self=this;
  769. return smalltalk.send(self, "_methodsFor_", [aString]);
  770. return self;}
  771. }),
  772. smalltalk.Behavior);
  773. smalltalk.addMethod(
  774. '_commentStamp_prior_',
  775. smalltalk.method({
  776. selector: 'commentStamp:prior:',
  777. fn: function (aStamp, prior){
  778. var self=this;
  779. return self;}
  780. }),
  781. smalltalk.Behavior);
  782. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel');
  783. smalltalk.addMethod(
  784. '_category',
  785. smalltalk.method({
  786. selector: 'category',
  787. fn: function (){
  788. var self=this;
  789. return self.category;
  790. return self;}
  791. }),
  792. smalltalk.Class);
  793. smalltalk.addMethod(
  794. '_category_',
  795. smalltalk.method({
  796. selector: 'category:',
  797. fn: function (aString){
  798. var self=this;
  799. self.category = aString;
  800. return self;}
  801. }),
  802. smalltalk.Class);
  803. smalltalk.addMethod(
  804. '_subclass_instanceVariableNames_',
  805. smalltalk.method({
  806. selector: 'subclass:instanceVariableNames:',
  807. fn: function (aString, anotherString){
  808. var self=this;
  809. return smalltalk.send(self, "_subclass_instanceVariableNames_category_", [aString, anotherString, nil]);
  810. return self;}
  811. }),
  812. smalltalk.Class);
  813. smalltalk.addMethod(
  814. '_subclass_instanceVariableNames_category_',
  815. smalltalk.method({
  816. selector: 'subclass:instanceVariableNames:category:',
  817. fn: function (aString, aString2, aString3){
  818. var self=this;
  819. return smalltalk.send(smalltalk.send(smalltalk.ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_category_", [self, aString, aString2, aString3]);
  820. return self;}
  821. }),
  822. smalltalk.Class);
  823. smalltalk.addMethod(
  824. '_isClass',
  825. smalltalk.method({
  826. selector: 'isClass',
  827. fn: function (){
  828. var self=this;
  829. return true;
  830. return self;}
  831. }),
  832. smalltalk.Class);
  833. smalltalk.addMethod(
  834. '_printString',
  835. smalltalk.method({
  836. selector: 'printString',
  837. fn: function (){
  838. var self=this;
  839. return smalltalk.send(self, "_name", []);
  840. return self;}
  841. }),
  842. smalltalk.Class);
  843. smalltalk.addMethod(
  844. '_rename_',
  845. smalltalk.method({
  846. selector: 'rename:',
  847. fn: function (aString){
  848. var self=this;
  849. smalltalk[aString] = self;
  850. delete smalltalk[self.className];
  851. self.className = aString;
  852. ;
  853. return self;}
  854. }),
  855. smalltalk.Class);
  856. smalltalk.addMethod(
  857. '_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_',
  858. smalltalk.method({
  859. selector: 'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:',
  860. fn: function (aString, aString2, classVars, pools, aString3){
  861. var self=this;
  862. return smalltalk.send(self, "_subclass_instanceVariableNames_category_", [aString, aString2, aString3]);
  863. return self;}
  864. }),
  865. smalltalk.Class);
  866. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel');
  867. smalltalk.addMethod(
  868. '_instanceClass',
  869. smalltalk.method({
  870. selector: 'instanceClass',
  871. fn: function (){
  872. var self=this;
  873. return self.instanceClass;
  874. return self;}
  875. }),
  876. smalltalk.Metaclass);
  877. smalltalk.addMethod(
  878. '_instanceVariableNames_',
  879. smalltalk.method({
  880. selector: 'instanceVariableNames:',
  881. fn: function (aCollection){
  882. var self=this;
  883. smalltalk.send(smalltalk.send(smalltalk.ClassBuilder, "_new", []), "_class_instanceVariableNames_", [self, aCollection]);
  884. return self;}
  885. }),
  886. smalltalk.Metaclass);
  887. smalltalk.addMethod(
  888. '_isMetaclass',
  889. smalltalk.method({
  890. selector: 'isMetaclass',
  891. fn: function (){
  892. var self=this;
  893. return true;
  894. return self;}
  895. }),
  896. smalltalk.Metaclass);
  897. smalltalk.addMethod(
  898. '_printString',
  899. smalltalk.method({
  900. selector: 'printString',
  901. fn: function (){
  902. var self=this;
  903. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instanceClass", []), "_name", []), "__comma", [" class"]);
  904. return self;}
  905. }),
  906. smalltalk.Metaclass);
  907. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel');
  908. smalltalk.addMethod(
  909. '_source',
  910. smalltalk.method({
  911. selector: 'source',
  912. fn: function (){
  913. var self=this;
  914. return smalltalk.send(smalltalk.send(self, "_basicAt_", ["source"]), "_ifNil_", [(function(){return "";})]);
  915. return self;}
  916. }),
  917. smalltalk.CompiledMethod);
  918. smalltalk.addMethod(
  919. '_source_',
  920. smalltalk.method({
  921. selector: 'source:',
  922. fn: function (aString){
  923. var self=this;
  924. smalltalk.send(self, "_basicAt_put_", ["source", aString]);
  925. return self;}
  926. }),
  927. smalltalk.CompiledMethod);
  928. smalltalk.addMethod(
  929. '_category',
  930. smalltalk.method({
  931. selector: 'category',
  932. fn: function (){
  933. var self=this;
  934. return smalltalk.send(smalltalk.send(self, "_basicAt_", ["category"]), "_ifNil_", [(function(){return "";})]);
  935. return self;}
  936. }),
  937. smalltalk.CompiledMethod);
  938. smalltalk.addMethod(
  939. '_category_',
  940. smalltalk.method({
  941. selector: 'category:',
  942. fn: function (aString){
  943. var self=this;
  944. smalltalk.send(self, "_basicAt_put_", ["category", aString]);
  945. return self;}
  946. }),
  947. smalltalk.CompiledMethod);
  948. smalltalk.addMethod(
  949. '_selector',
  950. smalltalk.method({
  951. selector: 'selector',
  952. fn: function (){
  953. var self=this;
  954. return smalltalk.send(self, "_basicAt_", ["selector"]);
  955. return self;}
  956. }),
  957. smalltalk.CompiledMethod);
  958. smalltalk.addMethod(
  959. '_selector_',
  960. smalltalk.method({
  961. selector: 'selector:',
  962. fn: function (aString){
  963. var self=this;
  964. smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
  965. return self;}
  966. }),
  967. smalltalk.CompiledMethod);
  968. smalltalk.addMethod(
  969. '_fn',
  970. smalltalk.method({
  971. selector: 'fn',
  972. fn: function (){
  973. var self=this;
  974. return smalltalk.send(self, "_basicAt_", ["fn"]);
  975. return self;}
  976. }),
  977. smalltalk.CompiledMethod);
  978. smalltalk.addMethod(
  979. '_fn_',
  980. smalltalk.method({
  981. selector: 'fn:',
  982. fn: function (aBlock){
  983. var self=this;
  984. smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
  985. return self;}
  986. }),
  987. smalltalk.CompiledMethod);
  988. smalltalk.addMethod(
  989. '_messageSends',
  990. smalltalk.method({
  991. selector: 'messageSends',
  992. fn: function (){
  993. var self=this;
  994. return smalltalk.send(self, "_basicAt_", ["messageSends"]);
  995. return self;}
  996. }),
  997. smalltalk.CompiledMethod);
  998. smalltalk.addMethod(
  999. '_methodClass',
  1000. smalltalk.method({
  1001. selector: 'methodClass',
  1002. fn: function (){
  1003. var self=this;
  1004. return smalltalk.send(self, "_basicAt_", ["methodClass"]);
  1005. return self;}
  1006. }),
  1007. smalltalk.CompiledMethod);
  1008. smalltalk.addMethod(
  1009. '_referencedClasses',
  1010. smalltalk.method({
  1011. selector: 'referencedClasses',
  1012. fn: function (){
  1013. var self=this;
  1014. return smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
  1015. return self;}
  1016. }),
  1017. smalltalk.CompiledMethod);
  1018. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel');
  1019. smalltalk.addMethod(
  1020. '__eq',
  1021. smalltalk.method({
  1022. selector: '=',
  1023. fn: function (aNumber){
  1024. var self=this;
  1025. return Number(self) == aNumber;
  1026. return self;}
  1027. }),
  1028. smalltalk.Number);
  1029. smalltalk.addMethod(
  1030. '__gt',
  1031. smalltalk.method({
  1032. selector: '>',
  1033. fn: function (aNumber){
  1034. var self=this;
  1035. return self > aNumber;
  1036. return self;}
  1037. }),
  1038. smalltalk.Number);
  1039. smalltalk.addMethod(
  1040. '__lt',
  1041. smalltalk.method({
  1042. selector: '<',
  1043. fn: function (aNumber){
  1044. var self=this;
  1045. return self < aNumber;
  1046. return self;}
  1047. }),
  1048. smalltalk.Number);
  1049. smalltalk.addMethod(
  1050. '__gt_eq',
  1051. smalltalk.method({
  1052. selector: '>=',
  1053. fn: function (aNumber){
  1054. var self=this;
  1055. return self >= aNumber;
  1056. return self;}
  1057. }),
  1058. smalltalk.Number);
  1059. smalltalk.addMethod(
  1060. '__lt_eq',
  1061. smalltalk.method({
  1062. selector: '<=',
  1063. fn: function (aNumber){
  1064. var self=this;
  1065. return self <= aNumber;
  1066. return self;}
  1067. }),
  1068. smalltalk.Number);
  1069. smalltalk.addMethod(
  1070. '__plus',
  1071. smalltalk.method({
  1072. selector: '+',
  1073. fn: function (aNumber){
  1074. var self=this;
  1075. return self + aNumber;
  1076. return self;}
  1077. }),
  1078. smalltalk.Number);
  1079. smalltalk.addMethod(
  1080. '__minus',
  1081. smalltalk.method({
  1082. selector: '-',
  1083. fn: function (aNumber){
  1084. var self=this;
  1085. return self - aNumber;
  1086. return self;}
  1087. }),
  1088. smalltalk.Number);
  1089. smalltalk.addMethod(
  1090. '__star',
  1091. smalltalk.method({
  1092. selector: '*',
  1093. fn: function (aNumber){
  1094. var self=this;
  1095. return self * aNumber;
  1096. return self;}
  1097. }),
  1098. smalltalk.Number);
  1099. smalltalk.addMethod(
  1100. '__slash',
  1101. smalltalk.method({
  1102. selector: '/',
  1103. fn: function (aNumber){
  1104. var self=this;
  1105. return self / aNumber;
  1106. return self;}
  1107. }),
  1108. smalltalk.Number);
  1109. smalltalk.addMethod(
  1110. '_max_',
  1111. smalltalk.method({
  1112. selector: 'max:',
  1113. fn: function (aNumber){
  1114. var self=this;
  1115. return Math.max(self, aNumber);;
  1116. return self;}
  1117. }),
  1118. smalltalk.Number);
  1119. smalltalk.addMethod(
  1120. '_min_',
  1121. smalltalk.method({
  1122. selector: 'min:',
  1123. fn: function (aNumber){
  1124. var self=this;
  1125. return Math.min(self, aNumber);;
  1126. return self;}
  1127. }),
  1128. smalltalk.Number);
  1129. smalltalk.addMethod(
  1130. '_rounded',
  1131. smalltalk.method({
  1132. selector: 'rounded',
  1133. fn: function (){
  1134. var self=this;
  1135. return Math.round(self);;
  1136. return self;}
  1137. }),
  1138. smalltalk.Number);
  1139. smalltalk.addMethod(
  1140. '_truncated',
  1141. smalltalk.method({
  1142. selector: 'truncated',
  1143. fn: function (){
  1144. var self=this;
  1145. return Math.floor(self);;
  1146. return self;}
  1147. }),
  1148. smalltalk.Number);
  1149. smalltalk.addMethod(
  1150. '_to_',
  1151. smalltalk.method({
  1152. selector: 'to:',
  1153. fn: function (aNumber){
  1154. var self=this;
  1155. var array=nil;
  1156. var first=nil;
  1157. var last=nil;
  1158. var count=nil;
  1159. first=smalltalk.send(self, "_truncated", []);
  1160. last=smalltalk.send(smalltalk.send(aNumber, "_truncated", []), "__plus", [(1)]);
  1161. count=(1);
  1162. smalltalk.send(smalltalk.send(first, "__lt_eq", [last]), "_ifFalse_", [(function(){return smalltalk.send(self, "_error_", ["Wrong interval"]);})]);
  1163. array=smalltalk.send(smalltalk.Array, "_new", []);
  1164. smalltalk.send(smalltalk.send(last, "__minus", [first]), "_timesRepeat_", [(function(){smalltalk.send(array, "_at_put_", [count, first]);count=smalltalk.send(count, "__plus", [(1)]);return first=smalltalk.send(first, "__plus", [(1)]);})]);
  1165. return array;
  1166. return self;}
  1167. }),
  1168. smalltalk.Number);
  1169. smalltalk.addMethod(
  1170. '_timesRepeat_',
  1171. smalltalk.method({
  1172. selector: 'timesRepeat:',
  1173. fn: function (aBlock){
  1174. var self=this;
  1175. var integer=nil;
  1176. var count=nil;
  1177. integer=smalltalk.send(self, "_truncated", []);
  1178. count=(1);
  1179. smalltalk.send((function(){return smalltalk.send(count, "__gt", [self]);}), "_whileFalse_", [(function(){smalltalk.send(aBlock, "_value", []);return count=smalltalk.send(count, "__plus", [(1)]);})]);
  1180. return self;}
  1181. }),
  1182. smalltalk.Number);
  1183. smalltalk.addMethod(
  1184. '_to_do_',
  1185. smalltalk.method({
  1186. selector: 'to:do:',
  1187. fn: function (aNumber, aBlock){
  1188. var self=this;
  1189. return smalltalk.send(smalltalk.send(self, "_to_", [aNumber]), "_do_", [aBlock]);
  1190. return self;}
  1191. }),
  1192. smalltalk.Number);
  1193. smalltalk.addMethod(
  1194. '_asString',
  1195. smalltalk.method({
  1196. selector: 'asString',
  1197. fn: function (){
  1198. var self=this;
  1199. return smalltalk.send(self, "_printString", []);
  1200. return self;}
  1201. }),
  1202. smalltalk.Number);
  1203. smalltalk.addMethod(
  1204. '_asJavascript',
  1205. smalltalk.method({
  1206. selector: 'asJavascript',
  1207. fn: function (){
  1208. var self=this;
  1209. return smalltalk.send(smalltalk.send(unescape("%28"), "__comma", [smalltalk.send(self, "_printString", [])]), "__comma", [unescape("%29")]);
  1210. return self;}
  1211. }),
  1212. smalltalk.Number);
  1213. smalltalk.addMethod(
  1214. '_printString',
  1215. smalltalk.method({
  1216. selector: 'printString',
  1217. fn: function (){
  1218. var self=this;
  1219. return String(self);
  1220. return self;}
  1221. }),
  1222. smalltalk.Number);
  1223. smalltalk.addMethod(
  1224. '_isNumber',
  1225. smalltalk.method({
  1226. selector: 'isNumber',
  1227. fn: function (){
  1228. var self=this;
  1229. return true;
  1230. return self;}
  1231. }),
  1232. smalltalk.Number);
  1233. smalltalk.addMethod(
  1234. '_atRandom',
  1235. smalltalk.method({
  1236. selector: 'atRandom',
  1237. fn: function (){
  1238. var self=this;
  1239. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Random, "_new", []), "_next", []), "__star", [self]), "_truncated", []), "__plus", [(1)]);
  1240. return self;}
  1241. }),
  1242. smalltalk.Number);
  1243. smalltalk.addMethod(
  1244. '__at',
  1245. smalltalk.method({
  1246. selector: '@',
  1247. fn: function (aNumber){
  1248. var self=this;
  1249. return smalltalk.send(smalltalk.Point, "_x_y_", [self, aNumber]);
  1250. return self;}
  1251. }),
  1252. smalltalk.Number);
  1253. smalltalk.addMethod(
  1254. '_asPoint',
  1255. smalltalk.method({
  1256. selector: 'asPoint',
  1257. fn: function (){
  1258. var self=this;
  1259. return smalltalk.send(smalltalk.Point, "_x_y_", [self, self]);
  1260. return self;}
  1261. }),
  1262. smalltalk.Number);
  1263. smalltalk.addMethod(
  1264. '_clearInterval',
  1265. smalltalk.method({
  1266. selector: 'clearInterval',
  1267. fn: function (){
  1268. var self=this;
  1269. clearInterval(Number(self));
  1270. return self;}
  1271. }),
  1272. smalltalk.Number);
  1273. smalltalk.addMethod(
  1274. '_asJSONObject',
  1275. smalltalk.method({
  1276. selector: 'asJSONObject',
  1277. fn: function (){
  1278. var self=this;
  1279. return self;
  1280. return self;}
  1281. }),
  1282. smalltalk.Number);
  1283. smalltalk.addMethod(
  1284. '_clearTimeout',
  1285. smalltalk.method({
  1286. selector: 'clearTimeout',
  1287. fn: function (){
  1288. var self=this;
  1289. clearTimeout(Number(self));
  1290. return self;}
  1291. }),
  1292. smalltalk.Number);
  1293. smalltalk.addMethod(
  1294. '_modulo_',
  1295. smalltalk.method({
  1296. selector: 'modulo:',
  1297. fn: function (aNumber){
  1298. var self=this;
  1299. return self % aNumber;
  1300. return self;}
  1301. }),
  1302. smalltalk.Number);
  1303. smalltalk.addMethod(
  1304. '_even',
  1305. smalltalk.method({
  1306. selector: 'even',
  1307. fn: function (){
  1308. var self=this;
  1309. return smalltalk.send((0), "__eq", [smalltalk.send(self, "_modulo_", [(2)])]);
  1310. return self;}
  1311. }),
  1312. smalltalk.Number);
  1313. smalltalk.addMethod(
  1314. '_odd',
  1315. smalltalk.method({
  1316. selector: 'odd',
  1317. fn: function (){
  1318. var self=this;
  1319. return smalltalk.send(smalltalk.send(self, "_even", []), "_not", []);
  1320. return self;}
  1321. }),
  1322. smalltalk.Number);
  1323. smalltalk.addMethod(
  1324. '_pi',
  1325. smalltalk.method({
  1326. selector: 'pi',
  1327. fn: function (){
  1328. var self=this;
  1329. return Math.PI;
  1330. return self;}
  1331. }),
  1332. smalltalk.Number.klass);
  1333. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel');
  1334. smalltalk.addMethod(
  1335. '_compiledSource',
  1336. smalltalk.method({
  1337. selector: 'compiledSource',
  1338. fn: function (){
  1339. var self=this;
  1340. return self.toString();
  1341. return self;}
  1342. }),
  1343. smalltalk.BlockClosure);
  1344. smalltalk.addMethod(
  1345. '_whileTrue_',
  1346. smalltalk.method({
  1347. selector: 'whileTrue:',
  1348. fn: function (aBlock){
  1349. var self=this;
  1350. while(self()) {aBlock()};
  1351. return self;}
  1352. }),
  1353. smalltalk.BlockClosure);
  1354. smalltalk.addMethod(
  1355. '_whileFalse_',
  1356. smalltalk.method({
  1357. selector: 'whileFalse:',
  1358. fn: function (aBlock){
  1359. var self=this;
  1360. while(!self()) {aBlock()};
  1361. return self;}
  1362. }),
  1363. smalltalk.BlockClosure);
  1364. smalltalk.addMethod(
  1365. '_value',
  1366. smalltalk.method({
  1367. selector: 'value',
  1368. fn: function (){
  1369. var self=this;
  1370. return self();;
  1371. return self;}
  1372. }),
  1373. smalltalk.BlockClosure);
  1374. smalltalk.addMethod(
  1375. '_value_',
  1376. smalltalk.method({
  1377. selector: 'value:',
  1378. fn: function (anArg){
  1379. var self=this;
  1380. return self(anArg);;
  1381. return self;}
  1382. }),
  1383. smalltalk.BlockClosure);
  1384. smalltalk.addMethod(
  1385. '_value_value_',
  1386. smalltalk.method({
  1387. selector: 'value:value:',
  1388. fn: function (firstArg, secondArg){
  1389. var self=this;
  1390. return self(firstArg, secondArg);;
  1391. return self;}
  1392. }),
  1393. smalltalk.BlockClosure);
  1394. smalltalk.addMethod(
  1395. '_value_value_value_',
  1396. smalltalk.method({
  1397. selector: 'value:value:value:',
  1398. fn: function (firstArg, secondArg, thirdArg){
  1399. var self=this;
  1400. return self(firstArg, secondArg, thirdArg);;
  1401. return self;}
  1402. }),
  1403. smalltalk.BlockClosure);
  1404. smalltalk.addMethod(
  1405. '_valueWithPossibleArguments_',
  1406. smalltalk.method({
  1407. selector: 'valueWithPossibleArguments:',
  1408. fn: function (aCollection){
  1409. var self=this;
  1410. return self.apply(null, aCollection);;
  1411. return self;}
  1412. }),
  1413. smalltalk.BlockClosure);
  1414. smalltalk.addMethod(
  1415. '_on_do_',
  1416. smalltalk.method({
  1417. selector: 'on:do:',
  1418. fn: function (anErrorClass, aBlock){
  1419. var self=this;
  1420. smalltalk.send(self, "_try_catch_", [self, (function(error){return smalltalk.send(smalltalk.send(error, "_isKindOf_", [anErrorClass]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [error]);}), (function(){return smalltalk.send(error, "_signal", []);})]);})]);
  1421. return self;}
  1422. }),
  1423. smalltalk.BlockClosure);
  1424. smalltalk.addMethod(
  1425. '_valueWithTimeout_',
  1426. smalltalk.method({
  1427. selector: 'valueWithTimeout:',
  1428. fn: function (aNumber){
  1429. var self=this;
  1430. return setTimeout(self, aNumber);
  1431. return self;}
  1432. }),
  1433. smalltalk.BlockClosure);
  1434. smalltalk.addMethod(
  1435. '_valueWithInterval_',
  1436. smalltalk.method({
  1437. selector: 'valueWithInterval:',
  1438. fn: function (aNumber){
  1439. var self=this;
  1440. return setInterval(self, aNumber);
  1441. return self;}
  1442. }),
  1443. smalltalk.BlockClosure);
  1444. smalltalk.addMethod(
  1445. '_printString',
  1446. smalltalk.method({
  1447. selector: 'printString',
  1448. fn: function (){
  1449. var self=this;
  1450. return smalltalk.send(smalltalk.String, "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_compiledSource", [])]);smalltalk.send($rec, "_nextPutAll_", [unescape("%29")]);return smalltalk.send($rec, "_cr", []);})(aStream);})]);
  1451. return self;}
  1452. }),
  1453. smalltalk.BlockClosure);
  1454. smalltalk.addMethod(
  1455. '_whileFalse',
  1456. smalltalk.method({
  1457. selector: 'whileFalse',
  1458. fn: function (){
  1459. var self=this;
  1460. smalltalk.send(self, "_whileFalse_", [(function(){return nil;})]);
  1461. return self;}
  1462. }),
  1463. smalltalk.BlockClosure);
  1464. smalltalk.addMethod(
  1465. '_whileTrue',
  1466. smalltalk.method({
  1467. selector: 'whileTrue',
  1468. fn: function (){
  1469. var self=this;
  1470. smalltalk.send(self, "_whileTrue_", [(function(){return nil;})]);
  1471. return self;}
  1472. }),
  1473. smalltalk.BlockClosure);
  1474. smalltalk.addMethod(
  1475. '_new',
  1476. smalltalk.method({
  1477. selector: 'new',
  1478. fn: function (){
  1479. var self=this;
  1480. return new self();
  1481. return self;}
  1482. }),
  1483. smalltalk.BlockClosure);
  1484. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel');
  1485. smalltalk.addMethod(
  1486. '__eq',
  1487. smalltalk.method({
  1488. selector: '=',
  1489. fn: function (aBoolean){
  1490. var self=this;
  1491. return Boolean(self == true) == aBoolean;
  1492. return self;}
  1493. }),
  1494. smalltalk.Boolean);
  1495. smalltalk.addMethod(
  1496. '_shallowCopy',
  1497. smalltalk.method({
  1498. selector: 'shallowCopy',
  1499. fn: function (){
  1500. var self=this;
  1501. return self;
  1502. return self;}
  1503. }),
  1504. smalltalk.Boolean);
  1505. smalltalk.addMethod(
  1506. '_deepCopy',
  1507. smalltalk.method({
  1508. selector: 'deepCopy',
  1509. fn: function (){
  1510. var self=this;
  1511. return self;
  1512. return self;}
  1513. }),
  1514. smalltalk.Boolean);
  1515. smalltalk.addMethod(
  1516. '_ifTrue_',
  1517. smalltalk.method({
  1518. selector: 'ifTrue:',
  1519. fn: function (aBlock){
  1520. var self=this;
  1521. return smalltalk.send(self, "_ifTrue_ifFalse_", [aBlock, (function(){return nil;})]);
  1522. return self;}
  1523. }),
  1524. smalltalk.Boolean);
  1525. smalltalk.addMethod(
  1526. '_ifFalse_',
  1527. smalltalk.method({
  1528. selector: 'ifFalse:',
  1529. fn: function (aBlock){
  1530. var self=this;
  1531. return smalltalk.send(self, "_ifTrue_ifFalse_", [(function(){return nil;}), aBlock]);
  1532. return self;}
  1533. }),
  1534. smalltalk.Boolean);
  1535. smalltalk.addMethod(
  1536. '_ifFalse_ifTrue_',
  1537. smalltalk.method({
  1538. selector: 'ifFalse:ifTrue:',
  1539. fn: function (aBlock, anotherBlock){
  1540. var self=this;
  1541. return smalltalk.send(self, "_ifTrue_ifFalse_", [anotherBlock, aBlock]);
  1542. return self;}
  1543. }),
  1544. smalltalk.Boolean);
  1545. smalltalk.addMethod(
  1546. '_ifTrue_ifFalse_',
  1547. smalltalk.method({
  1548. selector: 'ifTrue:ifFalse:',
  1549. fn: function (aBlock, anotherBlock){
  1550. var self=this;
  1551. if(self == true) {
  1552. return aBlock();
  1553. } else {
  1554. return anotherBlock();
  1555. }
  1556. ;
  1557. return self;}
  1558. }),
  1559. smalltalk.Boolean);
  1560. smalltalk.addMethod(
  1561. '_and_',
  1562. smalltalk.method({
  1563. selector: 'and:',
  1564. fn: function (aBlock){
  1565. var self=this;
  1566. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [aBlock, (function(){return false;})]);
  1567. return self;}
  1568. }),
  1569. smalltalk.Boolean);
  1570. smalltalk.addMethod(
  1571. '_or_',
  1572. smalltalk.method({
  1573. selector: 'or:',
  1574. fn: function (aBlock){
  1575. var self=this;
  1576. return smalltalk.send(smalltalk.send(self, "__eq", [true]), "_ifTrue_ifFalse_", [(function(){return true;}), aBlock]);
  1577. return self;}
  1578. }),
  1579. smalltalk.Boolean);
  1580. smalltalk.addMethod(
  1581. '_not',
  1582. smalltalk.method({
  1583. selector: 'not',
  1584. fn: function (){
  1585. var self=this;
  1586. return smalltalk.send(self, "__eq", [false]);
  1587. return self;}
  1588. }),
  1589. smalltalk.Boolean);
  1590. smalltalk.addMethod(
  1591. '_printString',
  1592. smalltalk.method({
  1593. selector: 'printString',
  1594. fn: function (){
  1595. var self=this;
  1596. return self.toString();
  1597. return self;}
  1598. }),
  1599. smalltalk.Boolean);
  1600. smalltalk.addMethod(
  1601. '_asJSONObject',
  1602. smalltalk.method({
  1603. selector: 'asJSONObject',
  1604. fn: function (){
  1605. var self=this;
  1606. return self;
  1607. return self;}
  1608. }),
  1609. smalltalk.Boolean);
  1610. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
  1611. smalltalk.addMethod(
  1612. '_year',
  1613. smalltalk.method({
  1614. selector: 'year',
  1615. fn: function (){
  1616. var self=this;
  1617. return self.getFullYear();
  1618. return self;}
  1619. }),
  1620. smalltalk.Date);
  1621. smalltalk.addMethod(
  1622. '_month',
  1623. smalltalk.method({
  1624. selector: 'month',
  1625. fn: function (){
  1626. var self=this;
  1627. return self.getMonth() + 1;
  1628. return self;}
  1629. }),
  1630. smalltalk.Date);
  1631. smalltalk.addMethod(
  1632. '_month_',
  1633. smalltalk.method({
  1634. selector: 'month:',
  1635. fn: function (aNumber){
  1636. var self=this;
  1637. self.setMonth(aNumber - 1);
  1638. return self;}
  1639. }),
  1640. smalltalk.Date);
  1641. smalltalk.addMethod(
  1642. '_day',
  1643. smalltalk.method({
  1644. selector: 'day',
  1645. fn: function (){
  1646. var self=this;
  1647. return smalltalk.send(self, "_dayOfWeek", []);
  1648. return self;}
  1649. }),
  1650. smalltalk.Date);
  1651. smalltalk.addMethod(
  1652. '_dayOfWeek',
  1653. smalltalk.method({
  1654. selector: 'dayOfWeek',
  1655. fn: function (){
  1656. var self=this;
  1657. return self.getDay() + 1;
  1658. return self;}
  1659. }),
  1660. smalltalk.Date);
  1661. smalltalk.addMethod(
  1662. '_dayOfWeek_',
  1663. smalltalk.method({
  1664. selector: 'dayOfWeek:',
  1665. fn: function (aNumber){
  1666. var self=this;
  1667. return self.setDay(aNumber - 1);
  1668. return self;}
  1669. }),
  1670. smalltalk.Date);
  1671. smalltalk.addMethod(
  1672. '_day_',
  1673. smalltalk.method({
  1674. selector: 'day:',
  1675. fn: function (aNumber){
  1676. var self=this;
  1677. smalltalk.send(self, "_day_", [aNumber]);
  1678. return self;}
  1679. }),
  1680. smalltalk.Date);
  1681. smalltalk.addMethod(
  1682. '_year_',
  1683. smalltalk.method({
  1684. selector: 'year:',
  1685. fn: function (aNumber){
  1686. var self=this;
  1687. self.setFullYear(aNumber);
  1688. return self;}
  1689. }),
  1690. smalltalk.Date);
  1691. smalltalk.addMethod(
  1692. '_dayOfMonth',
  1693. smalltalk.method({
  1694. selector: 'dayOfMonth',
  1695. fn: function (){
  1696. var self=this;
  1697. return self.getDate();
  1698. return self;}
  1699. }),
  1700. smalltalk.Date);
  1701. smalltalk.addMethod(
  1702. '_dayOfMonth_',
  1703. smalltalk.method({
  1704. selector: 'dayOfMonth:',
  1705. fn: function (aNumber){
  1706. var self=this;
  1707. self.setDate(aNumber);
  1708. return self;}
  1709. }),
  1710. smalltalk.Date);
  1711. smalltalk.addMethod(
  1712. '_asString',
  1713. smalltalk.method({
  1714. selector: 'asString',
  1715. fn: function (){
  1716. var self=this;
  1717. return self.toString();
  1718. return self;}
  1719. }),
  1720. smalltalk.Date);
  1721. smalltalk.addMethod(
  1722. '_printString',
  1723. smalltalk.method({
  1724. selector: 'printString',
  1725. fn: function (){
  1726. var self=this;
  1727. return smalltalk.send(self, "_asString", []);
  1728. return self;}
  1729. }),
  1730. smalltalk.Date);
  1731. smalltalk.addMethod(
  1732. '_asMilliseconds',
  1733. smalltalk.method({
  1734. selector: 'asMilliseconds',
  1735. fn: function (){
  1736. var self=this;
  1737. return smalltalk.send(self, "_time", []);
  1738. return self;}
  1739. }),
  1740. smalltalk.Date);
  1741. smalltalk.addMethod(
  1742. '_time',
  1743. smalltalk.method({
  1744. selector: 'time',
  1745. fn: function (){
  1746. var self=this;
  1747. return self.getTime();
  1748. return self;}
  1749. }),
  1750. smalltalk.Date);
  1751. smalltalk.addMethod(
  1752. '_time_',
  1753. smalltalk.method({
  1754. selector: 'time:',
  1755. fn: function (aNumber){
  1756. var self=this;
  1757. self.setTime(aNumber);
  1758. return self;}
  1759. }),
  1760. smalltalk.Date);
  1761. smalltalk.addMethod(
  1762. '_asDateString',
  1763. smalltalk.method({
  1764. selector: 'asDateString',
  1765. fn: function (){
  1766. var self=this;
  1767. return self.toDateString();
  1768. return self;}
  1769. }),
  1770. smalltalk.Date);
  1771. smalltalk.addMethod(
  1772. '_asTimeString',
  1773. smalltalk.method({
  1774. selector: 'asTimeString',
  1775. fn: function (){
  1776. var self=this;
  1777. return self.toTimeString();
  1778. return self;}
  1779. }),
  1780. smalltalk.Date);
  1781. smalltalk.addMethod(
  1782. '_asLocaleString',
  1783. smalltalk.method({
  1784. selector: 'asLocaleString',
  1785. fn: function (){
  1786. var self=this;
  1787. return self.toLocaleString();
  1788. return self;}
  1789. }),
  1790. smalltalk.Date);
  1791. smalltalk.addMethod(
  1792. '_asNumber',
  1793. smalltalk.method({
  1794. selector: 'asNumber',
  1795. fn: function (){
  1796. var self=this;
  1797. return smalltalk.send(self, "_asMilliseconds", []);
  1798. return self;}
  1799. }),
  1800. smalltalk.Date);
  1801. smalltalk.addMethod(
  1802. '_hours_',
  1803. smalltalk.method({
  1804. selector: 'hours:',
  1805. fn: function (aNumber){
  1806. var self=this;
  1807. self.setHours(aNumber);
  1808. return self;}
  1809. }),
  1810. smalltalk.Date);
  1811. smalltalk.addMethod(
  1812. '_minutes_',
  1813. smalltalk.method({
  1814. selector: 'minutes:',
  1815. fn: function (aNumber){
  1816. var self=this;
  1817. self.setMinutes(aNumber);
  1818. return self;}
  1819. }),
  1820. smalltalk.Date);
  1821. smalltalk.addMethod(
  1822. '_seconds_',
  1823. smalltalk.method({
  1824. selector: 'seconds:',
  1825. fn: function (aNumber){
  1826. var self=this;
  1827. self.setSeconds(aNumber);
  1828. return self;}
  1829. }),
  1830. smalltalk.Date);
  1831. smalltalk.addMethod(
  1832. '_milliseconds_',
  1833. smalltalk.method({
  1834. selector: 'milliseconds:',
  1835. fn: function (aNumber){
  1836. var self=this;
  1837. self.setMilliseconds(aNumber);
  1838. return self;}
  1839. }),
  1840. smalltalk.Date);
  1841. smalltalk.addMethod(
  1842. '_hours',
  1843. smalltalk.method({
  1844. selector: 'hours',
  1845. fn: function (){
  1846. var self=this;
  1847. return self.getHours();
  1848. return self;}
  1849. }),
  1850. smalltalk.Date);
  1851. smalltalk.addMethod(
  1852. '_minutes',
  1853. smalltalk.method({
  1854. selector: 'minutes',
  1855. fn: function (){
  1856. var self=this;
  1857. return self.getMinutes();
  1858. return self;}
  1859. }),
  1860. smalltalk.Date);
  1861. smalltalk.addMethod(
  1862. '_seconds',
  1863. smalltalk.method({
  1864. selector: 'seconds',
  1865. fn: function (){
  1866. var self=this;
  1867. return self.getSeconds();
  1868. return self;}
  1869. }),
  1870. smalltalk.Date);
  1871. smalltalk.addMethod(
  1872. '_milliseconds',
  1873. smalltalk.method({
  1874. selector: 'milliseconds',
  1875. fn: function (){
  1876. var self=this;
  1877. return self.getMilliseconds();
  1878. return self;}
  1879. }),
  1880. smalltalk.Date);
  1881. smalltalk.addMethod(
  1882. '__lt',
  1883. smalltalk.method({
  1884. selector: '<',
  1885. fn: function (aDate){
  1886. var self=this;
  1887. return self < aDate;
  1888. return self;}
  1889. }),
  1890. smalltalk.Date);
  1891. smalltalk.addMethod(
  1892. '__gt',
  1893. smalltalk.method({
  1894. selector: '>',
  1895. fn: function (aDate){
  1896. var self=this;
  1897. return self > aDate;
  1898. return self;}
  1899. }),
  1900. smalltalk.Date);
  1901. smalltalk.addMethod(
  1902. '__lt_eq',
  1903. smalltalk.method({
  1904. selector: '<=',
  1905. fn: function (aDate){
  1906. var self=this;
  1907. self <= aDate;
  1908. return self;}
  1909. }),
  1910. smalltalk.Date);
  1911. smalltalk.addMethod(
  1912. '__gt_eq',
  1913. smalltalk.method({
  1914. selector: '>=',
  1915. fn: function (aDate){
  1916. var self=this;
  1917. self >= aDate;
  1918. return self;}
  1919. }),
  1920. smalltalk.Date);
  1921. smalltalk.addMethod(
  1922. '__minus',
  1923. smalltalk.method({
  1924. selector: '-',
  1925. fn: function (aDate){
  1926. var self=this;
  1927. return self - aDate;
  1928. return self;}
  1929. }),
  1930. smalltalk.Date);
  1931. smalltalk.addMethod(
  1932. '__plus',
  1933. smalltalk.method({
  1934. selector: '+',
  1935. fn: function (aDate){
  1936. var self=this;
  1937. return self + aDate;
  1938. return self;}
  1939. }),
  1940. smalltalk.Date);
  1941. smalltalk.addMethod(
  1942. '_asJSONObject',
  1943. smalltalk.method({
  1944. selector: 'asJSONObject',
  1945. fn: function (){
  1946. var self=this;
  1947. return self;
  1948. return self;}
  1949. }),
  1950. smalltalk.Date);
  1951. smalltalk.addMethod(
  1952. '_new_',
  1953. smalltalk.method({
  1954. selector: 'new:',
  1955. fn: function (anObject){
  1956. var self=this;
  1957. return new Date(anObject);
  1958. return self;}
  1959. }),
  1960. smalltalk.Date.klass);
  1961. smalltalk.addMethod(
  1962. '_fromString_',
  1963. smalltalk.method({
  1964. selector: 'fromString:',
  1965. fn: function (aString){
  1966. var self=this;
  1967. return smalltalk.send(self, "_new_", [aString]);
  1968. return self;}
  1969. }),
  1970. smalltalk.Date.klass);
  1971. smalltalk.addMethod(
  1972. '_fromSeconds_',
  1973. smalltalk.method({
  1974. selector: 'fromSeconds:',
  1975. fn: function (aNumber){
  1976. var self=this;
  1977. return smalltalk.send(self, "_fromMilliseconds_", [smalltalk.send(aNumber, "__star", [(1000)])]);
  1978. return self;}
  1979. }),
  1980. smalltalk.Date.klass);
  1981. smalltalk.addMethod(
  1982. '_fromMilliseconds_',
  1983. smalltalk.method({
  1984. selector: 'fromMilliseconds:',
  1985. fn: function (aNumber){
  1986. var self=this;
  1987. return smalltalk.send(self, "_new_", [aNumber]);
  1988. return self;}
  1989. }),
  1990. smalltalk.Date.klass);
  1991. smalltalk.addMethod(
  1992. '_today',
  1993. smalltalk.method({
  1994. selector: 'today',
  1995. fn: function (){
  1996. var self=this;
  1997. return smalltalk.send(self, "_new", []);
  1998. return self;}
  1999. }),
  2000. smalltalk.Date.klass);
  2001. smalltalk.addMethod(
  2002. '_now',
  2003. smalltalk.method({
  2004. selector: 'now',
  2005. fn: function (){
  2006. var self=this;
  2007. return smalltalk.send(self, "_today", []);
  2008. return self;}
  2009. }),
  2010. smalltalk.Date.klass);
  2011. smalltalk.addMethod(
  2012. '_millisecondsToRun_',
  2013. smalltalk.method({
  2014. selector: 'millisecondsToRun:',
  2015. fn: function (aBlock){
  2016. var self=this;
  2017. var t=nil;
  2018. t=smalltalk.send(smalltalk.Date, "_now", []);
  2019. smalltalk.send(aBlock, "_value", []);
  2020. return smalltalk.send(smalltalk.send(smalltalk.Date, "_now", []), "__minus", [t]);
  2021. return self;}
  2022. }),
  2023. smalltalk.Date.klass);
  2024. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel');
  2025. smalltalk.addMethod(
  2026. '_subclass_instanceVariableNames_',
  2027. smalltalk.method({
  2028. selector: 'subclass:instanceVariableNames:',
  2029. fn: function (aString, anotherString){
  2030. var self=this;
  2031. return smalltalk.send(self, "_subclass_instanceVariableNames_category_", [aString, anotherString, nil]);
  2032. return self;}
  2033. }),
  2034. smalltalk.UndefinedObject);
  2035. smalltalk.addMethod(
  2036. '_subclass_instanceVariableNames_category_',
  2037. smalltalk.method({
  2038. selector: 'subclass:instanceVariableNames:category:',
  2039. fn: function (aString, aString2, aString3){
  2040. var self=this;
  2041. return smalltalk.send(smalltalk.send(smalltalk.ClassBuilder, "_new", []), "_superclass_subclass_instanceVariableNames_category_", [self, aString, aString2, aString3]);
  2042. return self;}
  2043. }),
  2044. smalltalk.UndefinedObject);
  2045. smalltalk.addMethod(
  2046. '_shallowCopy',
  2047. smalltalk.method({
  2048. selector: 'shallowCopy',
  2049. fn: function (){
  2050. var self=this;
  2051. return self;
  2052. return self;}
  2053. }),
  2054. smalltalk.UndefinedObject);
  2055. smalltalk.addMethod(
  2056. '_deepCopy',
  2057. smalltalk.method({
  2058. selector: 'deepCopy',
  2059. fn: function (){
  2060. var self=this;
  2061. return self;
  2062. return self;}
  2063. }),
  2064. smalltalk.UndefinedObject);
  2065. smalltalk.addMethod(
  2066. '_ifNil_',
  2067. smalltalk.method({
  2068. selector: 'ifNil:',
  2069. fn: function (aBlock){
  2070. var self=this;
  2071. return smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, (function(){return nil;})]);
  2072. return self;}
  2073. }),
  2074. smalltalk.UndefinedObject);
  2075. smalltalk.addMethod(
  2076. '_ifNotNil_',
  2077. smalltalk.method({
  2078. selector: 'ifNotNil:',
  2079. fn: function (aBlock){
  2080. var self=this;
  2081. return self;
  2082. return self;}
  2083. }),
  2084. smalltalk.UndefinedObject);
  2085. smalltalk.addMethod(
  2086. '_ifNil_ifNotNil_',
  2087. smalltalk.method({
  2088. selector: 'ifNil:ifNotNil:',
  2089. fn: function (aBlock, anotherBlock){
  2090. var self=this;
  2091. return smalltalk.send(aBlock, "_value", []);
  2092. return self;}
  2093. }),
  2094. smalltalk.UndefinedObject);
  2095. smalltalk.addMethod(
  2096. '_ifNotNil_ifNil_',
  2097. smalltalk.method({
  2098. selector: 'ifNotNil:ifNil:',
  2099. fn: function (aBlock, anotherBlock){
  2100. var self=this;
  2101. return smalltalk.send(anotherBlock, "_value", []);
  2102. return self;}
  2103. }),
  2104. smalltalk.UndefinedObject);
  2105. smalltalk.addMethod(
  2106. '_isNil',
  2107. smalltalk.method({
  2108. selector: 'isNil',
  2109. fn: function (){
  2110. var self=this;
  2111. return true;
  2112. return self;}
  2113. }),
  2114. smalltalk.UndefinedObject);
  2115. smalltalk.addMethod(
  2116. '_notNil',
  2117. smalltalk.method({
  2118. selector: 'notNil',
  2119. fn: function (){
  2120. var self=this;
  2121. return false;
  2122. return self;}
  2123. }),
  2124. smalltalk.UndefinedObject);
  2125. smalltalk.addMethod(
  2126. '_printString',
  2127. smalltalk.method({
  2128. selector: 'printString',
  2129. fn: function (){
  2130. var self=this;
  2131. return "nil";
  2132. return self;}
  2133. }),
  2134. smalltalk.UndefinedObject);
  2135. smalltalk.addMethod(
  2136. '_new',
  2137. smalltalk.method({
  2138. selector: 'new',
  2139. fn: function (){
  2140. var self=this;
  2141. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  2142. return self;}
  2143. }),
  2144. smalltalk.UndefinedObject.klass);
  2145. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel');
  2146. smalltalk.addMethod(
  2147. '_size',
  2148. smalltalk.method({
  2149. selector: 'size',
  2150. fn: function (){
  2151. var self=this;
  2152. smalltalk.send(self, "_subclassResponsibility", []);
  2153. return self;}
  2154. }),
  2155. smalltalk.Collection);
  2156. smalltalk.addMethod(
  2157. '_readStream',
  2158. smalltalk.method({
  2159. selector: 'readStream',
  2160. fn: function (){
  2161. var self=this;
  2162. return smalltalk.send(self, "_stream", []);
  2163. return self;}
  2164. }),
  2165. smalltalk.Collection);
  2166. smalltalk.addMethod(
  2167. '_writeStream',
  2168. smalltalk.method({
  2169. selector: 'writeStream',
  2170. fn: function (){
  2171. var self=this;
  2172. return smalltalk.send(self, "_stream", []);
  2173. return self;}
  2174. }),
  2175. smalltalk.Collection);
  2176. smalltalk.addMethod(
  2177. '_stream',
  2178. smalltalk.method({
  2179. selector: 'stream',
  2180. fn: function (){
  2181. var self=this;
  2182. return smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [self]);
  2183. return self;}
  2184. }),
  2185. smalltalk.Collection);
  2186. smalltalk.addMethod(
  2187. '_streamClass',
  2188. smalltalk.method({
  2189. selector: 'streamClass',
  2190. fn: function (){
  2191. var self=this;
  2192. return smalltalk.send(smalltalk.send(self, "_class", []), "_streamClass", []);
  2193. return self;}
  2194. }),
  2195. smalltalk.Collection);
  2196. smalltalk.addMethod(
  2197. '_add_',
  2198. smalltalk.method({
  2199. selector: 'add:',
  2200. fn: function (anObject){
  2201. var self=this;
  2202. smalltalk.send(self, "_subclassResponsibility", []);
  2203. return self;}
  2204. }),
  2205. smalltalk.Collection);
  2206. smalltalk.addMethod(
  2207. '_addAll_',
  2208. smalltalk.method({
  2209. selector: 'addAll:',
  2210. fn: function (aCollection){
  2211. var self=this;
  2212. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_add_", [each]);})]);
  2213. return aCollection;
  2214. return self;}
  2215. }),
  2216. smalltalk.Collection);
  2217. smalltalk.addMethod(
  2218. '__comma',
  2219. smalltalk.method({
  2220. selector: ',',
  2221. fn: function (aCollection){
  2222. var self=this;
  2223. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  2224. return self;}
  2225. }),
  2226. smalltalk.Collection);
  2227. smalltalk.addMethod(
  2228. '_copyWith_',
  2229. smalltalk.method({
  2230. selector: 'copyWith:',
  2231. fn: function (anObject){
  2232. var self=this;
  2233. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  2234. return self;}
  2235. }),
  2236. smalltalk.Collection);
  2237. smalltalk.addMethod(
  2238. '_copyWithAll_',
  2239. smalltalk.method({
  2240. selector: 'copyWithAll:',
  2241. fn: function (aCollection){
  2242. var self=this;
  2243. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_copy", []));
  2244. return self;}
  2245. }),
  2246. smalltalk.Collection);
  2247. smalltalk.addMethod(
  2248. '_asArray',
  2249. smalltalk.method({
  2250. selector: 'asArray',
  2251. fn: function (){
  2252. var self=this;
  2253. var array=nil;
  2254. var index=nil;
  2255. array=smalltalk.send(smalltalk.Array, "_new", []);
  2256. index=(0);
  2257. smalltalk.send(self, "_do_", [(function(each){index=smalltalk.send(index, "__plus", [(1)]);return smalltalk.send(array, "_at_put_", [index, each]);})]);
  2258. return array;
  2259. return self;}
  2260. }),
  2261. smalltalk.Collection);
  2262. smalltalk.addMethod(
  2263. '_do_',
  2264. smalltalk.method({
  2265. selector: 'do:',
  2266. fn: function (aBlock){
  2267. var self=this;
  2268. for(var i=0;i<self.length;i++){aBlock(self[i]);};
  2269. return self;}
  2270. }),
  2271. smalltalk.Collection);
  2272. smalltalk.addMethod(
  2273. '_collect_',
  2274. smalltalk.method({
  2275. selector: 'collect:',
  2276. fn: function (aBlock){
  2277. var self=this;
  2278. var newCollection=nil;
  2279. newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  2280. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [smalltalk.send(aBlock, "_value_", [each])]);})]);
  2281. return newCollection;
  2282. return self;}
  2283. }),
  2284. smalltalk.Collection);
  2285. smalltalk.addMethod(
  2286. '_detect_',
  2287. smalltalk.method({
  2288. selector: 'detect:',
  2289. fn: function (aBlock){
  2290. var self=this;
  2291. return smalltalk.send(self, "_detect_ifNone_", [aBlock, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  2292. return self;}
  2293. }),
  2294. smalltalk.Collection);
  2295. smalltalk.addMethod(
  2296. '_detect_ifNone_',
  2297. smalltalk.method({
  2298. selector: 'detect:ifNone:',
  2299. fn: function (aBlock, anotherBlock){
  2300. var self=this;
  2301. for(var i = 0; i < self.length; i++)
  2302. if(aBlock(self[i]))
  2303. return self[i];
  2304. return anotherBlock();
  2305. ;
  2306. return self;}
  2307. }),
  2308. smalltalk.Collection);
  2309. smalltalk.addMethod(
  2310. '_do_separatedBy_',
  2311. smalltalk.method({
  2312. selector: 'do:separatedBy:',
  2313. fn: function (aBlock, anotherBlock){
  2314. var self=this;
  2315. var first=nil;
  2316. first=true;
  2317. smalltalk.send(self, "_do_", [(function(each){smalltalk.send(first, "_ifTrue_ifFalse_", [(function(){return first=false;}), (function(){return smalltalk.send(anotherBlock, "_value", []);})]);return smalltalk.send(aBlock, "_value_", [each]);})]);
  2318. return self;}
  2319. }),
  2320. smalltalk.Collection);
  2321. smalltalk.addMethod(
  2322. '_inject_into_',
  2323. smalltalk.method({
  2324. selector: 'inject:into:',
  2325. fn: function (anObject, aBlock){
  2326. var self=this;
  2327. var result=nil;
  2328. result=anObject;
  2329. smalltalk.send(self, "_do_", [(function(each){return result=smalltalk.send(aBlock, "_value_value_", [result, each]);})]);
  2330. return result;
  2331. return self;}
  2332. }),
  2333. smalltalk.Collection);
  2334. smalltalk.addMethod(
  2335. '_reject_',
  2336. smalltalk.method({
  2337. selector: 'reject:',
  2338. fn: function (aBlock){
  2339. var self=this;
  2340. return smalltalk.send(self, "_select_", [(function(each){return smalltalk.send(smalltalk.send(aBlock, "_value_", [each]), "__eq", [false]);})]);
  2341. return self;}
  2342. }),
  2343. smalltalk.Collection);
  2344. smalltalk.addMethod(
  2345. '_select_',
  2346. smalltalk.method({
  2347. selector: 'select:',
  2348. fn: function (aBlock){
  2349. var self=this;
  2350. var stream=nil;
  2351. stream=smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "_new", []), "_writeStream", []);
  2352. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(smalltalk.send(aBlock, "_value_", [each]), "_ifTrue_", [(function(){return smalltalk.send(stream, "_nextPut_", [each]);})]);})]);
  2353. return smalltalk.send(stream, "_contents", []);
  2354. return self;}
  2355. }),
  2356. smalltalk.Collection);
  2357. smalltalk.addMethod(
  2358. '_errorNotFound',
  2359. smalltalk.method({
  2360. selector: 'errorNotFound',
  2361. fn: function (){
  2362. var self=this;
  2363. smalltalk.send(self, "_error_", ["Object is not in the collection"]);
  2364. return self;}
  2365. }),
  2366. smalltalk.Collection);
  2367. smalltalk.addMethod(
  2368. '_includes_',
  2369. smalltalk.method({
  2370. selector: 'includes:',
  2371. fn: function (anObject){
  2372. var self=this;
  2373. var i = self.length;
  2374. while (i--) {
  2375. if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
  2376. }
  2377. return false
  2378. ;
  2379. return self;}
  2380. }),
  2381. smalltalk.Collection);
  2382. smalltalk.addMethod(
  2383. '_notEmpty',
  2384. smalltalk.method({
  2385. selector: 'notEmpty',
  2386. fn: function (){
  2387. var self=this;
  2388. return smalltalk.send(smalltalk.send(self, "_isEmpty", []), "_not", []);
  2389. return self;}
  2390. }),
  2391. smalltalk.Collection);
  2392. smalltalk.addMethod(
  2393. '_isEmpty',
  2394. smalltalk.method({
  2395. selector: 'isEmpty',
  2396. fn: function (){
  2397. var self=this;
  2398. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  2399. return self;}
  2400. }),
  2401. smalltalk.Collection);
  2402. smalltalk.addMethod(
  2403. '_remove_',
  2404. smalltalk.method({
  2405. selector: 'remove:',
  2406. fn: function (anObject){
  2407. var self=this;
  2408. smalltalk.send(self, "_subclassResponsibility", []);
  2409. return self;}
  2410. }),
  2411. smalltalk.Collection);
  2412. smalltalk.addMethod(
  2413. '_streamClass',
  2414. smalltalk.method({
  2415. selector: 'streamClass',
  2416. fn: function (){
  2417. var self=this;
  2418. return smalltalk.Stream;
  2419. return self;}
  2420. }),
  2421. smalltalk.Collection.klass);
  2422. smalltalk.addMethod(
  2423. '_with_',
  2424. smalltalk.method({
  2425. selector: 'with:',
  2426. fn: function (anObject){
  2427. var self=this;
  2428. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2429. return self;}
  2430. }),
  2431. smalltalk.Collection.klass);
  2432. smalltalk.addMethod(
  2433. '_with_with_',
  2434. smalltalk.method({
  2435. selector: 'with:with:',
  2436. fn: function (anObject, anotherObject){
  2437. var self=this;
  2438. return (function($rec){smalltalk.send($rec, "_add_", [anObject]);smalltalk.send($rec, "_add_", [anotherObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2439. return self;}
  2440. }),
  2441. smalltalk.Collection.klass);
  2442. smalltalk.addMethod(
  2443. '_with_with_with_',
  2444. smalltalk.method({
  2445. selector: 'with:with:with:',
  2446. fn: function (firstObject, secondObject, thirdObject){
  2447. var self=this;
  2448. return (function($rec){smalltalk.send($rec, "_add_", [firstObject]);smalltalk.send($rec, "_add_", [secondObject]);smalltalk.send($rec, "_add_", [thirdObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2449. return self;}
  2450. }),
  2451. smalltalk.Collection.klass);
  2452. smalltalk.addMethod(
  2453. '_withAll_',
  2454. smalltalk.method({
  2455. selector: 'withAll:',
  2456. fn: function (aCollection){
  2457. var self=this;
  2458. return (function($rec){smalltalk.send($rec, "_addAll_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  2459. return self;}
  2460. }),
  2461. smalltalk.Collection.klass);
  2462. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel');
  2463. smalltalk.addMethod(
  2464. '_at_',
  2465. smalltalk.method({
  2466. selector: 'at:',
  2467. fn: function (anIndex){
  2468. var self=this;
  2469. return smalltalk.send(self, "_at_ifAbsent_", [anIndex, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  2470. return self;}
  2471. }),
  2472. smalltalk.SequenceableCollection);
  2473. smalltalk.addMethod(
  2474. '_at_ifAbsent_',
  2475. smalltalk.method({
  2476. selector: 'at:ifAbsent:',
  2477. fn: function (anIndex, aBlock){
  2478. var self=this;
  2479. smalltalk.send(self, "_subclassResponsibility", []);
  2480. return self;}
  2481. }),
  2482. smalltalk.SequenceableCollection);
  2483. smalltalk.addMethod(
  2484. '_at_put_',
  2485. smalltalk.method({
  2486. selector: 'at:put:',
  2487. fn: function (anIndex, anObject){
  2488. var self=this;
  2489. smalltalk.send(self, "_subclassResponsibility", []);
  2490. return self;}
  2491. }),
  2492. smalltalk.SequenceableCollection);
  2493. smalltalk.addMethod(
  2494. '_copyFrom_to_',
  2495. smalltalk.method({
  2496. selector: 'copyFrom:to:',
  2497. fn: function (anIndex, anotherIndex){
  2498. var self=this;
  2499. smalltalk.send(self, "_subclassResponsibility", []);
  2500. return self;}
  2501. }),
  2502. smalltalk.SequenceableCollection);
  2503. smalltalk.addMethod(
  2504. '_first',
  2505. smalltalk.method({
  2506. selector: 'first',
  2507. fn: function (){
  2508. var self=this;
  2509. return smalltalk.send(self, "_at_", [(1)]);
  2510. return self;}
  2511. }),
  2512. smalltalk.SequenceableCollection);
  2513. smalltalk.addMethod(
  2514. '_fourth',
  2515. smalltalk.method({
  2516. selector: 'fourth',
  2517. fn: function (){
  2518. var self=this;
  2519. return smalltalk.send(self, "_at_", [(4)]);
  2520. return self;}
  2521. }),
  2522. smalltalk.SequenceableCollection);
  2523. smalltalk.addMethod(
  2524. '_last',
  2525. smalltalk.method({
  2526. selector: 'last',
  2527. fn: function (){
  2528. var self=this;
  2529. return smalltalk.send(self, "_at_", [smalltalk.send(self, "_size", [])]);
  2530. return self;}
  2531. }),
  2532. smalltalk.SequenceableCollection);
  2533. smalltalk.addMethod(
  2534. '_second',
  2535. smalltalk.method({
  2536. selector: 'second',
  2537. fn: function (){
  2538. var self=this;
  2539. return smalltalk.send(self, "_at_", [(2)]);
  2540. return self;}
  2541. }),
  2542. smalltalk.SequenceableCollection);
  2543. smalltalk.addMethod(
  2544. '_third',
  2545. smalltalk.method({
  2546. selector: 'third',
  2547. fn: function (){
  2548. var self=this;
  2549. return smalltalk.send(self, "_at_", [(3)]);
  2550. return self;}
  2551. }),
  2552. smalltalk.SequenceableCollection);
  2553. smalltalk.addMethod(
  2554. '_removeLast',
  2555. smalltalk.method({
  2556. selector: 'removeLast',
  2557. fn: function (){
  2558. var self=this;
  2559. smalltalk.send(self, "_remove_", [smalltalk.send(self, "_last", [])]);
  2560. return self;}
  2561. }),
  2562. smalltalk.SequenceableCollection);
  2563. smalltalk.addMethod(
  2564. '_addLast_',
  2565. smalltalk.method({
  2566. selector: 'addLast:',
  2567. fn: function (anObject){
  2568. var self=this;
  2569. smalltalk.send(self, "_add_", [anObject]);
  2570. return self;}
  2571. }),
  2572. smalltalk.SequenceableCollection);
  2573. smalltalk.addMethod(
  2574. '_withIndexDo_',
  2575. smalltalk.method({
  2576. selector: 'withIndexDo:',
  2577. fn: function (aBlock){
  2578. var self=this;
  2579. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  2580. return self;}
  2581. }),
  2582. smalltalk.SequenceableCollection);
  2583. smalltalk.addMethod(
  2584. '_allButFirst',
  2585. smalltalk.method({
  2586. selector: 'allButFirst',
  2587. fn: function (){
  2588. var self=this;
  2589. return smalltalk.send(self, "_copyFrom_to_", [(2), smalltalk.send(self, "_size", [])]);
  2590. return self;}
  2591. }),
  2592. smalltalk.SequenceableCollection);
  2593. smalltalk.addMethod(
  2594. '_allButLast',
  2595. smalltalk.method({
  2596. selector: 'allButLast',
  2597. fn: function (){
  2598. var self=this;
  2599. return smalltalk.send(self, "_copyFrom_to_", [(1), smalltalk.send(smalltalk.send(self, "_size", []), "__minus", [(1)])]);
  2600. return self;}
  2601. }),
  2602. smalltalk.SequenceableCollection);
  2603. smalltalk.addMethod(
  2604. '_indexOf_',
  2605. smalltalk.method({
  2606. selector: 'indexOf:',
  2607. fn: function (anObject){
  2608. var self=this;
  2609. return smalltalk.send(self, "_indexOf_ifAbsent_", [anObject, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  2610. return self;}
  2611. }),
  2612. smalltalk.SequenceableCollection);
  2613. smalltalk.addMethod(
  2614. '_indexOf_ifAbsent_',
  2615. smalltalk.method({
  2616. selector: 'indexOf:ifAbsent:',
  2617. fn: function (anObject, aBlock){
  2618. var self=this;
  2619. for(var i=0;i<self.length;i++){
  2620. if(self[i].__eq(anObject)) {return i+1}
  2621. }
  2622. return aBlock();
  2623. ;
  2624. return self;}
  2625. }),
  2626. smalltalk.SequenceableCollection);
  2627. smalltalk.addClass('String', smalltalk.SequenceableCollection, [], 'Kernel');
  2628. smalltalk.addMethod(
  2629. '__eq',
  2630. smalltalk.method({
  2631. selector: '=',
  2632. fn: function (aString){
  2633. var self=this;
  2634. return String(self) == aString;
  2635. return self;}
  2636. }),
  2637. smalltalk.String);
  2638. smalltalk.addMethod(
  2639. '_size',
  2640. smalltalk.method({
  2641. selector: 'size',
  2642. fn: function (){
  2643. var self=this;
  2644. return self.length;
  2645. return self;}
  2646. }),
  2647. smalltalk.String);
  2648. smalltalk.addMethod(
  2649. '_at_',
  2650. smalltalk.method({
  2651. selector: 'at:',
  2652. fn: function (anIndex){
  2653. var self=this;
  2654. return self[anIndex - 1];
  2655. return self;}
  2656. }),
  2657. smalltalk.String);
  2658. smalltalk.addMethod(
  2659. '_at_put_',
  2660. smalltalk.method({
  2661. selector: 'at:put:',
  2662. fn: function (anIndex, anObject){
  2663. var self=this;
  2664. smalltalk.send(self, "_errorReadOnly", []);
  2665. return self;}
  2666. }),
  2667. smalltalk.String);
  2668. smalltalk.addMethod(
  2669. '_at_ifAbsent_',
  2670. smalltalk.method({
  2671. selector: 'at:ifAbsent:',
  2672. fn: function (anIndex, aBlock){
  2673. var self=this;
  2674. smalltalk.send(smalltalk.send(self, "_at_", [anIndex]), "_ifNil_", [(function(){return aBlock;})]);
  2675. return self;}
  2676. }),
  2677. smalltalk.String);
  2678. smalltalk.addMethod(
  2679. '_escaped',
  2680. smalltalk.method({
  2681. selector: 'escaped',
  2682. fn: function (){
  2683. var self=this;
  2684. return escape(self);
  2685. return self;}
  2686. }),
  2687. smalltalk.String);
  2688. smalltalk.addMethod(
  2689. '_unescaped',
  2690. smalltalk.method({
  2691. selector: 'unescaped',
  2692. fn: function (){
  2693. var self=this;
  2694. return unescape(self);
  2695. return self;}
  2696. }),
  2697. smalltalk.String);
  2698. smalltalk.addMethod(
  2699. '_add_',
  2700. smalltalk.method({
  2701. selector: 'add:',
  2702. fn: function (anObject){
  2703. var self=this;
  2704. smalltalk.send(self, "_errorReadOnly", []);
  2705. return self;}
  2706. }),
  2707. smalltalk.String);
  2708. smalltalk.addMethod(
  2709. '__comma',
  2710. smalltalk.method({
  2711. selector: ',',
  2712. fn: function (aString){
  2713. var self=this;
  2714. return self + aString;
  2715. return self;}
  2716. }),
  2717. smalltalk.String);
  2718. smalltalk.addMethod(
  2719. '_copyFrom_to_',
  2720. smalltalk.method({
  2721. selector: 'copyFrom:to:',
  2722. fn: function (anIndex, anotherIndex){
  2723. var self=this;
  2724. return self.substring(anIndex - 1, anotherIndex);
  2725. return self;}
  2726. }),
  2727. smalltalk.String);
  2728. smalltalk.addMethod(
  2729. '_shallowCopy',
  2730. smalltalk.method({
  2731. selector: 'shallowCopy',
  2732. fn: function (){
  2733. var self=this;
  2734. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  2735. return self;}
  2736. }),
  2737. smalltalk.String);
  2738. smalltalk.addMethod(
  2739. '_deepCopy',
  2740. smalltalk.method({
  2741. selector: 'deepCopy',
  2742. fn: function (){
  2743. var self=this;
  2744. return smalltalk.send(self, "_shallowCopy", []);
  2745. return self;}
  2746. }),
  2747. smalltalk.String);
  2748. smalltalk.addMethod(
  2749. '_asSelector',
  2750. smalltalk.method({
  2751. selector: 'asSelector',
  2752. fn: function (){
  2753. var self=this;
  2754. var selector=nil;
  2755. selector=smalltalk.send("_", "__comma", [self]);
  2756. selector=smalltalk.send(selector, "_replace_with_", [":", "_"]);
  2757. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B+%5D"), "_plus"]);
  2758. selector=smalltalk.send(selector, "_replace_with_", [unescape("-"), "_minus"]);
  2759. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B*%5D"), "_star"]);
  2760. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B/%5D"), "_slash"]);
  2761. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3E"), "_gt"]);
  2762. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3C"), "_lt"]);
  2763. selector=smalltalk.send(selector, "_replace_with_", [unescape("%3D"), "_eq"]);
  2764. selector=smalltalk.send(selector, "_replace_with_", [unescape("%2C"), "_comma"]);
  2765. selector=smalltalk.send(selector, "_replace_with_", [unescape("%5B@%5D"), "_at"]);
  2766. return selector;
  2767. return self;}
  2768. }),
  2769. smalltalk.String);
  2770. smalltalk.addMethod(
  2771. '_asJavascript',
  2772. smalltalk.method({
  2773. selector: 'asJavascript',
  2774. fn: function (){
  2775. var self=this;
  2776. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2777. return "unescape(\"" + escape(self) + "\")";
  2778. else
  2779. return "\"" + self + "\"";
  2780. ;
  2781. return self;}
  2782. }),
  2783. smalltalk.String);
  2784. smalltalk.addMethod(
  2785. '_replace_with_',
  2786. smalltalk.method({
  2787. selector: 'replace:with:',
  2788. fn: function (aString, anotherString){
  2789. var self=this;
  2790. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send(smalltalk.RegularExpression, "_fromString_flag_", [aString, "g"]), anotherString]);
  2791. return self;}
  2792. }),
  2793. smalltalk.String);
  2794. smalltalk.addMethod(
  2795. '_replaceRegexp_with_',
  2796. smalltalk.method({
  2797. selector: 'replaceRegexp:with:',
  2798. fn: function (aRegexp, aString){
  2799. var self=this;
  2800. return self.replace(aRegexp, aString);
  2801. return self;}
  2802. }),
  2803. smalltalk.String);
  2804. smalltalk.addMethod(
  2805. '_tokenize_',
  2806. smalltalk.method({
  2807. selector: 'tokenize:',
  2808. fn: function (aString){
  2809. var self=this;
  2810. return self.split(aString);
  2811. return self;}
  2812. }),
  2813. smalltalk.String);
  2814. smalltalk.addMethod(
  2815. '_match_',
  2816. smalltalk.method({
  2817. selector: 'match:',
  2818. fn: function (aRegexp){
  2819. var self=this;
  2820. return self.search(aRegexp) != -1;
  2821. return self;}
  2822. }),
  2823. smalltalk.String);
  2824. smalltalk.addMethod(
  2825. '_asString',
  2826. smalltalk.method({
  2827. selector: 'asString',
  2828. fn: function (){
  2829. var self=this;
  2830. return self;
  2831. return self;}
  2832. }),
  2833. smalltalk.String);
  2834. smalltalk.addMethod(
  2835. '_asNumber',
  2836. smalltalk.method({
  2837. selector: 'asNumber',
  2838. fn: function (){
  2839. var self=this;
  2840. return Number(self);
  2841. return self;}
  2842. }),
  2843. smalltalk.String);
  2844. smalltalk.addMethod(
  2845. '_asParser',
  2846. smalltalk.method({
  2847. selector: 'asParser',
  2848. fn: function (){
  2849. var self=this;
  2850. return smalltalk.send(smalltalk.send(smalltalk.PPStringParser, "_new", []), "_string_", [self]);
  2851. return self;}
  2852. }),
  2853. smalltalk.String);
  2854. smalltalk.addMethod(
  2855. '_asChoiceParser',
  2856. smalltalk.method({
  2857. selector: 'asChoiceParser',
  2858. fn: function (){
  2859. var self=this;
  2860. return smalltalk.send(smalltalk.PPChoiceParser, "_withAll_", [smalltalk.send(smalltalk.send(self, "_asArray", []), "_collect_", [(function(each){return smalltalk.send(each, "_asParser", []);})])]);
  2861. return self;}
  2862. }),
  2863. smalltalk.String);
  2864. smalltalk.addMethod(
  2865. '_asCharacterParser',
  2866. smalltalk.method({
  2867. selector: 'asCharacterParser',
  2868. fn: function (){
  2869. var self=this;
  2870. return smalltalk.send(smalltalk.send(smalltalk.PPCharacterParser, "_new", []), "_string_", [self]);
  2871. return self;}
  2872. }),
  2873. smalltalk.String);
  2874. smalltalk.addMethod(
  2875. '_errorReadOnly',
  2876. smalltalk.method({
  2877. selector: 'errorReadOnly',
  2878. fn: function (){
  2879. var self=this;
  2880. smalltalk.send(self, "_error_", [unescape("Object%20is%20read-only")]);
  2881. return self;}
  2882. }),
  2883. smalltalk.String);
  2884. smalltalk.addMethod(
  2885. '_printString',
  2886. smalltalk.method({
  2887. selector: 'printString',
  2888. fn: function (){
  2889. var self=this;
  2890. return smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [self]), "__comma", [unescape("%27")]);
  2891. return self;}
  2892. }),
  2893. smalltalk.String);
  2894. smalltalk.addMethod(
  2895. '_printNl',
  2896. smalltalk.method({
  2897. selector: 'printNl',
  2898. fn: function (){
  2899. var self=this;
  2900. console.log(self);
  2901. return self;}
  2902. }),
  2903. smalltalk.String);
  2904. smalltalk.addMethod(
  2905. '_isString',
  2906. smalltalk.method({
  2907. selector: 'isString',
  2908. fn: function (){
  2909. var self=this;
  2910. return true;
  2911. return self;}
  2912. }),
  2913. smalltalk.String);
  2914. smalltalk.addMethod(
  2915. '__gt',
  2916. smalltalk.method({
  2917. selector: '>',
  2918. fn: function (aString){
  2919. var self=this;
  2920. return String(self) > aString;
  2921. return self;}
  2922. }),
  2923. smalltalk.String);
  2924. smalltalk.addMethod(
  2925. '__lt',
  2926. smalltalk.method({
  2927. selector: '<',
  2928. fn: function (aString){
  2929. var self=this;
  2930. return String(self) < aString;
  2931. return self;}
  2932. }),
  2933. smalltalk.String);
  2934. smalltalk.addMethod(
  2935. '__gt_eq',
  2936. smalltalk.method({
  2937. selector: '>=',
  2938. fn: function (aString){
  2939. var self=this;
  2940. return String(self) >= aString;
  2941. return self;}
  2942. }),
  2943. smalltalk.String);
  2944. smalltalk.addMethod(
  2945. '__lt_eq',
  2946. smalltalk.method({
  2947. selector: '<=',
  2948. fn: function (aString){
  2949. var self=this;
  2950. return String(self) <= aString;
  2951. return self;}
  2952. }),
  2953. smalltalk.String);
  2954. smalltalk.addMethod(
  2955. '_remove_',
  2956. smalltalk.method({
  2957. selector: 'remove:',
  2958. fn: function (anObject){
  2959. var self=this;
  2960. smalltalk.send(self, "_errorReadOnly", []);
  2961. return self;}
  2962. }),
  2963. smalltalk.String);
  2964. smalltalk.addMethod(
  2965. '_asJSONObject',
  2966. smalltalk.method({
  2967. selector: 'asJSONObject',
  2968. fn: function (){
  2969. var self=this;
  2970. return self;
  2971. return self;}
  2972. }),
  2973. smalltalk.String);
  2974. smalltalk.addMethod(
  2975. '_trimLeft_',
  2976. smalltalk.method({
  2977. selector: 'trimLeft:',
  2978. fn: function (separators){
  2979. var self=this;
  2980. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send(smalltalk.RegularExpression, "_fromString_flag_", [smalltalk.send(smalltalk.send(unescape("%5E%5B"), "__comma", [separators]), "__comma", [unescape("%5D+")]), "g"]), ""]);
  2981. return self;}
  2982. }),
  2983. smalltalk.String);
  2984. smalltalk.addMethod(
  2985. '_trimRight_',
  2986. smalltalk.method({
  2987. selector: 'trimRight:',
  2988. fn: function (separators){
  2989. var self=this;
  2990. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send(smalltalk.RegularExpression, "_fromString_flag_", [smalltalk.send(smalltalk.send(unescape("%5B"), "__comma", [separators]), "__comma", [unescape("%5D+%24")]), "g"]), ""]);
  2991. return self;}
  2992. }),
  2993. smalltalk.String);
  2994. smalltalk.addMethod(
  2995. '_trimLeft',
  2996. smalltalk.method({
  2997. selector: 'trimLeft',
  2998. fn: function (){
  2999. var self=this;
  3000. return smalltalk.send(self, "_trimLeft_", [unescape("%5Cs")]);
  3001. return self;}
  3002. }),
  3003. smalltalk.String);
  3004. smalltalk.addMethod(
  3005. '_trimRight',
  3006. smalltalk.method({
  3007. selector: 'trimRight',
  3008. fn: function (){
  3009. var self=this;
  3010. return smalltalk.send(self, "_trimRight_", [unescape("%5Cs")]);
  3011. return self;}
  3012. }),
  3013. smalltalk.String);
  3014. smalltalk.addMethod(
  3015. '_trimBoth',
  3016. smalltalk.method({
  3017. selector: 'trimBoth',
  3018. fn: function (){
  3019. var self=this;
  3020. return smalltalk.send(self, "_trimBoth_", [unescape("%5Cs")]);
  3021. return self;}
  3022. }),
  3023. smalltalk.String);
  3024. smalltalk.addMethod(
  3025. '_trimBoth_',
  3026. smalltalk.method({
  3027. selector: 'trimBoth:',
  3028. fn: function (separators){
  3029. var self=this;
  3030. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  3031. return self;}
  3032. }),
  3033. smalltalk.String);
  3034. smalltalk.addMethod(
  3035. '_asLowercase',
  3036. smalltalk.method({
  3037. selector: 'asLowercase',
  3038. fn: function (){
  3039. var self=this;
  3040. return self.toLowerCase();
  3041. return self;}
  3042. }),
  3043. smalltalk.String);
  3044. smalltalk.addMethod(
  3045. '_asUppercase',
  3046. smalltalk.method({
  3047. selector: 'asUppercase',
  3048. fn: function (){
  3049. var self=this;
  3050. return self.toUpperCase();
  3051. return self;}
  3052. }),
  3053. smalltalk.String);
  3054. smalltalk.addMethod(
  3055. '_join_',
  3056. smalltalk.method({
  3057. selector: 'join:',
  3058. fn: function (aCollection){
  3059. var self=this;
  3060. return smalltalk.send(smalltalk.String, "_streamContents_", [(function(stream){return smalltalk.send(aCollection, "_do_separatedBy_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(each, "_asString", [])]);}), (function(){return smalltalk.send(stream, "_nextPutAll_", [self]);})]);})]);
  3061. return self;}
  3062. }),
  3063. smalltalk.String);
  3064. smalltalk.addMethod(
  3065. '_includesSubString_',
  3066. smalltalk.method({
  3067. selector: 'includesSubString:',
  3068. fn: function (subString){
  3069. var self=this;
  3070. return self.indexOf(subString) != -1 ;
  3071. return self;}
  3072. }),
  3073. smalltalk.String);
  3074. smalltalk.addMethod(
  3075. '_streamClass',
  3076. smalltalk.method({
  3077. selector: 'streamClass',
  3078. fn: function (){
  3079. var self=this;
  3080. return smalltalk.StringStream;
  3081. return self;}
  3082. }),
  3083. smalltalk.String.klass);
  3084. smalltalk.addMethod(
  3085. '_fromString_',
  3086. smalltalk.method({
  3087. selector: 'fromString:',
  3088. fn: function (aString){
  3089. var self=this;
  3090. return new self.fn(aString);
  3091. return self;}
  3092. }),
  3093. smalltalk.String.klass);
  3094. smalltalk.addMethod(
  3095. '_cr',
  3096. smalltalk.method({
  3097. selector: 'cr',
  3098. fn: function (){
  3099. var self=this;
  3100. return '\r';
  3101. return self;}
  3102. }),
  3103. smalltalk.String.klass);
  3104. smalltalk.addMethod(
  3105. '_lf',
  3106. smalltalk.method({
  3107. selector: 'lf',
  3108. fn: function (){
  3109. var self=this;
  3110. return '\n';
  3111. return self;}
  3112. }),
  3113. smalltalk.String.klass);
  3114. smalltalk.addMethod(
  3115. '_space',
  3116. smalltalk.method({
  3117. selector: 'space',
  3118. fn: function (){
  3119. var self=this;
  3120. return ' ';
  3121. return self;}
  3122. }),
  3123. smalltalk.String.klass);
  3124. smalltalk.addMethod(
  3125. '_tab',
  3126. smalltalk.method({
  3127. selector: 'tab',
  3128. fn: function (){
  3129. var self=this;
  3130. return '\t';
  3131. return self;}
  3132. }),
  3133. smalltalk.String.klass);
  3134. smalltalk.addMethod(
  3135. '_crlf',
  3136. smalltalk.method({
  3137. selector: 'crlf',
  3138. fn: function (){
  3139. var self=this;
  3140. return '\r\n';
  3141. return self;}
  3142. }),
  3143. smalltalk.String.klass);
  3144. smalltalk.addMethod(
  3145. '_streamContents_',
  3146. smalltalk.method({
  3147. selector: 'streamContents:',
  3148. fn: function (blockWithArg){
  3149. var self=this;
  3150. var stream=nil;
  3151. stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send(smalltalk.String, "_new", [])]);
  3152. smalltalk.send(blockWithArg, "_value_", [stream]);
  3153. return smalltalk.send(stream, "_contents", []);
  3154. return self;}
  3155. }),
  3156. smalltalk.String.klass);
  3157. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel');
  3158. smalltalk.addMethod(
  3159. '_size',
  3160. smalltalk.method({
  3161. selector: 'size',
  3162. fn: function (){
  3163. var self=this;
  3164. return self.length;
  3165. return self;}
  3166. }),
  3167. smalltalk.Array);
  3168. smalltalk.addMethod(
  3169. '_at_put_',
  3170. smalltalk.method({
  3171. selector: 'at:put:',
  3172. fn: function (anIndex, anObject){
  3173. var self=this;
  3174. return self[anIndex - 1] = anObject;
  3175. return self;}
  3176. }),
  3177. smalltalk.Array);
  3178. smalltalk.addMethod(
  3179. '_at_ifAbsent_',
  3180. smalltalk.method({
  3181. selector: 'at:ifAbsent:',
  3182. fn: function (anIndex, aBlock){
  3183. var self=this;
  3184. var value = self[anIndex - 1];
  3185. if(value === undefined) {
  3186. return aBlock();
  3187. } else {
  3188. return value;
  3189. }
  3190. ;
  3191. return self;}
  3192. }),
  3193. smalltalk.Array);
  3194. smalltalk.addMethod(
  3195. '_add_',
  3196. smalltalk.method({
  3197. selector: 'add:',
  3198. fn: function (anObject){
  3199. var self=this;
  3200. self.push(anObject); return anObject;;
  3201. return self;}
  3202. }),
  3203. smalltalk.Array);
  3204. smalltalk.addMethod(
  3205. '_shallowCopy',
  3206. smalltalk.method({
  3207. selector: 'shallowCopy',
  3208. fn: function (){
  3209. var self=this;
  3210. var newCollection=nil;
  3211. newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3212. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [each]);})]);
  3213. return newCollection;
  3214. return self;}
  3215. }),
  3216. smalltalk.Array);
  3217. smalltalk.addMethod(
  3218. '_deepCopy',
  3219. smalltalk.method({
  3220. selector: 'deepCopy',
  3221. fn: function (){
  3222. var self=this;
  3223. var newCollection=nil;
  3224. newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3225. smalltalk.send(self, "_do_", [(function(each){return smalltalk.send(newCollection, "_add_", [smalltalk.send(each, "_deepCopy", [])]);})]);
  3226. return newCollection;
  3227. return self;}
  3228. }),
  3229. smalltalk.Array);
  3230. smalltalk.addMethod(
  3231. '_copyFrom_to_',
  3232. smalltalk.method({
  3233. selector: 'copyFrom:to:',
  3234. fn: function (anIndex, anotherIndex){
  3235. var self=this;
  3236. var array=nil;
  3237. array=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3238. smalltalk.send(anIndex, "_to_do_", [anotherIndex, (function(each){return smalltalk.send(array, "_add_", [smalltalk.send(self, "_at_", [each])]);})]);
  3239. return array;
  3240. return self;}
  3241. }),
  3242. smalltalk.Array);
  3243. smalltalk.addMethod(
  3244. '_join_',
  3245. smalltalk.method({
  3246. selector: 'join:',
  3247. fn: function (aString){
  3248. var self=this;
  3249. return self.join(aString);
  3250. return self;}
  3251. }),
  3252. smalltalk.Array);
  3253. smalltalk.addMethod(
  3254. '_asJavascript',
  3255. smalltalk.method({
  3256. selector: 'asJavascript',
  3257. fn: function (){
  3258. var self=this;
  3259. return smalltalk.send(smalltalk.send(unescape("%5B"), "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [unescape("%2C%20")])]), "__comma", [unescape("%5D")]);
  3260. return self;}
  3261. }),
  3262. smalltalk.Array);
  3263. smalltalk.addMethod(
  3264. '_sort',
  3265. smalltalk.method({
  3266. selector: 'sort',
  3267. fn: function (){
  3268. var self=this;
  3269. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  3270. return self;}
  3271. }),
  3272. smalltalk.Array);
  3273. smalltalk.addMethod(
  3274. '_sort_',
  3275. smalltalk.method({
  3276. selector: 'sort:',
  3277. fn: function (aBlock){
  3278. var self=this;
  3279. return self.sort(function(a, b) {
  3280. if(aBlock(a,b)) {return -1} else {return 1}
  3281. })
  3282. ;
  3283. return self;}
  3284. }),
  3285. smalltalk.Array);
  3286. smalltalk.addMethod(
  3287. '_remove_',
  3288. smalltalk.method({
  3289. selector: 'remove:',
  3290. fn: function (anObject){
  3291. var self=this;
  3292. for(var i=0;i<self.length;i++) {
  3293. if(self[i] == anObject) {
  3294. self.splice(i,1);
  3295. break;
  3296. }
  3297. }
  3298. ;
  3299. return self;}
  3300. }),
  3301. smalltalk.Array);
  3302. smalltalk.addMethod(
  3303. '_sorted',
  3304. smalltalk.method({
  3305. selector: 'sorted',
  3306. fn: function (){
  3307. var self=this;
  3308. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  3309. return self;}
  3310. }),
  3311. smalltalk.Array);
  3312. smalltalk.addMethod(
  3313. '_sorted_',
  3314. smalltalk.method({
  3315. selector: 'sorted:',
  3316. fn: function (aBlock){
  3317. var self=this;
  3318. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  3319. return self;}
  3320. }),
  3321. smalltalk.Array);
  3322. smalltalk.addMethod(
  3323. '_asJSONObject',
  3324. smalltalk.method({
  3325. selector: 'asJSONObject',
  3326. fn: function (){
  3327. var self=this;
  3328. return smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJSONObject", []);})]);
  3329. return self;}
  3330. }),
  3331. smalltalk.Array);
  3332. smalltalk.addMethod(
  3333. '_removeFrom_to_',
  3334. smalltalk.method({
  3335. selector: 'removeFrom:to:',
  3336. fn: function (aNumber, anotherNumber){
  3337. var self=this;
  3338. self.splice(aNumber - 1,anotherNumber - 1);
  3339. return self;}
  3340. }),
  3341. smalltalk.Array);
  3342. smalltalk.addMethod(
  3343. '_printString',
  3344. smalltalk.method({
  3345. selector: 'printString',
  3346. fn: function (){
  3347. var self=this;
  3348. var str=nil;
  3349. str=smalltalk.send("", "_writeStream", []);
  3350. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.SequenceableCollection), "__comma", [unescape("%20%28")])]);
  3351. smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(str, "_nextPutAll_", [" "]);})]);
  3352. smalltalk.send(str, "_nextPutAll_", [unescape("%29")]);
  3353. return smalltalk.send(str, "_contents", []);
  3354. return self;}
  3355. }),
  3356. smalltalk.Array);
  3357. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel');
  3358. smalltalk.addMethod(
  3359. '_compile_',
  3360. smalltalk.method({
  3361. selector: 'compile:',
  3362. fn: function (aString){
  3363. var self=this;
  3364. return self.compile(aString);
  3365. return self;}
  3366. }),
  3367. smalltalk.RegularExpression);
  3368. smalltalk.addMethod(
  3369. '_exec_',
  3370. smalltalk.method({
  3371. selector: 'exec:',
  3372. fn: function (aString){
  3373. var self=this;
  3374. return self.exec(aString) || nil;
  3375. return self;}
  3376. }),
  3377. smalltalk.RegularExpression);
  3378. smalltalk.addMethod(
  3379. '_test_',
  3380. smalltalk.method({
  3381. selector: 'test:',
  3382. fn: function (aString){
  3383. var self=this;
  3384. return self.test(aString);
  3385. return self;}
  3386. }),
  3387. smalltalk.RegularExpression);
  3388. smalltalk.addMethod(
  3389. '_fromString_flag_',
  3390. smalltalk.method({
  3391. selector: 'fromString:flag:',
  3392. fn: function (aString, anotherString){
  3393. var self=this;
  3394. return new RegExp(aString, anotherString);
  3395. return self;}
  3396. }),
  3397. smalltalk.RegularExpression.klass);
  3398. smalltalk.addMethod(
  3399. '_fromString_',
  3400. smalltalk.method({
  3401. selector: 'fromString:',
  3402. fn: function (aString){
  3403. var self=this;
  3404. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  3405. return self;}
  3406. }),
  3407. smalltalk.RegularExpression.klass);
  3408. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel');
  3409. smalltalk.addMethod(
  3410. '_messageText',
  3411. smalltalk.method({
  3412. selector: 'messageText',
  3413. fn: function (){
  3414. var self=this;
  3415. return self['@messageText'];
  3416. return self;}
  3417. }),
  3418. smalltalk.Error);
  3419. smalltalk.addMethod(
  3420. '_messageText_',
  3421. smalltalk.method({
  3422. selector: 'messageText:',
  3423. fn: function (aString){
  3424. var self=this;
  3425. self['@messageText']=aString;
  3426. return self;}
  3427. }),
  3428. smalltalk.Error);
  3429. smalltalk.addMethod(
  3430. '_signal',
  3431. smalltalk.method({
  3432. selector: 'signal',
  3433. fn: function (){
  3434. var self=this;
  3435. self.context = thisContext; self.smalltalkError = true; throw(self);
  3436. return self;}
  3437. }),
  3438. smalltalk.Error);
  3439. smalltalk.addMethod(
  3440. '_context',
  3441. smalltalk.method({
  3442. selector: 'context',
  3443. fn: function (){
  3444. var self=this;
  3445. return self.context;
  3446. return self;}
  3447. }),
  3448. smalltalk.Error);
  3449. smalltalk.addMethod(
  3450. '_signal_',
  3451. smalltalk.method({
  3452. selector: 'signal:',
  3453. fn: function (aString){
  3454. var self=this;
  3455. return (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(self, "_new", []));
  3456. return self;}
  3457. }),
  3458. smalltalk.Error.klass);
  3459. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel');
  3460. smalltalk.addMethod(
  3461. '_receiver',
  3462. smalltalk.method({
  3463. selector: 'receiver',
  3464. fn: function (){
  3465. var self=this;
  3466. return self.receiver;
  3467. return self;}
  3468. }),
  3469. smalltalk.MethodContext);
  3470. smalltalk.addMethod(
  3471. '_selector',
  3472. smalltalk.method({
  3473. selector: 'selector',
  3474. fn: function (){
  3475. var self=this;
  3476. return smalltalk.convertSelector(self.selector);
  3477. return self;}
  3478. }),
  3479. smalltalk.MethodContext);
  3480. smalltalk.addMethod(
  3481. '_home',
  3482. smalltalk.method({
  3483. selector: 'home',
  3484. fn: function (){
  3485. var self=this;
  3486. return self.homeContext;
  3487. return self;}
  3488. }),
  3489. smalltalk.MethodContext);
  3490. smalltalk.addMethod(
  3491. '_temps',
  3492. smalltalk.method({
  3493. selector: 'temps',
  3494. fn: function (){
  3495. var self=this;
  3496. return self.temps;
  3497. return self;}
  3498. }),
  3499. smalltalk.MethodContext);
  3500. smalltalk.addMethod(
  3501. '_printString',
  3502. smalltalk.method({
  3503. selector: 'printString',
  3504. fn: function (){
  3505. var self=this;
  3506. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", [unescape("%28")]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [unescape("%29")]);
  3507. return self;}
  3508. }),
  3509. smalltalk.MethodContext);
  3510. smalltalk.addMethod(
  3511. '_asString',
  3512. smalltalk.method({
  3513. selector: 'asString',
  3514. fn: function (){
  3515. var self=this;
  3516. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [unescape("%20%3E%3E%20")]), "__comma", [smalltalk.send(self, "_selector", [])]);
  3517. return self;}
  3518. }),
  3519. smalltalk.MethodContext);
  3520. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel');
  3521. smalltalk.addMethod(
  3522. '__eq',
  3523. smalltalk.method({
  3524. selector: '=',
  3525. fn: function (anAssociation){
  3526. var self=this;
  3527. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
  3528. return self;}
  3529. }),
  3530. smalltalk.Association);
  3531. smalltalk.addMethod(
  3532. '_key_',
  3533. smalltalk.method({
  3534. selector: 'key:',
  3535. fn: function (aKey){
  3536. var self=this;
  3537. self['@key']=aKey;
  3538. return self;}
  3539. }),
  3540. smalltalk.Association);
  3541. smalltalk.addMethod(
  3542. '_key',
  3543. smalltalk.method({
  3544. selector: 'key',
  3545. fn: function (){
  3546. var self=this;
  3547. return self['@key'];
  3548. return self;}
  3549. }),
  3550. smalltalk.Association);
  3551. smalltalk.addMethod(
  3552. '_value_',
  3553. smalltalk.method({
  3554. selector: 'value:',
  3555. fn: function (aValue){
  3556. var self=this;
  3557. self['@value']=aValue;
  3558. return self;}
  3559. }),
  3560. smalltalk.Association);
  3561. smalltalk.addMethod(
  3562. '_value',
  3563. smalltalk.method({
  3564. selector: 'value',
  3565. fn: function (){
  3566. var self=this;
  3567. return self['@value'];
  3568. return self;}
  3569. }),
  3570. smalltalk.Association);
  3571. smalltalk.addMethod(
  3572. '_key_value_',
  3573. smalltalk.method({
  3574. selector: 'key:value:',
  3575. fn: function (aKey, aValue){
  3576. var self=this;
  3577. return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  3578. return self;}
  3579. }),
  3580. smalltalk.Association.klass);
  3581. smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
  3582. smalltalk.addMethod(
  3583. '__eq',
  3584. smalltalk.method({
  3585. selector: '=',
  3586. fn: function (aDictionary){
  3587. var self=this;
  3588. try{smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(aDictionary, "_class", [])]), "_ifFalse_", [(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})]);
  3589. smalltalk.send(self, "_associationsDo_", [(function(assoc){return smalltalk.send(smalltalk.send(smalltalk.send(aDictionary, "_at_ifAbsent_", [smalltalk.send(assoc, "_key", []), (function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})]), "__eq", [smalltalk.send(assoc, "_value", [])]), "_ifFalse_", [(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})]);})]);
  3590. (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return true}})})();
  3591. return self;
  3592. } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}}
  3593. }),
  3594. smalltalk.Dictionary);
  3595. smalltalk.addMethod(
  3596. '_shallowCopy',
  3597. smalltalk.method({
  3598. selector: 'shallowCopy',
  3599. fn: function (){
  3600. var self=this;
  3601. var copy=nil;
  3602. copy=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3603. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(copy, "_at_put_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  3604. return copy;
  3605. return self;}
  3606. }),
  3607. smalltalk.Dictionary);
  3608. smalltalk.addMethod(
  3609. '_initialize',
  3610. smalltalk.method({
  3611. selector: 'initialize',
  3612. fn: function (){
  3613. var self=this;
  3614. smalltalk.send(self, "_initialize", [], smalltalk.Collection);
  3615. self['@keys']=[];
  3616. return self;}
  3617. }),
  3618. smalltalk.Dictionary);
  3619. smalltalk.addMethod(
  3620. '_size',
  3621. smalltalk.method({
  3622. selector: 'size',
  3623. fn: function (){
  3624. var self=this;
  3625. return smalltalk.send(self['@keys'], "_size", []);
  3626. return self;}
  3627. }),
  3628. smalltalk.Dictionary);
  3629. smalltalk.addMethod(
  3630. '_associations',
  3631. smalltalk.method({
  3632. selector: 'associations',
  3633. fn: function (){
  3634. var self=this;
  3635. var associations=nil;
  3636. associations=[];
  3637. smalltalk.send(self['@keys'], "_do_", [(function(each){return smalltalk.send(associations, "_add_", [smalltalk.send(smalltalk.Association, "_key_value_", [each, smalltalk.send(self, "_at_", [each])])]);})]);
  3638. return associations;
  3639. return self;}
  3640. }),
  3641. smalltalk.Dictionary);
  3642. smalltalk.addMethod(
  3643. '_keys',
  3644. smalltalk.method({
  3645. selector: 'keys',
  3646. fn: function (){
  3647. var self=this;
  3648. return smalltalk.send(self['@keys'], "_copy", []);
  3649. return self;}
  3650. }),
  3651. smalltalk.Dictionary);
  3652. smalltalk.addMethod(
  3653. '_values',
  3654. smalltalk.method({
  3655. selector: 'values',
  3656. fn: function (){
  3657. var self=this;
  3658. return smalltalk.send(self['@keys'], "_collect_", [(function(each){return smalltalk.send(self, "_at_", [each]);})]);
  3659. return self;}
  3660. }),
  3661. smalltalk.Dictionary);
  3662. smalltalk.addMethod(
  3663. '_at_put_',
  3664. smalltalk.method({
  3665. selector: 'at:put:',
  3666. fn: function (aKey, aValue){
  3667. var self=this;
  3668. smalltalk.send(smalltalk.send(self['@keys'], "_includes_", [aKey]), "_ifFalse_", [(function(){return smalltalk.send(self['@keys'], "_add_", [aKey]);})]);
  3669. return smalltalk.send(self, "_basicAt_put_", [aKey, aValue]);
  3670. return self;}
  3671. }),
  3672. smalltalk.Dictionary);
  3673. smalltalk.addMethod(
  3674. '_at_ifAbsent_',
  3675. smalltalk.method({
  3676. selector: 'at:ifAbsent:',
  3677. fn: function (aKey, aBlock){
  3678. var self=this;
  3679. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_keys", []), "_includes_", [aKey]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_basicAt_", [aKey]);}), aBlock]);
  3680. return self;}
  3681. }),
  3682. smalltalk.Dictionary);
  3683. smalltalk.addMethod(
  3684. '_at_ifAbsentPut_',
  3685. smalltalk.method({
  3686. selector: 'at:ifAbsentPut:',
  3687. fn: function (aKey, aBlock){
  3688. var self=this;
  3689. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_at_put_", [aKey, smalltalk.send(aBlock, "_value", [])]);})]);
  3690. return self;}
  3691. }),
  3692. smalltalk.Dictionary);
  3693. smalltalk.addMethod(
  3694. '_at_ifPresent_',
  3695. smalltalk.method({
  3696. selector: 'at:ifPresent:',
  3697. fn: function (aKey, aBlock){
  3698. var self=this;
  3699. return smalltalk.send(smalltalk.send(self, "_basicAt_", [aKey]), "_ifNotNil_", [(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
  3700. return self;}
  3701. }),
  3702. smalltalk.Dictionary);
  3703. smalltalk.addMethod(
  3704. '_at_ifPresent_ifAbsent_',
  3705. smalltalk.method({
  3706. selector: 'at:ifPresent:ifAbsent:',
  3707. fn: function (aKey, aBlock, anotherBlock){
  3708. var self=this;
  3709. return smalltalk.send(smalltalk.send(self, "_basicAt_", [aKey]), "_ifNil_ifNotNil_", [anotherBlock, (function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_at_", [aKey])]);})]);
  3710. return self;}
  3711. }),
  3712. smalltalk.Dictionary);
  3713. smalltalk.addMethod(
  3714. '_add_',
  3715. smalltalk.method({
  3716. selector: 'add:',
  3717. fn: function (anAssociation){
  3718. var self=this;
  3719. smalltalk.send(self, "_at_put_", [smalltalk.send(anAssociation, "_key", []), smalltalk.send(anAssociation, "_value", [])]);
  3720. return self;}
  3721. }),
  3722. smalltalk.Dictionary);
  3723. smalltalk.addMethod(
  3724. '_addAll_',
  3725. smalltalk.method({
  3726. selector: 'addAll:',
  3727. fn: function (aDictionary){
  3728. var self=this;
  3729. smalltalk.send(self, "_addAll_", [smalltalk.send(aDictionary, "_associations", [])], smalltalk.Collection);
  3730. return aDictionary;
  3731. return self;}
  3732. }),
  3733. smalltalk.Dictionary);
  3734. smalltalk.addMethod(
  3735. '__comma',
  3736. smalltalk.method({
  3737. selector: ',',
  3738. fn: function (aCollection){
  3739. var self=this;
  3740. smalltalk.send(self, "_shouldNotImplement", []);
  3741. return self;}
  3742. }),
  3743. smalltalk.Dictionary);
  3744. smalltalk.addMethod(
  3745. '_copyFrom_to_',
  3746. smalltalk.method({
  3747. selector: 'copyFrom:to:',
  3748. fn: function (anIndex, anotherIndex){
  3749. var self=this;
  3750. smalltalk.send(self, "_shouldNotImplement", []);
  3751. return self;}
  3752. }),
  3753. smalltalk.Dictionary);
  3754. smalltalk.addMethod(
  3755. '_associationsDo_',
  3756. smalltalk.method({
  3757. selector: 'associationsDo:',
  3758. fn: function (aBlock){
  3759. var self=this;
  3760. smalltalk.send(smalltalk.send(self, "_associations", []), "_do_", [aBlock]);
  3761. return self;}
  3762. }),
  3763. smalltalk.Dictionary);
  3764. smalltalk.addMethod(
  3765. '_keysAndValuesDo_',
  3766. smalltalk.method({
  3767. selector: 'keysAndValuesDo:',
  3768. fn: function (aBlock){
  3769. var self=this;
  3770. smalltalk.send(self, "_associationsDo_", [(function(each){return smalltalk.send(aBlock, "_value_value_", [smalltalk.send(each, "_key", []), smalltalk.send(each, "_value", [])]);})]);
  3771. return self;}
  3772. }),
  3773. smalltalk.Dictionary);
  3774. smalltalk.addMethod(
  3775. '_do_',
  3776. smalltalk.method({
  3777. selector: 'do:',
  3778. fn: function (aBlock){
  3779. var self=this;
  3780. smalltalk.send(smalltalk.send(self, "_values", []), "_do_", [aBlock]);
  3781. return self;}
  3782. }),
  3783. smalltalk.Dictionary);
  3784. smalltalk.addMethod(
  3785. '_select_',
  3786. smalltalk.method({
  3787. selector: 'select:',
  3788. fn: function (aBlock){
  3789. var self=this;
  3790. var newDict=nil;
  3791. newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3792. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(smalltalk.send(aBlock, "_value_", [value]), "_ifTrue_", [(function(){return smalltalk.send(newDict, "_at_put_", [key, value]);})]);})]);
  3793. return newDict;
  3794. return self;}
  3795. }),
  3796. smalltalk.Dictionary);
  3797. smalltalk.addMethod(
  3798. '_collect_',
  3799. smalltalk.method({
  3800. selector: 'collect:',
  3801. fn: function (aBlock){
  3802. var self=this;
  3803. var newDict=nil;
  3804. newDict=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []);
  3805. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(newDict, "_at_put_", [key, smalltalk.send(aBlock, "_value_", [value])]);})]);
  3806. return newDict;
  3807. return self;}
  3808. }),
  3809. smalltalk.Dictionary);
  3810. smalltalk.addMethod(
  3811. '_detect_ifNone_',
  3812. smalltalk.method({
  3813. selector: 'detect:ifNone:',
  3814. fn: function (aBlock, anotherBlock){
  3815. var self=this;
  3816. return smalltalk.send(smalltalk.send(self, "_values", []), "_detect_ifNone_", [aBlock, anotherBlock]);
  3817. return self;}
  3818. }),
  3819. smalltalk.Dictionary);
  3820. smalltalk.addMethod(
  3821. '_includes_',
  3822. smalltalk.method({
  3823. selector: 'includes:',
  3824. fn: function (anObject){
  3825. var self=this;
  3826. return smalltalk.send(smalltalk.send(self, "_values", []), "_includes_", [anObject]);
  3827. return self;}
  3828. }),
  3829. smalltalk.Dictionary);
  3830. smalltalk.addMethod(
  3831. '_remove_',
  3832. smalltalk.method({
  3833. selector: 'remove:',
  3834. fn: function (aKey){
  3835. var self=this;
  3836. smalltalk.send(self, "_removeKey_", [aKey]);
  3837. return self;}
  3838. }),
  3839. smalltalk.Dictionary);
  3840. smalltalk.addMethod(
  3841. '_removeKey_',
  3842. smalltalk.method({
  3843. selector: 'removeKey:',
  3844. fn: function (aKey){
  3845. var self=this;
  3846. smalltalk.send(self['@keys'], "_remove_", [aKey]);
  3847. return self;}
  3848. }),
  3849. smalltalk.Dictionary);
  3850. smalltalk.addMethod(
  3851. '_at_',
  3852. smalltalk.method({
  3853. selector: 'at:',
  3854. fn: function (aKey){
  3855. var self=this;
  3856. return smalltalk.send(self, "_at_ifAbsent_", [aKey, (function(){return smalltalk.send(self, "_errorNotFound", []);})]);
  3857. return self;}
  3858. }),
  3859. smalltalk.Dictionary);
  3860. smalltalk.addMethod(
  3861. '_asJSONObject',
  3862. smalltalk.method({
  3863. selector: 'asJSONObject',
  3864. fn: function (){
  3865. var self=this;
  3866. var object=nil;
  3867. object=smalltalk.send(smalltalk.Object, "_new", []);
  3868. smalltalk.send(self, "_keysAndValuesDo_", [(function(key, value){return smalltalk.send(object, "_basicAt_put_", [key, smalltalk.send(value, "_asJSONObject", [])]);})]);
  3869. return object;
  3870. return self;}
  3871. }),
  3872. smalltalk.Dictionary);
  3873. smalltalk.addMethod(
  3874. '_printString',
  3875. smalltalk.method({
  3876. selector: 'printString',
  3877. fn: function (){
  3878. var self=this;
  3879. return smalltalk.send(smalltalk.String, "_streamContents_", [(function(aStream){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Collection)]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%28")]);})(aStream);smalltalk.send(smalltalk.send(self, "_associations", []), "_do_separatedBy_", [(function(anAssociation){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_key", []), "_printString", [])]);smalltalk.send($rec, "_nextPutAll_", [unescape("%20-%3E%20")]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(anAssociation, "_value", []), "_printString", [])]);})(aStream);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [unescape("%20%2C%20")]);})]);return smalltalk.send(aStream, "_nextPutAll_", [unescape("%29")]);})]);
  3880. return self;}
  3881. }),
  3882. smalltalk.Dictionary);
  3883. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel');
  3884. smalltalk.addMethod(
  3885. '_superclass_subclass_',
  3886. smalltalk.method({
  3887. selector: 'superclass:subclass:',
  3888. fn: function (aClass, aString){
  3889. var self=this;
  3890. smalltalk.send(self, "_superclass_subclass_instanceVariableNames_category_", [aClass, aString, "", nil]);
  3891. return self;}
  3892. }),
  3893. smalltalk.ClassBuilder);
  3894. smalltalk.addMethod(
  3895. '_superclass_subclass_instanceVariableNames_category_',
  3896. smalltalk.method({
  3897. selector: 'superclass:subclass:instanceVariableNames:category:',
  3898. fn: function (aClass, aString, aString2, aString3){
  3899. var self=this;
  3900. var newClass=nil;
  3901. newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_", [aClass, aString, smalltalk.send(self, "_instanceVariableNamesFor_", [aString2])]);
  3902. smalltalk.send(self, "_setupClass_", [newClass]);
  3903. smalltalk.send(newClass, "_category_", [smalltalk.send(aString3, "_ifNil_", [(function(){return "unclassified";})])]);
  3904. return self;}
  3905. }),
  3906. smalltalk.ClassBuilder);
  3907. smalltalk.addMethod(
  3908. '_class_instanceVariableNames_',
  3909. smalltalk.method({
  3910. selector: 'class:instanceVariableNames:',
  3911. fn: function (aClass, aString){
  3912. var self=this;
  3913. smalltalk.send(smalltalk.send(aClass, "_isMetaclass", []), "_ifFalse_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_name", []), "__comma", [" is not a metaclass"])]);})]);
  3914. smalltalk.send(aClass, "_basicAt_put_", ["iVarNames", smalltalk.send(self, "_instanceVariableNamesFor_", [aString])]);
  3915. smalltalk.send(self, "_setupClass_", [aClass]);
  3916. return self;}
  3917. }),
  3918. smalltalk.ClassBuilder);
  3919. smalltalk.addMethod(
  3920. '_instanceVariableNamesFor_',
  3921. smalltalk.method({
  3922. selector: 'instanceVariableNamesFor:',
  3923. fn: function (aString){
  3924. var self=this;
  3925. return smalltalk.send(smalltalk.send(aString, "_tokenize_", [" "]), "_reject_", [(function(each){return smalltalk.send(each, "_isEmpty", []);})]);
  3926. return self;}
  3927. }),
  3928. smalltalk.ClassBuilder);
  3929. smalltalk.addMethod(
  3930. '_addSubclassOf_named_instanceVariableNames_',
  3931. smalltalk.method({
  3932. selector: 'addSubclassOf:named:instanceVariableNames:',
  3933. fn: function (aClass, aString, aCollection){
  3934. var self=this;
  3935. smalltalk.addClass(aString, aClass, aCollection);
  3936. return smalltalk[aString];
  3937. return self;}
  3938. }),
  3939. smalltalk.ClassBuilder);
  3940. smalltalk.addMethod(
  3941. '_setupClass_',
  3942. smalltalk.method({
  3943. selector: 'setupClass:',
  3944. fn: function (aClass){
  3945. var self=this;
  3946. smalltalk.init(aClass);;
  3947. return self;}
  3948. }),
  3949. smalltalk.ClassBuilder);
  3950. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel');
  3951. smalltalk.addMethod(
  3952. '_initialize',
  3953. smalltalk.method({
  3954. selector: 'initialize',
  3955. fn: function (){
  3956. var self=this;
  3957. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  3958. self['@chunkParser']=smalltalk.send(smalltalk.ChunkParser, "_new", []);
  3959. return self;}
  3960. }),
  3961. smalltalk.ClassCategoryReader);
  3962. smalltalk.addMethod(
  3963. '_class_category_',
  3964. smalltalk.method({
  3965. selector: 'class:category:',
  3966. fn: function (aClass, aString){
  3967. var self=this;
  3968. self['@class']=aClass;
  3969. self['@category']=aString;
  3970. return self;}
  3971. }),
  3972. smalltalk.ClassCategoryReader);
  3973. smalltalk.addMethod(
  3974. '_scanFrom_',
  3975. smalltalk.method({
  3976. selector: 'scanFrom:',
  3977. fn: function (aStream){
  3978. var self=this;
  3979. var nextChunk=nil;
  3980. nextChunk=smalltalk.send(smalltalk.send(smalltalk.send(self['@chunkParser'], "_emptyChunk", []), "__slash", [smalltalk.send(self['@chunkParser'], "_chunk", [])]), "_parse_", [aStream]);
  3981. smalltalk.send(smalltalk.send(nextChunk, "_isEmptyChunk", []), "_ifFalse_", [(function(){smalltalk.send(self, "_compileMethod_", [smalltalk.send(nextChunk, "_contents", [])]);return smalltalk.send(self, "_scanFrom_", [aStream]);})]);
  3982. return self;}
  3983. }),
  3984. smalltalk.ClassCategoryReader);
  3985. smalltalk.addMethod(
  3986. '_compileMethod_',
  3987. smalltalk.method({
  3988. selector: 'compileMethod:',
  3989. fn: function (aString){
  3990. var self=this;
  3991. var method=nil;
  3992. method=smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_load_forClass_", [aString, self['@class']]);
  3993. smalltalk.send(method, "_category_", [self['@category']]);
  3994. smalltalk.send(self['@class'], "_addCompiledMethod_", [method]);
  3995. return self;}
  3996. }),
  3997. smalltalk.ClassCategoryReader);
  3998. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel');
  3999. smalltalk.addMethod(
  4000. '_collection',
  4001. smalltalk.method({
  4002. selector: 'collection',
  4003. fn: function (){
  4004. var self=this;
  4005. return self['@collection'];
  4006. return self;}
  4007. }),
  4008. smalltalk.Stream);
  4009. smalltalk.addMethod(
  4010. '_setCollection_',
  4011. smalltalk.method({
  4012. selector: 'setCollection:',
  4013. fn: function (aCollection){
  4014. var self=this;
  4015. self['@collection']=aCollection;
  4016. return self;}
  4017. }),
  4018. smalltalk.Stream);
  4019. smalltalk.addMethod(
  4020. '_position',
  4021. smalltalk.method({
  4022. selector: 'position',
  4023. fn: function (){
  4024. var self=this;
  4025. return smalltalk.send(self['@position'], "_ifNil_", [(function(){return self['@position']=(0);})]);
  4026. return self;}
  4027. }),
  4028. smalltalk.Stream);
  4029. smalltalk.addMethod(
  4030. '_position_',
  4031. smalltalk.method({
  4032. selector: 'position:',
  4033. fn: function (anInteger){
  4034. var self=this;
  4035. self['@position']=anInteger;
  4036. return self;}
  4037. }),
  4038. smalltalk.Stream);
  4039. smalltalk.addMethod(
  4040. '_streamSize',
  4041. smalltalk.method({
  4042. selector: 'streamSize',
  4043. fn: function (){
  4044. var self=this;
  4045. return self['@streamSize'];
  4046. return self;}
  4047. }),
  4048. smalltalk.Stream);
  4049. smalltalk.addMethod(
  4050. '_setStreamSize_',
  4051. smalltalk.method({
  4052. selector: 'setStreamSize:',
  4053. fn: function (anInteger){
  4054. var self=this;
  4055. self['@streamSize']=anInteger;
  4056. return self;}
  4057. }),
  4058. smalltalk.Stream);
  4059. smalltalk.addMethod(
  4060. '_contents',
  4061. smalltalk.method({
  4062. selector: 'contents',
  4063. fn: function (){
  4064. var self=this;
  4065. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  4066. return self;}
  4067. }),
  4068. smalltalk.Stream);
  4069. smalltalk.addMethod(
  4070. '_size',
  4071. smalltalk.method({
  4072. selector: 'size',
  4073. fn: function (){
  4074. var self=this;
  4075. return smalltalk.send(self, "_streamSize", []);
  4076. return self;}
  4077. }),
  4078. smalltalk.Stream);
  4079. smalltalk.addMethod(
  4080. '_reset',
  4081. smalltalk.method({
  4082. selector: 'reset',
  4083. fn: function (){
  4084. var self=this;
  4085. smalltalk.send(self, "_position_", [(0)]);
  4086. return self;}
  4087. }),
  4088. smalltalk.Stream);
  4089. smalltalk.addMethod(
  4090. '_close',
  4091. smalltalk.method({
  4092. selector: 'close',
  4093. fn: function (){
  4094. var self=this;
  4095. return self;}
  4096. }),
  4097. smalltalk.Stream);
  4098. smalltalk.addMethod(
  4099. '_flush',
  4100. smalltalk.method({
  4101. selector: 'flush',
  4102. fn: function (){
  4103. var self=this;
  4104. return self;}
  4105. }),
  4106. smalltalk.Stream);
  4107. smalltalk.addMethod(
  4108. '_resetContents',
  4109. smalltalk.method({
  4110. selector: 'resetContents',
  4111. fn: function (){
  4112. var self=this;
  4113. smalltalk.send(self, "_reset", []);
  4114. smalltalk.send(self, "_setStreamSize_", [(0)]);
  4115. return self;}
  4116. }),
  4117. smalltalk.Stream);
  4118. smalltalk.addMethod(
  4119. '_do_',
  4120. smalltalk.method({
  4121. selector: 'do:',
  4122. fn: function (aBlock){
  4123. var self=this;
  4124. smalltalk.send((function(){return smalltalk.send(self, "_atEnd", []);}), "_whileFalse_", [(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})]);
  4125. return self;}
  4126. }),
  4127. smalltalk.Stream);
  4128. smalltalk.addMethod(
  4129. '_setToEnd',
  4130. smalltalk.method({
  4131. selector: 'setToEnd',
  4132. fn: function (){
  4133. var self=this;
  4134. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  4135. return self;}
  4136. }),
  4137. smalltalk.Stream);
  4138. smalltalk.addMethod(
  4139. '_skip_',
  4140. smalltalk.method({
  4141. selector: 'skip:',
  4142. fn: function (anInteger){
  4143. var self=this;
  4144. smalltalk.send(self, "_position_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [anInteger]), "_min_max_", [smalltalk.send(self, "_size", []), (0)])]);
  4145. return self;}
  4146. }),
  4147. smalltalk.Stream);
  4148. smalltalk.addMethod(
  4149. '_next',
  4150. smalltalk.method({
  4151. selector: 'next',
  4152. fn: function (){
  4153. var self=this;
  4154. smalltalk.send(self, "_position_", [smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [(1)])]);
  4155. return smalltalk.send(self['@collection'], "_at_", [smalltalk.send(self, "_position", [])]);
  4156. return self;}
  4157. }),
  4158. smalltalk.Stream);
  4159. smalltalk.addMethod(
  4160. '_next_',
  4161. smalltalk.method({
  4162. selector: 'next:',
  4163. fn: function (anInteger){
  4164. var self=this;
  4165. var tempCollection=nil;
  4166. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []);
  4167. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return smalltalk.send(smalltalk.send(self, "_atEnd", []), "_ifFalse_", [(function(){return smalltalk.send(tempCollection, "_add_", [smalltalk.send(self, "_next", [])]);})]);})]);
  4168. return tempCollection;
  4169. return self;}
  4170. }),
  4171. smalltalk.Stream);
  4172. smalltalk.addMethod(
  4173. '_nextPut_',
  4174. smalltalk.method({
  4175. selector: 'nextPut:',
  4176. fn: function (anObject){
  4177. var self=this;
  4178. smalltalk.send(self, "_position_", [smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [(1)])]);
  4179. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  4180. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  4181. return self;}
  4182. }),
  4183. smalltalk.Stream);
  4184. smalltalk.addMethod(
  4185. '_nextPutAll_',
  4186. smalltalk.method({
  4187. selector: 'nextPutAll:',
  4188. fn: function (aCollection){
  4189. var self=this;
  4190. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  4191. return self;}
  4192. }),
  4193. smalltalk.Stream);
  4194. smalltalk.addMethod(
  4195. '_peek',
  4196. smalltalk.method({
  4197. selector: 'peek',
  4198. fn: function (){
  4199. var self=this;
  4200. return smalltalk.send(smalltalk.send(self, "_atEnd", []), "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_collection", []), "_at_", [smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [(1)])]);})]);
  4201. return self;}
  4202. }),
  4203. smalltalk.Stream);
  4204. smalltalk.addMethod(
  4205. '_atEnd',
  4206. smalltalk.method({
  4207. selector: 'atEnd',
  4208. fn: function (){
  4209. var self=this;
  4210. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  4211. return self;}
  4212. }),
  4213. smalltalk.Stream);
  4214. smalltalk.addMethod(
  4215. '_atStart',
  4216. smalltalk.method({
  4217. selector: 'atStart',
  4218. fn: function (){
  4219. var self=this;
  4220. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  4221. return self;}
  4222. }),
  4223. smalltalk.Stream);
  4224. smalltalk.addMethod(
  4225. '_isEmpty',
  4226. smalltalk.method({
  4227. selector: 'isEmpty',
  4228. fn: function (){
  4229. var self=this;
  4230. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  4231. return self;}
  4232. }),
  4233. smalltalk.Stream);
  4234. smalltalk.addMethod(
  4235. '_on_',
  4236. smalltalk.method({
  4237. selector: 'on:',
  4238. fn: function (aCollection){
  4239. var self=this;
  4240. return (function($rec){smalltalk.send($rec, "_setCollection_", [aCollection]);smalltalk.send($rec, "_setStreamSize_", [smalltalk.send(aCollection, "_size", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  4241. return self;}
  4242. }),
  4243. smalltalk.Stream.klass);
  4244. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel');
  4245. smalltalk.addMethod(
  4246. '_next_',
  4247. smalltalk.method({
  4248. selector: 'next:',
  4249. fn: function (anInteger){
  4250. var self=this;
  4251. var tempCollection=nil;
  4252. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []);
  4253. smalltalk.send(anInteger, "_timesRepeat_", [(function(){return smalltalk.send(smalltalk.send(self, "_atEnd", []), "_ifFalse_", [(function(){return tempCollection=smalltalk.send(tempCollection, "__comma", [smalltalk.send(self, "_next", [])]);})]);})]);
  4254. return tempCollection;
  4255. return self;}
  4256. }),
  4257. smalltalk.StringStream);
  4258. smalltalk.addMethod(
  4259. '_nextPut_',
  4260. smalltalk.method({
  4261. selector: 'nextPut:',
  4262. fn: function (aString){
  4263. var self=this;
  4264. smalltalk.send(self, "_nextPutAll_", [aString]);
  4265. return self;}
  4266. }),
  4267. smalltalk.StringStream);
  4268. smalltalk.addMethod(
  4269. '_nextPutAll_',
  4270. smalltalk.method({
  4271. selector: 'nextPutAll:',
  4272. fn: function (aString){
  4273. var self=this;
  4274. smalltalk.send(self, "_setCollection_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_position", [])]), "__comma", [aString]), "__comma", [smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [(1)]), "__plus", [smalltalk.send(aString, "_size", [])]), smalltalk.send(smalltalk.send(self, "_collection", []), "_size", [])])])]);
  4275. smalltalk.send(self, "_position_", [smalltalk.send(smalltalk.send(self, "_position", []), "__plus", [smalltalk.send(aString, "_size", [])])]);
  4276. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  4277. return self;}
  4278. }),
  4279. smalltalk.StringStream);
  4280. smalltalk.addMethod(
  4281. '_cr',
  4282. smalltalk.method({
  4283. selector: 'cr',
  4284. fn: function (){
  4285. var self=this;
  4286. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_cr", [])]);
  4287. return self;}
  4288. }),
  4289. smalltalk.StringStream);
  4290. smalltalk.addMethod(
  4291. '_crlf',
  4292. smalltalk.method({
  4293. selector: 'crlf',
  4294. fn: function (){
  4295. var self=this;
  4296. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_crlf", [])]);
  4297. return self;}
  4298. }),
  4299. smalltalk.StringStream);
  4300. smalltalk.addMethod(
  4301. '_lf',
  4302. smalltalk.method({
  4303. selector: 'lf',
  4304. fn: function (){
  4305. var self=this;
  4306. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_lf", [])]);
  4307. return self;}
  4308. }),
  4309. smalltalk.StringStream);
  4310. smalltalk.addMethod(
  4311. '_space',
  4312. smalltalk.method({
  4313. selector: 'space',
  4314. fn: function (){
  4315. var self=this;
  4316. smalltalk.send(self, "_nextPut_", [" "]);
  4317. return self;}
  4318. }),
  4319. smalltalk.StringStream);
  4320. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel');
  4321. smalltalk.addMethod(
  4322. '_class_',
  4323. smalltalk.method({
  4324. selector: 'class:',
  4325. fn: function (aClass){
  4326. var self=this;
  4327. self['@class']=aClass;
  4328. return self;}
  4329. }),
  4330. smalltalk.ClassCommentReader);
  4331. smalltalk.addMethod(
  4332. '_scanFrom_',
  4333. smalltalk.method({
  4334. selector: 'scanFrom:',
  4335. fn: function (aStream){
  4336. var self=this;
  4337. var nextChunk=nil;
  4338. nextChunk=smalltalk.send(smalltalk.send(smalltalk.send(self['@chunkParser'], "_emptyChunk", []), "__slash", [smalltalk.send(self['@chunkParser'], "_chunk", [])]), "_parse_", [aStream]);
  4339. smalltalk.send(smalltalk.send(nextChunk, "_isEmptyChunk", []), "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [smalltalk.send(nextChunk, "_contents", [])]);})]);
  4340. return self;}
  4341. }),
  4342. smalltalk.ClassCommentReader);
  4343. smalltalk.addMethod(
  4344. '_initialize',
  4345. smalltalk.method({
  4346. selector: 'initialize',
  4347. fn: function (){
  4348. var self=this;
  4349. smalltalk.send(self, "_initialize", [], smalltalk.Object);
  4350. self['@chunkParser']=smalltalk.send(smalltalk.ChunkParser, "_new", []);
  4351. return self;}
  4352. }),
  4353. smalltalk.ClassCommentReader);
  4354. smalltalk.addMethod(
  4355. '_setComment_',
  4356. smalltalk.method({
  4357. selector: 'setComment:',
  4358. fn: function (aString){
  4359. var self=this;
  4360. smalltalk.send(self['@class'], "_comment_", [aString]);
  4361. return self;}
  4362. }),
  4363. smalltalk.ClassCommentReader);
  4364. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel');
  4365. smalltalk.addMethod(
  4366. '_next',
  4367. smalltalk.method({
  4368. selector: 'next',
  4369. fn: function (){
  4370. var self=this;
  4371. return Math.random();
  4372. return self;}
  4373. }),
  4374. smalltalk.Random);
  4375. smalltalk.addMethod(
  4376. '_next_',
  4377. smalltalk.method({
  4378. selector: 'next:',
  4379. fn: function (anInteger){
  4380. var self=this;
  4381. return smalltalk.send((1), "_to_collect_", [anInteger, (function(each){return smalltalk.send(self, "_next", []);})]);
  4382. return self;}
  4383. }),
  4384. smalltalk.Random);
  4385. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel');
  4386. smalltalk.addMethod(
  4387. '_x',
  4388. smalltalk.method({
  4389. selector: 'x',
  4390. fn: function (){
  4391. var self=this;
  4392. return self['@x'];
  4393. return self;}
  4394. }),
  4395. smalltalk.Point);
  4396. smalltalk.addMethod(
  4397. '_y',
  4398. smalltalk.method({
  4399. selector: 'y',
  4400. fn: function (){
  4401. var self=this;
  4402. return self['@y'];
  4403. return self;}
  4404. }),
  4405. smalltalk.Point);
  4406. smalltalk.addMethod(
  4407. '_y_',
  4408. smalltalk.method({
  4409. selector: 'y:',
  4410. fn: function (aNumber){
  4411. var self=this;
  4412. self['@y']=aNumber;
  4413. return self;}
  4414. }),
  4415. smalltalk.Point);
  4416. smalltalk.addMethod(
  4417. '_x_',
  4418. smalltalk.method({
  4419. selector: 'x:',
  4420. fn: function (aNumber){
  4421. var self=this;
  4422. self['@x']=aNumber;
  4423. return self;}
  4424. }),
  4425. smalltalk.Point);
  4426. smalltalk.addMethod(
  4427. '__star',
  4428. smalltalk.method({
  4429. selector: '*',
  4430. fn: function (aPoint){
  4431. var self=this;
  4432. return smalltalk.send(smalltalk.Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__star", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4433. return self;}
  4434. }),
  4435. smalltalk.Point);
  4436. smalltalk.addMethod(
  4437. '__plus',
  4438. smalltalk.method({
  4439. selector: '+',
  4440. fn: function (aPoint){
  4441. var self=this;
  4442. return smalltalk.send(smalltalk.Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__plus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4443. return self;}
  4444. }),
  4445. smalltalk.Point);
  4446. smalltalk.addMethod(
  4447. '__minus',
  4448. smalltalk.method({
  4449. selector: '-',
  4450. fn: function (aPoint){
  4451. var self=this;
  4452. return smalltalk.send(smalltalk.Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__minus", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4453. return self;}
  4454. }),
  4455. smalltalk.Point);
  4456. smalltalk.addMethod(
  4457. '__slash',
  4458. smalltalk.method({
  4459. selector: '/',
  4460. fn: function (aPoint){
  4461. var self=this;
  4462. return smalltalk.send(smalltalk.Point, "_x_y_", [smalltalk.send(smalltalk.send(self, "_x", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_x", [])]), smalltalk.send(smalltalk.send(self, "_y", []), "__slash", [smalltalk.send(smalltalk.send(aPoint, "_asPoint", []), "_y", [])])]);
  4463. return self;}
  4464. }),
  4465. smalltalk.Point);
  4466. smalltalk.addMethod(
  4467. '_asPoint',
  4468. smalltalk.method({
  4469. selector: 'asPoint',
  4470. fn: function (){
  4471. var self=this;
  4472. return self;
  4473. return self;}
  4474. }),
  4475. smalltalk.Point);
  4476. smalltalk.addMethod(
  4477. '_x_y_',
  4478. smalltalk.method({
  4479. selector: 'x:y:',
  4480. fn: function (aNumber, anotherNumber){
  4481. var self=this;
  4482. return (function($rec){smalltalk.send($rec, "_x_", [aNumber]);smalltalk.send($rec, "_y_", [anotherNumber]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  4483. return self;}
  4484. }),
  4485. smalltalk.Point.klass);
  4486. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel');
  4487. smalltalk.addMethod(
  4488. '_selector',
  4489. smalltalk.method({
  4490. selector: 'selector',
  4491. fn: function (){
  4492. var self=this;
  4493. return self['@selector'];
  4494. return self;}
  4495. }),
  4496. smalltalk.Message);
  4497. smalltalk.addMethod(
  4498. '_selector_',
  4499. smalltalk.method({
  4500. selector: 'selector:',
  4501. fn: function (aString){
  4502. var self=this;
  4503. self['@selector']=aString;
  4504. return self;}
  4505. }),
  4506. smalltalk.Message);
  4507. smalltalk.addMethod(
  4508. '_arguments_',
  4509. smalltalk.method({
  4510. selector: 'arguments:',
  4511. fn: function (anArray){
  4512. var self=this;
  4513. self['@arguments']=anArray;
  4514. return self;}
  4515. }),
  4516. smalltalk.Message);
  4517. smalltalk.addMethod(
  4518. '_arguments',
  4519. smalltalk.method({
  4520. selector: 'arguments',
  4521. fn: function (){
  4522. var self=this;
  4523. return self['@arguments'];
  4524. return self;}
  4525. }),
  4526. smalltalk.Message);
  4527. smalltalk.addMethod(
  4528. '_selector_arguments_',
  4529. smalltalk.method({
  4530. selector: 'selector:arguments:',
  4531. fn: function (aString, anArray){
  4532. var self=this;
  4533. return (function($rec){smalltalk.send($rec, "_selector_", [aString]);smalltalk.send($rec, "_arguments_", [anArray]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  4534. return self;}
  4535. }),
  4536. smalltalk.Message.klass);
  4537. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel');
  4538. smalltalk.addMethod(
  4539. '_message',
  4540. smalltalk.method({
  4541. selector: 'message',
  4542. fn: function (){
  4543. var self=this;
  4544. return self['@message'];
  4545. return self;}
  4546. }),
  4547. smalltalk.MessageNotUnderstood);
  4548. smalltalk.addMethod(
  4549. '_message_',
  4550. smalltalk.method({
  4551. selector: 'message:',
  4552. fn: function (aMessage){
  4553. var self=this;
  4554. self['@message']=aMessage;
  4555. return self;}
  4556. }),
  4557. smalltalk.MessageNotUnderstood);
  4558. smalltalk.addMethod(
  4559. '_receiver',
  4560. smalltalk.method({
  4561. selector: 'receiver',
  4562. fn: function (){
  4563. var self=this;
  4564. return self['@receiver'];
  4565. return self;}
  4566. }),
  4567. smalltalk.MessageNotUnderstood);
  4568. smalltalk.addMethod(
  4569. '_receiver_',
  4570. smalltalk.method({
  4571. selector: 'receiver:',
  4572. fn: function (anObject){
  4573. var self=this;
  4574. self['@receiver']=anObject;
  4575. return self;}
  4576. }),
  4577. smalltalk.MessageNotUnderstood);
  4578. smalltalk.addMethod(
  4579. '_messageText',
  4580. smalltalk.method({
  4581. selector: 'messageText',
  4582. fn: function (){
  4583. var self=this;
  4584. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_asString", []), "__comma", [unescape("%20does%20not%20understand%20%23")]), "__comma", [smalltalk.send(smalltalk.send(self, "_message", []), "_selector", [])]);
  4585. return self;}
  4586. }),
  4587. smalltalk.MessageNotUnderstood);
  4588. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel');
  4589. smalltalk.addMethod(
  4590. '_handleError_',
  4591. smalltalk.method({
  4592. selector: 'handleError:',
  4593. fn: function (anError){
  4594. var self=this;
  4595. smalltalk.send(smalltalk.send(anError, "_context", []), "_ifNotNil_", [(function(){return smalltalk.send(self, "_logErrorContext_", [smalltalk.send(anError, "_context", [])]);})]);
  4596. smalltalk.send(self, "_logError_", [anError]);
  4597. return self;}
  4598. }),
  4599. smalltalk.ErrorHandler);
  4600. smalltalk.addMethod(
  4601. '_logContext_',
  4602. smalltalk.method({
  4603. selector: 'logContext:',
  4604. fn: function (aContext){
  4605. var self=this;
  4606. smalltalk.send(smalltalk.send(aContext, "_home", []), "_ifNotNil_", [(function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})]);
  4607. smalltalk.send(self, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext, "_receiver", []), "_asString", []), "__comma", [unescape("%3E%3E")]), "__comma", [smalltalk.send(aContext, "_selector", [])])]);
  4608. return self;}
  4609. }),
  4610. smalltalk.ErrorHandler);
  4611. smalltalk.addMethod(
  4612. '_logErrorContext_',
  4613. smalltalk.method({
  4614. selector: 'logErrorContext:',
  4615. fn: function (aContext){
  4616. var self=this;
  4617. smalltalk.send(aContext, "_ifNotNil_", [(function(){return smalltalk.send(smalltalk.send(aContext, "_home", []), "_ifNotNil_", [(function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})]);})]);
  4618. return self;}
  4619. }),
  4620. smalltalk.ErrorHandler);
  4621. smalltalk.addMethod(
  4622. '_logError_',
  4623. smalltalk.method({
  4624. selector: 'logError:',
  4625. fn: function (anError){
  4626. var self=this;
  4627. smalltalk.send(self, "_log_", [smalltalk.send(anError, "_messageText", [])]);
  4628. return self;}
  4629. }),
  4630. smalltalk.ErrorHandler);
  4631. smalltalk.addMethod(
  4632. '_log_',
  4633. smalltalk.method({
  4634. selector: 'log:',
  4635. fn: function (aString){
  4636. var self=this;
  4637. smalltalk.send(console, "_log_", [aString]);
  4638. return self;}
  4639. }),
  4640. smalltalk.ErrorHandler);
  4641. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  4642. smalltalk.addMethod(
  4643. '_current',
  4644. smalltalk.method({
  4645. selector: 'current',
  4646. fn: function (){
  4647. var self=this;
  4648. return self['@current'];
  4649. return self;}
  4650. }),
  4651. smalltalk.ErrorHandler.klass);
  4652. smalltalk.addMethod(
  4653. '_initialize',
  4654. smalltalk.method({
  4655. selector: 'initialize',
  4656. fn: function (){
  4657. var self=this;
  4658. smalltalk.send(self, "_register", []);
  4659. return self;}
  4660. }),
  4661. smalltalk.ErrorHandler.klass);
  4662. smalltalk.addMethod(
  4663. '_register',
  4664. smalltalk.method({
  4665. selector: 'register',
  4666. fn: function (){
  4667. var self=this;
  4668. smalltalk.send(smalltalk.ErrorHandler, "_setCurrent_", [smalltalk.send(self, "_new", [])]);
  4669. return self;}
  4670. }),
  4671. smalltalk.ErrorHandler.klass);
  4672. smalltalk.addMethod(
  4673. '_setCurrent_',
  4674. smalltalk.method({
  4675. selector: 'setCurrent:',
  4676. fn: function (anHandler){
  4677. var self=this;
  4678. self['@current']=anHandler;
  4679. return self;}
  4680. }),
  4681. smalltalk.ErrorHandler.klass);