Kernel.deploy.js 133 KB

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