1
0

Kernel-Objects.js 127 KB

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