Kernel-Objects.js 127 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672
  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 count;
  2624. count=(1);
  2625. smalltalk.send((function(){
  2626. return smalltalk.send(count,"__gt",[self]);
  2627. }),"_whileFalse_",[(function(){
  2628. smalltalk.send(aBlock,"_value",[]);
  2629. count=smalltalk.send(count,"__plus",[(1)]);
  2630. return count;
  2631. })]);
  2632. return self},
  2633. args: ["aBlock"],
  2634. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[count > self] whileFalse: [\x0a\x09 aBlock value.\x0a\x09 count := count + 1]",
  2635. messageSends: ["whileFalse:", "value", "+", ">"],
  2636. referencedClasses: []
  2637. }),
  2638. smalltalk.Number);
  2639. smalltalk.addMethod(
  2640. "_to_",
  2641. smalltalk.method({
  2642. selector: "to:",
  2643. category: 'converting',
  2644. fn: function (aNumber) {
  2645. var self = this;
  2646. var array;
  2647. var first;
  2648. var last;
  2649. var count;
  2650. first = smalltalk.send(self, "_truncated", []);
  2651. last = smalltalk.send(smalltalk.send(aNumber, "_truncated", []), "__plus", [1]);
  2652. count = 1;
  2653. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  2654. 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;}]);
  2655. return array;
  2656. },
  2657. args: ["aNumber"],
  2658. 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",
  2659. messageSends: ["truncated", "+", "new", "timesRepeat:", "at:put:", "-"],
  2660. referencedClasses: ["Array"]
  2661. }),
  2662. smalltalk.Number);
  2663. smalltalk.addMethod(
  2664. "_to_by_",
  2665. smalltalk.method({
  2666. selector: "to:by:",
  2667. category: 'converting',
  2668. fn: function (stop, step) {
  2669. var self = this;
  2670. var $1, $2;
  2671. var array;
  2672. var value;
  2673. var pos;
  2674. value = self;
  2675. array = smalltalk.send(smalltalk.Array || Array, "_new", []);
  2676. pos = 1;
  2677. $1 = smalltalk.send(step, "__eq", [0]);
  2678. if (smalltalk.assert($1)) {
  2679. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  2680. }
  2681. $2 = smalltalk.send(step, "__lt", [0]);
  2682. if (smalltalk.assert($2)) {
  2683. 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;}]);
  2684. } else {
  2685. 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;}]);
  2686. }
  2687. return array;
  2688. },
  2689. args: ["stop", "step"],
  2690. 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",
  2691. messageSends: ["new", "ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "at:put:", "+", ">=", "<=", "<"],
  2692. referencedClasses: ["Array"]
  2693. }),
  2694. smalltalk.Number);
  2695. smalltalk.addMethod(
  2696. "_to_by_do_",
  2697. smalltalk.method({
  2698. selector: "to:by:do:",
  2699. category: 'enumerating',
  2700. fn: function (stop, step, aBlock) {
  2701. var self = this;
  2702. var $1, $2;
  2703. var value;
  2704. value = self;
  2705. $1 = smalltalk.send(step, "__eq", [0]);
  2706. if (smalltalk.assert($1)) {
  2707. smalltalk.send(self, "_error_", ["step must be non-zero"]);
  2708. }
  2709. $2 = smalltalk.send(step, "__lt", [0]);
  2710. if (smalltalk.assert($2)) {
  2711. 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;}]);
  2712. } else {
  2713. 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;}]);
  2714. }
  2715. return self;
  2716. },
  2717. args: ["stop", "step", "aBlock"],
  2718. 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]]",
  2719. messageSends: ["ifTrue:", "error:", "=", "ifTrue:ifFalse:", "whileTrue:", "value:", "+", ">=", "<=", "<"],
  2720. referencedClasses: []
  2721. }),
  2722. smalltalk.Number);
  2723. smalltalk.addMethod(
  2724. "_to_do_",
  2725. smalltalk.method({
  2726. selector: "to:do:",
  2727. category: 'enumerating',
  2728. fn: function (stop, aBlock) {
  2729. var self = this;
  2730. var nextValue;
  2731. nextValue = self;
  2732. 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;}]);
  2733. return self;
  2734. },
  2735. args: ["stop", "aBlock"],
  2736. 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]",
  2737. messageSends: ["whileTrue:", "value:", "+", "<="],
  2738. referencedClasses: []
  2739. }),
  2740. smalltalk.Number);
  2741. smalltalk.addMethod(
  2742. "_truncated",
  2743. smalltalk.method({
  2744. selector: "truncated",
  2745. category: 'converting',
  2746. fn: function () {
  2747. var self = this;
  2748. var $1;
  2749. var result;
  2750. $1 = smalltalk.send(self, "__gt_eq", [0]);
  2751. if (smalltalk.assert($1)) {
  2752. result = Math.floor(self);
  2753. } else {
  2754. result = Math.floor(self * -1) * -1;
  2755. }
  2756. return result;
  2757. },
  2758. args: [],
  2759. 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",
  2760. messageSends: ["ifTrue:ifFalse:", ">="],
  2761. referencedClasses: []
  2762. }),
  2763. smalltalk.Number);
  2764. smalltalk.addMethod(
  2765. "_|",
  2766. smalltalk.method({
  2767. selector: "|",
  2768. category: 'converting',
  2769. fn: function (aNumber) {
  2770. var self = this;
  2771. return self | aNumber;
  2772. return self;
  2773. },
  2774. args: ["aNumber"],
  2775. source: "| aNumber\x0a\x09<return self | aNumber>",
  2776. messageSends: [],
  2777. referencedClasses: []
  2778. }),
  2779. smalltalk.Number);
  2780. smalltalk.addMethod(
  2781. "_pi",
  2782. smalltalk.method({
  2783. selector: "pi",
  2784. category: 'instance creation',
  2785. fn: function () {
  2786. var self = this;
  2787. return Math.PI;
  2788. return self;
  2789. },
  2790. args: [],
  2791. source: "pi\x0a\x09<return Math.PI>",
  2792. messageSends: [],
  2793. referencedClasses: []
  2794. }),
  2795. smalltalk.Number.klass);
  2796. smalltalk.addClass('Organizer', smalltalk.Object, [], 'Kernel-Objects');
  2797. smalltalk.addMethod(
  2798. "_addElement_",
  2799. smalltalk.method({
  2800. selector: "addElement:",
  2801. category: 'accessing',
  2802. fn: function (anObject) {
  2803. var self = this;
  2804. self.addElement(anObject);
  2805. return self;
  2806. },
  2807. args: ["anObject"],
  2808. source: "addElement: anObject\x0a\x09<self.addElement(anObject)>",
  2809. messageSends: [],
  2810. referencedClasses: []
  2811. }),
  2812. smalltalk.Organizer);
  2813. smalltalk.addMethod(
  2814. "_elements",
  2815. smalltalk.method({
  2816. selector: "elements",
  2817. category: 'accessing',
  2818. fn: function () {
  2819. var self = this;
  2820. var $1;
  2821. $1 = smalltalk.send(smalltalk.send(self, "_basicAt_", ["elements"]), "_copy", []);
  2822. return $1;
  2823. },
  2824. args: [],
  2825. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  2826. messageSends: ["copy", "basicAt:"],
  2827. referencedClasses: []
  2828. }),
  2829. smalltalk.Organizer);
  2830. smalltalk.addMethod(
  2831. "_removeElement_",
  2832. smalltalk.method({
  2833. selector: "removeElement:",
  2834. category: 'accessing',
  2835. fn: function (anObject) {
  2836. var self = this;
  2837. self.removeElement(anObject);
  2838. return self;
  2839. },
  2840. args: ["anObject"],
  2841. source: "removeElement: anObject\x0a\x09<self.removeElement(anObject)>",
  2842. messageSends: [],
  2843. referencedClasses: []
  2844. }),
  2845. smalltalk.Organizer);
  2846. smalltalk.addClass('Package', smalltalk.Object, ['commitPathJs', 'commitPathSt'], 'Kernel-Objects');
  2847. 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'"
  2848. smalltalk.addMethod(
  2849. "_classes",
  2850. smalltalk.method({
  2851. selector: "classes",
  2852. category: 'classes',
  2853. fn: function () {
  2854. var self = this;
  2855. var $1;
  2856. $1 = smalltalk.send(smalltalk.send(self, "_organization", []), "_elements", []);
  2857. return $1;
  2858. },
  2859. args: [],
  2860. source: "classes\x0a\x09^ self organization elements",
  2861. messageSends: ["elements", "organization"],
  2862. referencedClasses: []
  2863. }),
  2864. smalltalk.Package);
  2865. smalltalk.addMethod(
  2866. "_commitPathJs",
  2867. smalltalk.method({
  2868. selector: "commitPathJs",
  2869. category: 'accessing',
  2870. fn: function () {
  2871. var self = this;
  2872. var $1;
  2873. if (($receiver = self['@commitPathJs']) == nil ||
  2874. $receiver == undefined) {
  2875. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathJs", []);
  2876. } else {
  2877. $1 = self['@commitPathJs'];
  2878. }
  2879. return $1;
  2880. },
  2881. args: [],
  2882. source: "commitPathJs\x0a\x09^ commitPathJs ifNil: [self class defaultCommitPathJs]",
  2883. messageSends: ["ifNil:", "defaultCommitPathJs", "class"],
  2884. referencedClasses: []
  2885. }),
  2886. smalltalk.Package);
  2887. smalltalk.addMethod(
  2888. "_commitPathJs_",
  2889. smalltalk.method({
  2890. selector: "commitPathJs:",
  2891. category: 'accessing',
  2892. fn: function (aString) {
  2893. var self = this;
  2894. self['@commitPathJs'] = aString;
  2895. return self;
  2896. },
  2897. args: ["aString"],
  2898. source: "commitPathJs: aString\x0a\x09commitPathJs := aString",
  2899. messageSends: [],
  2900. referencedClasses: []
  2901. }),
  2902. smalltalk.Package);
  2903. smalltalk.addMethod(
  2904. "_commitPathSt",
  2905. smalltalk.method({
  2906. selector: "commitPathSt",
  2907. category: 'accessing',
  2908. fn: function () {
  2909. var self = this;
  2910. var $1;
  2911. if (($receiver = self['@commitPathSt']) == nil ||
  2912. $receiver == undefined) {
  2913. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_defaultCommitPathSt", []);
  2914. } else {
  2915. $1 = self['@commitPathSt'];
  2916. }
  2917. return $1;
  2918. },
  2919. args: [],
  2920. source: "commitPathSt\x0a\x09^ commitPathSt ifNil: [self class defaultCommitPathSt]",
  2921. messageSends: ["ifNil:", "defaultCommitPathSt", "class"],
  2922. referencedClasses: []
  2923. }),
  2924. smalltalk.Package);
  2925. smalltalk.addMethod(
  2926. "_commitPathSt_",
  2927. smalltalk.method({
  2928. selector: "commitPathSt:",
  2929. category: 'accessing',
  2930. fn: function (aString) {
  2931. var self = this;
  2932. self['@commitPathSt'] = aString;
  2933. return self;
  2934. },
  2935. args: ["aString"],
  2936. source: "commitPathSt: aString\x0a\x09commitPathSt := aString",
  2937. messageSends: [],
  2938. referencedClasses: []
  2939. }),
  2940. smalltalk.Package);
  2941. smalltalk.addMethod(
  2942. "_dependencies",
  2943. smalltalk.method({
  2944. selector: "dependencies",
  2945. category: 'accessing',
  2946. fn: function () {
  2947. var self = this;
  2948. var $1;
  2949. $1 = smalltalk.send(self, "_propertyAt_ifAbsent_", ["dependencies", function () {return [];}]);
  2950. return $1;
  2951. },
  2952. args: [],
  2953. source: "dependencies\x0a\x09^self propertyAt: 'dependencies' ifAbsent: [#()]",
  2954. messageSends: ["propertyAt:ifAbsent:"],
  2955. referencedClasses: []
  2956. }),
  2957. smalltalk.Package);
  2958. smalltalk.addMethod(
  2959. "_dependencies_",
  2960. smalltalk.method({
  2961. selector: "dependencies:",
  2962. category: 'accessing',
  2963. fn: function (anArray) {
  2964. var self = this;
  2965. var $1;
  2966. $1 = smalltalk.send(self, "_propertyAt_put_", ["dependencies", anArray]);
  2967. return $1;
  2968. },
  2969. args: ["anArray"],
  2970. source: "dependencies: anArray\x0a\x09^self propertyAt: 'dependencies' put: anArray",
  2971. messageSends: ["propertyAt:put:"],
  2972. referencedClasses: []
  2973. }),
  2974. smalltalk.Package);
  2975. smalltalk.addMethod(
  2976. "_jsProperties",
  2977. smalltalk.method({
  2978. selector: "jsProperties",
  2979. category: 'private',
  2980. fn: function () {
  2981. var self = this;
  2982. return self.properties;
  2983. return self;
  2984. },
  2985. args: [],
  2986. source: "jsProperties\x0a\x09<return self.properties>",
  2987. messageSends: [],
  2988. referencedClasses: []
  2989. }),
  2990. smalltalk.Package);
  2991. smalltalk.addMethod(
  2992. "_jsProperties_",
  2993. smalltalk.method({
  2994. selector: "jsProperties:",
  2995. category: 'private',
  2996. fn: function (aJSObject) {
  2997. var self = this;
  2998. return self.properties = aJSObject;
  2999. return self;
  3000. },
  3001. args: ["aJSObject"],
  3002. source: "jsProperties: aJSObject\x0a\x09<return self.properties = aJSObject>",
  3003. messageSends: [],
  3004. referencedClasses: []
  3005. }),
  3006. smalltalk.Package);
  3007. smalltalk.addMethod(
  3008. "_name",
  3009. smalltalk.method({
  3010. selector: "name",
  3011. category: 'accessing',
  3012. fn: function () {
  3013. var self = this;
  3014. return self.pkgName;
  3015. return self;
  3016. },
  3017. args: [],
  3018. source: "name\x0a\x09<return self.pkgName>",
  3019. messageSends: [],
  3020. referencedClasses: []
  3021. }),
  3022. smalltalk.Package);
  3023. smalltalk.addMethod(
  3024. "_name_",
  3025. smalltalk.method({
  3026. selector: "name:",
  3027. category: 'accessing',
  3028. fn: function (aString) {
  3029. var self = this;
  3030. self.pkgName = aString;
  3031. return self;
  3032. },
  3033. args: ["aString"],
  3034. source: "name: aString\x0a\x09<self.pkgName = aString>",
  3035. messageSends: [],
  3036. referencedClasses: []
  3037. }),
  3038. smalltalk.Package);
  3039. smalltalk.addMethod(
  3040. "_organization",
  3041. smalltalk.method({
  3042. selector: "organization",
  3043. category: 'accessing',
  3044. fn: function () {
  3045. var self = this;
  3046. var $1;
  3047. $1 = smalltalk.send(self, "_basicAt_", ["organization"]);
  3048. return $1;
  3049. },
  3050. args: [],
  3051. source: "organization\x0a\x09^ self basicAt: 'organization'",
  3052. messageSends: ["basicAt:"],
  3053. referencedClasses: []
  3054. }),
  3055. smalltalk.Package);
  3056. smalltalk.addMethod(
  3057. "_printString",
  3058. smalltalk.method({
  3059. selector: "printString",
  3060. category: 'printing',
  3061. fn: function () {
  3062. var self = this;
  3063. var $1;
  3064. $1 = smalltalk.send(self, "_name", []);
  3065. return $1;
  3066. },
  3067. args: [],
  3068. source: "printString\x0a\x09^self name",
  3069. messageSends: ["name"],
  3070. referencedClasses: []
  3071. }),
  3072. smalltalk.Package);
  3073. smalltalk.addMethod(
  3074. "_properties",
  3075. smalltalk.method({
  3076. selector: "properties",
  3077. category: 'accessing',
  3078. fn: function () {
  3079. var self = this;
  3080. var $1;
  3081. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_readJSObject_", [smalltalk.send(self, "_basicAt_", ["properties"])]);
  3082. return $1;
  3083. },
  3084. args: [],
  3085. source: "properties\x0a\x09^Smalltalk current readJSObject: (self basicAt: 'properties')",
  3086. messageSends: ["readJSObject:", "basicAt:", "current"],
  3087. referencedClasses: ["Smalltalk"]
  3088. }),
  3089. smalltalk.Package);
  3090. smalltalk.addMethod(
  3091. "_properties_",
  3092. smalltalk.method({
  3093. selector: "properties:",
  3094. category: 'accessing',
  3095. fn: function (aDict) {
  3096. var self = this;
  3097. var object;
  3098. object = {};
  3099. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  3100. return self.properties = object;
  3101. return self;
  3102. },
  3103. args: ["aDict"],
  3104. 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>",
  3105. messageSends: ["keysAndValuesDo:"],
  3106. referencedClasses: []
  3107. }),
  3108. smalltalk.Package);
  3109. smalltalk.addMethod(
  3110. "_propertiesAsJSON",
  3111. smalltalk.method({
  3112. selector: "propertiesAsJSON",
  3113. category: 'private',
  3114. fn: function () {
  3115. var self = this;
  3116. return JSON.stringify(self.properties);
  3117. return self;
  3118. },
  3119. args: [],
  3120. source: "propertiesAsJSON\x0a\x09<return JSON.stringify(self.properties)>",
  3121. messageSends: [],
  3122. referencedClasses: []
  3123. }),
  3124. smalltalk.Package);
  3125. smalltalk.addMethod(
  3126. "_propertyAt_",
  3127. smalltalk.method({
  3128. selector: "propertyAt:",
  3129. category: 'properties',
  3130. fn: function (key) {
  3131. var self = this;
  3132. return self.properties[key];
  3133. return self;
  3134. },
  3135. args: ["key"],
  3136. source: "propertyAt: key\x0a\x0a\x09<return self.properties[key]>",
  3137. messageSends: [],
  3138. referencedClasses: []
  3139. }),
  3140. smalltalk.Package);
  3141. smalltalk.addMethod(
  3142. "_propertyAt_ifAbsent_",
  3143. smalltalk.method({
  3144. selector: "propertyAt:ifAbsent:",
  3145. category: 'properties',
  3146. fn: function (key, block) {
  3147. var self = this;
  3148. var $2, $1;
  3149. $2 = smalltalk.send(self, "_propertyAt_", [key]);
  3150. if (($receiver = $2) == nil || $receiver == undefined) {
  3151. $1 = smalltalk.send(block, "_value", []);
  3152. } else {
  3153. $1 = $2;
  3154. }
  3155. return $1;
  3156. },
  3157. args: ["key", "block"],
  3158. source: "propertyAt: key ifAbsent: block\x0a\x0a\x09^(self propertyAt: key) ifNil: [block value]",
  3159. messageSends: ["ifNil:", "value", "propertyAt:"],
  3160. referencedClasses: []
  3161. }),
  3162. smalltalk.Package);
  3163. smalltalk.addMethod(
  3164. "_propertyAt_put_",
  3165. smalltalk.method({
  3166. selector: "propertyAt:put:",
  3167. category: 'properties',
  3168. fn: function (key, value) {
  3169. var self = this;
  3170. return self.properties[key] = value;
  3171. return self;
  3172. },
  3173. args: ["key", "value"],
  3174. source: "propertyAt: key put: value\x0a\x0a\x09<return self.properties[key] = value>",
  3175. messageSends: [],
  3176. referencedClasses: []
  3177. }),
  3178. smalltalk.Package);
  3179. smalltalk.addMethod(
  3180. "_sortedClasses",
  3181. smalltalk.method({
  3182. selector: "sortedClasses",
  3183. category: 'classes',
  3184. fn: function () {
  3185. var self = this;
  3186. var $1;
  3187. $1 = smalltalk.send(smalltalk.send(self, "_class", []), "_sortedClasses_", [smalltalk.send(self, "_classes", [])]);
  3188. return $1;
  3189. },
  3190. args: [],
  3191. 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",
  3192. messageSends: ["sortedClasses:", "classes", "class"],
  3193. referencedClasses: []
  3194. }),
  3195. smalltalk.Package);
  3196. smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  3197. smalltalk.addMethod(
  3198. "_commitPathsFromLoader",
  3199. smalltalk.method({
  3200. selector: "commitPathsFromLoader",
  3201. category: 'commit paths',
  3202. fn: function (){
  3203. var self=this;
  3204. var $1,$2;
  3205. var js;
  3206. var st;
  3207. var cp = smalltalk['@@commitPath'];
  3208. if (cp) { js = cp.js; st = cp.st; };
  3209. ;
  3210. $1=js;
  3211. if(($receiver = $1) == nil || $receiver == undefined){
  3212. $1;
  3213. } else {
  3214. smalltalk.send(self,"_defaultCommitPathJs_",[js]);
  3215. };
  3216. $2=st;
  3217. if(($receiver = $2) == nil || $receiver == undefined){
  3218. $2;
  3219. } else {
  3220. smalltalk.send(self,"_defaultCommitPathSt_",[st]);
  3221. };
  3222. return self},
  3223. args: [],
  3224. 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 ].",
  3225. messageSends: ["ifNotNil:", "defaultCommitPathJs:", "defaultCommitPathSt:"],
  3226. referencedClasses: []
  3227. }),
  3228. smalltalk.Package.klass);
  3229. smalltalk.addMethod(
  3230. "_commitToLocalStorage_",
  3231. smalltalk.method({
  3232. selector: "commitToLocalStorage:",
  3233. category: 'loading-storing',
  3234. fn: function (aPackageName) {
  3235. var self = this;
  3236. var key;
  3237. var sourceCode;
  3238. key = smalltalk.send("smalltalk.packages.", "__comma", [aPackageName]);
  3239. sourceCode = smalltalk.send(smalltalk.send(smalltalk.Exporter || Exporter, "_new", []), "_exportPackage_", [aPackageName]);
  3240. localStorage[key] = escape(sourceCode);
  3241. return self;
  3242. },
  3243. args: ["aPackageName"],
  3244. source: "commitToLocalStorage: aPackageName\x0a\x09| key sourceCode |\x0a\x09key := 'smalltalk.packages.' , aPackageName.\x0a\x09sourceCode := Exporter new exportPackage: aPackageName.\x0a\x09<localStorage[key] = escape(sourceCode)>",
  3245. messageSends: [",", "exportPackage:", "new"],
  3246. referencedClasses: ["Exporter"]
  3247. }),
  3248. smalltalk.Package.klass);
  3249. smalltalk.addMethod(
  3250. "_defaultCommitPathJs",
  3251. smalltalk.method({
  3252. selector: "defaultCommitPathJs",
  3253. category: 'commit paths',
  3254. fn: function () {
  3255. var self = this;
  3256. var $1;
  3257. if (($receiver = self['@defaultCommitPathJs']) == nil ||
  3258. $receiver == undefined) {
  3259. self['@defaultCommitPathJs'] = "js";
  3260. $1 = self['@defaultCommitPathJs'];
  3261. } else {
  3262. $1 = self['@defaultCommitPathJs'];
  3263. }
  3264. return $1;
  3265. },
  3266. args: [],
  3267. source: "defaultCommitPathJs\x0a\x09^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']",
  3268. messageSends: ["ifNil:"],
  3269. referencedClasses: []
  3270. }),
  3271. smalltalk.Package.klass);
  3272. smalltalk.addMethod(
  3273. "_defaultCommitPathJs_",
  3274. smalltalk.method({
  3275. selector: "defaultCommitPathJs:",
  3276. category: 'commit paths',
  3277. fn: function (aString) {
  3278. var self = this;
  3279. self['@defaultCommitPathJs'] = aString;
  3280. return self;
  3281. },
  3282. args: ["aString"],
  3283. source: "defaultCommitPathJs: aString\x0a\x09defaultCommitPathJs := aString",
  3284. messageSends: [],
  3285. referencedClasses: []
  3286. }),
  3287. smalltalk.Package.klass);
  3288. smalltalk.addMethod(
  3289. "_defaultCommitPathSt",
  3290. smalltalk.method({
  3291. selector: "defaultCommitPathSt",
  3292. category: 'commit paths',
  3293. fn: function () {
  3294. var self = this;
  3295. var $1;
  3296. if (($receiver = self['@defaultCommitPathSt']) == nil ||
  3297. $receiver == undefined) {
  3298. self['@defaultCommitPathSt'] = "st";
  3299. $1 = self['@defaultCommitPathSt'];
  3300. } else {
  3301. $1 = self['@defaultCommitPathSt'];
  3302. }
  3303. return $1;
  3304. },
  3305. args: [],
  3306. source: "defaultCommitPathSt\x0a\x09^ defaultCommitPathSt ifNil: [ defaultCommitPathSt := 'st']",
  3307. messageSends: ["ifNil:"],
  3308. referencedClasses: []
  3309. }),
  3310. smalltalk.Package.klass);
  3311. smalltalk.addMethod(
  3312. "_defaultCommitPathSt_",
  3313. smalltalk.method({
  3314. selector: "defaultCommitPathSt:",
  3315. category: 'commit paths',
  3316. fn: function (aString) {
  3317. var self = this;
  3318. self['@defaultCommitPathSt'] = aString;
  3319. return self;
  3320. },
  3321. args: ["aString"],
  3322. source: "defaultCommitPathSt: aString\x0a\x09defaultCommitPathSt := aString",
  3323. messageSends: [],
  3324. referencedClasses: []
  3325. }),
  3326. smalltalk.Package.klass);
  3327. smalltalk.addMethod(
  3328. "_fetch_",
  3329. smalltalk.method({
  3330. selector: "fetch:",
  3331. category: 'loading-storing',
  3332. fn: function (aPackageName) {
  3333. var self = this;
  3334. smalltalk.send(self, "_fetch_prefix_", [aPackageName, smalltalk.send(smalltalk.send(self, "_defaultCommitPathJs", []), "__comma", ["/"])]);
  3335. return self;
  3336. },
  3337. args: ["aPackageName"],
  3338. source: "fetch: aPackageName\x0a\x09self fetch: aPackageName prefix: self defaultCommitPathJs, '/'",
  3339. messageSends: ["fetch:prefix:", ",", "defaultCommitPathJs"],
  3340. referencedClasses: []
  3341. }),
  3342. smalltalk.Package.klass);
  3343. smalltalk.addMethod(
  3344. "_fetch_prefix_",
  3345. smalltalk.method({
  3346. selector: "fetch:prefix:",
  3347. category: 'loading-storing',
  3348. fn: function (aPackageName, aPrefix) {
  3349. var self = this;
  3350. smalltalk.send(jQuery, "_getScript_onSuccess_", [smalltalk.send(smalltalk.send(aPrefix, "__comma", [aPackageName]), "__comma", [".js"]), function () {return smalltalk.send(smalltalk.Package || Package, "_init_", [aPackageName]);}]);
  3351. return self;
  3352. },
  3353. args: ["aPackageName", "aPrefix"],
  3354. source: "fetch: aPackageName prefix: aPrefix\x0a\x09jQuery getScript: (aPrefix , aPackageName , '.js') onSuccess: [ Package init: aPackageName ]",
  3355. messageSends: ["getScript:onSuccess:", ",", "init:"],
  3356. referencedClasses: ["Package"]
  3357. }),
  3358. smalltalk.Package.klass);
  3359. smalltalk.addMethod(
  3360. "_init_",
  3361. smalltalk.method({
  3362. selector: "init:",
  3363. category: 'loading-storing',
  3364. fn: function (aPackageName) {
  3365. var self = this;
  3366. var $1, $2;
  3367. $1 = smalltalk.send(smalltalk.send(smalltalk, "_classes", []), "_select_", [function (each) {return each.pkg.pkgName == aPackageName;}]);
  3368. smalltalk.send($1, "_do_", [function (each) {return smalltalk.init(each);}]);
  3369. $2 = smalltalk.send($1, "_do_", [function (each) {return smalltalk.send(each, "_initialize", []);}]);
  3370. return self;
  3371. },
  3372. args: ["aPackageName"],
  3373. 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 ]",
  3374. messageSends: ["do:", "select:", "classes", "initialize"],
  3375. referencedClasses: []
  3376. }),
  3377. smalltalk.Package.klass);
  3378. smalltalk.addMethod(
  3379. "_initialize",
  3380. smalltalk.method({
  3381. selector: "initialize",
  3382. category: 'initialization',
  3383. fn: function (){
  3384. var self=this;
  3385. smalltalk.send(self,"_initialize",[],smalltalk.Object.klass);
  3386. smalltalk.send(self,"_commitPathsFromLoader",[]);
  3387. return self},
  3388. args: [],
  3389. source: "initialize\x0a\x09super initialize.\x0a self commitPathsFromLoader",
  3390. messageSends: ["initialize", "commitPathsFromLoader"],
  3391. referencedClasses: []
  3392. }),
  3393. smalltalk.Package.klass);
  3394. smalltalk.addMethod(
  3395. "_named_",
  3396. smalltalk.method({
  3397. selector: "named:",
  3398. category: 'not yet classified',
  3399. fn: function (aPackageName) {
  3400. var self = this;
  3401. var $1;
  3402. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_", [aPackageName]);
  3403. return $1;
  3404. },
  3405. args: ["aPackageName"],
  3406. source: "named: aPackageName\x0a\x0a\x09^Smalltalk current packageAt: aPackageName",
  3407. messageSends: ["packageAt:", "current"],
  3408. referencedClasses: ["Smalltalk"]
  3409. }),
  3410. smalltalk.Package.klass);
  3411. smalltalk.addMethod(
  3412. "_named_ifAbsent_",
  3413. smalltalk.method({
  3414. selector: "named:ifAbsent:",
  3415. category: 'not yet classified',
  3416. fn: function (aPackageName, aBlock) {
  3417. var self = this;
  3418. var $1;
  3419. $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_packageAt_ifAbsent_", [aPackageName, aBlock]);
  3420. return $1;
  3421. },
  3422. args: ["aPackageName", "aBlock"],
  3423. source: "named: aPackageName ifAbsent: aBlock\x0a\x0a\x09^Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
  3424. messageSends: ["packageAt:ifAbsent:", "current"],
  3425. referencedClasses: ["Smalltalk"]
  3426. }),
  3427. smalltalk.Package.klass);
  3428. smalltalk.addMethod(
  3429. "_resetCommitPaths",
  3430. smalltalk.method({
  3431. selector: "resetCommitPaths",
  3432. category: 'commit paths',
  3433. fn: function () {
  3434. var self = this;
  3435. self['@defaultCommitPathJs'] = nil;
  3436. self['@defaultCommitPathSt'] = nil;
  3437. return self;
  3438. },
  3439. args: [],
  3440. source: "resetCommitPaths\x0a defaultCommitPathJs := nil.\x0a defaultCommitPathSt := nil.",
  3441. messageSends: [],
  3442. referencedClasses: []
  3443. }),
  3444. smalltalk.Package.klass);
  3445. smalltalk.addMethod(
  3446. "_sortedClasses_",
  3447. smalltalk.method({
  3448. selector: "sortedClasses:",
  3449. category: 'sorting',
  3450. fn: function (classes) {
  3451. var self = this;
  3452. var $1;
  3453. var children;
  3454. var others;
  3455. var nodes;
  3456. var expandedClasses;
  3457. children = [];
  3458. others = [];
  3459. 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]);}}]);
  3460. nodes = smalltalk.send(children, "_collect_", [function (each) {return smalltalk.send(smalltalk.ClassSorterNode || ClassSorterNode, "_on_classes_level_", [each, others, 0]);}]);
  3461. 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", [])]);}]);
  3462. expandedClasses = smalltalk.send(smalltalk.Array || Array, "_new", []);
  3463. smalltalk.send(nodes, "_do_", [function (aNode) {return smalltalk.send(aNode, "_traverseClassesWith_", [expandedClasses]);}]);
  3464. return expandedClasses;
  3465. },
  3466. args: ["classes"],
  3467. 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",
  3468. messageSends: ["do:", "ifFalse:ifTrue:", "add:", "includes:", "superclass", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  3469. referencedClasses: ["ClassSorterNode", "Array"]
  3470. }),
  3471. smalltalk.Package.klass);
  3472. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
  3473. 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."
  3474. smalltalk.addMethod(
  3475. "__star",
  3476. smalltalk.method({
  3477. selector: "*",
  3478. category: 'arithmetic',
  3479. fn: function (aPoint) {
  3480. var self = this;
  3481. var $1;
  3482. $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", [])])]);
  3483. return $1;
  3484. },
  3485. args: ["aPoint"],
  3486. source: "* aPoint\x0a\x09^Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  3487. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  3488. referencedClasses: ["Point"]
  3489. }),
  3490. smalltalk.Point);
  3491. smalltalk.addMethod(
  3492. "__plus",
  3493. smalltalk.method({
  3494. selector: "+",
  3495. category: 'arithmetic',
  3496. fn: function (aPoint) {
  3497. var self = this;
  3498. var $1;
  3499. $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", [])])]);
  3500. return $1;
  3501. },
  3502. args: ["aPoint"],
  3503. source: "+ aPoint\x0a\x09^Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  3504. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  3505. referencedClasses: ["Point"]
  3506. }),
  3507. smalltalk.Point);
  3508. smalltalk.addMethod(
  3509. "__minus",
  3510. smalltalk.method({
  3511. selector: "-",
  3512. category: 'arithmetic',
  3513. fn: function (aPoint) {
  3514. var self = this;
  3515. var $1;
  3516. $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", [])])]);
  3517. return $1;
  3518. },
  3519. args: ["aPoint"],
  3520. source: "- aPoint\x0a\x09^Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  3521. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  3522. referencedClasses: ["Point"]
  3523. }),
  3524. smalltalk.Point);
  3525. smalltalk.addMethod(
  3526. "__slash",
  3527. smalltalk.method({
  3528. selector: "/",
  3529. category: 'arithmetic',
  3530. fn: function (aPoint) {
  3531. var self = this;
  3532. var $1;
  3533. $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", [])])]);
  3534. return $1;
  3535. },
  3536. args: ["aPoint"],
  3537. source: "/ aPoint\x0a\x09^Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  3538. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  3539. referencedClasses: ["Point"]
  3540. }),
  3541. smalltalk.Point);
  3542. smalltalk.addMethod(
  3543. "__eq",
  3544. smalltalk.method({
  3545. selector: "=",
  3546. category: 'arithmetic',
  3547. fn: function (aPoint) {
  3548. var self = this;
  3549. var $1;
  3550. $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", [])])]);}]);
  3551. return $1;
  3552. },
  3553. args: ["aPoint"],
  3554. source: "= aPoint\x0a\x09^aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y)]",
  3555. messageSends: ["and:", "&", "=", "y", "x", "class"],
  3556. referencedClasses: []
  3557. }),
  3558. smalltalk.Point);
  3559. smalltalk.addMethod(
  3560. "_asPoint",
  3561. smalltalk.method({
  3562. selector: "asPoint",
  3563. category: 'converting',
  3564. fn: function () {
  3565. var self = this;
  3566. return self;
  3567. },
  3568. args: [],
  3569. source: "asPoint\x0a\x09^self",
  3570. messageSends: [],
  3571. referencedClasses: []
  3572. }),
  3573. smalltalk.Point);
  3574. smalltalk.addMethod(
  3575. "_printString",
  3576. smalltalk.method({
  3577. selector: "printString",
  3578. category: 'printing',
  3579. fn: function () {
  3580. var self = this;
  3581. var $2, $1;
  3582. $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", [])]);}]);
  3583. return $1;
  3584. },
  3585. args: [],
  3586. 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]",
  3587. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "ifTrue:", "space", "and:", "negative", "notNil"],
  3588. referencedClasses: ["String"]
  3589. }),
  3590. smalltalk.Point);
  3591. smalltalk.addMethod(
  3592. "_translateBy_",
  3593. smalltalk.method({
  3594. selector: "translateBy:",
  3595. category: 'transforming',
  3596. fn: function (delta) {
  3597. var self = this;
  3598. var $1;
  3599. $1 = smalltalk.send(smalltalk.send(smalltalk.send(delta, "_x", []), "__plus", [self['@x']]), "__at", [smalltalk.send(smalltalk.send(delta, "_y", []), "__plus", [self['@y']])]);
  3600. return $1;
  3601. },
  3602. args: ["delta"],
  3603. source: "translateBy: delta \x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^(delta x + x) @ (delta y + y)",
  3604. messageSends: ["@", "+", "y", "x"],
  3605. referencedClasses: []
  3606. }),
  3607. smalltalk.Point);
  3608. smalltalk.addMethod(
  3609. "_x",
  3610. smalltalk.method({
  3611. selector: "x",
  3612. category: 'accessing',
  3613. fn: function () {
  3614. var self = this;
  3615. return self['@x'];
  3616. },
  3617. args: [],
  3618. source: "x\x0a\x09^x",
  3619. messageSends: [],
  3620. referencedClasses: []
  3621. }),
  3622. smalltalk.Point);
  3623. smalltalk.addMethod(
  3624. "_x_",
  3625. smalltalk.method({
  3626. selector: "x:",
  3627. category: 'accessing',
  3628. fn: function (aNumber) {
  3629. var self = this;
  3630. self['@x'] = aNumber;
  3631. return self;
  3632. },
  3633. args: ["aNumber"],
  3634. source: "x: aNumber\x0a\x09x := aNumber",
  3635. messageSends: [],
  3636. referencedClasses: []
  3637. }),
  3638. smalltalk.Point);
  3639. smalltalk.addMethod(
  3640. "_y",
  3641. smalltalk.method({
  3642. selector: "y",
  3643. category: 'accessing',
  3644. fn: function () {
  3645. var self = this;
  3646. return self['@y'];
  3647. },
  3648. args: [],
  3649. source: "y\x0a\x09^y",
  3650. messageSends: [],
  3651. referencedClasses: []
  3652. }),
  3653. smalltalk.Point);
  3654. smalltalk.addMethod(
  3655. "_y_",
  3656. smalltalk.method({
  3657. selector: "y:",
  3658. category: 'accessing',
  3659. fn: function (aNumber) {
  3660. var self = this;
  3661. self['@y'] = aNumber;
  3662. return self;
  3663. },
  3664. args: ["aNumber"],
  3665. source: "y: aNumber\x0a\x09y := aNumber",
  3666. messageSends: [],
  3667. referencedClasses: []
  3668. }),
  3669. smalltalk.Point);
  3670. smalltalk.addMethod(
  3671. "_x_y_",
  3672. smalltalk.method({
  3673. selector: "x:y:",
  3674. category: 'instance creation',
  3675. fn: function (aNumber, anotherNumber) {
  3676. var self = this;
  3677. var $2, $3, $1;
  3678. $2 = smalltalk.send(self, "_new", []);
  3679. smalltalk.send($2, "_x_", [aNumber]);
  3680. smalltalk.send($2, "_y_", [anotherNumber]);
  3681. $3 = smalltalk.send($2, "_yourself", []);
  3682. $1 = $3;
  3683. return $1;
  3684. },
  3685. args: ["aNumber", "anotherNumber"],
  3686. source: "x: aNumber y: anotherNumber\x0a\x09^self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  3687. messageSends: ["x:", "new", "y:", "yourself"],
  3688. referencedClasses: []
  3689. }),
  3690. smalltalk.Point.klass);
  3691. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
  3692. 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'`."
  3693. smalltalk.addMethod(
  3694. "_next",
  3695. smalltalk.method({
  3696. selector: "next",
  3697. category: 'accessing',
  3698. fn: function () {
  3699. var self = this;
  3700. return Math.random();
  3701. return self;
  3702. },
  3703. args: [],
  3704. source: "next\x0a\x09<return Math.random()>",
  3705. messageSends: [],
  3706. referencedClasses: []
  3707. }),
  3708. smalltalk.Random);
  3709. smalltalk.addMethod(
  3710. "_next_",
  3711. smalltalk.method({
  3712. selector: "next:",
  3713. category: 'accessing',
  3714. fn: function (anInteger) {
  3715. var self = this;
  3716. var $1;
  3717. $1 = smalltalk.send(smalltalk.send(1, "_to_", [anInteger]), "_collect_", [function (each) {return smalltalk.send(self, "_next", []);}]);
  3718. return $1;
  3719. },
  3720. args: ["anInteger"],
  3721. source: "next: anInteger\x0a ^(1 to: anInteger) collect: [:each | self next]",
  3722. messageSends: ["collect:", "next", "to:"],
  3723. referencedClasses: []
  3724. }),
  3725. smalltalk.Random);
  3726. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
  3727. 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"
  3728. smalltalk.addMethod(
  3729. "_at_",
  3730. smalltalk.method({
  3731. selector: "at:",
  3732. category: 'accessing',
  3733. fn: function (aSymbol) {
  3734. var self = this;
  3735. return self[aSymbol._asString()];
  3736. return self;
  3737. },
  3738. args: ["aSymbol"],
  3739. source: "at: aSymbol\x0a\x09<return self[aSymbol._asString()]>",
  3740. messageSends: [],
  3741. referencedClasses: []
  3742. }),
  3743. smalltalk.Smalltalk);
  3744. smalltalk.addMethod(
  3745. "_basicParse_",
  3746. smalltalk.method({
  3747. selector: "basicParse:",
  3748. category: 'accessing',
  3749. fn: function (aString) {
  3750. var self = this;
  3751. return smalltalk.parser.parse(aString);
  3752. return self;
  3753. },
  3754. args: ["aString"],
  3755. source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
  3756. messageSends: [],
  3757. referencedClasses: []
  3758. }),
  3759. smalltalk.Smalltalk);
  3760. smalltalk.addMethod(
  3761. "_classes",
  3762. smalltalk.method({
  3763. selector: "classes",
  3764. category: 'classes',
  3765. fn: function () {
  3766. var self = this;
  3767. return self.classes();
  3768. return self;
  3769. },
  3770. args: [],
  3771. source: "classes\x0a\x09<return self.classes()>",
  3772. messageSends: [],
  3773. referencedClasses: []
  3774. }),
  3775. smalltalk.Smalltalk);
  3776. smalltalk.addMethod(
  3777. "_createPackage_",
  3778. smalltalk.method({
  3779. selector: "createPackage:",
  3780. category: 'private',
  3781. fn: function (packageName) {
  3782. var self = this;
  3783. return smalltalk.addPackage(packageName, nil);
  3784. return self;
  3785. },
  3786. args: ["packageName"],
  3787. 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)>",
  3788. messageSends: [],
  3789. referencedClasses: []
  3790. }),
  3791. smalltalk.Smalltalk);
  3792. smalltalk.addMethod(
  3793. "_createPackage_properties_",
  3794. smalltalk.method({
  3795. selector: "createPackage:properties:",
  3796. category: 'private',
  3797. fn: function (packageName, aDict) {
  3798. var self = this;
  3799. var object;
  3800. object = {};
  3801. smalltalk.send(aDict, "_keysAndValuesDo_", [function (key, value) {return object[key] = value;}]);
  3802. return smalltalk.addPackage(packageName, object);
  3803. return self;
  3804. },
  3805. args: ["packageName", "aDict"],
  3806. 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)>",
  3807. messageSends: ["keysAndValuesDo:"],
  3808. referencedClasses: []
  3809. }),
  3810. smalltalk.Smalltalk);
  3811. smalltalk.addMethod(
  3812. "_deleteClass_",
  3813. smalltalk.method({
  3814. selector: "deleteClass:",
  3815. category: 'private',
  3816. fn: function (aClass) {
  3817. var self = this;
  3818. self.removeClass(aClass);
  3819. return self;
  3820. },
  3821. args: ["aClass"],
  3822. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a \x0a\x09<self.removeClass(aClass)>",
  3823. messageSends: [],
  3824. referencedClasses: []
  3825. }),
  3826. smalltalk.Smalltalk);
  3827. smalltalk.addMethod(
  3828. "_deletePackage_",
  3829. smalltalk.method({
  3830. selector: "deletePackage:",
  3831. category: 'private',
  3832. fn: function (packageName) {
  3833. var self = this;
  3834. delete smalltalk.packages[packageName];
  3835. return self;
  3836. },
  3837. args: ["packageName"],
  3838. 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]>",
  3839. messageSends: [],
  3840. referencedClasses: []
  3841. }),
  3842. smalltalk.Smalltalk);
  3843. smalltalk.addMethod(
  3844. "_packageAt_",
  3845. smalltalk.method({
  3846. selector: "packageAt:",
  3847. category: 'packages',
  3848. fn: function (packageName) {
  3849. var self = this;
  3850. return self.packages[packageName];
  3851. return self;
  3852. },
  3853. args: ["packageName"],
  3854. source: "packageAt: packageName\x0a <return self.packages[packageName]>",
  3855. messageSends: [],
  3856. referencedClasses: []
  3857. }),
  3858. smalltalk.Smalltalk);
  3859. smalltalk.addMethod(
  3860. "_packageAt_ifAbsent_",
  3861. smalltalk.method({
  3862. selector: "packageAt:ifAbsent:",
  3863. category: 'packages',
  3864. fn: function (packageName, aBlock) {
  3865. var self = this;
  3866. var $2, $1;
  3867. $2 = smalltalk.send(self, "_packageAt_", [packageName]);
  3868. $1 = smalltalk.send($2, "_ifNil_", [aBlock]);
  3869. return $1;
  3870. },
  3871. args: ["packageName", "aBlock"],
  3872. source: "packageAt: packageName ifAbsent: aBlock\x0a ^(self packageAt: packageName) ifNil: aBlock",
  3873. messageSends: ["ifNil:", "packageAt:"],
  3874. referencedClasses: []
  3875. }),
  3876. smalltalk.Smalltalk);
  3877. smalltalk.addMethod(
  3878. "_packages",
  3879. smalltalk.method({
  3880. selector: "packages",
  3881. category: 'packages',
  3882. fn: function () {
  3883. var self = this;
  3884. return self.packages.all();
  3885. return self;
  3886. },
  3887. args: [],
  3888. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<return self.packages.all()>",
  3889. messageSends: [],
  3890. referencedClasses: []
  3891. }),
  3892. smalltalk.Smalltalk);
  3893. smalltalk.addMethod(
  3894. "_parse_",
  3895. smalltalk.method({
  3896. selector: "parse:",
  3897. category: 'accessing',
  3898. fn: function (aString) {
  3899. var self = this;
  3900. var result;
  3901. 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", []);}]);
  3902. return result;
  3903. },
  3904. args: ["aString"],
  3905. source: "parse: aString\x0a\x09| result | \x0a\x09self try: [result := self basicParse: aString] catch: [:ex | (self parseError: ex parsing: aString) signal].\x0a\x09^result",
  3906. messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:"],
  3907. referencedClasses: []
  3908. }),
  3909. smalltalk.Smalltalk);
  3910. smalltalk.addMethod(
  3911. "_parseError_parsing_",
  3912. smalltalk.method({
  3913. selector: "parseError:parsing:",
  3914. category: 'accessing',
  3915. fn: function (anException, aString) {
  3916. var self = this;
  3917. var $1;
  3918. var row;
  3919. var col;
  3920. var message;
  3921. var lines;
  3922. var badLine;
  3923. var code;
  3924. row = anException.line;
  3925. col = anException.column;
  3926. message = anException.message;
  3927. lines = smalltalk.send(aString, "_lines", []);
  3928. badLine = smalltalk.send(lines, "_at_", [row]);
  3929. 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", [])])]);
  3930. smalltalk.send(lines, "_at_put_", [row, badLine]);
  3931. 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", [])])]);}]);}]);
  3932. $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])]);
  3933. return $1;
  3934. },
  3935. args: ["anException", "aString"],
  3936. 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)",
  3937. messageSends: ["lines", "at:", ",", "copyFrom:to:", "size", "-", "at:put:", "streamContents:", "withIndexDo:", "nextPutAll:", "lf", "asString", "messageText:", "new"],
  3938. referencedClasses: ["String", "ParseError"]
  3939. }),
  3940. smalltalk.Smalltalk);
  3941. smalltalk.addMethod(
  3942. "_pseudoVariableNames",
  3943. smalltalk.method({
  3944. selector: "pseudoVariableNames",
  3945. category: 'packages',
  3946. fn: function () {
  3947. var self = this;
  3948. return ["self", "super", "nil", "true", "false", "thisContext"];
  3949. },
  3950. args: [],
  3951. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  3952. messageSends: [],
  3953. referencedClasses: []
  3954. }),
  3955. smalltalk.Smalltalk);
  3956. smalltalk.addMethod(
  3957. "_readJSObject_",
  3958. smalltalk.method({
  3959. selector: "readJSObject:",
  3960. category: 'accessing',
  3961. fn: function (anObject) {
  3962. var self = this;
  3963. return self.readJSObject(anObject);
  3964. return self;
  3965. },
  3966. args: ["anObject"],
  3967. source: "readJSObject: anObject\x0a\x09<return self.readJSObject(anObject)>",
  3968. messageSends: [],
  3969. referencedClasses: []
  3970. }),
  3971. smalltalk.Smalltalk);
  3972. smalltalk.addMethod(
  3973. "_removeClass_",
  3974. smalltalk.method({
  3975. selector: "removeClass:",
  3976. category: 'classes',
  3977. fn: function (aClass) {
  3978. var self = this;
  3979. var $1, $2, $3;
  3980. $1 = smalltalk.send(aClass, "_isMetaclass", []);
  3981. if (smalltalk.assert($1)) {
  3982. smalltalk.send(self, "_error_", [smalltalk.send(smalltalk.send(aClass, "_asString", []), "__comma", [" is a Metaclass and cannot be removed!"])]);
  3983. }
  3984. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(aClass, "_removeCompiledMethod_", [each]);}]);
  3985. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [function (each) {return smalltalk.send(smalltalk.send(aClass, "_class", []), "_removeCompiledMethod_", [each]);}]);
  3986. smalltalk.send(self, "_deleteClass_", [aClass]);
  3987. $2 = smalltalk.send(smalltalk.ClassRemoved || ClassRemoved, "_new", []);
  3988. smalltalk.send($2, "_theClass_", [aClass]);
  3989. $3 = smalltalk.send($2, "_yourself", []);
  3990. smalltalk.send(smalltalk.send(smalltalk.SystemAnnouncer || SystemAnnouncer, "_current", []), "_announce_", [$3]);
  3991. return self;
  3992. },
  3993. args: ["aClass"],
  3994. 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)",
  3995. messageSends: ["ifTrue:", "error:", ",", "asString", "isMetaclass", "do:", "removeCompiledMethod:", "values", "methodDictionary", "class", "deleteClass:", "announce:", "theClass:", "new", "yourself", "current"],
  3996. referencedClasses: ["ClassRemoved", "SystemAnnouncer"]
  3997. }),
  3998. smalltalk.Smalltalk);
  3999. smalltalk.addMethod(
  4000. "_removePackage_",
  4001. smalltalk.method({
  4002. selector: "removePackage:",
  4003. category: 'packages',
  4004. fn: function (packageName) {
  4005. var self = this;
  4006. var pkg;
  4007. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4008. smalltalk.send(smalltalk.send(pkg, "_classes", []), "_do_", [function (each) {return smalltalk.send(self, "_removeClass_", [each]);}]);
  4009. smalltalk.send(self, "_deletePackage_", [packageName]);
  4010. return self;
  4011. },
  4012. args: ["packageName"],
  4013. 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",
  4014. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "removeClass:", "classes", "deletePackage:"],
  4015. referencedClasses: []
  4016. }),
  4017. smalltalk.Smalltalk);
  4018. smalltalk.addMethod(
  4019. "_renamePackage_to_",
  4020. smalltalk.method({
  4021. selector: "renamePackage:to:",
  4022. category: 'packages',
  4023. fn: function (packageName, newName) {
  4024. var self = this;
  4025. var $1;
  4026. var pkg;
  4027. pkg = smalltalk.send(self, "_packageAt_ifAbsent_", [packageName, function () {return smalltalk.send(self, "_error_", [smalltalk.send("Missing package: ", "__comma", [packageName])]);}]);
  4028. $1 = smalltalk.send(self, "_packageAt_", [newName]);
  4029. if (($receiver = $1) == nil || $receiver == undefined) {
  4030. } else {
  4031. smalltalk.send(self, "_error_", [smalltalk.send("Already exists a package called: ", "__comma", [newName])]);
  4032. }
  4033. smalltalk.packages[newName] = smalltalk.packages[packageName];
  4034. smalltalk.send(pkg, "_name_", [newName]);
  4035. smalltalk.send(self, "_deletePackage_", [packageName]);
  4036. return self;
  4037. },
  4038. args: ["packageName", "newName"],
  4039. 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.",
  4040. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "deletePackage:"],
  4041. referencedClasses: []
  4042. }),
  4043. smalltalk.Smalltalk);
  4044. smalltalk.addMethod(
  4045. "_reservedWords",
  4046. smalltalk.method({
  4047. selector: "reservedWords",
  4048. category: 'accessing',
  4049. fn: function () {
  4050. var self = this;
  4051. return self.reservedWords;
  4052. return self;
  4053. },
  4054. args: [],
  4055. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return self.reservedWords>",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. smalltalk.Smalltalk);
  4060. smalltalk.addMethod(
  4061. "_send_to_arguments_",
  4062. smalltalk.method({
  4063. selector: "send:to:arguments:",
  4064. category: 'accessing',
  4065. fn: function (aSelector, anObject, aCollection) {
  4066. var self = this;
  4067. var selector;
  4068. selector = smalltalk.send(smalltalk.send(aSelector, "_asString", []), "_asSelector", []);
  4069. return self.send(anObject, selector, aCollection);
  4070. return self;
  4071. },
  4072. args: ["aSelector", "anObject", "aCollection"],
  4073. source: "send: aSelector to: anObject arguments: aCollection\x0a\x09| selector |\x0a\x09selector := aSelector asString asSelector.\x0a\x09<return self.send(anObject, selector, aCollection)>",
  4074. messageSends: ["asSelector", "asString"],
  4075. referencedClasses: []
  4076. }),
  4077. smalltalk.Smalltalk);
  4078. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  4079. smalltalk.addMethod(
  4080. "_current",
  4081. smalltalk.method({
  4082. selector: "current",
  4083. category: 'accessing',
  4084. fn: function () {
  4085. var self = this;
  4086. return smalltalk;
  4087. return self;
  4088. },
  4089. args: [],
  4090. source: "current\x0a\x09<return smalltalk>",
  4091. messageSends: [],
  4092. referencedClasses: []
  4093. }),
  4094. smalltalk.Smalltalk.klass);
  4095. smalltalk.addClass('Timeout', smalltalk.Object, ['rawTimeout'], 'Kernel-Objects');
  4096. smalltalk.Timeout.comment="I am wrapping the returns from set{Timeout,Interval}.\x0a\x0aNumber suffices in browsers, but node.js returns an object."
  4097. smalltalk.addMethod(
  4098. "_clearInterval",
  4099. smalltalk.method({
  4100. selector: "clearInterval",
  4101. category: 'timeout/interval',
  4102. fn: function (){
  4103. var self=this;
  4104. var interval = self["@rawTimeout"];
  4105. clearInterval(interval);
  4106. ;
  4107. ;
  4108. return self},
  4109. args: [],
  4110. source: "clearInterval\x0a\x09<\x0a \x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a >",
  4111. messageSends: [],
  4112. referencedClasses: []
  4113. }),
  4114. smalltalk.Timeout);
  4115. smalltalk.addMethod(
  4116. "_clearTimeout",
  4117. smalltalk.method({
  4118. selector: "clearTimeout",
  4119. category: 'timeout/interval',
  4120. fn: function (){
  4121. var self=this;
  4122. var timeout = self["@rawTimeout"];
  4123. clearTimeout(timeout);
  4124. ;
  4125. ;
  4126. return self},
  4127. args: [],
  4128. source: "clearTimeout\x0a\x09<\x0a \x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a >",
  4129. messageSends: [],
  4130. referencedClasses: []
  4131. }),
  4132. smalltalk.Timeout);
  4133. smalltalk.addMethod(
  4134. "_rawTimeout_",
  4135. smalltalk.method({
  4136. selector: "rawTimeout:",
  4137. category: 'accessing',
  4138. fn: function (anObject){
  4139. var self=this;
  4140. self["@rawTimeout"]=anObject;
  4141. return self},
  4142. args: ["anObject"],
  4143. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  4144. messageSends: [],
  4145. referencedClasses: []
  4146. }),
  4147. smalltalk.Timeout);
  4148. smalltalk.addMethod(
  4149. "_on_",
  4150. smalltalk.method({
  4151. selector: "on:",
  4152. category: 'instance creation',
  4153. fn: function (anObject){
  4154. var self=this;
  4155. var $2,$3,$1;
  4156. $2=smalltalk.send(self,"_new",[]);
  4157. smalltalk.send($2,"_rawTimeout_",[anObject]);
  4158. $3=smalltalk.send($2,"_yourself",[]);
  4159. $1=$3;
  4160. return $1;
  4161. },
  4162. args: ["anObject"],
  4163. source: "on: anObject\x0a\x09^self new rawTimeout: anObject; yourself",
  4164. messageSends: ["rawTimeout:", "new", "yourself"],
  4165. referencedClasses: []
  4166. }),
  4167. smalltalk.Timeout.klass);
  4168. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
  4169. 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."
  4170. smalltalk.addMethod(
  4171. "_asJSON",
  4172. smalltalk.method({
  4173. selector: "asJSON",
  4174. category: 'converting',
  4175. fn: function () {
  4176. var self = this;
  4177. return null;
  4178. },
  4179. args: [],
  4180. source: "asJSON\x0a\x09^null",
  4181. messageSends: [],
  4182. referencedClasses: []
  4183. }),
  4184. smalltalk.UndefinedObject);
  4185. smalltalk.addMethod(
  4186. "_deepCopy",
  4187. smalltalk.method({
  4188. selector: "deepCopy",
  4189. category: 'copying',
  4190. fn: function () {
  4191. var self = this;
  4192. return self;
  4193. },
  4194. args: [],
  4195. source: "deepCopy\x0a\x09^self",
  4196. messageSends: [],
  4197. referencedClasses: []
  4198. }),
  4199. smalltalk.UndefinedObject);
  4200. smalltalk.addMethod(
  4201. "_ifNil_",
  4202. smalltalk.method({
  4203. selector: "ifNil:",
  4204. category: 'testing',
  4205. fn: function (aBlock) {
  4206. var self = this;
  4207. var $1;
  4208. $1 = smalltalk.send(self, "_ifNil_ifNotNil_", [aBlock, function () {}]);
  4209. return $1;
  4210. },
  4211. args: ["aBlock"],
  4212. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self ifNil: aBlock ifNotNil: []",
  4213. messageSends: ["ifNil:ifNotNil:"],
  4214. referencedClasses: []
  4215. }),
  4216. smalltalk.UndefinedObject);
  4217. smalltalk.addMethod(
  4218. "_ifNil_ifNotNil_",
  4219. smalltalk.method({
  4220. selector: "ifNil:ifNotNil:",
  4221. category: 'testing',
  4222. fn: function (aBlock, anotherBlock) {
  4223. var self = this;
  4224. var $1;
  4225. $1 = smalltalk.send(aBlock, "_value", []);
  4226. return $1;
  4227. },
  4228. args: ["aBlock", "anotherBlock"],
  4229. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^aBlock value",
  4230. messageSends: ["value"],
  4231. referencedClasses: []
  4232. }),
  4233. smalltalk.UndefinedObject);
  4234. smalltalk.addMethod(
  4235. "_ifNotNil_",
  4236. smalltalk.method({
  4237. selector: "ifNotNil:",
  4238. category: 'testing',
  4239. fn: function (aBlock) {
  4240. var self = this;
  4241. return self;
  4242. },
  4243. args: ["aBlock"],
  4244. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^self",
  4245. messageSends: [],
  4246. referencedClasses: []
  4247. }),
  4248. smalltalk.UndefinedObject);
  4249. smalltalk.addMethod(
  4250. "_ifNotNil_ifNil_",
  4251. smalltalk.method({
  4252. selector: "ifNotNil:ifNil:",
  4253. category: 'testing',
  4254. fn: function (aBlock, anotherBlock) {
  4255. var self = this;
  4256. var $1;
  4257. $1 = smalltalk.send(anotherBlock, "_value", []);
  4258. return $1;
  4259. },
  4260. args: ["aBlock", "anotherBlock"],
  4261. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^anotherBlock value",
  4262. messageSends: ["value"],
  4263. referencedClasses: []
  4264. }),
  4265. smalltalk.UndefinedObject);
  4266. smalltalk.addMethod(
  4267. "_isNil",
  4268. smalltalk.method({
  4269. selector: "isNil",
  4270. category: 'testing',
  4271. fn: function () {
  4272. var self = this;
  4273. return true;
  4274. },
  4275. args: [],
  4276. source: "isNil\x0a\x09^true",
  4277. messageSends: [],
  4278. referencedClasses: []
  4279. }),
  4280. smalltalk.UndefinedObject);
  4281. smalltalk.addMethod(
  4282. "_notNil",
  4283. smalltalk.method({
  4284. selector: "notNil",
  4285. category: 'testing',
  4286. fn: function () {
  4287. var self = this;
  4288. return false;
  4289. },
  4290. args: [],
  4291. source: "notNil\x0a\x09^false",
  4292. messageSends: [],
  4293. referencedClasses: []
  4294. }),
  4295. smalltalk.UndefinedObject);
  4296. smalltalk.addMethod(
  4297. "_printString",
  4298. smalltalk.method({
  4299. selector: "printString",
  4300. category: 'printing',
  4301. fn: function () {
  4302. var self = this;
  4303. return "nil";
  4304. },
  4305. args: [],
  4306. source: "printString\x0a ^'nil'",
  4307. messageSends: [],
  4308. referencedClasses: []
  4309. }),
  4310. smalltalk.UndefinedObject);
  4311. smalltalk.addMethod(
  4312. "_shallowCopy",
  4313. smalltalk.method({
  4314. selector: "shallowCopy",
  4315. category: 'copying',
  4316. fn: function () {
  4317. var self = this;
  4318. return self;
  4319. },
  4320. args: [],
  4321. source: "shallowCopy\x0a\x09^self",
  4322. messageSends: [],
  4323. referencedClasses: []
  4324. }),
  4325. smalltalk.UndefinedObject);
  4326. smalltalk.addMethod(
  4327. "_subclass_instanceVariableNames_",
  4328. smalltalk.method({
  4329. selector: "subclass:instanceVariableNames:",
  4330. category: 'class creation',
  4331. fn: function (aString, anotherString) {
  4332. var self = this;
  4333. var $1;
  4334. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
  4335. return $1;
  4336. },
  4337. args: ["aString", "anotherString"],
  4338. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  4339. messageSends: ["subclass:instanceVariableNames:package:"],
  4340. referencedClasses: []
  4341. }),
  4342. smalltalk.UndefinedObject);
  4343. smalltalk.addMethod(
  4344. "_subclass_instanceVariableNames_category_",
  4345. smalltalk.method({
  4346. selector: "subclass:instanceVariableNames:category:",
  4347. category: 'class creation',
  4348. fn: function (aString, aString2, aString3) {
  4349. var self = this;
  4350. var $1;
  4351. smalltalk.send(self, "_deprecatedAPI", []);
  4352. $1 = smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
  4353. return $1;
  4354. },
  4355. args: ["aString", "aString2", "aString3"],
  4356. 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",
  4357. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  4358. referencedClasses: []
  4359. }),
  4360. smalltalk.UndefinedObject);
  4361. smalltalk.addMethod(
  4362. "_subclass_instanceVariableNames_package_",
  4363. smalltalk.method({
  4364. selector: "subclass:instanceVariableNames:package:",
  4365. category: 'class creation',
  4366. fn: function (aString,aString2,aString3){
  4367. var self=this;
  4368. var $1;
  4369. $1=smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]),"_superclass_subclass_instanceVariableNames_package_",[self,smalltalk.send(aString,"_asString",[]),aString2,aString3]);
  4370. return $1;
  4371. },
  4372. args: ["aString", "aString2", "aString3"],
  4373. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  4374. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  4375. referencedClasses: ["ClassBuilder"]
  4376. }),
  4377. smalltalk.UndefinedObject);
  4378. smalltalk.addMethod(
  4379. "_new",
  4380. smalltalk.method({
  4381. selector: "new",
  4382. category: 'instance creation',
  4383. fn: function () {
  4384. var self = this;
  4385. smalltalk.send(self, "_error_", ["You cannot create new instances of UndefinedObject. Use nil"]);
  4386. return self;
  4387. },
  4388. args: [],
  4389. source: "new\x0a\x09 self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  4390. messageSends: ["error:"],
  4391. referencedClasses: []
  4392. }),
  4393. smalltalk.UndefinedObject.klass);