2
0

Kernel-Objects.js 156 KB

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