1
0

Kernel.js 145 KB

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