Kernel-Objects.js 188 KB

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