Kernel.js 147 KB

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