amber-cli.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839
  1. #!/usr/bin/env node
  2. var define = (function amdefine(module, requireFn) {
  3. 'use strict';
  4. var defineCache = {},
  5. loaderCache = {},
  6. alreadyCalled = false,
  7. path = require('path'),
  8. makeRequire, stringRequire;
  9. /**
  10. * Trims the . and .. from an array of path segments.
  11. * It will keep a leading path segment if a .. will become
  12. * the first path segment, to help with module name lookups,
  13. * which act like paths, but can be remapped. But the end result,
  14. * all paths that use this function should look normalized.
  15. * NOTE: this method MODIFIES the input array.
  16. * @param {Array} ary the array of path segments.
  17. */
  18. function trimDots(ary) {
  19. var i, part;
  20. for (i = 0; ary[i]; i+= 1) {
  21. part = ary[i];
  22. if (part === '.') {
  23. ary.splice(i, 1);
  24. i -= 1;
  25. } else if (part === '..') {
  26. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  27. //End of the line. Keep at least one non-dot
  28. //path segment at the front so it can be mapped
  29. //correctly to disk. Otherwise, there is likely
  30. //no path mapping for a path starting with '..'.
  31. //This can still fail, but catches the most reasonable
  32. //uses of ..
  33. break;
  34. } else if (i > 0) {
  35. ary.splice(i - 1, 2);
  36. i -= 2;
  37. }
  38. }
  39. }
  40. }
  41. function normalize(name, baseName) {
  42. var baseParts;
  43. //Adjust any relative paths.
  44. if (name && name.charAt(0) === '.') {
  45. //If have a base name, try to normalize against it,
  46. //otherwise, assume it is a top-level require that will
  47. //be relative to baseUrl in the end.
  48. if (baseName) {
  49. baseParts = baseName.split('/');
  50. baseParts = baseParts.slice(0, baseParts.length - 1);
  51. baseParts = baseParts.concat(name.split('/'));
  52. trimDots(baseParts);
  53. name = baseParts.join('/');
  54. }
  55. }
  56. return name;
  57. }
  58. /**
  59. * Create the normalize() function passed to a loader plugin's
  60. * normalize method.
  61. */
  62. function makeNormalize(relName) {
  63. return function (name) {
  64. return normalize(name, relName);
  65. };
  66. }
  67. function makeLoad(id) {
  68. function load(value) {
  69. loaderCache[id] = value;
  70. }
  71. load.fromText = function (id, text) {
  72. //This one is difficult because the text can/probably uses
  73. //define, and any relative paths and requires should be relative
  74. //to that id was it would be found on disk. But this would require
  75. //bootstrapping a module/require fairly deeply from node core.
  76. //Not sure how best to go about that yet.
  77. throw new Error('amdefine does not implement load.fromText');
  78. };
  79. return load;
  80. }
  81. makeRequire = function (systemRequire, exports, module, relId) {
  82. function amdRequire(deps, callback) {
  83. if (typeof deps === 'string') {
  84. //Synchronous, single module require('')
  85. return stringRequire(systemRequire, exports, module, deps, relId);
  86. } else {
  87. //Array of dependencies with a callback.
  88. //Convert the dependencies to modules.
  89. deps = deps.map(function (depName) {
  90. return stringRequire(systemRequire, exports, module, depName, relId);
  91. });
  92. //Wait for next tick to call back the require call.
  93. process.nextTick(function () {
  94. callback.apply(null, deps);
  95. });
  96. }
  97. }
  98. amdRequire.toUrl = function (filePath) {
  99. if (filePath.indexOf('.') === 0) {
  100. return normalize(filePath, path.dirname(module.filename));
  101. } else {
  102. return filePath;
  103. }
  104. };
  105. return amdRequire;
  106. };
  107. //Favor explicit value, passed in if the module wants to support Node 0.4.
  108. requireFn = requireFn || function req() {
  109. return module.require.apply(module, arguments);
  110. };
  111. function runFactory(id, deps, factory) {
  112. var r, e, m, result;
  113. if (id) {
  114. e = loaderCache[id] = {};
  115. m = {
  116. id: id,
  117. uri: __filename,
  118. exports: e
  119. };
  120. r = makeRequire(requireFn, e, m, id);
  121. } else {
  122. //Only support one define call per file
  123. if (alreadyCalled) {
  124. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  125. }
  126. alreadyCalled = true;
  127. //Use the real variables from node
  128. //Use module.exports for exports, since
  129. //the exports in here is amdefine exports.
  130. e = module.exports;
  131. m = module;
  132. r = makeRequire(requireFn, e, m, module.id);
  133. }
  134. //If there are dependencies, they are strings, so need
  135. //to convert them to dependency values.
  136. if (deps) {
  137. deps = deps.map(function (depName) {
  138. return r(depName);
  139. });
  140. }
  141. //Call the factory with the right dependencies.
  142. if (typeof factory === 'function') {
  143. result = factory.apply(m.exports, deps);
  144. } else {
  145. result = factory;
  146. }
  147. if (result !== undefined) {
  148. m.exports = result;
  149. if (id) {
  150. loaderCache[id] = m.exports;
  151. }
  152. }
  153. }
  154. stringRequire = function (systemRequire, exports, module, id, relId) {
  155. //Split the ID by a ! so that
  156. var index = id.indexOf('!'),
  157. originalId = id,
  158. prefix, plugin;
  159. if (index === -1) {
  160. id = normalize(id, relId);
  161. //Straight module lookup. If it is one of the special dependencies,
  162. //deal with it, otherwise, delegate to node.
  163. if (id === 'require') {
  164. return makeRequire(systemRequire, exports, module, relId);
  165. } else if (id === 'exports') {
  166. return exports;
  167. } else if (id === 'module') {
  168. return module;
  169. } else if (loaderCache.hasOwnProperty(id)) {
  170. return loaderCache[id];
  171. } else if (defineCache[id]) {
  172. runFactory.apply(null, defineCache[id]);
  173. return loaderCache[id];
  174. } else {
  175. if(systemRequire) {
  176. return systemRequire(originalId);
  177. } else {
  178. throw new Error('No module with ID: ' + id);
  179. }
  180. }
  181. } else {
  182. //There is a plugin in play.
  183. prefix = id.substring(0, index);
  184. id = id.substring(index + 1, id.length);
  185. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  186. if (plugin.normalize) {
  187. id = plugin.normalize(id, makeNormalize(relId));
  188. } else {
  189. //Normalize the ID normally.
  190. id = normalize(id, relId);
  191. }
  192. if (loaderCache[id]) {
  193. return loaderCache[id];
  194. } else {
  195. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  196. return loaderCache[id];
  197. }
  198. }
  199. };
  200. //Create a define function specific to the module asking for amdefine.
  201. function define(id, deps, factory) {
  202. if (Array.isArray(id)) {
  203. factory = deps;
  204. deps = id;
  205. id = undefined;
  206. } else if (typeof id !== 'string') {
  207. factory = id;
  208. id = deps = undefined;
  209. }
  210. if (deps && !Array.isArray(deps)) {
  211. factory = deps;
  212. deps = undefined;
  213. }
  214. if (!deps) {
  215. deps = ['require', 'exports', 'module'];
  216. }
  217. //Set up properties for this module. If an ID, then use
  218. //internal cache. If no ID, then use the external variables
  219. //for this node module.
  220. if (id) {
  221. //Put the module in deep freeze until there is a
  222. //require call for it.
  223. defineCache[id] = [id, deps, factory];
  224. } else {
  225. runFactory(id, deps, factory);
  226. }
  227. }
  228. //define.require, which has access to all the values in the
  229. //cache. Useful for AMD modules that all have IDs in the file,
  230. //but need to finally export a value to node based on one of those
  231. //IDs.
  232. define.require = function (id) {
  233. if (loaderCache[id]) {
  234. return loaderCache[id];
  235. }
  236. if (defineCache[id]) {
  237. runFactory.apply(null, defineCache[id]);
  238. return loaderCache[id];
  239. }
  240. };
  241. define.amd = {};
  242. return define;
  243. })(null, function (id) { throw new Error("Dependency not found: " + id); }), requirejs = define.require;
  244. define("amber_vm/browser-compatibility", [], {});
  245. define("amber/browser-compatibility", [], {});
  246. /* ====================================================================
  247. |
  248. | Amber Smalltalk
  249. | http://amber-lang.net
  250. |
  251. ======================================================================
  252. ======================================================================
  253. |
  254. | Copyright (c) 2010-2014
  255. | Nicolas Petton <petton.nicolas@gmail.com>
  256. |
  257. | Copyright (c) 2012-2014
  258. | The Amber team https://github.com/amber-smalltalk?tab=members
  259. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  260. |
  261. | Amber is released under the MIT license
  262. |
  263. | Permission is hereby granted, free of charge, to any person obtaining
  264. | a copy of this software and associated documentation files (the
  265. | 'Software'), to deal in the Software without restriction, including
  266. | without limitation the rights to use, copy, modify, merge, publish,
  267. | distribute, sublicense, and/or sell copies of the Software, and to
  268. | permit persons to whom the Software is furnished to do so, subject to
  269. | the following conditions:
  270. |
  271. | The above copyright notice and this permission notice shall be
  272. | included in all copies or substantial portions of the Software.
  273. |
  274. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  275. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  276. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  277. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  278. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  279. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  280. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  281. |
  282. ==================================================================== */
  283. define("amber/boot", [ 'require', './browser-compatibility' ], function (require) {
  284. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  285. function Brikz(api, apiKey, initKey) {
  286. var brikz = this, backup = {};
  287. apiKey = apiKey || 'exports';
  288. initKey = initKey || '__init__';
  289. function mixin(src, target, what) {
  290. for (var keys = Object.keys(what||src), l=keys.length, i=0; i<l; ++i) {
  291. var value = src[keys[i]];
  292. if (typeof value !== "undefined") { target[keys[i]] = value; }
  293. }
  294. return target;
  295. }
  296. var d={value: null, enumerable: false, configurable: true, writable: true};
  297. Object.defineProperties(this, { ensure: d, rebuild: d });
  298. var exclude = mixin(this, {});
  299. this.rebuild = function () {
  300. Object.keys(backup).forEach(function (key) {
  301. mixin({}, api, (backup[key]||0)[apiKey]);
  302. });
  303. var oapi = mixin(api, {}), order = [], chk = {};
  304. brikz.ensure = function(key) {
  305. if (key in exclude) { return null; }
  306. var b = brikz[key], bak = backup[key];
  307. mixin({}, api, api);
  308. while (typeof b === "function") { b = new b(brikz, api, bak); }
  309. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  310. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  311. return brikz[key] = b;
  312. };
  313. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  314. brikz.ensure = null;
  315. mixin(oapi, mixin({}, api, api));
  316. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  317. order.forEach(function(brik) { brik[initKey] && brik[initKey](); });
  318. backup = mixin(brikz, {});
  319. };
  320. }
  321. /* Brikz end */
  322. function inherits(child, parent) {
  323. child.prototype = Object.create(parent.prototype, {
  324. constructor: { value: child,
  325. enumerable: false, configurable: true, writable: true }
  326. });
  327. return child;
  328. }
  329. var globals = {};
  330. globals.SmalltalkSettings = {};
  331. var api = Object.create(globals);
  332. var brikz = new Brikz(api);
  333. function RootBrik(brikz, st) {
  334. /* Smalltalk foundational objects */
  335. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  336. All objects including `Object` inherit from SmalltalkRoot */
  337. function SmalltalkRoot() {}
  338. function SmalltalkProtoObject() {}
  339. inherits(SmalltalkProtoObject, SmalltalkRoot);
  340. function SmalltalkObject() {}
  341. inherits(SmalltalkObject, SmalltalkProtoObject);
  342. function SmalltalkNil() {}
  343. inherits(SmalltalkNil, SmalltalkObject);
  344. this.Object = SmalltalkObject;
  345. this.nil = new SmalltalkNil();
  346. // Adds an `isNil` property to the `nil` object. When sending
  347. // nil objects from one environment to another, doing
  348. // `anObject == nil` (in JavaScript) does not always answer
  349. // true as the referenced nil object might come from the other
  350. // environment.
  351. Object.defineProperty(this.nil, 'isNil', {
  352. value: true,
  353. enumerable: false, configurable: false, writable: false
  354. });
  355. // Hidden root class of the system.
  356. this.rootAsClass = {fn: SmalltalkRoot};
  357. this.__init__ = function () {
  358. st.addPackage("Kernel-Objects");
  359. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  360. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  361. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  362. };
  363. }
  364. function OrganizeBrik(brikz, st) {
  365. brikz.ensure("augments");
  366. var SmalltalkObject = brikz.ensure("root").Object;
  367. function SmalltalkOrganizer () {}
  368. function SmalltalkPackageOrganizer () {
  369. this.elements = [];
  370. }
  371. function SmalltalkClassOrganizer () {
  372. this.elements = [];
  373. }
  374. inherits(SmalltalkOrganizer, SmalltalkObject);
  375. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  376. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  377. this.__init__ = function () {
  378. st.addPackage("Kernel-Infrastructure");
  379. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  380. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  381. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  382. };
  383. this.setupClassOrganization = function (klass) {
  384. klass.organization = new SmalltalkClassOrganizer();
  385. klass.organization.theClass = klass;
  386. };
  387. this.setupPackageOrganization = function (pkg) {
  388. pkg.organization = new SmalltalkPackageOrganizer();
  389. };
  390. this.addOrganizationElement = function (owner, element) {
  391. owner.organization.elements.addElement(element);
  392. };
  393. this.removeOrganizationElement = function (owner, element) {
  394. owner.organization.elements.removeElement(element);
  395. };
  396. }
  397. function DNUBrik(brikz, st) {
  398. brikz.ensure("selectorConversion");
  399. brikz.ensure("messageSend");
  400. var manip = brikz.ensure("manipulation");
  401. var rootAsClass = brikz.ensure("root").rootAsClass;
  402. /* Method not implemented handlers */
  403. var methods = [], checker = Object.create(null);
  404. this.selectors = [];
  405. this.get = function (string) {
  406. var index = this.selectors.indexOf(string);
  407. if(index !== -1) {
  408. return methods[index];
  409. }
  410. this.selectors.push(string);
  411. var selector = st.selector(string);
  412. checker[selector] = true;
  413. var method = {jsSelector: selector, fn: createHandler(selector)};
  414. methods.push(method);
  415. manip.installMethod(method, rootAsClass);
  416. return method;
  417. };
  418. this.isSelector = function (selector) {
  419. return checker[selector];
  420. };
  421. /* Dnu handler method */
  422. function createHandler(selector) {
  423. return function() {
  424. return brikz.messageSend.messageNotUnderstood(this, selector, arguments);
  425. };
  426. }
  427. this.installHandlers = function (klass) {
  428. for(var i=0; i<methods.length; i++) {
  429. manip.installMethodIfAbsent(methods[i], klass);
  430. }
  431. };
  432. }
  433. function ClassInitBrik(brikz, st) {
  434. var dnu = brikz.ensure("dnu");
  435. var manip = brikz.ensure("manipulation");
  436. var nil = brikz.ensure("root").nil;
  437. /* Initialize a class in its class hierarchy. Handle both classes and
  438. metaclasses. */
  439. st.init = function(klass) {
  440. st.initClass(klass);
  441. if(klass.klass && !klass.meta) {
  442. st.initClass(klass.klass);
  443. }
  444. };
  445. st.initClass = function(klass) {
  446. if(klass.wrapped) {
  447. copySuperclass(klass);
  448. dnu.installHandlers(klass);
  449. }
  450. };
  451. function copySuperclass(klass, superclass) {
  452. var inheritedMethods = Object.create(null);
  453. deinstallAllMethods(klass);
  454. for (superclass = superclass || klass.superclass;
  455. superclass && superclass !== nil;
  456. superclass = superclass.superclass) {
  457. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  458. inheritMethodIfAbsent(superclass.methods[keys[i]]);
  459. }
  460. }
  461. manip.reinstallMethods(klass);
  462. function inheritMethodIfAbsent(method) {
  463. var selector = method.selector;
  464. //TODO: prepare klass methods into inheritedMethods to only test once
  465. if(klass.methods[selector] || inheritedMethods[selector]) {
  466. return;
  467. }
  468. manip.installMethod(method, klass);
  469. inheritedMethods[method.selector] = true;
  470. }
  471. }
  472. function deinstallAllMethods(klass) {
  473. var proto = klass.fn.prototype;
  474. for(var keys = Object.getOwnPropertyNames(proto), i=0; i<keys.length; i++) {
  475. var key = keys[i];
  476. if (dnu.isSelector(key)) {
  477. proto[key] = null;
  478. }
  479. }
  480. }
  481. }
  482. function ManipulationBrik(brikz, st) {
  483. this.installMethodIfAbsent = function (handler, klass) {
  484. if(!klass.fn.prototype[handler.jsSelector]) {
  485. installMethod(handler, klass);
  486. }
  487. };
  488. function installMethod (method, klass) {
  489. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  490. value: method.fn,
  491. enumerable: false, configurable: true, writable: true
  492. });
  493. }
  494. this.installMethod = installMethod;
  495. this.reinstallMethods = function (klass) {
  496. var methods = klass.methods;
  497. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  498. installMethod(methods[keys[i]], klass);
  499. }
  500. };
  501. }
  502. function ClassesBrik(brikz, st) {
  503. var org = brikz.ensure("organize");
  504. var root = brikz.ensure("root");
  505. brikz.ensure("classInit");
  506. var nil = root.nil;
  507. var rootAsClass = root.rootAsClass;
  508. var SmalltalkObject = root.Object;
  509. rootAsClass.klass = {fn: SmalltalkClass};
  510. function SmalltalkPackage() {}
  511. function SmalltalkBehavior() {}
  512. function SmalltalkClass() {}
  513. function SmalltalkMetaclass() {}
  514. inherits(SmalltalkPackage, SmalltalkObject);
  515. inherits(SmalltalkBehavior, SmalltalkObject);
  516. inherits(SmalltalkClass, SmalltalkBehavior);
  517. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  518. SmalltalkMetaclass.prototype.meta = true;
  519. this.__init__ = function () {
  520. st.addPackage("Kernel-Classes");
  521. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  522. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  523. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  524. // Manually bootstrap the metaclass hierarchy
  525. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  526. addSubclass(globals.ProtoObject.klass);
  527. st.addPackage("Kernel-Infrastructure");
  528. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  529. };
  530. /* Smalltalk classes */
  531. var classes = [];
  532. var wrappedClasses = [];
  533. /* We hold all Packages in a separate Object */
  534. st.packages = {};
  535. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  536. function pkg(spec) {
  537. var that = new SmalltalkPackage();
  538. that.pkgName = spec.pkgName;
  539. org.setupPackageOrganization(that);
  540. that.properties = spec.properties || {};
  541. return that;
  542. }
  543. /* Smalltalk class creation. A class is an instance of an automatically
  544. created metaclass object. Newly created classes (not their metaclass)
  545. should be added to the smalltalk object, see smalltalk.addClass().
  546. Superclass linking is *not* handled here, see smalltalk.init() */
  547. function klass(spec) {
  548. spec = spec || {};
  549. var setSuperClass = spec.superclass;
  550. if(!spec.superclass) {
  551. spec.superclass = rootAsClass;
  552. }
  553. var meta = metaclass(spec);
  554. var that = meta.instanceClass;
  555. that.superclass = setSuperClass;
  556. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  557. that.subclasses = [];
  558. setupClass(that, spec);
  559. that.className = spec.className;
  560. that.wrapped = spec.wrapped || false;
  561. meta.className = spec.className + ' class';
  562. meta.superclass = spec.superclass.klass;
  563. return that;
  564. }
  565. function metaclass(spec) {
  566. spec = spec || {};
  567. var that = new SmalltalkMetaclass();
  568. that.fn = inherits(function () {}, spec.superclass.klass.fn);
  569. that.instanceClass = new that.fn();
  570. setupClass(that);
  571. return that;
  572. }
  573. SmalltalkBehavior.prototype.toString = function () {
  574. return 'Smalltalk ' + this.className;
  575. };
  576. function wireKlass(klass) {
  577. Object.defineProperty(klass.fn.prototype, "klass", {
  578. value: klass,
  579. enumerable: false, configurable: true, writable: true
  580. });
  581. }
  582. function setupClass(klass, spec) {
  583. spec = spec || {};
  584. klass.iVarNames = spec.iVarNames || [];
  585. klass.pkg = spec.pkg;
  586. org.setupClassOrganization(klass);
  587. Object.defineProperty(klass, "methods", {
  588. value: Object.create(null),
  589. enumerable: false, configurable: true, writable: true
  590. });
  591. wireKlass(klass);
  592. }
  593. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  594. If pkgName is null or empty we return nil, which is an allowed package for a class.
  595. If package already exists we still update the properties of it. */
  596. st.addPackage = function(pkgName, properties) {
  597. if(!pkgName) {return nil;}
  598. if(!(st.packages[pkgName])) {
  599. st.packages[pkgName] = pkg({
  600. pkgName: pkgName,
  601. properties: properties
  602. });
  603. } else {
  604. if(properties) {
  605. st.packages[pkgName].properties = properties;
  606. }
  607. }
  608. return st.packages[pkgName];
  609. };
  610. /* Add a class to the smalltalk object, creating a new one if needed.
  611. A Package is lazily created if it does not exist with given name. */
  612. st.addClass = function(className, superclass, iVarNames, pkgName) {
  613. // While subclassing nil is allowed, it might be an error, so
  614. // warn about it.
  615. if (typeof superclass == 'undefined' || superclass == nil) {
  616. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  617. }
  618. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  619. };
  620. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  621. var pkg = st.packages[pkgName];
  622. if (!pkg) {
  623. throw new Error("Missing package "+pkgName);
  624. }
  625. if (!superclass || superclass == nil) { superclass = null; }
  626. if(globals[className] && globals[className].superclass == superclass) {
  627. // globals[className].superclass = superclass;
  628. globals[className].iVarNames = iVarNames || [];
  629. if (pkg) globals[className].pkg = pkg;
  630. if (fn) {
  631. fn.prototype = globals[className].fn.prototype;
  632. globals[className].fn = fn;
  633. fn.prototype.constructor = fn;
  634. }
  635. } else {
  636. if(globals[className]) {
  637. st.removeClass(globals[className]);
  638. }
  639. globals[className] = klass({
  640. className: className,
  641. superclass: superclass,
  642. pkg: pkg,
  643. iVarNames: iVarNames,
  644. fn: fn,
  645. wrapped: wrapped
  646. });
  647. addSubclass(globals[className]);
  648. }
  649. classes.addElement(globals[className]);
  650. org.addOrganizationElement(pkg, globals[className]);
  651. }
  652. st.removeClass = function(klass) {
  653. org.removeOrganizationElement(klass.pkg, klass);
  654. classes.removeElement(klass);
  655. removeSubclass(klass);
  656. delete globals[klass.className];
  657. };
  658. function addSubclass(klass) {
  659. if(klass.superclass) {
  660. klass.superclass.subclasses.addElement(klass);
  661. }
  662. }
  663. function removeSubclass(klass) {
  664. if(klass.superclass) {
  665. klass.superclass.subclasses.removeElement(klass);
  666. }
  667. }
  668. /* Create a new class wrapping a JavaScript constructor, and add it to the
  669. global smalltalk object. Package is lazily created if it does not exist with given name. */
  670. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  671. wrapped = wrapped !== false;
  672. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  673. if(wrapped) {
  674. wrappedClasses.addElement(globals[className]);
  675. }
  676. };
  677. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  678. st.setClassConstructor = function(klass, constructor) {
  679. wrappedClasses.addElement(klass);
  680. klass.wrapped = true;
  681. klass.fn = constructor;
  682. // The fn property changed. We need to add back the klass property to the prototype
  683. wireKlass(klass);
  684. st.initClass(klass);
  685. };
  686. /* Create an alias for an existing class */
  687. st.alias = function(klass, alias) {
  688. globals[alias] = klass;
  689. };
  690. /* Answer all registered Smalltalk classes */
  691. //TODO: remove the function and make smalltalk.classes an array
  692. st.classes = function() {
  693. return classes;
  694. };
  695. st.wrappedClasses = function() {
  696. return wrappedClasses;
  697. };
  698. // Still used, but could go away now that subclasses are stored
  699. // into classes directly.
  700. st.allSubclasses = function(klass) {
  701. return klass._allSubclasses();
  702. };
  703. }
  704. function MethodsBrik(brikz, st) {
  705. var manip = brikz.ensure("manipulation");
  706. var org = brikz.ensure("organize");
  707. var stInit = brikz.ensure("stInit");
  708. var dnu = brikz.ensure("dnu");
  709. var SmalltalkObject = brikz.ensure("root").Object;
  710. brikz.ensure("selectorConversion");
  711. brikz.ensure("classes");
  712. brikz.ensure("classInit");
  713. function SmalltalkMethod() {}
  714. inherits(SmalltalkMethod, SmalltalkObject);
  715. this.__init__ = function () {
  716. st.addPackage("Kernel-Methods");
  717. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  718. };
  719. /* Smalltalk method object. To add a method to a class,
  720. use smalltalk.addMethod() */
  721. st.method = function(spec) {
  722. var that = new SmalltalkMethod();
  723. that.selector = spec.selector;
  724. that.jsSelector = spec.jsSelector;
  725. that.args = spec.args || {};
  726. // spec.category is kept for compatibility
  727. that.protocol = spec.protocol || spec.category;
  728. that.source = spec.source;
  729. that.messageSends = spec.messageSends || [];
  730. that.referencedClasses = spec.referencedClasses || [];
  731. that.fn = spec.fn;
  732. return that;
  733. };
  734. function installNewDnuHandler(newHandler) {
  735. var wrappedClasses = st.wrappedClasses();
  736. for(var i = 0; i < wrappedClasses.length; i++) {
  737. manip.installMethodIfAbsent(newHandler, wrappedClasses[i]);
  738. }
  739. }
  740. /* Add/remove a method to/from a class */
  741. st.addMethod = function (method, klass) {
  742. if (!(method.jsSelector)) {
  743. method.jsSelector = st.selector(method.selector);
  744. }
  745. manip.installMethod(method, klass);
  746. klass.methods[method.selector] = method;
  747. method.methodClass = klass;
  748. // During the bootstrap, #addCompiledMethod is not used.
  749. // Therefore we populate the organizer here too
  750. org.addOrganizationElement(klass, method.protocol);
  751. propagateMethodChange(klass);
  752. var usedSelectors = method.messageSends;
  753. var dnuHandlers = [];
  754. dnuHandlers.push(dnu.get(method.selector));
  755. for(var i=0; i<usedSelectors.length; i++) {
  756. dnuHandlers.push(dnu.get(usedSelectors[i]));
  757. }
  758. if(stInit.initialized()) {
  759. dnuHandlers.forEach(function(each) {
  760. installNewDnuHandler(each);
  761. });
  762. }
  763. };
  764. function propagateMethodChange(klass) {
  765. // If already initialized (else it will be done later anyway),
  766. // re-initialize all subclasses to ensure the method change
  767. // propagation (for wrapped classes, not using the prototype
  768. // chain).
  769. //TODO: optimize, only one method need to be updated, not all of them
  770. if (stInit.initialized()) {
  771. st.allSubclasses(klass).forEach(function (subclass) {
  772. st.initClass(subclass);
  773. });
  774. }
  775. }
  776. st.removeMethod = function(method, klass) {
  777. if (klass !== method.methodClass) {
  778. throw new Error(
  779. "Refusing to remove method "
  780. + method.methodClass.className+">>"+method.selector
  781. + " from different class "
  782. + klass.className);
  783. }
  784. delete klass.fn.prototype[st.selector(method.selector)];
  785. delete klass.methods[method.selector];
  786. st.initClass(klass);
  787. propagateMethodChange(klass);
  788. // Do *not* delete protocols from here.
  789. // This is handled by #removeCompiledMethod
  790. };
  791. /* Answer all method selectors based on dnu handlers */
  792. st.allSelectors = function() {
  793. return dnu.selectors;
  794. };
  795. }
  796. function AugmentsBrik(brikz, st) {
  797. /* Make sure that console is defined */
  798. if(typeof console === "undefined") {
  799. this.console = {
  800. log: function() {},
  801. warn: function() {},
  802. info: function() {},
  803. debug: function() {},
  804. error: function() {}
  805. };
  806. }
  807. /* Array extensions */
  808. Array.prototype.addElement = function(el) {
  809. if(typeof el === 'undefined') { return; }
  810. if(this.indexOf(el) == -1) {
  811. this.push(el);
  812. }
  813. };
  814. Array.prototype.removeElement = function(el) {
  815. var i = this.indexOf(el);
  816. if (i !== -1) { this.splice(i, 1); }
  817. };
  818. }
  819. function SmalltalkInitBrik(brikz, st) {
  820. brikz.ensure("classInit");
  821. brikz.ensure("classes");
  822. var nil = brikz.ensure("root").nil;
  823. var initialized = false;
  824. /* Smalltalk initialization. Called on page load */
  825. st.initialize = function() {
  826. if(initialized) { return; }
  827. st.classes().forEach(function(klass) {
  828. st.init(klass);
  829. });
  830. runnable();
  831. st.classes().forEach(function(klass) {
  832. klass._initialize();
  833. });
  834. initialized = true;
  835. };
  836. this.initialized = function () {
  837. return initialized;
  838. };
  839. this.__init__ = function () {
  840. st.addPackage("Kernel-Methods");
  841. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  842. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  843. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  844. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  845. st.addPackage("Kernel-Collections");
  846. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  847. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  848. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  849. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  850. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  851. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  852. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  853. st.addPackage("Kernel-Exceptions");
  854. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  855. /* Alias definitions */
  856. st.alias(globals.Array, "OrderedCollection");
  857. st.alias(globals.Date, "Time");
  858. };
  859. }
  860. function PrimitivesBrik(brikz, st) {
  861. /* Unique ID number generator */
  862. var oid = 0;
  863. st.nextId = function() {
  864. oid += 1;
  865. return oid;
  866. };
  867. /* Converts a JavaScript object to valid Smalltalk Object */
  868. st.readJSObject = function(js) {
  869. var readObject = js.constructor === Object;
  870. var readArray = js.constructor === Array;
  871. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  872. for(var i in js) {
  873. if(readObject) {
  874. object._at_put_(i, st.readJSObject(js[i]));
  875. }
  876. if(readArray) {
  877. object[i] = st.readJSObject(js[i]);
  878. }
  879. }
  880. return object;
  881. };
  882. /* Boolean assertion */
  883. st.assert = function(shouldBeBoolean) {
  884. if (undefined !== shouldBeBoolean && shouldBeBoolean.klass === globals.Boolean) {
  885. return shouldBeBoolean == true;
  886. } else {
  887. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  888. }
  889. };
  890. /* List of all reserved words in JavaScript. They may not be used as variables
  891. in Smalltalk. */
  892. // list of reserved JavaScript keywords as of
  893. // http://es5.github.com/#x7.6.1.1
  894. // and
  895. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  896. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  897. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  898. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  899. 'try', 'typeof', 'var', 'void', 'while', 'with',
  900. // ES5: future use: http://es5.github.com/#x7.6.1.2
  901. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  902. // ES5: future use in strict mode
  903. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  904. 'public', 'static', 'yield'];
  905. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  906. }
  907. function RuntimeBrik(brikz, st) {
  908. brikz.ensure("selectorConversion");
  909. var root = brikz.ensure("root");
  910. var nil = root.nil;
  911. var SmalltalkObject = root.Object;
  912. function SmalltalkMethodContext(home, setup) {
  913. this.sendIdx = {};
  914. this.homeContext = home;
  915. this.setup = setup || function() {};
  916. this.supercall = false;
  917. }
  918. inherits(SmalltalkMethodContext, SmalltalkObject);
  919. this.__init__ = function () {
  920. st.addPackage("Kernel-Methods");
  921. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  922. // Fallbacks
  923. SmalltalkMethodContext.prototype.locals = {};
  924. SmalltalkMethodContext.prototype.receiver = null;
  925. SmalltalkMethodContext.prototype.selector = null;
  926. SmalltalkMethodContext.prototype.lookupClass = null;
  927. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  928. this.receiver = receiver;
  929. this.selector = selector;
  930. this.locals = locals || {};
  931. this.lookupClass = lookupClass;
  932. if(this.homeContext) {
  933. this.homeContext.evaluatedSelector = selector;
  934. }
  935. };
  936. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  937. this.locals = locals || {};
  938. this.outerContext = ctx;
  939. this.index = index || 0;
  940. };
  941. SmalltalkMethodContext.prototype.init = function() {
  942. var home = this.homeContext;
  943. if(home) {
  944. home.init();
  945. }
  946. this.setup(this);
  947. };
  948. SmalltalkMethodContext.prototype.method = function() {
  949. var method;
  950. var lookup = this.lookupClass || this.receiver.klass;
  951. while(!method && lookup) {
  952. method = lookup.methods[st.convertSelector(this.selector)];
  953. lookup = lookup.superclass;
  954. }
  955. return method;
  956. };
  957. };
  958. /* This is the current call context object. While it is publicly available,
  959. Use smalltalk.getThisContext() instead which will answer a safe copy of
  960. the current context */
  961. st.thisContext = undefined;
  962. st.withContext = function(worker, setup) {
  963. if(st.thisContext) {
  964. return inContext(worker, setup);
  965. } else {
  966. try {
  967. return inContext(worker, setup);
  968. } catch(error) {
  969. handleError(error);
  970. st.thisContext = null;
  971. // Rethrow the error in any case.
  972. error.amberHandled = true;
  973. throw error;
  974. }
  975. }
  976. };
  977. function inContext(worker, setup) {
  978. var context = pushContext(setup);
  979. var result = worker(context);
  980. popContext(context);
  981. return result;
  982. }
  983. /* Wrap a JavaScript exception in a Smalltalk Exception.
  984. In case of a RangeError, stub the stack after 100 contexts to
  985. avoid another RangeError later when the stack is manipulated. */
  986. function wrappedError(error) {
  987. var errorWrapper = globals.JavaScriptException._on_(error);
  988. // Add the error to the context, so it is visible in the stack
  989. try { errorWrapper._signal(); } catch (ex) {}
  990. var context = st.getThisContext();
  991. if(isRangeError(error)) {
  992. stubContextStack(context);
  993. }
  994. errorWrapper._context_(context);
  995. return errorWrapper;
  996. }
  997. /* Stub the context stack after 100 contexts */
  998. function stubContextStack(context) {
  999. var currentContext = context;
  1000. var contexts = 0;
  1001. while(contexts < 100) {
  1002. if(currentContext) {
  1003. currentContext = currentContext.homeContext;
  1004. }
  1005. contexts++;
  1006. }
  1007. if(currentContext) {
  1008. currentContext.homeContext = undefined;
  1009. }
  1010. }
  1011. function isRangeError(error) {
  1012. return error instanceof RangeError;
  1013. }
  1014. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  1015. (See the Smalltalk class ErrorHandler and its subclasses */
  1016. function handleError(error) {
  1017. if (!error.smalltalkError) {
  1018. error = wrappedError(error);
  1019. }
  1020. globals.ErrorHandler._handleError_(error);
  1021. }
  1022. /* Handle thisContext pseudo variable */
  1023. st.getThisContext = function() {
  1024. if(st.thisContext) {
  1025. st.thisContext.init();
  1026. return st.thisContext;
  1027. } else {
  1028. return nil;
  1029. }
  1030. };
  1031. function pushContext(setup) {
  1032. return st.thisContext = new SmalltalkMethodContext(st.thisContext, setup);
  1033. }
  1034. function popContext(context) {
  1035. st.thisContext = context.homeContext;
  1036. }
  1037. }
  1038. function MessageSendBrik(brikz, st) {
  1039. brikz.ensure("selectorConversion");
  1040. var nil = brikz.ensure("root").nil;
  1041. /* Handles unhandled errors during message sends */
  1042. // simply send the message and handle #dnu:
  1043. st.send = function(receiver, selector, args, klass) {
  1044. var method;
  1045. if(receiver === null) {
  1046. receiver = nil;
  1047. }
  1048. method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
  1049. if(method) {
  1050. return method.apply(receiver, args);
  1051. } else {
  1052. return messageNotUnderstood(receiver, selector, args);
  1053. }
  1054. };
  1055. /* Handles #dnu: *and* JavaScript method calls.
  1056. if the receiver has no klass, we consider it a JS object (outside of the
  1057. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  1058. function messageNotUnderstood(receiver, selector, args) {
  1059. /* Handles JS method calls. */
  1060. if(receiver.klass === undefined || receiver.allowJavaScriptCalls) {
  1061. return callJavaScriptMethod(receiver, selector, args);
  1062. }
  1063. /* Handles not understood messages. Also see the Amber counter-part
  1064. Object>>doesNotUnderstand: */
  1065. return receiver._doesNotUnderstand_(
  1066. globals.Message._new()
  1067. ._selector_(st.convertSelector(selector))
  1068. ._arguments_([].slice.call(args))
  1069. );
  1070. }
  1071. /* Call a method of a JS object, or answer a property if it exists.
  1072. Else try wrapping a JSObjectProxy around the receiver.
  1073. If the object property is a function, then call it, except if it starts with
  1074. an uppercase character (we probably want to answer the function itself in this
  1075. case and send it #new from Amber).
  1076. Converts keyword-based selectors by using the first
  1077. keyword only, but keeping all message arguments.
  1078. Example:
  1079. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1080. function callJavaScriptMethod(receiver, selector, args) {
  1081. var jsSelector = selector._asJavaScriptSelector();
  1082. if (jsSelector in receiver) {
  1083. var jsProperty = receiver[jsSelector];
  1084. if (typeof jsProperty === "function" && !/^[A-Z]/.test(jsSelector)) {
  1085. return jsProperty.apply(receiver, args);
  1086. } else if (args.length > 0) {
  1087. receiver[jsSelector] = args[0];
  1088. return nil;
  1089. } else {
  1090. return jsProperty;
  1091. }
  1092. }
  1093. return st.send(globals.JSObjectProxy._on_(receiver), selector, args);
  1094. }
  1095. this.messageNotUnderstood = messageNotUnderstood;
  1096. }
  1097. function SelectorConversionBrik(brikz, st) {
  1098. /* Convert a Smalltalk selector into a JS selector */
  1099. st.selector = function(string) {
  1100. var selector = '_' + string;
  1101. selector = selector.replace(/:/g, '_');
  1102. selector = selector.replace(/[\&]/g, '_and');
  1103. selector = selector.replace(/[\|]/g, '_or');
  1104. selector = selector.replace(/[+]/g, '_plus');
  1105. selector = selector.replace(/-/g, '_minus');
  1106. selector = selector.replace(/[*]/g ,'_star');
  1107. selector = selector.replace(/[\/]/g ,'_slash');
  1108. selector = selector.replace(/[\\]/g ,'_backslash');
  1109. selector = selector.replace(/[\~]/g ,'_tild');
  1110. selector = selector.replace(/>/g ,'_gt');
  1111. selector = selector.replace(/</g ,'_lt');
  1112. selector = selector.replace(/=/g ,'_eq');
  1113. selector = selector.replace(/,/g ,'_comma');
  1114. selector = selector.replace(/[@]/g ,'_at');
  1115. return selector;
  1116. };
  1117. /* Convert a string to a valid smalltalk selector.
  1118. if you modify the following functions, also change String>>asSelector
  1119. accordingly */
  1120. st.convertSelector = function(selector) {
  1121. if(selector.match(/__/)) {
  1122. return convertBinarySelector(selector);
  1123. } else {
  1124. return convertKeywordSelector(selector);
  1125. }
  1126. };
  1127. function convertKeywordSelector(selector) {
  1128. return selector.replace(/^_/, '').replace(/_/g, ':');
  1129. }
  1130. function convertBinarySelector(selector) {
  1131. return selector
  1132. .replace(/^_/, '')
  1133. .replace(/_and/g, '&')
  1134. .replace(/_or/g, '|')
  1135. .replace(/_plus/g, '+')
  1136. .replace(/_minus/g, '-')
  1137. .replace(/_star/g, '*')
  1138. .replace(/_slash/g, '/')
  1139. .replace(/_backslash/g, '\\')
  1140. .replace(/_tild/g, '~')
  1141. .replace(/_gt/g, '>')
  1142. .replace(/_lt/g, '<')
  1143. .replace(/_eq/g, '=')
  1144. .replace(/_comma/g, ',')
  1145. .replace(/_at/g, '@');
  1146. }
  1147. }
  1148. /* Adds AMD and requirejs related methods to the smalltalk object */
  1149. function AMDBrik(brikz, st) {
  1150. this.__init__ = function () {
  1151. st.amdRequire = require;
  1152. st.defaultTransportType = st.defaultTransportType || "amd";
  1153. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1154. };
  1155. }
  1156. /* Defines asReceiver to be present at load time */
  1157. /* (logically it belongs more to PrimitiveBrik) */
  1158. function AsReceiverBrik(brikz, st) {
  1159. var nil = brikz.ensure("root").nil;
  1160. /**
  1161. * This function is used all over the compiled amber code.
  1162. * It takes any value (JavaScript or Smalltalk)
  1163. * and returns a proper Amber Smalltalk receiver.
  1164. *
  1165. * null or undefined -> nil,
  1166. * plain JS object -> wrapped JS object,
  1167. * otherwise unchanged
  1168. */
  1169. this.asReceiver = function (o) {
  1170. if (o == null) { return nil; }
  1171. if (o.klass) { return o; }
  1172. return globals.JSObjectProxy._on_(o);
  1173. };
  1174. }
  1175. /* Making smalltalk that can load */
  1176. brikz.root = RootBrik;
  1177. brikz.dnu = DNUBrik;
  1178. brikz.organize = OrganizeBrik;
  1179. brikz.selectorConversion = SelectorConversionBrik;
  1180. brikz.classInit = ClassInitBrik;
  1181. brikz.manipulation = ManipulationBrik;
  1182. brikz.classes = ClassesBrik;
  1183. brikz.methods = MethodsBrik;
  1184. brikz.stInit = SmalltalkInitBrik;
  1185. brikz.augments = AugmentsBrik;
  1186. brikz.amdBrik = AMDBrik;
  1187. brikz.asReceiverBrik = AsReceiverBrik;
  1188. brikz.rebuild();
  1189. /* Making smalltalk that can run */
  1190. function runnable () {
  1191. brikz.messageSend = MessageSendBrik;
  1192. brikz.runtime = RuntimeBrik;
  1193. brikz.primitives = PrimitivesBrik;
  1194. brikz.rebuild();
  1195. };
  1196. return { vm: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiverBrik.asReceiver };
  1197. });
  1198. define("amber_vm/smalltalk", ["./boot"], function (boot) {
  1199. return boot.vm;
  1200. });
  1201. define("amber_vm/globals", ["./boot"], function (boot) {
  1202. return boot.globals;
  1203. });
  1204. define("amber_vm/nil", ["./boot"], function (boot) {
  1205. return boot.nil;
  1206. });
  1207. define("amber_vm/_st", ["./boot"], function (boot) {
  1208. return boot.asReceiver;
  1209. });
  1210. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){
  1211. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  1212. smalltalk.addPackage('Kernel-Objects');
  1213. smalltalk.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1214. smalltalk.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1215. globals.ProtoObject.comment="I implement the basic behavior required for any object in Amber.\x0a\x0aIn most cases, subclassing `ProtoObject` is wrong and `Object` should be used instead. However subclassing `ProtoObject` can be useful in some special cases like proxy implementations.";
  1216. smalltalk.addMethod(
  1217. smalltalk.method({
  1218. selector: "=",
  1219. protocol: 'comparing',
  1220. fn: function (anObject){
  1221. var self=this;
  1222. return smalltalk.withContext(function($ctx1) {
  1223. var $1;
  1224. $1=self.__eq_eq(anObject);
  1225. return $1;
  1226. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.ProtoObject)})},
  1227. args: ["anObject"],
  1228. source: "= anObject\x0a\x09^ self == anObject",
  1229. messageSends: ["=="],
  1230. referencedClasses: []
  1231. }),
  1232. globals.ProtoObject);
  1233. smalltalk.addMethod(
  1234. smalltalk.method({
  1235. selector: "==",
  1236. protocol: 'comparing',
  1237. fn: function (anObject){
  1238. var self=this;
  1239. return smalltalk.withContext(function($ctx1) {
  1240. var $2,$1;
  1241. $2=self._identityHash();
  1242. $ctx1.sendIdx["identityHash"]=1;
  1243. $1=_st($2).__eq(_st(anObject)._identityHash());
  1244. return $1;
  1245. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},globals.ProtoObject)})},
  1246. args: ["anObject"],
  1247. source: "== anObject\x0a\x09^ self identityHash = anObject identityHash",
  1248. messageSends: ["=", "identityHash"],
  1249. referencedClasses: []
  1250. }),
  1251. globals.ProtoObject);
  1252. smalltalk.addMethod(
  1253. smalltalk.method({
  1254. selector: "asString",
  1255. protocol: 'converting',
  1256. fn: function (){
  1257. var self=this;
  1258. return smalltalk.withContext(function($ctx1) {
  1259. var $1;
  1260. $1=self._printString();
  1261. return $1;
  1262. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.ProtoObject)})},
  1263. args: [],
  1264. source: "asString\x0a\x09^ self printString",
  1265. messageSends: ["printString"],
  1266. referencedClasses: []
  1267. }),
  1268. globals.ProtoObject);
  1269. smalltalk.addMethod(
  1270. smalltalk.method({
  1271. selector: "class",
  1272. protocol: 'accessing',
  1273. fn: function (){
  1274. var self=this;
  1275. return smalltalk.withContext(function($ctx1) {
  1276. return self.klass;
  1277. return self}, function($ctx1) {$ctx1.fill(self,"class",{},globals.ProtoObject)})},
  1278. args: [],
  1279. source: "class\x0a\x09<return self.klass>",
  1280. messageSends: [],
  1281. referencedClasses: []
  1282. }),
  1283. globals.ProtoObject);
  1284. smalltalk.addMethod(
  1285. smalltalk.method({
  1286. selector: "doesNotUnderstand:",
  1287. protocol: 'error handling',
  1288. fn: function (aMessage){
  1289. var self=this;
  1290. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1291. return smalltalk.withContext(function($ctx1) {
  1292. var $1,$2;
  1293. $1=_st($MessageNotUnderstood())._new();
  1294. _st($1)._receiver_(self);
  1295. _st($1)._message_(aMessage);
  1296. $2=_st($1)._signal();
  1297. return self}, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.ProtoObject)})},
  1298. args: ["aMessage"],
  1299. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1300. messageSends: ["receiver:", "new", "message:", "signal"],
  1301. referencedClasses: ["MessageNotUnderstood"]
  1302. }),
  1303. globals.ProtoObject);
  1304. smalltalk.addMethod(
  1305. smalltalk.method({
  1306. selector: "evaluate:on:",
  1307. protocol: 'evaluating',
  1308. fn: function (aString,anEvaluator){
  1309. var self=this;
  1310. return smalltalk.withContext(function($ctx1) {
  1311. var $1;
  1312. $1=_st(anEvaluator)._evaluate_receiver_(aString,self);
  1313. return $1;
  1314. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.ProtoObject)})},
  1315. args: ["aString", "anEvaluator"],
  1316. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1317. messageSends: ["evaluate:receiver:"],
  1318. referencedClasses: []
  1319. }),
  1320. globals.ProtoObject);
  1321. smalltalk.addMethod(
  1322. smalltalk.method({
  1323. selector: "identityHash",
  1324. protocol: 'accessing',
  1325. fn: function (){
  1326. var self=this;
  1327. return smalltalk.withContext(function($ctx1) {
  1328. var hash=self.identityHash;
  1329. if (hash) return hash;
  1330. hash=smalltalk.nextId();
  1331. Object.defineProperty(self, 'identityHash', {value:hash});
  1332. return hash;
  1333. ;
  1334. return self}, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.ProtoObject)})},
  1335. args: [],
  1336. source: "identityHash\x0a\x09<\x0a\x09\x09var hash=self.identityHash;\x0a\x09\x09if (hash) return hash;\x0a\x09\x09hash=smalltalk.nextId();\x0a\x09\x09Object.defineProperty(self, 'identityHash', {value:hash});\x0a\x09\x09return hash;\x0a\x09>",
  1337. messageSends: [],
  1338. referencedClasses: []
  1339. }),
  1340. globals.ProtoObject);
  1341. smalltalk.addMethod(
  1342. smalltalk.method({
  1343. selector: "initialize",
  1344. protocol: 'initialization',
  1345. fn: function (){
  1346. var self=this;
  1347. return self},
  1348. args: [],
  1349. source: "initialize",
  1350. messageSends: [],
  1351. referencedClasses: []
  1352. }),
  1353. globals.ProtoObject);
  1354. smalltalk.addMethod(
  1355. smalltalk.method({
  1356. selector: "inspect",
  1357. protocol: 'inspecting',
  1358. fn: function (){
  1359. var self=this;
  1360. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1361. return smalltalk.withContext(function($ctx1) {
  1362. _st($Inspector())._inspect_(self);
  1363. return self}, function($ctx1) {$ctx1.fill(self,"inspect",{},globals.ProtoObject)})},
  1364. args: [],
  1365. source: "inspect\x0a\x09Inspector inspect: self",
  1366. messageSends: ["inspect:"],
  1367. referencedClasses: ["Inspector"]
  1368. }),
  1369. globals.ProtoObject);
  1370. smalltalk.addMethod(
  1371. smalltalk.method({
  1372. selector: "inspectOn:",
  1373. protocol: 'inspecting',
  1374. fn: function (anInspector){
  1375. var self=this;
  1376. return self},
  1377. args: ["anInspector"],
  1378. source: "inspectOn: anInspector",
  1379. messageSends: [],
  1380. referencedClasses: []
  1381. }),
  1382. globals.ProtoObject);
  1383. smalltalk.addMethod(
  1384. smalltalk.method({
  1385. selector: "instVarAt:",
  1386. protocol: 'accessing',
  1387. fn: function (aString){
  1388. var self=this;
  1389. return smalltalk.withContext(function($ctx1) {
  1390. return self['@'+aString] ;
  1391. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},globals.ProtoObject)})},
  1392. args: ["aString"],
  1393. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1394. messageSends: [],
  1395. referencedClasses: []
  1396. }),
  1397. globals.ProtoObject);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "instVarAt:put:",
  1401. protocol: 'accessing',
  1402. fn: function (aString,anObject){
  1403. var self=this;
  1404. return smalltalk.withContext(function($ctx1) {
  1405. self['@' + aString] = anObject ;
  1406. return self}, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},globals.ProtoObject)})},
  1407. args: ["aString", "anObject"],
  1408. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1409. messageSends: [],
  1410. referencedClasses: []
  1411. }),
  1412. globals.ProtoObject);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "isKindOf:",
  1416. protocol: 'testing',
  1417. fn: function (aClass){
  1418. var self=this;
  1419. return smalltalk.withContext(function($ctx1) {
  1420. var $2,$1;
  1421. $2=self._isMemberOf_(aClass);
  1422. if(smalltalk.assert($2)){
  1423. $1=true;
  1424. } else {
  1425. $1=_st(self._class())._inheritsFrom_(aClass);
  1426. };
  1427. return $1;
  1428. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.ProtoObject)})},
  1429. args: ["aClass"],
  1430. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1431. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"],
  1432. referencedClasses: []
  1433. }),
  1434. globals.ProtoObject);
  1435. smalltalk.addMethod(
  1436. smalltalk.method({
  1437. selector: "perform:",
  1438. protocol: 'message handling',
  1439. fn: function (aString){
  1440. var self=this;
  1441. return smalltalk.withContext(function($ctx1) {
  1442. var $1;
  1443. $1=self._perform_withArguments_(aString,[]);
  1444. return $1;
  1445. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},globals.ProtoObject)})},
  1446. args: ["aString"],
  1447. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1448. messageSends: ["perform:withArguments:"],
  1449. referencedClasses: []
  1450. }),
  1451. globals.ProtoObject);
  1452. smalltalk.addMethod(
  1453. smalltalk.method({
  1454. selector: "perform:withArguments:",
  1455. protocol: 'message handling',
  1456. fn: function (aString,aCollection){
  1457. var self=this;
  1458. return smalltalk.withContext(function($ctx1) {
  1459. return smalltalk.send(self, aString._asSelector(), aCollection);
  1460. return self}, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},globals.ProtoObject)})},
  1461. args: ["aString", "aCollection"],
  1462. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asSelector(), aCollection)>",
  1463. messageSends: [],
  1464. referencedClasses: []
  1465. }),
  1466. globals.ProtoObject);
  1467. smalltalk.addMethod(
  1468. smalltalk.method({
  1469. selector: "printOn:",
  1470. protocol: 'printing',
  1471. fn: function (aStream){
  1472. var self=this;
  1473. return smalltalk.withContext(function($ctx1) {
  1474. var $5,$4,$3,$2,$1;
  1475. $5=self._class();
  1476. $ctx1.sendIdx["class"]=1;
  1477. $4=_st($5)._name();
  1478. $ctx1.sendIdx["name"]=1;
  1479. $3=_st($4)._first();
  1480. $2=_st($3)._isVowel();
  1481. if(smalltalk.assert($2)){
  1482. $1="an ";
  1483. } else {
  1484. $1="a ";
  1485. };
  1486. _st(aStream)._nextPutAll_($1);
  1487. $ctx1.sendIdx["nextPutAll:"]=1;
  1488. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1489. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.ProtoObject)})},
  1490. args: ["aStream"],
  1491. source: "printOn: aStream\x0a\x09aStream nextPutAll: (self class name first isVowel\x0a\x09\x09ifTrue: [ 'an ' ]\x0a\x09\x09ifFalse: [ 'a ' ]).\x0a\x09aStream nextPutAll: self class name",
  1492. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"],
  1493. referencedClasses: []
  1494. }),
  1495. globals.ProtoObject);
  1496. smalltalk.addMethod(
  1497. smalltalk.method({
  1498. selector: "printString",
  1499. protocol: 'printing',
  1500. fn: function (){
  1501. var self=this;
  1502. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1503. return smalltalk.withContext(function($ctx1) {
  1504. var $1;
  1505. $1=_st($String())._streamContents_((function(str){
  1506. return smalltalk.withContext(function($ctx2) {
  1507. return self._printOn_(str);
  1508. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  1509. return $1;
  1510. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.ProtoObject)})},
  1511. args: [],
  1512. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1513. messageSends: ["streamContents:", "printOn:"],
  1514. referencedClasses: ["String"]
  1515. }),
  1516. globals.ProtoObject);
  1517. smalltalk.addMethod(
  1518. smalltalk.method({
  1519. selector: "yourself",
  1520. protocol: 'accessing',
  1521. fn: function (){
  1522. var self=this;
  1523. return self;
  1524. },
  1525. args: [],
  1526. source: "yourself\x0a\x09^ self",
  1527. messageSends: [],
  1528. referencedClasses: []
  1529. }),
  1530. globals.ProtoObject);
  1531. smalltalk.addMethod(
  1532. smalltalk.method({
  1533. selector: "~=",
  1534. protocol: 'comparing',
  1535. fn: function (anObject){
  1536. var self=this;
  1537. return smalltalk.withContext(function($ctx1) {
  1538. var $1;
  1539. $1=_st(self.__eq(anObject)).__eq(false);
  1540. $ctx1.sendIdx["="]=1;
  1541. return $1;
  1542. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},globals.ProtoObject)})},
  1543. args: ["anObject"],
  1544. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1545. messageSends: ["="],
  1546. referencedClasses: []
  1547. }),
  1548. globals.ProtoObject);
  1549. smalltalk.addMethod(
  1550. smalltalk.method({
  1551. selector: "~~",
  1552. protocol: 'comparing',
  1553. fn: function (anObject){
  1554. var self=this;
  1555. return smalltalk.withContext(function($ctx1) {
  1556. var $1;
  1557. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1558. return $1;
  1559. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},globals.ProtoObject)})},
  1560. args: ["anObject"],
  1561. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1562. messageSends: ["=", "=="],
  1563. referencedClasses: []
  1564. }),
  1565. globals.ProtoObject);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "heliosClass",
  1569. protocol: 'accessing',
  1570. fn: function (){
  1571. var self=this;
  1572. return "class";
  1573. },
  1574. args: [],
  1575. 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'",
  1576. messageSends: [],
  1577. referencedClasses: []
  1578. }),
  1579. globals.ProtoObject.klass);
  1580. smalltalk.addMethod(
  1581. smalltalk.method({
  1582. selector: "initialize",
  1583. protocol: 'initialization',
  1584. fn: function (){
  1585. var self=this;
  1586. return self},
  1587. args: [],
  1588. source: "initialize",
  1589. messageSends: [],
  1590. referencedClasses: []
  1591. }),
  1592. globals.ProtoObject.klass);
  1593. smalltalk.addClass('Object', globals.ProtoObject, [], 'Kernel-Objects');
  1594. globals.Object.comment="**I am the root of the Smalltalk class system**. With the exception of unual subclasses of `ProtoObject`, all other classes in the system are subclasses of me.\x0a\x0aI provide default behavior common to all normal objects (some of it inherited from `ProtoObject`), 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.";
  1595. smalltalk.addMethod(
  1596. smalltalk.method({
  1597. selector: "->",
  1598. protocol: 'converting',
  1599. fn: function (anObject){
  1600. var self=this;
  1601. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  1602. return smalltalk.withContext(function($ctx1) {
  1603. var $1;
  1604. $1=_st($Association())._key_value_(self,anObject);
  1605. return $1;
  1606. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},globals.Object)})},
  1607. args: ["anObject"],
  1608. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1609. messageSends: ["key:value:"],
  1610. referencedClasses: ["Association"]
  1611. }),
  1612. globals.Object);
  1613. smalltalk.addMethod(
  1614. smalltalk.method({
  1615. selector: "asJSON",
  1616. protocol: 'converting',
  1617. fn: function (){
  1618. var self=this;
  1619. var variables;
  1620. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1621. return smalltalk.withContext(function($ctx1) {
  1622. var $1;
  1623. variables=_st($HashedCollection())._new();
  1624. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1625. return smalltalk.withContext(function($ctx2) {
  1626. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  1627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1628. $1=variables;
  1629. return $1;
  1630. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},globals.Object)})},
  1631. args: [],
  1632. 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",
  1633. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"],
  1634. referencedClasses: ["HashedCollection"]
  1635. }),
  1636. globals.Object);
  1637. smalltalk.addMethod(
  1638. smalltalk.method({
  1639. selector: "asJSONString",
  1640. protocol: 'converting',
  1641. fn: function (){
  1642. var self=this;
  1643. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1644. return smalltalk.withContext(function($ctx1) {
  1645. var $1;
  1646. $1=_st($JSON())._stringify_(self._asJSON());
  1647. return $1;
  1648. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},globals.Object)})},
  1649. args: [],
  1650. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1651. messageSends: ["stringify:", "asJSON"],
  1652. referencedClasses: ["JSON"]
  1653. }),
  1654. globals.Object);
  1655. smalltalk.addMethod(
  1656. smalltalk.method({
  1657. selector: "asJavascript",
  1658. protocol: 'converting',
  1659. fn: function (){
  1660. var self=this;
  1661. return smalltalk.withContext(function($ctx1) {
  1662. var $1;
  1663. $1=self._asString();
  1664. return $1;
  1665. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Object)})},
  1666. args: [],
  1667. source: "asJavascript\x0a\x09^ self asString",
  1668. messageSends: ["asString"],
  1669. referencedClasses: []
  1670. }),
  1671. globals.Object);
  1672. smalltalk.addMethod(
  1673. smalltalk.method({
  1674. selector: "basicAt:",
  1675. protocol: 'accessing',
  1676. fn: function (aString){
  1677. var self=this;
  1678. return smalltalk.withContext(function($ctx1) {
  1679. return self[aString];
  1680. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},globals.Object)})},
  1681. args: ["aString"],
  1682. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1683. messageSends: [],
  1684. referencedClasses: []
  1685. }),
  1686. globals.Object);
  1687. smalltalk.addMethod(
  1688. smalltalk.method({
  1689. selector: "basicAt:put:",
  1690. protocol: 'accessing',
  1691. fn: function (aString,anObject){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) {
  1694. return self[aString] = anObject;
  1695. return self}, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},globals.Object)})},
  1696. args: ["aString", "anObject"],
  1697. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1698. messageSends: [],
  1699. referencedClasses: []
  1700. }),
  1701. globals.Object);
  1702. smalltalk.addMethod(
  1703. smalltalk.method({
  1704. selector: "basicDelete:",
  1705. protocol: 'accessing',
  1706. fn: function (aString){
  1707. var self=this;
  1708. return smalltalk.withContext(function($ctx1) {
  1709. delete self[aString]; return aString;
  1710. return self}, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},globals.Object)})},
  1711. args: ["aString"],
  1712. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1713. messageSends: [],
  1714. referencedClasses: []
  1715. }),
  1716. globals.Object);
  1717. smalltalk.addMethod(
  1718. smalltalk.method({
  1719. selector: "basicPerform:",
  1720. protocol: 'message handling',
  1721. fn: function (aString){
  1722. var self=this;
  1723. return smalltalk.withContext(function($ctx1) {
  1724. var $1;
  1725. $1=self._basicPerform_withArguments_(aString,[]);
  1726. return $1;
  1727. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},globals.Object)})},
  1728. args: ["aString"],
  1729. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1730. messageSends: ["basicPerform:withArguments:"],
  1731. referencedClasses: []
  1732. }),
  1733. globals.Object);
  1734. smalltalk.addMethod(
  1735. smalltalk.method({
  1736. selector: "basicPerform:withArguments:",
  1737. protocol: 'message handling',
  1738. fn: function (aString,aCollection){
  1739. var self=this;
  1740. return smalltalk.withContext(function($ctx1) {
  1741. return self[aString].apply(self, aCollection);;
  1742. return self}, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},globals.Object)})},
  1743. args: ["aString", "aCollection"],
  1744. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1745. messageSends: [],
  1746. referencedClasses: []
  1747. }),
  1748. globals.Object);
  1749. smalltalk.addMethod(
  1750. smalltalk.method({
  1751. selector: "browse",
  1752. protocol: 'browsing',
  1753. fn: function (){
  1754. var self=this;
  1755. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1756. return smalltalk.withContext(function($ctx1) {
  1757. _st($Finder())._findClass_(self._class());
  1758. return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Object)})},
  1759. args: [],
  1760. source: "browse\x0a\x09Finder findClass: self class",
  1761. messageSends: ["findClass:", "class"],
  1762. referencedClasses: ["Finder"]
  1763. }),
  1764. globals.Object);
  1765. smalltalk.addMethod(
  1766. smalltalk.method({
  1767. selector: "copy",
  1768. protocol: 'copying',
  1769. fn: function (){
  1770. var self=this;
  1771. return smalltalk.withContext(function($ctx1) {
  1772. var $1;
  1773. $1=_st(self._shallowCopy())._postCopy();
  1774. return $1;
  1775. }, function($ctx1) {$ctx1.fill(self,"copy",{},globals.Object)})},
  1776. args: [],
  1777. source: "copy\x0a\x09^ self shallowCopy postCopy",
  1778. messageSends: ["postCopy", "shallowCopy"],
  1779. referencedClasses: []
  1780. }),
  1781. globals.Object);
  1782. smalltalk.addMethod(
  1783. smalltalk.method({
  1784. selector: "deepCopy",
  1785. protocol: 'copying',
  1786. fn: function (){
  1787. var self=this;
  1788. return smalltalk.withContext(function($ctx1) {
  1789. var copy = self.klass._new();
  1790. Object.keys(self).forEach(function (i) {
  1791. if(/^@.+/.test(i)) {
  1792. copy[i] = self[i]._deepCopy();
  1793. }
  1794. });
  1795. return copy;
  1796. ;
  1797. return self}, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Object)})},
  1798. args: [],
  1799. source: "deepCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function (i) {\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>",
  1800. messageSends: [],
  1801. referencedClasses: []
  1802. }),
  1803. globals.Object);
  1804. smalltalk.addMethod(
  1805. smalltalk.method({
  1806. selector: "deprecatedAPI",
  1807. protocol: 'error handling',
  1808. fn: function (){
  1809. var self=this;
  1810. return smalltalk.withContext(function($ctx1) {
  1811. var $1,$6,$5,$4,$8,$7,$3,$2;
  1812. $1=console;
  1813. $6=smalltalk.getThisContext()._home();
  1814. $ctx1.sendIdx["home"]=1;
  1815. $5=_st($6)._asString();
  1816. $ctx1.sendIdx["asString"]=1;
  1817. $4=_st($5).__comma(" is deprecated! (in ");
  1818. $8=_st(smalltalk.getThisContext()._home())._home();
  1819. $ctx1.sendIdx["home"]=2;
  1820. $7=_st($8)._asString();
  1821. $3=_st($4).__comma($7);
  1822. $ctx1.sendIdx[","]=2;
  1823. $2=_st($3).__comma(")");
  1824. $ctx1.sendIdx[","]=1;
  1825. _st($1)._warn_($2);
  1826. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},globals.Object)})},
  1827. args: [],
  1828. 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, ')'.",
  1829. messageSends: ["warn:", ",", "asString", "home"],
  1830. referencedClasses: []
  1831. }),
  1832. globals.Object);
  1833. smalltalk.addMethod(
  1834. smalltalk.method({
  1835. selector: "deprecatedAPI:",
  1836. protocol: 'error handling',
  1837. fn: function (aString){
  1838. var self=this;
  1839. return smalltalk.withContext(function($ctx1) {
  1840. var $1,$6,$5,$4,$8,$7,$3,$2;
  1841. $1=console;
  1842. $6=smalltalk.getThisContext()._home();
  1843. $ctx1.sendIdx["home"]=1;
  1844. $5=_st($6)._asString();
  1845. $ctx1.sendIdx["asString"]=1;
  1846. $4=_st($5).__comma(" is deprecated! (in ");
  1847. $8=_st(smalltalk.getThisContext()._home())._home();
  1848. $ctx1.sendIdx["home"]=2;
  1849. $7=_st($8)._asString();
  1850. $3=_st($4).__comma($7);
  1851. $ctx1.sendIdx[","]=2;
  1852. $2=_st($3).__comma(")");
  1853. $ctx1.sendIdx[","]=1;
  1854. _st($1)._warn_($2);
  1855. $ctx1.sendIdx["warn:"]=1;
  1856. _st(console)._warn_(aString);
  1857. return self}, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},globals.Object)})},
  1858. args: ["aString"],
  1859. source: "deprecatedAPI: aString\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, ')'.\x0a\x09console warn: aString",
  1860. messageSends: ["warn:", ",", "asString", "home"],
  1861. referencedClasses: []
  1862. }),
  1863. globals.Object);
  1864. smalltalk.addMethod(
  1865. smalltalk.method({
  1866. selector: "error:",
  1867. protocol: 'error handling',
  1868. fn: function (aString){
  1869. var self=this;
  1870. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1871. return smalltalk.withContext(function($ctx1) {
  1872. _st($Error())._signal_(aString);
  1873. return self}, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},globals.Object)})},
  1874. args: ["aString"],
  1875. source: "error: aString\x0a\x09Error signal: aString",
  1876. messageSends: ["signal:"],
  1877. referencedClasses: ["Error"]
  1878. }),
  1879. globals.Object);
  1880. smalltalk.addMethod(
  1881. smalltalk.method({
  1882. selector: "halt",
  1883. protocol: 'error handling',
  1884. fn: function (){
  1885. var self=this;
  1886. function $Halt(){return globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  1887. return smalltalk.withContext(function($ctx1) {
  1888. _st($Halt())._signal();
  1889. return self}, function($ctx1) {$ctx1.fill(self,"halt",{},globals.Object)})},
  1890. args: [],
  1891. source: "halt\x0a\x09Halt signal",
  1892. messageSends: ["signal"],
  1893. referencedClasses: ["Halt"]
  1894. }),
  1895. globals.Object);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "ifNil:",
  1899. protocol: 'testing',
  1900. fn: function (aBlock){
  1901. var self=this;
  1902. return self;
  1903. },
  1904. args: ["aBlock"],
  1905. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  1906. messageSends: [],
  1907. referencedClasses: []
  1908. }),
  1909. globals.Object);
  1910. smalltalk.addMethod(
  1911. smalltalk.method({
  1912. selector: "ifNil:ifNotNil:",
  1913. protocol: 'testing',
  1914. fn: function (aBlock,anotherBlock){
  1915. var self=this;
  1916. return smalltalk.withContext(function($ctx1) {
  1917. var $1;
  1918. $1=_st(anotherBlock)._value_(self);
  1919. return $1;
  1920. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  1921. args: ["aBlock", "anotherBlock"],
  1922. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  1923. messageSends: ["value:"],
  1924. referencedClasses: []
  1925. }),
  1926. globals.Object);
  1927. smalltalk.addMethod(
  1928. smalltalk.method({
  1929. selector: "ifNotNil:",
  1930. protocol: 'testing',
  1931. fn: function (aBlock){
  1932. var self=this;
  1933. return smalltalk.withContext(function($ctx1) {
  1934. var $1;
  1935. $1=_st(aBlock)._value_(self);
  1936. return $1;
  1937. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},globals.Object)})},
  1938. args: ["aBlock"],
  1939. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1940. messageSends: ["value:"],
  1941. referencedClasses: []
  1942. }),
  1943. globals.Object);
  1944. smalltalk.addMethod(
  1945. smalltalk.method({
  1946. selector: "ifNotNil:ifNil:",
  1947. protocol: 'testing',
  1948. fn: function (aBlock,anotherBlock){
  1949. var self=this;
  1950. return smalltalk.withContext(function($ctx1) {
  1951. var $1;
  1952. $1=_st(aBlock)._value_(self);
  1953. return $1;
  1954. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  1955. args: ["aBlock", "anotherBlock"],
  1956. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  1957. messageSends: ["value:"],
  1958. referencedClasses: []
  1959. }),
  1960. globals.Object);
  1961. smalltalk.addMethod(
  1962. smalltalk.method({
  1963. selector: "inspectOn:",
  1964. protocol: 'inspecting',
  1965. fn: function (anInspector){
  1966. var self=this;
  1967. var variables;
  1968. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1969. return smalltalk.withContext(function($ctx1) {
  1970. var $1;
  1971. variables=_st($Dictionary())._new();
  1972. _st(variables)._at_put_("#self",self);
  1973. $ctx1.sendIdx["at:put:"]=1;
  1974. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1975. return smalltalk.withContext(function($ctx2) {
  1976. return _st(variables)._at_put_(each,self._instVarAt_(each));
  1977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1978. _st(anInspector)._setLabel_(self._printString());
  1979. $1=_st(anInspector)._setVariables_(variables);
  1980. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.Object)})},
  1981. args: ["anInspector"],
  1982. 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",
  1983. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"],
  1984. referencedClasses: ["Dictionary"]
  1985. }),
  1986. globals.Object);
  1987. smalltalk.addMethod(
  1988. smalltalk.method({
  1989. selector: "isBehavior",
  1990. protocol: 'testing',
  1991. fn: function (){
  1992. var self=this;
  1993. return false;
  1994. },
  1995. args: [],
  1996. source: "isBehavior\x0a\x09^ false",
  1997. messageSends: [],
  1998. referencedClasses: []
  1999. }),
  2000. globals.Object);
  2001. smalltalk.addMethod(
  2002. smalltalk.method({
  2003. selector: "isBoolean",
  2004. protocol: 'testing',
  2005. fn: function (){
  2006. var self=this;
  2007. return false;
  2008. },
  2009. args: [],
  2010. source: "isBoolean\x0a\x09^ false",
  2011. messageSends: [],
  2012. referencedClasses: []
  2013. }),
  2014. globals.Object);
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "isClass",
  2018. protocol: 'testing',
  2019. fn: function (){
  2020. var self=this;
  2021. return false;
  2022. },
  2023. args: [],
  2024. source: "isClass\x0a\x09^ false",
  2025. messageSends: [],
  2026. referencedClasses: []
  2027. }),
  2028. globals.Object);
  2029. smalltalk.addMethod(
  2030. smalltalk.method({
  2031. selector: "isCompiledMethod",
  2032. protocol: 'testing',
  2033. fn: function (){
  2034. var self=this;
  2035. return false;
  2036. },
  2037. args: [],
  2038. source: "isCompiledMethod\x0a\x09^ false",
  2039. messageSends: [],
  2040. referencedClasses: []
  2041. }),
  2042. globals.Object);
  2043. smalltalk.addMethod(
  2044. smalltalk.method({
  2045. selector: "isImmutable",
  2046. protocol: 'testing',
  2047. fn: function (){
  2048. var self=this;
  2049. return false;
  2050. },
  2051. args: [],
  2052. source: "isImmutable\x0a\x09^ false",
  2053. messageSends: [],
  2054. referencedClasses: []
  2055. }),
  2056. globals.Object);
  2057. smalltalk.addMethod(
  2058. smalltalk.method({
  2059. selector: "isMemberOf:",
  2060. protocol: 'testing',
  2061. fn: function (aClass){
  2062. var self=this;
  2063. return smalltalk.withContext(function($ctx1) {
  2064. var $1;
  2065. $1=_st(self._class()).__eq(aClass);
  2066. return $1;
  2067. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},globals.Object)})},
  2068. args: ["aClass"],
  2069. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2070. messageSends: ["=", "class"],
  2071. referencedClasses: []
  2072. }),
  2073. globals.Object);
  2074. smalltalk.addMethod(
  2075. smalltalk.method({
  2076. selector: "isMetaclass",
  2077. protocol: 'testing',
  2078. fn: function (){
  2079. var self=this;
  2080. return false;
  2081. },
  2082. args: [],
  2083. source: "isMetaclass\x0a\x09^ false",
  2084. messageSends: [],
  2085. referencedClasses: []
  2086. }),
  2087. globals.Object);
  2088. smalltalk.addMethod(
  2089. smalltalk.method({
  2090. selector: "isNil",
  2091. protocol: 'testing',
  2092. fn: function (){
  2093. var self=this;
  2094. return false;
  2095. },
  2096. args: [],
  2097. source: "isNil\x0a\x09^ false",
  2098. messageSends: [],
  2099. referencedClasses: []
  2100. }),
  2101. globals.Object);
  2102. smalltalk.addMethod(
  2103. smalltalk.method({
  2104. selector: "isNumber",
  2105. protocol: 'testing',
  2106. fn: function (){
  2107. var self=this;
  2108. return false;
  2109. },
  2110. args: [],
  2111. source: "isNumber\x0a\x09^ false",
  2112. messageSends: [],
  2113. referencedClasses: []
  2114. }),
  2115. globals.Object);
  2116. smalltalk.addMethod(
  2117. smalltalk.method({
  2118. selector: "isPackage",
  2119. protocol: 'testing',
  2120. fn: function (){
  2121. var self=this;
  2122. return false;
  2123. },
  2124. args: [],
  2125. source: "isPackage\x0a\x09^ false",
  2126. messageSends: [],
  2127. referencedClasses: []
  2128. }),
  2129. globals.Object);
  2130. smalltalk.addMethod(
  2131. smalltalk.method({
  2132. selector: "isParseFailure",
  2133. protocol: 'testing',
  2134. fn: function (){
  2135. var self=this;
  2136. return false;
  2137. },
  2138. args: [],
  2139. source: "isParseFailure\x0a\x09^ false",
  2140. messageSends: [],
  2141. referencedClasses: []
  2142. }),
  2143. globals.Object);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "isString",
  2147. protocol: 'testing',
  2148. fn: function (){
  2149. var self=this;
  2150. return false;
  2151. },
  2152. args: [],
  2153. source: "isString\x0a\x09^ false",
  2154. messageSends: [],
  2155. referencedClasses: []
  2156. }),
  2157. globals.Object);
  2158. smalltalk.addMethod(
  2159. smalltalk.method({
  2160. selector: "isSymbol",
  2161. protocol: 'testing',
  2162. fn: function (){
  2163. var self=this;
  2164. return false;
  2165. },
  2166. args: [],
  2167. source: "isSymbol\x0a\x09^ false",
  2168. messageSends: [],
  2169. referencedClasses: []
  2170. }),
  2171. globals.Object);
  2172. smalltalk.addMethod(
  2173. smalltalk.method({
  2174. selector: "notNil",
  2175. protocol: 'testing',
  2176. fn: function (){
  2177. var self=this;
  2178. return smalltalk.withContext(function($ctx1) {
  2179. var $1;
  2180. $1=_st(self._isNil())._not();
  2181. return $1;
  2182. }, function($ctx1) {$ctx1.fill(self,"notNil",{},globals.Object)})},
  2183. args: [],
  2184. source: "notNil\x0a\x09^ self isNil not",
  2185. messageSends: ["not", "isNil"],
  2186. referencedClasses: []
  2187. }),
  2188. globals.Object);
  2189. smalltalk.addMethod(
  2190. smalltalk.method({
  2191. selector: "postCopy",
  2192. protocol: 'copying',
  2193. fn: function (){
  2194. var self=this;
  2195. return self},
  2196. args: [],
  2197. source: "postCopy",
  2198. messageSends: [],
  2199. referencedClasses: []
  2200. }),
  2201. globals.Object);
  2202. smalltalk.addMethod(
  2203. smalltalk.method({
  2204. selector: "putOn:",
  2205. protocol: 'streaming',
  2206. fn: function (aStream){
  2207. var self=this;
  2208. return smalltalk.withContext(function($ctx1) {
  2209. _st(aStream)._nextPut_(self);
  2210. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Object)})},
  2211. args: ["aStream"],
  2212. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2213. messageSends: ["nextPut:"],
  2214. referencedClasses: []
  2215. }),
  2216. globals.Object);
  2217. smalltalk.addMethod(
  2218. smalltalk.method({
  2219. selector: "respondsTo:",
  2220. protocol: 'testing',
  2221. fn: function (aSelector){
  2222. var self=this;
  2223. return smalltalk.withContext(function($ctx1) {
  2224. var $1;
  2225. $1=_st(self._class())._canUnderstand_(aSelector);
  2226. return $1;
  2227. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},globals.Object)})},
  2228. args: ["aSelector"],
  2229. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2230. messageSends: ["canUnderstand:", "class"],
  2231. referencedClasses: []
  2232. }),
  2233. globals.Object);
  2234. smalltalk.addMethod(
  2235. smalltalk.method({
  2236. selector: "shallowCopy",
  2237. protocol: 'copying',
  2238. fn: function (){
  2239. var self=this;
  2240. return smalltalk.withContext(function($ctx1) {
  2241. var copy = self.klass._new();
  2242. Object.keys(self).forEach(function(i) {
  2243. if(/^@.+/.test(i)) {
  2244. copy[i] = self[i];
  2245. }
  2246. });
  2247. return copy;
  2248. ;
  2249. return self}, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.Object)})},
  2250. args: [],
  2251. source: "shallowCopy\x0a\x09<\x0a\x09\x09var copy = self.klass._new();\x0a\x09\x09Object.keys(self).forEach(function(i) {\x0a\x09\x09if(/^@.+/.test(i)) {\x0a\x09\x09\x09copy[i] = self[i];\x0a\x09\x09}\x0a\x09\x09});\x0a\x09\x09return copy;\x0a\x09>",
  2252. messageSends: [],
  2253. referencedClasses: []
  2254. }),
  2255. globals.Object);
  2256. smalltalk.addMethod(
  2257. smalltalk.method({
  2258. selector: "shouldNotImplement",
  2259. protocol: 'error handling',
  2260. fn: function (){
  2261. var self=this;
  2262. return smalltalk.withContext(function($ctx1) {
  2263. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  2264. return self}, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},globals.Object)})},
  2265. args: [],
  2266. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2267. messageSends: ["error:", ",", "name", "class"],
  2268. referencedClasses: []
  2269. }),
  2270. globals.Object);
  2271. smalltalk.addMethod(
  2272. smalltalk.method({
  2273. selector: "size",
  2274. protocol: 'accessing',
  2275. fn: function (){
  2276. var self=this;
  2277. return smalltalk.withContext(function($ctx1) {
  2278. self._error_("Object not indexable");
  2279. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Object)})},
  2280. args: [],
  2281. source: "size\x0a\x09self error: 'Object not indexable'",
  2282. messageSends: ["error:"],
  2283. referencedClasses: []
  2284. }),
  2285. globals.Object);
  2286. smalltalk.addMethod(
  2287. smalltalk.method({
  2288. selector: "subclassResponsibility",
  2289. protocol: 'error handling',
  2290. fn: function (){
  2291. var self=this;
  2292. return smalltalk.withContext(function($ctx1) {
  2293. self._error_("This method is a responsibility of a subclass");
  2294. return self}, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},globals.Object)})},
  2295. args: [],
  2296. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2297. messageSends: ["error:"],
  2298. referencedClasses: []
  2299. }),
  2300. globals.Object);
  2301. smalltalk.addMethod(
  2302. smalltalk.method({
  2303. selector: "throw:",
  2304. protocol: 'error handling',
  2305. fn: function (anObject){
  2306. var self=this;
  2307. return smalltalk.withContext(function($ctx1) {
  2308. throw anObject ;
  2309. return self}, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},globals.Object)})},
  2310. args: ["anObject"],
  2311. source: "throw: anObject\x0a\x09< throw anObject >",
  2312. messageSends: [],
  2313. referencedClasses: []
  2314. }),
  2315. globals.Object);
  2316. smalltalk.addMethod(
  2317. smalltalk.method({
  2318. selector: "try:catch:",
  2319. protocol: 'error handling',
  2320. fn: function (aBlock,anotherBlock){
  2321. var self=this;
  2322. return smalltalk.withContext(function($ctx1) {
  2323. var $1;
  2324. self._deprecatedAPI();
  2325. $1=_st(aBlock)._tryCatch_(anotherBlock);
  2326. return $1;
  2327. }, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)})},
  2328. args: ["aBlock", "anotherBlock"],
  2329. source: "try: aBlock catch: anotherBlock\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ aBlock tryCatch: anotherBlock",
  2330. messageSends: ["deprecatedAPI", "tryCatch:"],
  2331. referencedClasses: []
  2332. }),
  2333. globals.Object);
  2334. smalltalk.addMethod(
  2335. smalltalk.method({
  2336. selector: "value",
  2337. protocol: 'accessing',
  2338. fn: function (){
  2339. var self=this;
  2340. return smalltalk.withContext(function($ctx1) {
  2341. return self.valueOf();
  2342. return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.Object)})},
  2343. args: [],
  2344. source: "value\x0a\x09<return self.valueOf()>",
  2345. messageSends: [],
  2346. referencedClasses: []
  2347. }),
  2348. globals.Object);
  2349. smalltalk.addMethod(
  2350. smalltalk.method({
  2351. selector: "accessorProtocolWith:",
  2352. protocol: 'helios',
  2353. fn: function (aGenerator){
  2354. var self=this;
  2355. return smalltalk.withContext(function($ctx1) {
  2356. _st(aGenerator)._accessorProtocolForObject();
  2357. return self}, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2358. args: ["aGenerator"],
  2359. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2360. messageSends: ["accessorProtocolForObject"],
  2361. referencedClasses: []
  2362. }),
  2363. globals.Object.klass);
  2364. smalltalk.addMethod(
  2365. smalltalk.method({
  2366. selector: "accessorsSourceCodesWith:",
  2367. protocol: 'helios',
  2368. fn: function (aGenerator){
  2369. var self=this;
  2370. return smalltalk.withContext(function($ctx1) {
  2371. _st(aGenerator)._accessorsForObject();
  2372. return self}, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2373. args: ["aGenerator"],
  2374. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2375. messageSends: ["accessorsForObject"],
  2376. referencedClasses: []
  2377. }),
  2378. globals.Object.klass);
  2379. smalltalk.addMethod(
  2380. smalltalk.method({
  2381. selector: "heliosClass",
  2382. protocol: 'helios',
  2383. fn: function (){
  2384. var self=this;
  2385. return "class";
  2386. },
  2387. args: [],
  2388. 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'",
  2389. messageSends: [],
  2390. referencedClasses: []
  2391. }),
  2392. globals.Object.klass);
  2393. smalltalk.addMethod(
  2394. smalltalk.method({
  2395. selector: "initialize",
  2396. protocol: 'initialization',
  2397. fn: function (){
  2398. var self=this;
  2399. return self},
  2400. args: [],
  2401. source: "initialize\x0a\x09\x22no op\x22",
  2402. messageSends: [],
  2403. referencedClasses: []
  2404. }),
  2405. globals.Object.klass);
  2406. smalltalk.addMethod(
  2407. smalltalk.method({
  2408. selector: "initializeProtocolWith:",
  2409. protocol: 'helios',
  2410. fn: function (aGenerator){
  2411. var self=this;
  2412. return smalltalk.withContext(function($ctx1) {
  2413. _st(aGenerator)._initializeProtocolForObject();
  2414. return self}, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2415. args: ["aGenerator"],
  2416. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2417. messageSends: ["initializeProtocolForObject"],
  2418. referencedClasses: []
  2419. }),
  2420. globals.Object.klass);
  2421. smalltalk.addMethod(
  2422. smalltalk.method({
  2423. selector: "initializeSourceCodesWith:",
  2424. protocol: 'helios',
  2425. fn: function (aGenerator){
  2426. var self=this;
  2427. return smalltalk.withContext(function($ctx1) {
  2428. _st(aGenerator)._initializeForObject();
  2429. return self}, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)})},
  2430. args: ["aGenerator"],
  2431. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2432. messageSends: ["initializeForObject"],
  2433. referencedClasses: []
  2434. }),
  2435. globals.Object.klass);
  2436. smalltalk.addClass('Boolean', globals.Object, [], 'Kernel-Objects');
  2437. globals.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: [ ... ]";
  2438. smalltalk.addMethod(
  2439. smalltalk.method({
  2440. selector: "&",
  2441. protocol: 'controlling',
  2442. fn: function (aBoolean){
  2443. var self=this;
  2444. return smalltalk.withContext(function($ctx1) {
  2445. if(self == true) {
  2446. return aBoolean;
  2447. } else {
  2448. return false;
  2449. }
  2450. ;
  2451. return self}, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},globals.Boolean)})},
  2452. args: ["aBoolean"],
  2453. 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>",
  2454. messageSends: [],
  2455. referencedClasses: []
  2456. }),
  2457. globals.Boolean);
  2458. smalltalk.addMethod(
  2459. smalltalk.method({
  2460. selector: "=",
  2461. protocol: 'comparing',
  2462. fn: function (aBoolean){
  2463. var self=this;
  2464. return smalltalk.withContext(function($ctx1) {
  2465. return aBoolean != null &&
  2466. typeof aBoolean._isBoolean === "function" &&
  2467. aBoolean._isBoolean() &&
  2468. Boolean(self == true) == aBoolean
  2469. ;
  2470. return self}, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},globals.Boolean)})},
  2471. args: ["aBoolean"],
  2472. source: "= aBoolean\x0a\x09<\x0a\x09\x09return aBoolean != null &&\x0a\x09\x09\x09typeof aBoolean._isBoolean === \x22function\x22 &&\x0a\x09\x09\x09aBoolean._isBoolean() &&\x0a\x09\x09\x09Boolean(self == true) == aBoolean\x0a\x09>",
  2473. messageSends: [],
  2474. referencedClasses: []
  2475. }),
  2476. globals.Boolean);
  2477. smalltalk.addMethod(
  2478. smalltalk.method({
  2479. selector: "==",
  2480. protocol: 'comparing',
  2481. fn: function (aBoolean){
  2482. var self=this;
  2483. return smalltalk.withContext(function($ctx1) {
  2484. var $1;
  2485. $1=self.__eq(aBoolean);
  2486. return $1;
  2487. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},globals.Boolean)})},
  2488. args: ["aBoolean"],
  2489. source: "== aBoolean\x0a\x09^ self = aBoolean",
  2490. messageSends: ["="],
  2491. referencedClasses: []
  2492. }),
  2493. globals.Boolean);
  2494. smalltalk.addMethod(
  2495. smalltalk.method({
  2496. selector: "and:",
  2497. protocol: 'controlling',
  2498. fn: function (aBlock){
  2499. var self=this;
  2500. return smalltalk.withContext(function($ctx1) {
  2501. var $2,$1;
  2502. $2=self.__eq(true);
  2503. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2504. return false;
  2505. }));
  2506. return $1;
  2507. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},globals.Boolean)})},
  2508. args: ["aBlock"],
  2509. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2510. messageSends: ["ifTrue:ifFalse:", "="],
  2511. referencedClasses: []
  2512. }),
  2513. globals.Boolean);
  2514. smalltalk.addMethod(
  2515. smalltalk.method({
  2516. selector: "asBit",
  2517. protocol: 'converting',
  2518. fn: function (){
  2519. var self=this;
  2520. return smalltalk.withContext(function($ctx1) {
  2521. var $1;
  2522. if(smalltalk.assert(self)){
  2523. $1=(1);
  2524. } else {
  2525. $1=(0);
  2526. };
  2527. return $1;
  2528. }, function($ctx1) {$ctx1.fill(self,"asBit",{},globals.Boolean)})},
  2529. args: [],
  2530. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  2531. messageSends: ["ifTrue:ifFalse:"],
  2532. referencedClasses: []
  2533. }),
  2534. globals.Boolean);
  2535. smalltalk.addMethod(
  2536. smalltalk.method({
  2537. selector: "asJSON",
  2538. protocol: 'converting',
  2539. fn: function (){
  2540. var self=this;
  2541. return self;
  2542. },
  2543. args: [],
  2544. source: "asJSON\x0a\x09^ self",
  2545. messageSends: [],
  2546. referencedClasses: []
  2547. }),
  2548. globals.Boolean);
  2549. smalltalk.addMethod(
  2550. smalltalk.method({
  2551. selector: "asString",
  2552. protocol: 'converting',
  2553. fn: function (){
  2554. var self=this;
  2555. return smalltalk.withContext(function($ctx1) {
  2556. return self.toString() ;
  2557. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Boolean)})},
  2558. args: [],
  2559. source: "asString\x0a\x09< return self.toString() >",
  2560. messageSends: [],
  2561. referencedClasses: []
  2562. }),
  2563. globals.Boolean);
  2564. smalltalk.addMethod(
  2565. smalltalk.method({
  2566. selector: "deepCopy",
  2567. protocol: 'copying',
  2568. fn: function (){
  2569. var self=this;
  2570. return self;
  2571. },
  2572. args: [],
  2573. source: "deepCopy\x0a\x09^ self",
  2574. messageSends: [],
  2575. referencedClasses: []
  2576. }),
  2577. globals.Boolean);
  2578. smalltalk.addMethod(
  2579. smalltalk.method({
  2580. selector: "ifFalse:",
  2581. protocol: 'controlling',
  2582. fn: function (aBlock){
  2583. var self=this;
  2584. return smalltalk.withContext(function($ctx1) {
  2585. var $1;
  2586. $1=self._ifTrue_ifFalse_((function(){
  2587. }),aBlock);
  2588. return $1;
  2589. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},globals.Boolean)})},
  2590. args: ["aBlock"],
  2591. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  2592. messageSends: ["ifTrue:ifFalse:"],
  2593. referencedClasses: []
  2594. }),
  2595. globals.Boolean);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "ifFalse:ifTrue:",
  2599. protocol: 'controlling',
  2600. fn: function (aBlock,anotherBlock){
  2601. var self=this;
  2602. return smalltalk.withContext(function($ctx1) {
  2603. var $1;
  2604. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  2605. return $1;
  2606. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
  2607. args: ["aBlock", "anotherBlock"],
  2608. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  2609. messageSends: ["ifTrue:ifFalse:"],
  2610. referencedClasses: []
  2611. }),
  2612. globals.Boolean);
  2613. smalltalk.addMethod(
  2614. smalltalk.method({
  2615. selector: "ifTrue:",
  2616. protocol: 'controlling',
  2617. fn: function (aBlock){
  2618. var self=this;
  2619. return smalltalk.withContext(function($ctx1) {
  2620. var $1;
  2621. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  2622. }));
  2623. return $1;
  2624. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},globals.Boolean)})},
  2625. args: ["aBlock"],
  2626. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  2627. messageSends: ["ifTrue:ifFalse:"],
  2628. referencedClasses: []
  2629. }),
  2630. globals.Boolean);
  2631. smalltalk.addMethod(
  2632. smalltalk.method({
  2633. selector: "ifTrue:ifFalse:",
  2634. protocol: 'controlling',
  2635. fn: function (aBlock,anotherBlock){
  2636. var self=this;
  2637. return smalltalk.withContext(function($ctx1) {
  2638. if(self == true) {
  2639. return aBlock._value();
  2640. } else {
  2641. return anotherBlock._value();
  2642. }
  2643. ;
  2644. return self}, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)})},
  2645. args: ["aBlock", "anotherBlock"],
  2646. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  2647. messageSends: [],
  2648. referencedClasses: []
  2649. }),
  2650. globals.Boolean);
  2651. smalltalk.addMethod(
  2652. smalltalk.method({
  2653. selector: "isBoolean",
  2654. protocol: 'testing',
  2655. fn: function (){
  2656. var self=this;
  2657. return true;
  2658. },
  2659. args: [],
  2660. source: "isBoolean\x0a\x09^ true",
  2661. messageSends: [],
  2662. referencedClasses: []
  2663. }),
  2664. globals.Boolean);
  2665. smalltalk.addMethod(
  2666. smalltalk.method({
  2667. selector: "isImmutable",
  2668. protocol: 'testing',
  2669. fn: function (){
  2670. var self=this;
  2671. return true;
  2672. },
  2673. args: [],
  2674. source: "isImmutable\x0a\x09^ true",
  2675. messageSends: [],
  2676. referencedClasses: []
  2677. }),
  2678. globals.Boolean);
  2679. smalltalk.addMethod(
  2680. smalltalk.method({
  2681. selector: "not",
  2682. protocol: 'controlling',
  2683. fn: function (){
  2684. var self=this;
  2685. return smalltalk.withContext(function($ctx1) {
  2686. var $1;
  2687. $1=self.__eq(false);
  2688. return $1;
  2689. }, function($ctx1) {$ctx1.fill(self,"not",{},globals.Boolean)})},
  2690. args: [],
  2691. source: "not\x0a\x09^ self = false",
  2692. messageSends: ["="],
  2693. referencedClasses: []
  2694. }),
  2695. globals.Boolean);
  2696. smalltalk.addMethod(
  2697. smalltalk.method({
  2698. selector: "or:",
  2699. protocol: 'controlling',
  2700. fn: function (aBlock){
  2701. var self=this;
  2702. return smalltalk.withContext(function($ctx1) {
  2703. var $2,$1;
  2704. $2=self.__eq(true);
  2705. $1=_st($2)._ifTrue_ifFalse_((function(){
  2706. return true;
  2707. }),aBlock);
  2708. return $1;
  2709. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},globals.Boolean)})},
  2710. args: ["aBlock"],
  2711. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  2712. messageSends: ["ifTrue:ifFalse:", "="],
  2713. referencedClasses: []
  2714. }),
  2715. globals.Boolean);
  2716. smalltalk.addMethod(
  2717. smalltalk.method({
  2718. selector: "printOn:",
  2719. protocol: 'printing',
  2720. fn: function (aStream){
  2721. var self=this;
  2722. return smalltalk.withContext(function($ctx1) {
  2723. _st(aStream)._nextPutAll_(self._asString());
  2724. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Boolean)})},
  2725. args: ["aStream"],
  2726. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  2727. messageSends: ["nextPutAll:", "asString"],
  2728. referencedClasses: []
  2729. }),
  2730. globals.Boolean);
  2731. smalltalk.addMethod(
  2732. smalltalk.method({
  2733. selector: "shallowCopy",
  2734. protocol: 'copying',
  2735. fn: function (){
  2736. var self=this;
  2737. return self;
  2738. },
  2739. args: [],
  2740. source: "shallowCopy\x0a\x09^ self",
  2741. messageSends: [],
  2742. referencedClasses: []
  2743. }),
  2744. globals.Boolean);
  2745. smalltalk.addMethod(
  2746. smalltalk.method({
  2747. selector: "|",
  2748. protocol: 'controlling',
  2749. fn: function (aBoolean){
  2750. var self=this;
  2751. return smalltalk.withContext(function($ctx1) {
  2752. if(self == true) {
  2753. return true;
  2754. } else {
  2755. return aBoolean;
  2756. }
  2757. ;
  2758. return self}, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},globals.Boolean)})},
  2759. args: ["aBoolean"],
  2760. 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>",
  2761. messageSends: [],
  2762. referencedClasses: []
  2763. }),
  2764. globals.Boolean);
  2765. smalltalk.addClass('Date', globals.Object, [], 'Kernel-Objects');
  2766. globals.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.).";
  2767. smalltalk.addMethod(
  2768. smalltalk.method({
  2769. selector: "+",
  2770. protocol: 'arithmetic',
  2771. fn: function (aDate){
  2772. var self=this;
  2773. return smalltalk.withContext(function($ctx1) {
  2774. return self + aDate;
  2775. return self}, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},globals.Date)})},
  2776. args: ["aDate"],
  2777. source: "+ aDate\x0a\x09<return self + aDate>",
  2778. messageSends: [],
  2779. referencedClasses: []
  2780. }),
  2781. globals.Date);
  2782. smalltalk.addMethod(
  2783. smalltalk.method({
  2784. selector: "-",
  2785. protocol: 'arithmetic',
  2786. fn: function (aDate){
  2787. var self=this;
  2788. return smalltalk.withContext(function($ctx1) {
  2789. return self - aDate;
  2790. return self}, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},globals.Date)})},
  2791. args: ["aDate"],
  2792. source: "- aDate\x0a\x09<return self - aDate>",
  2793. messageSends: [],
  2794. referencedClasses: []
  2795. }),
  2796. globals.Date);
  2797. smalltalk.addMethod(
  2798. smalltalk.method({
  2799. selector: "<",
  2800. protocol: 'comparing',
  2801. fn: function (aDate){
  2802. var self=this;
  2803. return smalltalk.withContext(function($ctx1) {
  2804. return self < aDate;
  2805. return self}, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},globals.Date)})},
  2806. args: ["aDate"],
  2807. source: "< aDate\x0a\x09<return self < aDate>",
  2808. messageSends: [],
  2809. referencedClasses: []
  2810. }),
  2811. globals.Date);
  2812. smalltalk.addMethod(
  2813. smalltalk.method({
  2814. selector: "<=",
  2815. protocol: 'comparing',
  2816. fn: function (aDate){
  2817. var self=this;
  2818. return smalltalk.withContext(function($ctx1) {
  2819. return self <= aDate;
  2820. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},globals.Date)})},
  2821. args: ["aDate"],
  2822. source: "<= aDate\x0a\x09<return self <= aDate>",
  2823. messageSends: [],
  2824. referencedClasses: []
  2825. }),
  2826. globals.Date);
  2827. smalltalk.addMethod(
  2828. smalltalk.method({
  2829. selector: ">",
  2830. protocol: 'comparing',
  2831. fn: function (aDate){
  2832. var self=this;
  2833. return smalltalk.withContext(function($ctx1) {
  2834. return self > aDate;
  2835. return self}, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},globals.Date)})},
  2836. args: ["aDate"],
  2837. source: "> aDate\x0a\x09<return self >> aDate>",
  2838. messageSends: [],
  2839. referencedClasses: []
  2840. }),
  2841. globals.Date);
  2842. smalltalk.addMethod(
  2843. smalltalk.method({
  2844. selector: ">=",
  2845. protocol: 'comparing',
  2846. fn: function (aDate){
  2847. var self=this;
  2848. return smalltalk.withContext(function($ctx1) {
  2849. return self >= aDate;
  2850. return self}, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},globals.Date)})},
  2851. args: ["aDate"],
  2852. source: ">= aDate\x0a\x09<return self >>= aDate>",
  2853. messageSends: [],
  2854. referencedClasses: []
  2855. }),
  2856. globals.Date);
  2857. smalltalk.addMethod(
  2858. smalltalk.method({
  2859. selector: "asDateString",
  2860. protocol: 'converting',
  2861. fn: function (){
  2862. var self=this;
  2863. return smalltalk.withContext(function($ctx1) {
  2864. return self.toDateString();
  2865. return self}, function($ctx1) {$ctx1.fill(self,"asDateString",{},globals.Date)})},
  2866. args: [],
  2867. source: "asDateString\x0a\x09<return self.toDateString()>",
  2868. messageSends: [],
  2869. referencedClasses: []
  2870. }),
  2871. globals.Date);
  2872. smalltalk.addMethod(
  2873. smalltalk.method({
  2874. selector: "asLocaleString",
  2875. protocol: 'converting',
  2876. fn: function (){
  2877. var self=this;
  2878. return smalltalk.withContext(function($ctx1) {
  2879. return self.toLocaleString();
  2880. return self}, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},globals.Date)})},
  2881. args: [],
  2882. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  2883. messageSends: [],
  2884. referencedClasses: []
  2885. }),
  2886. globals.Date);
  2887. smalltalk.addMethod(
  2888. smalltalk.method({
  2889. selector: "asMilliseconds",
  2890. protocol: 'converting',
  2891. fn: function (){
  2892. var self=this;
  2893. return smalltalk.withContext(function($ctx1) {
  2894. var $1;
  2895. $1=self._time();
  2896. return $1;
  2897. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},globals.Date)})},
  2898. args: [],
  2899. source: "asMilliseconds\x0a\x09^ self time",
  2900. messageSends: ["time"],
  2901. referencedClasses: []
  2902. }),
  2903. globals.Date);
  2904. smalltalk.addMethod(
  2905. smalltalk.method({
  2906. selector: "asNumber",
  2907. protocol: 'converting',
  2908. fn: function (){
  2909. var self=this;
  2910. return smalltalk.withContext(function($ctx1) {
  2911. var $1;
  2912. $1=self._asMilliseconds();
  2913. return $1;
  2914. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.Date)})},
  2915. args: [],
  2916. source: "asNumber\x0a\x09^ self asMilliseconds",
  2917. messageSends: ["asMilliseconds"],
  2918. referencedClasses: []
  2919. }),
  2920. globals.Date);
  2921. smalltalk.addMethod(
  2922. smalltalk.method({
  2923. selector: "asString",
  2924. protocol: 'converting',
  2925. fn: function (){
  2926. var self=this;
  2927. return smalltalk.withContext(function($ctx1) {
  2928. return self.toString();
  2929. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Date)})},
  2930. args: [],
  2931. source: "asString\x0a\x09<return self.toString()>",
  2932. messageSends: [],
  2933. referencedClasses: []
  2934. }),
  2935. globals.Date);
  2936. smalltalk.addMethod(
  2937. smalltalk.method({
  2938. selector: "asTimeString",
  2939. protocol: 'converting',
  2940. fn: function (){
  2941. var self=this;
  2942. return smalltalk.withContext(function($ctx1) {
  2943. return self.toTimeString();
  2944. return self}, function($ctx1) {$ctx1.fill(self,"asTimeString",{},globals.Date)})},
  2945. args: [],
  2946. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  2947. messageSends: [],
  2948. referencedClasses: []
  2949. }),
  2950. globals.Date);
  2951. smalltalk.addMethod(
  2952. smalltalk.method({
  2953. selector: "day",
  2954. protocol: 'accessing',
  2955. fn: function (){
  2956. var self=this;
  2957. return smalltalk.withContext(function($ctx1) {
  2958. var $1;
  2959. $1=self._dayOfWeek();
  2960. return $1;
  2961. }, function($ctx1) {$ctx1.fill(self,"day",{},globals.Date)})},
  2962. args: [],
  2963. source: "day\x0a\x09^ self dayOfWeek",
  2964. messageSends: ["dayOfWeek"],
  2965. referencedClasses: []
  2966. }),
  2967. globals.Date);
  2968. smalltalk.addMethod(
  2969. smalltalk.method({
  2970. selector: "day:",
  2971. protocol: 'accessing',
  2972. fn: function (aNumber){
  2973. var self=this;
  2974. return smalltalk.withContext(function($ctx1) {
  2975. self._dayOfWeek_(aNumber);
  2976. return self}, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},globals.Date)})},
  2977. args: ["aNumber"],
  2978. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  2979. messageSends: ["dayOfWeek:"],
  2980. referencedClasses: []
  2981. }),
  2982. globals.Date);
  2983. smalltalk.addMethod(
  2984. smalltalk.method({
  2985. selector: "dayOfMonth",
  2986. protocol: 'accessing',
  2987. fn: function (){
  2988. var self=this;
  2989. return smalltalk.withContext(function($ctx1) {
  2990. return self.getDate();
  2991. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},globals.Date)})},
  2992. args: [],
  2993. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  2994. messageSends: [],
  2995. referencedClasses: []
  2996. }),
  2997. globals.Date);
  2998. smalltalk.addMethod(
  2999. smalltalk.method({
  3000. selector: "dayOfMonth:",
  3001. protocol: 'accessing',
  3002. fn: function (aNumber){
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) {
  3005. self.setDate(aNumber);
  3006. return self}, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},globals.Date)})},
  3007. args: ["aNumber"],
  3008. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3009. messageSends: [],
  3010. referencedClasses: []
  3011. }),
  3012. globals.Date);
  3013. smalltalk.addMethod(
  3014. smalltalk.method({
  3015. selector: "dayOfWeek",
  3016. protocol: 'accessing',
  3017. fn: function (){
  3018. var self=this;
  3019. return smalltalk.withContext(function($ctx1) {
  3020. return self.getDay() + 1;
  3021. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},globals.Date)})},
  3022. args: [],
  3023. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3024. messageSends: [],
  3025. referencedClasses: []
  3026. }),
  3027. globals.Date);
  3028. smalltalk.addMethod(
  3029. smalltalk.method({
  3030. selector: "dayOfWeek:",
  3031. protocol: 'accessing',
  3032. fn: function (aNumber){
  3033. var self=this;
  3034. return smalltalk.withContext(function($ctx1) {
  3035. return self.setDay(aNumber - 1);
  3036. return self}, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},globals.Date)})},
  3037. args: ["aNumber"],
  3038. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3039. messageSends: [],
  3040. referencedClasses: []
  3041. }),
  3042. globals.Date);
  3043. smalltalk.addMethod(
  3044. smalltalk.method({
  3045. selector: "hours",
  3046. protocol: 'accessing',
  3047. fn: function (){
  3048. var self=this;
  3049. return smalltalk.withContext(function($ctx1) {
  3050. return self.getHours();
  3051. return self}, function($ctx1) {$ctx1.fill(self,"hours",{},globals.Date)})},
  3052. args: [],
  3053. source: "hours\x0a\x09<return self.getHours()>",
  3054. messageSends: [],
  3055. referencedClasses: []
  3056. }),
  3057. globals.Date);
  3058. smalltalk.addMethod(
  3059. smalltalk.method({
  3060. selector: "hours:",
  3061. protocol: 'accessing',
  3062. fn: function (aNumber){
  3063. var self=this;
  3064. return smalltalk.withContext(function($ctx1) {
  3065. self.setHours(aNumber);
  3066. return self}, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},globals.Date)})},
  3067. args: ["aNumber"],
  3068. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3069. messageSends: [],
  3070. referencedClasses: []
  3071. }),
  3072. globals.Date);
  3073. smalltalk.addMethod(
  3074. smalltalk.method({
  3075. selector: "milliseconds",
  3076. protocol: 'accessing',
  3077. fn: function (){
  3078. var self=this;
  3079. return smalltalk.withContext(function($ctx1) {
  3080. return self.getMilliseconds();
  3081. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds",{},globals.Date)})},
  3082. args: [],
  3083. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3084. messageSends: [],
  3085. referencedClasses: []
  3086. }),
  3087. globals.Date);
  3088. smalltalk.addMethod(
  3089. smalltalk.method({
  3090. selector: "milliseconds:",
  3091. protocol: 'accessing',
  3092. fn: function (aNumber){
  3093. var self=this;
  3094. return smalltalk.withContext(function($ctx1) {
  3095. self.setMilliseconds(aNumber);
  3096. return self}, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},globals.Date)})},
  3097. args: ["aNumber"],
  3098. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3099. messageSends: [],
  3100. referencedClasses: []
  3101. }),
  3102. globals.Date);
  3103. smalltalk.addMethod(
  3104. smalltalk.method({
  3105. selector: "minutes",
  3106. protocol: 'accessing',
  3107. fn: function (){
  3108. var self=this;
  3109. return smalltalk.withContext(function($ctx1) {
  3110. return self.getMinutes();
  3111. return self}, function($ctx1) {$ctx1.fill(self,"minutes",{},globals.Date)})},
  3112. args: [],
  3113. source: "minutes\x0a\x09<return self.getMinutes()>",
  3114. messageSends: [],
  3115. referencedClasses: []
  3116. }),
  3117. globals.Date);
  3118. smalltalk.addMethod(
  3119. smalltalk.method({
  3120. selector: "minutes:",
  3121. protocol: 'accessing',
  3122. fn: function (aNumber){
  3123. var self=this;
  3124. return smalltalk.withContext(function($ctx1) {
  3125. self.setMinutes(aNumber);
  3126. return self}, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},globals.Date)})},
  3127. args: ["aNumber"],
  3128. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3129. messageSends: [],
  3130. referencedClasses: []
  3131. }),
  3132. globals.Date);
  3133. smalltalk.addMethod(
  3134. smalltalk.method({
  3135. selector: "month",
  3136. protocol: 'accessing',
  3137. fn: function (){
  3138. var self=this;
  3139. return smalltalk.withContext(function($ctx1) {
  3140. return self.getMonth() + 1;
  3141. return self}, function($ctx1) {$ctx1.fill(self,"month",{},globals.Date)})},
  3142. args: [],
  3143. source: "month\x0a\x09<return self.getMonth() + 1>",
  3144. messageSends: [],
  3145. referencedClasses: []
  3146. }),
  3147. globals.Date);
  3148. smalltalk.addMethod(
  3149. smalltalk.method({
  3150. selector: "month:",
  3151. protocol: 'accessing',
  3152. fn: function (aNumber){
  3153. var self=this;
  3154. return smalltalk.withContext(function($ctx1) {
  3155. self.setMonth(aNumber - 1);
  3156. return self}, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},globals.Date)})},
  3157. args: ["aNumber"],
  3158. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3159. messageSends: [],
  3160. referencedClasses: []
  3161. }),
  3162. globals.Date);
  3163. smalltalk.addMethod(
  3164. smalltalk.method({
  3165. selector: "printOn:",
  3166. protocol: 'printing',
  3167. fn: function (aStream){
  3168. var self=this;
  3169. return smalltalk.withContext(function($ctx1) {
  3170. _st(aStream)._nextPutAll_(self._asString());
  3171. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Date)})},
  3172. args: ["aStream"],
  3173. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3174. messageSends: ["nextPutAll:", "asString"],
  3175. referencedClasses: []
  3176. }),
  3177. globals.Date);
  3178. smalltalk.addMethod(
  3179. smalltalk.method({
  3180. selector: "seconds",
  3181. protocol: 'accessing',
  3182. fn: function (){
  3183. var self=this;
  3184. return smalltalk.withContext(function($ctx1) {
  3185. return self.getSeconds();
  3186. return self}, function($ctx1) {$ctx1.fill(self,"seconds",{},globals.Date)})},
  3187. args: [],
  3188. source: "seconds\x0a\x09<return self.getSeconds()>",
  3189. messageSends: [],
  3190. referencedClasses: []
  3191. }),
  3192. globals.Date);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "seconds:",
  3196. protocol: 'accessing',
  3197. fn: function (aNumber){
  3198. var self=this;
  3199. return smalltalk.withContext(function($ctx1) {
  3200. self.setSeconds(aNumber);
  3201. return self}, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},globals.Date)})},
  3202. args: ["aNumber"],
  3203. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3204. messageSends: [],
  3205. referencedClasses: []
  3206. }),
  3207. globals.Date);
  3208. smalltalk.addMethod(
  3209. smalltalk.method({
  3210. selector: "time",
  3211. protocol: 'accessing',
  3212. fn: function (){
  3213. var self=this;
  3214. return smalltalk.withContext(function($ctx1) {
  3215. return self.getTime();
  3216. return self}, function($ctx1) {$ctx1.fill(self,"time",{},globals.Date)})},
  3217. args: [],
  3218. source: "time\x0a\x09<return self.getTime()>",
  3219. messageSends: [],
  3220. referencedClasses: []
  3221. }),
  3222. globals.Date);
  3223. smalltalk.addMethod(
  3224. smalltalk.method({
  3225. selector: "time:",
  3226. protocol: 'accessing',
  3227. fn: function (aNumber){
  3228. var self=this;
  3229. return smalltalk.withContext(function($ctx1) {
  3230. self.setTime(aNumber);
  3231. return self}, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},globals.Date)})},
  3232. args: ["aNumber"],
  3233. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3234. messageSends: [],
  3235. referencedClasses: []
  3236. }),
  3237. globals.Date);
  3238. smalltalk.addMethod(
  3239. smalltalk.method({
  3240. selector: "year",
  3241. protocol: 'accessing',
  3242. fn: function (){
  3243. var self=this;
  3244. return smalltalk.withContext(function($ctx1) {
  3245. return self.getFullYear();
  3246. return self}, function($ctx1) {$ctx1.fill(self,"year",{},globals.Date)})},
  3247. args: [],
  3248. source: "year\x0a\x09<return self.getFullYear()>",
  3249. messageSends: [],
  3250. referencedClasses: []
  3251. }),
  3252. globals.Date);
  3253. smalltalk.addMethod(
  3254. smalltalk.method({
  3255. selector: "year:",
  3256. protocol: 'accessing',
  3257. fn: function (aNumber){
  3258. var self=this;
  3259. return smalltalk.withContext(function($ctx1) {
  3260. self.setFullYear(aNumber);
  3261. return self}, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},globals.Date)})},
  3262. args: ["aNumber"],
  3263. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3264. messageSends: [],
  3265. referencedClasses: []
  3266. }),
  3267. globals.Date);
  3268. smalltalk.addMethod(
  3269. smalltalk.method({
  3270. selector: "fromMilliseconds:",
  3271. protocol: 'instance creation',
  3272. fn: function (aNumber){
  3273. var self=this;
  3274. return smalltalk.withContext(function($ctx1) {
  3275. var $1;
  3276. $1=self._new_(aNumber);
  3277. return $1;
  3278. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},globals.Date.klass)})},
  3279. args: ["aNumber"],
  3280. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3281. messageSends: ["new:"],
  3282. referencedClasses: []
  3283. }),
  3284. globals.Date.klass);
  3285. smalltalk.addMethod(
  3286. smalltalk.method({
  3287. selector: "fromSeconds:",
  3288. protocol: 'instance creation',
  3289. fn: function (aNumber){
  3290. var self=this;
  3291. return smalltalk.withContext(function($ctx1) {
  3292. var $1;
  3293. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  3294. return $1;
  3295. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},globals.Date.klass)})},
  3296. args: ["aNumber"],
  3297. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3298. messageSends: ["fromMilliseconds:", "*"],
  3299. referencedClasses: []
  3300. }),
  3301. globals.Date.klass);
  3302. smalltalk.addMethod(
  3303. smalltalk.method({
  3304. selector: "fromString:",
  3305. protocol: 'instance creation',
  3306. fn: function (aString){
  3307. var self=this;
  3308. return smalltalk.withContext(function($ctx1) {
  3309. var $1;
  3310. $1=self._new_(aString);
  3311. return $1;
  3312. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.Date.klass)})},
  3313. args: ["aString"],
  3314. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3315. messageSends: ["new:"],
  3316. referencedClasses: []
  3317. }),
  3318. globals.Date.klass);
  3319. smalltalk.addMethod(
  3320. smalltalk.method({
  3321. selector: "heliosClass",
  3322. protocol: 'helios',
  3323. fn: function (){
  3324. var self=this;
  3325. return "magnitude";
  3326. },
  3327. args: [],
  3328. source: "heliosClass\x0a\x09^ 'magnitude'",
  3329. messageSends: [],
  3330. referencedClasses: []
  3331. }),
  3332. globals.Date.klass);
  3333. smalltalk.addMethod(
  3334. smalltalk.method({
  3335. selector: "millisecondsToRun:",
  3336. protocol: 'instance creation',
  3337. fn: function (aBlock){
  3338. var self=this;
  3339. var t;
  3340. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  3341. return smalltalk.withContext(function($ctx1) {
  3342. var $1;
  3343. t=_st($Date())._now();
  3344. $ctx1.sendIdx["now"]=1;
  3345. _st(aBlock)._value();
  3346. $1=_st(_st($Date())._now()).__minus(t);
  3347. return $1;
  3348. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},globals.Date.klass)})},
  3349. args: ["aBlock"],
  3350. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3351. messageSends: ["now", "value", "-"],
  3352. referencedClasses: ["Date"]
  3353. }),
  3354. globals.Date.klass);
  3355. smalltalk.addMethod(
  3356. smalltalk.method({
  3357. selector: "new:",
  3358. protocol: 'instance creation',
  3359. fn: function (anObject){
  3360. var self=this;
  3361. return smalltalk.withContext(function($ctx1) {
  3362. return new Date(anObject);
  3363. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},globals.Date.klass)})},
  3364. args: ["anObject"],
  3365. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3366. messageSends: [],
  3367. referencedClasses: []
  3368. }),
  3369. globals.Date.klass);
  3370. smalltalk.addMethod(
  3371. smalltalk.method({
  3372. selector: "now",
  3373. protocol: 'instance creation',
  3374. fn: function (){
  3375. var self=this;
  3376. return smalltalk.withContext(function($ctx1) {
  3377. var $1;
  3378. $1=self._today();
  3379. return $1;
  3380. }, function($ctx1) {$ctx1.fill(self,"now",{},globals.Date.klass)})},
  3381. args: [],
  3382. source: "now\x0a\x09^ self today",
  3383. messageSends: ["today"],
  3384. referencedClasses: []
  3385. }),
  3386. globals.Date.klass);
  3387. smalltalk.addMethod(
  3388. smalltalk.method({
  3389. selector: "today",
  3390. protocol: 'instance creation',
  3391. fn: function (){
  3392. var self=this;
  3393. return smalltalk.withContext(function($ctx1) {
  3394. var $1;
  3395. $1=self._new();
  3396. return $1;
  3397. }, function($ctx1) {$ctx1.fill(self,"today",{},globals.Date.klass)})},
  3398. args: [],
  3399. source: "today\x0a\x09^ self new",
  3400. messageSends: ["new"],
  3401. referencedClasses: []
  3402. }),
  3403. globals.Date.klass);
  3404. smalltalk.addClass('Number', globals.Object, [], 'Kernel-Objects');
  3405. globals.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 ].";
  3406. smalltalk.addMethod(
  3407. smalltalk.method({
  3408. selector: "&",
  3409. protocol: 'converting',
  3410. fn: function (aNumber){
  3411. var self=this;
  3412. return smalltalk.withContext(function($ctx1) {
  3413. return self & aNumber;
  3414. return self}, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},globals.Number)})},
  3415. args: ["aNumber"],
  3416. source: "& aNumber\x0a\x09<return self & aNumber>",
  3417. messageSends: [],
  3418. referencedClasses: []
  3419. }),
  3420. globals.Number);
  3421. smalltalk.addMethod(
  3422. smalltalk.method({
  3423. selector: "*",
  3424. protocol: 'arithmetic',
  3425. fn: function (aNumber){
  3426. var self=this;
  3427. return smalltalk.withContext(function($ctx1) {
  3428. return self * aNumber;
  3429. return self}, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},globals.Number)})},
  3430. args: ["aNumber"],
  3431. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3432. messageSends: [],
  3433. referencedClasses: []
  3434. }),
  3435. globals.Number);
  3436. smalltalk.addMethod(
  3437. smalltalk.method({
  3438. selector: "**",
  3439. protocol: 'mathematical functions',
  3440. fn: function (exponent){
  3441. var self=this;
  3442. return smalltalk.withContext(function($ctx1) {
  3443. var $1;
  3444. $1=self._raisedTo_(exponent);
  3445. return $1;
  3446. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},globals.Number)})},
  3447. args: ["exponent"],
  3448. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  3449. messageSends: ["raisedTo:"],
  3450. referencedClasses: []
  3451. }),
  3452. globals.Number);
  3453. smalltalk.addMethod(
  3454. smalltalk.method({
  3455. selector: "+",
  3456. protocol: 'arithmetic',
  3457. fn: function (aNumber){
  3458. var self=this;
  3459. return smalltalk.withContext(function($ctx1) {
  3460. return self + aNumber;
  3461. return self}, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},globals.Number)})},
  3462. args: ["aNumber"],
  3463. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  3464. messageSends: [],
  3465. referencedClasses: []
  3466. }),
  3467. globals.Number);
  3468. smalltalk.addMethod(
  3469. smalltalk.method({
  3470. selector: "-",
  3471. protocol: 'arithmetic',
  3472. fn: function (aNumber){
  3473. var self=this;
  3474. return smalltalk.withContext(function($ctx1) {
  3475. return self - aNumber;
  3476. return self}, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},globals.Number)})},
  3477. args: ["aNumber"],
  3478. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  3479. messageSends: [],
  3480. referencedClasses: []
  3481. }),
  3482. globals.Number);
  3483. smalltalk.addMethod(
  3484. smalltalk.method({
  3485. selector: "/",
  3486. protocol: 'arithmetic',
  3487. fn: function (aNumber){
  3488. var self=this;
  3489. return smalltalk.withContext(function($ctx1) {
  3490. return self / aNumber;
  3491. return self}, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},globals.Number)})},
  3492. args: ["aNumber"],
  3493. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  3494. messageSends: [],
  3495. referencedClasses: []
  3496. }),
  3497. globals.Number);
  3498. smalltalk.addMethod(
  3499. smalltalk.method({
  3500. selector: "//",
  3501. protocol: 'arithmetic',
  3502. fn: function (aNumber){
  3503. var self=this;
  3504. return smalltalk.withContext(function($ctx1) {
  3505. var $1;
  3506. $1=_st(self.__slash(aNumber))._floor();
  3507. return $1;
  3508. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},globals.Number)})},
  3509. args: ["aNumber"],
  3510. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  3511. messageSends: ["floor", "/"],
  3512. referencedClasses: []
  3513. }),
  3514. globals.Number);
  3515. smalltalk.addMethod(
  3516. smalltalk.method({
  3517. selector: "<",
  3518. protocol: 'comparing',
  3519. fn: function (aNumber){
  3520. var self=this;
  3521. return smalltalk.withContext(function($ctx1) {
  3522. return self < aNumber;
  3523. return self}, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},globals.Number)})},
  3524. args: ["aNumber"],
  3525. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  3526. messageSends: [],
  3527. referencedClasses: []
  3528. }),
  3529. globals.Number);
  3530. smalltalk.addMethod(
  3531. smalltalk.method({
  3532. selector: "<=",
  3533. protocol: 'comparing',
  3534. fn: function (aNumber){
  3535. var self=this;
  3536. return smalltalk.withContext(function($ctx1) {
  3537. return self <= aNumber;
  3538. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},globals.Number)})},
  3539. args: ["aNumber"],
  3540. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  3541. messageSends: [],
  3542. referencedClasses: []
  3543. }),
  3544. globals.Number);
  3545. smalltalk.addMethod(
  3546. smalltalk.method({
  3547. selector: "=",
  3548. protocol: 'comparing',
  3549. fn: function (aNumber){
  3550. var self=this;
  3551. return smalltalk.withContext(function($ctx1) {
  3552. return aNumber != null &&
  3553. typeof aNumber._isNumber === "function" &&
  3554. aNumber._isNumber() &&
  3555. Number(self) == aNumber
  3556. ;
  3557. return self}, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},globals.Number)})},
  3558. args: ["aNumber"],
  3559. source: "= aNumber\x0a\x09<\x0a\x09\x09return aNumber != null &&\x0a\x09\x09\x09typeof aNumber._isNumber === \x22function\x22 &&\x0a\x09\x09\x09aNumber._isNumber() &&\x0a\x09\x09\x09Number(self) == aNumber\x0a\x09>",
  3560. messageSends: [],
  3561. referencedClasses: []
  3562. }),
  3563. globals.Number);
  3564. smalltalk.addMethod(
  3565. smalltalk.method({
  3566. selector: ">",
  3567. protocol: 'comparing',
  3568. fn: function (aNumber){
  3569. var self=this;
  3570. return smalltalk.withContext(function($ctx1) {
  3571. return self > aNumber;
  3572. return self}, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},globals.Number)})},
  3573. args: ["aNumber"],
  3574. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  3575. messageSends: [],
  3576. referencedClasses: []
  3577. }),
  3578. globals.Number);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: ">=",
  3582. protocol: 'comparing',
  3583. fn: function (aNumber){
  3584. var self=this;
  3585. return smalltalk.withContext(function($ctx1) {
  3586. return self >= aNumber;
  3587. return self}, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},globals.Number)})},
  3588. args: ["aNumber"],
  3589. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  3590. messageSends: [],
  3591. referencedClasses: []
  3592. }),
  3593. globals.Number);
  3594. smalltalk.addMethod(
  3595. smalltalk.method({
  3596. selector: "@",
  3597. protocol: 'converting',
  3598. fn: function (aNumber){
  3599. var self=this;
  3600. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  3601. return smalltalk.withContext(function($ctx1) {
  3602. var $1;
  3603. $1=_st($Point())._x_y_(self,aNumber);
  3604. return $1;
  3605. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},globals.Number)})},
  3606. args: ["aNumber"],
  3607. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  3608. messageSends: ["x:y:"],
  3609. referencedClasses: ["Point"]
  3610. }),
  3611. globals.Number);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "\x5c\x5c",
  3615. protocol: 'arithmetic',
  3616. fn: function (aNumber){
  3617. var self=this;
  3618. return smalltalk.withContext(function($ctx1) {
  3619. return self % aNumber;
  3620. return self}, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},globals.Number)})},
  3621. args: ["aNumber"],
  3622. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  3623. messageSends: [],
  3624. referencedClasses: []
  3625. }),
  3626. globals.Number);
  3627. smalltalk.addMethod(
  3628. smalltalk.method({
  3629. selector: "abs",
  3630. protocol: 'arithmetic',
  3631. fn: function (){
  3632. var self=this;
  3633. return smalltalk.withContext(function($ctx1) {
  3634. return Math.abs(self);;
  3635. return self}, function($ctx1) {$ctx1.fill(self,"abs",{},globals.Number)})},
  3636. args: [],
  3637. source: "abs\x0a\x09<return Math.abs(self);>",
  3638. messageSends: [],
  3639. referencedClasses: []
  3640. }),
  3641. globals.Number);
  3642. smalltalk.addMethod(
  3643. smalltalk.method({
  3644. selector: "arcCos",
  3645. protocol: 'mathematical functions',
  3646. fn: function (){
  3647. var self=this;
  3648. return smalltalk.withContext(function($ctx1) {
  3649. return Math.acos(self);;
  3650. return self}, function($ctx1) {$ctx1.fill(self,"arcCos",{},globals.Number)})},
  3651. args: [],
  3652. source: "arcCos\x0a\x09<return Math.acos(self);>",
  3653. messageSends: [],
  3654. referencedClasses: []
  3655. }),
  3656. globals.Number);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "arcSin",
  3660. protocol: 'mathematical functions',
  3661. fn: function (){
  3662. var self=this;
  3663. return smalltalk.withContext(function($ctx1) {
  3664. return Math.asin(self);;
  3665. return self}, function($ctx1) {$ctx1.fill(self,"arcSin",{},globals.Number)})},
  3666. args: [],
  3667. source: "arcSin\x0a\x09<return Math.asin(self);>",
  3668. messageSends: [],
  3669. referencedClasses: []
  3670. }),
  3671. globals.Number);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "arcTan",
  3675. protocol: 'mathematical functions',
  3676. fn: function (){
  3677. var self=this;
  3678. return smalltalk.withContext(function($ctx1) {
  3679. return Math.atan(self);;
  3680. return self}, function($ctx1) {$ctx1.fill(self,"arcTan",{},globals.Number)})},
  3681. args: [],
  3682. source: "arcTan\x0a\x09<return Math.atan(self);>",
  3683. messageSends: [],
  3684. referencedClasses: []
  3685. }),
  3686. globals.Number);
  3687. smalltalk.addMethod(
  3688. smalltalk.method({
  3689. selector: "asJSON",
  3690. protocol: 'converting',
  3691. fn: function (){
  3692. var self=this;
  3693. return self;
  3694. },
  3695. args: [],
  3696. source: "asJSON\x0a\x09^ self",
  3697. messageSends: [],
  3698. referencedClasses: []
  3699. }),
  3700. globals.Number);
  3701. smalltalk.addMethod(
  3702. smalltalk.method({
  3703. selector: "asJavascript",
  3704. protocol: 'converting',
  3705. fn: function (){
  3706. var self=this;
  3707. return smalltalk.withContext(function($ctx1) {
  3708. var $1;
  3709. $1=_st("(".__comma(self._printString())).__comma(")");
  3710. $ctx1.sendIdx[","]=1;
  3711. return $1;
  3712. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Number)})},
  3713. args: [],
  3714. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  3715. messageSends: [",", "printString"],
  3716. referencedClasses: []
  3717. }),
  3718. globals.Number);
  3719. smalltalk.addMethod(
  3720. smalltalk.method({
  3721. selector: "asNumber",
  3722. protocol: 'converting',
  3723. fn: function (){
  3724. var self=this;
  3725. return self;
  3726. },
  3727. args: [],
  3728. source: "asNumber\x0a\x09^ self",
  3729. messageSends: [],
  3730. referencedClasses: []
  3731. }),
  3732. globals.Number);
  3733. smalltalk.addMethod(
  3734. smalltalk.method({
  3735. selector: "asPoint",
  3736. protocol: 'converting',
  3737. fn: function (){
  3738. var self=this;
  3739. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  3740. return smalltalk.withContext(function($ctx1) {
  3741. var $1;
  3742. $1=_st($Point())._x_y_(self,self);
  3743. return $1;
  3744. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},globals.Number)})},
  3745. args: [],
  3746. source: "asPoint\x0a\x09^ Point x: self y: self",
  3747. messageSends: ["x:y:"],
  3748. referencedClasses: ["Point"]
  3749. }),
  3750. globals.Number);
  3751. smalltalk.addMethod(
  3752. smalltalk.method({
  3753. selector: "asString",
  3754. protocol: 'converting',
  3755. fn: function (){
  3756. var self=this;
  3757. return smalltalk.withContext(function($ctx1) {
  3758. return String(self) ;
  3759. return self}, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Number)})},
  3760. args: [],
  3761. source: "asString\x0a\x09< return String(self) >",
  3762. messageSends: [],
  3763. referencedClasses: []
  3764. }),
  3765. globals.Number);
  3766. smalltalk.addMethod(
  3767. smalltalk.method({
  3768. selector: "atRandom",
  3769. protocol: 'converting',
  3770. fn: function (){
  3771. var self=this;
  3772. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  3773. return smalltalk.withContext(function($ctx1) {
  3774. var $1;
  3775. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  3776. return $1;
  3777. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.Number)})},
  3778. args: [],
  3779. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  3780. messageSends: ["+", "truncated", "*", "next", "new"],
  3781. referencedClasses: ["Random"]
  3782. }),
  3783. globals.Number);
  3784. smalltalk.addMethod(
  3785. smalltalk.method({
  3786. selector: "ceiling",
  3787. protocol: 'converting',
  3788. fn: function (){
  3789. var self=this;
  3790. return smalltalk.withContext(function($ctx1) {
  3791. return Math.ceil(self);;
  3792. return self}, function($ctx1) {$ctx1.fill(self,"ceiling",{},globals.Number)})},
  3793. args: [],
  3794. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  3795. messageSends: [],
  3796. referencedClasses: []
  3797. }),
  3798. globals.Number);
  3799. smalltalk.addMethod(
  3800. smalltalk.method({
  3801. selector: "copy",
  3802. protocol: 'copying',
  3803. fn: function (){
  3804. var self=this;
  3805. return self;
  3806. },
  3807. args: [],
  3808. source: "copy\x0a\x09^ self",
  3809. messageSends: [],
  3810. referencedClasses: []
  3811. }),
  3812. globals.Number);
  3813. smalltalk.addMethod(
  3814. smalltalk.method({
  3815. selector: "cos",
  3816. protocol: 'mathematical functions',
  3817. fn: function (){
  3818. var self=this;
  3819. return smalltalk.withContext(function($ctx1) {
  3820. return Math.cos(self);;
  3821. return self}, function($ctx1) {$ctx1.fill(self,"cos",{},globals.Number)})},
  3822. args: [],
  3823. source: "cos\x0a\x09<return Math.cos(self);>",
  3824. messageSends: [],
  3825. referencedClasses: []
  3826. }),
  3827. globals.Number);
  3828. smalltalk.addMethod(
  3829. smalltalk.method({
  3830. selector: "deepCopy",
  3831. protocol: 'copying',
  3832. fn: function (){
  3833. var self=this;
  3834. return smalltalk.withContext(function($ctx1) {
  3835. var $1;
  3836. $1=self._copy();
  3837. return $1;
  3838. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Number)})},
  3839. args: [],
  3840. source: "deepCopy\x0a\x09^ self copy",
  3841. messageSends: ["copy"],
  3842. referencedClasses: []
  3843. }),
  3844. globals.Number);
  3845. smalltalk.addMethod(
  3846. smalltalk.method({
  3847. selector: "even",
  3848. protocol: 'testing',
  3849. fn: function (){
  3850. var self=this;
  3851. return smalltalk.withContext(function($ctx1) {
  3852. var $1;
  3853. $1=(0).__eq(self.__backslash_backslash((2)));
  3854. return $1;
  3855. }, function($ctx1) {$ctx1.fill(self,"even",{},globals.Number)})},
  3856. args: [],
  3857. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  3858. messageSends: ["=", "\x5c\x5c"],
  3859. referencedClasses: []
  3860. }),
  3861. globals.Number);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "floor",
  3865. protocol: 'converting',
  3866. fn: function (){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. return Math.floor(self);;
  3870. return self}, function($ctx1) {$ctx1.fill(self,"floor",{},globals.Number)})},
  3871. args: [],
  3872. source: "floor\x0a\x09<return Math.floor(self);>",
  3873. messageSends: [],
  3874. referencedClasses: []
  3875. }),
  3876. globals.Number);
  3877. smalltalk.addMethod(
  3878. smalltalk.method({
  3879. selector: "identityHash",
  3880. protocol: 'accessing',
  3881. fn: function (){
  3882. var self=this;
  3883. return smalltalk.withContext(function($ctx1) {
  3884. var $1;
  3885. $1=_st(self._asString()).__comma("n");
  3886. return $1;
  3887. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.Number)})},
  3888. args: [],
  3889. source: "identityHash\x0a\x09^ self asString, 'n'",
  3890. messageSends: [",", "asString"],
  3891. referencedClasses: []
  3892. }),
  3893. globals.Number);
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "isImmutable",
  3897. protocol: 'testing',
  3898. fn: function (){
  3899. var self=this;
  3900. return true;
  3901. },
  3902. args: [],
  3903. source: "isImmutable\x0a\x09^ true",
  3904. messageSends: [],
  3905. referencedClasses: []
  3906. }),
  3907. globals.Number);
  3908. smalltalk.addMethod(
  3909. smalltalk.method({
  3910. selector: "isNumber",
  3911. protocol: 'testing',
  3912. fn: function (){
  3913. var self=this;
  3914. return true;
  3915. },
  3916. args: [],
  3917. source: "isNumber\x0a\x09^ true",
  3918. messageSends: [],
  3919. referencedClasses: []
  3920. }),
  3921. globals.Number);
  3922. smalltalk.addMethod(
  3923. smalltalk.method({
  3924. selector: "isZero",
  3925. protocol: 'testing',
  3926. fn: function (){
  3927. var self=this;
  3928. return smalltalk.withContext(function($ctx1) {
  3929. var $1;
  3930. $1=self.__eq((0));
  3931. return $1;
  3932. }, function($ctx1) {$ctx1.fill(self,"isZero",{},globals.Number)})},
  3933. args: [],
  3934. source: "isZero\x0a\x09^ self = 0",
  3935. messageSends: ["="],
  3936. referencedClasses: []
  3937. }),
  3938. globals.Number);
  3939. smalltalk.addMethod(
  3940. smalltalk.method({
  3941. selector: "ln",
  3942. protocol: 'mathematical functions',
  3943. fn: function (){
  3944. var self=this;
  3945. return smalltalk.withContext(function($ctx1) {
  3946. return Math.log(self);;
  3947. return self}, function($ctx1) {$ctx1.fill(self,"ln",{},globals.Number)})},
  3948. args: [],
  3949. source: "ln\x0a\x09<return Math.log(self);>",
  3950. messageSends: [],
  3951. referencedClasses: []
  3952. }),
  3953. globals.Number);
  3954. smalltalk.addMethod(
  3955. smalltalk.method({
  3956. selector: "log",
  3957. protocol: 'mathematical functions',
  3958. fn: function (){
  3959. var self=this;
  3960. return smalltalk.withContext(function($ctx1) {
  3961. return Math.log(self) / Math.LN10;;
  3962. return self}, function($ctx1) {$ctx1.fill(self,"log",{},globals.Number)})},
  3963. args: [],
  3964. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  3965. messageSends: [],
  3966. referencedClasses: []
  3967. }),
  3968. globals.Number);
  3969. smalltalk.addMethod(
  3970. smalltalk.method({
  3971. selector: "log:",
  3972. protocol: 'mathematical functions',
  3973. fn: function (aNumber){
  3974. var self=this;
  3975. return smalltalk.withContext(function($ctx1) {
  3976. return Math.log(self) / Math.log(aNumber);;
  3977. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},globals.Number)})},
  3978. args: ["aNumber"],
  3979. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  3980. messageSends: [],
  3981. referencedClasses: []
  3982. }),
  3983. globals.Number);
  3984. smalltalk.addMethod(
  3985. smalltalk.method({
  3986. selector: "max:",
  3987. protocol: 'arithmetic',
  3988. fn: function (aNumber){
  3989. var self=this;
  3990. return smalltalk.withContext(function($ctx1) {
  3991. return Math.max(self, aNumber);;
  3992. return self}, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},globals.Number)})},
  3993. args: ["aNumber"],
  3994. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  3995. messageSends: [],
  3996. referencedClasses: []
  3997. }),
  3998. globals.Number);
  3999. smalltalk.addMethod(
  4000. smalltalk.method({
  4001. selector: "min:",
  4002. protocol: 'arithmetic',
  4003. fn: function (aNumber){
  4004. var self=this;
  4005. return smalltalk.withContext(function($ctx1) {
  4006. return Math.min(self, aNumber);;
  4007. return self}, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},globals.Number)})},
  4008. args: ["aNumber"],
  4009. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4010. messageSends: [],
  4011. referencedClasses: []
  4012. }),
  4013. globals.Number);
  4014. smalltalk.addMethod(
  4015. smalltalk.method({
  4016. selector: "negated",
  4017. protocol: 'arithmetic',
  4018. fn: function (){
  4019. var self=this;
  4020. return smalltalk.withContext(function($ctx1) {
  4021. var $1;
  4022. $1=(0).__minus(self);
  4023. return $1;
  4024. }, function($ctx1) {$ctx1.fill(self,"negated",{},globals.Number)})},
  4025. args: [],
  4026. source: "negated\x0a\x09^ 0 - self",
  4027. messageSends: ["-"],
  4028. referencedClasses: []
  4029. }),
  4030. globals.Number);
  4031. smalltalk.addMethod(
  4032. smalltalk.method({
  4033. selector: "negative",
  4034. protocol: 'testing',
  4035. fn: function (){
  4036. var self=this;
  4037. return smalltalk.withContext(function($ctx1) {
  4038. var $1;
  4039. $1=self.__lt((0));
  4040. return $1;
  4041. }, function($ctx1) {$ctx1.fill(self,"negative",{},globals.Number)})},
  4042. args: [],
  4043. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4044. messageSends: ["<"],
  4045. referencedClasses: []
  4046. }),
  4047. globals.Number);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "odd",
  4051. protocol: 'testing',
  4052. fn: function (){
  4053. var self=this;
  4054. return smalltalk.withContext(function($ctx1) {
  4055. var $1;
  4056. $1=_st(self._even())._not();
  4057. return $1;
  4058. }, function($ctx1) {$ctx1.fill(self,"odd",{},globals.Number)})},
  4059. args: [],
  4060. source: "odd\x0a\x09^ self even not",
  4061. messageSends: ["not", "even"],
  4062. referencedClasses: []
  4063. }),
  4064. globals.Number);
  4065. smalltalk.addMethod(
  4066. smalltalk.method({
  4067. selector: "positive",
  4068. protocol: 'testing',
  4069. fn: function (){
  4070. var self=this;
  4071. return smalltalk.withContext(function($ctx1) {
  4072. var $1;
  4073. $1=self.__gt_eq((0));
  4074. return $1;
  4075. }, function($ctx1) {$ctx1.fill(self,"positive",{},globals.Number)})},
  4076. args: [],
  4077. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4078. messageSends: [">="],
  4079. referencedClasses: []
  4080. }),
  4081. globals.Number);
  4082. smalltalk.addMethod(
  4083. smalltalk.method({
  4084. selector: "printOn:",
  4085. protocol: 'printing',
  4086. fn: function (aStream){
  4087. var self=this;
  4088. return smalltalk.withContext(function($ctx1) {
  4089. _st(aStream)._nextPutAll_(self._asString());
  4090. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Number)})},
  4091. args: ["aStream"],
  4092. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4093. messageSends: ["nextPutAll:", "asString"],
  4094. referencedClasses: []
  4095. }),
  4096. globals.Number);
  4097. smalltalk.addMethod(
  4098. smalltalk.method({
  4099. selector: "printShowingDecimalPlaces:",
  4100. protocol: 'printing',
  4101. fn: function (placesDesired){
  4102. var self=this;
  4103. return smalltalk.withContext(function($ctx1) {
  4104. return self.toFixed(placesDesired);
  4105. return self}, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},globals.Number)})},
  4106. args: ["placesDesired"],
  4107. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4108. messageSends: [],
  4109. referencedClasses: []
  4110. }),
  4111. globals.Number);
  4112. smalltalk.addMethod(
  4113. smalltalk.method({
  4114. selector: "raisedTo:",
  4115. protocol: 'mathematical functions',
  4116. fn: function (exponent){
  4117. var self=this;
  4118. return smalltalk.withContext(function($ctx1) {
  4119. return Math.pow(self, exponent);;
  4120. return self}, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},globals.Number)})},
  4121. args: ["exponent"],
  4122. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4123. messageSends: [],
  4124. referencedClasses: []
  4125. }),
  4126. globals.Number);
  4127. smalltalk.addMethod(
  4128. smalltalk.method({
  4129. selector: "rounded",
  4130. protocol: 'converting',
  4131. fn: function (){
  4132. var self=this;
  4133. return smalltalk.withContext(function($ctx1) {
  4134. return Math.round(self);;
  4135. return self}, function($ctx1) {$ctx1.fill(self,"rounded",{},globals.Number)})},
  4136. args: [],
  4137. source: "rounded\x0a\x09<return Math.round(self);>",
  4138. messageSends: [],
  4139. referencedClasses: []
  4140. }),
  4141. globals.Number);
  4142. smalltalk.addMethod(
  4143. smalltalk.method({
  4144. selector: "sign",
  4145. protocol: 'mathematical functions',
  4146. fn: function (){
  4147. var self=this;
  4148. return smalltalk.withContext(function($ctx1) {
  4149. var $1,$2;
  4150. $1=self._isZero();
  4151. if(smalltalk.assert($1)){
  4152. return (0);
  4153. };
  4154. $2=self._positive();
  4155. if(smalltalk.assert($2)){
  4156. return (1);
  4157. } else {
  4158. return (-1);
  4159. };
  4160. return self}, function($ctx1) {$ctx1.fill(self,"sign",{},globals.Number)})},
  4161. args: [],
  4162. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4163. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"],
  4164. referencedClasses: []
  4165. }),
  4166. globals.Number);
  4167. smalltalk.addMethod(
  4168. smalltalk.method({
  4169. selector: "sin",
  4170. protocol: 'mathematical functions',
  4171. fn: function (){
  4172. var self=this;
  4173. return smalltalk.withContext(function($ctx1) {
  4174. return Math.sin(self);;
  4175. return self}, function($ctx1) {$ctx1.fill(self,"sin",{},globals.Number)})},
  4176. args: [],
  4177. source: "sin\x0a\x09<return Math.sin(self);>",
  4178. messageSends: [],
  4179. referencedClasses: []
  4180. }),
  4181. globals.Number);
  4182. smalltalk.addMethod(
  4183. smalltalk.method({
  4184. selector: "sqrt",
  4185. protocol: 'mathematical functions',
  4186. fn: function (){
  4187. var self=this;
  4188. return smalltalk.withContext(function($ctx1) {
  4189. return Math.sqrt(self);
  4190. return self}, function($ctx1) {$ctx1.fill(self,"sqrt",{},globals.Number)})},
  4191. args: [],
  4192. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4193. messageSends: [],
  4194. referencedClasses: []
  4195. }),
  4196. globals.Number);
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "squared",
  4200. protocol: 'mathematical functions',
  4201. fn: function (){
  4202. var self=this;
  4203. return smalltalk.withContext(function($ctx1) {
  4204. var $1;
  4205. $1=self.__star(self);
  4206. return $1;
  4207. }, function($ctx1) {$ctx1.fill(self,"squared",{},globals.Number)})},
  4208. args: [],
  4209. source: "squared\x0a\x09^ self * self",
  4210. messageSends: ["*"],
  4211. referencedClasses: []
  4212. }),
  4213. globals.Number);
  4214. smalltalk.addMethod(
  4215. smalltalk.method({
  4216. selector: "tan",
  4217. protocol: 'mathematical functions',
  4218. fn: function (){
  4219. var self=this;
  4220. return smalltalk.withContext(function($ctx1) {
  4221. return Math.tan(self);;
  4222. return self}, function($ctx1) {$ctx1.fill(self,"tan",{},globals.Number)})},
  4223. args: [],
  4224. source: "tan\x0a\x09<return Math.tan(self);>",
  4225. messageSends: [],
  4226. referencedClasses: []
  4227. }),
  4228. globals.Number);
  4229. smalltalk.addMethod(
  4230. smalltalk.method({
  4231. selector: "timesRepeat:",
  4232. protocol: 'enumerating',
  4233. fn: function (aBlock){
  4234. var self=this;
  4235. var count;
  4236. return smalltalk.withContext(function($ctx1) {
  4237. count=(1);
  4238. _st((function(){
  4239. return smalltalk.withContext(function($ctx2) {
  4240. return _st(count).__gt(self);
  4241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  4242. return smalltalk.withContext(function($ctx2) {
  4243. _st(aBlock)._value();
  4244. count=_st(count).__plus((1));
  4245. return count;
  4246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4247. return self}, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},globals.Number)})},
  4248. args: ["aBlock"],
  4249. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4250. messageSends: ["whileFalse:", ">", "value", "+"],
  4251. referencedClasses: []
  4252. }),
  4253. globals.Number);
  4254. smalltalk.addMethod(
  4255. smalltalk.method({
  4256. selector: "to:",
  4257. protocol: 'converting',
  4258. fn: function (aNumber){
  4259. var self=this;
  4260. var array,first,last,count;
  4261. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4262. return smalltalk.withContext(function($ctx1) {
  4263. var $1;
  4264. first=self._truncated();
  4265. $ctx1.sendIdx["truncated"]=1;
  4266. last=_st(_st(aNumber)._truncated()).__plus((1));
  4267. $ctx1.sendIdx["+"]=1;
  4268. count=(1);
  4269. array=_st($Array())._new();
  4270. _st(_st(last).__minus(first))._timesRepeat_((function(){
  4271. return smalltalk.withContext(function($ctx2) {
  4272. _st(array)._at_put_(count,first);
  4273. count=_st(count).__plus((1));
  4274. $ctx2.sendIdx["+"]=2;
  4275. count;
  4276. first=_st(first).__plus((1));
  4277. return first;
  4278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4279. $1=array;
  4280. return $1;
  4281. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},globals.Number)})},
  4282. args: ["aNumber"],
  4283. 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",
  4284. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"],
  4285. referencedClasses: ["Array"]
  4286. }),
  4287. globals.Number);
  4288. smalltalk.addMethod(
  4289. smalltalk.method({
  4290. selector: "to:by:",
  4291. protocol: 'converting',
  4292. fn: function (stop,step){
  4293. var self=this;
  4294. var array,value,pos;
  4295. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4296. return smalltalk.withContext(function($ctx1) {
  4297. var $1,$2,$3;
  4298. value=self;
  4299. array=_st($Array())._new();
  4300. pos=(1);
  4301. $1=_st(step).__eq((0));
  4302. if(smalltalk.assert($1)){
  4303. self._error_("step must be non-zero");
  4304. };
  4305. $2=_st(step).__lt((0));
  4306. if(smalltalk.assert($2)){
  4307. _st((function(){
  4308. return smalltalk.withContext(function($ctx2) {
  4309. return _st(value).__gt_eq(stop);
  4310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  4311. return smalltalk.withContext(function($ctx2) {
  4312. _st(array)._at_put_(pos,value);
  4313. $ctx2.sendIdx["at:put:"]=1;
  4314. pos=_st(pos).__plus((1));
  4315. $ctx2.sendIdx["+"]=1;
  4316. pos;
  4317. value=_st(value).__plus(step);
  4318. $ctx2.sendIdx["+"]=2;
  4319. return value;
  4320. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4321. $ctx1.sendIdx["whileTrue:"]=1;
  4322. } else {
  4323. _st((function(){
  4324. return smalltalk.withContext(function($ctx2) {
  4325. return _st(value).__lt_eq(stop);
  4326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  4327. return smalltalk.withContext(function($ctx2) {
  4328. _st(array)._at_put_(pos,value);
  4329. pos=_st(pos).__plus((1));
  4330. $ctx2.sendIdx["+"]=3;
  4331. pos;
  4332. value=_st(value).__plus(step);
  4333. return value;
  4334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  4335. };
  4336. $3=array;
  4337. return $3;
  4338. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},globals.Number)})},
  4339. args: ["stop", "step"],
  4340. 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",
  4341. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="],
  4342. referencedClasses: ["Array"]
  4343. }),
  4344. globals.Number);
  4345. smalltalk.addMethod(
  4346. smalltalk.method({
  4347. selector: "to:by:do:",
  4348. protocol: 'enumerating',
  4349. fn: function (stop,step,aBlock){
  4350. var self=this;
  4351. var value;
  4352. return smalltalk.withContext(function($ctx1) {
  4353. var $1,$2;
  4354. value=self;
  4355. $1=_st(step).__eq((0));
  4356. if(smalltalk.assert($1)){
  4357. self._error_("step must be non-zero");
  4358. };
  4359. $2=_st(step).__lt((0));
  4360. if(smalltalk.assert($2)){
  4361. _st((function(){
  4362. return smalltalk.withContext(function($ctx2) {
  4363. return _st(value).__gt_eq(stop);
  4364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue_((function(){
  4365. return smalltalk.withContext(function($ctx2) {
  4366. _st(aBlock)._value_(value);
  4367. $ctx2.sendIdx["value:"]=1;
  4368. value=_st(value).__plus(step);
  4369. $ctx2.sendIdx["+"]=1;
  4370. return value;
  4371. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4372. $ctx1.sendIdx["whileTrue:"]=1;
  4373. } else {
  4374. _st((function(){
  4375. return smalltalk.withContext(function($ctx2) {
  4376. return _st(value).__lt_eq(stop);
  4377. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}))._whileTrue_((function(){
  4378. return smalltalk.withContext(function($ctx2) {
  4379. _st(aBlock)._value_(value);
  4380. value=_st(value).__plus(step);
  4381. return value;
  4382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  4383. };
  4384. return self}, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},globals.Number)})},
  4385. args: ["stop", "step", "aBlock"],
  4386. 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 ]]",
  4387. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="],
  4388. referencedClasses: []
  4389. }),
  4390. globals.Number);
  4391. smalltalk.addMethod(
  4392. smalltalk.method({
  4393. selector: "to:do:",
  4394. protocol: 'enumerating',
  4395. fn: function (stop,aBlock){
  4396. var self=this;
  4397. var nextValue;
  4398. return smalltalk.withContext(function($ctx1) {
  4399. nextValue=self;
  4400. _st((function(){
  4401. return smalltalk.withContext(function($ctx2) {
  4402. return _st(nextValue).__lt_eq(stop);
  4403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  4404. return smalltalk.withContext(function($ctx2) {
  4405. _st(aBlock)._value_(nextValue);
  4406. nextValue=_st(nextValue).__plus((1));
  4407. return nextValue;
  4408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4409. return self}, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},globals.Number)})},
  4410. args: ["stop", "aBlock"],
  4411. 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 ]",
  4412. messageSends: ["whileTrue:", "<=", "value:", "+"],
  4413. referencedClasses: []
  4414. }),
  4415. globals.Number);
  4416. smalltalk.addMethod(
  4417. smalltalk.method({
  4418. selector: "truncated",
  4419. protocol: 'converting',
  4420. fn: function (){
  4421. var self=this;
  4422. return smalltalk.withContext(function($ctx1) {
  4423. if(self >= 0) {
  4424. return Math.floor(self);
  4425. } else {
  4426. return Math.floor(self * (-1)) * (-1);
  4427. };
  4428. ;
  4429. return self}, function($ctx1) {$ctx1.fill(self,"truncated",{},globals.Number)})},
  4430. args: [],
  4431. 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>",
  4432. messageSends: [],
  4433. referencedClasses: []
  4434. }),
  4435. globals.Number);
  4436. smalltalk.addMethod(
  4437. smalltalk.method({
  4438. selector: "|",
  4439. protocol: 'converting',
  4440. fn: function (aNumber){
  4441. var self=this;
  4442. return smalltalk.withContext(function($ctx1) {
  4443. return self | aNumber;
  4444. return self}, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},globals.Number)})},
  4445. args: ["aNumber"],
  4446. source: "| aNumber\x0a\x09<return self | aNumber>",
  4447. messageSends: [],
  4448. referencedClasses: []
  4449. }),
  4450. globals.Number);
  4451. smalltalk.addMethod(
  4452. smalltalk.method({
  4453. selector: "e",
  4454. protocol: 'instance creation',
  4455. fn: function (){
  4456. var self=this;
  4457. return smalltalk.withContext(function($ctx1) {
  4458. return Math.E;;
  4459. return self}, function($ctx1) {$ctx1.fill(self,"e",{},globals.Number.klass)})},
  4460. args: [],
  4461. source: "e\x0a\x09<return Math.E;>",
  4462. messageSends: [],
  4463. referencedClasses: []
  4464. }),
  4465. globals.Number.klass);
  4466. smalltalk.addMethod(
  4467. smalltalk.method({
  4468. selector: "heliosClass",
  4469. protocol: 'helios',
  4470. fn: function (){
  4471. var self=this;
  4472. return "magnitude";
  4473. },
  4474. args: [],
  4475. source: "heliosClass\x0a\x09^ 'magnitude'",
  4476. messageSends: [],
  4477. referencedClasses: []
  4478. }),
  4479. globals.Number.klass);
  4480. smalltalk.addMethod(
  4481. smalltalk.method({
  4482. selector: "pi",
  4483. protocol: 'instance creation',
  4484. fn: function (){
  4485. var self=this;
  4486. return smalltalk.withContext(function($ctx1) {
  4487. return Math.PI;
  4488. return self}, function($ctx1) {$ctx1.fill(self,"pi",{},globals.Number.klass)})},
  4489. args: [],
  4490. source: "pi\x0a\x09<return Math.PI>",
  4491. messageSends: [],
  4492. referencedClasses: []
  4493. }),
  4494. globals.Number.klass);
  4495. smalltalk.addClass('Point', globals.Object, ['x', 'y'], 'Kernel-Objects');
  4496. globals.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";
  4497. smalltalk.addMethod(
  4498. smalltalk.method({
  4499. selector: "*",
  4500. protocol: 'arithmetic',
  4501. fn: function (aPoint){
  4502. var self=this;
  4503. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4504. return smalltalk.withContext(function($ctx1) {
  4505. var $3,$5,$4,$2,$7,$6,$1;
  4506. $3=self._x();
  4507. $ctx1.sendIdx["x"]=1;
  4508. $5=_st(aPoint)._asPoint();
  4509. $ctx1.sendIdx["asPoint"]=1;
  4510. $4=_st($5)._x();
  4511. $2=_st($3).__star($4);
  4512. $ctx1.sendIdx["*"]=1;
  4513. $7=self._y();
  4514. $ctx1.sendIdx["y"]=1;
  4515. $6=_st($7).__star(_st(_st(aPoint)._asPoint())._y());
  4516. $1=_st($Point())._x_y_($2,$6);
  4517. return $1;
  4518. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},globals.Point)})},
  4519. args: ["aPoint"],
  4520. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  4521. messageSends: ["x:y:", "*", "x", "asPoint", "y"],
  4522. referencedClasses: ["Point"]
  4523. }),
  4524. globals.Point);
  4525. smalltalk.addMethod(
  4526. smalltalk.method({
  4527. selector: "+",
  4528. protocol: 'arithmetic',
  4529. fn: function (aPoint){
  4530. var self=this;
  4531. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4532. return smalltalk.withContext(function($ctx1) {
  4533. var $3,$5,$4,$2,$7,$6,$1;
  4534. $3=self._x();
  4535. $ctx1.sendIdx["x"]=1;
  4536. $5=_st(aPoint)._asPoint();
  4537. $ctx1.sendIdx["asPoint"]=1;
  4538. $4=_st($5)._x();
  4539. $2=_st($3).__plus($4);
  4540. $ctx1.sendIdx["+"]=1;
  4541. $7=self._y();
  4542. $ctx1.sendIdx["y"]=1;
  4543. $6=_st($7).__plus(_st(_st(aPoint)._asPoint())._y());
  4544. $1=_st($Point())._x_y_($2,$6);
  4545. return $1;
  4546. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},globals.Point)})},
  4547. args: ["aPoint"],
  4548. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  4549. messageSends: ["x:y:", "+", "x", "asPoint", "y"],
  4550. referencedClasses: ["Point"]
  4551. }),
  4552. globals.Point);
  4553. smalltalk.addMethod(
  4554. smalltalk.method({
  4555. selector: "-",
  4556. protocol: 'arithmetic',
  4557. fn: function (aPoint){
  4558. var self=this;
  4559. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4560. return smalltalk.withContext(function($ctx1) {
  4561. var $3,$5,$4,$2,$7,$6,$1;
  4562. $3=self._x();
  4563. $ctx1.sendIdx["x"]=1;
  4564. $5=_st(aPoint)._asPoint();
  4565. $ctx1.sendIdx["asPoint"]=1;
  4566. $4=_st($5)._x();
  4567. $2=_st($3).__minus($4);
  4568. $ctx1.sendIdx["-"]=1;
  4569. $7=self._y();
  4570. $ctx1.sendIdx["y"]=1;
  4571. $6=_st($7).__minus(_st(_st(aPoint)._asPoint())._y());
  4572. $1=_st($Point())._x_y_($2,$6);
  4573. return $1;
  4574. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},globals.Point)})},
  4575. args: ["aPoint"],
  4576. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  4577. messageSends: ["x:y:", "-", "x", "asPoint", "y"],
  4578. referencedClasses: ["Point"]
  4579. }),
  4580. globals.Point);
  4581. smalltalk.addMethod(
  4582. smalltalk.method({
  4583. selector: "/",
  4584. protocol: 'arithmetic',
  4585. fn: function (aPoint){
  4586. var self=this;
  4587. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4588. return smalltalk.withContext(function($ctx1) {
  4589. var $3,$5,$4,$2,$7,$6,$1;
  4590. $3=self._x();
  4591. $ctx1.sendIdx["x"]=1;
  4592. $5=_st(aPoint)._asPoint();
  4593. $ctx1.sendIdx["asPoint"]=1;
  4594. $4=_st($5)._x();
  4595. $2=_st($3).__slash($4);
  4596. $ctx1.sendIdx["/"]=1;
  4597. $7=self._y();
  4598. $ctx1.sendIdx["y"]=1;
  4599. $6=_st($7).__slash(_st(_st(aPoint)._asPoint())._y());
  4600. $1=_st($Point())._x_y_($2,$6);
  4601. return $1;
  4602. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},globals.Point)})},
  4603. args: ["aPoint"],
  4604. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  4605. messageSends: ["x:y:", "/", "x", "asPoint", "y"],
  4606. referencedClasses: ["Point"]
  4607. }),
  4608. globals.Point);
  4609. smalltalk.addMethod(
  4610. smalltalk.method({
  4611. selector: "<",
  4612. protocol: 'comparing',
  4613. fn: function (aPoint){
  4614. var self=this;
  4615. return smalltalk.withContext(function($ctx1) {
  4616. var $3,$2,$4,$1;
  4617. $3=self._x();
  4618. $ctx1.sendIdx["x"]=1;
  4619. $2=_st($3).__lt(_st(aPoint)._x());
  4620. $ctx1.sendIdx["<"]=1;
  4621. $1=_st($2)._and_((function(){
  4622. return smalltalk.withContext(function($ctx2) {
  4623. $4=self._y();
  4624. $ctx2.sendIdx["y"]=1;
  4625. return _st($4).__lt(_st(aPoint)._y());
  4626. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4627. return $1;
  4628. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},globals.Point)})},
  4629. args: ["aPoint"],
  4630. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  4631. messageSends: ["and:", "<", "x", "y"],
  4632. referencedClasses: []
  4633. }),
  4634. globals.Point);
  4635. smalltalk.addMethod(
  4636. smalltalk.method({
  4637. selector: "<=",
  4638. protocol: 'comparing',
  4639. fn: function (aPoint){
  4640. var self=this;
  4641. return smalltalk.withContext(function($ctx1) {
  4642. var $3,$2,$4,$1;
  4643. $3=self._x();
  4644. $ctx1.sendIdx["x"]=1;
  4645. $2=_st($3).__lt_eq(_st(aPoint)._x());
  4646. $ctx1.sendIdx["<="]=1;
  4647. $1=_st($2)._and_((function(){
  4648. return smalltalk.withContext(function($ctx2) {
  4649. $4=self._y();
  4650. $ctx2.sendIdx["y"]=1;
  4651. return _st($4).__lt_eq(_st(aPoint)._y());
  4652. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4653. return $1;
  4654. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},globals.Point)})},
  4655. args: ["aPoint"],
  4656. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  4657. messageSends: ["and:", "<=", "x", "y"],
  4658. referencedClasses: []
  4659. }),
  4660. globals.Point);
  4661. smalltalk.addMethod(
  4662. smalltalk.method({
  4663. selector: "=",
  4664. protocol: 'comparing',
  4665. fn: function (aPoint){
  4666. var self=this;
  4667. return smalltalk.withContext(function($ctx1) {
  4668. var $3,$2,$5,$4,$7,$6,$1;
  4669. $3=_st(aPoint)._class();
  4670. $ctx1.sendIdx["class"]=1;
  4671. $2=_st($3).__eq(self._class());
  4672. $ctx1.sendIdx["="]=1;
  4673. $1=_st($2)._and_((function(){
  4674. return smalltalk.withContext(function($ctx2) {
  4675. $5=_st(aPoint)._x();
  4676. $ctx2.sendIdx["x"]=1;
  4677. $4=_st($5).__eq(self._x());
  4678. $ctx2.sendIdx["="]=2;
  4679. $7=_st(aPoint)._y();
  4680. $ctx2.sendIdx["y"]=1;
  4681. $6=_st($7).__eq(self._y());
  4682. return _st($4).__and($6);
  4683. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4684. return $1;
  4685. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},globals.Point)})},
  4686. args: ["aPoint"],
  4687. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  4688. messageSends: ["and:", "=", "class", "&", "x", "y"],
  4689. referencedClasses: []
  4690. }),
  4691. globals.Point);
  4692. smalltalk.addMethod(
  4693. smalltalk.method({
  4694. selector: ">",
  4695. protocol: 'comparing',
  4696. fn: function (aPoint){
  4697. var self=this;
  4698. return smalltalk.withContext(function($ctx1) {
  4699. var $3,$2,$4,$1;
  4700. $3=self._x();
  4701. $ctx1.sendIdx["x"]=1;
  4702. $2=_st($3).__gt(_st(aPoint)._x());
  4703. $ctx1.sendIdx[">"]=1;
  4704. $1=_st($2)._and_((function(){
  4705. return smalltalk.withContext(function($ctx2) {
  4706. $4=self._y();
  4707. $ctx2.sendIdx["y"]=1;
  4708. return _st($4).__gt(_st(aPoint)._y());
  4709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4710. return $1;
  4711. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},globals.Point)})},
  4712. args: ["aPoint"],
  4713. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  4714. messageSends: ["and:", ">", "x", "y"],
  4715. referencedClasses: []
  4716. }),
  4717. globals.Point);
  4718. smalltalk.addMethod(
  4719. smalltalk.method({
  4720. selector: ">=",
  4721. protocol: 'comparing',
  4722. fn: function (aPoint){
  4723. var self=this;
  4724. return smalltalk.withContext(function($ctx1) {
  4725. var $3,$2,$4,$1;
  4726. $3=self._x();
  4727. $ctx1.sendIdx["x"]=1;
  4728. $2=_st($3).__gt_eq(_st(aPoint)._x());
  4729. $ctx1.sendIdx[">="]=1;
  4730. $1=_st($2)._and_((function(){
  4731. return smalltalk.withContext(function($ctx2) {
  4732. $4=self._y();
  4733. $ctx2.sendIdx["y"]=1;
  4734. return _st($4).__gt_eq(_st(aPoint)._y());
  4735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4736. return $1;
  4737. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},globals.Point)})},
  4738. args: ["aPoint"],
  4739. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  4740. messageSends: ["and:", ">=", "x", "y"],
  4741. referencedClasses: []
  4742. }),
  4743. globals.Point);
  4744. smalltalk.addMethod(
  4745. smalltalk.method({
  4746. selector: "asPoint",
  4747. protocol: 'converting',
  4748. fn: function (){
  4749. var self=this;
  4750. return self;
  4751. },
  4752. args: [],
  4753. source: "asPoint\x0a\x09^ self",
  4754. messageSends: [],
  4755. referencedClasses: []
  4756. }),
  4757. globals.Point);
  4758. smalltalk.addMethod(
  4759. smalltalk.method({
  4760. selector: "dist:",
  4761. protocol: 'transforming',
  4762. fn: function (aPoint){
  4763. var self=this;
  4764. var dx,dy;
  4765. return smalltalk.withContext(function($ctx1) {
  4766. var $3,$2,$1;
  4767. dx=_st(_st(aPoint)._x()).__minus(self["@x"]);
  4768. $ctx1.sendIdx["-"]=1;
  4769. dy=_st(_st(aPoint)._y()).__minus(self["@y"]);
  4770. $3=_st(dx).__star(dx);
  4771. $ctx1.sendIdx["*"]=1;
  4772. $2=_st($3).__plus(_st(dy).__star(dy));
  4773. $1=_st($2)._sqrt();
  4774. return $1;
  4775. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},globals.Point)})},
  4776. args: ["aPoint"],
  4777. source: "dist: aPoint \x0a\x09\x22Answer the distance between aPoint and the receiver.\x22\x0a\x09| dx dy |\x0a\x09dx := aPoint x - x.\x0a\x09dy := aPoint y - y.\x0a\x09^ (dx * dx + (dy * dy)) sqrt",
  4778. messageSends: ["-", "x", "y", "sqrt", "+", "*"],
  4779. referencedClasses: []
  4780. }),
  4781. globals.Point);
  4782. smalltalk.addMethod(
  4783. smalltalk.method({
  4784. selector: "printOn:",
  4785. protocol: 'printing',
  4786. fn: function (aStream){
  4787. var self=this;
  4788. return smalltalk.withContext(function($ctx1) {
  4789. var $1;
  4790. _st(self["@x"])._printOn_(aStream);
  4791. $ctx1.sendIdx["printOn:"]=1;
  4792. _st(aStream)._nextPutAll_("@");
  4793. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  4794. return smalltalk.withContext(function($ctx2) {
  4795. return _st(self["@y"])._negative();
  4796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4797. if(smalltalk.assert($1)){
  4798. _st(aStream)._space();
  4799. };
  4800. _st(self["@y"])._printOn_(aStream);
  4801. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Point)})},
  4802. args: ["aStream"],
  4803. 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",
  4804. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"],
  4805. referencedClasses: []
  4806. }),
  4807. globals.Point);
  4808. smalltalk.addMethod(
  4809. smalltalk.method({
  4810. selector: "translateBy:",
  4811. protocol: 'transforming',
  4812. fn: function (delta){
  4813. var self=this;
  4814. return smalltalk.withContext(function($ctx1) {
  4815. var $2,$1;
  4816. $2=_st(_st(delta)._x()).__plus(self["@x"]);
  4817. $ctx1.sendIdx["+"]=1;
  4818. $1=_st($2).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  4819. return $1;
  4820. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},globals.Point)})},
  4821. args: ["delta"],
  4822. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  4823. messageSends: ["@", "+", "x", "y"],
  4824. referencedClasses: []
  4825. }),
  4826. globals.Point);
  4827. smalltalk.addMethod(
  4828. smalltalk.method({
  4829. selector: "x",
  4830. protocol: 'accessing',
  4831. fn: function (){
  4832. var self=this;
  4833. var $1;
  4834. $1=self["@x"];
  4835. return $1;
  4836. },
  4837. args: [],
  4838. source: "x\x0a\x09^ x",
  4839. messageSends: [],
  4840. referencedClasses: []
  4841. }),
  4842. globals.Point);
  4843. smalltalk.addMethod(
  4844. smalltalk.method({
  4845. selector: "x:",
  4846. protocol: 'accessing',
  4847. fn: function (aNumber){
  4848. var self=this;
  4849. self["@x"]=aNumber;
  4850. return self},
  4851. args: ["aNumber"],
  4852. source: "x: aNumber\x0a\x09x := aNumber",
  4853. messageSends: [],
  4854. referencedClasses: []
  4855. }),
  4856. globals.Point);
  4857. smalltalk.addMethod(
  4858. smalltalk.method({
  4859. selector: "y",
  4860. protocol: 'accessing',
  4861. fn: function (){
  4862. var self=this;
  4863. var $1;
  4864. $1=self["@y"];
  4865. return $1;
  4866. },
  4867. args: [],
  4868. source: "y\x0a\x09^ y",
  4869. messageSends: [],
  4870. referencedClasses: []
  4871. }),
  4872. globals.Point);
  4873. smalltalk.addMethod(
  4874. smalltalk.method({
  4875. selector: "y:",
  4876. protocol: 'accessing',
  4877. fn: function (aNumber){
  4878. var self=this;
  4879. self["@y"]=aNumber;
  4880. return self},
  4881. args: ["aNumber"],
  4882. source: "y: aNumber\x0a\x09y := aNumber",
  4883. messageSends: [],
  4884. referencedClasses: []
  4885. }),
  4886. globals.Point);
  4887. smalltalk.addMethod(
  4888. smalltalk.method({
  4889. selector: "heliosClass",
  4890. protocol: 'helios',
  4891. fn: function (){
  4892. var self=this;
  4893. return "magnitude";
  4894. },
  4895. args: [],
  4896. source: "heliosClass\x0a\x09^ 'magnitude'",
  4897. messageSends: [],
  4898. referencedClasses: []
  4899. }),
  4900. globals.Point.klass);
  4901. smalltalk.addMethod(
  4902. smalltalk.method({
  4903. selector: "x:y:",
  4904. protocol: 'instance creation',
  4905. fn: function (aNumber,anotherNumber){
  4906. var self=this;
  4907. return smalltalk.withContext(function($ctx1) {
  4908. var $2,$3,$1;
  4909. $2=self._new();
  4910. _st($2)._x_(aNumber);
  4911. _st($2)._y_(anotherNumber);
  4912. $3=_st($2)._yourself();
  4913. $1=$3;
  4914. return $1;
  4915. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Point.klass)})},
  4916. args: ["aNumber", "anotherNumber"],
  4917. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  4918. messageSends: ["x:", "new", "y:", "yourself"],
  4919. referencedClasses: []
  4920. }),
  4921. globals.Point.klass);
  4922. smalltalk.addClass('Random', globals.Object, [], 'Kernel-Objects');
  4923. globals.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'`.";
  4924. smalltalk.addMethod(
  4925. smalltalk.method({
  4926. selector: "next",
  4927. protocol: 'accessing',
  4928. fn: function (){
  4929. var self=this;
  4930. return smalltalk.withContext(function($ctx1) {
  4931. return Math.random();
  4932. return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.Random)})},
  4933. args: [],
  4934. source: "next\x0a\x09<return Math.random()>",
  4935. messageSends: [],
  4936. referencedClasses: []
  4937. }),
  4938. globals.Random);
  4939. smalltalk.addMethod(
  4940. smalltalk.method({
  4941. selector: "next:",
  4942. protocol: 'accessing',
  4943. fn: function (anInteger){
  4944. var self=this;
  4945. return smalltalk.withContext(function($ctx1) {
  4946. var $1;
  4947. $1=_st((1)._to_(anInteger))._collect_((function(each){
  4948. return smalltalk.withContext(function($ctx2) {
  4949. return self._next();
  4950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4951. return $1;
  4952. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},globals.Random)})},
  4953. args: ["anInteger"],
  4954. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  4955. messageSends: ["collect:", "to:", "next"],
  4956. referencedClasses: []
  4957. }),
  4958. globals.Random);
  4959. smalltalk.addClass('UndefinedObject', globals.Object, [], 'Kernel-Objects');
  4960. globals.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`.";
  4961. smalltalk.addMethod(
  4962. smalltalk.method({
  4963. selector: "asJSON",
  4964. protocol: 'converting',
  4965. fn: function (){
  4966. var self=this;
  4967. var $1;
  4968. $1=null;
  4969. return $1;
  4970. },
  4971. args: [],
  4972. source: "asJSON\x0a\x09^ null",
  4973. messageSends: [],
  4974. referencedClasses: []
  4975. }),
  4976. globals.UndefinedObject);
  4977. smalltalk.addMethod(
  4978. smalltalk.method({
  4979. selector: "deepCopy",
  4980. protocol: 'copying',
  4981. fn: function (){
  4982. var self=this;
  4983. return self;
  4984. },
  4985. args: [],
  4986. source: "deepCopy\x0a\x09^ self",
  4987. messageSends: [],
  4988. referencedClasses: []
  4989. }),
  4990. globals.UndefinedObject);
  4991. smalltalk.addMethod(
  4992. smalltalk.method({
  4993. selector: "ifNil:",
  4994. protocol: 'testing',
  4995. fn: function (aBlock){
  4996. var self=this;
  4997. return smalltalk.withContext(function($ctx1) {
  4998. var $1;
  4999. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  5000. }));
  5001. return $1;
  5002. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},globals.UndefinedObject)})},
  5003. args: ["aBlock"],
  5004. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5005. messageSends: ["ifNil:ifNotNil:"],
  5006. referencedClasses: []
  5007. }),
  5008. globals.UndefinedObject);
  5009. smalltalk.addMethod(
  5010. smalltalk.method({
  5011. selector: "ifNil:ifNotNil:",
  5012. protocol: 'testing',
  5013. fn: function (aBlock,anotherBlock){
  5014. var self=this;
  5015. return smalltalk.withContext(function($ctx1) {
  5016. var $1;
  5017. $1=_st(aBlock)._value();
  5018. return $1;
  5019. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
  5020. args: ["aBlock", "anotherBlock"],
  5021. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5022. messageSends: ["value"],
  5023. referencedClasses: []
  5024. }),
  5025. globals.UndefinedObject);
  5026. smalltalk.addMethod(
  5027. smalltalk.method({
  5028. selector: "ifNotNil:",
  5029. protocol: 'testing',
  5030. fn: function (aBlock){
  5031. var self=this;
  5032. return self;
  5033. },
  5034. args: ["aBlock"],
  5035. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5036. messageSends: [],
  5037. referencedClasses: []
  5038. }),
  5039. globals.UndefinedObject);
  5040. smalltalk.addMethod(
  5041. smalltalk.method({
  5042. selector: "ifNotNil:ifNil:",
  5043. protocol: 'testing',
  5044. fn: function (aBlock,anotherBlock){
  5045. var self=this;
  5046. return smalltalk.withContext(function($ctx1) {
  5047. var $1;
  5048. $1=_st(anotherBlock)._value();
  5049. return $1;
  5050. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)})},
  5051. args: ["aBlock", "anotherBlock"],
  5052. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5053. messageSends: ["value"],
  5054. referencedClasses: []
  5055. }),
  5056. globals.UndefinedObject);
  5057. smalltalk.addMethod(
  5058. smalltalk.method({
  5059. selector: "isImmutable",
  5060. protocol: 'testing',
  5061. fn: function (){
  5062. var self=this;
  5063. return true;
  5064. },
  5065. args: [],
  5066. source: "isImmutable\x0a\x09^ true",
  5067. messageSends: [],
  5068. referencedClasses: []
  5069. }),
  5070. globals.UndefinedObject);
  5071. smalltalk.addMethod(
  5072. smalltalk.method({
  5073. selector: "isNil",
  5074. protocol: 'testing',
  5075. fn: function (){
  5076. var self=this;
  5077. return true;
  5078. },
  5079. args: [],
  5080. source: "isNil\x0a\x09^ true",
  5081. messageSends: [],
  5082. referencedClasses: []
  5083. }),
  5084. globals.UndefinedObject);
  5085. smalltalk.addMethod(
  5086. smalltalk.method({
  5087. selector: "notNil",
  5088. protocol: 'testing',
  5089. fn: function (){
  5090. var self=this;
  5091. return false;
  5092. },
  5093. args: [],
  5094. source: "notNil\x0a\x09^ false",
  5095. messageSends: [],
  5096. referencedClasses: []
  5097. }),
  5098. globals.UndefinedObject);
  5099. smalltalk.addMethod(
  5100. smalltalk.method({
  5101. selector: "printOn:",
  5102. protocol: 'printing',
  5103. fn: function (aStream){
  5104. var self=this;
  5105. return smalltalk.withContext(function($ctx1) {
  5106. _st(aStream)._nextPutAll_("nil");
  5107. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.UndefinedObject)})},
  5108. args: ["aStream"],
  5109. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5110. messageSends: ["nextPutAll:"],
  5111. referencedClasses: []
  5112. }),
  5113. globals.UndefinedObject);
  5114. smalltalk.addMethod(
  5115. smalltalk.method({
  5116. selector: "shallowCopy",
  5117. protocol: 'copying',
  5118. fn: function (){
  5119. var self=this;
  5120. return self;
  5121. },
  5122. args: [],
  5123. source: "shallowCopy\x0a\x09^ self",
  5124. messageSends: [],
  5125. referencedClasses: []
  5126. }),
  5127. globals.UndefinedObject);
  5128. smalltalk.addMethod(
  5129. smalltalk.method({
  5130. selector: "subclass:instanceVariableNames:",
  5131. protocol: 'class creation',
  5132. fn: function (aString,anotherString){
  5133. var self=this;
  5134. return smalltalk.withContext(function($ctx1) {
  5135. var $1;
  5136. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5137. return $1;
  5138. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.UndefinedObject)})},
  5139. args: ["aString", "anotherString"],
  5140. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5141. messageSends: ["subclass:instanceVariableNames:package:"],
  5142. referencedClasses: []
  5143. }),
  5144. globals.UndefinedObject);
  5145. smalltalk.addMethod(
  5146. smalltalk.method({
  5147. selector: "subclass:instanceVariableNames:category:",
  5148. protocol: 'class creation',
  5149. fn: function (aString,aString2,aString3){
  5150. var self=this;
  5151. return smalltalk.withContext(function($ctx1) {
  5152. var $1;
  5153. self._deprecatedAPI();
  5154. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5155. return $1;
  5156. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
  5157. args: ["aString", "aString2", "aString3"],
  5158. 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",
  5159. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  5160. referencedClasses: []
  5161. }),
  5162. globals.UndefinedObject);
  5163. smalltalk.addMethod(
  5164. smalltalk.method({
  5165. selector: "subclass:instanceVariableNames:package:",
  5166. protocol: 'class creation',
  5167. fn: function (aString,aString2,aString3){
  5168. var self=this;
  5169. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  5170. return smalltalk.withContext(function($ctx1) {
  5171. var $1;
  5172. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  5173. return $1;
  5174. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)})},
  5175. args: ["aString", "aString2", "aString3"],
  5176. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5177. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  5178. referencedClasses: ["ClassBuilder"]
  5179. }),
  5180. globals.UndefinedObject);
  5181. smalltalk.addMethod(
  5182. smalltalk.method({
  5183. selector: "new",
  5184. protocol: 'instance creation',
  5185. fn: function (){
  5186. var self=this;
  5187. return smalltalk.withContext(function($ctx1) {
  5188. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5189. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.UndefinedObject.klass)})},
  5190. args: [],
  5191. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5192. messageSends: ["error:"],
  5193. referencedClasses: []
  5194. }),
  5195. globals.UndefinedObject.klass);
  5196. });
  5197. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  5198. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  5199. smalltalk.addPackage('Kernel-Classes');
  5200. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5201. smalltalk.addClass('Behavior', globals.Object, [], 'Kernel-Classes');
  5202. globals.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,\x0aand hold the method dictionary that's associated with each class.\x0a\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  5203. smalltalk.addMethod(
  5204. smalltalk.method({
  5205. selector: ">>",
  5206. protocol: 'accessing',
  5207. fn: function (aString){
  5208. var self=this;
  5209. return smalltalk.withContext(function($ctx1) {
  5210. var $1;
  5211. $1=self._methodAt_(aString);
  5212. return $1;
  5213. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},globals.Behavior)})},
  5214. args: ["aString"],
  5215. source: ">> aString\x0a\x09^ self methodAt: aString",
  5216. messageSends: ["methodAt:"],
  5217. referencedClasses: []
  5218. }),
  5219. globals.Behavior);
  5220. smalltalk.addMethod(
  5221. smalltalk.method({
  5222. selector: "addCompiledMethod:",
  5223. protocol: 'compiling',
  5224. fn: function (aMethod){
  5225. var self=this;
  5226. var oldMethod,announcement;
  5227. function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  5228. function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  5229. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5230. return smalltalk.withContext(function($ctx1) {
  5231. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  5232. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  5233. return nil;
  5234. }));
  5235. $2=self._protocols();
  5236. $3=_st(aMethod)._protocol();
  5237. $ctx1.sendIdx["protocol"]=1;
  5238. $1=_st($2)._includes_($3);
  5239. if(! smalltalk.assert($1)){
  5240. $4=self._organization();
  5241. $5=_st(aMethod)._protocol();
  5242. $ctx1.sendIdx["protocol"]=2;
  5243. _st($4)._addElement_($5);
  5244. };
  5245. self._basicAddCompiledMethod_(aMethod);
  5246. $6=oldMethod;
  5247. if(($receiver = $6) == null || $receiver.isNil){
  5248. $6;
  5249. } else {
  5250. self._removeProtocolIfEmpty_(_st(oldMethod)._protocol());
  5251. };
  5252. $7=oldMethod;
  5253. if(($receiver = $7) == null || $receiver.isNil){
  5254. $8=_st($MethodAdded())._new();
  5255. $ctx1.sendIdx["new"]=1;
  5256. _st($8)._method_(aMethod);
  5257. $ctx1.sendIdx["method:"]=1;
  5258. $9=_st($8)._yourself();
  5259. $ctx1.sendIdx["yourself"]=1;
  5260. announcement=$9;
  5261. } else {
  5262. $10=_st($MethodModified())._new();
  5263. _st($10)._oldMethod_(oldMethod);
  5264. _st($10)._method_(aMethod);
  5265. $11=_st($10)._yourself();
  5266. announcement=$11;
  5267. };
  5268. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  5269. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},globals.Behavior)})},
  5270. args: ["aMethod"],
  5271. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ].\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  5272. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  5273. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  5274. }),
  5275. globals.Behavior);
  5276. smalltalk.addMethod(
  5277. smalltalk.method({
  5278. selector: "allInstanceVariableNames",
  5279. protocol: 'accessing',
  5280. fn: function (){
  5281. var self=this;
  5282. var result;
  5283. return smalltalk.withContext(function($ctx1) {
  5284. var $1,$2,$receiver;
  5285. result=_st(self._instanceVariableNames())._copy();
  5286. $1=self._superclass();
  5287. $ctx1.sendIdx["superclass"]=1;
  5288. if(($receiver = $1) == null || $receiver.isNil){
  5289. $1;
  5290. } else {
  5291. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  5292. };
  5293. $2=result;
  5294. return $2;
  5295. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},globals.Behavior)})},
  5296. args: [],
  5297. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5298. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
  5299. referencedClasses: []
  5300. }),
  5301. globals.Behavior);
  5302. smalltalk.addMethod(
  5303. smalltalk.method({
  5304. selector: "allSelectors",
  5305. protocol: 'accessing',
  5306. fn: function (){
  5307. var self=this;
  5308. return smalltalk.withContext(function($ctx1) {
  5309. var $2,$3,$4,$1;
  5310. $2=self._allSuperclasses();
  5311. $3=self._selectors();
  5312. $ctx1.sendIdx["selectors"]=1;
  5313. $1=_st($2)._inject_into_($3,(function(acc,each){
  5314. return smalltalk.withContext(function($ctx2) {
  5315. _st(acc)._addAll_(_st(each)._selectors());
  5316. $4=_st(acc)._yourself();
  5317. return $4;
  5318. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})}));
  5319. return $1;
  5320. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Behavior)})},
  5321. args: [],
  5322. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5323. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"],
  5324. referencedClasses: []
  5325. }),
  5326. globals.Behavior);
  5327. smalltalk.addMethod(
  5328. smalltalk.method({
  5329. selector: "allSubclasses",
  5330. protocol: 'accessing',
  5331. fn: function (){
  5332. var self=this;
  5333. var subclasses,index;
  5334. return smalltalk.withContext(function($ctx1) {
  5335. var $1;
  5336. subclasses=self._subclasses();
  5337. $ctx1.sendIdx["subclasses"]=1;
  5338. index=(1);
  5339. _st((function(){
  5340. return smalltalk.withContext(function($ctx2) {
  5341. return _st(index).__gt(_st(subclasses)._size());
  5342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5343. return smalltalk.withContext(function($ctx2) {
  5344. _st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
  5345. index=_st(index).__plus((1));
  5346. return index;
  5347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5348. $1=subclasses;
  5349. return $1;
  5350. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},globals.Behavior)})},
  5351. args: [],
  5352. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  5353. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"],
  5354. referencedClasses: []
  5355. }),
  5356. globals.Behavior);
  5357. smalltalk.addMethod(
  5358. smalltalk.method({
  5359. selector: "allSubclassesDo:",
  5360. protocol: 'enumerating',
  5361. fn: function (aBlock){
  5362. var self=this;
  5363. return smalltalk.withContext(function($ctx1) {
  5364. _st(self._allSubclasses())._do_((function(each){
  5365. return smalltalk.withContext(function($ctx2) {
  5366. return _st(aBlock)._value_(each);
  5367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5368. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},globals.Behavior)})},
  5369. args: ["aBlock"],
  5370. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  5371. messageSends: ["do:", "allSubclasses", "value:"],
  5372. referencedClasses: []
  5373. }),
  5374. globals.Behavior);
  5375. smalltalk.addMethod(
  5376. smalltalk.method({
  5377. selector: "allSuperclasses",
  5378. protocol: 'accessing',
  5379. fn: function (){
  5380. var self=this;
  5381. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5382. return smalltalk.withContext(function($ctx1) {
  5383. var $1,$2,$5,$4,$6,$3,$receiver;
  5384. $1=self._superclass();
  5385. $ctx1.sendIdx["superclass"]=1;
  5386. if(($receiver = $1) == null || $receiver.isNil){
  5387. $2=[];
  5388. return $2;
  5389. } else {
  5390. $1;
  5391. };
  5392. $5=self._superclass();
  5393. $ctx1.sendIdx["superclass"]=2;
  5394. $4=_st($OrderedCollection())._with_($5);
  5395. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  5396. $6=_st($4)._yourself();
  5397. $3=$6;
  5398. return $3;
  5399. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},globals.Behavior)})},
  5400. args: [],
  5401. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  5402. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"],
  5403. referencedClasses: ["OrderedCollection"]
  5404. }),
  5405. globals.Behavior);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "basicAddCompiledMethod:",
  5409. protocol: 'private',
  5410. fn: function (aMethod){
  5411. var self=this;
  5412. return smalltalk.withContext(function($ctx1) {
  5413. smalltalk.addMethod(aMethod, self);
  5414. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  5415. args: ["aMethod"],
  5416. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  5417. messageSends: [],
  5418. referencedClasses: []
  5419. }),
  5420. globals.Behavior);
  5421. smalltalk.addMethod(
  5422. smalltalk.method({
  5423. selector: "basicNew",
  5424. protocol: 'instance creation',
  5425. fn: function (){
  5426. var self=this;
  5427. return smalltalk.withContext(function($ctx1) {
  5428. return new self.fn();
  5429. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},globals.Behavior)})},
  5430. args: [],
  5431. source: "basicNew\x0a\x09<return new self.fn()>",
  5432. messageSends: [],
  5433. referencedClasses: []
  5434. }),
  5435. globals.Behavior);
  5436. smalltalk.addMethod(
  5437. smalltalk.method({
  5438. selector: "basicRemoveCompiledMethod:",
  5439. protocol: 'private',
  5440. fn: function (aMethod){
  5441. var self=this;
  5442. return smalltalk.withContext(function($ctx1) {
  5443. smalltalk.removeMethod(aMethod,self);
  5444. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  5445. args: ["aMethod"],
  5446. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  5447. messageSends: [],
  5448. referencedClasses: []
  5449. }),
  5450. globals.Behavior);
  5451. smalltalk.addMethod(
  5452. smalltalk.method({
  5453. selector: "canUnderstand:",
  5454. protocol: 'testing',
  5455. fn: function (aSelector){
  5456. var self=this;
  5457. return smalltalk.withContext(function($ctx1) {
  5458. var $3,$2,$1;
  5459. $1=_st(self._includesSelector_(_st(aSelector)._asString()))._or_((function(){
  5460. return smalltalk.withContext(function($ctx2) {
  5461. $3=self._superclass();
  5462. $ctx2.sendIdx["superclass"]=1;
  5463. $2=_st($3)._notNil();
  5464. return _st($2)._and_((function(){
  5465. return smalltalk.withContext(function($ctx3) {
  5466. return _st(self._superclass())._canUnderstand_(aSelector);
  5467. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  5468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5469. return $1;
  5470. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},globals.Behavior)})},
  5471. args: ["aSelector"],
  5472. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  5473. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
  5474. referencedClasses: []
  5475. }),
  5476. globals.Behavior);
  5477. smalltalk.addMethod(
  5478. smalltalk.method({
  5479. selector: "comment",
  5480. protocol: 'accessing',
  5481. fn: function (){
  5482. var self=this;
  5483. return smalltalk.withContext(function($ctx1) {
  5484. var $2,$1,$receiver;
  5485. $2=self._basicAt_("comment");
  5486. if(($receiver = $2) == null || $receiver.isNil){
  5487. $1="";
  5488. } else {
  5489. $1=$2;
  5490. };
  5491. return $1;
  5492. }, function($ctx1) {$ctx1.fill(self,"comment",{},globals.Behavior)})},
  5493. args: [],
  5494. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  5495. messageSends: ["ifNil:", "basicAt:"],
  5496. referencedClasses: []
  5497. }),
  5498. globals.Behavior);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "comment:",
  5502. protocol: 'accessing',
  5503. fn: function (aString){
  5504. var self=this;
  5505. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  5506. function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  5507. return smalltalk.withContext(function($ctx1) {
  5508. var $1,$2;
  5509. self._basicAt_put_("comment",aString);
  5510. $1=_st($ClassCommentChanged())._new();
  5511. _st($1)._theClass_(self);
  5512. $2=_st($1)._yourself();
  5513. _st(_st($SystemAnnouncer())._current())._announce_($2);
  5514. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},globals.Behavior)})},
  5515. args: ["aString"],
  5516. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  5517. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"],
  5518. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"]
  5519. }),
  5520. globals.Behavior);
  5521. smalltalk.addMethod(
  5522. smalltalk.method({
  5523. selector: "commentStamp",
  5524. protocol: 'accessing',
  5525. fn: function (){
  5526. var self=this;
  5527. function $ClassCommentReader(){return globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  5528. return smalltalk.withContext(function($ctx1) {
  5529. var $2,$3,$1;
  5530. $2=_st($ClassCommentReader())._new();
  5531. _st($2)._class_(self);
  5532. $3=_st($2)._yourself();
  5533. $1=$3;
  5534. return $1;
  5535. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},globals.Behavior)})},
  5536. args: [],
  5537. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  5538. messageSends: ["class:", "new", "yourself"],
  5539. referencedClasses: ["ClassCommentReader"]
  5540. }),
  5541. globals.Behavior);
  5542. smalltalk.addMethod(
  5543. smalltalk.method({
  5544. selector: "commentStamp:prior:",
  5545. protocol: 'accessing',
  5546. fn: function (aStamp,prior){
  5547. var self=this;
  5548. return smalltalk.withContext(function($ctx1) {
  5549. var $1;
  5550. $1=self._commentStamp();
  5551. return $1;
  5552. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},globals.Behavior)})},
  5553. args: ["aStamp", "prior"],
  5554. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  5555. messageSends: ["commentStamp"],
  5556. referencedClasses: []
  5557. }),
  5558. globals.Behavior);
  5559. smalltalk.addMethod(
  5560. smalltalk.method({
  5561. selector: "compile:",
  5562. protocol: 'compiling',
  5563. fn: function (aString){
  5564. var self=this;
  5565. return smalltalk.withContext(function($ctx1) {
  5566. var $1;
  5567. $1=self._compile_protocol_(aString,"");
  5568. return $1;
  5569. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Behavior)})},
  5570. args: ["aString"],
  5571. source: "compile: aString\x0a\x09^ self compile: aString protocol: ''",
  5572. messageSends: ["compile:protocol:"],
  5573. referencedClasses: []
  5574. }),
  5575. globals.Behavior);
  5576. smalltalk.addMethod(
  5577. smalltalk.method({
  5578. selector: "compile:protocol:",
  5579. protocol: 'compiling',
  5580. fn: function (aString,anotherString){
  5581. var self=this;
  5582. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5583. return smalltalk.withContext(function($ctx1) {
  5584. var $1;
  5585. $1=_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  5586. return $1;
  5587. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},globals.Behavior)})},
  5588. args: ["aString", "anotherString"],
  5589. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  5590. messageSends: ["install:forClass:protocol:", "new"],
  5591. referencedClasses: ["Compiler"]
  5592. }),
  5593. globals.Behavior);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "definition",
  5597. protocol: 'accessing',
  5598. fn: function (){
  5599. var self=this;
  5600. return "";
  5601. },
  5602. args: [],
  5603. source: "definition\x0a\x09^ ''",
  5604. messageSends: [],
  5605. referencedClasses: []
  5606. }),
  5607. globals.Behavior);
  5608. smalltalk.addMethod(
  5609. smalltalk.method({
  5610. selector: "includesBehavior:",
  5611. protocol: 'testing',
  5612. fn: function (aClass){
  5613. var self=this;
  5614. return smalltalk.withContext(function($ctx1) {
  5615. var $1;
  5616. $1=_st(self.__eq_eq(aClass))._or_((function(){
  5617. return smalltalk.withContext(function($ctx2) {
  5618. return self._inheritsFrom_(aClass);
  5619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5620. return $1;
  5621. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},globals.Behavior)})},
  5622. args: ["aClass"],
  5623. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  5624. messageSends: ["or:", "==", "inheritsFrom:"],
  5625. referencedClasses: []
  5626. }),
  5627. globals.Behavior);
  5628. smalltalk.addMethod(
  5629. smalltalk.method({
  5630. selector: "includesSelector:",
  5631. protocol: 'testing',
  5632. fn: function (aString){
  5633. var self=this;
  5634. return smalltalk.withContext(function($ctx1) {
  5635. var $1;
  5636. $1=_st(self._methodDictionary())._includesKey_(aString);
  5637. return $1;
  5638. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},globals.Behavior)})},
  5639. args: ["aString"],
  5640. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  5641. messageSends: ["includesKey:", "methodDictionary"],
  5642. referencedClasses: []
  5643. }),
  5644. globals.Behavior);
  5645. smalltalk.addMethod(
  5646. smalltalk.method({
  5647. selector: "inheritsFrom:",
  5648. protocol: 'testing',
  5649. fn: function (aClass){
  5650. var self=this;
  5651. return smalltalk.withContext(function($ctx1) {
  5652. var $1,$4,$3,$2,$receiver;
  5653. $1=self._superclass();
  5654. $ctx1.sendIdx["superclass"]=1;
  5655. if(($receiver = $1) == null || $receiver.isNil){
  5656. return false;
  5657. } else {
  5658. $1;
  5659. };
  5660. $4=self._superclass();
  5661. $ctx1.sendIdx["superclass"]=2;
  5662. $3=_st(aClass).__eq_eq($4);
  5663. $2=_st($3)._or_((function(){
  5664. return smalltalk.withContext(function($ctx2) {
  5665. return _st(self._superclass())._inheritsFrom_(aClass);
  5666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5667. return $2;
  5668. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},globals.Behavior)})},
  5669. args: ["aClass"],
  5670. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  5671. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"],
  5672. referencedClasses: []
  5673. }),
  5674. globals.Behavior);
  5675. smalltalk.addMethod(
  5676. smalltalk.method({
  5677. selector: "instanceVariableNames",
  5678. protocol: 'accessing',
  5679. fn: function (){
  5680. var self=this;
  5681. return smalltalk.withContext(function($ctx1) {
  5682. return self.iVarNames;
  5683. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},globals.Behavior)})},
  5684. args: [],
  5685. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  5686. messageSends: [],
  5687. referencedClasses: []
  5688. }),
  5689. globals.Behavior);
  5690. smalltalk.addMethod(
  5691. smalltalk.method({
  5692. selector: "isBehavior",
  5693. protocol: 'testing',
  5694. fn: function (){
  5695. var self=this;
  5696. return true;
  5697. },
  5698. args: [],
  5699. source: "isBehavior\x0a\x09^ true",
  5700. messageSends: [],
  5701. referencedClasses: []
  5702. }),
  5703. globals.Behavior);
  5704. smalltalk.addMethod(
  5705. smalltalk.method({
  5706. selector: "javascriptConstructor",
  5707. protocol: 'accessing',
  5708. fn: function (){
  5709. var self=this;
  5710. return smalltalk.withContext(function($ctx1) {
  5711. return self.fn;
  5712. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},globals.Behavior)})},
  5713. args: [],
  5714. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  5715. messageSends: [],
  5716. referencedClasses: []
  5717. }),
  5718. globals.Behavior);
  5719. smalltalk.addMethod(
  5720. smalltalk.method({
  5721. selector: "javascriptConstructor:",
  5722. protocol: 'accessing',
  5723. fn: function (aJavaScriptFunction){
  5724. var self=this;
  5725. return smalltalk.withContext(function($ctx1) {
  5726. smalltalk.setClassConstructor(self, aJavaScriptFunction);;
  5727. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},globals.Behavior)})},
  5728. args: ["aJavaScriptFunction"],
  5729. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `smalltalk.setClassConstructor'\x22\x0a\x09\x0a\x09<smalltalk.setClassConstructor(self, aJavaScriptFunction);>",
  5730. messageSends: [],
  5731. referencedClasses: []
  5732. }),
  5733. globals.Behavior);
  5734. smalltalk.addMethod(
  5735. smalltalk.method({
  5736. selector: "lookupSelector:",
  5737. protocol: 'accessing',
  5738. fn: function (selector){
  5739. var self=this;
  5740. var lookupClass;
  5741. return smalltalk.withContext(function($ctx1) {
  5742. var $1,$2;
  5743. var $early={};
  5744. try {
  5745. lookupClass=self;
  5746. _st((function(){
  5747. return smalltalk.withContext(function($ctx2) {
  5748. return _st(lookupClass).__eq(nil);
  5749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5750. return smalltalk.withContext(function($ctx2) {
  5751. $1=_st(lookupClass)._includesSelector_(selector);
  5752. if(smalltalk.assert($1)){
  5753. $2=_st(lookupClass)._methodAt_(selector);
  5754. throw $early=[$2];
  5755. };
  5756. lookupClass=_st(lookupClass)._superclass();
  5757. return lookupClass;
  5758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5759. return nil;
  5760. }
  5761. catch(e) {if(e===$early)return e[0]; throw e}
  5762. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},globals.Behavior)})},
  5763. args: ["selector"],
  5764. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  5765. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"],
  5766. referencedClasses: []
  5767. }),
  5768. globals.Behavior);
  5769. smalltalk.addMethod(
  5770. smalltalk.method({
  5771. selector: "methodAt:",
  5772. protocol: 'accessing',
  5773. fn: function (aString){
  5774. var self=this;
  5775. return smalltalk.withContext(function($ctx1) {
  5776. var $1;
  5777. $1=_st(self._methodDictionary())._at_(aString);
  5778. return $1;
  5779. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},globals.Behavior)})},
  5780. args: ["aString"],
  5781. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  5782. messageSends: ["at:", "methodDictionary"],
  5783. referencedClasses: []
  5784. }),
  5785. globals.Behavior);
  5786. smalltalk.addMethod(
  5787. smalltalk.method({
  5788. selector: "methodDictionary",
  5789. protocol: 'accessing',
  5790. fn: function (){
  5791. var self=this;
  5792. return smalltalk.withContext(function($ctx1) {
  5793. var dict = globals.HashedCollection._new();
  5794. var methods = self.methods;
  5795. Object.keys(methods).forEach(function(i) {
  5796. if(methods[i].selector) {
  5797. dict._at_put_(methods[i].selector, methods[i]);
  5798. }
  5799. });
  5800. return dict;
  5801. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},globals.Behavior)})},
  5802. args: [],
  5803. source: "methodDictionary\x0a\x09<var dict = globals.HashedCollection._new();\x0a\x09var methods = self.methods;\x0a\x09Object.keys(methods).forEach(function(i) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09});\x0a\x09return dict>",
  5804. messageSends: [],
  5805. referencedClasses: []
  5806. }),
  5807. globals.Behavior);
  5808. smalltalk.addMethod(
  5809. smalltalk.method({
  5810. selector: "methodTemplate",
  5811. protocol: 'accessing',
  5812. fn: function (){
  5813. var self=this;
  5814. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5815. return smalltalk.withContext(function($ctx1) {
  5816. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  5817. $1=_st($String())._streamContents_((function(stream){
  5818. return smalltalk.withContext(function($ctx2) {
  5819. _st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  5820. $ctx2.sendIdx["nextPutAll:"]=1;
  5821. $3=_st($String())._lf();
  5822. $ctx2.sendIdx["lf"]=1;
  5823. $4=_st($String())._tab();
  5824. $ctx2.sendIdx["tab"]=1;
  5825. $2=_st($3).__comma($4);
  5826. $ctx2.sendIdx[","]=1;
  5827. _st(stream)._nextPutAll_($2);
  5828. $ctx2.sendIdx["nextPutAll:"]=2;
  5829. _st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  5830. $ctx2.sendIdx["nextPutAll:"]=3;
  5831. $7=_st($String())._lf();
  5832. $ctx2.sendIdx["lf"]=2;
  5833. $8=_st($String())._lf();
  5834. $ctx2.sendIdx["lf"]=3;
  5835. $6=_st($7).__comma($8);
  5836. $ctx2.sendIdx[","]=3;
  5837. $9=_st($String())._tab();
  5838. $ctx2.sendIdx["tab"]=2;
  5839. $5=_st($6).__comma($9);
  5840. $ctx2.sendIdx[","]=2;
  5841. _st(stream)._nextPutAll_($5);
  5842. $ctx2.sendIdx["nextPutAll:"]=4;
  5843. _st(stream)._nextPutAll_("| temporary variable names |");
  5844. $ctx2.sendIdx["nextPutAll:"]=5;
  5845. _st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  5846. $ctx2.sendIdx["nextPutAll:"]=6;
  5847. $10=_st(stream)._nextPutAll_("statements");
  5848. return $10;
  5849. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  5850. return $1;
  5851. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)})},
  5852. args: [],
  5853. source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
  5854. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"],
  5855. referencedClasses: ["String"]
  5856. }),
  5857. globals.Behavior);
  5858. smalltalk.addMethod(
  5859. smalltalk.method({
  5860. selector: "methods",
  5861. protocol: 'accessing',
  5862. fn: function (){
  5863. var self=this;
  5864. return smalltalk.withContext(function($ctx1) {
  5865. var $1;
  5866. $1=_st(self._methodDictionary())._values();
  5867. return $1;
  5868. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.Behavior)})},
  5869. args: [],
  5870. source: "methods\x0a\x09^ self methodDictionary values",
  5871. messageSends: ["values", "methodDictionary"],
  5872. referencedClasses: []
  5873. }),
  5874. globals.Behavior);
  5875. smalltalk.addMethod(
  5876. smalltalk.method({
  5877. selector: "methodsFor:",
  5878. protocol: 'accessing',
  5879. fn: function (aString){
  5880. var self=this;
  5881. function $ClassCategoryReader(){return globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  5882. return smalltalk.withContext(function($ctx1) {
  5883. var $2,$3,$1;
  5884. $2=_st($ClassCategoryReader())._new();
  5885. _st($2)._class_category_(self,aString);
  5886. $3=_st($2)._yourself();
  5887. $1=$3;
  5888. return $1;
  5889. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},globals.Behavior)})},
  5890. args: ["aString"],
  5891. source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  5892. messageSends: ["class:category:", "new", "yourself"],
  5893. referencedClasses: ["ClassCategoryReader"]
  5894. }),
  5895. globals.Behavior);
  5896. smalltalk.addMethod(
  5897. smalltalk.method({
  5898. selector: "methodsFor:stamp:",
  5899. protocol: 'accessing',
  5900. fn: function (aString,aStamp){
  5901. var self=this;
  5902. return smalltalk.withContext(function($ctx1) {
  5903. var $1;
  5904. $1=self._methodsFor_(aString);
  5905. return $1;
  5906. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},globals.Behavior)})},
  5907. args: ["aString", "aStamp"],
  5908. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  5909. messageSends: ["methodsFor:"],
  5910. referencedClasses: []
  5911. }),
  5912. globals.Behavior);
  5913. smalltalk.addMethod(
  5914. smalltalk.method({
  5915. selector: "methodsInProtocol:",
  5916. protocol: 'accessing',
  5917. fn: function (aString){
  5918. var self=this;
  5919. return smalltalk.withContext(function($ctx1) {
  5920. var $1;
  5921. $1=_st(self._methods())._select_((function(each){
  5922. return smalltalk.withContext(function($ctx2) {
  5923. return _st(_st(each)._protocol()).__eq(aString);
  5924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5925. return $1;
  5926. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.Behavior)})},
  5927. args: ["aString"],
  5928. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  5929. messageSends: ["select:", "methods", "=", "protocol"],
  5930. referencedClasses: []
  5931. }),
  5932. globals.Behavior);
  5933. smalltalk.addMethod(
  5934. smalltalk.method({
  5935. selector: "name",
  5936. protocol: 'accessing',
  5937. fn: function (){
  5938. var self=this;
  5939. return smalltalk.withContext(function($ctx1) {
  5940. return self.className || nil;
  5941. return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Behavior)})},
  5942. args: [],
  5943. source: "name\x0a\x09<return self.className || nil>",
  5944. messageSends: [],
  5945. referencedClasses: []
  5946. }),
  5947. globals.Behavior);
  5948. smalltalk.addMethod(
  5949. smalltalk.method({
  5950. selector: "new",
  5951. protocol: 'instance creation',
  5952. fn: function (){
  5953. var self=this;
  5954. return smalltalk.withContext(function($ctx1) {
  5955. var $1;
  5956. $1=_st(self._basicNew())._initialize();
  5957. return $1;
  5958. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Behavior)})},
  5959. args: [],
  5960. source: "new\x0a\x09^ self basicNew initialize",
  5961. messageSends: ["initialize", "basicNew"],
  5962. referencedClasses: []
  5963. }),
  5964. globals.Behavior);
  5965. smalltalk.addMethod(
  5966. smalltalk.method({
  5967. selector: "organization",
  5968. protocol: 'accessing',
  5969. fn: function (){
  5970. var self=this;
  5971. return smalltalk.withContext(function($ctx1) {
  5972. var $1;
  5973. $1=self._basicAt_("organization");
  5974. return $1;
  5975. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Behavior)})},
  5976. args: [],
  5977. source: "organization\x0a\x09^ self basicAt: 'organization'",
  5978. messageSends: ["basicAt:"],
  5979. referencedClasses: []
  5980. }),
  5981. globals.Behavior);
  5982. smalltalk.addMethod(
  5983. smalltalk.method({
  5984. selector: "ownMethods",
  5985. protocol: 'accessing',
  5986. fn: function (){
  5987. var self=this;
  5988. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5989. return smalltalk.withContext(function($ctx1) {
  5990. var $2,$1;
  5991. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  5992. return smalltalk.withContext(function($ctx2) {
  5993. return _st(acc).__comma(self._methodsInProtocol_(each));
  5994. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})})))._sorted_((function(a,b){
  5995. return smalltalk.withContext(function($ctx2) {
  5996. $2=_st(a)._selector();
  5997. $ctx2.sendIdx["selector"]=1;
  5998. return _st($2).__lt_eq(_st(b)._selector());
  5999. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}));
  6000. return $1;
  6001. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},globals.Behavior)})},
  6002. args: [],
  6003. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  6004. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"],
  6005. referencedClasses: ["OrderedCollection"]
  6006. }),
  6007. globals.Behavior);
  6008. smalltalk.addMethod(
  6009. smalltalk.method({
  6010. selector: "ownProtocols",
  6011. protocol: 'accessing',
  6012. fn: function (){
  6013. var self=this;
  6014. return smalltalk.withContext(function($ctx1) {
  6015. var $1;
  6016. $1=_st(self._protocols())._reject_((function(each){
  6017. return smalltalk.withContext(function($ctx2) {
  6018. return _st(each)._match_("^\x5c*");
  6019. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6020. return $1;
  6021. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},globals.Behavior)})},
  6022. args: [],
  6023. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  6024. messageSends: ["reject:", "protocols", "match:"],
  6025. referencedClasses: []
  6026. }),
  6027. globals.Behavior);
  6028. smalltalk.addMethod(
  6029. smalltalk.method({
  6030. selector: "protocols",
  6031. protocol: 'accessing',
  6032. fn: function (){
  6033. var self=this;
  6034. return smalltalk.withContext(function($ctx1) {
  6035. var $1;
  6036. $1=_st(_st(self._organization())._elements())._sorted();
  6037. return $1;
  6038. }, function($ctx1) {$ctx1.fill(self,"protocols",{},globals.Behavior)})},
  6039. args: [],
  6040. source: "protocols\x0a\x09^ self organization elements sorted",
  6041. messageSends: ["sorted", "elements", "organization"],
  6042. referencedClasses: []
  6043. }),
  6044. globals.Behavior);
  6045. smalltalk.addMethod(
  6046. smalltalk.method({
  6047. selector: "protocolsDo:",
  6048. protocol: 'enumerating',
  6049. fn: function (aBlock){
  6050. var self=this;
  6051. var methodsByProtocol;
  6052. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  6053. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  6054. return smalltalk.withContext(function($ctx1) {
  6055. methodsByProtocol=_st($HashedCollection())._new();
  6056. $ctx1.sendIdx["new"]=1;
  6057. _st(self._methodDictionary())._valuesDo_((function(m){
  6058. return smalltalk.withContext(function($ctx2) {
  6059. return _st(_st(methodsByProtocol)._at_ifAbsentPut_(_st(m)._protocol(),(function(){
  6060. return smalltalk.withContext(function($ctx3) {
  6061. return _st($Array())._new();
  6062. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._add_(m);
  6063. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
  6064. _st(self._protocols())._do_((function(protocol){
  6065. return smalltalk.withContext(function($ctx2) {
  6066. return _st(aBlock)._value_value_(protocol,_st(methodsByProtocol)._at_(protocol));
  6067. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)})}));
  6068. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},globals.Behavior)})},
  6069. args: ["aBlock"],
  6070. source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method protocol with\x0a\x09its collection of methods in the sort order of protocol name.\x22\x0a\x0a\x09| methodsByProtocol |\x0a\x09methodsByProtocol := HashedCollection new.\x0a\x09self methodDictionary valuesDo: [ :m |\x0a\x09\x09(methodsByProtocol at: m protocol ifAbsentPut: [ Array new ])\x0a\x09\x09\x09add: m ].\x0a\x09self protocols do: [ :protocol |\x0a\x09\x09aBlock value: protocol value: (methodsByProtocol at: protocol) ]",
  6071. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"],
  6072. referencedClasses: ["HashedCollection", "Array"]
  6073. }),
  6074. globals.Behavior);
  6075. smalltalk.addMethod(
  6076. smalltalk.method({
  6077. selector: "prototype",
  6078. protocol: 'accessing',
  6079. fn: function (){
  6080. var self=this;
  6081. return smalltalk.withContext(function($ctx1) {
  6082. return self.fn.prototype;
  6083. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},globals.Behavior)})},
  6084. args: [],
  6085. source: "prototype\x0a\x09<return self.fn.prototype>",
  6086. messageSends: [],
  6087. referencedClasses: []
  6088. }),
  6089. globals.Behavior);
  6090. smalltalk.addMethod(
  6091. smalltalk.method({
  6092. selector: "recompile",
  6093. protocol: 'compiling',
  6094. fn: function (){
  6095. var self=this;
  6096. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6097. return smalltalk.withContext(function($ctx1) {
  6098. var $1;
  6099. $1=_st(_st($Compiler())._new())._recompile_(self);
  6100. return $1;
  6101. }, function($ctx1) {$ctx1.fill(self,"recompile",{},globals.Behavior)})},
  6102. args: [],
  6103. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6104. messageSends: ["recompile:", "new"],
  6105. referencedClasses: ["Compiler"]
  6106. }),
  6107. globals.Behavior);
  6108. smalltalk.addMethod(
  6109. smalltalk.method({
  6110. selector: "removeCompiledMethod:",
  6111. protocol: 'compiling',
  6112. fn: function (aMethod){
  6113. var self=this;
  6114. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6115. function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  6116. return smalltalk.withContext(function($ctx1) {
  6117. var $1,$2;
  6118. self._basicRemoveCompiledMethod_(aMethod);
  6119. self._removeProtocolIfEmpty_(_st(aMethod)._protocol());
  6120. $1=_st($MethodRemoved())._new();
  6121. _st($1)._method_(aMethod);
  6122. $2=_st($1)._yourself();
  6123. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6124. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},globals.Behavior)})},
  6125. args: ["aMethod"],
  6126. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self removeProtocolIfEmpty: aMethod protocol.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  6127. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"],
  6128. referencedClasses: ["SystemAnnouncer", "MethodRemoved"]
  6129. }),
  6130. globals.Behavior);
  6131. smalltalk.addMethod(
  6132. smalltalk.method({
  6133. selector: "removeProtocolIfEmpty:",
  6134. protocol: 'accessing',
  6135. fn: function (aString){
  6136. var self=this;
  6137. return smalltalk.withContext(function($ctx1) {
  6138. _st(self._methods())._detect_ifNone_((function(each){
  6139. return smalltalk.withContext(function($ctx2) {
  6140. return _st(_st(each)._protocol()).__eq(aString);
  6141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  6142. return smalltalk.withContext(function($ctx2) {
  6143. return _st(self._organization())._removeElement_(aString);
  6144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6145. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},globals.Behavior)})},
  6146. args: ["aString"],
  6147. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6148. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"],
  6149. referencedClasses: []
  6150. }),
  6151. globals.Behavior);
  6152. smalltalk.addMethod(
  6153. smalltalk.method({
  6154. selector: "selectors",
  6155. protocol: 'accessing',
  6156. fn: function (){
  6157. var self=this;
  6158. return smalltalk.withContext(function($ctx1) {
  6159. var $1;
  6160. $1=_st(self._methodDictionary())._keys();
  6161. return $1;
  6162. }, function($ctx1) {$ctx1.fill(self,"selectors",{},globals.Behavior)})},
  6163. args: [],
  6164. source: "selectors\x0a\x09^ self methodDictionary keys",
  6165. messageSends: ["keys", "methodDictionary"],
  6166. referencedClasses: []
  6167. }),
  6168. globals.Behavior);
  6169. smalltalk.addMethod(
  6170. smalltalk.method({
  6171. selector: "subclasses",
  6172. protocol: 'accessing',
  6173. fn: function (){
  6174. var self=this;
  6175. return smalltalk.withContext(function($ctx1) {
  6176. self._subclassResponsibility();
  6177. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Behavior)})},
  6178. args: [],
  6179. source: "subclasses\x0a\x09self subclassResponsibility",
  6180. messageSends: ["subclassResponsibility"],
  6181. referencedClasses: []
  6182. }),
  6183. globals.Behavior);
  6184. smalltalk.addMethod(
  6185. smalltalk.method({
  6186. selector: "superclass",
  6187. protocol: 'accessing',
  6188. fn: function (){
  6189. var self=this;
  6190. return smalltalk.withContext(function($ctx1) {
  6191. return self.superclass || nil;
  6192. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},globals.Behavior)})},
  6193. args: [],
  6194. source: "superclass\x0a\x09<return self.superclass || nil>",
  6195. messageSends: [],
  6196. referencedClasses: []
  6197. }),
  6198. globals.Behavior);
  6199. smalltalk.addMethod(
  6200. smalltalk.method({
  6201. selector: "theMetaClass",
  6202. protocol: 'accessing',
  6203. fn: function (){
  6204. var self=this;
  6205. return smalltalk.withContext(function($ctx1) {
  6206. var $1;
  6207. $1=self._class();
  6208. return $1;
  6209. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},globals.Behavior)})},
  6210. args: [],
  6211. source: "theMetaClass\x0a\x09^ self class",
  6212. messageSends: ["class"],
  6213. referencedClasses: []
  6214. }),
  6215. globals.Behavior);
  6216. smalltalk.addMethod(
  6217. smalltalk.method({
  6218. selector: "theNonMetaClass",
  6219. protocol: 'accessing',
  6220. fn: function (){
  6221. var self=this;
  6222. return self;
  6223. },
  6224. args: [],
  6225. source: "theNonMetaClass\x0a\x09^ self",
  6226. messageSends: [],
  6227. referencedClasses: []
  6228. }),
  6229. globals.Behavior);
  6230. smalltalk.addMethod(
  6231. smalltalk.method({
  6232. selector: "withAllSubclasses",
  6233. protocol: 'accessing',
  6234. fn: function (){
  6235. var self=this;
  6236. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  6237. return smalltalk.withContext(function($ctx1) {
  6238. var $2,$3,$1;
  6239. $2=_st($Array())._with_(self);
  6240. _st($2)._addAll_(self._allSubclasses());
  6241. $3=_st($2)._yourself();
  6242. $1=$3;
  6243. return $1;
  6244. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},globals.Behavior)})},
  6245. args: [],
  6246. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6247. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"],
  6248. referencedClasses: ["Array"]
  6249. }),
  6250. globals.Behavior);
  6251. smalltalk.addClass('Class', globals.Behavior, [], 'Kernel-Classes');
  6252. globals.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  6253. smalltalk.addMethod(
  6254. smalltalk.method({
  6255. selector: "asJavascript",
  6256. protocol: 'converting',
  6257. fn: function (){
  6258. var self=this;
  6259. return smalltalk.withContext(function($ctx1) {
  6260. var $1;
  6261. $1="globals.".__comma(self._name());
  6262. return $1;
  6263. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Class)})},
  6264. args: [],
  6265. source: "asJavascript\x0a\x09^ 'globals.', self name",
  6266. messageSends: [",", "name"],
  6267. referencedClasses: []
  6268. }),
  6269. globals.Class);
  6270. smalltalk.addMethod(
  6271. smalltalk.method({
  6272. selector: "browse",
  6273. protocol: 'browsing',
  6274. fn: function (){
  6275. var self=this;
  6276. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  6277. return smalltalk.withContext(function($ctx1) {
  6278. _st($Finder())._findClass_(self);
  6279. return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Class)})},
  6280. args: [],
  6281. source: "browse\x0a\x09Finder findClass: self",
  6282. messageSends: ["findClass:"],
  6283. referencedClasses: ["Finder"]
  6284. }),
  6285. globals.Class);
  6286. smalltalk.addMethod(
  6287. smalltalk.method({
  6288. selector: "category",
  6289. protocol: 'accessing',
  6290. fn: function (){
  6291. var self=this;
  6292. return smalltalk.withContext(function($ctx1) {
  6293. var $2,$1,$receiver;
  6294. $2=self._package();
  6295. $ctx1.sendIdx["package"]=1;
  6296. if(($receiver = $2) == null || $receiver.isNil){
  6297. $1="Unclassified";
  6298. } else {
  6299. $1=_st(self._package())._name();
  6300. };
  6301. return $1;
  6302. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.Class)})},
  6303. args: [],
  6304. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6305. messageSends: ["ifNil:ifNotNil:", "package", "name"],
  6306. referencedClasses: []
  6307. }),
  6308. globals.Class);
  6309. smalltalk.addMethod(
  6310. smalltalk.method({
  6311. selector: "definition",
  6312. protocol: 'accessing',
  6313. fn: function (){
  6314. var self=this;
  6315. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6316. return smalltalk.withContext(function($ctx1) {
  6317. var $3,$4,$2,$5,$6,$7,$1;
  6318. $1=_st($String())._streamContents_((function(stream){
  6319. return smalltalk.withContext(function($ctx2) {
  6320. _st(stream)._nextPutAll_(_st(self._superclass())._asString());
  6321. $ctx2.sendIdx["nextPutAll:"]=1;
  6322. _st(stream)._nextPutAll_(" subclass: #");
  6323. $ctx2.sendIdx["nextPutAll:"]=2;
  6324. _st(stream)._nextPutAll_(self._name());
  6325. $ctx2.sendIdx["nextPutAll:"]=3;
  6326. $3=_st($String())._lf();
  6327. $ctx2.sendIdx["lf"]=1;
  6328. $4=_st($String())._tab();
  6329. $ctx2.sendIdx["tab"]=1;
  6330. $2=_st($3).__comma($4);
  6331. $ctx2.sendIdx[","]=1;
  6332. _st(stream)._nextPutAll_($2);
  6333. $ctx2.sendIdx["nextPutAll:"]=4;
  6334. $5=_st(stream)._nextPutAll_("instanceVariableNames: '");
  6335. $ctx2.sendIdx["nextPutAll:"]=5;
  6336. $5;
  6337. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  6338. return smalltalk.withContext(function($ctx3) {
  6339. return _st(stream)._nextPutAll_(each);
  6340. $ctx3.sendIdx["nextPutAll:"]=6;
  6341. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  6342. return smalltalk.withContext(function($ctx3) {
  6343. return _st(stream)._nextPutAll_(" ");
  6344. $ctx3.sendIdx["nextPutAll:"]=7;
  6345. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  6346. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  6347. $ctx2.sendIdx[","]=2;
  6348. _st(stream)._nextPutAll_($6);
  6349. $ctx2.sendIdx["nextPutAll:"]=8;
  6350. _st(stream)._nextPutAll_("package: '");
  6351. $ctx2.sendIdx["nextPutAll:"]=9;
  6352. _st(stream)._nextPutAll_(self._category());
  6353. $ctx2.sendIdx["nextPutAll:"]=10;
  6354. $7=_st(stream)._nextPutAll_("'");
  6355. return $7;
  6356. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  6357. return $1;
  6358. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Class)})},
  6359. args: [],
  6360. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  6361. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"],
  6362. referencedClasses: ["String"]
  6363. }),
  6364. globals.Class);
  6365. smalltalk.addMethod(
  6366. smalltalk.method({
  6367. selector: "isClass",
  6368. protocol: 'testing',
  6369. fn: function (){
  6370. var self=this;
  6371. return true;
  6372. },
  6373. args: [],
  6374. source: "isClass\x0a\x09^ true",
  6375. messageSends: [],
  6376. referencedClasses: []
  6377. }),
  6378. globals.Class);
  6379. smalltalk.addMethod(
  6380. smalltalk.method({
  6381. selector: "package",
  6382. protocol: 'accessing',
  6383. fn: function (){
  6384. var self=this;
  6385. return smalltalk.withContext(function($ctx1) {
  6386. var $1;
  6387. $1=self._basicAt_("pkg");
  6388. return $1;
  6389. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Class)})},
  6390. args: [],
  6391. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6392. messageSends: ["basicAt:"],
  6393. referencedClasses: []
  6394. }),
  6395. globals.Class);
  6396. smalltalk.addMethod(
  6397. smalltalk.method({
  6398. selector: "package:",
  6399. protocol: 'accessing',
  6400. fn: function (aPackage){
  6401. var self=this;
  6402. var oldPackage;
  6403. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6404. function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  6405. return smalltalk.withContext(function($ctx1) {
  6406. var $2,$1,$3,$4,$5;
  6407. $2=self._package();
  6408. $ctx1.sendIdx["package"]=1;
  6409. $1=_st($2).__eq(aPackage);
  6410. if(smalltalk.assert($1)){
  6411. return self;
  6412. };
  6413. oldPackage=self._package();
  6414. self._basicAt_put_("pkg",aPackage);
  6415. $3=_st(oldPackage)._organization();
  6416. $ctx1.sendIdx["organization"]=1;
  6417. _st($3)._removeElement_(self);
  6418. _st(_st(aPackage)._organization())._addElement_(self);
  6419. $4=_st($ClassMoved())._new();
  6420. _st($4)._theClass_(self);
  6421. _st($4)._oldPackage_(oldPackage);
  6422. $5=_st($4)._yourself();
  6423. _st(_st($SystemAnnouncer())._current())._announce_($5);
  6424. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},globals.Class)})},
  6425. args: ["aPackage"],
  6426. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  6427. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"],
  6428. referencedClasses: ["SystemAnnouncer", "ClassMoved"]
  6429. }),
  6430. globals.Class);
  6431. smalltalk.addMethod(
  6432. smalltalk.method({
  6433. selector: "printOn:",
  6434. protocol: 'printing',
  6435. fn: function (aStream){
  6436. var self=this;
  6437. return smalltalk.withContext(function($ctx1) {
  6438. _st(aStream)._nextPutAll_(self._name());
  6439. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Class)})},
  6440. args: ["aStream"],
  6441. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  6442. messageSends: ["nextPutAll:", "name"],
  6443. referencedClasses: []
  6444. }),
  6445. globals.Class);
  6446. smalltalk.addMethod(
  6447. smalltalk.method({
  6448. selector: "rename:",
  6449. protocol: 'accessing',
  6450. fn: function (aString){
  6451. var self=this;
  6452. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6453. return smalltalk.withContext(function($ctx1) {
  6454. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  6455. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},globals.Class)})},
  6456. args: ["aString"],
  6457. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  6458. messageSends: ["renameClass:to:", "new"],
  6459. referencedClasses: ["ClassBuilder"]
  6460. }),
  6461. globals.Class);
  6462. smalltalk.addMethod(
  6463. smalltalk.method({
  6464. selector: "subclass:instanceVariableNames:",
  6465. protocol: 'class creation',
  6466. fn: function (aString,anotherString){
  6467. var self=this;
  6468. return smalltalk.withContext(function($ctx1) {
  6469. var $1;
  6470. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6471. return $1;
  6472. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.Class)})},
  6473. args: ["aString", "anotherString"],
  6474. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6475. messageSends: ["subclass:instanceVariableNames:package:"],
  6476. referencedClasses: []
  6477. }),
  6478. globals.Class);
  6479. smalltalk.addMethod(
  6480. smalltalk.method({
  6481. selector: "subclass:instanceVariableNames:category:",
  6482. protocol: 'class creation',
  6483. fn: function (aString,aString2,aString3){
  6484. var self=this;
  6485. return smalltalk.withContext(function($ctx1) {
  6486. var $1;
  6487. self._deprecatedAPI();
  6488. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6489. return $1;
  6490. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
  6491. args: ["aString", "aString2", "aString3"],
  6492. 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",
  6493. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  6494. referencedClasses: []
  6495. }),
  6496. globals.Class);
  6497. smalltalk.addMethod(
  6498. smalltalk.method({
  6499. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  6500. protocol: 'class creation',
  6501. fn: function (aString,aString2,classVars,pools,aString3){
  6502. var self=this;
  6503. return smalltalk.withContext(function($ctx1) {
  6504. var $1;
  6505. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6506. return $1;
  6507. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},globals.Class)})},
  6508. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  6509. source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  6510. messageSends: ["subclass:instanceVariableNames:package:"],
  6511. referencedClasses: []
  6512. }),
  6513. globals.Class);
  6514. smalltalk.addMethod(
  6515. smalltalk.method({
  6516. selector: "subclass:instanceVariableNames:package:",
  6517. protocol: 'class creation',
  6518. fn: function (aString,aString2,aString3){
  6519. var self=this;
  6520. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6521. return smalltalk.withContext(function($ctx1) {
  6522. var $1;
  6523. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6524. return $1;
  6525. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)})},
  6526. args: ["aString", "aString2", "aString3"],
  6527. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6528. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  6529. referencedClasses: ["ClassBuilder"]
  6530. }),
  6531. globals.Class);
  6532. smalltalk.addMethod(
  6533. smalltalk.method({
  6534. selector: "subclasses",
  6535. protocol: 'accessing',
  6536. fn: function (){
  6537. var self=this;
  6538. return smalltalk.withContext(function($ctx1) {
  6539. return self.subclasses._copy();
  6540. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Class)})},
  6541. args: [],
  6542. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  6543. messageSends: [],
  6544. referencedClasses: []
  6545. }),
  6546. globals.Class);
  6547. smalltalk.addClass('Metaclass', globals.Behavior, [], 'Kernel-Classes');
  6548. globals.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  6549. smalltalk.addMethod(
  6550. smalltalk.method({
  6551. selector: "asJavascript",
  6552. protocol: 'converting',
  6553. fn: function (){
  6554. var self=this;
  6555. return smalltalk.withContext(function($ctx1) {
  6556. var $1;
  6557. $1=_st("globals.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  6558. $ctx1.sendIdx[","]=1;
  6559. return $1;
  6560. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Metaclass)})},
  6561. args: [],
  6562. source: "asJavascript\x0a\x09^ 'globals.', self instanceClass name, '.klass'",
  6563. messageSends: [",", "name", "instanceClass"],
  6564. referencedClasses: []
  6565. }),
  6566. globals.Metaclass);
  6567. smalltalk.addMethod(
  6568. smalltalk.method({
  6569. selector: "definition",
  6570. protocol: 'accessing',
  6571. fn: function (){
  6572. var self=this;
  6573. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6574. return smalltalk.withContext(function($ctx1) {
  6575. var $2,$1;
  6576. $1=_st($String())._streamContents_((function(stream){
  6577. return smalltalk.withContext(function($ctx2) {
  6578. _st(stream)._nextPutAll_(self._asString());
  6579. $ctx2.sendIdx["nextPutAll:"]=1;
  6580. $2=_st(stream)._nextPutAll_(" instanceVariableNames: '");
  6581. $ctx2.sendIdx["nextPutAll:"]=2;
  6582. $2;
  6583. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  6584. return smalltalk.withContext(function($ctx3) {
  6585. return _st(stream)._nextPutAll_(each);
  6586. $ctx3.sendIdx["nextPutAll:"]=3;
  6587. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  6588. return smalltalk.withContext(function($ctx3) {
  6589. return _st(stream)._nextPutAll_(" ");
  6590. $ctx3.sendIdx["nextPutAll:"]=4;
  6591. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  6592. return _st(stream)._nextPutAll_("'");
  6593. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  6594. return $1;
  6595. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Metaclass)})},
  6596. args: [],
  6597. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  6598. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  6599. referencedClasses: ["String"]
  6600. }),
  6601. globals.Metaclass);
  6602. smalltalk.addMethod(
  6603. smalltalk.method({
  6604. selector: "instanceClass",
  6605. protocol: 'accessing',
  6606. fn: function (){
  6607. var self=this;
  6608. return smalltalk.withContext(function($ctx1) {
  6609. return self.instanceClass;
  6610. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},globals.Metaclass)})},
  6611. args: [],
  6612. source: "instanceClass\x0a\x09<return self.instanceClass>",
  6613. messageSends: [],
  6614. referencedClasses: []
  6615. }),
  6616. globals.Metaclass);
  6617. smalltalk.addMethod(
  6618. smalltalk.method({
  6619. selector: "instanceVariableNames:",
  6620. protocol: 'accessing',
  6621. fn: function (aCollection){
  6622. var self=this;
  6623. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6624. return smalltalk.withContext(function($ctx1) {
  6625. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  6626. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},globals.Metaclass)})},
  6627. args: ["aCollection"],
  6628. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  6629. messageSends: ["class:instanceVariableNames:", "new"],
  6630. referencedClasses: ["ClassBuilder"]
  6631. }),
  6632. globals.Metaclass);
  6633. smalltalk.addMethod(
  6634. smalltalk.method({
  6635. selector: "isMetaclass",
  6636. protocol: 'testing',
  6637. fn: function (){
  6638. var self=this;
  6639. return true;
  6640. },
  6641. args: [],
  6642. source: "isMetaclass\x0a\x09^ true",
  6643. messageSends: [],
  6644. referencedClasses: []
  6645. }),
  6646. globals.Metaclass);
  6647. smalltalk.addMethod(
  6648. smalltalk.method({
  6649. selector: "package",
  6650. protocol: 'accessing',
  6651. fn: function (){
  6652. var self=this;
  6653. return smalltalk.withContext(function($ctx1) {
  6654. var $1;
  6655. $1=_st(self._instanceClass())._package();
  6656. return $1;
  6657. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Metaclass)})},
  6658. args: [],
  6659. source: "package\x0a\x09^ self instanceClass package",
  6660. messageSends: ["package", "instanceClass"],
  6661. referencedClasses: []
  6662. }),
  6663. globals.Metaclass);
  6664. smalltalk.addMethod(
  6665. smalltalk.method({
  6666. selector: "printOn:",
  6667. protocol: 'printing',
  6668. fn: function (aStream){
  6669. var self=this;
  6670. return smalltalk.withContext(function($ctx1) {
  6671. var $1;
  6672. _st(aStream)._nextPutAll_(_st(self._instanceClass())._name());
  6673. $ctx1.sendIdx["nextPutAll:"]=1;
  6674. $1=_st(aStream)._nextPutAll_(" class");
  6675. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Metaclass)})},
  6676. args: ["aStream"],
  6677. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  6678. messageSends: ["nextPutAll:", "name", "instanceClass"],
  6679. referencedClasses: []
  6680. }),
  6681. globals.Metaclass);
  6682. smalltalk.addMethod(
  6683. smalltalk.method({
  6684. selector: "subclasses",
  6685. protocol: 'accessing',
  6686. fn: function (){
  6687. var self=this;
  6688. return smalltalk.withContext(function($ctx1) {
  6689. var $1;
  6690. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  6691. return smalltalk.withContext(function($ctx2) {
  6692. return _st(_st(each)._isMetaclass())._not();
  6693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  6694. return smalltalk.withContext(function($ctx2) {
  6695. return _st(each)._theMetaClass();
  6696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  6697. return $1;
  6698. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Metaclass)})},
  6699. args: [],
  6700. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  6701. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"],
  6702. referencedClasses: []
  6703. }),
  6704. globals.Metaclass);
  6705. smalltalk.addMethod(
  6706. smalltalk.method({
  6707. selector: "theMetaClass",
  6708. protocol: 'accessing',
  6709. fn: function (){
  6710. var self=this;
  6711. return self;
  6712. },
  6713. args: [],
  6714. source: "theMetaClass\x0a\x09^ self",
  6715. messageSends: [],
  6716. referencedClasses: []
  6717. }),
  6718. globals.Metaclass);
  6719. smalltalk.addMethod(
  6720. smalltalk.method({
  6721. selector: "theNonMetaClass",
  6722. protocol: 'accessing',
  6723. fn: function (){
  6724. var self=this;
  6725. return smalltalk.withContext(function($ctx1) {
  6726. var $1;
  6727. $1=self._instanceClass();
  6728. return $1;
  6729. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},globals.Metaclass)})},
  6730. args: [],
  6731. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  6732. messageSends: ["instanceClass"],
  6733. referencedClasses: []
  6734. }),
  6735. globals.Metaclass);
  6736. smalltalk.addClass('ClassBuilder', globals.Object, [], 'Kernel-Classes');
  6737. globals.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  6738. smalltalk.addMethod(
  6739. smalltalk.method({
  6740. selector: "addSubclassOf:named:instanceVariableNames:package:",
  6741. protocol: 'class definition',
  6742. fn: function (aClass,className,aCollection,packageName){
  6743. var self=this;
  6744. var theClass,thePackage;
  6745. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  6746. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  6747. return smalltalk.withContext(function($ctx1) {
  6748. var $1,$2,$3,$4,$receiver;
  6749. theClass=_st(_st($Smalltalk())._globals())._at_(className);
  6750. thePackage=_st($Package())._named_(packageName);
  6751. $1=theClass;
  6752. if(($receiver = $1) == null || $receiver.isNil){
  6753. $1;
  6754. } else {
  6755. _st(theClass)._package_(thePackage);
  6756. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  6757. if(! smalltalk.assert($2)){
  6758. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  6759. return $3;
  6760. };
  6761. };
  6762. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  6763. return $4;
  6764. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},globals.ClassBuilder)})},
  6765. args: ["aClass", "className", "aCollection", "packageName"],
  6766. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  6767. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  6768. referencedClasses: ["Smalltalk", "Package"]
  6769. }),
  6770. globals.ClassBuilder);
  6771. smalltalk.addMethod(
  6772. smalltalk.method({
  6773. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  6774. protocol: 'private',
  6775. fn: function (aClass,aString,aCollection,packageName){
  6776. var self=this;
  6777. return smalltalk.withContext(function($ctx1) {
  6778. smalltalk.addClass(aString, aClass, aCollection, packageName);
  6779. return globals[aString]
  6780. ;
  6781. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},globals.ClassBuilder)})},
  6782. args: ["aClass", "aString", "aCollection", "packageName"],
  6783. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return globals[aString]\x0a\x09>",
  6784. messageSends: [],
  6785. referencedClasses: []
  6786. }),
  6787. globals.ClassBuilder);
  6788. smalltalk.addMethod(
  6789. smalltalk.method({
  6790. selector: "basicClass:instanceVariableNames:",
  6791. protocol: 'private',
  6792. fn: function (aClass,aString){
  6793. var self=this;
  6794. return smalltalk.withContext(function($ctx1) {
  6795. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  6796. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  6797. args: ["aClass", "aString"],
  6798. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  6799. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  6800. referencedClasses: []
  6801. }),
  6802. globals.ClassBuilder);
  6803. smalltalk.addMethod(
  6804. smalltalk.method({
  6805. selector: "basicClass:instanceVariables:",
  6806. protocol: 'private',
  6807. fn: function (aClass,aCollection){
  6808. var self=this;
  6809. return smalltalk.withContext(function($ctx1) {
  6810. var $1;
  6811. $1=_st(aClass)._isMetaclass();
  6812. if(! smalltalk.assert($1)){
  6813. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  6814. };
  6815. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  6816. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},globals.ClassBuilder)})},
  6817. args: ["aClass", "aCollection"],
  6818. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  6819. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"],
  6820. referencedClasses: []
  6821. }),
  6822. globals.ClassBuilder);
  6823. smalltalk.addMethod(
  6824. smalltalk.method({
  6825. selector: "basicRemoveClass:",
  6826. protocol: 'private',
  6827. fn: function (aClass){
  6828. var self=this;
  6829. return smalltalk.withContext(function($ctx1) {
  6830. smalltalk.removeClass(aClass);
  6831. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},globals.ClassBuilder)})},
  6832. args: ["aClass"],
  6833. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  6834. messageSends: [],
  6835. referencedClasses: []
  6836. }),
  6837. globals.ClassBuilder);
  6838. smalltalk.addMethod(
  6839. smalltalk.method({
  6840. selector: "basicRenameClass:to:",
  6841. protocol: 'private',
  6842. fn: function (aClass,aString){
  6843. var self=this;
  6844. return smalltalk.withContext(function($ctx1) {
  6845. globals[aString] = aClass;
  6846. delete globals[aClass.className];
  6847. aClass.className = aString;
  6848. ;
  6849. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  6850. args: ["aClass", "aString"],
  6851. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09\x09delete globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  6852. messageSends: [],
  6853. referencedClasses: []
  6854. }),
  6855. globals.ClassBuilder);
  6856. smalltalk.addMethod(
  6857. smalltalk.method({
  6858. selector: "basicSwapClassNames:with:",
  6859. protocol: 'private',
  6860. fn: function (aClass,anotherClass){
  6861. var self=this;
  6862. return smalltalk.withContext(function($ctx1) {
  6863. var tmp = aClass.className;
  6864. aClass.className = anotherClass.className;
  6865. anotherClass.className = tmp;
  6866. ;
  6867. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  6868. args: ["aClass", "anotherClass"],
  6869. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  6870. messageSends: [],
  6871. referencedClasses: []
  6872. }),
  6873. globals.ClassBuilder);
  6874. smalltalk.addMethod(
  6875. smalltalk.method({
  6876. selector: "class:instanceVariableNames:",
  6877. protocol: 'class definition',
  6878. fn: function (aClass,ivarNames){
  6879. var self=this;
  6880. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6881. function $ClassDefinitionChanged(){return globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  6882. return smalltalk.withContext(function($ctx1) {
  6883. var $1,$2;
  6884. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  6885. self._setupClass_(aClass);
  6886. $1=_st($ClassDefinitionChanged())._new();
  6887. _st($1)._theClass_(aClass);
  6888. $2=_st($1)._yourself();
  6889. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6890. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},globals.ClassBuilder)})},
  6891. args: ["aClass", "ivarNames"],
  6892. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  6893. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  6894. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"]
  6895. }),
  6896. globals.ClassBuilder);
  6897. smalltalk.addMethod(
  6898. smalltalk.method({
  6899. selector: "copyClass:named:",
  6900. protocol: 'copying',
  6901. fn: function (aClass,className){
  6902. var self=this;
  6903. var newClass;
  6904. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6905. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  6906. return smalltalk.withContext(function($ctx1) {
  6907. var $1,$2,$3;
  6908. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  6909. self._copyClass_to_(aClass,newClass);
  6910. $1=_st($ClassAdded())._new();
  6911. _st($1)._theClass_(newClass);
  6912. $2=_st($1)._yourself();
  6913. _st(_st($SystemAnnouncer())._current())._announce_($2);
  6914. $3=newClass;
  6915. return $3;
  6916. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},globals.ClassBuilder)})},
  6917. args: ["aClass", "className"],
  6918. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  6919. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"],
  6920. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  6921. }),
  6922. globals.ClassBuilder);
  6923. smalltalk.addMethod(
  6924. smalltalk.method({
  6925. selector: "copyClass:to:",
  6926. protocol: 'copying',
  6927. fn: function (aClass,anotherClass){
  6928. var self=this;
  6929. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6930. return smalltalk.withContext(function($ctx1) {
  6931. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  6932. _st(anotherClass)._comment_(_st(aClass)._comment());
  6933. $1=_st(aClass)._methodDictionary();
  6934. $ctx1.sendIdx["methodDictionary"]=1;
  6935. _st($1)._valuesDo_((function(each){
  6936. return smalltalk.withContext(function($ctx2) {
  6937. $2=_st($Compiler())._new();
  6938. $ctx2.sendIdx["new"]=1;
  6939. $3=_st(each)._source();
  6940. $ctx2.sendIdx["source"]=1;
  6941. $4=_st(each)._protocol();
  6942. $ctx2.sendIdx["protocol"]=1;
  6943. return _st($2)._install_forClass_protocol_($3,anotherClass,$4);
  6944. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  6945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6946. $ctx1.sendIdx["valuesDo:"]=1;
  6947. $5=_st(anotherClass)._class();
  6948. $ctx1.sendIdx["class"]=1;
  6949. $7=_st(aClass)._class();
  6950. $ctx1.sendIdx["class"]=2;
  6951. $6=_st($7)._instanceVariableNames();
  6952. self._basicClass_instanceVariables_($5,$6);
  6953. $9=_st(aClass)._class();
  6954. $ctx1.sendIdx["class"]=3;
  6955. $8=_st($9)._methodDictionary();
  6956. _st($8)._valuesDo_((function(each){
  6957. return smalltalk.withContext(function($ctx2) {
  6958. return _st(_st($Compiler())._new())._install_forClass_protocol_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._protocol());
  6959. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  6960. self._setupClass_(anotherClass);
  6961. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  6962. args: ["aClass", "anotherClass"],
  6963. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass protocol: each protocol ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary valuesDo: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class protocol: each protocol ].\x0a\x0a\x09self setupClass: anotherClass",
  6964. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  6965. referencedClasses: ["Compiler"]
  6966. }),
  6967. globals.ClassBuilder);
  6968. smalltalk.addMethod(
  6969. smalltalk.method({
  6970. selector: "installMethod:forClass:protocol:",
  6971. protocol: 'method definition',
  6972. fn: function (aCompiledMethod,aBehavior,aString){
  6973. var self=this;
  6974. return smalltalk.withContext(function($ctx1) {
  6975. _st(aCompiledMethod)._protocol_(aString);
  6976. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  6977. self._setupClass_(aBehavior);
  6978. return aCompiledMethod;
  6979. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},globals.ClassBuilder)})},
  6980. args: ["aCompiledMethod", "aBehavior", "aString"],
  6981. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^ aCompiledMethod",
  6982. messageSends: ["protocol:", "addCompiledMethod:", "setupClass:"],
  6983. referencedClasses: []
  6984. }),
  6985. globals.ClassBuilder);
  6986. smalltalk.addMethod(
  6987. smalltalk.method({
  6988. selector: "instanceVariableNamesFor:",
  6989. protocol: 'accessing',
  6990. fn: function (aString){
  6991. var self=this;
  6992. return smalltalk.withContext(function($ctx1) {
  6993. var $1;
  6994. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  6995. return smalltalk.withContext(function($ctx2) {
  6996. return _st(each)._isEmpty();
  6997. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6998. return $1;
  6999. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},globals.ClassBuilder)})},
  7000. args: ["aString"],
  7001. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7002. messageSends: ["reject:", "tokenize:", "isEmpty"],
  7003. referencedClasses: []
  7004. }),
  7005. globals.ClassBuilder);
  7006. smalltalk.addMethod(
  7007. smalltalk.method({
  7008. selector: "migrateClass:superclass:",
  7009. protocol: 'class migration',
  7010. fn: function (aClass,anotherClass){
  7011. var self=this;
  7012. return smalltalk.withContext(function($ctx1) {
  7013. var $2,$1;
  7014. $2=_st(aClass)._name();
  7015. $ctx1.sendIdx["name"]=1;
  7016. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  7017. return $1;
  7018. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)})},
  7019. args: ["aClass", "anotherClass"],
  7020. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  7021. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  7022. referencedClasses: []
  7023. }),
  7024. globals.ClassBuilder);
  7025. smalltalk.addMethod(
  7026. smalltalk.method({
  7027. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7028. protocol: 'class migration',
  7029. fn: function (className,aClass,aCollection,packageName){
  7030. var self=this;
  7031. var oldClass,newClass,tmp;
  7032. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7033. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7034. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7035. function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  7036. return smalltalk.withContext(function($ctx1) {
  7037. var $1,$2,$3,$4,$5;
  7038. tmp="new*".__comma(className);
  7039. oldClass=_st(_st($Smalltalk())._globals())._at_(className);
  7040. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7041. self._basicSwapClassNames_with_(oldClass,newClass);
  7042. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7043. _st((function(){
  7044. return smalltalk.withContext(function($ctx2) {
  7045. return self._copyClass_to_(oldClass,newClass);
  7046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
  7047. return smalltalk.withContext(function($ctx2) {
  7048. self._basicSwapClassNames_with_(oldClass,newClass);
  7049. $1=self._basicRemoveClass_(newClass);
  7050. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7051. $1;
  7052. return _st(exception)._signal();
  7053. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
  7054. self._rawRenameClass_to_(oldClass,tmp);
  7055. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7056. $2=self._rawRenameClass_to_(newClass,className);
  7057. _st(_st(oldClass)._subclasses())._do_((function(each){
  7058. return smalltalk.withContext(function($ctx2) {
  7059. return self._migrateClass_superclass_(each,newClass);
  7060. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  7061. self._basicRemoveClass_(oldClass);
  7062. $3=_st($ClassMigrated())._new();
  7063. _st($3)._theClass_(newClass);
  7064. _st($3)._oldClass_(oldClass);
  7065. $4=_st($3)._yourself();
  7066. _st(_st($SystemAnnouncer())._current())._announce_($4);
  7067. $5=newClass;
  7068. return $5;
  7069. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},globals.ClassBuilder)})},
  7070. args: ["className", "aClass", "aCollection", "packageName"],
  7071. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ].\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7072. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"],
  7073. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
  7074. }),
  7075. globals.ClassBuilder);
  7076. smalltalk.addMethod(
  7077. smalltalk.method({
  7078. selector: "rawRenameClass:to:",
  7079. protocol: 'private',
  7080. fn: function (aClass,aString){
  7081. var self=this;
  7082. return smalltalk.withContext(function($ctx1) {
  7083. globals[aString] = aClass;
  7084. ;
  7085. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)})},
  7086. args: ["aClass", "aString"],
  7087. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09>",
  7088. messageSends: [],
  7089. referencedClasses: []
  7090. }),
  7091. globals.ClassBuilder);
  7092. smalltalk.addMethod(
  7093. smalltalk.method({
  7094. selector: "renameClass:to:",
  7095. protocol: 'class migration',
  7096. fn: function (aClass,className){
  7097. var self=this;
  7098. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7099. function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  7100. return smalltalk.withContext(function($ctx1) {
  7101. var $1,$2;
  7102. self._basicRenameClass_to_(aClass,className);
  7103. _st(aClass)._recompile();
  7104. $1=_st($ClassRenamed())._new();
  7105. _st($1)._theClass_(aClass);
  7106. $2=_st($1)._yourself();
  7107. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7108. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},globals.ClassBuilder)})},
  7109. args: ["aClass", "className"],
  7110. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7111. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"],
  7112. referencedClasses: ["SystemAnnouncer", "ClassRenamed"]
  7113. }),
  7114. globals.ClassBuilder);
  7115. smalltalk.addMethod(
  7116. smalltalk.method({
  7117. selector: "setupClass:",
  7118. protocol: 'public',
  7119. fn: function (aClass){
  7120. var self=this;
  7121. return smalltalk.withContext(function($ctx1) {
  7122. smalltalk.init(aClass);;
  7123. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},globals.ClassBuilder)})},
  7124. args: ["aClass"],
  7125. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  7126. messageSends: [],
  7127. referencedClasses: []
  7128. }),
  7129. globals.ClassBuilder);
  7130. smalltalk.addMethod(
  7131. smalltalk.method({
  7132. selector: "superclass:subclass:",
  7133. protocol: 'class definition',
  7134. fn: function (aClass,className){
  7135. var self=this;
  7136. return smalltalk.withContext(function($ctx1) {
  7137. var $1;
  7138. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7139. return $1;
  7140. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},globals.ClassBuilder)})},
  7141. args: ["aClass", "className"],
  7142. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7143. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  7144. referencedClasses: []
  7145. }),
  7146. globals.ClassBuilder);
  7147. smalltalk.addMethod(
  7148. smalltalk.method({
  7149. selector: "superclass:subclass:instanceVariableNames:package:",
  7150. protocol: 'class definition',
  7151. fn: function (aClass,className,ivarNames,packageName){
  7152. var self=this;
  7153. var newClass;
  7154. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7155. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  7156. return smalltalk.withContext(function($ctx1) {
  7157. var $1,$2,$3,$4,$5,$receiver;
  7158. $1=self._instanceVariableNamesFor_(ivarNames);
  7159. if(($receiver = packageName) == null || $receiver.isNil){
  7160. $2="unclassified";
  7161. } else {
  7162. $2=packageName;
  7163. };
  7164. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7165. self._setupClass_(newClass);
  7166. $3=_st($ClassAdded())._new();
  7167. _st($3)._theClass_(newClass);
  7168. $4=_st($3)._yourself();
  7169. _st(_st($SystemAnnouncer())._current())._announce_($4);
  7170. $5=newClass;
  7171. return $5;
  7172. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},globals.ClassBuilder)})},
  7173. args: ["aClass", "className", "ivarNames", "packageName"],
  7174. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: [ 'unclassified' ]).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
  7175. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  7176. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  7177. }),
  7178. globals.ClassBuilder);
  7179. smalltalk.addClass('ClassCategoryReader', globals.Object, ['class', 'category'], 'Kernel-Classes');
  7180. globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  7181. smalltalk.addMethod(
  7182. smalltalk.method({
  7183. selector: "class:category:",
  7184. protocol: 'accessing',
  7185. fn: function (aClass,aString){
  7186. var self=this;
  7187. self["@class"]=aClass;
  7188. self["@category"]=aString;
  7189. return self},
  7190. args: ["aClass", "aString"],
  7191. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  7192. messageSends: [],
  7193. referencedClasses: []
  7194. }),
  7195. globals.ClassCategoryReader);
  7196. smalltalk.addMethod(
  7197. smalltalk.method({
  7198. selector: "compileMethod:",
  7199. protocol: 'private',
  7200. fn: function (aString){
  7201. var self=this;
  7202. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7203. return smalltalk.withContext(function($ctx1) {
  7204. _st(_st($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  7205. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},globals.ClassCategoryReader)})},
  7206. args: ["aString"],
  7207. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  7208. messageSends: ["install:forClass:protocol:", "new"],
  7209. referencedClasses: ["Compiler"]
  7210. }),
  7211. globals.ClassCategoryReader);
  7212. smalltalk.addMethod(
  7213. smalltalk.method({
  7214. selector: "initialize",
  7215. protocol: 'initialization',
  7216. fn: function (){
  7217. var self=this;
  7218. return smalltalk.withContext(function($ctx1) {
  7219. ($ctx1.supercall = true, globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  7220. $ctx1.supercall = false;
  7221. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCategoryReader)})},
  7222. args: [],
  7223. source: "initialize\x0a\x09super initialize.",
  7224. messageSends: ["initialize"],
  7225. referencedClasses: []
  7226. }),
  7227. globals.ClassCategoryReader);
  7228. smalltalk.addMethod(
  7229. smalltalk.method({
  7230. selector: "scanFrom:",
  7231. protocol: 'fileIn',
  7232. fn: function (aChunkParser){
  7233. var self=this;
  7234. var chunk;
  7235. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  7236. return smalltalk.withContext(function($ctx1) {
  7237. _st((function(){
  7238. return smalltalk.withContext(function($ctx2) {
  7239. chunk=_st(aChunkParser)._nextChunk();
  7240. chunk;
  7241. return _st(chunk)._isEmpty();
  7242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  7243. return smalltalk.withContext(function($ctx2) {
  7244. return self._compileMethod_(chunk);
  7245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7246. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  7247. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCategoryReader)})},
  7248. args: ["aChunkParser"],
  7249. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
  7250. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
  7251. referencedClasses: ["ClassBuilder"]
  7252. }),
  7253. globals.ClassCategoryReader);
  7254. smalltalk.addClass('ClassCommentReader', globals.Object, ['class'], 'Kernel-Classes');
  7255. globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  7256. smalltalk.addMethod(
  7257. smalltalk.method({
  7258. selector: "class:",
  7259. protocol: 'accessing',
  7260. fn: function (aClass){
  7261. var self=this;
  7262. self["@class"]=aClass;
  7263. return self},
  7264. args: ["aClass"],
  7265. source: "class: aClass\x0a\x09class := aClass",
  7266. messageSends: [],
  7267. referencedClasses: []
  7268. }),
  7269. globals.ClassCommentReader);
  7270. smalltalk.addMethod(
  7271. smalltalk.method({
  7272. selector: "initialize",
  7273. protocol: 'initialization',
  7274. fn: function (){
  7275. var self=this;
  7276. return smalltalk.withContext(function($ctx1) {
  7277. ($ctx1.supercall = true, globals.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  7278. $ctx1.supercall = false;
  7279. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCommentReader)})},
  7280. args: [],
  7281. source: "initialize\x0a\x09super initialize.",
  7282. messageSends: ["initialize"],
  7283. referencedClasses: []
  7284. }),
  7285. globals.ClassCommentReader);
  7286. smalltalk.addMethod(
  7287. smalltalk.method({
  7288. selector: "scanFrom:",
  7289. protocol: 'fileIn',
  7290. fn: function (aChunkParser){
  7291. var self=this;
  7292. var chunk;
  7293. return smalltalk.withContext(function($ctx1) {
  7294. var $1;
  7295. chunk=_st(aChunkParser)._nextChunk();
  7296. $1=_st(chunk)._isEmpty();
  7297. if(! smalltalk.assert($1)){
  7298. self._setComment_(chunk);
  7299. };
  7300. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCommentReader)})},
  7301. args: ["aChunkParser"],
  7302. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  7303. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
  7304. referencedClasses: []
  7305. }),
  7306. globals.ClassCommentReader);
  7307. smalltalk.addMethod(
  7308. smalltalk.method({
  7309. selector: "setComment:",
  7310. protocol: 'private',
  7311. fn: function (aString){
  7312. var self=this;
  7313. return smalltalk.withContext(function($ctx1) {
  7314. _st(self["@class"])._comment_(aString);
  7315. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},globals.ClassCommentReader)})},
  7316. args: ["aString"],
  7317. source: "setComment: aString\x0a\x09class comment: aString",
  7318. messageSends: ["comment:"],
  7319. referencedClasses: []
  7320. }),
  7321. globals.ClassCommentReader);
  7322. smalltalk.addClass('ClassSorterNode', globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7323. globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "getNodesFrom:",
  7327. protocol: 'accessing',
  7328. fn: function (aCollection){
  7329. var self=this;
  7330. var children,others;
  7331. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  7332. return smalltalk.withContext(function($ctx1) {
  7333. var $1;
  7334. children=[];
  7335. others=[];
  7336. _st(aCollection)._do_((function(each){
  7337. return smalltalk.withContext(function($ctx2) {
  7338. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  7339. if(smalltalk.assert($1)){
  7340. return _st(children)._add_(each);
  7341. $ctx2.sendIdx["add:"]=1;
  7342. } else {
  7343. return _st(others)._add_(each);
  7344. };
  7345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7346. self["@nodes"]=_st(children)._collect_((function(each){
  7347. return smalltalk.withContext(function($ctx2) {
  7348. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  7349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  7350. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},globals.ClassSorterNode)})},
  7351. args: ["aCollection"],
  7352. source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [ :each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [ children add: each ]\x0a\x09\x09\x09ifFalse: [ others add: each ]].\x0a\x09nodes:= children collect: [ :each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1 ]",
  7353. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
  7354. referencedClasses: ["ClassSorterNode"]
  7355. }),
  7356. globals.ClassSorterNode);
  7357. smalltalk.addMethod(
  7358. smalltalk.method({
  7359. selector: "level",
  7360. protocol: 'accessing',
  7361. fn: function (){
  7362. var self=this;
  7363. var $1;
  7364. $1=self["@level"];
  7365. return $1;
  7366. },
  7367. args: [],
  7368. source: "level\x0a\x09^ level",
  7369. messageSends: [],
  7370. referencedClasses: []
  7371. }),
  7372. globals.ClassSorterNode);
  7373. smalltalk.addMethod(
  7374. smalltalk.method({
  7375. selector: "level:",
  7376. protocol: 'accessing',
  7377. fn: function (anInteger){
  7378. var self=this;
  7379. self["@level"]=anInteger;
  7380. return self},
  7381. args: ["anInteger"],
  7382. source: "level: anInteger\x0a\x09level := anInteger",
  7383. messageSends: [],
  7384. referencedClasses: []
  7385. }),
  7386. globals.ClassSorterNode);
  7387. smalltalk.addMethod(
  7388. smalltalk.method({
  7389. selector: "nodes",
  7390. protocol: 'accessing',
  7391. fn: function (){
  7392. var self=this;
  7393. var $1;
  7394. $1=self["@nodes"];
  7395. return $1;
  7396. },
  7397. args: [],
  7398. source: "nodes\x0a\x09^ nodes",
  7399. messageSends: [],
  7400. referencedClasses: []
  7401. }),
  7402. globals.ClassSorterNode);
  7403. smalltalk.addMethod(
  7404. smalltalk.method({
  7405. selector: "theClass",
  7406. protocol: 'accessing',
  7407. fn: function (){
  7408. var self=this;
  7409. var $1;
  7410. $1=self["@theClass"];
  7411. return $1;
  7412. },
  7413. args: [],
  7414. source: "theClass\x0a\x09^ theClass",
  7415. messageSends: [],
  7416. referencedClasses: []
  7417. }),
  7418. globals.ClassSorterNode);
  7419. smalltalk.addMethod(
  7420. smalltalk.method({
  7421. selector: "theClass:",
  7422. protocol: 'accessing',
  7423. fn: function (aClass){
  7424. var self=this;
  7425. self["@theClass"]=aClass;
  7426. return self},
  7427. args: ["aClass"],
  7428. source: "theClass: aClass\x0a\x09theClass := aClass",
  7429. messageSends: [],
  7430. referencedClasses: []
  7431. }),
  7432. globals.ClassSorterNode);
  7433. smalltalk.addMethod(
  7434. smalltalk.method({
  7435. selector: "traverseClassesWith:",
  7436. protocol: 'visiting',
  7437. fn: function (aCollection){
  7438. var self=this;
  7439. return smalltalk.withContext(function($ctx1) {
  7440. var $1,$3,$2;
  7441. $1=self._theClass();
  7442. $ctx1.sendIdx["theClass"]=1;
  7443. _st(aCollection)._add_($1);
  7444. _st(_st(self._nodes())._sorted_((function(a,b){
  7445. return smalltalk.withContext(function($ctx2) {
  7446. $3=_st(a)._theClass();
  7447. $ctx2.sendIdx["theClass"]=2;
  7448. $2=_st($3)._name();
  7449. $ctx2.sendIdx["name"]=1;
  7450. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  7451. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(aNode){
  7452. return smalltalk.withContext(function($ctx2) {
  7453. return _st(aNode)._traverseClassesWith_(aCollection);
  7454. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)})}));
  7455. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},globals.ClassSorterNode)})},
  7456. args: ["aCollection"],
  7457. source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [ :a :b | a theClass name <= b theClass name ]) do: [ :aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
  7458. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
  7459. referencedClasses: []
  7460. }),
  7461. globals.ClassSorterNode);
  7462. smalltalk.addMethod(
  7463. smalltalk.method({
  7464. selector: "on:classes:level:",
  7465. protocol: 'instance creation',
  7466. fn: function (aClass,aCollection,anInteger){
  7467. var self=this;
  7468. return smalltalk.withContext(function($ctx1) {
  7469. var $2,$3,$1;
  7470. $2=self._new();
  7471. _st($2)._theClass_(aClass);
  7472. _st($2)._level_(anInteger);
  7473. _st($2)._getNodesFrom_(aCollection);
  7474. $3=_st($2)._yourself();
  7475. $1=$3;
  7476. return $1;
  7477. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},globals.ClassSorterNode.klass)})},
  7478. args: ["aClass", "aCollection", "anInteger"],
  7479. source: "on: aClass classes: aCollection level: anInteger\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
  7480. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  7481. referencedClasses: []
  7482. }),
  7483. globals.ClassSorterNode.klass);
  7484. });
  7485. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  7486. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  7487. smalltalk.addPackage('Kernel-Methods');
  7488. smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7489. smalltalk.addClass('BlockClosure', globals.Object, [], 'Kernel-Methods');
  7490. globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
  7491. smalltalk.addMethod(
  7492. smalltalk.method({
  7493. selector: "applyTo:arguments:",
  7494. protocol: 'evaluating',
  7495. fn: function (anObject,aCollection){
  7496. var self=this;
  7497. return smalltalk.withContext(function($ctx1) {
  7498. return self.apply(anObject, aCollection);
  7499. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.BlockClosure)})},
  7500. args: ["anObject", "aCollection"],
  7501. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7502. messageSends: [],
  7503. referencedClasses: []
  7504. }),
  7505. globals.BlockClosure);
  7506. smalltalk.addMethod(
  7507. smalltalk.method({
  7508. selector: "asCompiledMethod:",
  7509. protocol: 'converting',
  7510. fn: function (aString){
  7511. var self=this;
  7512. return smalltalk.withContext(function($ctx1) {
  7513. return smalltalk.method({selector:aString, fn:self});;
  7514. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},globals.BlockClosure)})},
  7515. args: ["aString"],
  7516. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  7517. messageSends: [],
  7518. referencedClasses: []
  7519. }),
  7520. globals.BlockClosure);
  7521. smalltalk.addMethod(
  7522. smalltalk.method({
  7523. selector: "compiledSource",
  7524. protocol: 'accessing',
  7525. fn: function (){
  7526. var self=this;
  7527. return smalltalk.withContext(function($ctx1) {
  7528. return self.toString();
  7529. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},globals.BlockClosure)})},
  7530. args: [],
  7531. source: "compiledSource\x0a\x09<return self.toString()>",
  7532. messageSends: [],
  7533. referencedClasses: []
  7534. }),
  7535. globals.BlockClosure);
  7536. smalltalk.addMethod(
  7537. smalltalk.method({
  7538. selector: "currySelf",
  7539. protocol: 'converting',
  7540. fn: function (){
  7541. var self=this;
  7542. return smalltalk.withContext(function($ctx1) {
  7543. return function () {
  7544. var args = [ this ];
  7545. args.push.apply(args, arguments);
  7546. return self.apply(null, args);
  7547. }
  7548. ;
  7549. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.BlockClosure)})},
  7550. args: [],
  7551. source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09>",
  7552. messageSends: [],
  7553. referencedClasses: []
  7554. }),
  7555. globals.BlockClosure);
  7556. smalltalk.addMethod(
  7557. smalltalk.method({
  7558. selector: "ensure:",
  7559. protocol: 'evaluating',
  7560. fn: function (aBlock){
  7561. var self=this;
  7562. return smalltalk.withContext(function($ctx1) {
  7563. try{return self._value()}finally{aBlock._value()};
  7564. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},globals.BlockClosure)})},
  7565. args: ["aBlock"],
  7566. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  7567. messageSends: [],
  7568. referencedClasses: []
  7569. }),
  7570. globals.BlockClosure);
  7571. smalltalk.addMethod(
  7572. smalltalk.method({
  7573. selector: "fork",
  7574. protocol: 'timeout/interval',
  7575. fn: function (){
  7576. var self=this;
  7577. function $ForkPool(){return globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  7578. return smalltalk.withContext(function($ctx1) {
  7579. _st(_st($ForkPool())._default())._fork_(self);
  7580. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},globals.BlockClosure)})},
  7581. args: [],
  7582. source: "fork\x0a\x09ForkPool default fork: self",
  7583. messageSends: ["fork:", "default"],
  7584. referencedClasses: ["ForkPool"]
  7585. }),
  7586. globals.BlockClosure);
  7587. smalltalk.addMethod(
  7588. smalltalk.method({
  7589. selector: "new",
  7590. protocol: 'evaluating',
  7591. fn: function (){
  7592. var self=this;
  7593. return smalltalk.withContext(function($ctx1) {
  7594. return new self();
  7595. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.BlockClosure)})},
  7596. args: [],
  7597. source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
  7598. messageSends: [],
  7599. referencedClasses: []
  7600. }),
  7601. globals.BlockClosure);
  7602. smalltalk.addMethod(
  7603. smalltalk.method({
  7604. selector: "newValue:",
  7605. protocol: 'evaluating',
  7606. fn: function (anObject){
  7607. var self=this;
  7608. return smalltalk.withContext(function($ctx1) {
  7609. var $1;
  7610. $1=self._newWithValues_([anObject]);
  7611. return $1;
  7612. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},globals.BlockClosure)})},
  7613. args: ["anObject"],
  7614. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  7615. messageSends: ["newWithValues:"],
  7616. referencedClasses: []
  7617. }),
  7618. globals.BlockClosure);
  7619. smalltalk.addMethod(
  7620. smalltalk.method({
  7621. selector: "newValue:value:",
  7622. protocol: 'evaluating',
  7623. fn: function (anObject,anObject2){
  7624. var self=this;
  7625. return smalltalk.withContext(function($ctx1) {
  7626. var $1;
  7627. $1=self._newWithValues_([anObject,anObject2]);
  7628. return $1;
  7629. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},globals.BlockClosure)})},
  7630. args: ["anObject", "anObject2"],
  7631. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  7632. messageSends: ["newWithValues:"],
  7633. referencedClasses: []
  7634. }),
  7635. globals.BlockClosure);
  7636. smalltalk.addMethod(
  7637. smalltalk.method({
  7638. selector: "newValue:value:value:",
  7639. protocol: 'evaluating',
  7640. fn: function (anObject,anObject2,anObject3){
  7641. var self=this;
  7642. return smalltalk.withContext(function($ctx1) {
  7643. var $1;
  7644. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  7645. return $1;
  7646. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.BlockClosure)})},
  7647. args: ["anObject", "anObject2", "anObject3"],
  7648. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  7649. messageSends: ["newWithValues:"],
  7650. referencedClasses: []
  7651. }),
  7652. globals.BlockClosure);
  7653. smalltalk.addMethod(
  7654. smalltalk.method({
  7655. selector: "newWithValues:",
  7656. protocol: 'evaluating',
  7657. fn: function (aCollection){
  7658. var self=this;
  7659. return smalltalk.withContext(function($ctx1) {
  7660. var object = Object.create(self.prototype);
  7661. var result = self.apply(object, aCollection);
  7662. return typeof result === "object" ? result : object;
  7663. ;
  7664. return self}, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},globals.BlockClosure)})},
  7665. args: ["aCollection"],
  7666. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09>",
  7667. messageSends: [],
  7668. referencedClasses: []
  7669. }),
  7670. globals.BlockClosure);
  7671. smalltalk.addMethod(
  7672. smalltalk.method({
  7673. selector: "numArgs",
  7674. protocol: 'accessing',
  7675. fn: function (){
  7676. var self=this;
  7677. return smalltalk.withContext(function($ctx1) {
  7678. return self.length;
  7679. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.BlockClosure)})},
  7680. args: [],
  7681. source: "numArgs\x0a\x09<return self.length>",
  7682. messageSends: [],
  7683. referencedClasses: []
  7684. }),
  7685. globals.BlockClosure);
  7686. smalltalk.addMethod(
  7687. smalltalk.method({
  7688. selector: "on:do:",
  7689. protocol: 'error handling',
  7690. fn: function (anErrorClass,aBlock){
  7691. var self=this;
  7692. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  7693. return smalltalk.withContext(function($ctx1) {
  7694. var $2,$1;
  7695. $1=self._tryCatch_((function(error){
  7696. var smalltalkError;
  7697. return smalltalk.withContext(function($ctx2) {
  7698. smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
  7699. smalltalkError;
  7700. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  7701. if(smalltalk.assert($2)){
  7702. return _st(aBlock)._value_(smalltalkError);
  7703. } else {
  7704. return _st(smalltalkError)._resignal();
  7705. };
  7706. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)})}));
  7707. return $1;
  7708. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},globals.BlockClosure)})},
  7709. args: ["anErrorClass", "aBlock"],
  7710. source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self tryCatch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
  7711. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
  7712. referencedClasses: ["Smalltalk"]
  7713. }),
  7714. globals.BlockClosure);
  7715. smalltalk.addMethod(
  7716. smalltalk.method({
  7717. selector: "receiver",
  7718. protocol: 'accessing',
  7719. fn: function (){
  7720. var self=this;
  7721. return nil;
  7722. },
  7723. args: [],
  7724. source: "receiver\x0a\x09^ nil",
  7725. messageSends: [],
  7726. referencedClasses: []
  7727. }),
  7728. globals.BlockClosure);
  7729. smalltalk.addMethod(
  7730. smalltalk.method({
  7731. selector: "timeToRun",
  7732. protocol: 'evaluating',
  7733. fn: function (){
  7734. var self=this;
  7735. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  7736. return smalltalk.withContext(function($ctx1) {
  7737. var $1;
  7738. $1=_st($Date())._millisecondsToRun_(self);
  7739. return $1;
  7740. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},globals.BlockClosure)})},
  7741. args: [],
  7742. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  7743. messageSends: ["millisecondsToRun:"],
  7744. referencedClasses: ["Date"]
  7745. }),
  7746. globals.BlockClosure);
  7747. smalltalk.addMethod(
  7748. smalltalk.method({
  7749. selector: "tryCatch:",
  7750. protocol: 'error handling',
  7751. fn: function (aBlock){
  7752. var self=this;
  7753. return smalltalk.withContext(function($ctx1) {
  7754. try {
  7755. return self._value();
  7756. } catch(error) {
  7757. return aBlock._value_(error);
  7758. }
  7759. ;
  7760. return self}, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},globals.BlockClosure)})},
  7761. args: ["aBlock"],
  7762. source: "tryCatch: aBlock\x0a\x09<\x0a\x09\x09try {\x0a\x09\x09\x09return self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09>",
  7763. messageSends: [],
  7764. referencedClasses: []
  7765. }),
  7766. globals.BlockClosure);
  7767. smalltalk.addMethod(
  7768. smalltalk.method({
  7769. selector: "value",
  7770. protocol: 'evaluating',
  7771. fn: function (){
  7772. var self=this;
  7773. return smalltalk.withContext(function($ctx1) {
  7774. return self();;
  7775. return self}, function($ctx1) {$ctx1.fill(self,"value",{},globals.BlockClosure)})},
  7776. args: [],
  7777. source: "value\x0a\x09<return self();>",
  7778. messageSends: [],
  7779. referencedClasses: []
  7780. }),
  7781. globals.BlockClosure);
  7782. smalltalk.addMethod(
  7783. smalltalk.method({
  7784. selector: "value:",
  7785. protocol: 'evaluating',
  7786. fn: function (anArg){
  7787. var self=this;
  7788. return smalltalk.withContext(function($ctx1) {
  7789. return self(anArg);;
  7790. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},globals.BlockClosure)})},
  7791. args: ["anArg"],
  7792. source: "value: anArg\x0a\x09<return self(anArg);>",
  7793. messageSends: [],
  7794. referencedClasses: []
  7795. }),
  7796. globals.BlockClosure);
  7797. smalltalk.addMethod(
  7798. smalltalk.method({
  7799. selector: "value:value:",
  7800. protocol: 'evaluating',
  7801. fn: function (firstArg,secondArg){
  7802. var self=this;
  7803. return smalltalk.withContext(function($ctx1) {
  7804. return self(firstArg, secondArg);;
  7805. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},globals.BlockClosure)})},
  7806. args: ["firstArg", "secondArg"],
  7807. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  7808. messageSends: [],
  7809. referencedClasses: []
  7810. }),
  7811. globals.BlockClosure);
  7812. smalltalk.addMethod(
  7813. smalltalk.method({
  7814. selector: "value:value:value:",
  7815. protocol: 'evaluating',
  7816. fn: function (firstArg,secondArg,thirdArg){
  7817. var self=this;
  7818. return smalltalk.withContext(function($ctx1) {
  7819. return self(firstArg, secondArg, thirdArg);;
  7820. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},globals.BlockClosure)})},
  7821. args: ["firstArg", "secondArg", "thirdArg"],
  7822. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  7823. messageSends: [],
  7824. referencedClasses: []
  7825. }),
  7826. globals.BlockClosure);
  7827. smalltalk.addMethod(
  7828. smalltalk.method({
  7829. selector: "valueWithInterval:",
  7830. protocol: 'timeout/interval',
  7831. fn: function (aNumber){
  7832. var self=this;
  7833. return smalltalk.withContext(function($ctx1) {
  7834. var interval = setInterval(self, aNumber);
  7835. return globals.Timeout._on_(interval);
  7836. ;
  7837. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},globals.BlockClosure)})},
  7838. args: ["aNumber"],
  7839. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(interval);\x0a\x09>",
  7840. messageSends: [],
  7841. referencedClasses: []
  7842. }),
  7843. globals.BlockClosure);
  7844. smalltalk.addMethod(
  7845. smalltalk.method({
  7846. selector: "valueWithPossibleArguments:",
  7847. protocol: 'evaluating',
  7848. fn: function (aCollection){
  7849. var self=this;
  7850. return smalltalk.withContext(function($ctx1) {
  7851. return self.apply(null, aCollection);;
  7852. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.BlockClosure)})},
  7853. args: ["aCollection"],
  7854. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  7855. messageSends: [],
  7856. referencedClasses: []
  7857. }),
  7858. globals.BlockClosure);
  7859. smalltalk.addMethod(
  7860. smalltalk.method({
  7861. selector: "valueWithTimeout:",
  7862. protocol: 'timeout/interval',
  7863. fn: function (aNumber){
  7864. var self=this;
  7865. return smalltalk.withContext(function($ctx1) {
  7866. var timeout = setTimeout(self, aNumber);
  7867. return globals.Timeout._on_(timeout);
  7868. ;
  7869. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},globals.BlockClosure)})},
  7870. args: ["aNumber"],
  7871. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(timeout);\x0a\x09>",
  7872. messageSends: [],
  7873. referencedClasses: []
  7874. }),
  7875. globals.BlockClosure);
  7876. smalltalk.addMethod(
  7877. smalltalk.method({
  7878. selector: "whileFalse",
  7879. protocol: 'controlling',
  7880. fn: function (){
  7881. var self=this;
  7882. return smalltalk.withContext(function($ctx1) {
  7883. self._whileFalse_((function(){
  7884. }));
  7885. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},globals.BlockClosure)})},
  7886. args: [],
  7887. source: "whileFalse\x0a\x09self whileFalse: []",
  7888. messageSends: ["whileFalse:"],
  7889. referencedClasses: []
  7890. }),
  7891. globals.BlockClosure);
  7892. smalltalk.addMethod(
  7893. smalltalk.method({
  7894. selector: "whileFalse:",
  7895. protocol: 'controlling',
  7896. fn: function (aBlock){
  7897. var self=this;
  7898. return smalltalk.withContext(function($ctx1) {
  7899. while(!smalltalk.assert(self._value())) {aBlock._value()};
  7900. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},globals.BlockClosure)})},
  7901. args: ["aBlock"],
  7902. source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  7903. messageSends: [],
  7904. referencedClasses: []
  7905. }),
  7906. globals.BlockClosure);
  7907. smalltalk.addMethod(
  7908. smalltalk.method({
  7909. selector: "whileTrue",
  7910. protocol: 'controlling',
  7911. fn: function (){
  7912. var self=this;
  7913. return smalltalk.withContext(function($ctx1) {
  7914. self._whileTrue_((function(){
  7915. }));
  7916. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},globals.BlockClosure)})},
  7917. args: [],
  7918. source: "whileTrue\x0a\x09self whileTrue: []",
  7919. messageSends: ["whileTrue:"],
  7920. referencedClasses: []
  7921. }),
  7922. globals.BlockClosure);
  7923. smalltalk.addMethod(
  7924. smalltalk.method({
  7925. selector: "whileTrue:",
  7926. protocol: 'controlling',
  7927. fn: function (aBlock){
  7928. var self=this;
  7929. return smalltalk.withContext(function($ctx1) {
  7930. while(smalltalk.assert(self._value())) {aBlock._value()};
  7931. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},globals.BlockClosure)})},
  7932. args: ["aBlock"],
  7933. source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  7934. messageSends: [],
  7935. referencedClasses: []
  7936. }),
  7937. globals.BlockClosure);
  7938. smalltalk.addClass('CompiledMethod', globals.Object, [], 'Kernel-Methods');
  7939. globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
  7940. smalltalk.addMethod(
  7941. smalltalk.method({
  7942. selector: "arguments",
  7943. protocol: 'accessing',
  7944. fn: function (){
  7945. var self=this;
  7946. return smalltalk.withContext(function($ctx1) {
  7947. return self.args || [];
  7948. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.CompiledMethod)})},
  7949. args: [],
  7950. source: "arguments\x0a\x09<return self.args || []>",
  7951. messageSends: [],
  7952. referencedClasses: []
  7953. }),
  7954. globals.CompiledMethod);
  7955. smalltalk.addMethod(
  7956. smalltalk.method({
  7957. selector: "browse",
  7958. protocol: 'browsing',
  7959. fn: function (){
  7960. var self=this;
  7961. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  7962. return smalltalk.withContext(function($ctx1) {
  7963. _st($Finder())._findMethod_(self);
  7964. return self}, function($ctx1) {$ctx1.fill(self,"browse",{},globals.CompiledMethod)})},
  7965. args: [],
  7966. source: "browse\x0a\x09Finder findMethod: self",
  7967. messageSends: ["findMethod:"],
  7968. referencedClasses: ["Finder"]
  7969. }),
  7970. globals.CompiledMethod);
  7971. smalltalk.addMethod(
  7972. smalltalk.method({
  7973. selector: "category",
  7974. protocol: 'accessing',
  7975. fn: function (){
  7976. var self=this;
  7977. return smalltalk.withContext(function($ctx1) {
  7978. var $1;
  7979. $1=self._protocol();
  7980. return $1;
  7981. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.CompiledMethod)})},
  7982. args: [],
  7983. source: "category\x0a\x09^ self protocol",
  7984. messageSends: ["protocol"],
  7985. referencedClasses: []
  7986. }),
  7987. globals.CompiledMethod);
  7988. smalltalk.addMethod(
  7989. smalltalk.method({
  7990. selector: "defaultProtocol",
  7991. protocol: 'defaults',
  7992. fn: function (){
  7993. var self=this;
  7994. return "as yet unclassified";
  7995. },
  7996. args: [],
  7997. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  7998. messageSends: [],
  7999. referencedClasses: []
  8000. }),
  8001. globals.CompiledMethod);
  8002. smalltalk.addMethod(
  8003. smalltalk.method({
  8004. selector: "fn",
  8005. protocol: 'accessing',
  8006. fn: function (){
  8007. var self=this;
  8008. return smalltalk.withContext(function($ctx1) {
  8009. var $1;
  8010. $1=self._basicAt_("fn");
  8011. return $1;
  8012. }, function($ctx1) {$ctx1.fill(self,"fn",{},globals.CompiledMethod)})},
  8013. args: [],
  8014. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8015. messageSends: ["basicAt:"],
  8016. referencedClasses: []
  8017. }),
  8018. globals.CompiledMethod);
  8019. smalltalk.addMethod(
  8020. smalltalk.method({
  8021. selector: "fn:",
  8022. protocol: 'accessing',
  8023. fn: function (aBlock){
  8024. var self=this;
  8025. return smalltalk.withContext(function($ctx1) {
  8026. self._basicAt_put_("fn",aBlock);
  8027. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},globals.CompiledMethod)})},
  8028. args: ["aBlock"],
  8029. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8030. messageSends: ["basicAt:put:"],
  8031. referencedClasses: []
  8032. }),
  8033. globals.CompiledMethod);
  8034. smalltalk.addMethod(
  8035. smalltalk.method({
  8036. selector: "isCompiledMethod",
  8037. protocol: 'testing',
  8038. fn: function (){
  8039. var self=this;
  8040. return true;
  8041. },
  8042. args: [],
  8043. source: "isCompiledMethod\x0a\x09^ true",
  8044. messageSends: [],
  8045. referencedClasses: []
  8046. }),
  8047. globals.CompiledMethod);
  8048. smalltalk.addMethod(
  8049. smalltalk.method({
  8050. selector: "isOverridden",
  8051. protocol: 'testing',
  8052. fn: function (){
  8053. var self=this;
  8054. var selector;
  8055. return smalltalk.withContext(function($ctx1) {
  8056. var $1;
  8057. var $early={};
  8058. try {
  8059. selector=self._selector();
  8060. _st(self._methodClass())._allSubclassesDo_((function(each){
  8061. return smalltalk.withContext(function($ctx2) {
  8062. $1=_st(each)._includesSelector_(selector);
  8063. if(smalltalk.assert($1)){
  8064. throw $early=[true];
  8065. };
  8066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8067. return false;
  8068. }
  8069. catch(e) {if(e===$early)return e[0]; throw e}
  8070. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},globals.CompiledMethod)})},
  8071. args: [],
  8072. source: "isOverridden\x0a\x09| selector |\x0a \x0a selector := self selector.\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  8073. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"],
  8074. referencedClasses: []
  8075. }),
  8076. globals.CompiledMethod);
  8077. smalltalk.addMethod(
  8078. smalltalk.method({
  8079. selector: "isOverride",
  8080. protocol: 'testing',
  8081. fn: function (){
  8082. var self=this;
  8083. var superclass;
  8084. return smalltalk.withContext(function($ctx1) {
  8085. var $1,$2,$3,$receiver;
  8086. $1=self._methodClass();
  8087. $ctx1.sendIdx["methodClass"]=1;
  8088. superclass=_st($1)._superclass();
  8089. $ctx1.sendIdx["superclass"]=1;
  8090. $2=superclass;
  8091. if(($receiver = $2) == null || $receiver.isNil){
  8092. return false;
  8093. } else {
  8094. $2;
  8095. };
  8096. $3=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8097. return $3;
  8098. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},globals.CompiledMethod)})},
  8099. args: [],
  8100. source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
  8101. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"],
  8102. referencedClasses: []
  8103. }),
  8104. globals.CompiledMethod);
  8105. smalltalk.addMethod(
  8106. smalltalk.method({
  8107. selector: "messageSends",
  8108. protocol: 'accessing',
  8109. fn: function (){
  8110. var self=this;
  8111. return smalltalk.withContext(function($ctx1) {
  8112. var $1;
  8113. $1=self._basicAt_("messageSends");
  8114. return $1;
  8115. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.CompiledMethod)})},
  8116. args: [],
  8117. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8118. messageSends: ["basicAt:"],
  8119. referencedClasses: []
  8120. }),
  8121. globals.CompiledMethod);
  8122. smalltalk.addMethod(
  8123. smalltalk.method({
  8124. selector: "methodClass",
  8125. protocol: 'accessing',
  8126. fn: function (){
  8127. var self=this;
  8128. return smalltalk.withContext(function($ctx1) {
  8129. var $1;
  8130. $1=self._basicAt_("methodClass");
  8131. return $1;
  8132. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},globals.CompiledMethod)})},
  8133. args: [],
  8134. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8135. messageSends: ["basicAt:"],
  8136. referencedClasses: []
  8137. }),
  8138. globals.CompiledMethod);
  8139. smalltalk.addMethod(
  8140. smalltalk.method({
  8141. selector: "package",
  8142. protocol: 'accessing',
  8143. fn: function (){
  8144. var self=this;
  8145. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  8146. return smalltalk.withContext(function($ctx1) {
  8147. var $1,$3,$2,$4,$5,$receiver;
  8148. $1=self._methodClass();
  8149. $ctx1.sendIdx["methodClass"]=1;
  8150. if(($receiver = $1) == null || $receiver.isNil){
  8151. return nil;
  8152. } else {
  8153. $1;
  8154. };
  8155. $3=self._protocol();
  8156. $ctx1.sendIdx["protocol"]=1;
  8157. $2=_st($3)._beginsWith_("*");
  8158. if(! smalltalk.assert($2)){
  8159. $4=_st(self._methodClass())._package();
  8160. return $4;
  8161. };
  8162. $5=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  8163. return nil;
  8164. }));
  8165. return $5;
  8166. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.CompiledMethod)})},
  8167. args: [],
  8168. source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09self methodClass ifNil: [ ^ nil ].\x0a\x09\x0a\x09(self protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self methodClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  8169. messageSends: ["ifNil:", "methodClass", "ifFalse:", "beginsWith:", "protocol", "package", "named:ifAbsent:", "allButFirst"],
  8170. referencedClasses: ["Package"]
  8171. }),
  8172. globals.CompiledMethod);
  8173. smalltalk.addMethod(
  8174. smalltalk.method({
  8175. selector: "protocol",
  8176. protocol: 'accessing',
  8177. fn: function (){
  8178. var self=this;
  8179. return smalltalk.withContext(function($ctx1) {
  8180. var $2,$1,$receiver;
  8181. $2=self._basicAt_("protocol");
  8182. if(($receiver = $2) == null || $receiver.isNil){
  8183. $1=self._defaultProtocol();
  8184. } else {
  8185. $1=$2;
  8186. };
  8187. return $1;
  8188. }, function($ctx1) {$ctx1.fill(self,"protocol",{},globals.CompiledMethod)})},
  8189. args: [],
  8190. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8191. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"],
  8192. referencedClasses: []
  8193. }),
  8194. globals.CompiledMethod);
  8195. smalltalk.addMethod(
  8196. smalltalk.method({
  8197. selector: "protocol:",
  8198. protocol: 'accessing',
  8199. fn: function (aString){
  8200. var self=this;
  8201. var oldProtocol;
  8202. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8203. function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  8204. return smalltalk.withContext(function($ctx1) {
  8205. var $1,$2,$3,$receiver;
  8206. oldProtocol=self._protocol();
  8207. self._basicAt_put_("protocol",aString);
  8208. $1=_st($MethodMoved())._new();
  8209. _st($1)._method_(self);
  8210. _st($1)._oldProtocol_(oldProtocol);
  8211. $2=_st($1)._yourself();
  8212. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8213. $3=self._methodClass();
  8214. if(($receiver = $3) == null || $receiver.isNil){
  8215. $3;
  8216. } else {
  8217. var methodClass;
  8218. methodClass=$receiver;
  8219. _st(_st(methodClass)._organization())._addElement_(aString);
  8220. _st(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8221. };
  8222. return self}, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},globals.CompiledMethod)})},
  8223. args: ["aString"],
  8224. source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09self basicAt: 'protocol' put: aString.\x0a\x0a\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09method: self;\x0a\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09yourself).\x0a\x0a\x09self methodClass ifNotNil: [ :methodClass |\x0a\x09\x09methodClass organization addElement: aString.\x0a\x09\x09methodClass removeProtocolIfEmpty: oldProtocol ]",
  8225. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"],
  8226. referencedClasses: ["SystemAnnouncer", "MethodMoved"]
  8227. }),
  8228. globals.CompiledMethod);
  8229. smalltalk.addMethod(
  8230. smalltalk.method({
  8231. selector: "referencedClasses",
  8232. protocol: 'accessing',
  8233. fn: function (){
  8234. var self=this;
  8235. return smalltalk.withContext(function($ctx1) {
  8236. var $1;
  8237. $1=self._basicAt_("referencedClasses");
  8238. return $1;
  8239. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},globals.CompiledMethod)})},
  8240. args: [],
  8241. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8242. messageSends: ["basicAt:"],
  8243. referencedClasses: []
  8244. }),
  8245. globals.CompiledMethod);
  8246. smalltalk.addMethod(
  8247. smalltalk.method({
  8248. selector: "selector",
  8249. protocol: 'accessing',
  8250. fn: function (){
  8251. var self=this;
  8252. return smalltalk.withContext(function($ctx1) {
  8253. var $1;
  8254. $1=self._basicAt_("selector");
  8255. return $1;
  8256. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.CompiledMethod)})},
  8257. args: [],
  8258. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8259. messageSends: ["basicAt:"],
  8260. referencedClasses: []
  8261. }),
  8262. globals.CompiledMethod);
  8263. smalltalk.addMethod(
  8264. smalltalk.method({
  8265. selector: "selector:",
  8266. protocol: 'accessing',
  8267. fn: function (aString){
  8268. var self=this;
  8269. return smalltalk.withContext(function($ctx1) {
  8270. self._basicAt_put_("selector",aString);
  8271. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.CompiledMethod)})},
  8272. args: ["aString"],
  8273. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8274. messageSends: ["basicAt:put:"],
  8275. referencedClasses: []
  8276. }),
  8277. globals.CompiledMethod);
  8278. smalltalk.addMethod(
  8279. smalltalk.method({
  8280. selector: "sendTo:arguments:",
  8281. protocol: 'evaluating',
  8282. fn: function (anObject,aCollection){
  8283. var self=this;
  8284. return smalltalk.withContext(function($ctx1) {
  8285. var $1;
  8286. $1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
  8287. return $1;
  8288. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.CompiledMethod)})},
  8289. args: ["anObject", "aCollection"],
  8290. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8291. messageSends: ["applyTo:arguments:", "fn"],
  8292. referencedClasses: []
  8293. }),
  8294. globals.CompiledMethod);
  8295. smalltalk.addMethod(
  8296. smalltalk.method({
  8297. selector: "source",
  8298. protocol: 'accessing',
  8299. fn: function (){
  8300. var self=this;
  8301. return smalltalk.withContext(function($ctx1) {
  8302. var $2,$1,$receiver;
  8303. $2=self._basicAt_("source");
  8304. if(($receiver = $2) == null || $receiver.isNil){
  8305. $1="";
  8306. } else {
  8307. $1=$2;
  8308. };
  8309. return $1;
  8310. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.CompiledMethod)})},
  8311. args: [],
  8312. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8313. messageSends: ["ifNil:", "basicAt:"],
  8314. referencedClasses: []
  8315. }),
  8316. globals.CompiledMethod);
  8317. smalltalk.addMethod(
  8318. smalltalk.method({
  8319. selector: "source:",
  8320. protocol: 'accessing',
  8321. fn: function (aString){
  8322. var self=this;
  8323. return smalltalk.withContext(function($ctx1) {
  8324. self._basicAt_put_("source",aString);
  8325. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},globals.CompiledMethod)})},
  8326. args: ["aString"],
  8327. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8328. messageSends: ["basicAt:put:"],
  8329. referencedClasses: []
  8330. }),
  8331. globals.CompiledMethod);
  8332. smalltalk.addClass('ForkPool', globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8333. globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
  8334. smalltalk.addMethod(
  8335. smalltalk.method({
  8336. selector: "addWorker",
  8337. protocol: 'private',
  8338. fn: function (){
  8339. var self=this;
  8340. return smalltalk.withContext(function($ctx1) {
  8341. _st(self["@worker"])._valueWithTimeout_((0));
  8342. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  8343. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},globals.ForkPool)})},
  8344. args: [],
  8345. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8346. messageSends: ["valueWithTimeout:", "+"],
  8347. referencedClasses: []
  8348. }),
  8349. globals.ForkPool);
  8350. smalltalk.addMethod(
  8351. smalltalk.method({
  8352. selector: "defaultMaxPoolSize",
  8353. protocol: 'defaults',
  8354. fn: function (){
  8355. var self=this;
  8356. return smalltalk.withContext(function($ctx1) {
  8357. var $1;
  8358. $1=_st(self._class())._defaultMaxPoolSize();
  8359. return $1;
  8360. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},globals.ForkPool)})},
  8361. args: [],
  8362. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8363. messageSends: ["defaultMaxPoolSize", "class"],
  8364. referencedClasses: []
  8365. }),
  8366. globals.ForkPool);
  8367. smalltalk.addMethod(
  8368. smalltalk.method({
  8369. selector: "fork:",
  8370. protocol: 'actions',
  8371. fn: function (aBlock){
  8372. var self=this;
  8373. return smalltalk.withContext(function($ctx1) {
  8374. var $1;
  8375. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  8376. if(smalltalk.assert($1)){
  8377. self._addWorker();
  8378. };
  8379. _st(self["@queue"])._nextPut_(aBlock);
  8380. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},globals.ForkPool)})},
  8381. args: ["aBlock"],
  8382. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8383. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"],
  8384. referencedClasses: []
  8385. }),
  8386. globals.ForkPool);
  8387. smalltalk.addMethod(
  8388. smalltalk.method({
  8389. selector: "initialize",
  8390. protocol: 'initialization',
  8391. fn: function (){
  8392. var self=this;
  8393. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8394. return smalltalk.withContext(function($ctx1) {
  8395. ($ctx1.supercall = true, globals.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []));
  8396. $ctx1.supercall = false;
  8397. self["@poolSize"]=(0);
  8398. self["@queue"]=_st($Queue())._new();
  8399. self["@worker"]=self._makeWorker();
  8400. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ForkPool)})},
  8401. args: [],
  8402. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8403. messageSends: ["initialize", "new", "makeWorker"],
  8404. referencedClasses: ["Queue"]
  8405. }),
  8406. globals.ForkPool);
  8407. smalltalk.addMethod(
  8408. smalltalk.method({
  8409. selector: "makeWorker",
  8410. protocol: 'initialization',
  8411. fn: function (){
  8412. var self=this;
  8413. var sentinel;
  8414. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  8415. return smalltalk.withContext(function($ctx1) {
  8416. var $2,$1;
  8417. sentinel=_st($Object())._new();
  8418. $1=(function(){
  8419. var block;
  8420. return smalltalk.withContext(function($ctx2) {
  8421. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  8422. self["@poolSize"];
  8423. block=_st(self["@queue"])._nextIfAbsent_((function(){
  8424. return sentinel;
  8425. }));
  8426. block;
  8427. $2=_st(block).__eq_eq(sentinel);
  8428. if(! smalltalk.assert($2)){
  8429. return _st((function(){
  8430. return smalltalk.withContext(function($ctx3) {
  8431. return _st(block)._value();
  8432. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}))._ensure_((function(){
  8433. return smalltalk.withContext(function($ctx3) {
  8434. return self._addWorker();
  8435. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  8436. };
  8437. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)})});
  8438. return $1;
  8439. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},globals.ForkPool)})},
  8440. args: [],
  8441. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
  8442. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"],
  8443. referencedClasses: ["Object"]
  8444. }),
  8445. globals.ForkPool);
  8446. smalltalk.addMethod(
  8447. smalltalk.method({
  8448. selector: "maxPoolSize",
  8449. protocol: 'accessing',
  8450. fn: function (){
  8451. var self=this;
  8452. return smalltalk.withContext(function($ctx1) {
  8453. var $2,$1,$receiver;
  8454. $2=self["@maxPoolSize"];
  8455. if(($receiver = $2) == null || $receiver.isNil){
  8456. $1=self._defaultMaxPoolSize();
  8457. } else {
  8458. $1=$2;
  8459. };
  8460. return $1;
  8461. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},globals.ForkPool)})},
  8462. args: [],
  8463. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8464. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  8465. referencedClasses: []
  8466. }),
  8467. globals.ForkPool);
  8468. smalltalk.addMethod(
  8469. smalltalk.method({
  8470. selector: "maxPoolSize:",
  8471. protocol: 'accessing',
  8472. fn: function (anInteger){
  8473. var self=this;
  8474. self["@maxPoolSize"]=anInteger;
  8475. return self},
  8476. args: ["anInteger"],
  8477. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  8478. messageSends: [],
  8479. referencedClasses: []
  8480. }),
  8481. globals.ForkPool);
  8482. globals.ForkPool.klass.iVarNames = ['default'];
  8483. smalltalk.addMethod(
  8484. smalltalk.method({
  8485. selector: "default",
  8486. protocol: 'accessing',
  8487. fn: function (){
  8488. var self=this;
  8489. return smalltalk.withContext(function($ctx1) {
  8490. var $2,$1,$receiver;
  8491. $2=self["@default"];
  8492. if(($receiver = $2) == null || $receiver.isNil){
  8493. self["@default"]=self._new();
  8494. $1=self["@default"];
  8495. } else {
  8496. $1=$2;
  8497. };
  8498. return $1;
  8499. }, function($ctx1) {$ctx1.fill(self,"default",{},globals.ForkPool.klass)})},
  8500. args: [],
  8501. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  8502. messageSends: ["ifNil:", "new"],
  8503. referencedClasses: []
  8504. }),
  8505. globals.ForkPool.klass);
  8506. smalltalk.addMethod(
  8507. smalltalk.method({
  8508. selector: "defaultMaxPoolSize",
  8509. protocol: 'accessing',
  8510. fn: function (){
  8511. var self=this;
  8512. return (100);
  8513. },
  8514. args: [],
  8515. source: "defaultMaxPoolSize\x0a\x09^ 100",
  8516. messageSends: [],
  8517. referencedClasses: []
  8518. }),
  8519. globals.ForkPool.klass);
  8520. smalltalk.addMethod(
  8521. smalltalk.method({
  8522. selector: "resetDefault",
  8523. protocol: 'accessing',
  8524. fn: function (){
  8525. var self=this;
  8526. self["@default"]=nil;
  8527. return self},
  8528. args: [],
  8529. source: "resetDefault\x0a\x09default := nil",
  8530. messageSends: [],
  8531. referencedClasses: []
  8532. }),
  8533. globals.ForkPool.klass);
  8534. smalltalk.addClass('Message', globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  8535. globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
  8536. smalltalk.addMethod(
  8537. smalltalk.method({
  8538. selector: "arguments",
  8539. protocol: 'accessing',
  8540. fn: function (){
  8541. var self=this;
  8542. var $1;
  8543. $1=self["@arguments"];
  8544. return $1;
  8545. },
  8546. args: [],
  8547. source: "arguments\x0a\x09^ arguments",
  8548. messageSends: [],
  8549. referencedClasses: []
  8550. }),
  8551. globals.Message);
  8552. smalltalk.addMethod(
  8553. smalltalk.method({
  8554. selector: "arguments:",
  8555. protocol: 'accessing',
  8556. fn: function (anArray){
  8557. var self=this;
  8558. self["@arguments"]=anArray;
  8559. return self},
  8560. args: ["anArray"],
  8561. source: "arguments: anArray\x0a\x09arguments := anArray",
  8562. messageSends: [],
  8563. referencedClasses: []
  8564. }),
  8565. globals.Message);
  8566. smalltalk.addMethod(
  8567. smalltalk.method({
  8568. selector: "printOn:",
  8569. protocol: 'printing',
  8570. fn: function (aStream){
  8571. var self=this;
  8572. return smalltalk.withContext(function($ctx1) {
  8573. var $1;
  8574. ($ctx1.supercall = true, globals.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  8575. $ctx1.supercall = false;
  8576. _st(aStream)._nextPutAll_("(");
  8577. $ctx1.sendIdx["nextPutAll:"]=1;
  8578. _st(aStream)._nextPutAll_(self._selector());
  8579. $ctx1.sendIdx["nextPutAll:"]=2;
  8580. $1=_st(aStream)._nextPutAll_(")");
  8581. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Message)})},
  8582. args: ["aStream"],
  8583. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8584. messageSends: ["printOn:", "nextPutAll:", "selector"],
  8585. referencedClasses: []
  8586. }),
  8587. globals.Message);
  8588. smalltalk.addMethod(
  8589. smalltalk.method({
  8590. selector: "selector",
  8591. protocol: 'accessing',
  8592. fn: function (){
  8593. var self=this;
  8594. var $1;
  8595. $1=self["@selector"];
  8596. return $1;
  8597. },
  8598. args: [],
  8599. source: "selector\x0a\x09^ selector",
  8600. messageSends: [],
  8601. referencedClasses: []
  8602. }),
  8603. globals.Message);
  8604. smalltalk.addMethod(
  8605. smalltalk.method({
  8606. selector: "selector:",
  8607. protocol: 'accessing',
  8608. fn: function (aString){
  8609. var self=this;
  8610. self["@selector"]=aString;
  8611. return self},
  8612. args: ["aString"],
  8613. source: "selector: aString\x0a\x09selector := aString",
  8614. messageSends: [],
  8615. referencedClasses: []
  8616. }),
  8617. globals.Message);
  8618. smalltalk.addMethod(
  8619. smalltalk.method({
  8620. selector: "sendTo:",
  8621. protocol: 'actions',
  8622. fn: function (anObject){
  8623. var self=this;
  8624. return smalltalk.withContext(function($ctx1) {
  8625. var $1;
  8626. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  8627. return $1;
  8628. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},globals.Message)})},
  8629. args: ["anObject"],
  8630. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  8631. messageSends: ["perform:withArguments:", "selector", "arguments"],
  8632. referencedClasses: []
  8633. }),
  8634. globals.Message);
  8635. smalltalk.addMethod(
  8636. smalltalk.method({
  8637. selector: "selector:arguments:",
  8638. protocol: 'instance creation',
  8639. fn: function (aString,anArray){
  8640. var self=this;
  8641. return smalltalk.withContext(function($ctx1) {
  8642. var $2,$3,$1;
  8643. $2=self._new();
  8644. _st($2)._selector_(aString);
  8645. _st($2)._arguments_(anArray);
  8646. $3=_st($2)._yourself();
  8647. $1=$3;
  8648. return $1;
  8649. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},globals.Message.klass)})},
  8650. args: ["aString", "anArray"],
  8651. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  8652. messageSends: ["selector:", "new", "arguments:", "yourself"],
  8653. referencedClasses: []
  8654. }),
  8655. globals.Message.klass);
  8656. smalltalk.addClass('MessageSend', globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  8657. globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
  8658. smalltalk.addMethod(
  8659. smalltalk.method({
  8660. selector: "arguments",
  8661. protocol: 'accessing',
  8662. fn: function (){
  8663. var self=this;
  8664. return smalltalk.withContext(function($ctx1) {
  8665. var $1;
  8666. $1=_st(self["@message"])._arguments();
  8667. return $1;
  8668. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MessageSend)})},
  8669. args: [],
  8670. source: "arguments\x0a\x09^ message arguments",
  8671. messageSends: ["arguments"],
  8672. referencedClasses: []
  8673. }),
  8674. globals.MessageSend);
  8675. smalltalk.addMethod(
  8676. smalltalk.method({
  8677. selector: "arguments:",
  8678. protocol: 'accessing',
  8679. fn: function (aCollection){
  8680. var self=this;
  8681. return smalltalk.withContext(function($ctx1) {
  8682. _st(self["@message"])._arguments_(aCollection);
  8683. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.MessageSend)})},
  8684. args: ["aCollection"],
  8685. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  8686. messageSends: ["arguments:"],
  8687. referencedClasses: []
  8688. }),
  8689. globals.MessageSend);
  8690. smalltalk.addMethod(
  8691. smalltalk.method({
  8692. selector: "initialize",
  8693. protocol: 'initialization',
  8694. fn: function (){
  8695. var self=this;
  8696. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  8697. return smalltalk.withContext(function($ctx1) {
  8698. ($ctx1.supercall = true, globals.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []));
  8699. $ctx1.supercall = false;
  8700. self["@message"]=_st($Message())._new();
  8701. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MessageSend)})},
  8702. args: [],
  8703. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  8704. messageSends: ["initialize", "new"],
  8705. referencedClasses: ["Message"]
  8706. }),
  8707. globals.MessageSend);
  8708. smalltalk.addMethod(
  8709. smalltalk.method({
  8710. selector: "printOn:",
  8711. protocol: 'printing',
  8712. fn: function (aStream){
  8713. var self=this;
  8714. return smalltalk.withContext(function($ctx1) {
  8715. var $1;
  8716. ($ctx1.supercall = true, globals.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  8717. $ctx1.supercall = false;
  8718. _st(aStream)._nextPutAll_("(");
  8719. $ctx1.sendIdx["nextPutAll:"]=1;
  8720. _st(aStream)._nextPutAll_(self._receiver());
  8721. $ctx1.sendIdx["nextPutAll:"]=2;
  8722. _st(aStream)._nextPutAll_(" >> ");
  8723. $ctx1.sendIdx["nextPutAll:"]=3;
  8724. _st(aStream)._nextPutAll_(self._selector());
  8725. $ctx1.sendIdx["nextPutAll:"]=4;
  8726. $1=_st(aStream)._nextPutAll_(")");
  8727. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MessageSend)})},
  8728. args: ["aStream"],
  8729. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  8730. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"],
  8731. referencedClasses: []
  8732. }),
  8733. globals.MessageSend);
  8734. smalltalk.addMethod(
  8735. smalltalk.method({
  8736. selector: "receiver",
  8737. protocol: 'accessing',
  8738. fn: function (){
  8739. var self=this;
  8740. var $1;
  8741. $1=self["@receiver"];
  8742. return $1;
  8743. },
  8744. args: [],
  8745. source: "receiver\x0a\x09^ receiver",
  8746. messageSends: [],
  8747. referencedClasses: []
  8748. }),
  8749. globals.MessageSend);
  8750. smalltalk.addMethod(
  8751. smalltalk.method({
  8752. selector: "receiver:",
  8753. protocol: 'accessing',
  8754. fn: function (anObject){
  8755. var self=this;
  8756. self["@receiver"]=anObject;
  8757. return self},
  8758. args: ["anObject"],
  8759. source: "receiver: anObject\x0a\x09receiver := anObject",
  8760. messageSends: [],
  8761. referencedClasses: []
  8762. }),
  8763. globals.MessageSend);
  8764. smalltalk.addMethod(
  8765. smalltalk.method({
  8766. selector: "selector",
  8767. protocol: 'accessing',
  8768. fn: function (){
  8769. var self=this;
  8770. return smalltalk.withContext(function($ctx1) {
  8771. var $1;
  8772. $1=_st(self["@message"])._selector();
  8773. return $1;
  8774. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MessageSend)})},
  8775. args: [],
  8776. source: "selector\x0a\x09^ message selector",
  8777. messageSends: ["selector"],
  8778. referencedClasses: []
  8779. }),
  8780. globals.MessageSend);
  8781. smalltalk.addMethod(
  8782. smalltalk.method({
  8783. selector: "selector:",
  8784. protocol: 'accessing',
  8785. fn: function (aString){
  8786. var self=this;
  8787. return smalltalk.withContext(function($ctx1) {
  8788. _st(self["@message"])._selector_(aString);
  8789. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.MessageSend)})},
  8790. args: ["aString"],
  8791. source: "selector: aString\x0a\x09message selector: aString",
  8792. messageSends: ["selector:"],
  8793. referencedClasses: []
  8794. }),
  8795. globals.MessageSend);
  8796. smalltalk.addMethod(
  8797. smalltalk.method({
  8798. selector: "value",
  8799. protocol: 'evaluating',
  8800. fn: function (){
  8801. var self=this;
  8802. return smalltalk.withContext(function($ctx1) {
  8803. var $1;
  8804. $1=_st(self["@message"])._sendTo_(self._receiver());
  8805. return $1;
  8806. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.MessageSend)})},
  8807. args: [],
  8808. source: "value\x0a\x09^ message sendTo: self receiver",
  8809. messageSends: ["sendTo:", "receiver"],
  8810. referencedClasses: []
  8811. }),
  8812. globals.MessageSend);
  8813. smalltalk.addMethod(
  8814. smalltalk.method({
  8815. selector: "value:",
  8816. protocol: 'evaluating',
  8817. fn: function (anObject){
  8818. var self=this;
  8819. return smalltalk.withContext(function($ctx1) {
  8820. var $2,$3,$1;
  8821. $2=self["@message"];
  8822. _st($2)._arguments_([anObject]);
  8823. $3=_st($2)._sendTo_(self._receiver());
  8824. $1=$3;
  8825. return $1;
  8826. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.MessageSend)})},
  8827. args: ["anObject"],
  8828. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  8829. messageSends: ["arguments:", "sendTo:", "receiver"],
  8830. referencedClasses: []
  8831. }),
  8832. globals.MessageSend);
  8833. smalltalk.addMethod(
  8834. smalltalk.method({
  8835. selector: "value:value:",
  8836. protocol: 'evaluating',
  8837. fn: function (firstArgument,secondArgument){
  8838. var self=this;
  8839. return smalltalk.withContext(function($ctx1) {
  8840. var $2,$3,$1;
  8841. $2=self["@message"];
  8842. _st($2)._arguments_([firstArgument,secondArgument]);
  8843. $3=_st($2)._sendTo_(self._receiver());
  8844. $1=$3;
  8845. return $1;
  8846. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.MessageSend)})},
  8847. args: ["firstArgument", "secondArgument"],
  8848. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  8849. messageSends: ["arguments:", "sendTo:", "receiver"],
  8850. referencedClasses: []
  8851. }),
  8852. globals.MessageSend);
  8853. smalltalk.addMethod(
  8854. smalltalk.method({
  8855. selector: "value:value:value:",
  8856. protocol: 'evaluating',
  8857. fn: function (firstArgument,secondArgument,thirdArgument){
  8858. var self=this;
  8859. return smalltalk.withContext(function($ctx1) {
  8860. var $2,$3,$1;
  8861. $2=self["@message"];
  8862. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  8863. $3=_st($2)._sendTo_(self._receiver());
  8864. $1=$3;
  8865. return $1;
  8866. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.MessageSend)})},
  8867. args: ["firstArgument", "secondArgument", "thirdArgument"],
  8868. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  8869. messageSends: ["arguments:", "sendTo:", "receiver"],
  8870. referencedClasses: []
  8871. }),
  8872. globals.MessageSend);
  8873. smalltalk.addMethod(
  8874. smalltalk.method({
  8875. selector: "valueWithPossibleArguments:",
  8876. protocol: 'evaluating',
  8877. fn: function (aCollection){
  8878. var self=this;
  8879. return smalltalk.withContext(function($ctx1) {
  8880. var $1;
  8881. self._arguments_(aCollection);
  8882. $1=self._value();
  8883. return $1;
  8884. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.MessageSend)})},
  8885. args: ["aCollection"],
  8886. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  8887. messageSends: ["arguments:", "value"],
  8888. referencedClasses: []
  8889. }),
  8890. globals.MessageSend);
  8891. smalltalk.addClass('MethodContext', globals.Object, [], 'Kernel-Methods');
  8892. globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
  8893. smalltalk.addMethod(
  8894. smalltalk.method({
  8895. selector: "asString",
  8896. protocol: 'converting',
  8897. fn: function (){
  8898. var self=this;
  8899. return smalltalk.withContext(function($ctx1) {
  8900. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  8901. $2=self._isBlockContext();
  8902. if(smalltalk.assert($2)){
  8903. $3="a block (in ".__comma(_st(self._methodContext())._asString());
  8904. $ctx1.sendIdx[","]=2;
  8905. $1=_st($3).__comma(")");
  8906. $ctx1.sendIdx[","]=1;
  8907. } else {
  8908. var methodClass;
  8909. methodClass=_st(self._method())._methodClass();
  8910. methodClass;
  8911. $5=methodClass;
  8912. $7=self._receiver();
  8913. $ctx1.sendIdx["receiver"]=1;
  8914. $6=_st($7)._class();
  8915. $ctx1.sendIdx["class"]=1;
  8916. $4=_st($5).__eq($6);
  8917. if(smalltalk.assert($4)){
  8918. $11=self._receiver();
  8919. $ctx1.sendIdx["receiver"]=2;
  8920. $10=_st($11)._class();
  8921. $ctx1.sendIdx["class"]=2;
  8922. $9=_st($10)._name();
  8923. $ctx1.sendIdx["name"]=1;
  8924. $8=_st($9).__comma(" >> ");
  8925. $ctx1.sendIdx[","]=4;
  8926. $12=self._selector();
  8927. $ctx1.sendIdx["selector"]=1;
  8928. $1=_st($8).__comma($12);
  8929. $ctx1.sendIdx[","]=3;
  8930. } else {
  8931. $16=_st(_st(self._receiver())._class())._name();
  8932. $ctx1.sendIdx["name"]=2;
  8933. $15=_st($16).__comma("(");
  8934. $14=_st($15).__comma(_st(methodClass)._name());
  8935. $ctx1.sendIdx[","]=7;
  8936. $13=_st($14).__comma(") >> ");
  8937. $ctx1.sendIdx[","]=6;
  8938. $1=_st($13).__comma(self._selector());
  8939. $ctx1.sendIdx[","]=5;
  8940. };
  8941. };
  8942. return $1;
  8943. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.MethodContext)})},
  8944. args: [],
  8945. source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ \x0a\x09\x09\x09| methodClass |\x0a\x09\x09\x09methodClass := self method methodClass.\x0a\x09\x09\x09methodClass = self receiver class \x0a\x09\x09\x09\x09ifTrue: [ self receiver class name, ' >> ', self selector ]\x0a\x09\x09\x09\x09ifFalse: [ self receiver class name, '(', methodClass name, ') >> ', self selector ] ]",
  8946. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"],
  8947. referencedClasses: []
  8948. }),
  8949. globals.MethodContext);
  8950. smalltalk.addMethod(
  8951. smalltalk.method({
  8952. selector: "basicReceiver",
  8953. protocol: 'accessing',
  8954. fn: function (){
  8955. var self=this;
  8956. return smalltalk.withContext(function($ctx1) {
  8957. return self.receiver;
  8958. return self}, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.MethodContext)})},
  8959. args: [],
  8960. source: "basicReceiver\x0a\x09<return self.receiver>",
  8961. messageSends: [],
  8962. referencedClasses: []
  8963. }),
  8964. globals.MethodContext);
  8965. smalltalk.addMethod(
  8966. smalltalk.method({
  8967. selector: "evaluatedSelector",
  8968. protocol: 'accessing',
  8969. fn: function (){
  8970. var self=this;
  8971. return smalltalk.withContext(function($ctx1) {
  8972. return self.evaluatedSelector;
  8973. return self}, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},globals.MethodContext)})},
  8974. args: [],
  8975. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  8976. messageSends: [],
  8977. referencedClasses: []
  8978. }),
  8979. globals.MethodContext);
  8980. smalltalk.addMethod(
  8981. smalltalk.method({
  8982. selector: "findContextSuchThat:",
  8983. protocol: 'accessing',
  8984. fn: function (testBlock){
  8985. var self=this;
  8986. var context;
  8987. return smalltalk.withContext(function($ctx1) {
  8988. var $1,$2;
  8989. var $early={};
  8990. try {
  8991. context=self;
  8992. _st((function(){
  8993. return smalltalk.withContext(function($ctx2) {
  8994. return _st(context)._isNil();
  8995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  8996. return smalltalk.withContext(function($ctx2) {
  8997. $1=_st(testBlock)._value_(context);
  8998. if(smalltalk.assert($1)){
  8999. $2=context;
  9000. throw $early=[$2];
  9001. };
  9002. context=_st(context)._outerContext();
  9003. return context;
  9004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  9005. return nil;
  9006. }
  9007. catch(e) {if(e===$early)return e[0]; throw e}
  9008. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},globals.MethodContext)})},
  9009. args: ["testBlock"],
  9010. source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
  9011. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"],
  9012. referencedClasses: []
  9013. }),
  9014. globals.MethodContext);
  9015. smalltalk.addMethod(
  9016. smalltalk.method({
  9017. selector: "home",
  9018. protocol: 'accessing',
  9019. fn: function (){
  9020. var self=this;
  9021. return smalltalk.withContext(function($ctx1) {
  9022. return self.homeContext;
  9023. return self}, function($ctx1) {$ctx1.fill(self,"home",{},globals.MethodContext)})},
  9024. args: [],
  9025. source: "home\x0a\x09<return self.homeContext>",
  9026. messageSends: [],
  9027. referencedClasses: []
  9028. }),
  9029. globals.MethodContext);
  9030. smalltalk.addMethod(
  9031. smalltalk.method({
  9032. selector: "index",
  9033. protocol: 'accessing',
  9034. fn: function (){
  9035. var self=this;
  9036. return smalltalk.withContext(function($ctx1) {
  9037. return self.index || 0;
  9038. return self}, function($ctx1) {$ctx1.fill(self,"index",{},globals.MethodContext)})},
  9039. args: [],
  9040. source: "index\x0a\x09<return self.index || 0>",
  9041. messageSends: [],
  9042. referencedClasses: []
  9043. }),
  9044. globals.MethodContext);
  9045. smalltalk.addMethod(
  9046. smalltalk.method({
  9047. selector: "isBlockContext",
  9048. protocol: 'testing',
  9049. fn: function (){
  9050. var self=this;
  9051. return smalltalk.withContext(function($ctx1) {
  9052. var $1;
  9053. $1=_st(self._selector())._isNil();
  9054. return $1;
  9055. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},globals.MethodContext)})},
  9056. args: [],
  9057. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9058. messageSends: ["isNil", "selector"],
  9059. referencedClasses: []
  9060. }),
  9061. globals.MethodContext);
  9062. smalltalk.addMethod(
  9063. smalltalk.method({
  9064. selector: "locals",
  9065. protocol: 'accessing',
  9066. fn: function (){
  9067. var self=this;
  9068. return smalltalk.withContext(function($ctx1) {
  9069. return self.locals || {};
  9070. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},globals.MethodContext)})},
  9071. args: [],
  9072. source: "locals\x0a\x09<return self.locals || {}>",
  9073. messageSends: [],
  9074. referencedClasses: []
  9075. }),
  9076. globals.MethodContext);
  9077. smalltalk.addMethod(
  9078. smalltalk.method({
  9079. selector: "method",
  9080. protocol: 'accessing',
  9081. fn: function (){
  9082. var self=this;
  9083. var method,lookupClass,receiverClass,supercall;
  9084. return smalltalk.withContext(function($ctx1) {
  9085. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  9086. $1=self._methodContext();
  9087. $ctx1.sendIdx["methodContext"]=1;
  9088. if(($receiver = $1) == null || $receiver.isNil){
  9089. return nil;
  9090. } else {
  9091. $1;
  9092. };
  9093. $3=self._methodContext();
  9094. $ctx1.sendIdx["methodContext"]=2;
  9095. $2=_st($3)._receiver();
  9096. receiverClass=_st($2)._class();
  9097. $4=receiverClass;
  9098. $6=self._methodContext();
  9099. $ctx1.sendIdx["methodContext"]=3;
  9100. $5=_st($6)._selector();
  9101. $ctx1.sendIdx["selector"]=1;
  9102. method=_st($4)._lookupSelector_($5);
  9103. $ctx1.sendIdx["lookupSelector:"]=1;
  9104. $7=self._outerContext();
  9105. if(($receiver = $7) == null || $receiver.isNil){
  9106. supercall=false;
  9107. } else {
  9108. var outer;
  9109. outer=$receiver;
  9110. supercall=_st(outer)._supercall();
  9111. };
  9112. $9=supercall;
  9113. if(smalltalk.assert($9)){
  9114. $8=_st(_st(_st(method)._methodClass())._superclass())._lookupSelector_(_st(self._methodContext())._selector());
  9115. } else {
  9116. $8=method;
  9117. };
  9118. return $8;
  9119. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},globals.MethodContext)})},
  9120. args: [],
  9121. source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
  9122. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"],
  9123. referencedClasses: []
  9124. }),
  9125. globals.MethodContext);
  9126. smalltalk.addMethod(
  9127. smalltalk.method({
  9128. selector: "methodContext",
  9129. protocol: 'accessing',
  9130. fn: function (){
  9131. var self=this;
  9132. return smalltalk.withContext(function($ctx1) {
  9133. var $1,$3,$2,$receiver;
  9134. $1=self._isBlockContext();
  9135. if(! smalltalk.assert($1)){
  9136. return self;
  9137. };
  9138. $3=self._outerContext();
  9139. if(($receiver = $3) == null || $receiver.isNil){
  9140. $2=$3;
  9141. } else {
  9142. var outer;
  9143. outer=$receiver;
  9144. $2=_st(outer)._methodContext();
  9145. };
  9146. return $2;
  9147. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},globals.MethodContext)})},
  9148. args: [],
  9149. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9150. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"],
  9151. referencedClasses: []
  9152. }),
  9153. globals.MethodContext);
  9154. smalltalk.addMethod(
  9155. smalltalk.method({
  9156. selector: "outerContext",
  9157. protocol: 'accessing',
  9158. fn: function (){
  9159. var self=this;
  9160. return smalltalk.withContext(function($ctx1) {
  9161. return self.outerContext || self.homeContext;
  9162. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},globals.MethodContext)})},
  9163. args: [],
  9164. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9165. messageSends: [],
  9166. referencedClasses: []
  9167. }),
  9168. globals.MethodContext);
  9169. smalltalk.addMethod(
  9170. smalltalk.method({
  9171. selector: "printOn:",
  9172. protocol: 'printing',
  9173. fn: function (aStream){
  9174. var self=this;
  9175. return smalltalk.withContext(function($ctx1) {
  9176. var $1;
  9177. ($ctx1.supercall = true, globals.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  9178. $ctx1.supercall = false;
  9179. _st(aStream)._nextPutAll_("(");
  9180. $ctx1.sendIdx["nextPutAll:"]=1;
  9181. _st(aStream)._nextPutAll_(self._asString());
  9182. $ctx1.sendIdx["nextPutAll:"]=2;
  9183. $1=_st(aStream)._nextPutAll_(")");
  9184. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MethodContext)})},
  9185. args: ["aStream"],
  9186. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9187. messageSends: ["printOn:", "nextPutAll:", "asString"],
  9188. referencedClasses: []
  9189. }),
  9190. globals.MethodContext);
  9191. smalltalk.addMethod(
  9192. smalltalk.method({
  9193. selector: "receiver",
  9194. protocol: 'accessing',
  9195. fn: function (){
  9196. var self=this;
  9197. return smalltalk.withContext(function($ctx1) {
  9198. var $3,$2,$1;
  9199. $2=_st(self._isBlockContext())._and_((function(){
  9200. return smalltalk.withContext(function($ctx2) {
  9201. $3=self._outerContext();
  9202. $ctx2.sendIdx["outerContext"]=1;
  9203. return _st($3)._notNil();
  9204. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9205. if(smalltalk.assert($2)){
  9206. $1=_st(self._outerContext())._receiver();
  9207. } else {
  9208. $1=self._basicReceiver();
  9209. };
  9210. return $1;
  9211. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.MethodContext)})},
  9212. args: [],
  9213. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9214. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"],
  9215. referencedClasses: []
  9216. }),
  9217. globals.MethodContext);
  9218. smalltalk.addMethod(
  9219. smalltalk.method({
  9220. selector: "selector",
  9221. protocol: 'accessing',
  9222. fn: function (){
  9223. var self=this;
  9224. return smalltalk.withContext(function($ctx1) {
  9225. if(self.selector) {
  9226. return smalltalk.convertSelector(self.selector);
  9227. } else {
  9228. return nil;
  9229. }
  9230. ;
  9231. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MethodContext)})},
  9232. args: [],
  9233. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  9234. messageSends: [],
  9235. referencedClasses: []
  9236. }),
  9237. globals.MethodContext);
  9238. smalltalk.addMethod(
  9239. smalltalk.method({
  9240. selector: "sendIndexAt:",
  9241. protocol: 'accessing',
  9242. fn: function (aSelector){
  9243. var self=this;
  9244. return smalltalk.withContext(function($ctx1) {
  9245. return self.sendIdx[aSelector] || 0;
  9246. return self}, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},globals.MethodContext)})},
  9247. args: ["aSelector"],
  9248. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9249. messageSends: [],
  9250. referencedClasses: []
  9251. }),
  9252. globals.MethodContext);
  9253. smalltalk.addMethod(
  9254. smalltalk.method({
  9255. selector: "sendIndexes",
  9256. protocol: 'accessing',
  9257. fn: function (){
  9258. var self=this;
  9259. return smalltalk.withContext(function($ctx1) {
  9260. return self.sendIdx;
  9261. return self}, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.MethodContext)})},
  9262. args: [],
  9263. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9264. messageSends: [],
  9265. referencedClasses: []
  9266. }),
  9267. globals.MethodContext);
  9268. smalltalk.addMethod(
  9269. smalltalk.method({
  9270. selector: "supercall",
  9271. protocol: 'accessing',
  9272. fn: function (){
  9273. var self=this;
  9274. return smalltalk.withContext(function($ctx1) {
  9275. return self.supercall == true;
  9276. return self}, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.MethodContext)})},
  9277. args: [],
  9278. source: "supercall\x0a\x09<return self.supercall == true>",
  9279. messageSends: [],
  9280. referencedClasses: []
  9281. }),
  9282. globals.MethodContext);
  9283. smalltalk.addMethod(
  9284. smalltalk.method({
  9285. selector: "temps",
  9286. protocol: 'accessing',
  9287. fn: function (){
  9288. var self=this;
  9289. return smalltalk.withContext(function($ctx1) {
  9290. var $1;
  9291. self._deprecatedAPI();
  9292. $1=self._locals();
  9293. return $1;
  9294. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.MethodContext)})},
  9295. args: [],
  9296. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  9297. messageSends: ["deprecatedAPI", "locals"],
  9298. referencedClasses: []
  9299. }),
  9300. globals.MethodContext);
  9301. smalltalk.addClass('NativeFunction', globals.Object, [], 'Kernel-Methods');
  9302. globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
  9303. smalltalk.addMethod(
  9304. smalltalk.method({
  9305. selector: "constructor:",
  9306. protocol: 'instance creation',
  9307. fn: function (aString){
  9308. var self=this;
  9309. return smalltalk.withContext(function($ctx1) {
  9310. var nativeFunc=eval(aString);
  9311. return new nativeFunc();
  9312. ;
  9313. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},globals.NativeFunction.klass)})},
  9314. args: ["aString"],
  9315. source: "constructor: aString\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9316. messageSends: [],
  9317. referencedClasses: []
  9318. }),
  9319. globals.NativeFunction.klass);
  9320. smalltalk.addMethod(
  9321. smalltalk.method({
  9322. selector: "constructor:value:",
  9323. protocol: 'instance creation',
  9324. fn: function (aString,anObject){
  9325. var self=this;
  9326. return smalltalk.withContext(function($ctx1) {
  9327. var nativeFunc=eval(aString);
  9328. return new nativeFunc(anObject);
  9329. ;
  9330. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},globals.NativeFunction.klass)})},
  9331. args: ["aString", "anObject"],
  9332. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9333. messageSends: [],
  9334. referencedClasses: []
  9335. }),
  9336. globals.NativeFunction.klass);
  9337. smalltalk.addMethod(
  9338. smalltalk.method({
  9339. selector: "constructor:value:value:",
  9340. protocol: 'instance creation',
  9341. fn: function (aString,anObject,anObject2){
  9342. var self=this;
  9343. return smalltalk.withContext(function($ctx1) {
  9344. var nativeFunc=eval(aString);
  9345. return new nativeFunc(anObject,anObject2);
  9346. ;
  9347. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},globals.NativeFunction.klass)})},
  9348. args: ["aString", "anObject", "anObject2"],
  9349. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9350. messageSends: [],
  9351. referencedClasses: []
  9352. }),
  9353. globals.NativeFunction.klass);
  9354. smalltalk.addMethod(
  9355. smalltalk.method({
  9356. selector: "constructor:value:value:value:",
  9357. protocol: 'instance creation',
  9358. fn: function (aString,anObject,anObject2,anObject3){
  9359. var self=this;
  9360. return smalltalk.withContext(function($ctx1) {
  9361. var nativeFunc=eval(aString);
  9362. return new nativeFunc(anObject,anObject2, anObject3);
  9363. ;
  9364. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.NativeFunction.klass)})},
  9365. args: ["aString", "anObject", "anObject2", "anObject3"],
  9366. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9367. messageSends: [],
  9368. referencedClasses: []
  9369. }),
  9370. globals.NativeFunction.klass);
  9371. smalltalk.addMethod(
  9372. smalltalk.method({
  9373. selector: "exists:",
  9374. protocol: 'testing',
  9375. fn: function (aString){
  9376. var self=this;
  9377. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  9378. return smalltalk.withContext(function($ctx1) {
  9379. var $1;
  9380. $1=_st($PlatformInterface())._existsGlobal_(aString);
  9381. return $1;
  9382. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},globals.NativeFunction.klass)})},
  9383. args: ["aString"],
  9384. source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString",
  9385. messageSends: ["existsGlobal:"],
  9386. referencedClasses: ["PlatformInterface"]
  9387. }),
  9388. globals.NativeFunction.klass);
  9389. smalltalk.addClass('Timeout', globals.Object, ['rawTimeout'], 'Kernel-Methods');
  9390. globals.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.";
  9391. smalltalk.addMethod(
  9392. smalltalk.method({
  9393. selector: "clearInterval",
  9394. protocol: 'timeout/interval',
  9395. fn: function (){
  9396. var self=this;
  9397. return smalltalk.withContext(function($ctx1) {
  9398. var interval = self["@rawTimeout"];
  9399. clearInterval(interval);
  9400. ;
  9401. return self}, function($ctx1) {$ctx1.fill(self,"clearInterval",{},globals.Timeout)})},
  9402. args: [],
  9403. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  9404. messageSends: [],
  9405. referencedClasses: []
  9406. }),
  9407. globals.Timeout);
  9408. smalltalk.addMethod(
  9409. smalltalk.method({
  9410. selector: "clearTimeout",
  9411. protocol: 'timeout/interval',
  9412. fn: function (){
  9413. var self=this;
  9414. return smalltalk.withContext(function($ctx1) {
  9415. var timeout = self["@rawTimeout"];
  9416. clearTimeout(timeout);
  9417. ;
  9418. return self}, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},globals.Timeout)})},
  9419. args: [],
  9420. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  9421. messageSends: [],
  9422. referencedClasses: []
  9423. }),
  9424. globals.Timeout);
  9425. smalltalk.addMethod(
  9426. smalltalk.method({
  9427. selector: "rawTimeout:",
  9428. protocol: 'accessing',
  9429. fn: function (anObject){
  9430. var self=this;
  9431. self["@rawTimeout"]=anObject;
  9432. return self},
  9433. args: ["anObject"],
  9434. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  9435. messageSends: [],
  9436. referencedClasses: []
  9437. }),
  9438. globals.Timeout);
  9439. smalltalk.addMethod(
  9440. smalltalk.method({
  9441. selector: "on:",
  9442. protocol: 'instance creation',
  9443. fn: function (anObject){
  9444. var self=this;
  9445. return smalltalk.withContext(function($ctx1) {
  9446. var $2,$3,$1;
  9447. $2=self._new();
  9448. _st($2)._rawTimeout_(anObject);
  9449. $3=_st($2)._yourself();
  9450. $1=$3;
  9451. return $1;
  9452. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},globals.Timeout.klass)})},
  9453. args: ["anObject"],
  9454. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  9455. messageSends: ["rawTimeout:", "new", "yourself"],
  9456. referencedClasses: []
  9457. }),
  9458. globals.Timeout.klass);
  9459. });
  9460. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  9461. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  9462. smalltalk.addPackage('Kernel-Collections');
  9463. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  9464. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  9465. globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9466. smalltalk.addMethod(
  9467. smalltalk.method({
  9468. selector: "=",
  9469. protocol: 'comparing',
  9470. fn: function (anAssociation){
  9471. var self=this;
  9472. return smalltalk.withContext(function($ctx1) {
  9473. var $3,$2,$5,$4,$6,$1;
  9474. $3=self._class();
  9475. $ctx1.sendIdx["class"]=1;
  9476. $2=_st($3).__eq(_st(anAssociation)._class());
  9477. $ctx1.sendIdx["="]=1;
  9478. $1=_st($2)._and_((function(){
  9479. return smalltalk.withContext(function($ctx2) {
  9480. $5=self._key();
  9481. $ctx2.sendIdx["key"]=1;
  9482. $4=_st($5).__eq(_st(anAssociation)._key());
  9483. $ctx2.sendIdx["="]=2;
  9484. return _st($4)._and_((function(){
  9485. return smalltalk.withContext(function($ctx3) {
  9486. $6=self._value();
  9487. $ctx3.sendIdx["value"]=1;
  9488. return _st($6).__eq(_st(anAssociation)._value());
  9489. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  9490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9491. $ctx1.sendIdx["and:"]=1;
  9492. return $1;
  9493. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)})},
  9494. args: ["anAssociation"],
  9495. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  9496. messageSends: ["and:", "=", "class", "key", "value"],
  9497. referencedClasses: []
  9498. }),
  9499. globals.Association);
  9500. smalltalk.addMethod(
  9501. smalltalk.method({
  9502. selector: "key",
  9503. protocol: 'accessing',
  9504. fn: function (){
  9505. var self=this;
  9506. var $1;
  9507. $1=self["@key"];
  9508. return $1;
  9509. },
  9510. args: [],
  9511. source: "key\x0a\x09^ key",
  9512. messageSends: [],
  9513. referencedClasses: []
  9514. }),
  9515. globals.Association);
  9516. smalltalk.addMethod(
  9517. smalltalk.method({
  9518. selector: "key:",
  9519. protocol: 'accessing',
  9520. fn: function (aKey){
  9521. var self=this;
  9522. self["@key"]=aKey;
  9523. return self},
  9524. args: ["aKey"],
  9525. source: "key: aKey\x0a\x09key := aKey",
  9526. messageSends: [],
  9527. referencedClasses: []
  9528. }),
  9529. globals.Association);
  9530. smalltalk.addMethod(
  9531. smalltalk.method({
  9532. selector: "printOn:",
  9533. protocol: 'printing',
  9534. fn: function (aStream){
  9535. var self=this;
  9536. return smalltalk.withContext(function($ctx1) {
  9537. _st(self._key())._printOn_(aStream);
  9538. $ctx1.sendIdx["printOn:"]=1;
  9539. _st(aStream)._nextPutAll_(" -> ");
  9540. _st(self._value())._printOn_(aStream);
  9541. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)})},
  9542. args: ["aStream"],
  9543. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  9544. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  9545. referencedClasses: []
  9546. }),
  9547. globals.Association);
  9548. smalltalk.addMethod(
  9549. smalltalk.method({
  9550. selector: "value",
  9551. protocol: 'accessing',
  9552. fn: function (){
  9553. var self=this;
  9554. var $1;
  9555. $1=self["@value"];
  9556. return $1;
  9557. },
  9558. args: [],
  9559. source: "value\x0a\x09^ value",
  9560. messageSends: [],
  9561. referencedClasses: []
  9562. }),
  9563. globals.Association);
  9564. smalltalk.addMethod(
  9565. smalltalk.method({
  9566. selector: "value:",
  9567. protocol: 'accessing',
  9568. fn: function (aValue){
  9569. var self=this;
  9570. self["@value"]=aValue;
  9571. return self},
  9572. args: ["aValue"],
  9573. source: "value: aValue\x0a\x09value := aValue",
  9574. messageSends: [],
  9575. referencedClasses: []
  9576. }),
  9577. globals.Association);
  9578. smalltalk.addMethod(
  9579. smalltalk.method({
  9580. selector: "key:value:",
  9581. protocol: 'instance creation',
  9582. fn: function (aKey,aValue){
  9583. var self=this;
  9584. return smalltalk.withContext(function($ctx1) {
  9585. var $2,$3,$1;
  9586. $2=self._new();
  9587. _st($2)._key_(aKey);
  9588. _st($2)._value_(aValue);
  9589. $3=_st($2)._yourself();
  9590. $1=$3;
  9591. return $1;
  9592. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)})},
  9593. args: ["aKey", "aValue"],
  9594. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  9595. messageSends: ["key:", "new", "value:", "yourself"],
  9596. referencedClasses: []
  9597. }),
  9598. globals.Association.klass);
  9599. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  9600. globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  9601. smalltalk.addMethod(
  9602. smalltalk.method({
  9603. selector: "bucketOfElement:",
  9604. protocol: 'accessing',
  9605. fn: function (anObject){
  9606. var self=this;
  9607. return smalltalk.withContext(function($ctx1) {
  9608. var hash = self['@hashBlock'](anObject);
  9609. if (!hash) return null;
  9610. var buckets = self['@buckets'],
  9611. bucket = buckets[hash];
  9612. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  9613. return bucket;
  9614. ;
  9615. return self}, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)})},
  9616. args: ["anObject"],
  9617. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  9618. messageSends: [],
  9619. referencedClasses: []
  9620. }),
  9621. globals.BucketStore);
  9622. smalltalk.addMethod(
  9623. smalltalk.method({
  9624. selector: "do:",
  9625. protocol: 'enumerating',
  9626. fn: function (aBlock){
  9627. var self=this;
  9628. return smalltalk.withContext(function($ctx1) {
  9629. var buckets = self['@buckets'];
  9630. var keys = Object.keys(buckets);
  9631. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  9632. ;
  9633. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)})},
  9634. args: ["aBlock"],
  9635. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  9636. messageSends: [],
  9637. referencedClasses: []
  9638. }),
  9639. globals.BucketStore);
  9640. smalltalk.addMethod(
  9641. smalltalk.method({
  9642. selector: "hashBlock:",
  9643. protocol: 'accessing',
  9644. fn: function (aBlock){
  9645. var self=this;
  9646. self["@hashBlock"]=aBlock;
  9647. return self},
  9648. args: ["aBlock"],
  9649. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  9650. messageSends: [],
  9651. referencedClasses: []
  9652. }),
  9653. globals.BucketStore);
  9654. smalltalk.addMethod(
  9655. smalltalk.method({
  9656. selector: "initialize",
  9657. protocol: 'initialization',
  9658. fn: function (){
  9659. var self=this;
  9660. return smalltalk.withContext(function($ctx1) {
  9661. ($ctx1.supercall = true, globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []));
  9662. $ctx1.supercall = false;
  9663. self._removeAll();
  9664. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)})},
  9665. args: [],
  9666. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  9667. messageSends: ["initialize", "removeAll"],
  9668. referencedClasses: []
  9669. }),
  9670. globals.BucketStore);
  9671. smalltalk.addMethod(
  9672. smalltalk.method({
  9673. selector: "newBucket",
  9674. protocol: 'private',
  9675. fn: function (){
  9676. var self=this;
  9677. return smalltalk.withContext(function($ctx1) {
  9678. self._subclassResponsibility();
  9679. return self}, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)})},
  9680. args: [],
  9681. source: "newBucket\x0a\x09self subclassResponsibility",
  9682. messageSends: ["subclassResponsibility"],
  9683. referencedClasses: []
  9684. }),
  9685. globals.BucketStore);
  9686. smalltalk.addMethod(
  9687. smalltalk.method({
  9688. selector: "removeAll",
  9689. protocol: 'adding/removing',
  9690. fn: function (){
  9691. var self=this;
  9692. return smalltalk.withContext(function($ctx1) {
  9693. self['@buckets'] = Object.create(null);;
  9694. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)})},
  9695. args: [],
  9696. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  9697. messageSends: [],
  9698. referencedClasses: []
  9699. }),
  9700. globals.BucketStore);
  9701. smalltalk.addMethod(
  9702. smalltalk.method({
  9703. selector: "hashBlock:",
  9704. protocol: 'instance creation',
  9705. fn: function (aBlock){
  9706. var self=this;
  9707. return smalltalk.withContext(function($ctx1) {
  9708. var $2,$3,$1;
  9709. $2=self._new();
  9710. _st($2)._hashBlock_(aBlock);
  9711. $3=_st($2)._yourself();
  9712. $1=$3;
  9713. return $1;
  9714. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)})},
  9715. args: ["aBlock"],
  9716. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  9717. messageSends: ["hashBlock:", "new", "yourself"],
  9718. referencedClasses: []
  9719. }),
  9720. globals.BucketStore.klass);
  9721. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  9722. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  9723. smalltalk.addMethod(
  9724. smalltalk.method({
  9725. selector: "newBucket",
  9726. protocol: 'private',
  9727. fn: function (){
  9728. var self=this;
  9729. var $1;
  9730. $1=[];
  9731. return $1;
  9732. },
  9733. args: [],
  9734. source: "newBucket\x0a\x09^ #()",
  9735. messageSends: [],
  9736. referencedClasses: []
  9737. }),
  9738. globals.ArrayBucketStore);
  9739. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  9740. globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  9741. smalltalk.addMethod(
  9742. smalltalk.method({
  9743. selector: ",",
  9744. protocol: 'copying',
  9745. fn: function (aCollection){
  9746. var self=this;
  9747. return smalltalk.withContext(function($ctx1) {
  9748. var $2,$3,$1;
  9749. $2=self._copy();
  9750. _st($2)._addAll_(aCollection);
  9751. $3=_st($2)._yourself();
  9752. $1=$3;
  9753. return $1;
  9754. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)})},
  9755. args: ["aCollection"],
  9756. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  9757. messageSends: ["addAll:", "copy", "yourself"],
  9758. referencedClasses: []
  9759. }),
  9760. globals.Collection);
  9761. smalltalk.addMethod(
  9762. smalltalk.method({
  9763. selector: "add:",
  9764. protocol: 'adding/removing',
  9765. fn: function (anObject){
  9766. var self=this;
  9767. return smalltalk.withContext(function($ctx1) {
  9768. self._subclassResponsibility();
  9769. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)})},
  9770. args: ["anObject"],
  9771. source: "add: anObject\x0a\x09self subclassResponsibility",
  9772. messageSends: ["subclassResponsibility"],
  9773. referencedClasses: []
  9774. }),
  9775. globals.Collection);
  9776. smalltalk.addMethod(
  9777. smalltalk.method({
  9778. selector: "addAll:",
  9779. protocol: 'adding/removing',
  9780. fn: function (aCollection){
  9781. var self=this;
  9782. return smalltalk.withContext(function($ctx1) {
  9783. _st(aCollection)._do_((function(each){
  9784. return smalltalk.withContext(function($ctx2) {
  9785. return self._add_(each);
  9786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9787. return aCollection;
  9788. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)})},
  9789. args: ["aCollection"],
  9790. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  9791. messageSends: ["do:", "add:"],
  9792. referencedClasses: []
  9793. }),
  9794. globals.Collection);
  9795. smalltalk.addMethod(
  9796. smalltalk.method({
  9797. selector: "allSatisfy:",
  9798. protocol: 'enumerating',
  9799. fn: function (aBlock){
  9800. var self=this;
  9801. return smalltalk.withContext(function($ctx1) {
  9802. var $1;
  9803. var $early={};
  9804. try {
  9805. self._do_((function(each){
  9806. return smalltalk.withContext(function($ctx2) {
  9807. $1=_st(aBlock)._value_(each);
  9808. if(! smalltalk.assert($1)){
  9809. throw $early=[false];
  9810. };
  9811. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9812. return true;
  9813. }
  9814. catch(e) {if(e===$early)return e[0]; throw e}
  9815. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)})},
  9816. args: ["aBlock"],
  9817. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  9818. messageSends: ["do:", "ifFalse:", "value:"],
  9819. referencedClasses: []
  9820. }),
  9821. globals.Collection);
  9822. smalltalk.addMethod(
  9823. smalltalk.method({
  9824. selector: "anyOne",
  9825. protocol: 'adding/removing',
  9826. fn: function (){
  9827. var self=this;
  9828. return smalltalk.withContext(function($ctx1) {
  9829. var $early={};
  9830. try {
  9831. self._ifEmpty_((function(){
  9832. return smalltalk.withContext(function($ctx2) {
  9833. return self._error_("Collection is empty");
  9834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  9835. self._do_((function(each){
  9836. throw $early=[each];
  9837. }));
  9838. return self}
  9839. catch(e) {if(e===$early)return e[0]; throw e}
  9840. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)})},
  9841. args: [],
  9842. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  9843. messageSends: ["ifEmpty:", "error:", "do:"],
  9844. referencedClasses: []
  9845. }),
  9846. globals.Collection);
  9847. smalltalk.addMethod(
  9848. smalltalk.method({
  9849. selector: "anySatisfy:",
  9850. protocol: 'enumerating',
  9851. fn: function (aBlock){
  9852. var self=this;
  9853. return smalltalk.withContext(function($ctx1) {
  9854. var $1;
  9855. var $early={};
  9856. try {
  9857. self._do_((function(each){
  9858. return smalltalk.withContext(function($ctx2) {
  9859. $1=_st(aBlock)._value_(each);
  9860. if(smalltalk.assert($1)){
  9861. throw $early=[true];
  9862. };
  9863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9864. return false;
  9865. }
  9866. catch(e) {if(e===$early)return e[0]; throw e}
  9867. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)})},
  9868. args: ["aBlock"],
  9869. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  9870. messageSends: ["do:", "ifTrue:", "value:"],
  9871. referencedClasses: []
  9872. }),
  9873. globals.Collection);
  9874. smalltalk.addMethod(
  9875. smalltalk.method({
  9876. selector: "asArray",
  9877. protocol: 'converting',
  9878. fn: function (){
  9879. var self=this;
  9880. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  9881. return smalltalk.withContext(function($ctx1) {
  9882. var $1;
  9883. $1=_st($Array())._withAll_(self);
  9884. return $1;
  9885. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)})},
  9886. args: [],
  9887. source: "asArray\x0a\x09^ Array withAll: self",
  9888. messageSends: ["withAll:"],
  9889. referencedClasses: ["Array"]
  9890. }),
  9891. globals.Collection);
  9892. smalltalk.addMethod(
  9893. smalltalk.method({
  9894. selector: "asJSON",
  9895. protocol: 'converting',
  9896. fn: function (){
  9897. var self=this;
  9898. return smalltalk.withContext(function($ctx1) {
  9899. var $1;
  9900. $1=_st(self._asArray())._collect_((function(each){
  9901. return smalltalk.withContext(function($ctx2) {
  9902. return _st(each)._asJSON();
  9903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9904. return $1;
  9905. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)})},
  9906. args: [],
  9907. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  9908. messageSends: ["collect:", "asArray", "asJSON"],
  9909. referencedClasses: []
  9910. }),
  9911. globals.Collection);
  9912. smalltalk.addMethod(
  9913. smalltalk.method({
  9914. selector: "asOrderedCollection",
  9915. protocol: 'converting',
  9916. fn: function (){
  9917. var self=this;
  9918. return smalltalk.withContext(function($ctx1) {
  9919. var $1;
  9920. $1=self._asArray();
  9921. return $1;
  9922. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)})},
  9923. args: [],
  9924. source: "asOrderedCollection\x0a\x09^ self asArray",
  9925. messageSends: ["asArray"],
  9926. referencedClasses: []
  9927. }),
  9928. globals.Collection);
  9929. smalltalk.addMethod(
  9930. smalltalk.method({
  9931. selector: "asSet",
  9932. protocol: 'converting',
  9933. fn: function (){
  9934. var self=this;
  9935. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  9936. return smalltalk.withContext(function($ctx1) {
  9937. var $1;
  9938. $1=_st($Set())._withAll_(self);
  9939. return $1;
  9940. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)})},
  9941. args: [],
  9942. source: "asSet\x0a\x09^ Set withAll: self",
  9943. messageSends: ["withAll:"],
  9944. referencedClasses: ["Set"]
  9945. }),
  9946. globals.Collection);
  9947. smalltalk.addMethod(
  9948. smalltalk.method({
  9949. selector: "collect:",
  9950. protocol: 'enumerating',
  9951. fn: function (aBlock){
  9952. var self=this;
  9953. var stream;
  9954. return smalltalk.withContext(function($ctx1) {
  9955. var $1;
  9956. stream=_st(_st(self._class())._new())._writeStream();
  9957. self._do_((function(each){
  9958. return smalltalk.withContext(function($ctx2) {
  9959. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  9960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  9961. $1=_st(stream)._contents();
  9962. return $1;
  9963. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  9964. args: ["aBlock"],
  9965. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  9966. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  9967. referencedClasses: []
  9968. }),
  9969. globals.Collection);
  9970. smalltalk.addMethod(
  9971. smalltalk.method({
  9972. selector: "contains:",
  9973. protocol: 'testing',
  9974. fn: function (aBlock){
  9975. var self=this;
  9976. return smalltalk.withContext(function($ctx1) {
  9977. var $1;
  9978. self._deprecatedAPI();
  9979. $1=self._anySatisfy_(aBlock);
  9980. return $1;
  9981. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)})},
  9982. args: ["aBlock"],
  9983. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  9984. messageSends: ["deprecatedAPI", "anySatisfy:"],
  9985. referencedClasses: []
  9986. }),
  9987. globals.Collection);
  9988. smalltalk.addMethod(
  9989. smalltalk.method({
  9990. selector: "copyWith:",
  9991. protocol: 'copying',
  9992. fn: function (anObject){
  9993. var self=this;
  9994. return smalltalk.withContext(function($ctx1) {
  9995. var $2,$3,$1;
  9996. $2=self._copy();
  9997. _st($2)._add_(anObject);
  9998. $3=_st($2)._yourself();
  9999. $1=$3;
  10000. return $1;
  10001. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)})},
  10002. args: ["anObject"],
  10003. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10004. messageSends: ["add:", "copy", "yourself"],
  10005. referencedClasses: []
  10006. }),
  10007. globals.Collection);
  10008. smalltalk.addMethod(
  10009. smalltalk.method({
  10010. selector: "copyWithAll:",
  10011. protocol: 'copying',
  10012. fn: function (aCollection){
  10013. var self=this;
  10014. return smalltalk.withContext(function($ctx1) {
  10015. var $2,$3,$1;
  10016. $2=self._copy();
  10017. _st($2)._addAll_(aCollection);
  10018. $3=_st($2)._yourself();
  10019. $1=$3;
  10020. return $1;
  10021. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)})},
  10022. args: ["aCollection"],
  10023. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10024. messageSends: ["addAll:", "copy", "yourself"],
  10025. referencedClasses: []
  10026. }),
  10027. globals.Collection);
  10028. smalltalk.addMethod(
  10029. smalltalk.method({
  10030. selector: "copyWithoutAll:",
  10031. protocol: 'copying',
  10032. fn: function (aCollection){
  10033. var self=this;
  10034. return smalltalk.withContext(function($ctx1) {
  10035. var $1;
  10036. $1=self._reject_((function(each){
  10037. return smalltalk.withContext(function($ctx2) {
  10038. return _st(aCollection)._includes_(each);
  10039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10040. return $1;
  10041. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)})},
  10042. args: ["aCollection"],
  10043. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  10044. messageSends: ["reject:", "includes:"],
  10045. referencedClasses: []
  10046. }),
  10047. globals.Collection);
  10048. smalltalk.addMethod(
  10049. smalltalk.method({
  10050. selector: "detect:",
  10051. protocol: 'enumerating',
  10052. fn: function (aBlock){
  10053. var self=this;
  10054. return smalltalk.withContext(function($ctx1) {
  10055. var $1;
  10056. $1=self._detect_ifNone_(aBlock,(function(){
  10057. return smalltalk.withContext(function($ctx2) {
  10058. return self._errorNotFound();
  10059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10060. return $1;
  10061. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)})},
  10062. args: ["aBlock"],
  10063. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10064. messageSends: ["detect:ifNone:", "errorNotFound"],
  10065. referencedClasses: []
  10066. }),
  10067. globals.Collection);
  10068. smalltalk.addMethod(
  10069. smalltalk.method({
  10070. selector: "detect:ifNone:",
  10071. protocol: 'enumerating',
  10072. fn: function (aBlock,anotherBlock){
  10073. var self=this;
  10074. return smalltalk.withContext(function($ctx1) {
  10075. self._subclassResponsibility();
  10076. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  10077. args: ["aBlock", "anotherBlock"],
  10078. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10079. messageSends: ["subclassResponsibility"],
  10080. referencedClasses: []
  10081. }),
  10082. globals.Collection);
  10083. smalltalk.addMethod(
  10084. smalltalk.method({
  10085. selector: "do:",
  10086. protocol: 'enumerating',
  10087. fn: function (aBlock){
  10088. var self=this;
  10089. return smalltalk.withContext(function($ctx1) {
  10090. self._subclassResponsibility();
  10091. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)})},
  10092. args: ["aBlock"],
  10093. source: "do: aBlock\x0a\x09self subclassResponsibility",
  10094. messageSends: ["subclassResponsibility"],
  10095. referencedClasses: []
  10096. }),
  10097. globals.Collection);
  10098. smalltalk.addMethod(
  10099. smalltalk.method({
  10100. selector: "do:separatedBy:",
  10101. protocol: 'enumerating',
  10102. fn: function (aBlock,anotherBlock){
  10103. var self=this;
  10104. var actionBeforeElement;
  10105. return smalltalk.withContext(function($ctx1) {
  10106. actionBeforeElement=(function(){
  10107. actionBeforeElement=anotherBlock;
  10108. return actionBeforeElement;
  10109. });
  10110. self._do_((function(each){
  10111. return smalltalk.withContext(function($ctx2) {
  10112. _st(actionBeforeElement)._value();
  10113. return _st(aBlock)._value_(each);
  10114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  10115. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)})},
  10116. args: ["aBlock", "anotherBlock"],
  10117. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  10118. messageSends: ["do:", "value", "value:"],
  10119. referencedClasses: []
  10120. }),
  10121. globals.Collection);
  10122. smalltalk.addMethod(
  10123. smalltalk.method({
  10124. selector: "errorNotFound",
  10125. protocol: 'error handling',
  10126. fn: function (){
  10127. var self=this;
  10128. return smalltalk.withContext(function($ctx1) {
  10129. self._error_("Object is not in the collection");
  10130. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)})},
  10131. args: [],
  10132. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  10133. messageSends: ["error:"],
  10134. referencedClasses: []
  10135. }),
  10136. globals.Collection);
  10137. smalltalk.addMethod(
  10138. smalltalk.method({
  10139. selector: "ifEmpty:",
  10140. protocol: 'testing',
  10141. fn: function (aBlock){
  10142. var self=this;
  10143. return smalltalk.withContext(function($ctx1) {
  10144. var $2,$1;
  10145. $2=self._isEmpty();
  10146. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  10147. return self;
  10148. }));
  10149. return $1;
  10150. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)})},
  10151. args: ["aBlock"],
  10152. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  10153. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  10154. referencedClasses: []
  10155. }),
  10156. globals.Collection);
  10157. smalltalk.addMethod(
  10158. smalltalk.method({
  10159. selector: "ifEmpty:ifNotEmpty:",
  10160. protocol: 'testing',
  10161. fn: function (aBlock,anotherBlock){
  10162. var self=this;
  10163. return smalltalk.withContext(function($ctx1) {
  10164. var $2,$1;
  10165. $2=self._isEmpty();
  10166. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  10167. return $1;
  10168. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  10169. args: ["aBlock", "anotherBlock"],
  10170. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  10171. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  10172. referencedClasses: []
  10173. }),
  10174. globals.Collection);
  10175. smalltalk.addMethod(
  10176. smalltalk.method({
  10177. selector: "ifNotEmpty:",
  10178. protocol: 'testing',
  10179. fn: function (aBlock){
  10180. var self=this;
  10181. return smalltalk.withContext(function($ctx1) {
  10182. var $2,$1;
  10183. $2=self._notEmpty();
  10184. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  10185. return self;
  10186. }));
  10187. return $1;
  10188. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)})},
  10189. args: ["aBlock"],
  10190. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  10191. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  10192. referencedClasses: []
  10193. }),
  10194. globals.Collection);
  10195. smalltalk.addMethod(
  10196. smalltalk.method({
  10197. selector: "ifNotEmpty:ifEmpty:",
  10198. protocol: 'testing',
  10199. fn: function (aBlock,anotherBlock){
  10200. var self=this;
  10201. return smalltalk.withContext(function($ctx1) {
  10202. var $2,$1;
  10203. $2=self._notEmpty();
  10204. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  10205. return $1;
  10206. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  10207. args: ["aBlock", "anotherBlock"],
  10208. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  10209. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  10210. referencedClasses: []
  10211. }),
  10212. globals.Collection);
  10213. smalltalk.addMethod(
  10214. smalltalk.method({
  10215. selector: "includes:",
  10216. protocol: 'testing',
  10217. fn: function (anObject){
  10218. var self=this;
  10219. return smalltalk.withContext(function($ctx1) {
  10220. var $1;
  10221. $1=self._anySatisfy_((function(each){
  10222. return smalltalk.withContext(function($ctx2) {
  10223. return _st(each).__eq(anObject);
  10224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10225. return $1;
  10226. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)})},
  10227. args: ["anObject"],
  10228. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  10229. messageSends: ["anySatisfy:", "="],
  10230. referencedClasses: []
  10231. }),
  10232. globals.Collection);
  10233. smalltalk.addMethod(
  10234. smalltalk.method({
  10235. selector: "inject:into:",
  10236. protocol: 'enumerating',
  10237. fn: function (anObject,aBlock){
  10238. var self=this;
  10239. var result;
  10240. return smalltalk.withContext(function($ctx1) {
  10241. var $1;
  10242. result=anObject;
  10243. self._do_((function(each){
  10244. return smalltalk.withContext(function($ctx2) {
  10245. result=_st(aBlock)._value_value_(result,each);
  10246. return result;
  10247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10248. $1=result;
  10249. return $1;
  10250. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)})},
  10251. args: ["anObject", "aBlock"],
  10252. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  10253. messageSends: ["do:", "value:value:"],
  10254. referencedClasses: []
  10255. }),
  10256. globals.Collection);
  10257. smalltalk.addMethod(
  10258. smalltalk.method({
  10259. selector: "intersection:",
  10260. protocol: 'enumerating',
  10261. fn: function (aCollection){
  10262. var self=this;
  10263. var set,outputSet;
  10264. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  10265. return smalltalk.withContext(function($ctx1) {
  10266. var $2,$1,$3;
  10267. set=self._asSet();
  10268. outputSet=_st($Set())._new();
  10269. _st(aCollection)._do_((function(each){
  10270. return smalltalk.withContext(function($ctx2) {
  10271. $2=_st(set)._includes_(each);
  10272. $ctx2.sendIdx["includes:"]=1;
  10273. $1=_st($2)._and_((function(){
  10274. return smalltalk.withContext(function($ctx3) {
  10275. return _st(_st(outputSet)._includes_(each))._not();
  10276. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  10277. if(smalltalk.assert($1)){
  10278. return _st(outputSet)._add_(each);
  10279. };
  10280. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10281. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  10282. return $3;
  10283. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)})},
  10284. args: ["aCollection"],
  10285. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  10286. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"],
  10287. referencedClasses: ["Set"]
  10288. }),
  10289. globals.Collection);
  10290. smalltalk.addMethod(
  10291. smalltalk.method({
  10292. selector: "isEmpty",
  10293. protocol: 'testing',
  10294. fn: function (){
  10295. var self=this;
  10296. return smalltalk.withContext(function($ctx1) {
  10297. var $1;
  10298. $1=_st(self._size()).__eq((0));
  10299. return $1;
  10300. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)})},
  10301. args: [],
  10302. source: "isEmpty\x0a\x09^ self size = 0",
  10303. messageSends: ["=", "size"],
  10304. referencedClasses: []
  10305. }),
  10306. globals.Collection);
  10307. smalltalk.addMethod(
  10308. smalltalk.method({
  10309. selector: "noneSatisfy:",
  10310. protocol: 'enumerating',
  10311. fn: function (aBlock){
  10312. var self=this;
  10313. return smalltalk.withContext(function($ctx1) {
  10314. var $1;
  10315. var $early={};
  10316. try {
  10317. self._do_((function(item){
  10318. return smalltalk.withContext(function($ctx2) {
  10319. $1=_st(aBlock)._value_(item);
  10320. if(smalltalk.assert($1)){
  10321. throw $early=[false];
  10322. };
  10323. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)})}));
  10324. return true;
  10325. }
  10326. catch(e) {if(e===$early)return e[0]; throw e}
  10327. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)})},
  10328. args: ["aBlock"],
  10329. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  10330. messageSends: ["do:", "ifTrue:", "value:"],
  10331. referencedClasses: []
  10332. }),
  10333. globals.Collection);
  10334. smalltalk.addMethod(
  10335. smalltalk.method({
  10336. selector: "notEmpty",
  10337. protocol: 'testing',
  10338. fn: function (){
  10339. var self=this;
  10340. return smalltalk.withContext(function($ctx1) {
  10341. var $1;
  10342. $1=_st(self._isEmpty())._not();
  10343. return $1;
  10344. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)})},
  10345. args: [],
  10346. source: "notEmpty\x0a\x09^ self isEmpty not",
  10347. messageSends: ["not", "isEmpty"],
  10348. referencedClasses: []
  10349. }),
  10350. globals.Collection);
  10351. smalltalk.addMethod(
  10352. smalltalk.method({
  10353. selector: "occurrencesOf:",
  10354. protocol: 'accessing',
  10355. fn: function (anObject){
  10356. var self=this;
  10357. var tally;
  10358. return smalltalk.withContext(function($ctx1) {
  10359. var $1,$2;
  10360. tally=(0);
  10361. self._do_((function(each){
  10362. return smalltalk.withContext(function($ctx2) {
  10363. $1=_st(anObject).__eq(each);
  10364. if(smalltalk.assert($1)){
  10365. tally=_st(tally).__plus((1));
  10366. return tally;
  10367. };
  10368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10369. $2=tally;
  10370. return $2;
  10371. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)})},
  10372. args: ["anObject"],
  10373. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  10374. messageSends: ["do:", "ifTrue:", "=", "+"],
  10375. referencedClasses: []
  10376. }),
  10377. globals.Collection);
  10378. smalltalk.addMethod(
  10379. smalltalk.method({
  10380. selector: "putOn:",
  10381. protocol: 'streaming',
  10382. fn: function (aStream){
  10383. var self=this;
  10384. return smalltalk.withContext(function($ctx1) {
  10385. self._do_((function(each){
  10386. return smalltalk.withContext(function($ctx2) {
  10387. return _st(each)._putOn_(aStream);
  10388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10389. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)})},
  10390. args: ["aStream"],
  10391. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  10392. messageSends: ["do:", "putOn:"],
  10393. referencedClasses: []
  10394. }),
  10395. globals.Collection);
  10396. smalltalk.addMethod(
  10397. smalltalk.method({
  10398. selector: "reject:",
  10399. protocol: 'enumerating',
  10400. fn: function (aBlock){
  10401. var self=this;
  10402. return smalltalk.withContext(function($ctx1) {
  10403. var $1;
  10404. $1=self._select_((function(each){
  10405. return smalltalk.withContext(function($ctx2) {
  10406. return _st(_st(aBlock)._value_(each)).__eq(false);
  10407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10408. return $1;
  10409. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)})},
  10410. args: ["aBlock"],
  10411. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  10412. messageSends: ["select:", "=", "value:"],
  10413. referencedClasses: []
  10414. }),
  10415. globals.Collection);
  10416. smalltalk.addMethod(
  10417. smalltalk.method({
  10418. selector: "remove:",
  10419. protocol: 'adding/removing',
  10420. fn: function (anObject){
  10421. var self=this;
  10422. return smalltalk.withContext(function($ctx1) {
  10423. var $1;
  10424. $1=self._remove_ifAbsent_(anObject,(function(){
  10425. return smalltalk.withContext(function($ctx2) {
  10426. return self._errorNotFound();
  10427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10428. return $1;
  10429. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)})},
  10430. args: ["anObject"],
  10431. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  10432. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  10433. referencedClasses: []
  10434. }),
  10435. globals.Collection);
  10436. smalltalk.addMethod(
  10437. smalltalk.method({
  10438. selector: "remove:ifAbsent:",
  10439. protocol: 'adding/removing',
  10440. fn: function (anObject,aBlock){
  10441. var self=this;
  10442. return smalltalk.withContext(function($ctx1) {
  10443. self._subclassResponsibility();
  10444. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)})},
  10445. args: ["anObject", "aBlock"],
  10446. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  10447. messageSends: ["subclassResponsibility"],
  10448. referencedClasses: []
  10449. }),
  10450. globals.Collection);
  10451. smalltalk.addMethod(
  10452. smalltalk.method({
  10453. selector: "removeAll",
  10454. protocol: 'adding/removing',
  10455. fn: function (){
  10456. var self=this;
  10457. return smalltalk.withContext(function($ctx1) {
  10458. self._subclassResponsibility();
  10459. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)})},
  10460. args: [],
  10461. source: "removeAll\x0a\x09self subclassResponsibility",
  10462. messageSends: ["subclassResponsibility"],
  10463. referencedClasses: []
  10464. }),
  10465. globals.Collection);
  10466. smalltalk.addMethod(
  10467. smalltalk.method({
  10468. selector: "select:",
  10469. protocol: 'enumerating',
  10470. fn: function (aBlock){
  10471. var self=this;
  10472. var stream;
  10473. return smalltalk.withContext(function($ctx1) {
  10474. var $1,$2;
  10475. stream=_st(_st(self._class())._new())._writeStream();
  10476. self._do_((function(each){
  10477. return smalltalk.withContext(function($ctx2) {
  10478. $1=_st(aBlock)._value_(each);
  10479. if(smalltalk.assert($1)){
  10480. return _st(stream)._nextPut_(each);
  10481. };
  10482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10483. $2=_st(stream)._contents();
  10484. return $2;
  10485. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  10486. args: ["aBlock"],
  10487. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  10488. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  10489. referencedClasses: []
  10490. }),
  10491. globals.Collection);
  10492. smalltalk.addMethod(
  10493. smalltalk.method({
  10494. selector: "select:thenCollect:",
  10495. protocol: 'enumerating',
  10496. fn: function (selectBlock,collectBlock){
  10497. var self=this;
  10498. var stream;
  10499. return smalltalk.withContext(function($ctx1) {
  10500. var $1,$2;
  10501. stream=_st(_st(self._class())._new())._writeStream();
  10502. self._do_((function(each){
  10503. return smalltalk.withContext(function($ctx2) {
  10504. $1=_st(selectBlock)._value_(each);
  10505. $ctx2.sendIdx["value:"]=1;
  10506. if(smalltalk.assert($1)){
  10507. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  10508. };
  10509. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10510. $2=_st(stream)._contents();
  10511. return $2;
  10512. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)})},
  10513. args: ["selectBlock", "collectBlock"],
  10514. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  10515. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  10516. referencedClasses: []
  10517. }),
  10518. globals.Collection);
  10519. smalltalk.addMethod(
  10520. smalltalk.method({
  10521. selector: "size",
  10522. protocol: 'accessing',
  10523. fn: function (){
  10524. var self=this;
  10525. return smalltalk.withContext(function($ctx1) {
  10526. self._subclassResponsibility();
  10527. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)})},
  10528. args: [],
  10529. source: "size\x0a\x09self subclassResponsibility",
  10530. messageSends: ["subclassResponsibility"],
  10531. referencedClasses: []
  10532. }),
  10533. globals.Collection);
  10534. smalltalk.addMethod(
  10535. smalltalk.method({
  10536. selector: "heliosClass",
  10537. protocol: 'helios',
  10538. fn: function (){
  10539. var self=this;
  10540. return "collection";
  10541. },
  10542. args: [],
  10543. source: "heliosClass\x0a\x09^ 'collection'",
  10544. messageSends: [],
  10545. referencedClasses: []
  10546. }),
  10547. globals.Collection.klass);
  10548. smalltalk.addMethod(
  10549. smalltalk.method({
  10550. selector: "new:",
  10551. protocol: 'instance creation',
  10552. fn: function (anInteger){
  10553. var self=this;
  10554. return smalltalk.withContext(function($ctx1) {
  10555. var $1;
  10556. $1=self._new();
  10557. return $1;
  10558. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)})},
  10559. args: ["anInteger"],
  10560. source: "new: anInteger\x0a\x09^ self new",
  10561. messageSends: ["new"],
  10562. referencedClasses: []
  10563. }),
  10564. globals.Collection.klass);
  10565. smalltalk.addMethod(
  10566. smalltalk.method({
  10567. selector: "with:",
  10568. protocol: 'instance creation',
  10569. fn: function (anObject){
  10570. var self=this;
  10571. return smalltalk.withContext(function($ctx1) {
  10572. var $2,$3,$1;
  10573. $2=self._new();
  10574. _st($2)._add_(anObject);
  10575. $3=_st($2)._yourself();
  10576. $1=$3;
  10577. return $1;
  10578. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)})},
  10579. args: ["anObject"],
  10580. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  10581. messageSends: ["add:", "new", "yourself"],
  10582. referencedClasses: []
  10583. }),
  10584. globals.Collection.klass);
  10585. smalltalk.addMethod(
  10586. smalltalk.method({
  10587. selector: "with:with:",
  10588. protocol: 'instance creation',
  10589. fn: function (anObject,anotherObject){
  10590. var self=this;
  10591. return smalltalk.withContext(function($ctx1) {
  10592. var $2,$3,$1;
  10593. $2=self._new();
  10594. _st($2)._add_(anObject);
  10595. $ctx1.sendIdx["add:"]=1;
  10596. _st($2)._add_(anotherObject);
  10597. $3=_st($2)._yourself();
  10598. $1=$3;
  10599. return $1;
  10600. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)})},
  10601. args: ["anObject", "anotherObject"],
  10602. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  10603. messageSends: ["add:", "new", "yourself"],
  10604. referencedClasses: []
  10605. }),
  10606. globals.Collection.klass);
  10607. smalltalk.addMethod(
  10608. smalltalk.method({
  10609. selector: "with:with:with:",
  10610. protocol: 'instance creation',
  10611. fn: function (firstObject,secondObject,thirdObject){
  10612. var self=this;
  10613. return smalltalk.withContext(function($ctx1) {
  10614. var $2,$3,$1;
  10615. $2=self._new();
  10616. _st($2)._add_(firstObject);
  10617. $ctx1.sendIdx["add:"]=1;
  10618. _st($2)._add_(secondObject);
  10619. $ctx1.sendIdx["add:"]=2;
  10620. _st($2)._add_(thirdObject);
  10621. $3=_st($2)._yourself();
  10622. $1=$3;
  10623. return $1;
  10624. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)})},
  10625. args: ["firstObject", "secondObject", "thirdObject"],
  10626. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  10627. messageSends: ["add:", "new", "yourself"],
  10628. referencedClasses: []
  10629. }),
  10630. globals.Collection.klass);
  10631. smalltalk.addMethod(
  10632. smalltalk.method({
  10633. selector: "withAll:",
  10634. protocol: 'instance creation',
  10635. fn: function (aCollection){
  10636. var self=this;
  10637. return smalltalk.withContext(function($ctx1) {
  10638. var $2,$3,$1;
  10639. $2=self._new();
  10640. _st($2)._addAll_(aCollection);
  10641. $3=_st($2)._yourself();
  10642. $1=$3;
  10643. return $1;
  10644. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)})},
  10645. args: ["aCollection"],
  10646. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10647. messageSends: ["addAll:", "new", "yourself"],
  10648. referencedClasses: []
  10649. }),
  10650. globals.Collection.klass);
  10651. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  10652. globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  10653. smalltalk.addMethod(
  10654. smalltalk.method({
  10655. selector: "at:",
  10656. protocol: 'accessing',
  10657. fn: function (anIndex){
  10658. var self=this;
  10659. return smalltalk.withContext(function($ctx1) {
  10660. var $1;
  10661. $1=self._at_ifAbsent_(anIndex,(function(){
  10662. return smalltalk.withContext(function($ctx2) {
  10663. return self._errorNotFound();
  10664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10665. return $1;
  10666. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)})},
  10667. args: ["anIndex"],
  10668. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  10669. messageSends: ["at:ifAbsent:", "errorNotFound"],
  10670. referencedClasses: []
  10671. }),
  10672. globals.IndexableCollection);
  10673. smalltalk.addMethod(
  10674. smalltalk.method({
  10675. selector: "at:ifAbsent:",
  10676. protocol: 'accessing',
  10677. fn: function (anIndex,aBlock){
  10678. var self=this;
  10679. return smalltalk.withContext(function($ctx1) {
  10680. self._subclassResponsibility();
  10681. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  10682. args: ["anIndex", "aBlock"],
  10683. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  10684. messageSends: ["subclassResponsibility"],
  10685. referencedClasses: []
  10686. }),
  10687. globals.IndexableCollection);
  10688. smalltalk.addMethod(
  10689. smalltalk.method({
  10690. selector: "at:ifAbsentPut:",
  10691. protocol: 'accessing',
  10692. fn: function (aKey,aBlock){
  10693. var self=this;
  10694. return smalltalk.withContext(function($ctx1) {
  10695. var $1;
  10696. $1=self._at_ifAbsent_(aKey,(function(){
  10697. return smalltalk.withContext(function($ctx2) {
  10698. return self._at_put_(aKey,_st(aBlock)._value());
  10699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10700. return $1;
  10701. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)})},
  10702. args: ["aKey", "aBlock"],
  10703. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  10704. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  10705. referencedClasses: []
  10706. }),
  10707. globals.IndexableCollection);
  10708. smalltalk.addMethod(
  10709. smalltalk.method({
  10710. selector: "at:ifPresent:",
  10711. protocol: 'accessing',
  10712. fn: function (anIndex,aBlock){
  10713. var self=this;
  10714. return smalltalk.withContext(function($ctx1) {
  10715. var $1;
  10716. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  10717. return nil;
  10718. }));
  10719. return $1;
  10720. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  10721. args: ["anIndex", "aBlock"],
  10722. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  10723. messageSends: ["at:ifPresent:ifAbsent:"],
  10724. referencedClasses: []
  10725. }),
  10726. globals.IndexableCollection);
  10727. smalltalk.addMethod(
  10728. smalltalk.method({
  10729. selector: "at:ifPresent:ifAbsent:",
  10730. protocol: 'accessing',
  10731. fn: function (anIndex,aBlock,anotherBlock){
  10732. var self=this;
  10733. return smalltalk.withContext(function($ctx1) {
  10734. self._subclassResponsibility();
  10735. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)})},
  10736. args: ["anIndex", "aBlock", "anotherBlock"],
  10737. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  10738. messageSends: ["subclassResponsibility"],
  10739. referencedClasses: []
  10740. }),
  10741. globals.IndexableCollection);
  10742. smalltalk.addMethod(
  10743. smalltalk.method({
  10744. selector: "at:put:",
  10745. protocol: 'accessing',
  10746. fn: function (anIndex,anObject){
  10747. var self=this;
  10748. return smalltalk.withContext(function($ctx1) {
  10749. self._subclassResponsibility();
  10750. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)})},
  10751. args: ["anIndex", "anObject"],
  10752. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  10753. messageSends: ["subclassResponsibility"],
  10754. referencedClasses: []
  10755. }),
  10756. globals.IndexableCollection);
  10757. smalltalk.addMethod(
  10758. smalltalk.method({
  10759. selector: "indexOf:",
  10760. protocol: 'accessing',
  10761. fn: function (anObject){
  10762. var self=this;
  10763. return smalltalk.withContext(function($ctx1) {
  10764. var $1;
  10765. $1=self._indexOf_ifAbsent_(anObject,(function(){
  10766. return smalltalk.withContext(function($ctx2) {
  10767. return self._errorNotFound();
  10768. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  10769. return $1;
  10770. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)})},
  10771. args: ["anObject"],
  10772. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  10773. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  10774. referencedClasses: []
  10775. }),
  10776. globals.IndexableCollection);
  10777. smalltalk.addMethod(
  10778. smalltalk.method({
  10779. selector: "indexOf:ifAbsent:",
  10780. protocol: 'accessing',
  10781. fn: function (anObject,aBlock){
  10782. var self=this;
  10783. return smalltalk.withContext(function($ctx1) {
  10784. self._subclassResponsibility();
  10785. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)})},
  10786. args: ["anObject", "aBlock"],
  10787. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  10788. messageSends: ["subclassResponsibility"],
  10789. referencedClasses: []
  10790. }),
  10791. globals.IndexableCollection);
  10792. smalltalk.addMethod(
  10793. smalltalk.method({
  10794. selector: "with:do:",
  10795. protocol: 'enumerating',
  10796. fn: function (anotherCollection,aBlock){
  10797. var self=this;
  10798. return smalltalk.withContext(function($ctx1) {
  10799. self._withIndexDo_((function(each,index){
  10800. return smalltalk.withContext(function($ctx2) {
  10801. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  10802. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  10803. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)})},
  10804. args: ["anotherCollection", "aBlock"],
  10805. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  10806. messageSends: ["withIndexDo:", "value:value:", "at:"],
  10807. referencedClasses: []
  10808. }),
  10809. globals.IndexableCollection);
  10810. smalltalk.addMethod(
  10811. smalltalk.method({
  10812. selector: "withIndexDo:",
  10813. protocol: 'enumerating',
  10814. fn: function (aBlock){
  10815. var self=this;
  10816. return smalltalk.withContext(function($ctx1) {
  10817. self._subclassResponsibility();
  10818. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)})},
  10819. args: ["aBlock"],
  10820. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  10821. messageSends: ["subclassResponsibility"],
  10822. referencedClasses: []
  10823. }),
  10824. globals.IndexableCollection);
  10825. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  10826. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  10827. smalltalk.addMethod(
  10828. smalltalk.method({
  10829. selector: "=",
  10830. protocol: 'comparing',
  10831. fn: function (anAssocitativeCollection){
  10832. var self=this;
  10833. return smalltalk.withContext(function($ctx1) {
  10834. var $2,$1,$4,$3,$6,$5;
  10835. $2=self._class();
  10836. $ctx1.sendIdx["class"]=1;
  10837. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  10838. $ctx1.sendIdx["="]=1;
  10839. if(! smalltalk.assert($1)){
  10840. return false;
  10841. };
  10842. $4=self._size();
  10843. $ctx1.sendIdx["size"]=1;
  10844. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  10845. $ctx1.sendIdx["="]=2;
  10846. if(! smalltalk.assert($3)){
  10847. return false;
  10848. };
  10849. $6=self._associations();
  10850. $ctx1.sendIdx["associations"]=1;
  10851. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  10852. return $5;
  10853. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)})},
  10854. args: ["anAssocitativeCollection"],
  10855. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  10856. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  10857. referencedClasses: []
  10858. }),
  10859. globals.AssociativeCollection);
  10860. smalltalk.addMethod(
  10861. smalltalk.method({
  10862. selector: "add:",
  10863. protocol: 'adding/removing',
  10864. fn: function (anAssociation){
  10865. var self=this;
  10866. return smalltalk.withContext(function($ctx1) {
  10867. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  10868. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)})},
  10869. args: ["anAssociation"],
  10870. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  10871. messageSends: ["at:put:", "key", "value"],
  10872. referencedClasses: []
  10873. }),
  10874. globals.AssociativeCollection);
  10875. smalltalk.addMethod(
  10876. smalltalk.method({
  10877. selector: "addAll:",
  10878. protocol: 'adding/removing',
  10879. fn: function (anAssociativeCollection){
  10880. var self=this;
  10881. return smalltalk.withContext(function($ctx1) {
  10882. ($ctx1.supercall = true, globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]));
  10883. $ctx1.supercall = false;
  10884. return anAssociativeCollection;
  10885. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)})},
  10886. args: ["anAssociativeCollection"],
  10887. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  10888. messageSends: ["addAll:", "associations"],
  10889. referencedClasses: []
  10890. }),
  10891. globals.AssociativeCollection);
  10892. smalltalk.addMethod(
  10893. smalltalk.method({
  10894. selector: "asDictionary",
  10895. protocol: 'converting',
  10896. fn: function (){
  10897. var self=this;
  10898. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  10899. return smalltalk.withContext(function($ctx1) {
  10900. var $1;
  10901. $1=_st($Dictionary())._from_(self._associations());
  10902. return $1;
  10903. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)})},
  10904. args: [],
  10905. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  10906. messageSends: ["from:", "associations"],
  10907. referencedClasses: ["Dictionary"]
  10908. }),
  10909. globals.AssociativeCollection);
  10910. smalltalk.addMethod(
  10911. smalltalk.method({
  10912. selector: "asHashedCollection",
  10913. protocol: 'converting',
  10914. fn: function (){
  10915. var self=this;
  10916. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10917. return smalltalk.withContext(function($ctx1) {
  10918. var $1;
  10919. $1=_st($HashedCollection())._from_(self._associations());
  10920. return $1;
  10921. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)})},
  10922. args: [],
  10923. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  10924. messageSends: ["from:", "associations"],
  10925. referencedClasses: ["HashedCollection"]
  10926. }),
  10927. globals.AssociativeCollection);
  10928. smalltalk.addMethod(
  10929. smalltalk.method({
  10930. selector: "asJSON",
  10931. protocol: 'converting',
  10932. fn: function (){
  10933. var self=this;
  10934. var hash;
  10935. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  10936. return smalltalk.withContext(function($ctx1) {
  10937. var $1;
  10938. hash=_st($HashedCollection())._new();
  10939. self._keysAndValuesDo_((function(key,value){
  10940. return smalltalk.withContext(function($ctx2) {
  10941. return _st(hash)._at_put_(key,_st(value)._asJSON());
  10942. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10943. $1=hash;
  10944. return $1;
  10945. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)})},
  10946. args: [],
  10947. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  10948. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"],
  10949. referencedClasses: ["HashedCollection"]
  10950. }),
  10951. globals.AssociativeCollection);
  10952. smalltalk.addMethod(
  10953. smalltalk.method({
  10954. selector: "associations",
  10955. protocol: 'accessing',
  10956. fn: function (){
  10957. var self=this;
  10958. var associations;
  10959. return smalltalk.withContext(function($ctx1) {
  10960. var $1;
  10961. associations=[];
  10962. self._associationsDo_((function(each){
  10963. return smalltalk.withContext(function($ctx2) {
  10964. return _st(associations)._add_(each);
  10965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  10966. $1=associations;
  10967. return $1;
  10968. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)})},
  10969. args: [],
  10970. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  10971. messageSends: ["associationsDo:", "add:"],
  10972. referencedClasses: []
  10973. }),
  10974. globals.AssociativeCollection);
  10975. smalltalk.addMethod(
  10976. smalltalk.method({
  10977. selector: "associationsDo:",
  10978. protocol: 'enumerating',
  10979. fn: function (aBlock){
  10980. var self=this;
  10981. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  10982. return smalltalk.withContext(function($ctx1) {
  10983. self._keysAndValuesDo_((function(key,value){
  10984. return smalltalk.withContext(function($ctx2) {
  10985. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  10986. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  10987. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  10988. args: ["aBlock"],
  10989. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  10990. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  10991. referencedClasses: ["Association"]
  10992. }),
  10993. globals.AssociativeCollection);
  10994. smalltalk.addMethod(
  10995. smalltalk.method({
  10996. selector: "at:ifPresent:ifAbsent:",
  10997. protocol: 'accessing',
  10998. fn: function (aKey,aBlock,anotherBlock){
  10999. var self=this;
  11000. return smalltalk.withContext(function($ctx1) {
  11001. var $2,$1;
  11002. $2=self._includesKey_(aKey);
  11003. if(smalltalk.assert($2)){
  11004. $1=_st(aBlock)._value_(self._at_(aKey));
  11005. } else {
  11006. $1=_st(anotherBlock)._value();
  11007. };
  11008. return $1;
  11009. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  11010. args: ["aKey", "aBlock", "anotherBlock"],
  11011. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  11012. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"],
  11013. referencedClasses: []
  11014. }),
  11015. globals.AssociativeCollection);
  11016. smalltalk.addMethod(
  11017. smalltalk.method({
  11018. selector: "collect:",
  11019. protocol: 'enumerating',
  11020. fn: function (aBlock){
  11021. var self=this;
  11022. var newDict;
  11023. return smalltalk.withContext(function($ctx1) {
  11024. var $1;
  11025. newDict=_st(self._class())._new();
  11026. self._keysAndValuesDo_((function(key,value){
  11027. return smalltalk.withContext(function($ctx2) {
  11028. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  11029. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11030. $1=newDict;
  11031. return $1;
  11032. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  11033. args: ["aBlock"],
  11034. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  11035. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  11036. referencedClasses: []
  11037. }),
  11038. globals.AssociativeCollection);
  11039. smalltalk.addMethod(
  11040. smalltalk.method({
  11041. selector: "deepCopy",
  11042. protocol: 'copying',
  11043. fn: function (){
  11044. var self=this;
  11045. var copy;
  11046. return smalltalk.withContext(function($ctx1) {
  11047. var $1;
  11048. copy=_st(self._class())._new();
  11049. self._keysAndValuesDo_((function(key,value){
  11050. return smalltalk.withContext(function($ctx2) {
  11051. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  11052. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11053. $1=copy;
  11054. return $1;
  11055. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)})},
  11056. args: [],
  11057. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  11058. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  11059. referencedClasses: []
  11060. }),
  11061. globals.AssociativeCollection);
  11062. smalltalk.addMethod(
  11063. smalltalk.method({
  11064. selector: "detect:ifNone:",
  11065. protocol: 'enumerating',
  11066. fn: function (aBlock,anotherBlock){
  11067. var self=this;
  11068. return smalltalk.withContext(function($ctx1) {
  11069. var $1;
  11070. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  11071. return $1;
  11072. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  11073. args: ["aBlock", "anotherBlock"],
  11074. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  11075. messageSends: ["detect:ifNone:", "values"],
  11076. referencedClasses: []
  11077. }),
  11078. globals.AssociativeCollection);
  11079. smalltalk.addMethod(
  11080. smalltalk.method({
  11081. selector: "do:",
  11082. protocol: 'enumerating',
  11083. fn: function (aBlock){
  11084. var self=this;
  11085. return smalltalk.withContext(function($ctx1) {
  11086. self._valuesDo_(aBlock);
  11087. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11088. args: ["aBlock"],
  11089. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  11090. messageSends: ["valuesDo:"],
  11091. referencedClasses: []
  11092. }),
  11093. globals.AssociativeCollection);
  11094. smalltalk.addMethod(
  11095. smalltalk.method({
  11096. selector: "includes:",
  11097. protocol: 'enumerating',
  11098. fn: function (anObject){
  11099. var self=this;
  11100. return smalltalk.withContext(function($ctx1) {
  11101. var $1;
  11102. $1=_st(self._values())._includes_(anObject);
  11103. return $1;
  11104. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)})},
  11105. args: ["anObject"],
  11106. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  11107. messageSends: ["includes:", "values"],
  11108. referencedClasses: []
  11109. }),
  11110. globals.AssociativeCollection);
  11111. smalltalk.addMethod(
  11112. smalltalk.method({
  11113. selector: "includesKey:",
  11114. protocol: 'testing',
  11115. fn: function (aKey){
  11116. var self=this;
  11117. return smalltalk.withContext(function($ctx1) {
  11118. self._subclassResponsibility();
  11119. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)})},
  11120. args: ["aKey"],
  11121. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  11122. messageSends: ["subclassResponsibility"],
  11123. referencedClasses: []
  11124. }),
  11125. globals.AssociativeCollection);
  11126. smalltalk.addMethod(
  11127. smalltalk.method({
  11128. selector: "indexOf:ifAbsent:",
  11129. protocol: 'accessing',
  11130. fn: function (anObject,aBlock){
  11131. var self=this;
  11132. return smalltalk.withContext(function($ctx1) {
  11133. var $1;
  11134. $1=_st(self._keys())._detect_ifNone_((function(each){
  11135. return smalltalk.withContext(function($ctx2) {
  11136. return _st(self._at_(each)).__eq(anObject);
  11137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),aBlock);
  11138. return $1;
  11139. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  11140. args: ["anObject", "aBlock"],
  11141. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  11142. messageSends: ["detect:ifNone:", "keys", "=", "at:"],
  11143. referencedClasses: []
  11144. }),
  11145. globals.AssociativeCollection);
  11146. smalltalk.addMethod(
  11147. smalltalk.method({
  11148. selector: "keyAtValue:",
  11149. protocol: 'accessing',
  11150. fn: function (anObject){
  11151. var self=this;
  11152. return smalltalk.withContext(function($ctx1) {
  11153. var $1;
  11154. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  11155. return smalltalk.withContext(function($ctx2) {
  11156. return self._errorNotFound();
  11157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  11158. return $1;
  11159. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)})},
  11160. args: ["anObject"],
  11161. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  11162. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"],
  11163. referencedClasses: []
  11164. }),
  11165. globals.AssociativeCollection);
  11166. smalltalk.addMethod(
  11167. smalltalk.method({
  11168. selector: "keyAtValue:ifAbsent:",
  11169. protocol: 'accessing',
  11170. fn: function (anObject,aBlock){
  11171. var self=this;
  11172. return smalltalk.withContext(function($ctx1) {
  11173. var $1;
  11174. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  11175. return $1;
  11176. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  11177. args: ["anObject", "aBlock"],
  11178. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  11179. messageSends: ["indexOf:ifAbsent:"],
  11180. referencedClasses: []
  11181. }),
  11182. globals.AssociativeCollection);
  11183. smalltalk.addMethod(
  11184. smalltalk.method({
  11185. selector: "keys",
  11186. protocol: 'accessing',
  11187. fn: function (){
  11188. var self=this;
  11189. return smalltalk.withContext(function($ctx1) {
  11190. self._subclassResponsibility();
  11191. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)})},
  11192. args: [],
  11193. source: "keys\x0a\x09self subclassResponsibility",
  11194. messageSends: ["subclassResponsibility"],
  11195. referencedClasses: []
  11196. }),
  11197. globals.AssociativeCollection);
  11198. smalltalk.addMethod(
  11199. smalltalk.method({
  11200. selector: "keysAndValuesDo:",
  11201. protocol: 'enumerating',
  11202. fn: function (aBlock){
  11203. var self=this;
  11204. return smalltalk.withContext(function($ctx1) {
  11205. self._keysDo_((function(each){
  11206. return smalltalk.withContext(function($ctx2) {
  11207. return _st(aBlock)._value_value_(each,self._at_(each));
  11208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  11209. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11210. args: ["aBlock"],
  11211. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  11212. messageSends: ["keysDo:", "value:value:", "at:"],
  11213. referencedClasses: []
  11214. }),
  11215. globals.AssociativeCollection);
  11216. smalltalk.addMethod(
  11217. smalltalk.method({
  11218. selector: "keysDo:",
  11219. protocol: 'enumerating',
  11220. fn: function (aBlock){
  11221. var self=this;
  11222. return smalltalk.withContext(function($ctx1) {
  11223. self._subclassResponsibility();
  11224. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11225. args: ["aBlock"],
  11226. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  11227. messageSends: ["subclassResponsibility"],
  11228. referencedClasses: []
  11229. }),
  11230. globals.AssociativeCollection);
  11231. smalltalk.addMethod(
  11232. smalltalk.method({
  11233. selector: "printOn:",
  11234. protocol: 'printing',
  11235. fn: function (aStream){
  11236. var self=this;
  11237. return smalltalk.withContext(function($ctx1) {
  11238. ($ctx1.supercall = true, globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  11239. $ctx1.supercall = false;
  11240. $ctx1.sendIdx["printOn:"]=1;
  11241. _st(aStream)._nextPutAll_(" (");
  11242. $ctx1.sendIdx["nextPutAll:"]=1;
  11243. _st(self._associations())._do_separatedBy_((function(each){
  11244. return smalltalk.withContext(function($ctx2) {
  11245. return _st(each)._printOn_(aStream);
  11246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  11247. return smalltalk.withContext(function($ctx2) {
  11248. return _st(aStream)._nextPutAll_(" , ");
  11249. $ctx2.sendIdx["nextPutAll:"]=2;
  11250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  11251. _st(aStream)._nextPutAll_(")");
  11252. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)})},
  11253. args: ["aStream"],
  11254. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  11255. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  11256. referencedClasses: []
  11257. }),
  11258. globals.AssociativeCollection);
  11259. smalltalk.addMethod(
  11260. smalltalk.method({
  11261. selector: "remove:ifAbsent:",
  11262. protocol: 'adding/removing',
  11263. fn: function (aKey,aBlock){
  11264. var self=this;
  11265. return smalltalk.withContext(function($ctx1) {
  11266. var $1;
  11267. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  11268. return $1;
  11269. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  11270. args: ["aKey", "aBlock"],
  11271. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  11272. messageSends: ["removeKey:ifAbsent:"],
  11273. referencedClasses: []
  11274. }),
  11275. globals.AssociativeCollection);
  11276. smalltalk.addMethod(
  11277. smalltalk.method({
  11278. selector: "removeAll",
  11279. protocol: 'adding/removing',
  11280. fn: function (){
  11281. var self=this;
  11282. return smalltalk.withContext(function($ctx1) {
  11283. var $1;
  11284. $1=_st(self._keys())._do_((function(each){
  11285. return smalltalk.withContext(function($ctx2) {
  11286. return self._removeKey_(each);
  11287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  11288. return $1;
  11289. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)})},
  11290. args: [],
  11291. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  11292. messageSends: ["do:", "keys", "removeKey:"],
  11293. referencedClasses: []
  11294. }),
  11295. globals.AssociativeCollection);
  11296. smalltalk.addMethod(
  11297. smalltalk.method({
  11298. selector: "removeKey:",
  11299. protocol: 'adding/removing',
  11300. fn: function (aKey){
  11301. var self=this;
  11302. return smalltalk.withContext(function($ctx1) {
  11303. var $1;
  11304. $1=self._remove_(aKey);
  11305. return $1;
  11306. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)})},
  11307. args: ["aKey"],
  11308. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  11309. messageSends: ["remove:"],
  11310. referencedClasses: []
  11311. }),
  11312. globals.AssociativeCollection);
  11313. smalltalk.addMethod(
  11314. smalltalk.method({
  11315. selector: "removeKey:ifAbsent:",
  11316. protocol: 'adding/removing',
  11317. fn: function (aKey,aBlock){
  11318. var self=this;
  11319. return smalltalk.withContext(function($ctx1) {
  11320. self._subclassResponsibility();
  11321. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  11322. args: ["aKey", "aBlock"],
  11323. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11324. messageSends: ["subclassResponsibility"],
  11325. referencedClasses: []
  11326. }),
  11327. globals.AssociativeCollection);
  11328. smalltalk.addMethod(
  11329. smalltalk.method({
  11330. selector: "select:",
  11331. protocol: 'enumerating',
  11332. fn: function (aBlock){
  11333. var self=this;
  11334. var newDict;
  11335. return smalltalk.withContext(function($ctx1) {
  11336. var $1,$2;
  11337. newDict=_st(self._class())._new();
  11338. self._keysAndValuesDo_((function(key,value){
  11339. return smalltalk.withContext(function($ctx2) {
  11340. $1=_st(aBlock)._value_(value);
  11341. if(smalltalk.assert($1)){
  11342. return _st(newDict)._at_put_(key,value);
  11343. };
  11344. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11345. $2=newDict;
  11346. return $2;
  11347. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  11348. args: ["aBlock"],
  11349. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  11350. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
  11351. referencedClasses: []
  11352. }),
  11353. globals.AssociativeCollection);
  11354. smalltalk.addMethod(
  11355. smalltalk.method({
  11356. selector: "shallowCopy",
  11357. protocol: 'copying',
  11358. fn: function (){
  11359. var self=this;
  11360. var copy;
  11361. return smalltalk.withContext(function($ctx1) {
  11362. var $1;
  11363. copy=_st(self._class())._new();
  11364. self._keysAndValuesDo_((function(key,value){
  11365. return smalltalk.withContext(function($ctx2) {
  11366. return _st(copy)._at_put_(key,value);
  11367. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11368. $1=copy;
  11369. return $1;
  11370. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)})},
  11371. args: [],
  11372. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  11373. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  11374. referencedClasses: []
  11375. }),
  11376. globals.AssociativeCollection);
  11377. smalltalk.addMethod(
  11378. smalltalk.method({
  11379. selector: "size",
  11380. protocol: 'accessing',
  11381. fn: function (){
  11382. var self=this;
  11383. return smalltalk.withContext(function($ctx1) {
  11384. var $1;
  11385. $1=_st(self._keys())._size();
  11386. return $1;
  11387. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)})},
  11388. args: [],
  11389. source: "size\x0a\x09^ self keys size",
  11390. messageSends: ["size", "keys"],
  11391. referencedClasses: []
  11392. }),
  11393. globals.AssociativeCollection);
  11394. smalltalk.addMethod(
  11395. smalltalk.method({
  11396. selector: "values",
  11397. protocol: 'accessing',
  11398. fn: function (){
  11399. var self=this;
  11400. return smalltalk.withContext(function($ctx1) {
  11401. self._subclassResponsibility();
  11402. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)})},
  11403. args: [],
  11404. source: "values\x0a\x09self subclassResponsibility",
  11405. messageSends: ["subclassResponsibility"],
  11406. referencedClasses: []
  11407. }),
  11408. globals.AssociativeCollection);
  11409. smalltalk.addMethod(
  11410. smalltalk.method({
  11411. selector: "valuesDo:",
  11412. protocol: 'enumerating',
  11413. fn: function (aBlock){
  11414. var self=this;
  11415. return smalltalk.withContext(function($ctx1) {
  11416. self._subclassResponsibility();
  11417. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11418. args: ["aBlock"],
  11419. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  11420. messageSends: ["subclassResponsibility"],
  11421. referencedClasses: []
  11422. }),
  11423. globals.AssociativeCollection);
  11424. smalltalk.addMethod(
  11425. smalltalk.method({
  11426. selector: "withIndexDo:",
  11427. protocol: 'enumerating',
  11428. fn: function (aBlock){
  11429. var self=this;
  11430. return smalltalk.withContext(function($ctx1) {
  11431. self._keysAndValuesDo_((function(key,value){
  11432. return smalltalk.withContext(function($ctx2) {
  11433. return _st(aBlock)._value_value_(value,key);
  11434. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  11435. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  11436. args: ["aBlock"],
  11437. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  11438. messageSends: ["keysAndValuesDo:", "value:value:"],
  11439. referencedClasses: []
  11440. }),
  11441. globals.AssociativeCollection);
  11442. smalltalk.addMethod(
  11443. smalltalk.method({
  11444. selector: "from:",
  11445. protocol: 'instance creation',
  11446. fn: function (aCollection){
  11447. var self=this;
  11448. var newCollection;
  11449. return smalltalk.withContext(function($ctx1) {
  11450. var $1;
  11451. newCollection=self._new();
  11452. _st(aCollection)._do_((function(each){
  11453. return smalltalk.withContext(function($ctx2) {
  11454. return _st(newCollection)._add_(each);
  11455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  11456. $1=newCollection;
  11457. return $1;
  11458. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  11459. args: ["aCollection"],
  11460. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  11461. messageSends: ["new", "do:", "add:"],
  11462. referencedClasses: []
  11463. }),
  11464. globals.AssociativeCollection.klass);
  11465. smalltalk.addMethod(
  11466. smalltalk.method({
  11467. selector: "fromPairs:",
  11468. protocol: 'instance creation',
  11469. fn: function (aCollection){
  11470. var self=this;
  11471. return smalltalk.withContext(function($ctx1) {
  11472. var $1;
  11473. $1=self._from_(aCollection);
  11474. return $1;
  11475. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)})},
  11476. args: ["aCollection"],
  11477. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  11478. messageSends: ["from:"],
  11479. referencedClasses: []
  11480. }),
  11481. globals.AssociativeCollection.klass);
  11482. smalltalk.addMethod(
  11483. smalltalk.method({
  11484. selector: "newFromPairs:",
  11485. protocol: 'instance creation',
  11486. fn: function (aCollection){
  11487. var self=this;
  11488. var newCollection;
  11489. return smalltalk.withContext(function($ctx1) {
  11490. var $2,$1,$3,$4,$5;
  11491. $2=_st(aCollection)._size();
  11492. $ctx1.sendIdx["size"]=1;
  11493. $1=_st($2)._even();
  11494. if(! smalltalk.assert($1)){
  11495. self._error_("#newFromPairs only accepts arrays of an even length");
  11496. };
  11497. newCollection=self._new();
  11498. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  11499. return smalltalk.withContext(function($ctx2) {
  11500. $3=newCollection;
  11501. $4=_st(aCollection)._at_(each);
  11502. $ctx2.sendIdx["at:"]=1;
  11503. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  11504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  11505. $5=newCollection;
  11506. return $5;
  11507. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  11508. args: ["aCollection"],
  11509. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  11510. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"],
  11511. referencedClasses: []
  11512. }),
  11513. globals.AssociativeCollection.klass);
  11514. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  11515. globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  11516. smalltalk.addMethod(
  11517. smalltalk.method({
  11518. selector: "at:ifAbsent:",
  11519. protocol: 'accessing',
  11520. fn: function (aKey,aBlock){
  11521. var self=this;
  11522. return smalltalk.withContext(function($ctx1) {
  11523. var index = self._positionOfKey_(aKey);
  11524. return index >=0 ? self['@values'][index] : aBlock._value();
  11525. ;
  11526. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  11527. args: ["aKey", "aBlock"],
  11528. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  11529. messageSends: [],
  11530. referencedClasses: []
  11531. }),
  11532. globals.Dictionary);
  11533. smalltalk.addMethod(
  11534. smalltalk.method({
  11535. selector: "at:put:",
  11536. protocol: 'accessing',
  11537. fn: function (aKey,aValue){
  11538. var self=this;
  11539. return smalltalk.withContext(function($ctx1) {
  11540. var index = self._positionOfKey_(aKey);
  11541. if(index === -1) {
  11542. var keys = self['@keys'];
  11543. index = keys.length;
  11544. keys.push(aKey);
  11545. }
  11546. return self['@values'][index] = aValue;
  11547. ;
  11548. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)})},
  11549. args: ["aKey", "aValue"],
  11550. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  11551. messageSends: [],
  11552. referencedClasses: []
  11553. }),
  11554. globals.Dictionary);
  11555. smalltalk.addMethod(
  11556. smalltalk.method({
  11557. selector: "includesKey:",
  11558. protocol: 'testing',
  11559. fn: function (aKey){
  11560. var self=this;
  11561. return smalltalk.withContext(function($ctx1) {
  11562. return self._positionOfKey_(aKey) >= 0; ;
  11563. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)})},
  11564. args: ["aKey"],
  11565. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  11566. messageSends: [],
  11567. referencedClasses: []
  11568. }),
  11569. globals.Dictionary);
  11570. smalltalk.addMethod(
  11571. smalltalk.method({
  11572. selector: "indexOf:ifAbsent:",
  11573. protocol: 'accessing',
  11574. fn: function (anObject,aBlock){
  11575. var self=this;
  11576. var index;
  11577. return smalltalk.withContext(function($ctx1) {
  11578. var $2,$1;
  11579. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  11580. return (0);
  11581. }));
  11582. $2=_st(index).__eq((0));
  11583. if(smalltalk.assert($2)){
  11584. $1=_st(aBlock)._value();
  11585. } else {
  11586. $1=_st(self["@keys"])._at_(index);
  11587. };
  11588. return $1;
  11589. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)})},
  11590. args: ["anObject", "aBlock"],
  11591. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  11592. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"],
  11593. referencedClasses: []
  11594. }),
  11595. globals.Dictionary);
  11596. smalltalk.addMethod(
  11597. smalltalk.method({
  11598. selector: "initialize",
  11599. protocol: 'initialization',
  11600. fn: function (){
  11601. var self=this;
  11602. return smalltalk.withContext(function($ctx1) {
  11603. ($ctx1.supercall = true, globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []));
  11604. $ctx1.supercall = false;
  11605. self["@keys"]=[];
  11606. self["@values"]=[];
  11607. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)})},
  11608. args: [],
  11609. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  11610. messageSends: ["initialize"],
  11611. referencedClasses: []
  11612. }),
  11613. globals.Dictionary);
  11614. smalltalk.addMethod(
  11615. smalltalk.method({
  11616. selector: "keys",
  11617. protocol: 'accessing',
  11618. fn: function (){
  11619. var self=this;
  11620. return smalltalk.withContext(function($ctx1) {
  11621. var $1;
  11622. $1=_st(self["@keys"])._copy();
  11623. return $1;
  11624. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)})},
  11625. args: [],
  11626. source: "keys\x0a\x09^ keys copy",
  11627. messageSends: ["copy"],
  11628. referencedClasses: []
  11629. }),
  11630. globals.Dictionary);
  11631. smalltalk.addMethod(
  11632. smalltalk.method({
  11633. selector: "keysAndValuesDo:",
  11634. protocol: 'enumerating',
  11635. fn: function (aBlock){
  11636. var self=this;
  11637. return smalltalk.withContext(function($ctx1) {
  11638. var $1;
  11639. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  11640. return $1;
  11641. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  11642. args: ["aBlock"],
  11643. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  11644. messageSends: ["with:do:"],
  11645. referencedClasses: []
  11646. }),
  11647. globals.Dictionary);
  11648. smalltalk.addMethod(
  11649. smalltalk.method({
  11650. selector: "keysDo:",
  11651. protocol: 'enumerating',
  11652. fn: function (aBlock){
  11653. var self=this;
  11654. return smalltalk.withContext(function($ctx1) {
  11655. var $1;
  11656. $1=_st(self["@keys"])._do_(aBlock);
  11657. return $1;
  11658. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)})},
  11659. args: ["aBlock"],
  11660. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  11661. messageSends: ["do:"],
  11662. referencedClasses: []
  11663. }),
  11664. globals.Dictionary);
  11665. smalltalk.addMethod(
  11666. smalltalk.method({
  11667. selector: "positionOfKey:",
  11668. protocol: 'private',
  11669. fn: function (anObject){
  11670. var self=this;
  11671. return smalltalk.withContext(function($ctx1) {
  11672. var keys = self['@keys'];
  11673. for(var i=0;i<keys.length;i++){
  11674. if(keys[i].__eq(anObject)) { return i;}
  11675. }
  11676. return -1;
  11677. ;
  11678. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)})},
  11679. args: ["anObject"],
  11680. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  11681. messageSends: [],
  11682. referencedClasses: []
  11683. }),
  11684. globals.Dictionary);
  11685. smalltalk.addMethod(
  11686. smalltalk.method({
  11687. selector: "removeAll",
  11688. protocol: 'adding/removing',
  11689. fn: function (){
  11690. var self=this;
  11691. return smalltalk.withContext(function($ctx1) {
  11692. _st(self["@keys"])._removeAll();
  11693. $ctx1.sendIdx["removeAll"]=1;
  11694. _st(self["@values"])._removeAll();
  11695. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)})},
  11696. args: [],
  11697. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  11698. messageSends: ["removeAll"],
  11699. referencedClasses: []
  11700. }),
  11701. globals.Dictionary);
  11702. smalltalk.addMethod(
  11703. smalltalk.method({
  11704. selector: "removeKey:ifAbsent:",
  11705. protocol: 'adding/removing',
  11706. fn: function (aKey,aBlock){
  11707. var self=this;
  11708. return smalltalk.withContext(function($ctx1) {
  11709. var index = self._positionOfKey_(aKey);
  11710. if(index === -1) {
  11711. return aBlock._value()
  11712. } else {
  11713. var keys = self['@keys'], values = self['@values'];
  11714. var value = values[index], l = keys.length;
  11715. keys[index] = keys[l-1];
  11716. keys.pop();
  11717. values[index] = values[l-1];
  11718. values.pop();
  11719. return value;
  11720. }
  11721. ;
  11722. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  11723. args: ["aKey", "aBlock"],
  11724. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  11725. messageSends: [],
  11726. referencedClasses: []
  11727. }),
  11728. globals.Dictionary);
  11729. smalltalk.addMethod(
  11730. smalltalk.method({
  11731. selector: "values",
  11732. protocol: 'accessing',
  11733. fn: function (){
  11734. var self=this;
  11735. var $1;
  11736. $1=self["@values"];
  11737. return $1;
  11738. },
  11739. args: [],
  11740. source: "values\x0a\x09^ values",
  11741. messageSends: [],
  11742. referencedClasses: []
  11743. }),
  11744. globals.Dictionary);
  11745. smalltalk.addMethod(
  11746. smalltalk.method({
  11747. selector: "valuesDo:",
  11748. protocol: 'enumerating',
  11749. fn: function (aBlock){
  11750. var self=this;
  11751. return smalltalk.withContext(function($ctx1) {
  11752. var $1;
  11753. $1=_st(self["@values"])._do_(aBlock);
  11754. return $1;
  11755. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  11756. args: ["aBlock"],
  11757. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  11758. messageSends: ["do:"],
  11759. referencedClasses: []
  11760. }),
  11761. globals.Dictionary);
  11762. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  11763. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  11764. smalltalk.addMethod(
  11765. smalltalk.method({
  11766. selector: "at:ifAbsent:",
  11767. protocol: 'accessing',
  11768. fn: function (aKey,aBlock){
  11769. var self=this;
  11770. return smalltalk.withContext(function($ctx1) {
  11771. var $2,$1;
  11772. $2=self._includesKey_(aKey);
  11773. if(smalltalk.assert($2)){
  11774. $1=self._basicAt_(aKey);
  11775. } else {
  11776. $1=_st(aBlock)._value();
  11777. };
  11778. return $1;
  11779. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  11780. args: ["aKey", "aBlock"],
  11781. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  11782. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"],
  11783. referencedClasses: []
  11784. }),
  11785. globals.HashedCollection);
  11786. smalltalk.addMethod(
  11787. smalltalk.method({
  11788. selector: "at:put:",
  11789. protocol: 'accessing',
  11790. fn: function (aKey,aValue){
  11791. var self=this;
  11792. return smalltalk.withContext(function($ctx1) {
  11793. var $1;
  11794. $1=self._basicAt_put_(aKey,aValue);
  11795. return $1;
  11796. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)})},
  11797. args: ["aKey", "aValue"],
  11798. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  11799. messageSends: ["basicAt:put:"],
  11800. referencedClasses: []
  11801. }),
  11802. globals.HashedCollection);
  11803. smalltalk.addMethod(
  11804. smalltalk.method({
  11805. selector: "includesKey:",
  11806. protocol: 'testing',
  11807. fn: function (aKey){
  11808. var self=this;
  11809. return smalltalk.withContext(function($ctx1) {
  11810. return self.hasOwnProperty(aKey);
  11811. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)})},
  11812. args: ["aKey"],
  11813. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  11814. messageSends: [],
  11815. referencedClasses: []
  11816. }),
  11817. globals.HashedCollection);
  11818. smalltalk.addMethod(
  11819. smalltalk.method({
  11820. selector: "keys",
  11821. protocol: 'accessing',
  11822. fn: function (){
  11823. var self=this;
  11824. return smalltalk.withContext(function($ctx1) {
  11825. return Object.keys(self);
  11826. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)})},
  11827. args: [],
  11828. source: "keys\x0a\x09<return Object.keys(self)>",
  11829. messageSends: [],
  11830. referencedClasses: []
  11831. }),
  11832. globals.HashedCollection);
  11833. smalltalk.addMethod(
  11834. smalltalk.method({
  11835. selector: "keysDo:",
  11836. protocol: 'enumerating',
  11837. fn: function (aBlock){
  11838. var self=this;
  11839. return smalltalk.withContext(function($ctx1) {
  11840. _st(self._keys())._do_(aBlock);
  11841. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)})},
  11842. args: ["aBlock"],
  11843. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  11844. messageSends: ["do:", "keys"],
  11845. referencedClasses: []
  11846. }),
  11847. globals.HashedCollection);
  11848. smalltalk.addMethod(
  11849. smalltalk.method({
  11850. selector: "removeKey:ifAbsent:",
  11851. protocol: 'adding/removing',
  11852. fn: function (aKey,aBlock){
  11853. var self=this;
  11854. return smalltalk.withContext(function($ctx1) {
  11855. var $1;
  11856. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  11857. return smalltalk.withContext(function($ctx2) {
  11858. self._basicDelete_(aKey);
  11859. return removed;
  11860. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)})}),(function(){
  11861. return smalltalk.withContext(function($ctx2) {
  11862. return _st(aBlock)._value();
  11863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  11864. return $1;
  11865. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  11866. args: ["aKey", "aBlock"],
  11867. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  11868. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"],
  11869. referencedClasses: []
  11870. }),
  11871. globals.HashedCollection);
  11872. smalltalk.addMethod(
  11873. smalltalk.method({
  11874. selector: "values",
  11875. protocol: 'accessing',
  11876. fn: function (){
  11877. var self=this;
  11878. return smalltalk.withContext(function($ctx1) {
  11879. return self._keys().map(function(key){
  11880. return self._at_(key);
  11881. });
  11882. ;
  11883. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)})},
  11884. args: [],
  11885. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  11886. messageSends: [],
  11887. referencedClasses: []
  11888. }),
  11889. globals.HashedCollection);
  11890. smalltalk.addMethod(
  11891. smalltalk.method({
  11892. selector: "valuesDo:",
  11893. protocol: 'enumerating',
  11894. fn: function (aBlock){
  11895. var self=this;
  11896. return smalltalk.withContext(function($ctx1) {
  11897. _st(self._values())._do_(aBlock);
  11898. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)})},
  11899. args: ["aBlock"],
  11900. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  11901. messageSends: ["do:", "values"],
  11902. referencedClasses: []
  11903. }),
  11904. globals.HashedCollection);
  11905. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  11906. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  11907. smalltalk.addMethod(
  11908. smalltalk.method({
  11909. selector: "=",
  11910. protocol: 'comparing',
  11911. fn: function (aCollection){
  11912. var self=this;
  11913. return smalltalk.withContext(function($ctx1) {
  11914. var $3,$2,$4,$1,$5;
  11915. var $early={};
  11916. try {
  11917. $3=self._class();
  11918. $ctx1.sendIdx["class"]=1;
  11919. $2=_st($3).__eq(_st(aCollection)._class());
  11920. $ctx1.sendIdx["="]=1;
  11921. $1=_st($2)._and_((function(){
  11922. return smalltalk.withContext(function($ctx2) {
  11923. $4=self._size();
  11924. $ctx2.sendIdx["size"]=1;
  11925. return _st($4).__eq(_st(aCollection)._size());
  11926. $ctx2.sendIdx["="]=2;
  11927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  11928. if(! smalltalk.assert($1)){
  11929. return false;
  11930. };
  11931. self._withIndexDo_((function(each,i){
  11932. return smalltalk.withContext(function($ctx2) {
  11933. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  11934. if(! smalltalk.assert($5)){
  11935. throw $early=[false];
  11936. };
  11937. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  11938. return true;
  11939. }
  11940. catch(e) {if(e===$early)return e[0]; throw e}
  11941. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)})},
  11942. args: ["aCollection"],
  11943. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  11944. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
  11945. referencedClasses: []
  11946. }),
  11947. globals.SequenceableCollection);
  11948. smalltalk.addMethod(
  11949. smalltalk.method({
  11950. selector: "addLast:",
  11951. protocol: 'adding/removing',
  11952. fn: function (anObject){
  11953. var self=this;
  11954. return smalltalk.withContext(function($ctx1) {
  11955. self._add_(anObject);
  11956. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)})},
  11957. args: ["anObject"],
  11958. source: "addLast: anObject\x0a\x09self add: anObject",
  11959. messageSends: ["add:"],
  11960. referencedClasses: []
  11961. }),
  11962. globals.SequenceableCollection);
  11963. smalltalk.addMethod(
  11964. smalltalk.method({
  11965. selector: "allButFirst",
  11966. protocol: 'accessing',
  11967. fn: function (){
  11968. var self=this;
  11969. return smalltalk.withContext(function($ctx1) {
  11970. var $1;
  11971. $1=self._copyFrom_to_((2),self._size());
  11972. return $1;
  11973. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)})},
  11974. args: [],
  11975. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  11976. messageSends: ["copyFrom:to:", "size"],
  11977. referencedClasses: []
  11978. }),
  11979. globals.SequenceableCollection);
  11980. smalltalk.addMethod(
  11981. smalltalk.method({
  11982. selector: "allButLast",
  11983. protocol: 'accessing',
  11984. fn: function (){
  11985. var self=this;
  11986. return smalltalk.withContext(function($ctx1) {
  11987. var $1;
  11988. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  11989. return $1;
  11990. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)})},
  11991. args: [],
  11992. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  11993. messageSends: ["copyFrom:to:", "-", "size"],
  11994. referencedClasses: []
  11995. }),
  11996. globals.SequenceableCollection);
  11997. smalltalk.addMethod(
  11998. smalltalk.method({
  11999. selector: "atRandom",
  12000. protocol: 'accessing',
  12001. fn: function (){
  12002. var self=this;
  12003. return smalltalk.withContext(function($ctx1) {
  12004. var $1;
  12005. $1=self._at_(_st(self._size())._atRandom());
  12006. return $1;
  12007. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)})},
  12008. args: [],
  12009. source: "atRandom\x0a\x09^ self at: self size atRandom",
  12010. messageSends: ["at:", "atRandom", "size"],
  12011. referencedClasses: []
  12012. }),
  12013. globals.SequenceableCollection);
  12014. smalltalk.addMethod(
  12015. smalltalk.method({
  12016. selector: "beginsWith:",
  12017. protocol: 'testing',
  12018. fn: function (prefix){
  12019. var self=this;
  12020. return smalltalk.withContext(function($ctx1) {
  12021. var $2,$3,$1,$4;
  12022. $2=self._size();
  12023. $ctx1.sendIdx["size"]=1;
  12024. $3=_st(prefix)._size();
  12025. $ctx1.sendIdx["size"]=2;
  12026. $1=_st($2).__lt($3);
  12027. if(smalltalk.assert($1)){
  12028. return false;
  12029. };
  12030. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  12031. return $4;
  12032. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)})},
  12033. args: ["prefix"],
  12034. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  12035. messageSends: ["ifTrue:", "<", "size", "=", "first:"],
  12036. referencedClasses: []
  12037. }),
  12038. globals.SequenceableCollection);
  12039. smalltalk.addMethod(
  12040. smalltalk.method({
  12041. selector: "copyFrom:to:",
  12042. protocol: 'copying',
  12043. fn: function (anIndex,anotherIndex){
  12044. var self=this;
  12045. var range,newCollection;
  12046. return smalltalk.withContext(function($ctx1) {
  12047. var $1;
  12048. range=_st(anIndex)._to_(anotherIndex);
  12049. newCollection=_st(self._class())._new_(_st(range)._size());
  12050. _st(range)._withIndexDo_((function(each,i){
  12051. return smalltalk.withContext(function($ctx2) {
  12052. return _st(newCollection)._at_put_(i,self._at_(each));
  12053. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  12054. $1=newCollection;
  12055. return $1;
  12056. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)})},
  12057. args: ["anIndex", "anotherIndex"],
  12058. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  12059. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
  12060. referencedClasses: []
  12061. }),
  12062. globals.SequenceableCollection);
  12063. smalltalk.addMethod(
  12064. smalltalk.method({
  12065. selector: "deepCopy",
  12066. protocol: 'copying',
  12067. fn: function (){
  12068. var self=this;
  12069. var newCollection;
  12070. return smalltalk.withContext(function($ctx1) {
  12071. var $1;
  12072. newCollection=_st(self._class())._new_(self._size());
  12073. self._withIndexDo_((function(each,index){
  12074. return smalltalk.withContext(function($ctx2) {
  12075. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  12076. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  12077. $1=newCollection;
  12078. return $1;
  12079. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  12080. args: [],
  12081. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  12082. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
  12083. referencedClasses: []
  12084. }),
  12085. globals.SequenceableCollection);
  12086. smalltalk.addMethod(
  12087. smalltalk.method({
  12088. selector: "detect:ifNone:",
  12089. protocol: 'enumerating',
  12090. fn: function (aBlock,anotherBlock){
  12091. var self=this;
  12092. return smalltalk.withContext(function($ctx1) {
  12093. self = self._numericallyIndexable();
  12094. for(var i = 0; i < self.length; i++)
  12095. if(aBlock._value_(self[i]))
  12096. return self[i];
  12097. return anotherBlock._value();
  12098. ;
  12099. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)})},
  12100. args: ["aBlock", "anotherBlock"],
  12101. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  12102. messageSends: [],
  12103. referencedClasses: []
  12104. }),
  12105. globals.SequenceableCollection);
  12106. smalltalk.addMethod(
  12107. smalltalk.method({
  12108. selector: "do:",
  12109. protocol: 'enumerating',
  12110. fn: function (aBlock){
  12111. var self=this;
  12112. return smalltalk.withContext(function($ctx1) {
  12113. self = self._numericallyIndexable();
  12114. for(var i=0; i < self.length; i++) {
  12115. aBlock._value_(self[i]);
  12116. }
  12117. ;
  12118. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)})},
  12119. args: ["aBlock"],
  12120. source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
  12121. messageSends: [],
  12122. referencedClasses: []
  12123. }),
  12124. globals.SequenceableCollection);
  12125. smalltalk.addMethod(
  12126. smalltalk.method({
  12127. selector: "endsWith:",
  12128. protocol: 'testing',
  12129. fn: function (suffix){
  12130. var self=this;
  12131. return smalltalk.withContext(function($ctx1) {
  12132. var $2,$3,$1,$4;
  12133. $2=self._size();
  12134. $ctx1.sendIdx["size"]=1;
  12135. $3=_st(suffix)._size();
  12136. $ctx1.sendIdx["size"]=2;
  12137. $1=_st($2).__lt($3);
  12138. if(smalltalk.assert($1)){
  12139. return false;
  12140. };
  12141. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  12142. return $4;
  12143. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)})},
  12144. args: ["suffix"],
  12145. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  12146. messageSends: ["ifTrue:", "<", "size", "=", "last:"],
  12147. referencedClasses: []
  12148. }),
  12149. globals.SequenceableCollection);
  12150. smalltalk.addMethod(
  12151. smalltalk.method({
  12152. selector: "first",
  12153. protocol: 'accessing',
  12154. fn: function (){
  12155. var self=this;
  12156. return smalltalk.withContext(function($ctx1) {
  12157. var $1;
  12158. $1=self._at_((1));
  12159. return $1;
  12160. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)})},
  12161. args: [],
  12162. source: "first\x0a\x09^ self at: 1",
  12163. messageSends: ["at:"],
  12164. referencedClasses: []
  12165. }),
  12166. globals.SequenceableCollection);
  12167. smalltalk.addMethod(
  12168. smalltalk.method({
  12169. selector: "first:",
  12170. protocol: 'accessing',
  12171. fn: function (aNumber){
  12172. var self=this;
  12173. return smalltalk.withContext(function($ctx1) {
  12174. var $1,$2;
  12175. $1=_st(self._size()).__lt(aNumber);
  12176. if(smalltalk.assert($1)){
  12177. self._error_("Invalid number of elements");
  12178. };
  12179. $2=self._copyFrom_to_((1),aNumber);
  12180. return $2;
  12181. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)})},
  12182. args: ["aNumber"],
  12183. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  12184. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"],
  12185. referencedClasses: []
  12186. }),
  12187. globals.SequenceableCollection);
  12188. smalltalk.addMethod(
  12189. smalltalk.method({
  12190. selector: "fourth",
  12191. protocol: 'accessing',
  12192. fn: function (){
  12193. var self=this;
  12194. return smalltalk.withContext(function($ctx1) {
  12195. var $1;
  12196. $1=self._at_((4));
  12197. return $1;
  12198. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)})},
  12199. args: [],
  12200. source: "fourth\x0a\x09^ self at: 4",
  12201. messageSends: ["at:"],
  12202. referencedClasses: []
  12203. }),
  12204. globals.SequenceableCollection);
  12205. smalltalk.addMethod(
  12206. smalltalk.method({
  12207. selector: "includes:",
  12208. protocol: 'testing',
  12209. fn: function (anObject){
  12210. var self=this;
  12211. return smalltalk.withContext(function($ctx1) {
  12212. var $1;
  12213. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  12214. return nil;
  12215. })))._notNil();
  12216. return $1;
  12217. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)})},
  12218. args: ["anObject"],
  12219. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  12220. messageSends: ["notNil", "indexOf:ifAbsent:"],
  12221. referencedClasses: []
  12222. }),
  12223. globals.SequenceableCollection);
  12224. smalltalk.addMethod(
  12225. smalltalk.method({
  12226. selector: "indexOf:ifAbsent:",
  12227. protocol: 'accessing',
  12228. fn: function (anObject,aBlock){
  12229. var self=this;
  12230. return smalltalk.withContext(function($ctx1) {
  12231. self = self._numericallyIndexable();
  12232. for(var i=0; i < self.length; i++) {
  12233. if(_st(self[i]).__eq(anObject)) {return i+1}
  12234. };
  12235. return aBlock._value();
  12236. ;
  12237. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)})},
  12238. args: ["anObject", "aBlock"],
  12239. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  12240. messageSends: [],
  12241. referencedClasses: []
  12242. }),
  12243. globals.SequenceableCollection);
  12244. smalltalk.addMethod(
  12245. smalltalk.method({
  12246. selector: "indexOf:startingAt:",
  12247. protocol: 'accessing',
  12248. fn: function (anObject,start){
  12249. var self=this;
  12250. return smalltalk.withContext(function($ctx1) {
  12251. var $1;
  12252. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  12253. return (0);
  12254. }));
  12255. return $1;
  12256. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)})},
  12257. args: ["anObject", "start"],
  12258. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  12259. messageSends: ["indexOf:startingAt:ifAbsent:"],
  12260. referencedClasses: []
  12261. }),
  12262. globals.SequenceableCollection);
  12263. smalltalk.addMethod(
  12264. smalltalk.method({
  12265. selector: "indexOf:startingAt:ifAbsent:",
  12266. protocol: 'accessing',
  12267. fn: function (anObject,start,aBlock){
  12268. var self=this;
  12269. return smalltalk.withContext(function($ctx1) {
  12270. self = self._numericallyIndexable();
  12271. for(var i=start - 1; i < self.length; i++){
  12272. if(_st(self[i]).__eq(anObject)) {return i+1}
  12273. }
  12274. return aBlock._value();
  12275. ;
  12276. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)})},
  12277. args: ["anObject", "start", "aBlock"],
  12278. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  12279. messageSends: [],
  12280. referencedClasses: []
  12281. }),
  12282. globals.SequenceableCollection);
  12283. smalltalk.addMethod(
  12284. smalltalk.method({
  12285. selector: "last",
  12286. protocol: 'accessing',
  12287. fn: function (){
  12288. var self=this;
  12289. return smalltalk.withContext(function($ctx1) {
  12290. var $1;
  12291. $1=self._at_(self._size());
  12292. return $1;
  12293. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)})},
  12294. args: [],
  12295. source: "last\x0a\x09^ self at: self size",
  12296. messageSends: ["at:", "size"],
  12297. referencedClasses: []
  12298. }),
  12299. globals.SequenceableCollection);
  12300. smalltalk.addMethod(
  12301. smalltalk.method({
  12302. selector: "last:",
  12303. protocol: 'accessing',
  12304. fn: function (aNumber){
  12305. var self=this;
  12306. return smalltalk.withContext(function($ctx1) {
  12307. var $2,$1,$6,$5,$4,$3;
  12308. $2=self._size();
  12309. $ctx1.sendIdx["size"]=1;
  12310. $1=_st($2).__lt(aNumber);
  12311. if(smalltalk.assert($1)){
  12312. self._error_("Invalid number of elements");
  12313. };
  12314. $6=self._size();
  12315. $ctx1.sendIdx["size"]=2;
  12316. $5=_st($6).__minus(aNumber);
  12317. $4=_st($5).__plus((1));
  12318. $3=self._copyFrom_to_($4,self._size());
  12319. return $3;
  12320. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)})},
  12321. args: ["aNumber"],
  12322. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  12323. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"],
  12324. referencedClasses: []
  12325. }),
  12326. globals.SequenceableCollection);
  12327. smalltalk.addMethod(
  12328. smalltalk.method({
  12329. selector: "newStream",
  12330. protocol: 'streaming',
  12331. fn: function (){
  12332. var self=this;
  12333. return smalltalk.withContext(function($ctx1) {
  12334. var $1;
  12335. $1=_st(self._streamClass())._on_(self);
  12336. return $1;
  12337. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)})},
  12338. args: [],
  12339. source: "newStream\x0a\x09^ self streamClass on: self",
  12340. messageSends: ["on:", "streamClass"],
  12341. referencedClasses: []
  12342. }),
  12343. globals.SequenceableCollection);
  12344. smalltalk.addMethod(
  12345. smalltalk.method({
  12346. selector: "numericallyIndexable",
  12347. protocol: 'private',
  12348. fn: function (){
  12349. var self=this;
  12350. return smalltalk.withContext(function($ctx1) {
  12351. self._subclassResponsibility();
  12352. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)})},
  12353. args: [],
  12354. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  12355. messageSends: ["subclassResponsibility"],
  12356. referencedClasses: []
  12357. }),
  12358. globals.SequenceableCollection);
  12359. smalltalk.addMethod(
  12360. smalltalk.method({
  12361. selector: "readStream",
  12362. protocol: 'streaming',
  12363. fn: function (){
  12364. var self=this;
  12365. return smalltalk.withContext(function($ctx1) {
  12366. var $1;
  12367. $1=self._stream();
  12368. return $1;
  12369. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)})},
  12370. args: [],
  12371. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  12372. messageSends: ["stream"],
  12373. referencedClasses: []
  12374. }),
  12375. globals.SequenceableCollection);
  12376. smalltalk.addMethod(
  12377. smalltalk.method({
  12378. selector: "removeLast",
  12379. protocol: 'adding/removing',
  12380. fn: function (){
  12381. var self=this;
  12382. return smalltalk.withContext(function($ctx1) {
  12383. var $1;
  12384. $1=self._remove_(self._last());
  12385. return $1;
  12386. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)})},
  12387. args: [],
  12388. source: "removeLast\x0a\x09^ self remove: self last",
  12389. messageSends: ["remove:", "last"],
  12390. referencedClasses: []
  12391. }),
  12392. globals.SequenceableCollection);
  12393. smalltalk.addMethod(
  12394. smalltalk.method({
  12395. selector: "reversed",
  12396. protocol: 'converting',
  12397. fn: function (){
  12398. var self=this;
  12399. return smalltalk.withContext(function($ctx1) {
  12400. self._subclassResponsibility();
  12401. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)})},
  12402. args: [],
  12403. source: "reversed\x0a\x09self subclassResponsibility",
  12404. messageSends: ["subclassResponsibility"],
  12405. referencedClasses: []
  12406. }),
  12407. globals.SequenceableCollection);
  12408. smalltalk.addMethod(
  12409. smalltalk.method({
  12410. selector: "second",
  12411. protocol: 'accessing',
  12412. fn: function (){
  12413. var self=this;
  12414. return smalltalk.withContext(function($ctx1) {
  12415. var $1;
  12416. $1=self._at_((2));
  12417. return $1;
  12418. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)})},
  12419. args: [],
  12420. source: "second\x0a\x09^ self at: 2",
  12421. messageSends: ["at:"],
  12422. referencedClasses: []
  12423. }),
  12424. globals.SequenceableCollection);
  12425. smalltalk.addMethod(
  12426. smalltalk.method({
  12427. selector: "shallowCopy",
  12428. protocol: 'copying',
  12429. fn: function (){
  12430. var self=this;
  12431. var newCollection;
  12432. return smalltalk.withContext(function($ctx1) {
  12433. var $1;
  12434. newCollection=_st(self._class())._new_(self._size());
  12435. self._withIndexDo_((function(each,index){
  12436. return smalltalk.withContext(function($ctx2) {
  12437. return _st(newCollection)._at_put_(index,each);
  12438. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  12439. $1=newCollection;
  12440. return $1;
  12441. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  12442. args: [],
  12443. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  12444. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  12445. referencedClasses: []
  12446. }),
  12447. globals.SequenceableCollection);
  12448. smalltalk.addMethod(
  12449. smalltalk.method({
  12450. selector: "stream",
  12451. protocol: 'streaming',
  12452. fn: function (){
  12453. var self=this;
  12454. return smalltalk.withContext(function($ctx1) {
  12455. var $1;
  12456. $1=self._newStream();
  12457. return $1;
  12458. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)})},
  12459. args: [],
  12460. source: "stream\x0a\x09^ self newStream",
  12461. messageSends: ["newStream"],
  12462. referencedClasses: []
  12463. }),
  12464. globals.SequenceableCollection);
  12465. smalltalk.addMethod(
  12466. smalltalk.method({
  12467. selector: "streamClass",
  12468. protocol: 'streaming',
  12469. fn: function (){
  12470. var self=this;
  12471. return smalltalk.withContext(function($ctx1) {
  12472. var $1;
  12473. $1=_st(self._class())._streamClass();
  12474. return $1;
  12475. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)})},
  12476. args: [],
  12477. source: "streamClass\x0a\x09^ self class streamClass",
  12478. messageSends: ["streamClass", "class"],
  12479. referencedClasses: []
  12480. }),
  12481. globals.SequenceableCollection);
  12482. smalltalk.addMethod(
  12483. smalltalk.method({
  12484. selector: "third",
  12485. protocol: 'accessing',
  12486. fn: function (){
  12487. var self=this;
  12488. return smalltalk.withContext(function($ctx1) {
  12489. var $1;
  12490. $1=self._at_((3));
  12491. return $1;
  12492. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)})},
  12493. args: [],
  12494. source: "third\x0a\x09^ self at: 3",
  12495. messageSends: ["at:"],
  12496. referencedClasses: []
  12497. }),
  12498. globals.SequenceableCollection);
  12499. smalltalk.addMethod(
  12500. smalltalk.method({
  12501. selector: "with:do:",
  12502. protocol: 'enumerating',
  12503. fn: function (anotherCollection,aBlock){
  12504. var self=this;
  12505. return smalltalk.withContext(function($ctx1) {
  12506. self = self._numericallyIndexable();
  12507. anotherCollection = anotherCollection._numericallyIndexable();
  12508. for(var i=0; i<self.length; i++) {
  12509. aBlock._value_value_(self[i], anotherCollection[i]);
  12510. }
  12511. ;
  12512. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)})},
  12513. args: ["anotherCollection", "aBlock"],
  12514. source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
  12515. messageSends: [],
  12516. referencedClasses: []
  12517. }),
  12518. globals.SequenceableCollection);
  12519. smalltalk.addMethod(
  12520. smalltalk.method({
  12521. selector: "withIndexDo:",
  12522. protocol: 'enumerating',
  12523. fn: function (aBlock){
  12524. var self=this;
  12525. return smalltalk.withContext(function($ctx1) {
  12526. self = self._numericallyIndexable();
  12527. for(var i=0; i < self.length; i++) {
  12528. aBlock._value_value_(self[i], i+1);
  12529. }
  12530. ;
  12531. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)})},
  12532. args: ["aBlock"],
  12533. source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
  12534. messageSends: [],
  12535. referencedClasses: []
  12536. }),
  12537. globals.SequenceableCollection);
  12538. smalltalk.addMethod(
  12539. smalltalk.method({
  12540. selector: "writeStream",
  12541. protocol: 'streaming',
  12542. fn: function (){
  12543. var self=this;
  12544. return smalltalk.withContext(function($ctx1) {
  12545. var $1;
  12546. $1=self._stream();
  12547. return $1;
  12548. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)})},
  12549. args: [],
  12550. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  12551. messageSends: ["stream"],
  12552. referencedClasses: []
  12553. }),
  12554. globals.SequenceableCollection);
  12555. smalltalk.addMethod(
  12556. smalltalk.method({
  12557. selector: "streamClass",
  12558. protocol: 'accessing',
  12559. fn: function (){
  12560. var self=this;
  12561. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  12562. return $Stream();
  12563. },
  12564. args: [],
  12565. source: "streamClass\x0a\x09\x09^ Stream",
  12566. messageSends: [],
  12567. referencedClasses: ["Stream"]
  12568. }),
  12569. globals.SequenceableCollection.klass);
  12570. smalltalk.addMethod(
  12571. smalltalk.method({
  12572. selector: "streamContents:",
  12573. protocol: 'streaming',
  12574. fn: function (aBlock){
  12575. var self=this;
  12576. var stream;
  12577. return smalltalk.withContext(function($ctx1) {
  12578. var $1;
  12579. stream=_st(self._streamClass())._on_(self._new());
  12580. _st(aBlock)._value_(stream);
  12581. $1=_st(stream)._contents();
  12582. return $1;
  12583. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)})},
  12584. args: ["aBlock"],
  12585. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  12586. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  12587. referencedClasses: []
  12588. }),
  12589. globals.SequenceableCollection.klass);
  12590. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  12591. globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  12592. smalltalk.addMethod(
  12593. smalltalk.method({
  12594. selector: "add:",
  12595. protocol: 'adding/removing',
  12596. fn: function (anObject){
  12597. var self=this;
  12598. return smalltalk.withContext(function($ctx1) {
  12599. self.push(anObject); return anObject;;
  12600. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)})},
  12601. args: ["anObject"],
  12602. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  12603. messageSends: [],
  12604. referencedClasses: []
  12605. }),
  12606. globals.Array);
  12607. smalltalk.addMethod(
  12608. smalltalk.method({
  12609. selector: "addFirst:",
  12610. protocol: 'adding/removing',
  12611. fn: function (anObject){
  12612. var self=this;
  12613. return smalltalk.withContext(function($ctx1) {
  12614. self.unshift(anObject); return anObject;;
  12615. return self}, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)})},
  12616. args: ["anObject"],
  12617. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  12618. messageSends: [],
  12619. referencedClasses: []
  12620. }),
  12621. globals.Array);
  12622. smalltalk.addMethod(
  12623. smalltalk.method({
  12624. selector: "asJavascript",
  12625. protocol: 'converting',
  12626. fn: function (){
  12627. var self=this;
  12628. return smalltalk.withContext(function($ctx1) {
  12629. var $1;
  12630. $1=_st("[".__comma(_st(self._collect_((function(each){
  12631. return smalltalk.withContext(function($ctx2) {
  12632. return _st(each)._asJavascript();
  12633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._join_(", "))).__comma("]");
  12634. $ctx1.sendIdx[","]=1;
  12635. return $1;
  12636. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)})},
  12637. args: [],
  12638. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  12639. messageSends: [",", "join:", "collect:", "asJavascript"],
  12640. referencedClasses: []
  12641. }),
  12642. globals.Array);
  12643. smalltalk.addMethod(
  12644. smalltalk.method({
  12645. selector: "at:ifAbsent:",
  12646. protocol: 'accessing',
  12647. fn: function (anIndex,aBlock){
  12648. var self=this;
  12649. return smalltalk.withContext(function($ctx1) {
  12650. return anIndex >= 1 && anIndex <= self.length
  12651. ? self[anIndex - 1]
  12652. : aBlock._value()
  12653. ;
  12654. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)})},
  12655. args: ["anIndex", "aBlock"],
  12656. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  12657. messageSends: [],
  12658. referencedClasses: []
  12659. }),
  12660. globals.Array);
  12661. smalltalk.addMethod(
  12662. smalltalk.method({
  12663. selector: "at:ifPresent:ifAbsent:",
  12664. protocol: 'accessing',
  12665. fn: function (anIndex,aBlock,anotherBlock){
  12666. var self=this;
  12667. return smalltalk.withContext(function($ctx1) {
  12668. return anIndex >= 1 && anIndex <= self.length
  12669. ? aBlock._value_(self[anIndex - 1])
  12670. : anotherBlock._value()
  12671. ;
  12672. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)})},
  12673. args: ["anIndex", "aBlock", "anotherBlock"],
  12674. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
  12675. messageSends: [],
  12676. referencedClasses: []
  12677. }),
  12678. globals.Array);
  12679. smalltalk.addMethod(
  12680. smalltalk.method({
  12681. selector: "at:put:",
  12682. protocol: 'accessing',
  12683. fn: function (anIndex,anObject){
  12684. var self=this;
  12685. return smalltalk.withContext(function($ctx1) {
  12686. return self[anIndex - 1] = anObject;
  12687. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)})},
  12688. args: ["anIndex", "anObject"],
  12689. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  12690. messageSends: [],
  12691. referencedClasses: []
  12692. }),
  12693. globals.Array);
  12694. smalltalk.addMethod(
  12695. smalltalk.method({
  12696. selector: "collect:",
  12697. protocol: 'enumerating',
  12698. fn: function (aBlock){
  12699. var self=this;
  12700. return smalltalk.withContext(function($ctx1) {
  12701. return self.map(function(each) {return aBlock._value_(each)});
  12702. return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)})},
  12703. args: ["aBlock"],
  12704. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  12705. messageSends: [],
  12706. referencedClasses: []
  12707. }),
  12708. globals.Array);
  12709. smalltalk.addMethod(
  12710. smalltalk.method({
  12711. selector: "join:",
  12712. protocol: 'enumerating',
  12713. fn: function (aString){
  12714. var self=this;
  12715. return smalltalk.withContext(function($ctx1) {
  12716. return self.join(aString);
  12717. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)})},
  12718. args: ["aString"],
  12719. source: "join: aString\x0a\x09<return self.join(aString)>",
  12720. messageSends: [],
  12721. referencedClasses: []
  12722. }),
  12723. globals.Array);
  12724. smalltalk.addMethod(
  12725. smalltalk.method({
  12726. selector: "numericallyIndexable",
  12727. protocol: 'private',
  12728. fn: function (){
  12729. var self=this;
  12730. return self;
  12731. },
  12732. args: [],
  12733. source: "numericallyIndexable\x0a\x09^ self",
  12734. messageSends: [],
  12735. referencedClasses: []
  12736. }),
  12737. globals.Array);
  12738. smalltalk.addMethod(
  12739. smalltalk.method({
  12740. selector: "printOn:",
  12741. protocol: 'printing',
  12742. fn: function (aStream){
  12743. var self=this;
  12744. return smalltalk.withContext(function($ctx1) {
  12745. ($ctx1.supercall = true, globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  12746. $ctx1.supercall = false;
  12747. $ctx1.sendIdx["printOn:"]=1;
  12748. _st(aStream)._nextPutAll_(" (");
  12749. $ctx1.sendIdx["nextPutAll:"]=1;
  12750. self._do_separatedBy_((function(each){
  12751. return smalltalk.withContext(function($ctx2) {
  12752. return _st(each)._printOn_(aStream);
  12753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  12754. return smalltalk.withContext(function($ctx2) {
  12755. return _st(aStream)._nextPutAll_(" ");
  12756. $ctx2.sendIdx["nextPutAll:"]=2;
  12757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  12758. _st(aStream)._nextPutAll_(")");
  12759. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)})},
  12760. args: ["aStream"],
  12761. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  12762. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  12763. referencedClasses: []
  12764. }),
  12765. globals.Array);
  12766. smalltalk.addMethod(
  12767. smalltalk.method({
  12768. selector: "remove:ifAbsent:",
  12769. protocol: 'adding/removing',
  12770. fn: function (anObject,aBlock){
  12771. var self=this;
  12772. var index;
  12773. return smalltalk.withContext(function($ctx1) {
  12774. var $2,$1;
  12775. index=self._indexOf_ifAbsent_(anObject,(function(){
  12776. return (0);
  12777. }));
  12778. $2=_st(index).__eq((0));
  12779. if(smalltalk.assert($2)){
  12780. $1=_st(aBlock)._value();
  12781. } else {
  12782. self._removeIndex_(index);
  12783. $1=anObject;
  12784. };
  12785. return $1;
  12786. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)})},
  12787. args: ["anObject", "aBlock"],
  12788. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  12789. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"],
  12790. referencedClasses: []
  12791. }),
  12792. globals.Array);
  12793. smalltalk.addMethod(
  12794. smalltalk.method({
  12795. selector: "removeAll",
  12796. protocol: 'adding/removing',
  12797. fn: function (){
  12798. var self=this;
  12799. return smalltalk.withContext(function($ctx1) {
  12800. self.length = 0;
  12801. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)})},
  12802. args: [],
  12803. source: "removeAll\x0a\x09<self.length = 0>",
  12804. messageSends: [],
  12805. referencedClasses: []
  12806. }),
  12807. globals.Array);
  12808. smalltalk.addMethod(
  12809. smalltalk.method({
  12810. selector: "removeFrom:to:",
  12811. protocol: 'adding/removing',
  12812. fn: function (aNumber,anotherNumber){
  12813. var self=this;
  12814. return smalltalk.withContext(function($ctx1) {
  12815. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  12816. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)})},
  12817. args: ["aNumber", "anotherNumber"],
  12818. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  12819. messageSends: [],
  12820. referencedClasses: []
  12821. }),
  12822. globals.Array);
  12823. smalltalk.addMethod(
  12824. smalltalk.method({
  12825. selector: "removeIndex:",
  12826. protocol: 'adding/removing',
  12827. fn: function (anInteger){
  12828. var self=this;
  12829. return smalltalk.withContext(function($ctx1) {
  12830. self.splice(anInteger - 1, 1);
  12831. return self}, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)})},
  12832. args: ["anInteger"],
  12833. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  12834. messageSends: [],
  12835. referencedClasses: []
  12836. }),
  12837. globals.Array);
  12838. smalltalk.addMethod(
  12839. smalltalk.method({
  12840. selector: "removeLast",
  12841. protocol: 'adding/removing',
  12842. fn: function (){
  12843. var self=this;
  12844. return smalltalk.withContext(function($ctx1) {
  12845. return self.pop();;
  12846. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)})},
  12847. args: [],
  12848. source: "removeLast\x0a\x09<return self.pop();>",
  12849. messageSends: [],
  12850. referencedClasses: []
  12851. }),
  12852. globals.Array);
  12853. smalltalk.addMethod(
  12854. smalltalk.method({
  12855. selector: "reversed",
  12856. protocol: 'converting',
  12857. fn: function (){
  12858. var self=this;
  12859. return smalltalk.withContext(function($ctx1) {
  12860. return self._copy().reverse();
  12861. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)})},
  12862. args: [],
  12863. source: "reversed\x0a\x09<return self._copy().reverse()>",
  12864. messageSends: [],
  12865. referencedClasses: []
  12866. }),
  12867. globals.Array);
  12868. smalltalk.addMethod(
  12869. smalltalk.method({
  12870. selector: "select:",
  12871. protocol: 'enumerating',
  12872. fn: function (aBlock){
  12873. var self=this;
  12874. return smalltalk.withContext(function($ctx1) {
  12875. var result = self.klass._new();
  12876. for(var i=0; i<self.length; i++) {
  12877. if(aBlock._value_(self[i])) {
  12878. result.push(self[i]);
  12879. }
  12880. }
  12881. return result;
  12882. ;
  12883. return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)})},
  12884. args: ["aBlock"],
  12885. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  12886. messageSends: [],
  12887. referencedClasses: []
  12888. }),
  12889. globals.Array);
  12890. smalltalk.addMethod(
  12891. smalltalk.method({
  12892. selector: "size",
  12893. protocol: 'accessing',
  12894. fn: function (){
  12895. var self=this;
  12896. return smalltalk.withContext(function($ctx1) {
  12897. return self.length;
  12898. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)})},
  12899. args: [],
  12900. source: "size\x0a\x09<return self.length>",
  12901. messageSends: [],
  12902. referencedClasses: []
  12903. }),
  12904. globals.Array);
  12905. smalltalk.addMethod(
  12906. smalltalk.method({
  12907. selector: "sort",
  12908. protocol: 'enumerating',
  12909. fn: function (){
  12910. var self=this;
  12911. return smalltalk.withContext(function($ctx1) {
  12912. var $1;
  12913. $1=self._sort_((function(a,b){
  12914. return smalltalk.withContext(function($ctx2) {
  12915. return _st(a).__lt(b);
  12916. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  12917. return $1;
  12918. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)})},
  12919. args: [],
  12920. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  12921. messageSends: ["sort:", "<"],
  12922. referencedClasses: []
  12923. }),
  12924. globals.Array);
  12925. smalltalk.addMethod(
  12926. smalltalk.method({
  12927. selector: "sort:",
  12928. protocol: 'enumerating',
  12929. fn: function (aBlock){
  12930. var self=this;
  12931. return smalltalk.withContext(function($ctx1) {
  12932. return self.sort(function(a, b) {
  12933. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  12934. })
  12935. ;
  12936. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)})},
  12937. args: ["aBlock"],
  12938. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  12939. messageSends: [],
  12940. referencedClasses: []
  12941. }),
  12942. globals.Array);
  12943. smalltalk.addMethod(
  12944. smalltalk.method({
  12945. selector: "sorted",
  12946. protocol: 'enumerating',
  12947. fn: function (){
  12948. var self=this;
  12949. return smalltalk.withContext(function($ctx1) {
  12950. var $1;
  12951. $1=_st(self._copy())._sort();
  12952. return $1;
  12953. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)})},
  12954. args: [],
  12955. source: "sorted\x0a\x09^ self copy sort",
  12956. messageSends: ["sort", "copy"],
  12957. referencedClasses: []
  12958. }),
  12959. globals.Array);
  12960. smalltalk.addMethod(
  12961. smalltalk.method({
  12962. selector: "sorted:",
  12963. protocol: 'enumerating',
  12964. fn: function (aBlock){
  12965. var self=this;
  12966. return smalltalk.withContext(function($ctx1) {
  12967. var $1;
  12968. $1=_st(self._copy())._sort_(aBlock);
  12969. return $1;
  12970. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)})},
  12971. args: ["aBlock"],
  12972. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  12973. messageSends: ["sort:", "copy"],
  12974. referencedClasses: []
  12975. }),
  12976. globals.Array);
  12977. smalltalk.addMethod(
  12978. smalltalk.method({
  12979. selector: "new:",
  12980. protocol: 'instance creation',
  12981. fn: function (anInteger){
  12982. var self=this;
  12983. return smalltalk.withContext(function($ctx1) {
  12984. return new Array(anInteger);
  12985. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)})},
  12986. args: ["anInteger"],
  12987. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  12988. messageSends: [],
  12989. referencedClasses: []
  12990. }),
  12991. globals.Array.klass);
  12992. smalltalk.addMethod(
  12993. smalltalk.method({
  12994. selector: "with:",
  12995. protocol: 'instance creation',
  12996. fn: function (anObject){
  12997. var self=this;
  12998. return smalltalk.withContext(function($ctx1) {
  12999. var $2,$3,$1;
  13000. $2=self._new_((1));
  13001. _st($2)._at_put_((1),anObject);
  13002. $3=_st($2)._yourself();
  13003. $1=$3;
  13004. return $1;
  13005. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)})},
  13006. args: ["anObject"],
  13007. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  13008. messageSends: ["at:put:", "new:", "yourself"],
  13009. referencedClasses: []
  13010. }),
  13011. globals.Array.klass);
  13012. smalltalk.addMethod(
  13013. smalltalk.method({
  13014. selector: "with:with:",
  13015. protocol: 'instance creation',
  13016. fn: function (anObject,anObject2){
  13017. var self=this;
  13018. return smalltalk.withContext(function($ctx1) {
  13019. var $2,$3,$1;
  13020. $2=self._new_((2));
  13021. _st($2)._at_put_((1),anObject);
  13022. $ctx1.sendIdx["at:put:"]=1;
  13023. _st($2)._at_put_((2),anObject2);
  13024. $3=_st($2)._yourself();
  13025. $1=$3;
  13026. return $1;
  13027. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)})},
  13028. args: ["anObject", "anObject2"],
  13029. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  13030. messageSends: ["at:put:", "new:", "yourself"],
  13031. referencedClasses: []
  13032. }),
  13033. globals.Array.klass);
  13034. smalltalk.addMethod(
  13035. smalltalk.method({
  13036. selector: "with:with:with:",
  13037. protocol: 'instance creation',
  13038. fn: function (anObject,anObject2,anObject3){
  13039. var self=this;
  13040. return smalltalk.withContext(function($ctx1) {
  13041. var $2,$3,$1;
  13042. $2=self._new_((3));
  13043. _st($2)._at_put_((1),anObject);
  13044. $ctx1.sendIdx["at:put:"]=1;
  13045. _st($2)._at_put_((2),anObject2);
  13046. $ctx1.sendIdx["at:put:"]=2;
  13047. _st($2)._at_put_((3),anObject3);
  13048. $3=_st($2)._yourself();
  13049. $1=$3;
  13050. return $1;
  13051. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)})},
  13052. args: ["anObject", "anObject2", "anObject3"],
  13053. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  13054. messageSends: ["at:put:", "new:", "yourself"],
  13055. referencedClasses: []
  13056. }),
  13057. globals.Array.klass);
  13058. smalltalk.addMethod(
  13059. smalltalk.method({
  13060. selector: "withAll:",
  13061. protocol: 'instance creation',
  13062. fn: function (aCollection){
  13063. var self=this;
  13064. var instance,index;
  13065. return smalltalk.withContext(function($ctx1) {
  13066. var $1;
  13067. index=(1);
  13068. instance=self._new_(_st(aCollection)._size());
  13069. _st(aCollection)._do_((function(each){
  13070. return smalltalk.withContext(function($ctx2) {
  13071. _st(instance)._at_put_(index,each);
  13072. index=_st(index).__plus((1));
  13073. return index;
  13074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  13075. $1=instance;
  13076. return $1;
  13077. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)})},
  13078. args: ["aCollection"],
  13079. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  13080. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  13081. referencedClasses: []
  13082. }),
  13083. globals.Array.klass);
  13084. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  13085. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  13086. smalltalk.addMethod(
  13087. smalltalk.method({
  13088. selector: ",",
  13089. protocol: 'copying',
  13090. fn: function (aString){
  13091. var self=this;
  13092. return smalltalk.withContext(function($ctx1) {
  13093. var $2,$1;
  13094. $2=self._asString();
  13095. $ctx1.sendIdx["asString"]=1;
  13096. $1=_st($2).__comma(_st(aString)._asString());
  13097. return $1;
  13098. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)})},
  13099. args: ["aString"],
  13100. source: ", aString\x0a\x09^ self asString, aString asString",
  13101. messageSends: [",", "asString"],
  13102. referencedClasses: []
  13103. }),
  13104. globals.CharacterArray);
  13105. smalltalk.addMethod(
  13106. smalltalk.method({
  13107. selector: "add:",
  13108. protocol: 'adding/removing',
  13109. fn: function (anObject){
  13110. var self=this;
  13111. return smalltalk.withContext(function($ctx1) {
  13112. self._errorReadOnly();
  13113. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)})},
  13114. args: ["anObject"],
  13115. source: "add: anObject\x0a\x09self errorReadOnly",
  13116. messageSends: ["errorReadOnly"],
  13117. referencedClasses: []
  13118. }),
  13119. globals.CharacterArray);
  13120. smalltalk.addMethod(
  13121. smalltalk.method({
  13122. selector: "asLowercase",
  13123. protocol: 'converting',
  13124. fn: function (){
  13125. var self=this;
  13126. return smalltalk.withContext(function($ctx1) {
  13127. var $1;
  13128. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  13129. return $1;
  13130. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)})},
  13131. args: [],
  13132. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  13133. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  13134. referencedClasses: []
  13135. }),
  13136. globals.CharacterArray);
  13137. smalltalk.addMethod(
  13138. smalltalk.method({
  13139. selector: "asNumber",
  13140. protocol: 'converting',
  13141. fn: function (){
  13142. var self=this;
  13143. return smalltalk.withContext(function($ctx1) {
  13144. var $1;
  13145. $1=_st(self._asString())._asNumber();
  13146. return $1;
  13147. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)})},
  13148. args: [],
  13149. source: "asNumber\x0a\x09^ self asString asNumber",
  13150. messageSends: ["asNumber", "asString"],
  13151. referencedClasses: []
  13152. }),
  13153. globals.CharacterArray);
  13154. smalltalk.addMethod(
  13155. smalltalk.method({
  13156. selector: "asString",
  13157. protocol: 'converting',
  13158. fn: function (){
  13159. var self=this;
  13160. return smalltalk.withContext(function($ctx1) {
  13161. var $1;
  13162. $1=self._subclassResponsibility();
  13163. return $1;
  13164. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)})},
  13165. args: [],
  13166. source: "asString\x0a\x09^ self subclassResponsibility",
  13167. messageSends: ["subclassResponsibility"],
  13168. referencedClasses: []
  13169. }),
  13170. globals.CharacterArray);
  13171. smalltalk.addMethod(
  13172. smalltalk.method({
  13173. selector: "asSymbol",
  13174. protocol: 'converting',
  13175. fn: function (){
  13176. var self=this;
  13177. return smalltalk.withContext(function($ctx1) {
  13178. var $1;
  13179. $1=self._asString();
  13180. return $1;
  13181. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)})},
  13182. args: [],
  13183. source: "asSymbol\x0a\x09^ self asString",
  13184. messageSends: ["asString"],
  13185. referencedClasses: []
  13186. }),
  13187. globals.CharacterArray);
  13188. smalltalk.addMethod(
  13189. smalltalk.method({
  13190. selector: "asUppercase",
  13191. protocol: 'converting',
  13192. fn: function (){
  13193. var self=this;
  13194. return smalltalk.withContext(function($ctx1) {
  13195. var $1;
  13196. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  13197. return $1;
  13198. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)})},
  13199. args: [],
  13200. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  13201. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  13202. referencedClasses: []
  13203. }),
  13204. globals.CharacterArray);
  13205. smalltalk.addMethod(
  13206. smalltalk.method({
  13207. selector: "at:put:",
  13208. protocol: 'accessing',
  13209. fn: function (anIndex,anObject){
  13210. var self=this;
  13211. return smalltalk.withContext(function($ctx1) {
  13212. self._errorReadOnly();
  13213. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)})},
  13214. args: ["anIndex", "anObject"],
  13215. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  13216. messageSends: ["errorReadOnly"],
  13217. referencedClasses: []
  13218. }),
  13219. globals.CharacterArray);
  13220. smalltalk.addMethod(
  13221. smalltalk.method({
  13222. selector: "errorReadOnly",
  13223. protocol: 'error handling',
  13224. fn: function (){
  13225. var self=this;
  13226. return smalltalk.withContext(function($ctx1) {
  13227. self._error_("Object is read-only");
  13228. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)})},
  13229. args: [],
  13230. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  13231. messageSends: ["error:"],
  13232. referencedClasses: []
  13233. }),
  13234. globals.CharacterArray);
  13235. smalltalk.addMethod(
  13236. smalltalk.method({
  13237. selector: "printOn:",
  13238. protocol: 'printing',
  13239. fn: function (aStream){
  13240. var self=this;
  13241. return smalltalk.withContext(function($ctx1) {
  13242. _st(self._asString())._printOn_(aStream);
  13243. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)})},
  13244. args: ["aStream"],
  13245. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  13246. messageSends: ["printOn:", "asString"],
  13247. referencedClasses: []
  13248. }),
  13249. globals.CharacterArray);
  13250. smalltalk.addMethod(
  13251. smalltalk.method({
  13252. selector: "putOn:",
  13253. protocol: 'streaming',
  13254. fn: function (aStream){
  13255. var self=this;
  13256. return smalltalk.withContext(function($ctx1) {
  13257. _st(aStream)._nextPutString_(self);
  13258. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)})},
  13259. args: ["aStream"],
  13260. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  13261. messageSends: ["nextPutString:"],
  13262. referencedClasses: []
  13263. }),
  13264. globals.CharacterArray);
  13265. smalltalk.addMethod(
  13266. smalltalk.method({
  13267. selector: "remove:",
  13268. protocol: 'adding/removing',
  13269. fn: function (anObject){
  13270. var self=this;
  13271. return smalltalk.withContext(function($ctx1) {
  13272. self._errorReadOnly();
  13273. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)})},
  13274. args: ["anObject"],
  13275. source: "remove: anObject\x0a\x09self errorReadOnly",
  13276. messageSends: ["errorReadOnly"],
  13277. referencedClasses: []
  13278. }),
  13279. globals.CharacterArray);
  13280. smalltalk.addMethod(
  13281. smalltalk.method({
  13282. selector: "fromString:",
  13283. protocol: 'instance creation',
  13284. fn: function (aString){
  13285. var self=this;
  13286. return smalltalk.withContext(function($ctx1) {
  13287. self._subclassResponsibility();
  13288. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)})},
  13289. args: ["aString"],
  13290. source: "fromString: aString\x0a\x09self subclassResponsibility",
  13291. messageSends: ["subclassResponsibility"],
  13292. referencedClasses: []
  13293. }),
  13294. globals.CharacterArray.klass);
  13295. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  13296. globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  13297. smalltalk.addMethod(
  13298. smalltalk.method({
  13299. selector: ",",
  13300. protocol: 'copying',
  13301. fn: function (aString){
  13302. var self=this;
  13303. return smalltalk.withContext(function($ctx1) {
  13304. return String(self) + aString;
  13305. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)})},
  13306. args: ["aString"],
  13307. source: ", aString\x0a\x09<return String(self) + aString>",
  13308. messageSends: [],
  13309. referencedClasses: []
  13310. }),
  13311. globals.String);
  13312. smalltalk.addMethod(
  13313. smalltalk.method({
  13314. selector: "<",
  13315. protocol: 'comparing',
  13316. fn: function (aString){
  13317. var self=this;
  13318. return smalltalk.withContext(function($ctx1) {
  13319. return String(self) < aString._asString();
  13320. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)})},
  13321. args: ["aString"],
  13322. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  13323. messageSends: [],
  13324. referencedClasses: []
  13325. }),
  13326. globals.String);
  13327. smalltalk.addMethod(
  13328. smalltalk.method({
  13329. selector: "<=",
  13330. protocol: 'comparing',
  13331. fn: function (aString){
  13332. var self=this;
  13333. return smalltalk.withContext(function($ctx1) {
  13334. return String(self) <= aString._asString();
  13335. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)})},
  13336. args: ["aString"],
  13337. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  13338. messageSends: [],
  13339. referencedClasses: []
  13340. }),
  13341. globals.String);
  13342. smalltalk.addMethod(
  13343. smalltalk.method({
  13344. selector: "=",
  13345. protocol: 'comparing',
  13346. fn: function (aString){
  13347. var self=this;
  13348. return smalltalk.withContext(function($ctx1) {
  13349. return aString != null &&
  13350. typeof aString._isString === "function" &&
  13351. aString._isString() &&
  13352. String(self) === String(aString)
  13353. ;
  13354. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)})},
  13355. args: ["aString"],
  13356. source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
  13357. messageSends: [],
  13358. referencedClasses: []
  13359. }),
  13360. globals.String);
  13361. smalltalk.addMethod(
  13362. smalltalk.method({
  13363. selector: "==",
  13364. protocol: 'comparing',
  13365. fn: function (aString){
  13366. var self=this;
  13367. return smalltalk.withContext(function($ctx1) {
  13368. var $1;
  13369. $1=self.__eq(aString);
  13370. return $1;
  13371. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)})},
  13372. args: ["aString"],
  13373. source: "== aString\x0a\x09^ self = aString",
  13374. messageSends: ["="],
  13375. referencedClasses: []
  13376. }),
  13377. globals.String);
  13378. smalltalk.addMethod(
  13379. smalltalk.method({
  13380. selector: ">",
  13381. protocol: 'comparing',
  13382. fn: function (aString){
  13383. var self=this;
  13384. return smalltalk.withContext(function($ctx1) {
  13385. return String(self) > aString._asString();
  13386. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)})},
  13387. args: ["aString"],
  13388. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  13389. messageSends: [],
  13390. referencedClasses: []
  13391. }),
  13392. globals.String);
  13393. smalltalk.addMethod(
  13394. smalltalk.method({
  13395. selector: ">=",
  13396. protocol: 'comparing',
  13397. fn: function (aString){
  13398. var self=this;
  13399. return smalltalk.withContext(function($ctx1) {
  13400. return String(self) >= aString._asString();
  13401. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)})},
  13402. args: ["aString"],
  13403. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  13404. messageSends: [],
  13405. referencedClasses: []
  13406. }),
  13407. globals.String);
  13408. smalltalk.addMethod(
  13409. smalltalk.method({
  13410. selector: "asJSON",
  13411. protocol: 'converting',
  13412. fn: function (){
  13413. var self=this;
  13414. return self;
  13415. },
  13416. args: [],
  13417. source: "asJSON\x0a\x09^ self",
  13418. messageSends: [],
  13419. referencedClasses: []
  13420. }),
  13421. globals.String);
  13422. smalltalk.addMethod(
  13423. smalltalk.method({
  13424. selector: "asJavascript",
  13425. protocol: 'converting',
  13426. fn: function (){
  13427. var self=this;
  13428. return smalltalk.withContext(function($ctx1) {
  13429. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  13430. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  13431. else
  13432. return "\"" + self + "\"";
  13433. ;
  13434. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)})},
  13435. args: [],
  13436. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  13437. messageSends: [],
  13438. referencedClasses: []
  13439. }),
  13440. globals.String);
  13441. smalltalk.addMethod(
  13442. smalltalk.method({
  13443. selector: "asLowercase",
  13444. protocol: 'converting',
  13445. fn: function (){
  13446. var self=this;
  13447. return smalltalk.withContext(function($ctx1) {
  13448. return self.toLowerCase();
  13449. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)})},
  13450. args: [],
  13451. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  13452. messageSends: [],
  13453. referencedClasses: []
  13454. }),
  13455. globals.String);
  13456. smalltalk.addMethod(
  13457. smalltalk.method({
  13458. selector: "asMutator",
  13459. protocol: 'converting',
  13460. fn: function (){
  13461. var self=this;
  13462. return smalltalk.withContext(function($ctx1) {
  13463. var $1,$2;
  13464. $1=_st(self._last()).__eq(":");
  13465. if(! smalltalk.assert($1)){
  13466. $2=self.__comma(":");
  13467. return $2;
  13468. };
  13469. return self;
  13470. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)})},
  13471. args: [],
  13472. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  13473. messageSends: ["ifFalse:", "=", "last", ","],
  13474. referencedClasses: []
  13475. }),
  13476. globals.String);
  13477. smalltalk.addMethod(
  13478. smalltalk.method({
  13479. selector: "asNumber",
  13480. protocol: 'converting',
  13481. fn: function (){
  13482. var self=this;
  13483. return smalltalk.withContext(function($ctx1) {
  13484. return Number(self);
  13485. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)})},
  13486. args: [],
  13487. source: "asNumber\x0a\x09<return Number(self)>",
  13488. messageSends: [],
  13489. referencedClasses: []
  13490. }),
  13491. globals.String);
  13492. smalltalk.addMethod(
  13493. smalltalk.method({
  13494. selector: "asRegexp",
  13495. protocol: 'converting',
  13496. fn: function (){
  13497. var self=this;
  13498. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  13499. return smalltalk.withContext(function($ctx1) {
  13500. var $1;
  13501. $1=_st($RegularExpression())._fromString_(self);
  13502. return $1;
  13503. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)})},
  13504. args: [],
  13505. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  13506. messageSends: ["fromString:"],
  13507. referencedClasses: ["RegularExpression"]
  13508. }),
  13509. globals.String);
  13510. smalltalk.addMethod(
  13511. smalltalk.method({
  13512. selector: "asSelector",
  13513. protocol: 'converting',
  13514. fn: function (){
  13515. var self=this;
  13516. return smalltalk.withContext(function($ctx1) {
  13517. return smalltalk.selector(self);
  13518. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)})},
  13519. args: [],
  13520. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  13521. messageSends: [],
  13522. referencedClasses: []
  13523. }),
  13524. globals.String);
  13525. smalltalk.addMethod(
  13526. smalltalk.method({
  13527. selector: "asString",
  13528. protocol: 'converting',
  13529. fn: function (){
  13530. var self=this;
  13531. return self;
  13532. },
  13533. args: [],
  13534. source: "asString\x0a\x09^ self",
  13535. messageSends: [],
  13536. referencedClasses: []
  13537. }),
  13538. globals.String);
  13539. smalltalk.addMethod(
  13540. smalltalk.method({
  13541. selector: "asSymbol",
  13542. protocol: 'converting',
  13543. fn: function (){
  13544. var self=this;
  13545. return self;
  13546. },
  13547. args: [],
  13548. source: "asSymbol\x0a\x09^ self",
  13549. messageSends: [],
  13550. referencedClasses: []
  13551. }),
  13552. globals.String);
  13553. smalltalk.addMethod(
  13554. smalltalk.method({
  13555. selector: "asUppercase",
  13556. protocol: 'converting',
  13557. fn: function (){
  13558. var self=this;
  13559. return smalltalk.withContext(function($ctx1) {
  13560. return self.toUpperCase();
  13561. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)})},
  13562. args: [],
  13563. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  13564. messageSends: [],
  13565. referencedClasses: []
  13566. }),
  13567. globals.String);
  13568. smalltalk.addMethod(
  13569. smalltalk.method({
  13570. selector: "asciiValue",
  13571. protocol: 'accessing',
  13572. fn: function (){
  13573. var self=this;
  13574. return smalltalk.withContext(function($ctx1) {
  13575. return self.charCodeAt(0);;
  13576. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)})},
  13577. args: [],
  13578. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  13579. messageSends: [],
  13580. referencedClasses: []
  13581. }),
  13582. globals.String);
  13583. smalltalk.addMethod(
  13584. smalltalk.method({
  13585. selector: "at:ifAbsent:",
  13586. protocol: 'accessing',
  13587. fn: function (anIndex,aBlock){
  13588. var self=this;
  13589. return smalltalk.withContext(function($ctx1) {
  13590. return String(self)[anIndex - 1] || aBlock._value();
  13591. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)})},
  13592. args: ["anIndex", "aBlock"],
  13593. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  13594. messageSends: [],
  13595. referencedClasses: []
  13596. }),
  13597. globals.String);
  13598. smalltalk.addMethod(
  13599. smalltalk.method({
  13600. selector: "at:ifPresent:ifAbsent:",
  13601. protocol: 'accessing',
  13602. fn: function (anIndex,aBlock,anotherBlock){
  13603. var self=this;
  13604. return smalltalk.withContext(function($ctx1) {
  13605. var result = String(self)[anIndex - 1];
  13606. return result ? aBlock._value_(result) : anotherBlock._value();
  13607. ;
  13608. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)})},
  13609. args: ["anIndex", "aBlock", "anotherBlock"],
  13610. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  13611. messageSends: [],
  13612. referencedClasses: []
  13613. }),
  13614. globals.String);
  13615. smalltalk.addMethod(
  13616. smalltalk.method({
  13617. selector: "capitalized",
  13618. protocol: 'converting',
  13619. fn: function (){
  13620. var self=this;
  13621. return smalltalk.withContext(function($ctx1) {
  13622. var $2,$1;
  13623. $2=self._isEmpty();
  13624. if(smalltalk.assert($2)){
  13625. $1=self;
  13626. } else {
  13627. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  13628. };
  13629. return $1;
  13630. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)})},
  13631. args: [],
  13632. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  13633. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"],
  13634. referencedClasses: []
  13635. }),
  13636. globals.String);
  13637. smalltalk.addMethod(
  13638. smalltalk.method({
  13639. selector: "charCodeAt:",
  13640. protocol: 'accessing',
  13641. fn: function (anInteger){
  13642. var self=this;
  13643. return smalltalk.withContext(function($ctx1) {
  13644. return self.charCodeAt(anInteger - 1);
  13645. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)})},
  13646. args: ["anInteger"],
  13647. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  13648. messageSends: [],
  13649. referencedClasses: []
  13650. }),
  13651. globals.String);
  13652. smalltalk.addMethod(
  13653. smalltalk.method({
  13654. selector: "copyFrom:to:",
  13655. protocol: 'copying',
  13656. fn: function (anIndex,anotherIndex){
  13657. var self=this;
  13658. return smalltalk.withContext(function($ctx1) {
  13659. return self.substring(anIndex - 1, anotherIndex);
  13660. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)})},
  13661. args: ["anIndex", "anotherIndex"],
  13662. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  13663. messageSends: [],
  13664. referencedClasses: []
  13665. }),
  13666. globals.String);
  13667. smalltalk.addMethod(
  13668. smalltalk.method({
  13669. selector: "crlfSanitized",
  13670. protocol: 'converting',
  13671. fn: function (){
  13672. var self=this;
  13673. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13674. return smalltalk.withContext(function($ctx1) {
  13675. var $1;
  13676. $1=_st(self._lines())._join_(_st($String())._lf());
  13677. return $1;
  13678. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)})},
  13679. args: [],
  13680. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  13681. messageSends: ["join:", "lines", "lf"],
  13682. referencedClasses: ["String"]
  13683. }),
  13684. globals.String);
  13685. smalltalk.addMethod(
  13686. smalltalk.method({
  13687. selector: "deepCopy",
  13688. protocol: 'copying',
  13689. fn: function (){
  13690. var self=this;
  13691. return smalltalk.withContext(function($ctx1) {
  13692. var $1;
  13693. $1=self._shallowCopy();
  13694. return $1;
  13695. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)})},
  13696. args: [],
  13697. source: "deepCopy\x0a\x09^ self shallowCopy",
  13698. messageSends: ["shallowCopy"],
  13699. referencedClasses: []
  13700. }),
  13701. globals.String);
  13702. smalltalk.addMethod(
  13703. smalltalk.method({
  13704. selector: "escaped",
  13705. protocol: 'converting',
  13706. fn: function (){
  13707. var self=this;
  13708. return smalltalk.withContext(function($ctx1) {
  13709. return escape(self);
  13710. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)})},
  13711. args: [],
  13712. source: "escaped\x0a\x09<return escape(self)>",
  13713. messageSends: [],
  13714. referencedClasses: []
  13715. }),
  13716. globals.String);
  13717. smalltalk.addMethod(
  13718. smalltalk.method({
  13719. selector: "identityHash",
  13720. protocol: 'accessing',
  13721. fn: function (){
  13722. var self=this;
  13723. return smalltalk.withContext(function($ctx1) {
  13724. var $1;
  13725. $1=self.__comma("s");
  13726. return $1;
  13727. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)})},
  13728. args: [],
  13729. source: "identityHash\x0a\x09^ self, 's'",
  13730. messageSends: [","],
  13731. referencedClasses: []
  13732. }),
  13733. globals.String);
  13734. smalltalk.addMethod(
  13735. smalltalk.method({
  13736. selector: "includesSubString:",
  13737. protocol: 'testing',
  13738. fn: function (subString){
  13739. var self=this;
  13740. return smalltalk.withContext(function($ctx1) {
  13741. return self.indexOf(subString) != -1;
  13742. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)})},
  13743. args: ["subString"],
  13744. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  13745. messageSends: [],
  13746. referencedClasses: []
  13747. }),
  13748. globals.String);
  13749. smalltalk.addMethod(
  13750. smalltalk.method({
  13751. selector: "isCapitalized",
  13752. protocol: 'testing',
  13753. fn: function (){
  13754. var self=this;
  13755. return smalltalk.withContext(function($ctx1) {
  13756. var $3,$2,$1;
  13757. $3=self._first();
  13758. $ctx1.sendIdx["first"]=1;
  13759. $2=_st($3)._asUppercase();
  13760. $1=_st($2).__eq_eq(self._first());
  13761. return $1;
  13762. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)})},
  13763. args: [],
  13764. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  13765. messageSends: ["==", "asUppercase", "first"],
  13766. referencedClasses: []
  13767. }),
  13768. globals.String);
  13769. smalltalk.addMethod(
  13770. smalltalk.method({
  13771. selector: "isImmutable",
  13772. protocol: 'testing',
  13773. fn: function (){
  13774. var self=this;
  13775. return true;
  13776. },
  13777. args: [],
  13778. source: "isImmutable\x0a\x09^ true",
  13779. messageSends: [],
  13780. referencedClasses: []
  13781. }),
  13782. globals.String);
  13783. smalltalk.addMethod(
  13784. smalltalk.method({
  13785. selector: "isString",
  13786. protocol: 'testing',
  13787. fn: function (){
  13788. var self=this;
  13789. return true;
  13790. },
  13791. args: [],
  13792. source: "isString\x0a\x09^ true",
  13793. messageSends: [],
  13794. referencedClasses: []
  13795. }),
  13796. globals.String);
  13797. smalltalk.addMethod(
  13798. smalltalk.method({
  13799. selector: "isVowel",
  13800. protocol: 'testing',
  13801. fn: function (){
  13802. var self=this;
  13803. return smalltalk.withContext(function($ctx1) {
  13804. var $1;
  13805. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  13806. return smalltalk.withContext(function($ctx2) {
  13807. return "aeiou"._includes_(self._asLowercase());
  13808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  13809. return $1;
  13810. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)})},
  13811. args: [],
  13812. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  13813. messageSends: ["and:", "=", "size", "includes:", "asLowercase"],
  13814. referencedClasses: []
  13815. }),
  13816. globals.String);
  13817. smalltalk.addMethod(
  13818. smalltalk.method({
  13819. selector: "join:",
  13820. protocol: 'split join',
  13821. fn: function (aCollection){
  13822. var self=this;
  13823. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13824. return smalltalk.withContext(function($ctx1) {
  13825. var $1;
  13826. $1=_st($String())._streamContents_((function(stream){
  13827. return smalltalk.withContext(function($ctx2) {
  13828. return _st(aCollection)._do_separatedBy_((function(each){
  13829. return smalltalk.withContext(function($ctx3) {
  13830. return _st(stream)._nextPutAll_(_st(each)._asString());
  13831. $ctx3.sendIdx["nextPutAll:"]=1;
  13832. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  13833. return smalltalk.withContext(function($ctx3) {
  13834. return _st(stream)._nextPutAll_(self);
  13835. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  13836. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  13837. return $1;
  13838. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)})},
  13839. args: ["aCollection"],
  13840. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  13841. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  13842. referencedClasses: ["String"]
  13843. }),
  13844. globals.String);
  13845. smalltalk.addMethod(
  13846. smalltalk.method({
  13847. selector: "lineIndicesDo:",
  13848. protocol: 'split join',
  13849. fn: function (aBlock){
  13850. var self=this;
  13851. var cr,lf,start,sz,nextLF,nextCR;
  13852. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  13853. return smalltalk.withContext(function($ctx1) {
  13854. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  13855. var $early={};
  13856. try {
  13857. start=(1);
  13858. sz=self._size();
  13859. cr=_st($String())._cr();
  13860. nextCR=self._indexOf_startingAt_(cr,(1));
  13861. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  13862. lf=_st($String())._lf();
  13863. nextLF=self._indexOf_startingAt_(lf,(1));
  13864. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  13865. _st((function(){
  13866. return smalltalk.withContext(function($ctx2) {
  13867. return _st(start).__lt_eq(sz);
  13868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  13869. return smalltalk.withContext(function($ctx2) {
  13870. $2=_st(nextLF).__eq((0));
  13871. $ctx2.sendIdx["="]=1;
  13872. $1=_st($2)._and_((function(){
  13873. return smalltalk.withContext(function($ctx3) {
  13874. return _st(nextCR).__eq((0));
  13875. $ctx3.sendIdx["="]=2;
  13876. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  13877. $ctx2.sendIdx["and:"]=1;
  13878. if(smalltalk.assert($1)){
  13879. _st(aBlock)._value_value_value_(start,sz,sz);
  13880. $ctx2.sendIdx["value:value:value:"]=1;
  13881. throw $early=[self];
  13882. };
  13883. $4=_st(nextCR).__eq((0));
  13884. $ctx2.sendIdx["="]=3;
  13885. $3=_st($4)._or_((function(){
  13886. return smalltalk.withContext(function($ctx3) {
  13887. $5=(0).__lt(nextLF);
  13888. $ctx3.sendIdx["<"]=1;
  13889. return _st($5)._and_((function(){
  13890. return smalltalk.withContext(function($ctx4) {
  13891. return _st(nextLF).__lt(nextCR);
  13892. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  13893. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  13894. if(smalltalk.assert($3)){
  13895. $6=start;
  13896. $7=_st(nextLF).__minus((1));
  13897. $ctx2.sendIdx["-"]=1;
  13898. _st(aBlock)._value_value_value_($6,$7,nextLF);
  13899. $ctx2.sendIdx["value:value:value:"]=2;
  13900. start=(1).__plus(nextLF);
  13901. $ctx2.sendIdx["+"]=1;
  13902. start;
  13903. nextLF=self._indexOf_startingAt_(lf,start);
  13904. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  13905. return nextLF;
  13906. } else {
  13907. $9=(1).__plus(nextCR);
  13908. $ctx2.sendIdx["+"]=2;
  13909. $8=_st($9).__eq(nextLF);
  13910. if(smalltalk.assert($8)){
  13911. $10=start;
  13912. $11=_st(nextCR).__minus((1));
  13913. $ctx2.sendIdx["-"]=2;
  13914. _st(aBlock)._value_value_value_($10,$11,nextLF);
  13915. $ctx2.sendIdx["value:value:value:"]=3;
  13916. start=(1).__plus(nextLF);
  13917. $ctx2.sendIdx["+"]=3;
  13918. start;
  13919. nextCR=self._indexOf_startingAt_(cr,start);
  13920. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  13921. nextCR;
  13922. nextLF=self._indexOf_startingAt_(lf,start);
  13923. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  13924. return nextLF;
  13925. } else {
  13926. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  13927. start=(1).__plus(nextCR);
  13928. start;
  13929. nextCR=self._indexOf_startingAt_(cr,start);
  13930. return nextCR;
  13931. };
  13932. };
  13933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  13934. return self}
  13935. catch(e) {if(e===$early)return e[0]; throw e}
  13936. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)})},
  13937. args: ["aBlock"],
  13938. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  13939. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  13940. referencedClasses: ["String"]
  13941. }),
  13942. globals.String);
  13943. smalltalk.addMethod(
  13944. smalltalk.method({
  13945. selector: "lineNumber:",
  13946. protocol: 'split join',
  13947. fn: function (anIndex){
  13948. var self=this;
  13949. var lineCount;
  13950. return smalltalk.withContext(function($ctx1) {
  13951. var $2,$1,$3;
  13952. var $early={};
  13953. try {
  13954. lineCount=(0);
  13955. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  13956. return smalltalk.withContext(function($ctx2) {
  13957. lineCount=_st(lineCount).__plus((1));
  13958. $2=lineCount;
  13959. $1=_st($2).__eq(anIndex);
  13960. if(smalltalk.assert($1)){
  13961. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  13962. throw $early=[$3];
  13963. };
  13964. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  13965. return nil;
  13966. }
  13967. catch(e) {if(e===$early)return e[0]; throw e}
  13968. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)})},
  13969. args: ["anIndex"],
  13970. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  13971. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  13972. referencedClasses: []
  13973. }),
  13974. globals.String);
  13975. smalltalk.addMethod(
  13976. smalltalk.method({
  13977. selector: "lines",
  13978. protocol: 'split join',
  13979. fn: function (){
  13980. var self=this;
  13981. var lines;
  13982. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  13983. return smalltalk.withContext(function($ctx1) {
  13984. var $1;
  13985. lines=_st($Array())._new();
  13986. self._linesDo_((function(aLine){
  13987. return smalltalk.withContext(function($ctx2) {
  13988. return _st(lines)._add_(aLine);
  13989. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)})}));
  13990. $1=lines;
  13991. return $1;
  13992. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)})},
  13993. args: [],
  13994. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  13995. messageSends: ["new", "linesDo:", "add:"],
  13996. referencedClasses: ["Array"]
  13997. }),
  13998. globals.String);
  13999. smalltalk.addMethod(
  14000. smalltalk.method({
  14001. selector: "linesDo:",
  14002. protocol: 'split join',
  14003. fn: function (aBlock){
  14004. var self=this;
  14005. return smalltalk.withContext(function($ctx1) {
  14006. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  14007. return smalltalk.withContext(function($ctx2) {
  14008. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  14009. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  14010. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)})},
  14011. args: ["aBlock"],
  14012. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  14013. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  14014. referencedClasses: []
  14015. }),
  14016. globals.String);
  14017. smalltalk.addMethod(
  14018. smalltalk.method({
  14019. selector: "match:",
  14020. protocol: 'regular expressions',
  14021. fn: function (aRegexp){
  14022. var self=this;
  14023. return smalltalk.withContext(function($ctx1) {
  14024. return self.search(aRegexp) != -1;
  14025. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)})},
  14026. args: ["aRegexp"],
  14027. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  14028. messageSends: [],
  14029. referencedClasses: []
  14030. }),
  14031. globals.String);
  14032. smalltalk.addMethod(
  14033. smalltalk.method({
  14034. selector: "matchesOf:",
  14035. protocol: 'regular expressions',
  14036. fn: function (aRegularExpression){
  14037. var self=this;
  14038. return smalltalk.withContext(function($ctx1) {
  14039. return self.match(aRegularExpression);
  14040. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)})},
  14041. args: ["aRegularExpression"],
  14042. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  14043. messageSends: [],
  14044. referencedClasses: []
  14045. }),
  14046. globals.String);
  14047. smalltalk.addMethod(
  14048. smalltalk.method({
  14049. selector: "numericallyIndexable",
  14050. protocol: 'private',
  14051. fn: function (){
  14052. var self=this;
  14053. return smalltalk.withContext(function($ctx1) {
  14054. return String(self);
  14055. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)})},
  14056. args: [],
  14057. source: "numericallyIndexable\x0a\x09<return String(self)>",
  14058. messageSends: [],
  14059. referencedClasses: []
  14060. }),
  14061. globals.String);
  14062. smalltalk.addMethod(
  14063. smalltalk.method({
  14064. selector: "printNl",
  14065. protocol: 'printing',
  14066. fn: function (){
  14067. var self=this;
  14068. return smalltalk.withContext(function($ctx1) {
  14069. console.log(self);
  14070. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)})},
  14071. args: [],
  14072. source: "printNl\x0a\x09<console.log(self)>",
  14073. messageSends: [],
  14074. referencedClasses: []
  14075. }),
  14076. globals.String);
  14077. smalltalk.addMethod(
  14078. smalltalk.method({
  14079. selector: "printOn:",
  14080. protocol: 'printing',
  14081. fn: function (aStream){
  14082. var self=this;
  14083. return smalltalk.withContext(function($ctx1) {
  14084. var $1;
  14085. _st(aStream)._nextPutAll_("'");
  14086. $ctx1.sendIdx["nextPutAll:"]=1;
  14087. _st(aStream)._nextPutAll_(self);
  14088. $ctx1.sendIdx["nextPutAll:"]=2;
  14089. $1=_st(aStream)._nextPutAll_("'");
  14090. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)})},
  14091. args: ["aStream"],
  14092. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  14093. messageSends: ["nextPutAll:"],
  14094. referencedClasses: []
  14095. }),
  14096. globals.String);
  14097. smalltalk.addMethod(
  14098. smalltalk.method({
  14099. selector: "replace:with:",
  14100. protocol: 'regular expressions',
  14101. fn: function (aString,anotherString){
  14102. var self=this;
  14103. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14104. return smalltalk.withContext(function($ctx1) {
  14105. var $1;
  14106. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  14107. return $1;
  14108. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)})},
  14109. args: ["aString", "anotherString"],
  14110. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  14111. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  14112. referencedClasses: ["RegularExpression"]
  14113. }),
  14114. globals.String);
  14115. smalltalk.addMethod(
  14116. smalltalk.method({
  14117. selector: "replaceRegexp:with:",
  14118. protocol: 'regular expressions',
  14119. fn: function (aRegexp,aString){
  14120. var self=this;
  14121. return smalltalk.withContext(function($ctx1) {
  14122. return self.replace(aRegexp, aString);
  14123. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)})},
  14124. args: ["aRegexp", "aString"],
  14125. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  14126. messageSends: [],
  14127. referencedClasses: []
  14128. }),
  14129. globals.String);
  14130. smalltalk.addMethod(
  14131. smalltalk.method({
  14132. selector: "reversed",
  14133. protocol: 'converting',
  14134. fn: function (){
  14135. var self=this;
  14136. return smalltalk.withContext(function($ctx1) {
  14137. return self.split("").reverse().join("");
  14138. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)})},
  14139. args: [],
  14140. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  14141. messageSends: [],
  14142. referencedClasses: []
  14143. }),
  14144. globals.String);
  14145. smalltalk.addMethod(
  14146. smalltalk.method({
  14147. selector: "shallowCopy",
  14148. protocol: 'copying',
  14149. fn: function (){
  14150. var self=this;
  14151. return smalltalk.withContext(function($ctx1) {
  14152. var $1;
  14153. $1=_st(self._class())._fromString_(self);
  14154. return $1;
  14155. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)})},
  14156. args: [],
  14157. source: "shallowCopy\x0a\x09^ self class fromString: self",
  14158. messageSends: ["fromString:", "class"],
  14159. referencedClasses: []
  14160. }),
  14161. globals.String);
  14162. smalltalk.addMethod(
  14163. smalltalk.method({
  14164. selector: "size",
  14165. protocol: 'accessing',
  14166. fn: function (){
  14167. var self=this;
  14168. return smalltalk.withContext(function($ctx1) {
  14169. return self.length;
  14170. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)})},
  14171. args: [],
  14172. source: "size\x0a\x09<return self.length>",
  14173. messageSends: [],
  14174. referencedClasses: []
  14175. }),
  14176. globals.String);
  14177. smalltalk.addMethod(
  14178. smalltalk.method({
  14179. selector: "subStrings:",
  14180. protocol: 'split join',
  14181. fn: function (aString){
  14182. var self=this;
  14183. return smalltalk.withContext(function($ctx1) {
  14184. var $1;
  14185. $1=self._tokenize_(aString);
  14186. return $1;
  14187. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)})},
  14188. args: ["aString"],
  14189. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  14190. messageSends: ["tokenize:"],
  14191. referencedClasses: []
  14192. }),
  14193. globals.String);
  14194. smalltalk.addMethod(
  14195. smalltalk.method({
  14196. selector: "tokenize:",
  14197. protocol: 'split join',
  14198. fn: function (aString){
  14199. var self=this;
  14200. return smalltalk.withContext(function($ctx1) {
  14201. return self.split(aString);
  14202. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)})},
  14203. args: ["aString"],
  14204. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  14205. messageSends: [],
  14206. referencedClasses: []
  14207. }),
  14208. globals.String);
  14209. smalltalk.addMethod(
  14210. smalltalk.method({
  14211. selector: "trimBoth",
  14212. protocol: 'regular expressions',
  14213. fn: function (){
  14214. var self=this;
  14215. return smalltalk.withContext(function($ctx1) {
  14216. var $1;
  14217. $1=self._trimBoth_("\x5cs");
  14218. return $1;
  14219. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)})},
  14220. args: [],
  14221. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  14222. messageSends: ["trimBoth:"],
  14223. referencedClasses: []
  14224. }),
  14225. globals.String);
  14226. smalltalk.addMethod(
  14227. smalltalk.method({
  14228. selector: "trimBoth:",
  14229. protocol: 'regular expressions',
  14230. fn: function (separators){
  14231. var self=this;
  14232. return smalltalk.withContext(function($ctx1) {
  14233. var $1;
  14234. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  14235. return $1;
  14236. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)})},
  14237. args: ["separators"],
  14238. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  14239. messageSends: ["trimRight:", "trimLeft:"],
  14240. referencedClasses: []
  14241. }),
  14242. globals.String);
  14243. smalltalk.addMethod(
  14244. smalltalk.method({
  14245. selector: "trimLeft",
  14246. protocol: 'regular expressions',
  14247. fn: function (){
  14248. var self=this;
  14249. return smalltalk.withContext(function($ctx1) {
  14250. var $1;
  14251. $1=self._trimLeft_("\x5cs");
  14252. return $1;
  14253. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)})},
  14254. args: [],
  14255. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  14256. messageSends: ["trimLeft:"],
  14257. referencedClasses: []
  14258. }),
  14259. globals.String);
  14260. smalltalk.addMethod(
  14261. smalltalk.method({
  14262. selector: "trimLeft:",
  14263. protocol: 'regular expressions',
  14264. fn: function (separators){
  14265. var self=this;
  14266. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14267. return smalltalk.withContext(function($ctx1) {
  14268. var $3,$2,$1;
  14269. $3=_st("^[".__comma(separators)).__comma("]+");
  14270. $ctx1.sendIdx[","]=1;
  14271. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  14272. $1=self._replaceRegexp_with_($2,"");
  14273. return $1;
  14274. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)})},
  14275. args: ["separators"],
  14276. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  14277. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  14278. referencedClasses: ["RegularExpression"]
  14279. }),
  14280. globals.String);
  14281. smalltalk.addMethod(
  14282. smalltalk.method({
  14283. selector: "trimRight",
  14284. protocol: 'regular expressions',
  14285. fn: function (){
  14286. var self=this;
  14287. return smalltalk.withContext(function($ctx1) {
  14288. var $1;
  14289. $1=self._trimRight_("\x5cs");
  14290. return $1;
  14291. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)})},
  14292. args: [],
  14293. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  14294. messageSends: ["trimRight:"],
  14295. referencedClasses: []
  14296. }),
  14297. globals.String);
  14298. smalltalk.addMethod(
  14299. smalltalk.method({
  14300. selector: "trimRight:",
  14301. protocol: 'regular expressions',
  14302. fn: function (separators){
  14303. var self=this;
  14304. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  14305. return smalltalk.withContext(function($ctx1) {
  14306. var $3,$2,$1;
  14307. $3=_st("[".__comma(separators)).__comma("]+$");
  14308. $ctx1.sendIdx[","]=1;
  14309. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  14310. $1=self._replaceRegexp_with_($2,"");
  14311. return $1;
  14312. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)})},
  14313. args: ["separators"],
  14314. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  14315. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  14316. referencedClasses: ["RegularExpression"]
  14317. }),
  14318. globals.String);
  14319. smalltalk.addMethod(
  14320. smalltalk.method({
  14321. selector: "unescaped",
  14322. protocol: 'converting',
  14323. fn: function (){
  14324. var self=this;
  14325. return smalltalk.withContext(function($ctx1) {
  14326. return unescape(self);
  14327. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)})},
  14328. args: [],
  14329. source: "unescaped\x0a\x09<return unescape(self)>",
  14330. messageSends: [],
  14331. referencedClasses: []
  14332. }),
  14333. globals.String);
  14334. smalltalk.addMethod(
  14335. smalltalk.method({
  14336. selector: "uriComponentDecoded",
  14337. protocol: 'converting',
  14338. fn: function (){
  14339. var self=this;
  14340. return smalltalk.withContext(function($ctx1) {
  14341. return decodeURIComponent(self);
  14342. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)})},
  14343. args: [],
  14344. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  14345. messageSends: [],
  14346. referencedClasses: []
  14347. }),
  14348. globals.String);
  14349. smalltalk.addMethod(
  14350. smalltalk.method({
  14351. selector: "uriComponentEncoded",
  14352. protocol: 'converting',
  14353. fn: function (){
  14354. var self=this;
  14355. return smalltalk.withContext(function($ctx1) {
  14356. return encodeURIComponent(self);
  14357. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)})},
  14358. args: [],
  14359. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  14360. messageSends: [],
  14361. referencedClasses: []
  14362. }),
  14363. globals.String);
  14364. smalltalk.addMethod(
  14365. smalltalk.method({
  14366. selector: "uriDecoded",
  14367. protocol: 'converting',
  14368. fn: function (){
  14369. var self=this;
  14370. return smalltalk.withContext(function($ctx1) {
  14371. return decodeURI(self);
  14372. return self}, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)})},
  14373. args: [],
  14374. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  14375. messageSends: [],
  14376. referencedClasses: []
  14377. }),
  14378. globals.String);
  14379. smalltalk.addMethod(
  14380. smalltalk.method({
  14381. selector: "uriEncoded",
  14382. protocol: 'converting',
  14383. fn: function (){
  14384. var self=this;
  14385. return smalltalk.withContext(function($ctx1) {
  14386. return encodeURI(self);
  14387. return self}, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)})},
  14388. args: [],
  14389. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  14390. messageSends: [],
  14391. referencedClasses: []
  14392. }),
  14393. globals.String);
  14394. smalltalk.addMethod(
  14395. smalltalk.method({
  14396. selector: "value:",
  14397. protocol: 'evaluating',
  14398. fn: function (anObject){
  14399. var self=this;
  14400. return smalltalk.withContext(function($ctx1) {
  14401. var $1;
  14402. $1=_st(anObject)._perform_(self);
  14403. return $1;
  14404. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.String)})},
  14405. args: ["anObject"],
  14406. source: "value: anObject \x0a\x09^ anObject perform: self",
  14407. messageSends: ["perform:"],
  14408. referencedClasses: []
  14409. }),
  14410. globals.String);
  14411. smalltalk.addMethod(
  14412. smalltalk.method({
  14413. selector: "cr",
  14414. protocol: 'accessing',
  14415. fn: function (){
  14416. var self=this;
  14417. return smalltalk.withContext(function($ctx1) {
  14418. return '\r';
  14419. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)})},
  14420. args: [],
  14421. source: "cr\x0a\x09<return '\x5cr'>",
  14422. messageSends: [],
  14423. referencedClasses: []
  14424. }),
  14425. globals.String.klass);
  14426. smalltalk.addMethod(
  14427. smalltalk.method({
  14428. selector: "crlf",
  14429. protocol: 'accessing',
  14430. fn: function (){
  14431. var self=this;
  14432. return smalltalk.withContext(function($ctx1) {
  14433. return '\r\n';
  14434. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)})},
  14435. args: [],
  14436. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  14437. messageSends: [],
  14438. referencedClasses: []
  14439. }),
  14440. globals.String.klass);
  14441. smalltalk.addMethod(
  14442. smalltalk.method({
  14443. selector: "esc",
  14444. protocol: 'accessing',
  14445. fn: function (){
  14446. var self=this;
  14447. return smalltalk.withContext(function($ctx1) {
  14448. var $1;
  14449. $1=self._fromCharCode_((27));
  14450. return $1;
  14451. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)})},
  14452. args: [],
  14453. source: "esc\x0a\x09^ self fromCharCode: 27",
  14454. messageSends: ["fromCharCode:"],
  14455. referencedClasses: []
  14456. }),
  14457. globals.String.klass);
  14458. smalltalk.addMethod(
  14459. smalltalk.method({
  14460. selector: "fromCharCode:",
  14461. protocol: 'instance creation',
  14462. fn: function (anInteger){
  14463. var self=this;
  14464. return smalltalk.withContext(function($ctx1) {
  14465. return String.fromCharCode(anInteger);
  14466. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)})},
  14467. args: ["anInteger"],
  14468. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  14469. messageSends: [],
  14470. referencedClasses: []
  14471. }),
  14472. globals.String.klass);
  14473. smalltalk.addMethod(
  14474. smalltalk.method({
  14475. selector: "fromString:",
  14476. protocol: 'instance creation',
  14477. fn: function (aString){
  14478. var self=this;
  14479. return smalltalk.withContext(function($ctx1) {
  14480. return String(aString);
  14481. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)})},
  14482. args: ["aString"],
  14483. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  14484. messageSends: [],
  14485. referencedClasses: []
  14486. }),
  14487. globals.String.klass);
  14488. smalltalk.addMethod(
  14489. smalltalk.method({
  14490. selector: "lf",
  14491. protocol: 'accessing',
  14492. fn: function (){
  14493. var self=this;
  14494. return smalltalk.withContext(function($ctx1) {
  14495. return '\n';
  14496. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)})},
  14497. args: [],
  14498. source: "lf\x0a\x09<return '\x5cn'>",
  14499. messageSends: [],
  14500. referencedClasses: []
  14501. }),
  14502. globals.String.klass);
  14503. smalltalk.addMethod(
  14504. smalltalk.method({
  14505. selector: "random",
  14506. protocol: 'random',
  14507. fn: function (){
  14508. var self=this;
  14509. return smalltalk.withContext(function($ctx1) {
  14510. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  14511. return self}, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)})},
  14512. args: [],
  14513. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  14514. messageSends: [],
  14515. referencedClasses: []
  14516. }),
  14517. globals.String.klass);
  14518. smalltalk.addMethod(
  14519. smalltalk.method({
  14520. selector: "randomNotIn:",
  14521. protocol: 'random',
  14522. fn: function (aString){
  14523. var self=this;
  14524. var result;
  14525. return smalltalk.withContext(function($ctx1) {
  14526. var $1;
  14527. _st((function(){
  14528. return smalltalk.withContext(function($ctx2) {
  14529. result=self._random();
  14530. result;
  14531. return _st(aString)._includesSubString_(result);
  14532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue();
  14533. $1=result;
  14534. return $1;
  14535. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)})},
  14536. args: ["aString"],
  14537. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  14538. messageSends: ["whileTrue", "random", "includesSubString:"],
  14539. referencedClasses: []
  14540. }),
  14541. globals.String.klass);
  14542. smalltalk.addMethod(
  14543. smalltalk.method({
  14544. selector: "space",
  14545. protocol: 'accessing',
  14546. fn: function (){
  14547. var self=this;
  14548. return smalltalk.withContext(function($ctx1) {
  14549. return ' ';
  14550. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)})},
  14551. args: [],
  14552. source: "space\x0a\x09<return ' '>",
  14553. messageSends: [],
  14554. referencedClasses: []
  14555. }),
  14556. globals.String.klass);
  14557. smalltalk.addMethod(
  14558. smalltalk.method({
  14559. selector: "streamClass",
  14560. protocol: 'accessing',
  14561. fn: function (){
  14562. var self=this;
  14563. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  14564. return $StringStream();
  14565. },
  14566. args: [],
  14567. source: "streamClass\x0a\x09\x09^ StringStream",
  14568. messageSends: [],
  14569. referencedClasses: ["StringStream"]
  14570. }),
  14571. globals.String.klass);
  14572. smalltalk.addMethod(
  14573. smalltalk.method({
  14574. selector: "tab",
  14575. protocol: 'accessing',
  14576. fn: function (){
  14577. var self=this;
  14578. return smalltalk.withContext(function($ctx1) {
  14579. return '\t';
  14580. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)})},
  14581. args: [],
  14582. source: "tab\x0a\x09<return '\x5ct'>",
  14583. messageSends: [],
  14584. referencedClasses: []
  14585. }),
  14586. globals.String.klass);
  14587. smalltalk.addMethod(
  14588. smalltalk.method({
  14589. selector: "value:",
  14590. protocol: 'instance creation',
  14591. fn: function (aUTFCharCode){
  14592. var self=this;
  14593. return smalltalk.withContext(function($ctx1) {
  14594. return String.fromCharCode(aUTFCharCode);;
  14595. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)})},
  14596. args: ["aUTFCharCode"],
  14597. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  14598. messageSends: [],
  14599. referencedClasses: []
  14600. }),
  14601. globals.String.klass);
  14602. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  14603. globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  14604. smalltalk.addMethod(
  14605. smalltalk.method({
  14606. selector: "=",
  14607. protocol: 'comparing',
  14608. fn: function (aCollection){
  14609. var self=this;
  14610. return smalltalk.withContext(function($ctx1) {
  14611. var $2,$1,$4,$3,$5;
  14612. var $early={};
  14613. try {
  14614. $2=self._class();
  14615. $ctx1.sendIdx["class"]=1;
  14616. $1=_st($2).__eq(_st(aCollection)._class());
  14617. $ctx1.sendIdx["="]=1;
  14618. if(! smalltalk.assert($1)){
  14619. return false;
  14620. };
  14621. $4=self._size();
  14622. $ctx1.sendIdx["size"]=1;
  14623. $3=_st($4).__eq(_st(aCollection)._size());
  14624. if(! smalltalk.assert($3)){
  14625. return false;
  14626. };
  14627. self._do_((function(each){
  14628. return smalltalk.withContext(function($ctx2) {
  14629. $5=_st(aCollection)._includes_(each);
  14630. if(! smalltalk.assert($5)){
  14631. throw $early=[false];
  14632. };
  14633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  14634. return true;
  14635. }
  14636. catch(e) {if(e===$early)return e[0]; throw e}
  14637. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)})},
  14638. args: ["aCollection"],
  14639. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  14640. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  14641. referencedClasses: []
  14642. }),
  14643. globals.Set);
  14644. smalltalk.addMethod(
  14645. smalltalk.method({
  14646. selector: "add:",
  14647. protocol: 'adding/removing',
  14648. fn: function (anObject){
  14649. var self=this;
  14650. var bucket;
  14651. return smalltalk.withContext(function($ctx1) {
  14652. var $2,$1,$receiver;
  14653. bucket=self._bucketsOfElement_(anObject);
  14654. $2=_st(bucket)._second();
  14655. if(($receiver = $2) == null || $receiver.isNil){
  14656. var object,slowBucket;
  14657. object=_st(bucket)._first();
  14658. $ctx1.sendIdx["first"]=1;
  14659. object;
  14660. slowBucket=_st(bucket)._third();
  14661. slowBucket;
  14662. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  14663. return smalltalk.withContext(function($ctx2) {
  14664. _st(slowBucket)._add_(object);
  14665. self["@size"]=_st(self["@size"]).__plus((1));
  14666. return self["@size"];
  14667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14668. $1=object;
  14669. } else {
  14670. var primitiveBucket;
  14671. primitiveBucket=$receiver;
  14672. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  14673. };
  14674. return $1;
  14675. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)})},
  14676. args: ["anObject"],
  14677. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  14678. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"],
  14679. referencedClasses: []
  14680. }),
  14681. globals.Set);
  14682. smalltalk.addMethod(
  14683. smalltalk.method({
  14684. selector: "add:in:",
  14685. protocol: 'private',
  14686. fn: function (anObject,anotherObject){
  14687. var self=this;
  14688. return smalltalk.withContext(function($ctx1) {
  14689. if (anObject in anotherObject.store) { return false; }
  14690. self['@size']++;
  14691. return anotherObject.store[anObject] = true;
  14692. ;
  14693. return self}, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  14694. args: ["anObject", "anotherObject"],
  14695. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  14696. messageSends: [],
  14697. referencedClasses: []
  14698. }),
  14699. globals.Set);
  14700. smalltalk.addMethod(
  14701. smalltalk.method({
  14702. selector: "bucketsOfElement:",
  14703. protocol: 'private',
  14704. fn: function (anObject){
  14705. var self=this;
  14706. return smalltalk.withContext(function($ctx1) {
  14707. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  14708. if ((type = typeof prim) === "object") {
  14709. if (anObject !== nil) {
  14710. bucket = null;
  14711. self['@slowBucketStores'].some(function (store) {
  14712. return bucket = store._bucketOfElement_(anObject);
  14713. });
  14714. return [ anObject, null, bucket || self['@defaultBucket'] ];
  14715. }
  14716. // include nil to well-known objects under 'boolean' fastBucket
  14717. prim = null;
  14718. type = 'boolean';
  14719. }
  14720. return [ prim, self['@fastBuckets'][type] ];
  14721. ;
  14722. return self}, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)})},
  14723. args: ["anObject"],
  14724. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  14725. messageSends: [],
  14726. referencedClasses: []
  14727. }),
  14728. globals.Set);
  14729. smalltalk.addMethod(
  14730. smalltalk.method({
  14731. selector: "classNameOf:",
  14732. protocol: 'private',
  14733. fn: function (anObject){
  14734. var self=this;
  14735. return smalltalk.withContext(function($ctx1) {
  14736. return anObject.klass && anObject.klass.className;
  14737. return self}, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)})},
  14738. args: ["anObject"],
  14739. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass && anObject.klass.className>",
  14740. messageSends: [],
  14741. referencedClasses: []
  14742. }),
  14743. globals.Set);
  14744. smalltalk.addMethod(
  14745. smalltalk.method({
  14746. selector: "collect:",
  14747. protocol: 'enumerating',
  14748. fn: function (aBlock){
  14749. var self=this;
  14750. var collection;
  14751. return smalltalk.withContext(function($ctx1) {
  14752. var $1;
  14753. collection=_st(self._class())._new();
  14754. self._do_((function(each){
  14755. return smalltalk.withContext(function($ctx2) {
  14756. return _st(collection)._add_(_st(aBlock)._value_(each));
  14757. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14758. $1=collection;
  14759. return $1;
  14760. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)})},
  14761. args: ["aBlock"],
  14762. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  14763. messageSends: ["new", "class", "do:", "add:", "value:"],
  14764. referencedClasses: []
  14765. }),
  14766. globals.Set);
  14767. smalltalk.addMethod(
  14768. smalltalk.method({
  14769. selector: "detect:ifNone:",
  14770. protocol: 'enumerating',
  14771. fn: function (aBlock,anotherBlock){
  14772. var self=this;
  14773. return smalltalk.withContext(function($ctx1) {
  14774. var $1,$2;
  14775. var $early={};
  14776. try {
  14777. self._do_((function(each){
  14778. return smalltalk.withContext(function($ctx2) {
  14779. $1=_st(aBlock)._value_(each);
  14780. if(smalltalk.assert($1)){
  14781. throw $early=[each];
  14782. };
  14783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  14784. $2=_st(anotherBlock)._value();
  14785. return $2;
  14786. }
  14787. catch(e) {if(e===$early)return e[0]; throw e}
  14788. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)})},
  14789. args: ["aBlock", "anotherBlock"],
  14790. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  14791. messageSends: ["do:", "ifTrue:", "value:", "value"],
  14792. referencedClasses: []
  14793. }),
  14794. globals.Set);
  14795. smalltalk.addMethod(
  14796. smalltalk.method({
  14797. selector: "do:",
  14798. protocol: 'enumerating',
  14799. fn: function (aBlock){
  14800. var self=this;
  14801. return smalltalk.withContext(function($ctx1) {
  14802. var el, keys, i;
  14803. el = self['@fastBuckets'];
  14804. keys = Object.keys(el);
  14805. for (i = 0; i < keys.length; ++i) {
  14806. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  14807. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  14808. else { store._do_(aBlock); }
  14809. }
  14810. el = self['@slowBucketStores'];
  14811. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  14812. self['@defaultBucket']._do_(aBlock);
  14813. ;
  14814. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)})},
  14815. args: ["aBlock"],
  14816. source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
  14817. messageSends: [],
  14818. referencedClasses: []
  14819. }),
  14820. globals.Set);
  14821. smalltalk.addMethod(
  14822. smalltalk.method({
  14823. selector: "includes:",
  14824. protocol: 'testing',
  14825. fn: function (anObject){
  14826. var self=this;
  14827. var bucket;
  14828. return smalltalk.withContext(function($ctx1) {
  14829. var $2,$3,$4,$1,$receiver;
  14830. bucket=self._bucketsOfElement_(anObject);
  14831. $2=_st(bucket)._second();
  14832. if(($receiver = $2) == null || $receiver.isNil){
  14833. $3=_st(bucket)._third();
  14834. $4=_st(bucket)._first();
  14835. $ctx1.sendIdx["first"]=1;
  14836. $1=_st($3)._includes_($4);
  14837. } else {
  14838. var primitiveBucket;
  14839. primitiveBucket=$receiver;
  14840. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  14841. };
  14842. return $1;
  14843. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)})},
  14844. args: ["anObject"],
  14845. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  14846. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"],
  14847. referencedClasses: []
  14848. }),
  14849. globals.Set);
  14850. smalltalk.addMethod(
  14851. smalltalk.method({
  14852. selector: "includes:in:",
  14853. protocol: 'private',
  14854. fn: function (anObject,anotherObject){
  14855. var self=this;
  14856. return smalltalk.withContext(function($ctx1) {
  14857. return anObject in anotherObject.store;
  14858. return self}, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  14859. args: ["anObject", "anotherObject"],
  14860. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  14861. messageSends: [],
  14862. referencedClasses: []
  14863. }),
  14864. globals.Set);
  14865. smalltalk.addMethod(
  14866. smalltalk.method({
  14867. selector: "initialize",
  14868. protocol: 'initialization',
  14869. fn: function (){
  14870. var self=this;
  14871. return smalltalk.withContext(function($ctx1) {
  14872. var $1;
  14873. ($ctx1.supercall = true, globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []));
  14874. $ctx1.supercall = false;
  14875. self["@defaultBucket"]=[];
  14876. self._initializeSlowBucketStores();
  14877. $1=self._removeAll();
  14878. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)})},
  14879. args: [],
  14880. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  14881. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"],
  14882. referencedClasses: []
  14883. }),
  14884. globals.Set);
  14885. smalltalk.addMethod(
  14886. smalltalk.method({
  14887. selector: "initializeSlowBucketStores",
  14888. protocol: 'initialization',
  14889. fn: function (){
  14890. var self=this;
  14891. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  14892. return smalltalk.withContext(function($ctx1) {
  14893. var $1;
  14894. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  14895. return smalltalk.withContext(function($ctx2) {
  14896. return self._classNameOf_(x);
  14897. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  14898. $ctx1.sendIdx["hashBlock:"]=1;
  14899. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  14900. return smalltalk.withContext(function($ctx2) {
  14901. return self._jsConstructorNameOf_(x);
  14902. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))];
  14903. return self}, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)})},
  14904. args: [],
  14905. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  14906. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"],
  14907. referencedClasses: ["ArrayBucketStore"]
  14908. }),
  14909. globals.Set);
  14910. smalltalk.addMethod(
  14911. smalltalk.method({
  14912. selector: "jsConstructorNameOf:",
  14913. protocol: 'private',
  14914. fn: function (anObject){
  14915. var self=this;
  14916. return smalltalk.withContext(function($ctx1) {
  14917. return anObject.constructor && anObject.constructor.name;
  14918. return self}, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)})},
  14919. args: ["anObject"],
  14920. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  14921. messageSends: [],
  14922. referencedClasses: []
  14923. }),
  14924. globals.Set);
  14925. smalltalk.addMethod(
  14926. smalltalk.method({
  14927. selector: "printOn:",
  14928. protocol: 'printing',
  14929. fn: function (aStream){
  14930. var self=this;
  14931. return smalltalk.withContext(function($ctx1) {
  14932. ($ctx1.supercall = true, globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  14933. $ctx1.supercall = false;
  14934. $ctx1.sendIdx["printOn:"]=1;
  14935. _st(aStream)._nextPutAll_(" (");
  14936. $ctx1.sendIdx["nextPutAll:"]=1;
  14937. self._do_separatedBy_((function(each){
  14938. return smalltalk.withContext(function($ctx2) {
  14939. return _st(each)._printOn_(aStream);
  14940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  14941. return smalltalk.withContext(function($ctx2) {
  14942. return _st(aStream)._nextPutAll_(" ");
  14943. $ctx2.sendIdx["nextPutAll:"]=2;
  14944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14945. _st(aStream)._nextPutAll_(")");
  14946. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)})},
  14947. args: ["aStream"],
  14948. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  14949. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  14950. referencedClasses: []
  14951. }),
  14952. globals.Set);
  14953. smalltalk.addMethod(
  14954. smalltalk.method({
  14955. selector: "remove:ifAbsent:",
  14956. protocol: 'adding/removing',
  14957. fn: function (anObject,aBlock){
  14958. var self=this;
  14959. var bucket;
  14960. return smalltalk.withContext(function($ctx1) {
  14961. var $2,$3,$4,$5,$1,$receiver;
  14962. var $early={};
  14963. try {
  14964. bucket=self._bucketsOfElement_(anObject);
  14965. $2=_st(bucket)._second();
  14966. if(($receiver = $2) == null || $receiver.isNil){
  14967. $3=_st(bucket)._third();
  14968. $4=_st(bucket)._first();
  14969. $ctx1.sendIdx["first"]=1;
  14970. _st($3)._remove_ifAbsent_($4,(function(){
  14971. return smalltalk.withContext(function($ctx2) {
  14972. $5=_st(aBlock)._value();
  14973. throw $early=[$5];
  14974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  14975. self["@size"]=_st(self["@size"]).__minus((1));
  14976. $1=self["@size"];
  14977. } else {
  14978. var primitiveBucket;
  14979. primitiveBucket=$receiver;
  14980. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  14981. };
  14982. return $1;
  14983. }
  14984. catch(e) {if(e===$early)return e[0]; throw e}
  14985. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)})},
  14986. args: ["anObject", "aBlock"],
  14987. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  14988. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"],
  14989. referencedClasses: []
  14990. }),
  14991. globals.Set);
  14992. smalltalk.addMethod(
  14993. smalltalk.method({
  14994. selector: "remove:in:",
  14995. protocol: 'private',
  14996. fn: function (anObject,anotherObject){
  14997. var self=this;
  14998. return smalltalk.withContext(function($ctx1) {
  14999. if (delete anotherObject.store[anObject]) self['@size']--;
  15000. return self}, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  15001. args: ["anObject", "anotherObject"],
  15002. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  15003. messageSends: [],
  15004. referencedClasses: []
  15005. }),
  15006. globals.Set);
  15007. smalltalk.addMethod(
  15008. smalltalk.method({
  15009. selector: "removeAll",
  15010. protocol: 'adding/removing',
  15011. fn: function (){
  15012. var self=this;
  15013. return smalltalk.withContext(function($ctx1) {
  15014. self['@fastBuckets'] = {
  15015. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  15016. 'number': { store: Object.create(null), fn: Number },
  15017. 'string': { store: Object.create(null) }
  15018. };
  15019. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  15020. self['@defaultBucket']._removeAll();
  15021. self['@size'] = 0;
  15022. ;
  15023. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)})},
  15024. args: [],
  15025. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
  15026. messageSends: [],
  15027. referencedClasses: []
  15028. }),
  15029. globals.Set);
  15030. smalltalk.addMethod(
  15031. smalltalk.method({
  15032. selector: "select:",
  15033. protocol: 'enumerating',
  15034. fn: function (aBlock){
  15035. var self=this;
  15036. var collection;
  15037. return smalltalk.withContext(function($ctx1) {
  15038. var $1,$2;
  15039. collection=_st(self._class())._new();
  15040. self._do_((function(each){
  15041. return smalltalk.withContext(function($ctx2) {
  15042. $1=_st(aBlock)._value_(each);
  15043. if(smalltalk.assert($1)){
  15044. return _st(collection)._add_(each);
  15045. };
  15046. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15047. $2=collection;
  15048. return $2;
  15049. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)})},
  15050. args: ["aBlock"],
  15051. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  15052. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  15053. referencedClasses: []
  15054. }),
  15055. globals.Set);
  15056. smalltalk.addMethod(
  15057. smalltalk.method({
  15058. selector: "size",
  15059. protocol: 'accessing',
  15060. fn: function (){
  15061. var self=this;
  15062. var $1;
  15063. $1=self["@size"];
  15064. return $1;
  15065. },
  15066. args: [],
  15067. source: "size\x0a\x09^ size",
  15068. messageSends: [],
  15069. referencedClasses: []
  15070. }),
  15071. globals.Set);
  15072. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  15073. globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  15074. smalltalk.addMethod(
  15075. smalltalk.method({
  15076. selector: "initialize",
  15077. protocol: 'initialization',
  15078. fn: function (){
  15079. var self=this;
  15080. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  15081. return smalltalk.withContext(function($ctx1) {
  15082. ($ctx1.supercall = true, globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []));
  15083. $ctx1.supercall = false;
  15084. self["@read"]=_st($OrderedCollection())._new();
  15085. $ctx1.sendIdx["new"]=1;
  15086. self["@write"]=_st($OrderedCollection())._new();
  15087. self["@readIndex"]=(1);
  15088. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)})},
  15089. args: [],
  15090. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  15091. messageSends: ["initialize", "new"],
  15092. referencedClasses: ["OrderedCollection"]
  15093. }),
  15094. globals.Queue);
  15095. smalltalk.addMethod(
  15096. smalltalk.method({
  15097. selector: "next",
  15098. protocol: 'accessing',
  15099. fn: function (){
  15100. var self=this;
  15101. return smalltalk.withContext(function($ctx1) {
  15102. var $1;
  15103. $1=self._nextIfAbsent_((function(){
  15104. return smalltalk.withContext(function($ctx2) {
  15105. return self._error_("Cannot read from empty Queue.");
  15106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15107. return $1;
  15108. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)})},
  15109. args: [],
  15110. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  15111. messageSends: ["nextIfAbsent:", "error:"],
  15112. referencedClasses: []
  15113. }),
  15114. globals.Queue);
  15115. smalltalk.addMethod(
  15116. smalltalk.method({
  15117. selector: "nextIfAbsent:",
  15118. protocol: 'accessing',
  15119. fn: function (aBlock){
  15120. var self=this;
  15121. var result;
  15122. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  15123. return smalltalk.withContext(function($ctx1) {
  15124. var $1,$2,$3,$4;
  15125. var $early={};
  15126. try {
  15127. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  15128. return smalltalk.withContext(function($ctx2) {
  15129. $1=_st(self["@write"])._isEmpty();
  15130. if(smalltalk.assert($1)){
  15131. $2=_st(self["@readIndex"]).__gt((1));
  15132. if(smalltalk.assert($2)){
  15133. self["@read"]=[];
  15134. self["@read"];
  15135. self["@readIndex"]=(1);
  15136. self["@readIndex"];
  15137. };
  15138. $3=_st(aBlock)._value();
  15139. throw $early=[$3];
  15140. };
  15141. self["@read"]=self["@write"];
  15142. self["@read"];
  15143. self["@readIndex"]=(1);
  15144. self["@readIndex"];
  15145. self["@write"]=_st($OrderedCollection())._new();
  15146. self["@write"];
  15147. return _st(self["@read"])._first();
  15148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15149. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  15150. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  15151. $4=result;
  15152. return $4;
  15153. }
  15154. catch(e) {if(e===$early)return e[0]; throw e}
  15155. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)})},
  15156. args: ["aBlock"],
  15157. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  15158. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"],
  15159. referencedClasses: ["OrderedCollection"]
  15160. }),
  15161. globals.Queue);
  15162. smalltalk.addMethod(
  15163. smalltalk.method({
  15164. selector: "nextPut:",
  15165. protocol: 'accessing',
  15166. fn: function (anObject){
  15167. var self=this;
  15168. return smalltalk.withContext(function($ctx1) {
  15169. _st(self["@write"])._add_(anObject);
  15170. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)})},
  15171. args: ["anObject"],
  15172. source: "nextPut: anObject\x0a\x09write add: anObject",
  15173. messageSends: ["add:"],
  15174. referencedClasses: []
  15175. }),
  15176. globals.Queue);
  15177. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  15178. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  15179. smalltalk.addMethod(
  15180. smalltalk.method({
  15181. selector: "compile:",
  15182. protocol: 'evaluating',
  15183. fn: function (aString){
  15184. var self=this;
  15185. return smalltalk.withContext(function($ctx1) {
  15186. return self.compile(aString);
  15187. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)})},
  15188. args: ["aString"],
  15189. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  15190. messageSends: [],
  15191. referencedClasses: []
  15192. }),
  15193. globals.RegularExpression);
  15194. smalltalk.addMethod(
  15195. smalltalk.method({
  15196. selector: "exec:",
  15197. protocol: 'evaluating',
  15198. fn: function (aString){
  15199. var self=this;
  15200. return smalltalk.withContext(function($ctx1) {
  15201. return self.exec(aString) || nil;
  15202. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)})},
  15203. args: ["aString"],
  15204. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  15205. messageSends: [],
  15206. referencedClasses: []
  15207. }),
  15208. globals.RegularExpression);
  15209. smalltalk.addMethod(
  15210. smalltalk.method({
  15211. selector: "test:",
  15212. protocol: 'evaluating',
  15213. fn: function (aString){
  15214. var self=this;
  15215. return smalltalk.withContext(function($ctx1) {
  15216. return self.test(aString);
  15217. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)})},
  15218. args: ["aString"],
  15219. source: "test: aString\x0a\x09<return self.test(aString)>",
  15220. messageSends: [],
  15221. referencedClasses: []
  15222. }),
  15223. globals.RegularExpression);
  15224. smalltalk.addMethod(
  15225. smalltalk.method({
  15226. selector: "fromString:",
  15227. protocol: 'instance creation',
  15228. fn: function (aString){
  15229. var self=this;
  15230. return smalltalk.withContext(function($ctx1) {
  15231. var $1;
  15232. $1=self._fromString_flag_(aString,"");
  15233. return $1;
  15234. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)})},
  15235. args: ["aString"],
  15236. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  15237. messageSends: ["fromString:flag:"],
  15238. referencedClasses: []
  15239. }),
  15240. globals.RegularExpression.klass);
  15241. smalltalk.addMethod(
  15242. smalltalk.method({
  15243. selector: "fromString:flag:",
  15244. protocol: 'instance creation',
  15245. fn: function (aString,anotherString){
  15246. var self=this;
  15247. return smalltalk.withContext(function($ctx1) {
  15248. return new RegExp(aString, anotherString);
  15249. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)})},
  15250. args: ["aString", "anotherString"],
  15251. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  15252. messageSends: [],
  15253. referencedClasses: []
  15254. }),
  15255. globals.RegularExpression.klass);
  15256. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  15257. globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  15258. smalltalk.addMethod(
  15259. smalltalk.method({
  15260. selector: "<<",
  15261. protocol: 'writing',
  15262. fn: function (anObject){
  15263. var self=this;
  15264. return smalltalk.withContext(function($ctx1) {
  15265. self._write_(anObject);
  15266. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)})},
  15267. args: ["anObject"],
  15268. source: "<< anObject\x0a\x09self write: anObject",
  15269. messageSends: ["write:"],
  15270. referencedClasses: []
  15271. }),
  15272. globals.Stream);
  15273. smalltalk.addMethod(
  15274. smalltalk.method({
  15275. selector: "atEnd",
  15276. protocol: 'testing',
  15277. fn: function (){
  15278. var self=this;
  15279. return smalltalk.withContext(function($ctx1) {
  15280. var $1;
  15281. $1=_st(self._position()).__eq(self._size());
  15282. return $1;
  15283. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)})},
  15284. args: [],
  15285. source: "atEnd\x0a\x09^ self position = self size",
  15286. messageSends: ["=", "position", "size"],
  15287. referencedClasses: []
  15288. }),
  15289. globals.Stream);
  15290. smalltalk.addMethod(
  15291. smalltalk.method({
  15292. selector: "atStart",
  15293. protocol: 'testing',
  15294. fn: function (){
  15295. var self=this;
  15296. return smalltalk.withContext(function($ctx1) {
  15297. var $1;
  15298. $1=_st(self._position()).__eq((0));
  15299. return $1;
  15300. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)})},
  15301. args: [],
  15302. source: "atStart\x0a\x09^ self position = 0",
  15303. messageSends: ["=", "position"],
  15304. referencedClasses: []
  15305. }),
  15306. globals.Stream);
  15307. smalltalk.addMethod(
  15308. smalltalk.method({
  15309. selector: "close",
  15310. protocol: 'actions',
  15311. fn: function (){
  15312. var self=this;
  15313. return self},
  15314. args: [],
  15315. source: "close",
  15316. messageSends: [],
  15317. referencedClasses: []
  15318. }),
  15319. globals.Stream);
  15320. smalltalk.addMethod(
  15321. smalltalk.method({
  15322. selector: "collection",
  15323. protocol: 'accessing',
  15324. fn: function (){
  15325. var self=this;
  15326. var $1;
  15327. $1=self["@collection"];
  15328. return $1;
  15329. },
  15330. args: [],
  15331. source: "collection\x0a\x09^ collection",
  15332. messageSends: [],
  15333. referencedClasses: []
  15334. }),
  15335. globals.Stream);
  15336. smalltalk.addMethod(
  15337. smalltalk.method({
  15338. selector: "contents",
  15339. protocol: 'accessing',
  15340. fn: function (){
  15341. var self=this;
  15342. return smalltalk.withContext(function($ctx1) {
  15343. var $1;
  15344. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  15345. return $1;
  15346. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)})},
  15347. args: [],
  15348. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  15349. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  15350. referencedClasses: []
  15351. }),
  15352. globals.Stream);
  15353. smalltalk.addMethod(
  15354. smalltalk.method({
  15355. selector: "do:",
  15356. protocol: 'enumerating',
  15357. fn: function (aBlock){
  15358. var self=this;
  15359. return smalltalk.withContext(function($ctx1) {
  15360. _st((function(){
  15361. return smalltalk.withContext(function($ctx2) {
  15362. return self._atEnd();
  15363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  15364. return smalltalk.withContext(function($ctx2) {
  15365. return _st(aBlock)._value_(self._next());
  15366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  15367. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)})},
  15368. args: ["aBlock"],
  15369. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  15370. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  15371. referencedClasses: []
  15372. }),
  15373. globals.Stream);
  15374. smalltalk.addMethod(
  15375. smalltalk.method({
  15376. selector: "flush",
  15377. protocol: 'actions',
  15378. fn: function (){
  15379. var self=this;
  15380. return self},
  15381. args: [],
  15382. source: "flush",
  15383. messageSends: [],
  15384. referencedClasses: []
  15385. }),
  15386. globals.Stream);
  15387. smalltalk.addMethod(
  15388. smalltalk.method({
  15389. selector: "isEmpty",
  15390. protocol: 'testing',
  15391. fn: function (){
  15392. var self=this;
  15393. return smalltalk.withContext(function($ctx1) {
  15394. var $1;
  15395. $1=_st(self._size()).__eq((0));
  15396. return $1;
  15397. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)})},
  15398. args: [],
  15399. source: "isEmpty\x0a\x09^ self size = 0",
  15400. messageSends: ["=", "size"],
  15401. referencedClasses: []
  15402. }),
  15403. globals.Stream);
  15404. smalltalk.addMethod(
  15405. smalltalk.method({
  15406. selector: "next",
  15407. protocol: 'reading',
  15408. fn: function (){
  15409. var self=this;
  15410. return smalltalk.withContext(function($ctx1) {
  15411. var $2,$4,$3,$1;
  15412. $2=self._atEnd();
  15413. if(smalltalk.assert($2)){
  15414. $1=nil;
  15415. } else {
  15416. $4=self._position();
  15417. $ctx1.sendIdx["position"]=1;
  15418. $3=_st($4).__plus((1));
  15419. self._position_($3);
  15420. $1=_st(self["@collection"])._at_(self._position());
  15421. };
  15422. return $1;
  15423. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)})},
  15424. args: [],
  15425. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  15426. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  15427. referencedClasses: []
  15428. }),
  15429. globals.Stream);
  15430. smalltalk.addMethod(
  15431. smalltalk.method({
  15432. selector: "next:",
  15433. protocol: 'reading',
  15434. fn: function (anInteger){
  15435. var self=this;
  15436. var tempCollection;
  15437. return smalltalk.withContext(function($ctx1) {
  15438. var $1,$2;
  15439. tempCollection=_st(_st(self._collection())._class())._new();
  15440. _st(anInteger)._timesRepeat_((function(){
  15441. return smalltalk.withContext(function($ctx2) {
  15442. $1=self._atEnd();
  15443. if(! smalltalk.assert($1)){
  15444. return _st(tempCollection)._add_(self._next());
  15445. };
  15446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15447. $2=tempCollection;
  15448. return $2;
  15449. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)})},
  15450. args: ["anInteger"],
  15451. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  15452. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  15453. referencedClasses: []
  15454. }),
  15455. globals.Stream);
  15456. smalltalk.addMethod(
  15457. smalltalk.method({
  15458. selector: "nextPut:",
  15459. protocol: 'writing',
  15460. fn: function (anObject){
  15461. var self=this;
  15462. return smalltalk.withContext(function($ctx1) {
  15463. var $2,$1,$3,$4;
  15464. $2=self._position();
  15465. $ctx1.sendIdx["position"]=1;
  15466. $1=_st($2).__plus((1));
  15467. self._position_($1);
  15468. $3=self._collection();
  15469. $4=self._position();
  15470. $ctx1.sendIdx["position"]=2;
  15471. _st($3)._at_put_($4,anObject);
  15472. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15473. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)})},
  15474. args: ["anObject"],
  15475. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  15476. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  15477. referencedClasses: []
  15478. }),
  15479. globals.Stream);
  15480. smalltalk.addMethod(
  15481. smalltalk.method({
  15482. selector: "nextPutAll:",
  15483. protocol: 'writing',
  15484. fn: function (aCollection){
  15485. var self=this;
  15486. return smalltalk.withContext(function($ctx1) {
  15487. _st(aCollection)._do_((function(each){
  15488. return smalltalk.withContext(function($ctx2) {
  15489. return self._nextPut_(each);
  15490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  15491. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)})},
  15492. args: ["aCollection"],
  15493. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  15494. messageSends: ["do:", "nextPut:"],
  15495. referencedClasses: []
  15496. }),
  15497. globals.Stream);
  15498. smalltalk.addMethod(
  15499. smalltalk.method({
  15500. selector: "nextPutString:",
  15501. protocol: 'writing',
  15502. fn: function (aString){
  15503. var self=this;
  15504. return smalltalk.withContext(function($ctx1) {
  15505. self._nextPut_(aString);
  15506. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)})},
  15507. args: ["aString"],
  15508. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  15509. messageSends: ["nextPut:"],
  15510. referencedClasses: []
  15511. }),
  15512. globals.Stream);
  15513. smalltalk.addMethod(
  15514. smalltalk.method({
  15515. selector: "peek",
  15516. protocol: 'reading',
  15517. fn: function (){
  15518. var self=this;
  15519. return smalltalk.withContext(function($ctx1) {
  15520. var $2,$1;
  15521. $2=self._atEnd();
  15522. if(! smalltalk.assert($2)){
  15523. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  15524. };
  15525. return $1;
  15526. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)})},
  15527. args: [],
  15528. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  15529. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  15530. referencedClasses: []
  15531. }),
  15532. globals.Stream);
  15533. smalltalk.addMethod(
  15534. smalltalk.method({
  15535. selector: "position",
  15536. protocol: 'accessing',
  15537. fn: function (){
  15538. var self=this;
  15539. return smalltalk.withContext(function($ctx1) {
  15540. var $2,$1,$receiver;
  15541. $2=self["@position"];
  15542. if(($receiver = $2) == null || $receiver.isNil){
  15543. self["@position"]=(0);
  15544. $1=self["@position"];
  15545. } else {
  15546. $1=$2;
  15547. };
  15548. return $1;
  15549. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)})},
  15550. args: [],
  15551. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  15552. messageSends: ["ifNil:"],
  15553. referencedClasses: []
  15554. }),
  15555. globals.Stream);
  15556. smalltalk.addMethod(
  15557. smalltalk.method({
  15558. selector: "position:",
  15559. protocol: 'accessing',
  15560. fn: function (anInteger){
  15561. var self=this;
  15562. self["@position"]=anInteger;
  15563. return self},
  15564. args: ["anInteger"],
  15565. source: "position: anInteger\x0a\x09position := anInteger",
  15566. messageSends: [],
  15567. referencedClasses: []
  15568. }),
  15569. globals.Stream);
  15570. smalltalk.addMethod(
  15571. smalltalk.method({
  15572. selector: "reset",
  15573. protocol: 'actions',
  15574. fn: function (){
  15575. var self=this;
  15576. return smalltalk.withContext(function($ctx1) {
  15577. self._position_((0));
  15578. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)})},
  15579. args: [],
  15580. source: "reset\x0a\x09self position: 0",
  15581. messageSends: ["position:"],
  15582. referencedClasses: []
  15583. }),
  15584. globals.Stream);
  15585. smalltalk.addMethod(
  15586. smalltalk.method({
  15587. selector: "resetContents",
  15588. protocol: 'actions',
  15589. fn: function (){
  15590. var self=this;
  15591. return smalltalk.withContext(function($ctx1) {
  15592. self._reset();
  15593. self._setStreamSize_((0));
  15594. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)})},
  15595. args: [],
  15596. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  15597. messageSends: ["reset", "setStreamSize:"],
  15598. referencedClasses: []
  15599. }),
  15600. globals.Stream);
  15601. smalltalk.addMethod(
  15602. smalltalk.method({
  15603. selector: "setCollection:",
  15604. protocol: 'accessing',
  15605. fn: function (aCollection){
  15606. var self=this;
  15607. self["@collection"]=aCollection;
  15608. return self},
  15609. args: ["aCollection"],
  15610. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  15611. messageSends: [],
  15612. referencedClasses: []
  15613. }),
  15614. globals.Stream);
  15615. smalltalk.addMethod(
  15616. smalltalk.method({
  15617. selector: "setStreamSize:",
  15618. protocol: 'accessing',
  15619. fn: function (anInteger){
  15620. var self=this;
  15621. self["@streamSize"]=anInteger;
  15622. return self},
  15623. args: ["anInteger"],
  15624. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  15625. messageSends: [],
  15626. referencedClasses: []
  15627. }),
  15628. globals.Stream);
  15629. smalltalk.addMethod(
  15630. smalltalk.method({
  15631. selector: "setToEnd",
  15632. protocol: 'positioning',
  15633. fn: function (){
  15634. var self=this;
  15635. return smalltalk.withContext(function($ctx1) {
  15636. self._position_(self._size());
  15637. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)})},
  15638. args: [],
  15639. source: "setToEnd\x0a\x09self position: self size",
  15640. messageSends: ["position:", "size"],
  15641. referencedClasses: []
  15642. }),
  15643. globals.Stream);
  15644. smalltalk.addMethod(
  15645. smalltalk.method({
  15646. selector: "size",
  15647. protocol: 'accessing',
  15648. fn: function (){
  15649. var self=this;
  15650. return smalltalk.withContext(function($ctx1) {
  15651. var $1;
  15652. $1=self._streamSize();
  15653. return $1;
  15654. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)})},
  15655. args: [],
  15656. source: "size\x0a\x09^ self streamSize",
  15657. messageSends: ["streamSize"],
  15658. referencedClasses: []
  15659. }),
  15660. globals.Stream);
  15661. smalltalk.addMethod(
  15662. smalltalk.method({
  15663. selector: "skip:",
  15664. protocol: 'positioning',
  15665. fn: function (anInteger){
  15666. var self=this;
  15667. return smalltalk.withContext(function($ctx1) {
  15668. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  15669. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)})},
  15670. args: ["anInteger"],
  15671. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  15672. messageSends: ["position:", "min:max:", "+", "position", "size"],
  15673. referencedClasses: []
  15674. }),
  15675. globals.Stream);
  15676. smalltalk.addMethod(
  15677. smalltalk.method({
  15678. selector: "streamSize",
  15679. protocol: 'accessing',
  15680. fn: function (){
  15681. var self=this;
  15682. var $1;
  15683. $1=self["@streamSize"];
  15684. return $1;
  15685. },
  15686. args: [],
  15687. source: "streamSize\x0a\x09^ streamSize",
  15688. messageSends: [],
  15689. referencedClasses: []
  15690. }),
  15691. globals.Stream);
  15692. smalltalk.addMethod(
  15693. smalltalk.method({
  15694. selector: "write:",
  15695. protocol: 'writing',
  15696. fn: function (anObject){
  15697. var self=this;
  15698. return smalltalk.withContext(function($ctx1) {
  15699. _st(anObject)._putOn_(self);
  15700. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)})},
  15701. args: ["anObject"],
  15702. source: "write: anObject\x0a\x09anObject putOn: self",
  15703. messageSends: ["putOn:"],
  15704. referencedClasses: []
  15705. }),
  15706. globals.Stream);
  15707. smalltalk.addMethod(
  15708. smalltalk.method({
  15709. selector: "on:",
  15710. protocol: 'instance creation',
  15711. fn: function (aCollection){
  15712. var self=this;
  15713. return smalltalk.withContext(function($ctx1) {
  15714. var $2,$3,$1;
  15715. $2=self._new();
  15716. _st($2)._setCollection_(aCollection);
  15717. _st($2)._setStreamSize_(_st(aCollection)._size());
  15718. $3=_st($2)._yourself();
  15719. $1=$3;
  15720. return $1;
  15721. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)})},
  15722. args: ["aCollection"],
  15723. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  15724. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  15725. referencedClasses: []
  15726. }),
  15727. globals.Stream.klass);
  15728. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  15729. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  15730. smalltalk.addMethod(
  15731. smalltalk.method({
  15732. selector: "cr",
  15733. protocol: 'writing',
  15734. fn: function (){
  15735. var self=this;
  15736. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15737. return smalltalk.withContext(function($ctx1) {
  15738. var $1;
  15739. $1=self._nextPutAll_(_st($String())._cr());
  15740. return $1;
  15741. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)})},
  15742. args: [],
  15743. source: "cr\x0a\x09^ self nextPutAll: String cr",
  15744. messageSends: ["nextPutAll:", "cr"],
  15745. referencedClasses: ["String"]
  15746. }),
  15747. globals.StringStream);
  15748. smalltalk.addMethod(
  15749. smalltalk.method({
  15750. selector: "crlf",
  15751. protocol: 'writing',
  15752. fn: function (){
  15753. var self=this;
  15754. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15755. return smalltalk.withContext(function($ctx1) {
  15756. var $1;
  15757. $1=self._nextPutAll_(_st($String())._crlf());
  15758. return $1;
  15759. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)})},
  15760. args: [],
  15761. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  15762. messageSends: ["nextPutAll:", "crlf"],
  15763. referencedClasses: ["String"]
  15764. }),
  15765. globals.StringStream);
  15766. smalltalk.addMethod(
  15767. smalltalk.method({
  15768. selector: "lf",
  15769. protocol: 'writing',
  15770. fn: function (){
  15771. var self=this;
  15772. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15773. return smalltalk.withContext(function($ctx1) {
  15774. var $1;
  15775. $1=self._nextPutAll_(_st($String())._lf());
  15776. return $1;
  15777. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)})},
  15778. args: [],
  15779. source: "lf\x0a\x09^ self nextPutAll: String lf",
  15780. messageSends: ["nextPutAll:", "lf"],
  15781. referencedClasses: ["String"]
  15782. }),
  15783. globals.StringStream);
  15784. smalltalk.addMethod(
  15785. smalltalk.method({
  15786. selector: "next:",
  15787. protocol: 'reading',
  15788. fn: function (anInteger){
  15789. var self=this;
  15790. var tempCollection;
  15791. return smalltalk.withContext(function($ctx1) {
  15792. var $1,$2;
  15793. tempCollection=_st(_st(self._collection())._class())._new();
  15794. _st(anInteger)._timesRepeat_((function(){
  15795. return smalltalk.withContext(function($ctx2) {
  15796. $1=self._atEnd();
  15797. if(! smalltalk.assert($1)){
  15798. tempCollection=_st(tempCollection).__comma(self._next());
  15799. return tempCollection;
  15800. };
  15801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  15802. $2=tempCollection;
  15803. return $2;
  15804. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)})},
  15805. args: ["anInteger"],
  15806. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  15807. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  15808. referencedClasses: []
  15809. }),
  15810. globals.StringStream);
  15811. smalltalk.addMethod(
  15812. smalltalk.method({
  15813. selector: "nextPut:",
  15814. protocol: 'writing',
  15815. fn: function (aString){
  15816. var self=this;
  15817. return smalltalk.withContext(function($ctx1) {
  15818. self._nextPutAll_(aString);
  15819. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)})},
  15820. args: ["aString"],
  15821. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  15822. messageSends: ["nextPutAll:"],
  15823. referencedClasses: []
  15824. }),
  15825. globals.StringStream);
  15826. smalltalk.addMethod(
  15827. smalltalk.method({
  15828. selector: "nextPutAll:",
  15829. protocol: 'writing',
  15830. fn: function (aString){
  15831. var self=this;
  15832. var pre,post;
  15833. return smalltalk.withContext(function($ctx1) {
  15834. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  15835. $1=self._atEnd();
  15836. if(smalltalk.assert($1)){
  15837. $3=self._collection();
  15838. $ctx1.sendIdx["collection"]=1;
  15839. $2=_st($3).__comma(aString);
  15840. $ctx1.sendIdx[","]=1;
  15841. self._setCollection_($2);
  15842. $ctx1.sendIdx["setCollection:"]=1;
  15843. } else {
  15844. $4=self._collection();
  15845. $ctx1.sendIdx["collection"]=2;
  15846. $5=self._position();
  15847. $ctx1.sendIdx["position"]=1;
  15848. pre=_st($4)._copyFrom_to_((1),$5);
  15849. $ctx1.sendIdx["copyFrom:to:"]=1;
  15850. pre;
  15851. $6=self._collection();
  15852. $ctx1.sendIdx["collection"]=3;
  15853. $9=self._position();
  15854. $ctx1.sendIdx["position"]=2;
  15855. $8=_st($9).__plus((1));
  15856. $ctx1.sendIdx["+"]=2;
  15857. $10=_st(aString)._size();
  15858. $ctx1.sendIdx["size"]=1;
  15859. $7=_st($8).__plus($10);
  15860. $ctx1.sendIdx["+"]=1;
  15861. $11=_st(self._collection())._size();
  15862. $ctx1.sendIdx["size"]=2;
  15863. post=_st($6)._copyFrom_to_($7,$11);
  15864. post;
  15865. $12=_st(_st(pre).__comma(aString)).__comma(post);
  15866. $ctx1.sendIdx[","]=2;
  15867. self._setCollection_($12);
  15868. };
  15869. $14=self._position();
  15870. $ctx1.sendIdx["position"]=3;
  15871. $13=_st($14).__plus(_st(aString)._size());
  15872. self._position_($13);
  15873. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  15874. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)})},
  15875. args: ["aString"],
  15876. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  15877. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  15878. referencedClasses: []
  15879. }),
  15880. globals.StringStream);
  15881. smalltalk.addMethod(
  15882. smalltalk.method({
  15883. selector: "nextPutString:",
  15884. protocol: 'writing',
  15885. fn: function (aString){
  15886. var self=this;
  15887. return smalltalk.withContext(function($ctx1) {
  15888. self._nextPutAll_(aString);
  15889. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)})},
  15890. args: ["aString"],
  15891. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  15892. messageSends: ["nextPutAll:"],
  15893. referencedClasses: []
  15894. }),
  15895. globals.StringStream);
  15896. smalltalk.addMethod(
  15897. smalltalk.method({
  15898. selector: "space",
  15899. protocol: 'writing',
  15900. fn: function (){
  15901. var self=this;
  15902. return smalltalk.withContext(function($ctx1) {
  15903. self._nextPut_(" ");
  15904. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)})},
  15905. args: [],
  15906. source: "space\x0a\x09self nextPut: ' '",
  15907. messageSends: ["nextPut:"],
  15908. referencedClasses: []
  15909. }),
  15910. globals.StringStream);
  15911. smalltalk.addMethod(
  15912. smalltalk.method({
  15913. selector: "tab",
  15914. protocol: 'writing',
  15915. fn: function (){
  15916. var self=this;
  15917. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  15918. return smalltalk.withContext(function($ctx1) {
  15919. var $1;
  15920. $1=self._nextPutAll_(_st($String())._tab());
  15921. return $1;
  15922. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)})},
  15923. args: [],
  15924. source: "tab\x0a\x09^ self nextPutAll: String tab",
  15925. messageSends: ["nextPutAll:", "tab"],
  15926. referencedClasses: ["String"]
  15927. }),
  15928. globals.StringStream);
  15929. });
  15930. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  15931. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  15932. smalltalk.addPackage('Kernel-Infrastructure');
  15933. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  15934. smalltalk.addClass('ConsoleErrorHandler', globals.Object, [], 'Kernel-Infrastructure');
  15935. globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  15936. smalltalk.addMethod(
  15937. smalltalk.method({
  15938. selector: "handleError:",
  15939. protocol: 'error handling',
  15940. fn: function (anError){
  15941. var self=this;
  15942. return smalltalk.withContext(function($ctx1) {
  15943. var $1,$receiver;
  15944. $1=_st(anError)._context();
  15945. $ctx1.sendIdx["context"]=1;
  15946. if(($receiver = $1) == null || $receiver.isNil){
  15947. $1;
  15948. } else {
  15949. self._logErrorContext_(_st(anError)._context());
  15950. };
  15951. self._logError_(anError);
  15952. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ConsoleErrorHandler)})},
  15953. args: ["anError"],
  15954. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  15955. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"],
  15956. referencedClasses: []
  15957. }),
  15958. globals.ConsoleErrorHandler);
  15959. smalltalk.addMethod(
  15960. smalltalk.method({
  15961. selector: "log:",
  15962. protocol: 'private',
  15963. fn: function (aString){
  15964. var self=this;
  15965. return smalltalk.withContext(function($ctx1) {
  15966. _st(console)._log_(aString);
  15967. return self}, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},globals.ConsoleErrorHandler)})},
  15968. args: ["aString"],
  15969. source: "log: aString\x0a\x09console log: aString",
  15970. messageSends: ["log:"],
  15971. referencedClasses: []
  15972. }),
  15973. globals.ConsoleErrorHandler);
  15974. smalltalk.addMethod(
  15975. smalltalk.method({
  15976. selector: "logContext:",
  15977. protocol: 'private',
  15978. fn: function (aContext){
  15979. var self=this;
  15980. return smalltalk.withContext(function($ctx1) {
  15981. var $1,$receiver;
  15982. $1=_st(aContext)._home();
  15983. $ctx1.sendIdx["home"]=1;
  15984. if(($receiver = $1) == null || $receiver.isNil){
  15985. $1;
  15986. } else {
  15987. self._logContext_(_st(aContext)._home());
  15988. };
  15989. self._log_(_st(aContext)._asString());
  15990. return self}, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
  15991. args: ["aContext"],
  15992. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  15993. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"],
  15994. referencedClasses: []
  15995. }),
  15996. globals.ConsoleErrorHandler);
  15997. smalltalk.addMethod(
  15998. smalltalk.method({
  15999. selector: "logError:",
  16000. protocol: 'private',
  16001. fn: function (anError){
  16002. var self=this;
  16003. return smalltalk.withContext(function($ctx1) {
  16004. self._log_(_st(anError)._messageText());
  16005. return self}, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},globals.ConsoleErrorHandler)})},
  16006. args: ["anError"],
  16007. source: "logError: anError\x0a\x09self log: anError messageText",
  16008. messageSends: ["log:", "messageText"],
  16009. referencedClasses: []
  16010. }),
  16011. globals.ConsoleErrorHandler);
  16012. smalltalk.addMethod(
  16013. smalltalk.method({
  16014. selector: "logErrorContext:",
  16015. protocol: 'private',
  16016. fn: function (aContext){
  16017. var self=this;
  16018. return smalltalk.withContext(function($ctx1) {
  16019. var $1,$receiver;
  16020. if(($receiver = aContext) == null || $receiver.isNil){
  16021. aContext;
  16022. } else {
  16023. $1=_st(aContext)._home();
  16024. $ctx1.sendIdx["home"]=1;
  16025. if(($receiver = $1) == null || $receiver.isNil){
  16026. $1;
  16027. } else {
  16028. self._logContext_(_st(aContext)._home());
  16029. };
  16030. };
  16031. return self}, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},globals.ConsoleErrorHandler)})},
  16032. args: ["aContext"],
  16033. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  16034. messageSends: ["ifNotNil:", "home", "logContext:"],
  16035. referencedClasses: []
  16036. }),
  16037. globals.ConsoleErrorHandler);
  16038. globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  16039. smalltalk.addMethod(
  16040. smalltalk.method({
  16041. selector: "initialize",
  16042. protocol: 'initialization',
  16043. fn: function (){
  16044. var self=this;
  16045. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  16046. return smalltalk.withContext(function($ctx1) {
  16047. _st($ErrorHandler())._registerIfNone_(self._new());
  16048. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleErrorHandler.klass)})},
  16049. args: [],
  16050. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  16051. messageSends: ["registerIfNone:", "new"],
  16052. referencedClasses: ["ErrorHandler"]
  16053. }),
  16054. globals.ConsoleErrorHandler.klass);
  16055. smalltalk.addClass('InterfacingObject', globals.Object, [], 'Kernel-Infrastructure');
  16056. globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  16057. smalltalk.addMethod(
  16058. smalltalk.method({
  16059. selector: "ajax:",
  16060. protocol: 'actions',
  16061. fn: function (anObject){
  16062. var self=this;
  16063. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  16064. return smalltalk.withContext(function($ctx1) {
  16065. var $1;
  16066. $1=_st($PlatformInterface())._ajax_(anObject);
  16067. return $1;
  16068. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.InterfacingObject)})},
  16069. args: ["anObject"],
  16070. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  16071. messageSends: ["ajax:"],
  16072. referencedClasses: ["PlatformInterface"]
  16073. }),
  16074. globals.InterfacingObject);
  16075. smalltalk.addMethod(
  16076. smalltalk.method({
  16077. selector: "alert:",
  16078. protocol: 'actions',
  16079. fn: function (aString){
  16080. var self=this;
  16081. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  16082. return smalltalk.withContext(function($ctx1) {
  16083. var $1;
  16084. $1=_st($PlatformInterface())._alert_(aString);
  16085. return $1;
  16086. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.InterfacingObject)})},
  16087. args: ["aString"],
  16088. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  16089. messageSends: ["alert:"],
  16090. referencedClasses: ["PlatformInterface"]
  16091. }),
  16092. globals.InterfacingObject);
  16093. smalltalk.addMethod(
  16094. smalltalk.method({
  16095. selector: "confirm:",
  16096. protocol: 'actions',
  16097. fn: function (aString){
  16098. var self=this;
  16099. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  16100. return smalltalk.withContext(function($ctx1) {
  16101. var $1;
  16102. $1=_st($PlatformInterface())._confirm_(aString);
  16103. return $1;
  16104. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.InterfacingObject)})},
  16105. args: ["aString"],
  16106. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  16107. messageSends: ["confirm:"],
  16108. referencedClasses: ["PlatformInterface"]
  16109. }),
  16110. globals.InterfacingObject);
  16111. smalltalk.addMethod(
  16112. smalltalk.method({
  16113. selector: "prompt:",
  16114. protocol: 'actions',
  16115. fn: function (aString){
  16116. var self=this;
  16117. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  16118. return smalltalk.withContext(function($ctx1) {
  16119. var $1;
  16120. $1=_st($PlatformInterface())._prompt_(aString);
  16121. return $1;
  16122. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.InterfacingObject)})},
  16123. args: ["aString"],
  16124. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  16125. messageSends: ["prompt:"],
  16126. referencedClasses: ["PlatformInterface"]
  16127. }),
  16128. globals.InterfacingObject);
  16129. smalltalk.addMethod(
  16130. smalltalk.method({
  16131. selector: "prompt:default:",
  16132. protocol: 'actions',
  16133. fn: function (aString,defaultString){
  16134. var self=this;
  16135. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  16136. return smalltalk.withContext(function($ctx1) {
  16137. var $1;
  16138. $1=_st($PlatformInterface())._prompt_default_(aString,defaultString);
  16139. return $1;
  16140. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.InterfacingObject)})},
  16141. args: ["aString", "defaultString"],
  16142. source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
  16143. messageSends: ["prompt:default:"],
  16144. referencedClasses: ["PlatformInterface"]
  16145. }),
  16146. globals.InterfacingObject);
  16147. smalltalk.addClass('Environment', globals.InterfacingObject, [], 'Kernel-Infrastructure');
  16148. globals.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.";
  16149. smalltalk.addMethod(
  16150. smalltalk.method({
  16151. selector: "addInstVarNamed:to:",
  16152. protocol: 'compiling',
  16153. fn: function (aString,aClass){
  16154. var self=this;
  16155. return smalltalk.withContext(function($ctx1) {
  16156. var $1,$2,$3,$4,$5;
  16157. $1=self._classBuilder();
  16158. $2=_st(aClass)._superclass();
  16159. $3=_st(aClass)._name();
  16160. $ctx1.sendIdx["name"]=1;
  16161. $4=_st(_st(aClass)._instanceVariableNames())._copy();
  16162. _st($4)._add_(aString);
  16163. $5=_st($4)._yourself();
  16164. _st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
  16165. return self}, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},globals.Environment)})},
  16166. args: ["aString", "aClass"],
  16167. 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",
  16168. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"],
  16169. referencedClasses: []
  16170. }),
  16171. globals.Environment);
  16172. smalltalk.addMethod(
  16173. smalltalk.method({
  16174. selector: "allSelectors",
  16175. protocol: 'accessing',
  16176. fn: function (){
  16177. var self=this;
  16178. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16179. return smalltalk.withContext(function($ctx1) {
  16180. var $1;
  16181. $1=_st(_st($Smalltalk())._vm())._allSelectors();
  16182. return $1;
  16183. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Environment)})},
  16184. args: [],
  16185. source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
  16186. messageSends: ["allSelectors", "vm"],
  16187. referencedClasses: ["Smalltalk"]
  16188. }),
  16189. globals.Environment);
  16190. smalltalk.addMethod(
  16191. smalltalk.method({
  16192. selector: "availableClassNames",
  16193. protocol: 'accessing',
  16194. fn: function (){
  16195. var self=this;
  16196. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16197. return smalltalk.withContext(function($ctx1) {
  16198. var $1;
  16199. $1=_st(_st($Smalltalk())._classes())._collect_((function(each){
  16200. return smalltalk.withContext(function($ctx2) {
  16201. return _st(each)._name();
  16202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16203. return $1;
  16204. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.Environment)})},
  16205. args: [],
  16206. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  16207. messageSends: ["collect:", "classes", "name"],
  16208. referencedClasses: ["Smalltalk"]
  16209. }),
  16210. globals.Environment);
  16211. smalltalk.addMethod(
  16212. smalltalk.method({
  16213. selector: "availablePackageNames",
  16214. protocol: 'accessing',
  16215. fn: function (){
  16216. var self=this;
  16217. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16218. return smalltalk.withContext(function($ctx1) {
  16219. var $1;
  16220. $1=_st(_st($Smalltalk())._packages())._collect_((function(each){
  16221. return smalltalk.withContext(function($ctx2) {
  16222. return _st(each)._name();
  16223. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16224. return $1;
  16225. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.Environment)})},
  16226. args: [],
  16227. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  16228. messageSends: ["collect:", "packages", "name"],
  16229. referencedClasses: ["Smalltalk"]
  16230. }),
  16231. globals.Environment);
  16232. smalltalk.addMethod(
  16233. smalltalk.method({
  16234. selector: "availableProtocolsFor:",
  16235. protocol: 'accessing',
  16236. fn: function (aClass){
  16237. var self=this;
  16238. var protocols;
  16239. return smalltalk.withContext(function($ctx1) {
  16240. var $1,$2,$receiver;
  16241. protocols=_st(aClass)._protocols();
  16242. $1=_st(aClass)._superclass();
  16243. $ctx1.sendIdx["superclass"]=1;
  16244. if(($receiver = $1) == null || $receiver.isNil){
  16245. $1;
  16246. } else {
  16247. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  16248. };
  16249. $2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
  16250. return $2;
  16251. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},globals.Environment)})},
  16252. args: ["aClass"],
  16253. 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 sort",
  16254. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"],
  16255. referencedClasses: []
  16256. }),
  16257. globals.Environment);
  16258. smalltalk.addMethod(
  16259. smalltalk.method({
  16260. selector: "classBuilder",
  16261. protocol: 'accessing',
  16262. fn: function (){
  16263. var self=this;
  16264. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  16265. return smalltalk.withContext(function($ctx1) {
  16266. var $1;
  16267. $1=_st($ClassBuilder())._new();
  16268. return $1;
  16269. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},globals.Environment)})},
  16270. args: [],
  16271. source: "classBuilder\x0a\x09^ ClassBuilder new",
  16272. messageSends: ["new"],
  16273. referencedClasses: ["ClassBuilder"]
  16274. }),
  16275. globals.Environment);
  16276. smalltalk.addMethod(
  16277. smalltalk.method({
  16278. selector: "classNamed:",
  16279. protocol: 'accessing',
  16280. fn: function (aString){
  16281. var self=this;
  16282. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16283. return smalltalk.withContext(function($ctx1) {
  16284. var $2,$1,$receiver;
  16285. $2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
  16286. if(($receiver = $2) == null || $receiver.isNil){
  16287. $1=self._error_("Invalid class name");
  16288. } else {
  16289. $1=$2;
  16290. };
  16291. return $1;
  16292. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},globals.Environment)})},
  16293. args: ["aString"],
  16294. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  16295. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"],
  16296. referencedClasses: ["Smalltalk"]
  16297. }),
  16298. globals.Environment);
  16299. smalltalk.addMethod(
  16300. smalltalk.method({
  16301. selector: "classes",
  16302. protocol: 'accessing',
  16303. fn: function (){
  16304. var self=this;
  16305. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16306. return smalltalk.withContext(function($ctx1) {
  16307. var $1;
  16308. $1=_st($Smalltalk())._classes();
  16309. return $1;
  16310. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Environment)})},
  16311. args: [],
  16312. source: "classes\x0a\x09^ Smalltalk classes",
  16313. messageSends: ["classes"],
  16314. referencedClasses: ["Smalltalk"]
  16315. }),
  16316. globals.Environment);
  16317. smalltalk.addMethod(
  16318. smalltalk.method({
  16319. selector: "commitPackage:onSuccess:onError:",
  16320. protocol: 'actions',
  16321. fn: function (aPackage,aBlock,anotherBlock){
  16322. var self=this;
  16323. return smalltalk.withContext(function($ctx1) {
  16324. _st(_st(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  16325. return self}, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.Environment)})},
  16326. args: ["aPackage", "aBlock", "anotherBlock"],
  16327. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  16328. messageSends: ["commitOnSuccess:onError:", "transport"],
  16329. referencedClasses: []
  16330. }),
  16331. globals.Environment);
  16332. smalltalk.addMethod(
  16333. smalltalk.method({
  16334. selector: "compileClassComment:for:",
  16335. protocol: 'compiling',
  16336. fn: function (aString,aClass){
  16337. var self=this;
  16338. return smalltalk.withContext(function($ctx1) {
  16339. _st(aClass)._comment_(aString);
  16340. return self}, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},globals.Environment)})},
  16341. args: ["aString", "aClass"],
  16342. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  16343. messageSends: ["comment:"],
  16344. referencedClasses: []
  16345. }),
  16346. globals.Environment);
  16347. smalltalk.addMethod(
  16348. smalltalk.method({
  16349. selector: "compileClassDefinition:",
  16350. protocol: 'compiling',
  16351. fn: function (aString){
  16352. var self=this;
  16353. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  16354. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  16355. return smalltalk.withContext(function($ctx1) {
  16356. _st((function(){
  16357. return smalltalk.withContext(function($ctx2) {
  16358. return self._evaluate_for_(aString,_st($DoIt())._new());
  16359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  16360. return smalltalk.withContext(function($ctx2) {
  16361. return self._alert_(_st(error)._messageText());
  16362. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  16363. return self}, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.Environment)})},
  16364. args: ["aString"],
  16365. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  16366. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"],
  16367. referencedClasses: ["DoIt", "Error"]
  16368. }),
  16369. globals.Environment);
  16370. smalltalk.addMethod(
  16371. smalltalk.method({
  16372. selector: "compileMethod:for:protocol:",
  16373. protocol: 'compiling',
  16374. fn: function (sourceCode,class_,protocol){
  16375. var self=this;
  16376. return smalltalk.withContext(function($ctx1) {
  16377. var $1;
  16378. $1=_st(class_)._compile_protocol_(sourceCode,protocol);
  16379. return $1;
  16380. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},globals.Environment)})},
  16381. args: ["sourceCode", "class", "protocol"],
  16382. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  16383. messageSends: ["compile:protocol:"],
  16384. referencedClasses: []
  16385. }),
  16386. globals.Environment);
  16387. smalltalk.addMethod(
  16388. smalltalk.method({
  16389. selector: "copyClass:to:",
  16390. protocol: 'actions',
  16391. fn: function (aClass,aClassName){
  16392. var self=this;
  16393. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16394. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  16395. return smalltalk.withContext(function($ctx1) {
  16396. var $1,$2,$receiver;
  16397. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  16398. if(($receiver = $1) == null || $receiver.isNil){
  16399. $1;
  16400. } else {
  16401. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  16402. $ctx1.sendIdx[","]=1;
  16403. self._error_($2);
  16404. };
  16405. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  16406. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
  16407. args: ["aClass", "aClassName"],
  16408. source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
  16409. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"],
  16410. referencedClasses: ["Smalltalk", "ClassBuilder"]
  16411. }),
  16412. globals.Environment);
  16413. smalltalk.addMethod(
  16414. smalltalk.method({
  16415. selector: "doItReceiver",
  16416. protocol: 'accessing',
  16417. fn: function (){
  16418. var self=this;
  16419. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  16420. return smalltalk.withContext(function($ctx1) {
  16421. var $1;
  16422. $1=_st($DoIt())._new();
  16423. return $1;
  16424. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},globals.Environment)})},
  16425. args: [],
  16426. source: "doItReceiver\x0a\x09^ DoIt new",
  16427. messageSends: ["new"],
  16428. referencedClasses: ["DoIt"]
  16429. }),
  16430. globals.Environment);
  16431. smalltalk.addMethod(
  16432. smalltalk.method({
  16433. selector: "evaluate:for:",
  16434. protocol: 'evaluating',
  16435. fn: function (aString,anObject){
  16436. var self=this;
  16437. function $Evaluator(){return globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  16438. return smalltalk.withContext(function($ctx1) {
  16439. var $1;
  16440. $1=_st($Evaluator())._evaluate_for_(aString,anObject);
  16441. return $1;
  16442. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Environment)})},
  16443. args: ["aString", "anObject"],
  16444. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  16445. messageSends: ["evaluate:for:"],
  16446. referencedClasses: ["Evaluator"]
  16447. }),
  16448. globals.Environment);
  16449. smalltalk.addMethod(
  16450. smalltalk.method({
  16451. selector: "evaluate:on:do:",
  16452. protocol: 'error handling',
  16453. fn: function (aBlock,anErrorClass,exceptionBlock){
  16454. var self=this;
  16455. return smalltalk.withContext(function($ctx1) {
  16456. var $1;
  16457. _st(aBlock)._tryCatch_((function(exception){
  16458. return smalltalk.withContext(function($ctx2) {
  16459. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  16460. if(smalltalk.assert($1)){
  16461. return _st(exceptionBlock)._value_(exception);
  16462. } else {
  16463. return _st(exception)._signal();
  16464. };
  16465. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)})}));
  16466. return self}, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},globals.Environment)})},
  16467. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  16468. source: "evaluate: aBlock on: anErrorClass do: exceptionBlock\x0a\x09\x22Evaluate a block and catch exceptions happening on the environment stack\x22\x0a\x09\x0a\x09aBlock tryCatch: [ :exception | \x0a\x09\x09(exception isKindOf: (self classNamed: anErrorClass name))\x0a\x09\x09\x09ifTrue: [ exceptionBlock value: exception ]\x0a \x09\x09\x09ifFalse: [ exception signal ] ]",
  16469. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"],
  16470. referencedClasses: []
  16471. }),
  16472. globals.Environment);
  16473. smalltalk.addMethod(
  16474. smalltalk.method({
  16475. selector: "inspect:",
  16476. protocol: 'actions',
  16477. fn: function (anObject){
  16478. var self=this;
  16479. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  16480. return smalltalk.withContext(function($ctx1) {
  16481. _st($Inspector())._inspect_(anObject);
  16482. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Environment)})},
  16483. args: ["anObject"],
  16484. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  16485. messageSends: ["inspect:"],
  16486. referencedClasses: ["Inspector"]
  16487. }),
  16488. globals.Environment);
  16489. smalltalk.addMethod(
  16490. smalltalk.method({
  16491. selector: "moveClass:toPackage:",
  16492. protocol: 'actions',
  16493. fn: function (aClass,aPackageName){
  16494. var self=this;
  16495. var package_;
  16496. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  16497. return smalltalk.withContext(function($ctx1) {
  16498. var $1,$2,$receiver;
  16499. package_=_st($Package())._named_(aPackageName);
  16500. $1=package_;
  16501. if(($receiver = $1) == null || $receiver.isNil){
  16502. self._error_("Invalid package name");
  16503. } else {
  16504. $1;
  16505. };
  16506. $2=_st(package_).__eq_eq(_st(aClass)._package());
  16507. if(smalltalk.assert($2)){
  16508. return self;
  16509. };
  16510. _st(aClass)._package_(package_);
  16511. return self}, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)})},
  16512. args: ["aClass", "aPackageName"],
  16513. 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",
  16514. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"],
  16515. referencedClasses: ["Package"]
  16516. }),
  16517. globals.Environment);
  16518. smalltalk.addMethod(
  16519. smalltalk.method({
  16520. selector: "moveMethod:toClass:",
  16521. protocol: 'actions',
  16522. fn: function (aMethod,aClassName){
  16523. var self=this;
  16524. var destinationClass;
  16525. return smalltalk.withContext(function($ctx1) {
  16526. var $2,$3,$1,$5,$4;
  16527. destinationClass=self._classNamed_(aClassName);
  16528. $2=destinationClass;
  16529. $3=_st(aMethod)._methodClass();
  16530. $ctx1.sendIdx["methodClass"]=1;
  16531. $1=_st($2).__eq_eq($3);
  16532. if(smalltalk.assert($1)){
  16533. return self;
  16534. };
  16535. $5=_st(aMethod)._methodClass();
  16536. $ctx1.sendIdx["methodClass"]=2;
  16537. $4=_st($5)._isMetaclass();
  16538. if(smalltalk.assert($4)){
  16539. destinationClass=_st(destinationClass)._class();
  16540. destinationClass;
  16541. };
  16542. _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
  16543. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  16544. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)})},
  16545. args: ["aMethod", "aClassName"],
  16546. source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09aMethod methodClass isMetaclass ifTrue: [ \x0a\x09\x09destinationClass := destinationClass class ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
  16547. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
  16548. referencedClasses: []
  16549. }),
  16550. globals.Environment);
  16551. smalltalk.addMethod(
  16552. smalltalk.method({
  16553. selector: "moveMethod:toProtocol:",
  16554. protocol: 'actions',
  16555. fn: function (aMethod,aProtocol){
  16556. var self=this;
  16557. return smalltalk.withContext(function($ctx1) {
  16558. _st(aMethod)._protocol_(aProtocol);
  16559. return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)})},
  16560. args: ["aMethod", "aProtocol"],
  16561. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  16562. messageSends: ["protocol:"],
  16563. referencedClasses: []
  16564. }),
  16565. globals.Environment);
  16566. smalltalk.addMethod(
  16567. smalltalk.method({
  16568. selector: "packages",
  16569. protocol: 'accessing',
  16570. fn: function (){
  16571. var self=this;
  16572. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16573. return smalltalk.withContext(function($ctx1) {
  16574. var $1;
  16575. $1=_st($Smalltalk())._packages();
  16576. return $1;
  16577. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)})},
  16578. args: [],
  16579. source: "packages\x0a\x09^ Smalltalk packages",
  16580. messageSends: ["packages"],
  16581. referencedClasses: ["Smalltalk"]
  16582. }),
  16583. globals.Environment);
  16584. smalltalk.addMethod(
  16585. smalltalk.method({
  16586. selector: "registerErrorHandler:",
  16587. protocol: 'services',
  16588. fn: function (anErrorHandler){
  16589. var self=this;
  16590. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  16591. return smalltalk.withContext(function($ctx1) {
  16592. _st($ErrorHandler())._register_(anErrorHandler);
  16593. return self}, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)})},
  16594. args: ["anErrorHandler"],
  16595. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  16596. messageSends: ["register:"],
  16597. referencedClasses: ["ErrorHandler"]
  16598. }),
  16599. globals.Environment);
  16600. smalltalk.addMethod(
  16601. smalltalk.method({
  16602. selector: "registerFinder:",
  16603. protocol: 'services',
  16604. fn: function (aFinder){
  16605. var self=this;
  16606. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  16607. return smalltalk.withContext(function($ctx1) {
  16608. _st($Finder())._register_(aFinder);
  16609. return self}, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},globals.Environment)})},
  16610. args: ["aFinder"],
  16611. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  16612. messageSends: ["register:"],
  16613. referencedClasses: ["Finder"]
  16614. }),
  16615. globals.Environment);
  16616. smalltalk.addMethod(
  16617. smalltalk.method({
  16618. selector: "registerInspector:",
  16619. protocol: 'services',
  16620. fn: function (anInspector){
  16621. var self=this;
  16622. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  16623. return smalltalk.withContext(function($ctx1) {
  16624. _st($Inspector())._register_(anInspector);
  16625. return self}, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)})},
  16626. args: ["anInspector"],
  16627. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  16628. messageSends: ["register:"],
  16629. referencedClasses: ["Inspector"]
  16630. }),
  16631. globals.Environment);
  16632. smalltalk.addMethod(
  16633. smalltalk.method({
  16634. selector: "registerProgressHandler:",
  16635. protocol: 'services',
  16636. fn: function (aProgressHandler){
  16637. var self=this;
  16638. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  16639. return smalltalk.withContext(function($ctx1) {
  16640. _st($ProgressHandler())._register_(aProgressHandler);
  16641. return self}, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)})},
  16642. args: ["aProgressHandler"],
  16643. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  16644. messageSends: ["register:"],
  16645. referencedClasses: ["ProgressHandler"]
  16646. }),
  16647. globals.Environment);
  16648. smalltalk.addMethod(
  16649. smalltalk.method({
  16650. selector: "registerTranscript:",
  16651. protocol: 'services',
  16652. fn: function (aTranscript){
  16653. var self=this;
  16654. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  16655. return smalltalk.withContext(function($ctx1) {
  16656. _st($Transcript())._register_(aTranscript);
  16657. return self}, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)})},
  16658. args: ["aTranscript"],
  16659. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  16660. messageSends: ["register:"],
  16661. referencedClasses: ["Transcript"]
  16662. }),
  16663. globals.Environment);
  16664. smalltalk.addMethod(
  16665. smalltalk.method({
  16666. selector: "removeClass:",
  16667. protocol: 'actions',
  16668. fn: function (aClass){
  16669. var self=this;
  16670. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16671. return smalltalk.withContext(function($ctx1) {
  16672. _st($Smalltalk())._removeClass_(aClass);
  16673. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)})},
  16674. args: ["aClass"],
  16675. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  16676. messageSends: ["removeClass:"],
  16677. referencedClasses: ["Smalltalk"]
  16678. }),
  16679. globals.Environment);
  16680. smalltalk.addMethod(
  16681. smalltalk.method({
  16682. selector: "removeMethod:",
  16683. protocol: 'actions',
  16684. fn: function (aMethod){
  16685. var self=this;
  16686. return smalltalk.withContext(function($ctx1) {
  16687. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  16688. return self}, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)})},
  16689. args: ["aMethod"],
  16690. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  16691. messageSends: ["removeCompiledMethod:", "methodClass"],
  16692. referencedClasses: []
  16693. }),
  16694. globals.Environment);
  16695. smalltalk.addMethod(
  16696. smalltalk.method({
  16697. selector: "removeProtocol:from:",
  16698. protocol: 'actions',
  16699. fn: function (aString,aClass){
  16700. var self=this;
  16701. return smalltalk.withContext(function($ctx1) {
  16702. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  16703. return smalltalk.withContext(function($ctx2) {
  16704. return _st(aClass)._removeCompiledMethod_(each);
  16705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16706. return self}, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)})},
  16707. args: ["aString", "aClass"],
  16708. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  16709. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"],
  16710. referencedClasses: []
  16711. }),
  16712. globals.Environment);
  16713. smalltalk.addMethod(
  16714. smalltalk.method({
  16715. selector: "renameClass:to:",
  16716. protocol: 'actions',
  16717. fn: function (aClass,aClassName){
  16718. var self=this;
  16719. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16720. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  16721. return smalltalk.withContext(function($ctx1) {
  16722. var $1,$2,$receiver;
  16723. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  16724. if(($receiver = $1) == null || $receiver.isNil){
  16725. $1;
  16726. } else {
  16727. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  16728. $ctx1.sendIdx[","]=1;
  16729. self._error_($2);
  16730. };
  16731. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  16732. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)})},
  16733. args: ["aClass", "aClassName"],
  16734. source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
  16735. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"],
  16736. referencedClasses: ["Smalltalk", "ClassBuilder"]
  16737. }),
  16738. globals.Environment);
  16739. smalltalk.addMethod(
  16740. smalltalk.method({
  16741. selector: "renameProtocol:to:in:",
  16742. protocol: 'actions',
  16743. fn: function (aString,anotherString,aClass){
  16744. var self=this;
  16745. return smalltalk.withContext(function($ctx1) {
  16746. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  16747. return smalltalk.withContext(function($ctx2) {
  16748. return _st(each)._protocol_(anotherString);
  16749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  16750. return self}, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)})},
  16751. args: ["aString", "anotherString", "aClass"],
  16752. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  16753. messageSends: ["do:", "methodsInProtocol:", "protocol:"],
  16754. referencedClasses: []
  16755. }),
  16756. globals.Environment);
  16757. smalltalk.addMethod(
  16758. smalltalk.method({
  16759. selector: "setClassCommentOf:to:",
  16760. protocol: 'actions',
  16761. fn: function (aClass,aString){
  16762. var self=this;
  16763. return smalltalk.withContext(function($ctx1) {
  16764. _st(aClass)._comment_(aString);
  16765. return self}, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)})},
  16766. args: ["aClass", "aString"],
  16767. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  16768. messageSends: ["comment:"],
  16769. referencedClasses: []
  16770. }),
  16771. globals.Environment);
  16772. smalltalk.addMethod(
  16773. smalltalk.method({
  16774. selector: "systemAnnouncer",
  16775. protocol: 'accessing',
  16776. fn: function (){
  16777. var self=this;
  16778. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  16779. return smalltalk.withContext(function($ctx1) {
  16780. var $1;
  16781. $1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  16782. return $1;
  16783. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)})},
  16784. args: [],
  16785. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  16786. messageSends: ["current", "at:", "globals"],
  16787. referencedClasses: ["Smalltalk"]
  16788. }),
  16789. globals.Environment);
  16790. smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  16791. globals.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`.";
  16792. smalltalk.addMethod(
  16793. smalltalk.method({
  16794. selector: "=",
  16795. protocol: 'comparing',
  16796. fn: function (anObject){
  16797. var self=this;
  16798. return smalltalk.withContext(function($ctx1) {
  16799. var $2,$1,$3;
  16800. $2=_st(anObject)._class();
  16801. $ctx1.sendIdx["class"]=1;
  16802. $1=_st($2).__eq_eq(self._class());
  16803. if(! smalltalk.assert($1)){
  16804. return false;
  16805. };
  16806. $3=self._compareJSObjectWith_(_st(anObject)._jsObject());
  16807. return $3;
  16808. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)})},
  16809. args: ["anObject"],
  16810. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
  16811. messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"],
  16812. referencedClasses: []
  16813. }),
  16814. globals.JSObjectProxy);
  16815. smalltalk.addMethod(
  16816. smalltalk.method({
  16817. selector: "addObjectVariablesTo:",
  16818. protocol: 'proxy',
  16819. fn: function (aDictionary){
  16820. var self=this;
  16821. return smalltalk.withContext(function($ctx1) {
  16822. for(var i in self['@jsObject']) {
  16823. aDictionary._at_put_(i, self['@jsObject'][i]);
  16824. }
  16825. ;
  16826. return self}, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)})},
  16827. args: ["aDictionary"],
  16828. 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>",
  16829. messageSends: [],
  16830. referencedClasses: []
  16831. }),
  16832. globals.JSObjectProxy);
  16833. smalltalk.addMethod(
  16834. smalltalk.method({
  16835. selector: "asJSON",
  16836. protocol: 'enumerating',
  16837. fn: function (){
  16838. var self=this;
  16839. var $1;
  16840. $1=self["@jsObject"];
  16841. return $1;
  16842. },
  16843. args: [],
  16844. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  16845. messageSends: [],
  16846. referencedClasses: []
  16847. }),
  16848. globals.JSObjectProxy);
  16849. smalltalk.addMethod(
  16850. smalltalk.method({
  16851. selector: "at:",
  16852. protocol: 'accessing',
  16853. fn: function (aString){
  16854. var self=this;
  16855. return smalltalk.withContext(function($ctx1) {
  16856. return self['@jsObject'][aString];
  16857. return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)})},
  16858. args: ["aString"],
  16859. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  16860. messageSends: [],
  16861. referencedClasses: []
  16862. }),
  16863. globals.JSObjectProxy);
  16864. smalltalk.addMethod(
  16865. smalltalk.method({
  16866. selector: "at:ifAbsent:",
  16867. protocol: 'accessing',
  16868. fn: function (aString,aBlock){
  16869. var self=this;
  16870. return smalltalk.withContext(function($ctx1) {
  16871. var obj = self['@jsObject'];
  16872. return aString in obj ? obj[aString] : aBlock._value();
  16873. ;
  16874. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  16875. args: ["aString", "aBlock"],
  16876. 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._value();\x0a\x09>",
  16877. messageSends: [],
  16878. referencedClasses: []
  16879. }),
  16880. globals.JSObjectProxy);
  16881. smalltalk.addMethod(
  16882. smalltalk.method({
  16883. selector: "at:ifPresent:",
  16884. protocol: 'accessing',
  16885. fn: function (aString,aBlock){
  16886. var self=this;
  16887. return smalltalk.withContext(function($ctx1) {
  16888. var obj = self['@jsObject'];
  16889. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  16890. ;
  16891. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)})},
  16892. args: ["aString", "aBlock"],
  16893. 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._value_(obj[aString]) : nil;\x0a\x09>",
  16894. messageSends: [],
  16895. referencedClasses: []
  16896. }),
  16897. globals.JSObjectProxy);
  16898. smalltalk.addMethod(
  16899. smalltalk.method({
  16900. selector: "at:ifPresent:ifAbsent:",
  16901. protocol: 'accessing',
  16902. fn: function (aString,aBlock,anotherBlock){
  16903. var self=this;
  16904. return smalltalk.withContext(function($ctx1) {
  16905. var obj = self['@jsObject'];
  16906. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  16907. ;
  16908. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)})},
  16909. args: ["aString", "aBlock", "anotherBlock"],
  16910. 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._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  16911. messageSends: [],
  16912. referencedClasses: []
  16913. }),
  16914. globals.JSObjectProxy);
  16915. smalltalk.addMethod(
  16916. smalltalk.method({
  16917. selector: "at:put:",
  16918. protocol: 'accessing',
  16919. fn: function (aString,anObject){
  16920. var self=this;
  16921. return smalltalk.withContext(function($ctx1) {
  16922. return self['@jsObject'][aString] = anObject;
  16923. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)})},
  16924. args: ["aString", "anObject"],
  16925. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  16926. messageSends: [],
  16927. referencedClasses: []
  16928. }),
  16929. globals.JSObjectProxy);
  16930. smalltalk.addMethod(
  16931. smalltalk.method({
  16932. selector: "compareJSObjectWith:",
  16933. protocol: 'private',
  16934. fn: function (aJSObject){
  16935. var self=this;
  16936. return smalltalk.withContext(function($ctx1) {
  16937. return self["@jsObject"] === aJSObject;
  16938. return self}, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)})},
  16939. args: ["aJSObject"],
  16940. source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
  16941. messageSends: [],
  16942. referencedClasses: []
  16943. }),
  16944. globals.JSObjectProxy);
  16945. smalltalk.addMethod(
  16946. smalltalk.method({
  16947. selector: "doesNotUnderstand:",
  16948. protocol: 'proxy',
  16949. fn: function (aMessage){
  16950. var self=this;
  16951. return smalltalk.withContext(function($ctx1) {
  16952. var $2,$1,$receiver;
  16953. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptSelector());
  16954. if(($receiver = $2) == null || $receiver.isNil){
  16955. $1=($ctx1.supercall = true, globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]));
  16956. $ctx1.supercall = false;
  16957. } else {
  16958. var jsSelector;
  16959. jsSelector=$receiver;
  16960. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  16961. };
  16962. return $1;
  16963. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)})},
  16964. args: ["aMessage"],
  16965. 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 ]",
  16966. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptSelector", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"],
  16967. referencedClasses: []
  16968. }),
  16969. globals.JSObjectProxy);
  16970. smalltalk.addMethod(
  16971. smalltalk.method({
  16972. selector: "forwardMessage:withArguments:",
  16973. protocol: 'proxy',
  16974. fn: function (aString,anArray){
  16975. var self=this;
  16976. return smalltalk.withContext(function($ctx1) {
  16977. return smalltalk.send(self._jsObject(), aString, anArray);
  16978. ;
  16979. return self}, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)})},
  16980. args: ["aString", "anArray"],
  16981. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.send(self._jsObject(), aString, anArray);\x0a\x09>",
  16982. messageSends: [],
  16983. referencedClasses: []
  16984. }),
  16985. globals.JSObjectProxy);
  16986. smalltalk.addMethod(
  16987. smalltalk.method({
  16988. selector: "inspectOn:",
  16989. protocol: 'proxy',
  16990. fn: function (anInspector){
  16991. var self=this;
  16992. var variables;
  16993. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  16994. return smalltalk.withContext(function($ctx1) {
  16995. variables=_st($Dictionary())._new();
  16996. _st(variables)._at_put_("#self",self._jsObject());
  16997. _st(anInspector)._setLabel_(self._printString());
  16998. self._addObjectVariablesTo_(variables);
  16999. _st(anInspector)._setVariables_(variables);
  17000. return self}, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)})},
  17001. args: ["anInspector"],
  17002. 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",
  17003. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"],
  17004. referencedClasses: ["Dictionary"]
  17005. }),
  17006. globals.JSObjectProxy);
  17007. smalltalk.addMethod(
  17008. smalltalk.method({
  17009. selector: "jsObject",
  17010. protocol: 'accessing',
  17011. fn: function (){
  17012. var self=this;
  17013. var $1;
  17014. $1=self["@jsObject"];
  17015. return $1;
  17016. },
  17017. args: [],
  17018. source: "jsObject\x0a\x09^ jsObject",
  17019. messageSends: [],
  17020. referencedClasses: []
  17021. }),
  17022. globals.JSObjectProxy);
  17023. smalltalk.addMethod(
  17024. smalltalk.method({
  17025. selector: "jsObject:",
  17026. protocol: 'accessing',
  17027. fn: function (aJSObject){
  17028. var self=this;
  17029. self["@jsObject"]=aJSObject;
  17030. return self},
  17031. args: ["aJSObject"],
  17032. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  17033. messageSends: [],
  17034. referencedClasses: []
  17035. }),
  17036. globals.JSObjectProxy);
  17037. smalltalk.addMethod(
  17038. smalltalk.method({
  17039. selector: "keysAndValuesDo:",
  17040. protocol: 'enumerating',
  17041. fn: function (aBlock){
  17042. var self=this;
  17043. return smalltalk.withContext(function($ctx1) {
  17044. var o = self['@jsObject'];
  17045. for(var i in o) {
  17046. aBlock._value_value_(i, o[i]);
  17047. }
  17048. ;
  17049. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)})},
  17050. args: ["aBlock"],
  17051. source: "keysAndValuesDo: aBlock\x0a\x09<\x0a\x09\x09var o = self['@jsObject'];\x0a\x09\x09for(var i in o) {\x0a\x09\x09\x09aBlock._value_value_(i, o[i]);\x0a\x09\x09}\x0a\x09>",
  17052. messageSends: [],
  17053. referencedClasses: []
  17054. }),
  17055. globals.JSObjectProxy);
  17056. smalltalk.addMethod(
  17057. smalltalk.method({
  17058. selector: "lookupProperty:",
  17059. protocol: 'accessing',
  17060. fn: function (aString){
  17061. var self=this;
  17062. return smalltalk.withContext(function($ctx1) {
  17063. return aString in self._jsObject() ? aString : nil;
  17064. return self}, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)})},
  17065. args: ["aString"],
  17066. 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>",
  17067. messageSends: [],
  17068. referencedClasses: []
  17069. }),
  17070. globals.JSObjectProxy);
  17071. smalltalk.addMethod(
  17072. smalltalk.method({
  17073. selector: "printOn:",
  17074. protocol: 'printing',
  17075. fn: function (aStream){
  17076. var self=this;
  17077. return smalltalk.withContext(function($ctx1) {
  17078. _st(aStream)._nextPutAll_(self._printString());
  17079. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)})},
  17080. args: ["aStream"],
  17081. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  17082. messageSends: ["nextPutAll:", "printString"],
  17083. referencedClasses: []
  17084. }),
  17085. globals.JSObjectProxy);
  17086. smalltalk.addMethod(
  17087. smalltalk.method({
  17088. selector: "printString",
  17089. protocol: 'printing',
  17090. fn: function (){
  17091. var self=this;
  17092. return smalltalk.withContext(function($ctx1) {
  17093. var js = self['@jsObject'];
  17094. return js.toString
  17095. ? js.toString()
  17096. : Object.prototype.toString.call(js)
  17097. ;
  17098. return self}, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)})},
  17099. args: [],
  17100. source: "printString\x0a\x09<\x0a\x09\x09var js = self['@jsObject'];\x0a\x09\x09return js.toString\x0a\x09\x09\x09? js.toString()\x0a\x09\x09\x09: Object.prototype.toString.call(js)\x0a\x09>",
  17101. messageSends: [],
  17102. referencedClasses: []
  17103. }),
  17104. globals.JSObjectProxy);
  17105. smalltalk.addMethod(
  17106. smalltalk.method({
  17107. selector: "on:",
  17108. protocol: 'instance creation',
  17109. fn: function (aJSObject){
  17110. var self=this;
  17111. return smalltalk.withContext(function($ctx1) {
  17112. var $2,$3,$1;
  17113. $2=self._new();
  17114. _st($2)._jsObject_(aJSObject);
  17115. $3=_st($2)._yourself();
  17116. $1=$3;
  17117. return $1;
  17118. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)})},
  17119. args: ["aJSObject"],
  17120. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  17121. messageSends: ["jsObject:", "new", "yourself"],
  17122. referencedClasses: []
  17123. }),
  17124. globals.JSObjectProxy.klass);
  17125. smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
  17126. globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  17127. smalltalk.addMethod(
  17128. smalltalk.method({
  17129. selector: "do:on:displaying:",
  17130. protocol: 'progress handling',
  17131. fn: function (aBlock,aCollection,aString){
  17132. var self=this;
  17133. return smalltalk.withContext(function($ctx1) {
  17134. _st(aCollection)._do_(aBlock);
  17135. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)})},
  17136. args: ["aBlock", "aCollection", "aString"],
  17137. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  17138. messageSends: ["do:"],
  17139. referencedClasses: []
  17140. }),
  17141. globals.NullProgressHandler);
  17142. globals.NullProgressHandler.klass.iVarNames = ['current'];
  17143. smalltalk.addMethod(
  17144. smalltalk.method({
  17145. selector: "initialize",
  17146. protocol: 'initialization',
  17147. fn: function (){
  17148. var self=this;
  17149. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  17150. return smalltalk.withContext(function($ctx1) {
  17151. _st($ProgressHandler())._registerIfNone_(self._new());
  17152. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)})},
  17153. args: [],
  17154. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  17155. messageSends: ["registerIfNone:", "new"],
  17156. referencedClasses: ["ProgressHandler"]
  17157. }),
  17158. globals.NullProgressHandler.klass);
  17159. smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
  17160. globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  17161. smalltalk.addMethod(
  17162. smalltalk.method({
  17163. selector: "addElement:",
  17164. protocol: 'accessing',
  17165. fn: function (anObject){
  17166. var self=this;
  17167. return smalltalk.withContext(function($ctx1) {
  17168. self.elements.addElement(anObject);
  17169. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)})},
  17170. args: ["anObject"],
  17171. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  17172. messageSends: [],
  17173. referencedClasses: []
  17174. }),
  17175. globals.Organizer);
  17176. smalltalk.addMethod(
  17177. smalltalk.method({
  17178. selector: "elements",
  17179. protocol: 'accessing',
  17180. fn: function (){
  17181. var self=this;
  17182. return smalltalk.withContext(function($ctx1) {
  17183. var $1;
  17184. $1=_st(self._basicAt_("elements"))._copy();
  17185. return $1;
  17186. }, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)})},
  17187. args: [],
  17188. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  17189. messageSends: ["copy", "basicAt:"],
  17190. referencedClasses: []
  17191. }),
  17192. globals.Organizer);
  17193. smalltalk.addMethod(
  17194. smalltalk.method({
  17195. selector: "removeElement:",
  17196. protocol: 'accessing',
  17197. fn: function (anObject){
  17198. var self=this;
  17199. return smalltalk.withContext(function($ctx1) {
  17200. self.elements.removeElement(anObject);
  17201. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)})},
  17202. args: ["anObject"],
  17203. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  17204. messageSends: [],
  17205. referencedClasses: []
  17206. }),
  17207. globals.Organizer);
  17208. smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  17209. globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  17210. smalltalk.addMethod(
  17211. smalltalk.method({
  17212. selector: "addElement:",
  17213. protocol: 'accessing',
  17214. fn: function (aString){
  17215. var self=this;
  17216. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17217. function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  17218. return smalltalk.withContext(function($ctx1) {
  17219. var $1,$2;
  17220. ($ctx1.supercall = true, globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]));
  17221. $ctx1.supercall = false;
  17222. $1=_st($ProtocolAdded())._new();
  17223. _st($1)._protocol_(aString);
  17224. _st($1)._theClass_(self._theClass());
  17225. $2=_st($1)._yourself();
  17226. _st(_st($SystemAnnouncer())._current())._announce_($2);
  17227. return self}, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)})},
  17228. args: ["aString"],
  17229. 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)",
  17230. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  17231. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"]
  17232. }),
  17233. globals.ClassOrganizer);
  17234. smalltalk.addMethod(
  17235. smalltalk.method({
  17236. selector: "removeElement:",
  17237. protocol: 'accessing',
  17238. fn: function (aString){
  17239. var self=this;
  17240. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17241. function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  17242. return smalltalk.withContext(function($ctx1) {
  17243. var $1,$2;
  17244. ($ctx1.supercall = true, globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]));
  17245. $ctx1.supercall = false;
  17246. $1=_st($ProtocolRemoved())._new();
  17247. _st($1)._protocol_(aString);
  17248. _st($1)._theClass_(self._theClass());
  17249. $2=_st($1)._yourself();
  17250. _st(_st($SystemAnnouncer())._current())._announce_($2);
  17251. return self}, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)})},
  17252. args: ["aString"],
  17253. 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)",
  17254. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"],
  17255. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"]
  17256. }),
  17257. globals.ClassOrganizer);
  17258. smalltalk.addMethod(
  17259. smalltalk.method({
  17260. selector: "theClass",
  17261. protocol: 'accessing',
  17262. fn: function (){
  17263. var self=this;
  17264. return smalltalk.withContext(function($ctx1) {
  17265. return self.theClass ;
  17266. return self}, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)})},
  17267. args: [],
  17268. source: "theClass\x0a\x09< return self.theClass >",
  17269. messageSends: [],
  17270. referencedClasses: []
  17271. }),
  17272. globals.ClassOrganizer);
  17273. smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  17274. globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  17275. smalltalk.addClass('Package', globals.Object, ['transport', 'dirty'], 'Kernel-Infrastructure');
  17276. globals.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'";
  17277. smalltalk.addMethod(
  17278. smalltalk.method({
  17279. selector: "basicName:",
  17280. protocol: 'private',
  17281. fn: function (aString){
  17282. var self=this;
  17283. return smalltalk.withContext(function($ctx1) {
  17284. self.pkgName = aString;
  17285. return self}, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},globals.Package)})},
  17286. args: ["aString"],
  17287. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  17288. messageSends: [],
  17289. referencedClasses: []
  17290. }),
  17291. globals.Package);
  17292. smalltalk.addMethod(
  17293. smalltalk.method({
  17294. selector: "basicTransport",
  17295. protocol: 'private',
  17296. fn: function (){
  17297. var self=this;
  17298. return smalltalk.withContext(function($ctx1) {
  17299. return self.transport;
  17300. return self}, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)})},
  17301. args: [],
  17302. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  17303. messageSends: [],
  17304. referencedClasses: []
  17305. }),
  17306. globals.Package);
  17307. smalltalk.addMethod(
  17308. smalltalk.method({
  17309. selector: "beClean",
  17310. protocol: 'accessing',
  17311. fn: function (){
  17312. var self=this;
  17313. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17314. function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  17315. return smalltalk.withContext(function($ctx1) {
  17316. var $1,$2;
  17317. self["@dirty"]=false;
  17318. $1=_st($PackageClean())._new();
  17319. _st($1)._package_(self);
  17320. $2=_st($1)._yourself();
  17321. _st(_st($SystemAnnouncer())._current())._announce_($2);
  17322. return self}, function($ctx1) {$ctx1.fill(self,"beClean",{},globals.Package)})},
  17323. args: [],
  17324. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  17325. messageSends: ["announce:", "current", "package:", "new", "yourself"],
  17326. referencedClasses: ["SystemAnnouncer", "PackageClean"]
  17327. }),
  17328. globals.Package);
  17329. smalltalk.addMethod(
  17330. smalltalk.method({
  17331. selector: "beDirty",
  17332. protocol: 'accessing',
  17333. fn: function (){
  17334. var self=this;
  17335. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17336. function $PackageDirty(){return globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  17337. return smalltalk.withContext(function($ctx1) {
  17338. var $1,$2;
  17339. self["@dirty"]=true;
  17340. $1=_st($PackageDirty())._new();
  17341. _st($1)._package_(self);
  17342. $2=_st($1)._yourself();
  17343. _st(_st($SystemAnnouncer())._current())._announce_($2);
  17344. return self}, function($ctx1) {$ctx1.fill(self,"beDirty",{},globals.Package)})},
  17345. args: [],
  17346. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  17347. messageSends: ["announce:", "current", "package:", "new", "yourself"],
  17348. referencedClasses: ["SystemAnnouncer", "PackageDirty"]
  17349. }),
  17350. globals.Package);
  17351. smalltalk.addMethod(
  17352. smalltalk.method({
  17353. selector: "classTemplate",
  17354. protocol: 'accessing',
  17355. fn: function (){
  17356. var self=this;
  17357. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  17358. return smalltalk.withContext(function($ctx1) {
  17359. var $3,$4,$2,$5,$6,$7,$1;
  17360. $1=_st($String())._streamContents_((function(stream){
  17361. return smalltalk.withContext(function($ctx2) {
  17362. _st(stream)._nextPutAll_("Object");
  17363. $ctx2.sendIdx["nextPutAll:"]=1;
  17364. _st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  17365. $ctx2.sendIdx["nextPutAll:"]=2;
  17366. $3=_st($String())._lf();
  17367. $ctx2.sendIdx["lf"]=1;
  17368. $4=_st($String())._tab();
  17369. $ctx2.sendIdx["tab"]=1;
  17370. $2=_st($3).__comma($4);
  17371. $ctx2.sendIdx[","]=1;
  17372. _st(stream)._nextPutAll_($2);
  17373. $ctx2.sendIdx["nextPutAll:"]=3;
  17374. $5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
  17375. $ctx2.sendIdx["nextPutAll:"]=4;
  17376. $5;
  17377. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  17378. $ctx2.sendIdx[","]=2;
  17379. _st(stream)._nextPutAll_($6);
  17380. $ctx2.sendIdx["nextPutAll:"]=5;
  17381. _st(stream)._nextPutAll_("package: '");
  17382. $ctx2.sendIdx["nextPutAll:"]=6;
  17383. _st(stream)._nextPutAll_(self._name());
  17384. $ctx2.sendIdx["nextPutAll:"]=7;
  17385. $7=_st(stream)._nextPutAll_("'");
  17386. return $7;
  17387. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  17388. return $1;
  17389. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)})},
  17390. args: [],
  17391. source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
  17392. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"],
  17393. referencedClasses: ["String"]
  17394. }),
  17395. globals.Package);
  17396. smalltalk.addMethod(
  17397. smalltalk.method({
  17398. selector: "classes",
  17399. protocol: 'classes',
  17400. fn: function (){
  17401. var self=this;
  17402. return smalltalk.withContext(function($ctx1) {
  17403. var $1;
  17404. $1=_st(self._organization())._elements();
  17405. return $1;
  17406. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)})},
  17407. args: [],
  17408. source: "classes\x0a\x09^ self organization elements",
  17409. messageSends: ["elements", "organization"],
  17410. referencedClasses: []
  17411. }),
  17412. globals.Package);
  17413. smalltalk.addMethod(
  17414. smalltalk.method({
  17415. selector: "definition",
  17416. protocol: 'accessing',
  17417. fn: function (){
  17418. var self=this;
  17419. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  17420. return smalltalk.withContext(function($ctx1) {
  17421. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  17422. $1=_st($String())._streamContents_((function(stream){
  17423. return smalltalk.withContext(function($ctx2) {
  17424. $2=_st(self._class())._name();
  17425. $ctx2.sendIdx["name"]=1;
  17426. _st(stream)._nextPutAll_($2);
  17427. $ctx2.sendIdx["nextPutAll:"]=1;
  17428. $4=_st($String())._lf();
  17429. $ctx2.sendIdx["lf"]=1;
  17430. $5=_st($String())._tab();
  17431. $ctx2.sendIdx["tab"]=1;
  17432. $3=_st($4).__comma($5);
  17433. $ctx2.sendIdx[","]=1;
  17434. _st(stream)._nextPutAll_($3);
  17435. $ctx2.sendIdx["nextPutAll:"]=2;
  17436. _st(stream)._nextPutAll_(" named: ");
  17437. $ctx2.sendIdx["nextPutAll:"]=3;
  17438. $7="'".__comma(self._name());
  17439. $ctx2.sendIdx[","]=3;
  17440. $6=_st($7).__comma("'");
  17441. $ctx2.sendIdx[","]=2;
  17442. _st(stream)._nextPutAll_($6);
  17443. $ctx2.sendIdx["nextPutAll:"]=4;
  17444. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  17445. $ctx2.sendIdx[","]=4;
  17446. _st(stream)._nextPutAll_($8);
  17447. $ctx2.sendIdx["nextPutAll:"]=5;
  17448. _st(stream)._nextPutAll_(" transport: (");
  17449. $ctx2.sendIdx["nextPutAll:"]=6;
  17450. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  17451. return $9;
  17452. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  17453. return $1;
  17454. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)})},
  17455. args: [],
  17456. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' named: ';\x0a\x09\x09\x09nextPutAll: '''', self name, '''';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: ' transport: (';\x0a\x09\x09\x09nextPutAll: self transport definition, ')' ]",
  17457. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"],
  17458. referencedClasses: ["String"]
  17459. }),
  17460. globals.Package);
  17461. smalltalk.addMethod(
  17462. smalltalk.method({
  17463. selector: "isDirty",
  17464. protocol: 'testing',
  17465. fn: function (){
  17466. var self=this;
  17467. return smalltalk.withContext(function($ctx1) {
  17468. var $2,$1,$receiver;
  17469. $2=self["@dirty"];
  17470. if(($receiver = $2) == null || $receiver.isNil){
  17471. $1=false;
  17472. } else {
  17473. $1=$2;
  17474. };
  17475. return $1;
  17476. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},globals.Package)})},
  17477. args: [],
  17478. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  17479. messageSends: ["ifNil:"],
  17480. referencedClasses: []
  17481. }),
  17482. globals.Package);
  17483. smalltalk.addMethod(
  17484. smalltalk.method({
  17485. selector: "isPackage",
  17486. protocol: 'testing',
  17487. fn: function (){
  17488. var self=this;
  17489. return true;
  17490. },
  17491. args: [],
  17492. source: "isPackage\x0a\x09^ true",
  17493. messageSends: [],
  17494. referencedClasses: []
  17495. }),
  17496. globals.Package);
  17497. smalltalk.addMethod(
  17498. smalltalk.method({
  17499. selector: "loadDependencies",
  17500. protocol: 'dependencies',
  17501. fn: function (){
  17502. var self=this;
  17503. var classes,packages;
  17504. return smalltalk.withContext(function($ctx1) {
  17505. var $2,$3,$1;
  17506. classes=self._loadDependencyClasses();
  17507. $2=_st(_st(classes)._collect_((function(each){
  17508. return smalltalk.withContext(function($ctx2) {
  17509. return _st(each)._package();
  17510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  17511. _st($2)._remove_ifAbsent_(self,(function(){
  17512. }));
  17513. $3=_st($2)._yourself();
  17514. $1=$3;
  17515. return $1;
  17516. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)})},
  17517. args: [],
  17518. source: "loadDependencies\x0a\x09\x22Returns list of packages that need to be loaded\x0a\x09before loading this package.\x22\x0a\x09\x0a\x09| classes packages |\x0a\x09classes := self loadDependencyClasses.\x0a\x09^ (classes collect: [ :each | each package ]) asSet\x0a\x09\x09remove: self ifAbsent: [];\x0a\x09\x09yourself",
  17519. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"],
  17520. referencedClasses: []
  17521. }),
  17522. globals.Package);
  17523. smalltalk.addMethod(
  17524. smalltalk.method({
  17525. selector: "loadDependencyClasses",
  17526. protocol: 'dependencies',
  17527. fn: function (){
  17528. var self=this;
  17529. var starCategoryName;
  17530. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17531. return smalltalk.withContext(function($ctx1) {
  17532. var $4,$3,$2,$6,$5,$7,$1;
  17533. starCategoryName="*".__comma(self._name());
  17534. $ctx1.sendIdx[","]=1;
  17535. $4=self._classes();
  17536. $ctx1.sendIdx["classes"]=1;
  17537. $3=_st($4)._collect_((function(each){
  17538. return smalltalk.withContext(function($ctx2) {
  17539. return _st(each)._superclass();
  17540. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17541. $2=_st($3)._asSet();
  17542. _st($2)._remove_ifAbsent_(nil,(function(){
  17543. }));
  17544. _st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
  17545. return smalltalk.withContext(function($ctx2) {
  17546. $6=_st(each)._protocols();
  17547. $ctx2.sendIdx["protocols"]=1;
  17548. $5=_st($6).__comma(_st(_st(each)._class())._protocols());
  17549. return _st($5)._includes_(starCategoryName);
  17550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})})));
  17551. $7=_st($2)._yourself();
  17552. $1=$7;
  17553. return $1;
  17554. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)})},
  17555. args: [],
  17556. source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
  17557. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"],
  17558. referencedClasses: ["Smalltalk"]
  17559. }),
  17560. globals.Package);
  17561. smalltalk.addMethod(
  17562. smalltalk.method({
  17563. selector: "name",
  17564. protocol: 'accessing',
  17565. fn: function (){
  17566. var self=this;
  17567. return smalltalk.withContext(function($ctx1) {
  17568. return self.pkgName;
  17569. return self}, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)})},
  17570. args: [],
  17571. source: "name\x0a\x09<return self.pkgName>",
  17572. messageSends: [],
  17573. referencedClasses: []
  17574. }),
  17575. globals.Package);
  17576. smalltalk.addMethod(
  17577. smalltalk.method({
  17578. selector: "name:",
  17579. protocol: 'accessing',
  17580. fn: function (aString){
  17581. var self=this;
  17582. return smalltalk.withContext(function($ctx1) {
  17583. self._basicName_(aString);
  17584. self._beDirty();
  17585. return self}, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)})},
  17586. args: ["aString"],
  17587. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  17588. messageSends: ["basicName:", "beDirty"],
  17589. referencedClasses: []
  17590. }),
  17591. globals.Package);
  17592. smalltalk.addMethod(
  17593. smalltalk.method({
  17594. selector: "organization",
  17595. protocol: 'accessing',
  17596. fn: function (){
  17597. var self=this;
  17598. return smalltalk.withContext(function($ctx1) {
  17599. var $1;
  17600. $1=self._basicAt_("organization");
  17601. return $1;
  17602. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)})},
  17603. args: [],
  17604. source: "organization\x0a\x09^ self basicAt: 'organization'",
  17605. messageSends: ["basicAt:"],
  17606. referencedClasses: []
  17607. }),
  17608. globals.Package);
  17609. smalltalk.addMethod(
  17610. smalltalk.method({
  17611. selector: "printOn:",
  17612. protocol: 'printing',
  17613. fn: function (aStream){
  17614. var self=this;
  17615. return smalltalk.withContext(function($ctx1) {
  17616. var $1;
  17617. ($ctx1.supercall = true, globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  17618. $ctx1.supercall = false;
  17619. _st(aStream)._nextPutAll_(" (");
  17620. $ctx1.sendIdx["nextPutAll:"]=1;
  17621. _st(aStream)._nextPutAll_(self._name());
  17622. $ctx1.sendIdx["nextPutAll:"]=2;
  17623. $1=_st(aStream)._nextPutAll_(")");
  17624. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)})},
  17625. args: ["aStream"],
  17626. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  17627. messageSends: ["printOn:", "nextPutAll:", "name"],
  17628. referencedClasses: []
  17629. }),
  17630. globals.Package);
  17631. smalltalk.addMethod(
  17632. smalltalk.method({
  17633. selector: "setupClasses",
  17634. protocol: 'classes',
  17635. fn: function (){
  17636. var self=this;
  17637. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  17638. return smalltalk.withContext(function($ctx1) {
  17639. var $1,$2;
  17640. $1=self._classes();
  17641. _st($1)._do_((function(each){
  17642. return smalltalk.withContext(function($ctx2) {
  17643. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  17644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17645. $ctx1.sendIdx["do:"]=1;
  17646. $2=_st($1)._do_((function(each){
  17647. return smalltalk.withContext(function($ctx2) {
  17648. return _st(each)._initialize();
  17649. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  17650. return self}, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)})},
  17651. args: [],
  17652. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  17653. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"],
  17654. referencedClasses: ["ClassBuilder"]
  17655. }),
  17656. globals.Package);
  17657. smalltalk.addMethod(
  17658. smalltalk.method({
  17659. selector: "sortedClasses",
  17660. protocol: 'classes',
  17661. fn: function (){
  17662. var self=this;
  17663. return smalltalk.withContext(function($ctx1) {
  17664. var $1;
  17665. $1=_st(self._class())._sortedClasses_(self._classes());
  17666. return $1;
  17667. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)})},
  17668. args: [],
  17669. 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",
  17670. messageSends: ["sortedClasses:", "class", "classes"],
  17671. referencedClasses: []
  17672. }),
  17673. globals.Package);
  17674. smalltalk.addMethod(
  17675. smalltalk.method({
  17676. selector: "transport",
  17677. protocol: 'accessing',
  17678. fn: function (){
  17679. var self=this;
  17680. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  17681. return smalltalk.withContext(function($ctx1) {
  17682. var $2,$3,$4,$1,$receiver;
  17683. $2=self["@transport"];
  17684. if(($receiver = $2) == null || $receiver.isNil){
  17685. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  17686. _st($3)._package_(self);
  17687. $4=_st($3)._yourself();
  17688. self["@transport"]=$4;
  17689. $1=self["@transport"];
  17690. } else {
  17691. $1=$2;
  17692. };
  17693. return $1;
  17694. }, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)})},
  17695. args: [],
  17696. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  17697. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"],
  17698. referencedClasses: ["PackageTransport"]
  17699. }),
  17700. globals.Package);
  17701. smalltalk.addMethod(
  17702. smalltalk.method({
  17703. selector: "transport:",
  17704. protocol: 'accessing',
  17705. fn: function (aPackageTransport){
  17706. var self=this;
  17707. return smalltalk.withContext(function($ctx1) {
  17708. self["@transport"]=aPackageTransport;
  17709. _st(aPackageTransport)._package_(self);
  17710. return self}, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)})},
  17711. args: ["aPackageTransport"],
  17712. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  17713. messageSends: ["package:"],
  17714. referencedClasses: []
  17715. }),
  17716. globals.Package);
  17717. globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  17718. smalltalk.addMethod(
  17719. smalltalk.method({
  17720. selector: "named:",
  17721. protocol: 'accessing',
  17722. fn: function (aPackageName){
  17723. var self=this;
  17724. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17725. return smalltalk.withContext(function($ctx1) {
  17726. var $1;
  17727. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  17728. return smalltalk.withContext(function($ctx2) {
  17729. return _st($Smalltalk())._createPackage_(aPackageName);
  17730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  17731. return $1;
  17732. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)})},
  17733. args: ["aPackageName"],
  17734. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  17735. messageSends: ["packageAt:ifAbsent:", "createPackage:"],
  17736. referencedClasses: ["Smalltalk"]
  17737. }),
  17738. globals.Package.klass);
  17739. smalltalk.addMethod(
  17740. smalltalk.method({
  17741. selector: "named:ifAbsent:",
  17742. protocol: 'accessing',
  17743. fn: function (aPackageName,aBlock){
  17744. var self=this;
  17745. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  17746. return smalltalk.withContext(function($ctx1) {
  17747. var $1;
  17748. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  17749. return $1;
  17750. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)})},
  17751. args: ["aPackageName", "aBlock"],
  17752. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  17753. messageSends: ["packageAt:ifAbsent:"],
  17754. referencedClasses: ["Smalltalk"]
  17755. }),
  17756. globals.Package.klass);
  17757. smalltalk.addMethod(
  17758. smalltalk.method({
  17759. selector: "named:transport:",
  17760. protocol: 'accessing',
  17761. fn: function (aPackageName,aTransport){
  17762. var self=this;
  17763. var package_;
  17764. return smalltalk.withContext(function($ctx1) {
  17765. var $1;
  17766. package_=self._named_(aPackageName);
  17767. _st(package_)._transport_(aTransport);
  17768. $1=package_;
  17769. return $1;
  17770. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)})},
  17771. args: ["aPackageName", "aTransport"],
  17772. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  17773. messageSends: ["named:", "transport:"],
  17774. referencedClasses: []
  17775. }),
  17776. globals.Package.klass);
  17777. smalltalk.addMethod(
  17778. smalltalk.method({
  17779. selector: "sortedClasses:",
  17780. protocol: 'sorting',
  17781. fn: function (classes){
  17782. var self=this;
  17783. var children,others,nodes,expandedClasses;
  17784. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  17785. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  17786. return smalltalk.withContext(function($ctx1) {
  17787. var $1,$3,$2,$4;
  17788. children=[];
  17789. others=[];
  17790. _st(classes)._do_((function(each){
  17791. return smalltalk.withContext(function($ctx2) {
  17792. $1=_st(classes)._includes_(_st(each)._superclass());
  17793. if(smalltalk.assert($1)){
  17794. return _st(others)._add_(each);
  17795. } else {
  17796. return _st(children)._add_(each);
  17797. $ctx2.sendIdx["add:"]=1;
  17798. };
  17799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  17800. $ctx1.sendIdx["do:"]=1;
  17801. nodes=_st(children)._collect_((function(each){
  17802. return smalltalk.withContext(function($ctx2) {
  17803. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  17804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  17805. nodes=_st(nodes)._sorted_((function(a,b){
  17806. return smalltalk.withContext(function($ctx2) {
  17807. $3=_st(a)._theClass();
  17808. $ctx2.sendIdx["theClass"]=1;
  17809. $2=_st($3)._name();
  17810. $ctx2.sendIdx["name"]=1;
  17811. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  17812. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)})}));
  17813. expandedClasses=_st($Array())._new();
  17814. _st(nodes)._do_((function(aNode){
  17815. return smalltalk.withContext(function($ctx2) {
  17816. return _st(aNode)._traverseClassesWith_(expandedClasses);
  17817. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)})}));
  17818. $4=expandedClasses;
  17819. return $4;
  17820. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)})},
  17821. args: ["classes"],
  17822. 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",
  17823. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"],
  17824. referencedClasses: ["ClassSorterNode", "Array"]
  17825. }),
  17826. globals.Package.klass);
  17827. smalltalk.addClass('PackageStateObserver', globals.Object, [], 'Kernel-Infrastructure');
  17828. globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  17829. smalltalk.addMethod(
  17830. smalltalk.method({
  17831. selector: "announcer",
  17832. protocol: 'accessing',
  17833. fn: function (){
  17834. var self=this;
  17835. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  17836. return smalltalk.withContext(function($ctx1) {
  17837. var $1;
  17838. $1=_st($SystemAnnouncer())._current();
  17839. return $1;
  17840. }, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.PackageStateObserver)})},
  17841. args: [],
  17842. source: "announcer\x0a\x09^ SystemAnnouncer current",
  17843. messageSends: ["current"],
  17844. referencedClasses: ["SystemAnnouncer"]
  17845. }),
  17846. globals.PackageStateObserver);
  17847. smalltalk.addMethod(
  17848. smalltalk.method({
  17849. selector: "observeSystem",
  17850. protocol: 'actions',
  17851. fn: function (){
  17852. var self=this;
  17853. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  17854. function $ClassAnnouncement(){return globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  17855. function $MethodAnnouncement(){return globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  17856. function $ProtocolAnnouncement(){return globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  17857. return smalltalk.withContext(function($ctx1) {
  17858. var $1,$2;
  17859. $1=self._announcer();
  17860. _st($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  17861. $ctx1.sendIdx["on:send:to:"]=1;
  17862. _st($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  17863. $ctx1.sendIdx["on:send:to:"]=2;
  17864. _st($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  17865. $ctx1.sendIdx["on:send:to:"]=3;
  17866. $2=_st($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  17867. return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.PackageStateObserver)})},
  17868. args: [],
  17869. source: "observeSystem\x0a\x09self announcer\x0a\x09\x09on: PackageAdded\x0a\x09\x09send: #onPackageAdded:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ClassAnnouncement\x0a\x09\x09send: #onClassModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: MethodAnnouncement\x0a\x09\x09send: #onMethodModification:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: ProtocolAnnouncement\x0a\x09\x09send: #onProtocolModification:\x0a\x09\x09to: self",
  17870. messageSends: ["on:send:to:", "announcer"],
  17871. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"]
  17872. }),
  17873. globals.PackageStateObserver);
  17874. smalltalk.addMethod(
  17875. smalltalk.method({
  17876. selector: "onClassModification:",
  17877. protocol: 'reactions',
  17878. fn: function (anAnnouncement){
  17879. var self=this;
  17880. return smalltalk.withContext(function($ctx1) {
  17881. var $1,$receiver;
  17882. $1=_st(anAnnouncement)._theClass();
  17883. if(($receiver = $1) == null || $receiver.isNil){
  17884. $1;
  17885. } else {
  17886. var theClass;
  17887. theClass=$receiver;
  17888. _st(_st(theClass)._package())._beDirty();
  17889. };
  17890. return self}, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
  17891. args: ["anAnnouncement"],
  17892. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  17893. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"],
  17894. referencedClasses: []
  17895. }),
  17896. globals.PackageStateObserver);
  17897. smalltalk.addMethod(
  17898. smalltalk.method({
  17899. selector: "onMethodModification:",
  17900. protocol: 'reactions',
  17901. fn: function (anAnnouncement){
  17902. var self=this;
  17903. return smalltalk.withContext(function($ctx1) {
  17904. var $1,$receiver;
  17905. $1=_st(_st(anAnnouncement)._method())._package();
  17906. if(($receiver = $1) == null || $receiver.isNil){
  17907. $1;
  17908. } else {
  17909. var package_;
  17910. package_=$receiver;
  17911. _st(package_)._beDirty();
  17912. };
  17913. return self}, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
  17914. args: ["anAnnouncement"],
  17915. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  17916. messageSends: ["ifNotNil:", "package", "method", "beDirty"],
  17917. referencedClasses: []
  17918. }),
  17919. globals.PackageStateObserver);
  17920. smalltalk.addMethod(
  17921. smalltalk.method({
  17922. selector: "onPackageAdded:",
  17923. protocol: 'reactions',
  17924. fn: function (anAnnouncement){
  17925. var self=this;
  17926. return smalltalk.withContext(function($ctx1) {
  17927. _st(_st(anAnnouncement)._package())._beDirty();
  17928. return self}, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
  17929. args: ["anAnnouncement"],
  17930. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  17931. messageSends: ["beDirty", "package"],
  17932. referencedClasses: []
  17933. }),
  17934. globals.PackageStateObserver);
  17935. smalltalk.addMethod(
  17936. smalltalk.method({
  17937. selector: "onProtocolModification:",
  17938. protocol: 'reactions',
  17939. fn: function (anAnnouncement){
  17940. var self=this;
  17941. return smalltalk.withContext(function($ctx1) {
  17942. var $1,$receiver;
  17943. $1=_st(anAnnouncement)._package();
  17944. if(($receiver = $1) == null || $receiver.isNil){
  17945. $1;
  17946. } else {
  17947. var package_;
  17948. package_=$receiver;
  17949. _st(package_)._beDirty();
  17950. };
  17951. return self}, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)})},
  17952. args: ["anAnnouncement"],
  17953. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  17954. messageSends: ["ifNotNil:", "package", "beDirty"],
  17955. referencedClasses: []
  17956. }),
  17957. globals.PackageStateObserver);
  17958. globals.PackageStateObserver.klass.iVarNames = ['current'];
  17959. smalltalk.addMethod(
  17960. smalltalk.method({
  17961. selector: "current",
  17962. protocol: 'accessing',
  17963. fn: function (){
  17964. var self=this;
  17965. return smalltalk.withContext(function($ctx1) {
  17966. var $2,$1,$receiver;
  17967. $2=self["@current"];
  17968. if(($receiver = $2) == null || $receiver.isNil){
  17969. self["@current"]=self._new();
  17970. $1=self["@current"];
  17971. } else {
  17972. $1=$2;
  17973. };
  17974. return $1;
  17975. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.PackageStateObserver.klass)})},
  17976. args: [],
  17977. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  17978. messageSends: ["ifNil:", "new"],
  17979. referencedClasses: []
  17980. }),
  17981. globals.PackageStateObserver.klass);
  17982. smalltalk.addMethod(
  17983. smalltalk.method({
  17984. selector: "initialize",
  17985. protocol: 'initialization',
  17986. fn: function (){
  17987. var self=this;
  17988. return smalltalk.withContext(function($ctx1) {
  17989. _st(self._current())._observeSystem();
  17990. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageStateObserver.klass)})},
  17991. args: [],
  17992. source: "initialize\x0a\x09self current observeSystem",
  17993. messageSends: ["observeSystem", "current"],
  17994. referencedClasses: []
  17995. }),
  17996. globals.PackageStateObserver.klass);
  17997. smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
  17998. globals.PlatformInterface.comment="I am single entry point to UI and environment interface.\x0aMy `initialize` tries several options (for now, browser environment only) to set myself up.\x0a\x0a## API\x0a\x0a PlatformInterface alert: 'Hey, there is a problem'.\x0a PlatformInterface confirm: 'Affirmative?'.\x0a PlatformInterface prompt: 'Your name:'.\x0a\x0a PlatformInterface ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  17999. globals.PlatformInterface.klass.iVarNames = ['worker'];
  18000. smalltalk.addMethod(
  18001. smalltalk.method({
  18002. selector: "ajax:",
  18003. protocol: 'actions',
  18004. fn: function (anObject){
  18005. var self=this;
  18006. return smalltalk.withContext(function($ctx1) {
  18007. var $2,$1,$receiver;
  18008. $2=self["@worker"];
  18009. if(($receiver = $2) == null || $receiver.isNil){
  18010. $1=self._error_("ajax: not available");
  18011. } else {
  18012. $1=_st(self["@worker"])._ajax_(anObject);
  18013. };
  18014. return $1;
  18015. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)})},
  18016. args: ["anObject"],
  18017. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  18018. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"],
  18019. referencedClasses: []
  18020. }),
  18021. globals.PlatformInterface.klass);
  18022. smalltalk.addMethod(
  18023. smalltalk.method({
  18024. selector: "alert:",
  18025. protocol: 'actions',
  18026. fn: function (aString){
  18027. var self=this;
  18028. return smalltalk.withContext(function($ctx1) {
  18029. var $2,$1,$receiver;
  18030. $2=self["@worker"];
  18031. if(($receiver = $2) == null || $receiver.isNil){
  18032. $1=self._error_("alert: not available");
  18033. } else {
  18034. $1=_st(self["@worker"])._alert_(aString);
  18035. };
  18036. return $1;
  18037. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)})},
  18038. args: ["aString"],
  18039. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  18040. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"],
  18041. referencedClasses: []
  18042. }),
  18043. globals.PlatformInterface.klass);
  18044. smalltalk.addMethod(
  18045. smalltalk.method({
  18046. selector: "confirm:",
  18047. protocol: 'actions',
  18048. fn: function (aString){
  18049. var self=this;
  18050. return smalltalk.withContext(function($ctx1) {
  18051. var $2,$1,$receiver;
  18052. $2=self["@worker"];
  18053. if(($receiver = $2) == null || $receiver.isNil){
  18054. $1=self._error_("confirm: not available");
  18055. } else {
  18056. $1=_st(self["@worker"])._confirm_(aString);
  18057. };
  18058. return $1;
  18059. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)})},
  18060. args: ["aString"],
  18061. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  18062. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"],
  18063. referencedClasses: []
  18064. }),
  18065. globals.PlatformInterface.klass);
  18066. smalltalk.addMethod(
  18067. smalltalk.method({
  18068. selector: "existsGlobal:",
  18069. protocol: 'actions',
  18070. fn: function (aString){
  18071. var self=this;
  18072. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  18073. return smalltalk.withContext(function($ctx1) {
  18074. var $1;
  18075. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  18076. return true;
  18077. }),(function(){
  18078. return false;
  18079. }));
  18080. return $1;
  18081. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)})},
  18082. args: ["aString"],
  18083. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  18084. messageSends: ["at:ifPresent:ifAbsent:", "globals"],
  18085. referencedClasses: ["PlatformInterface"]
  18086. }),
  18087. globals.PlatformInterface.klass);
  18088. smalltalk.addMethod(
  18089. smalltalk.method({
  18090. selector: "globals",
  18091. protocol: 'accessing',
  18092. fn: function (){
  18093. var self=this;
  18094. return smalltalk.withContext(function($ctx1) {
  18095. return (new Function('return this'))();;
  18096. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)})},
  18097. args: [],
  18098. source: "globals\x0a\x09<return (new Function('return this'))();>",
  18099. messageSends: [],
  18100. referencedClasses: []
  18101. }),
  18102. globals.PlatformInterface.klass);
  18103. smalltalk.addMethod(
  18104. smalltalk.method({
  18105. selector: "initialize",
  18106. protocol: 'initialization',
  18107. fn: function (){
  18108. var self=this;
  18109. var candidate;
  18110. function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  18111. return smalltalk.withContext(function($ctx1) {
  18112. var $1,$receiver;
  18113. ($ctx1.supercall = true, globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  18114. $ctx1.supercall = false;
  18115. if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
  18116. $BrowserInterface();
  18117. } else {
  18118. candidate=_st($BrowserInterface())._new();
  18119. candidate;
  18120. $1=_st(candidate)._isAvailable();
  18121. if(smalltalk.assert($1)){
  18122. self._setWorker_(candidate);
  18123. return self;
  18124. };
  18125. };
  18126. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)})},
  18127. args: [],
  18128. source: "initialize\x0a\x09| candidate |\x0a\x09\x0a\x09super initialize.\x0a\x09\x0a\x09BrowserInterface ifNotNil: [\x0a\x09\x09candidate := BrowserInterface new.\x0a\x09\x09candidate isAvailable ifTrue: [ self setWorker: candidate. ^ self ]\x0a\x09]",
  18129. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"],
  18130. referencedClasses: ["BrowserInterface"]
  18131. }),
  18132. globals.PlatformInterface.klass);
  18133. smalltalk.addMethod(
  18134. smalltalk.method({
  18135. selector: "prompt:",
  18136. protocol: 'actions',
  18137. fn: function (aString){
  18138. var self=this;
  18139. return smalltalk.withContext(function($ctx1) {
  18140. var $2,$1,$receiver;
  18141. $2=self["@worker"];
  18142. if(($receiver = $2) == null || $receiver.isNil){
  18143. $1=self._error_("prompt: not available");
  18144. } else {
  18145. $1=_st(self["@worker"])._prompt_(aString);
  18146. };
  18147. return $1;
  18148. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)})},
  18149. args: ["aString"],
  18150. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  18151. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"],
  18152. referencedClasses: []
  18153. }),
  18154. globals.PlatformInterface.klass);
  18155. smalltalk.addMethod(
  18156. smalltalk.method({
  18157. selector: "prompt:default:",
  18158. protocol: 'actions',
  18159. fn: function (aString,defaultString){
  18160. var self=this;
  18161. return smalltalk.withContext(function($ctx1) {
  18162. var $2,$1,$receiver;
  18163. $2=self["@worker"];
  18164. if(($receiver = $2) == null || $receiver.isNil){
  18165. $1=self._error_("prompt: not available");
  18166. } else {
  18167. $1=_st(self["@worker"])._prompt_default_(aString,defaultString);
  18168. };
  18169. return $1;
  18170. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.PlatformInterface.klass)})},
  18171. args: ["aString", "defaultString"],
  18172. source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  18173. messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"],
  18174. referencedClasses: []
  18175. }),
  18176. globals.PlatformInterface.klass);
  18177. smalltalk.addMethod(
  18178. smalltalk.method({
  18179. selector: "setWorker:",
  18180. protocol: 'accessing',
  18181. fn: function (anObject){
  18182. var self=this;
  18183. self["@worker"]=anObject;
  18184. return self},
  18185. args: ["anObject"],
  18186. source: "setWorker: anObject\x0a\x09worker := anObject",
  18187. messageSends: [],
  18188. referencedClasses: []
  18189. }),
  18190. globals.PlatformInterface.klass);
  18191. smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
  18192. globals.Service.comment="I implement the basic behavior for class registration to a service.\x0a\x0aSee the `Transcript` class for a concrete service.\x0a\x0a## API\x0a\x0aUse class-side methods `#register:` and `#registerIfNone:` to register classes to a specific service.";
  18193. globals.Service.klass.iVarNames = ['current'];
  18194. smalltalk.addMethod(
  18195. smalltalk.method({
  18196. selector: "current",
  18197. protocol: 'accessing',
  18198. fn: function (){
  18199. var self=this;
  18200. var $1;
  18201. $1=self["@current"];
  18202. return $1;
  18203. },
  18204. args: [],
  18205. source: "current\x0a\x09^ current",
  18206. messageSends: [],
  18207. referencedClasses: []
  18208. }),
  18209. globals.Service.klass);
  18210. smalltalk.addMethod(
  18211. smalltalk.method({
  18212. selector: "new",
  18213. protocol: 'instance creation',
  18214. fn: function (){
  18215. var self=this;
  18216. return smalltalk.withContext(function($ctx1) {
  18217. self._shouldNotImplement();
  18218. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)})},
  18219. args: [],
  18220. source: "new\x0a\x09self shouldNotImplement",
  18221. messageSends: ["shouldNotImplement"],
  18222. referencedClasses: []
  18223. }),
  18224. globals.Service.klass);
  18225. smalltalk.addMethod(
  18226. smalltalk.method({
  18227. selector: "register:",
  18228. protocol: 'registration',
  18229. fn: function (anObject){
  18230. var self=this;
  18231. self["@current"]=anObject;
  18232. return self},
  18233. args: ["anObject"],
  18234. source: "register: anObject\x0a\x09current := anObject",
  18235. messageSends: [],
  18236. referencedClasses: []
  18237. }),
  18238. globals.Service.klass);
  18239. smalltalk.addMethod(
  18240. smalltalk.method({
  18241. selector: "registerIfNone:",
  18242. protocol: 'registration',
  18243. fn: function (anObject){
  18244. var self=this;
  18245. return smalltalk.withContext(function($ctx1) {
  18246. var $1,$receiver;
  18247. $1=self._current();
  18248. if(($receiver = $1) == null || $receiver.isNil){
  18249. self._register_(anObject);
  18250. } else {
  18251. $1;
  18252. };
  18253. return self}, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)})},
  18254. args: ["anObject"],
  18255. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  18256. messageSends: ["ifNil:", "current", "register:"],
  18257. referencedClasses: []
  18258. }),
  18259. globals.Service.klass);
  18260. smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
  18261. globals.ErrorHandler.comment="I am the service used to handle Smalltalk errors.\x0aSee `boot.js` `handleError()` function.\x0a\x0aRegistered service instances must implement `#handleError:` to perform an action on the thrown exception.";
  18262. smalltalk.addMethod(
  18263. smalltalk.method({
  18264. selector: "handleError:",
  18265. protocol: 'error handling',
  18266. fn: function (anError){
  18267. var self=this;
  18268. return smalltalk.withContext(function($ctx1) {
  18269. self._handleUnhandledError_(anError);
  18270. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)})},
  18271. args: ["anError"],
  18272. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  18273. messageSends: ["handleUnhandledError:"],
  18274. referencedClasses: []
  18275. }),
  18276. globals.ErrorHandler.klass);
  18277. smalltalk.addMethod(
  18278. smalltalk.method({
  18279. selector: "handleUnhandledError:",
  18280. protocol: 'error handling',
  18281. fn: function (anError){
  18282. var self=this;
  18283. return smalltalk.withContext(function($ctx1) {
  18284. var $1,$2;
  18285. $1=_st(anError)._wasHandled();
  18286. if(smalltalk.assert($1)){
  18287. return self;
  18288. };
  18289. $2=_st(self._current())._handleError_(anError);
  18290. return $2;
  18291. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},globals.ErrorHandler.klass)})},
  18292. args: ["anError"],
  18293. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  18294. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"],
  18295. referencedClasses: []
  18296. }),
  18297. globals.ErrorHandler.klass);
  18298. smalltalk.addClass('Finder', globals.Service, [], 'Kernel-Infrastructure');
  18299. globals.Finder.comment="I am the service responsible for finding classes/methods.\x0a__There is no default finder.__\x0a\x0a## API\x0a\x0aUse `#browse` on an object to find it.";
  18300. smalltalk.addMethod(
  18301. smalltalk.method({
  18302. selector: "findClass:",
  18303. protocol: 'finding',
  18304. fn: function (aClass){
  18305. var self=this;
  18306. return smalltalk.withContext(function($ctx1) {
  18307. var $1;
  18308. $1=_st(self._current())._findClass_(aClass);
  18309. return $1;
  18310. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},globals.Finder.klass)})},
  18311. args: ["aClass"],
  18312. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  18313. messageSends: ["findClass:", "current"],
  18314. referencedClasses: []
  18315. }),
  18316. globals.Finder.klass);
  18317. smalltalk.addMethod(
  18318. smalltalk.method({
  18319. selector: "findMethod:",
  18320. protocol: 'finding',
  18321. fn: function (aCompiledMethod){
  18322. var self=this;
  18323. return smalltalk.withContext(function($ctx1) {
  18324. var $1;
  18325. $1=_st(self._current())._findMethod_(aCompiledMethod);
  18326. return $1;
  18327. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},globals.Finder.klass)})},
  18328. args: ["aCompiledMethod"],
  18329. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  18330. messageSends: ["findMethod:", "current"],
  18331. referencedClasses: []
  18332. }),
  18333. globals.Finder.klass);
  18334. smalltalk.addMethod(
  18335. smalltalk.method({
  18336. selector: "findString:",
  18337. protocol: 'finding',
  18338. fn: function (aString){
  18339. var self=this;
  18340. return smalltalk.withContext(function($ctx1) {
  18341. var $1;
  18342. $1=_st(self._current())._findString_(aString);
  18343. return $1;
  18344. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},globals.Finder.klass)})},
  18345. args: ["aString"],
  18346. source: "findString: aString\x0a\x09^ self current findString: aString",
  18347. messageSends: ["findString:", "current"],
  18348. referencedClasses: []
  18349. }),
  18350. globals.Finder.klass);
  18351. smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
  18352. globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  18353. smalltalk.addMethod(
  18354. smalltalk.method({
  18355. selector: "inspect:",
  18356. protocol: 'inspecting',
  18357. fn: function (anObject){
  18358. var self=this;
  18359. return smalltalk.withContext(function($ctx1) {
  18360. var $1;
  18361. $1=_st(self._current())._inspect_(anObject);
  18362. return $1;
  18363. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)})},
  18364. args: ["anObject"],
  18365. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  18366. messageSends: ["inspect:", "current"],
  18367. referencedClasses: []
  18368. }),
  18369. globals.Inspector.klass);
  18370. smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
  18371. globals.ProgressHandler.comment="I am used to manage progress in collection iterations, see `SequenceableCollection >> #do:displayingProgress:`.\x0a\x0aRegistered instances must implement `#do:on:displaying:`.\x0a\x0aThe default behavior is to simply iterate over the collection, using `NullProgressHandler`.";
  18372. smalltalk.addMethod(
  18373. smalltalk.method({
  18374. selector: "do:on:displaying:",
  18375. protocol: 'progress handling',
  18376. fn: function (aBlock,aCollection,aString){
  18377. var self=this;
  18378. return smalltalk.withContext(function($ctx1) {
  18379. _st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  18380. return self}, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)})},
  18381. args: ["aBlock", "aCollection", "aString"],
  18382. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  18383. messageSends: ["do:on:displaying:", "current"],
  18384. referencedClasses: []
  18385. }),
  18386. globals.ProgressHandler.klass);
  18387. smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
  18388. globals.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  18389. smalltalk.addMethod(
  18390. smalltalk.method({
  18391. selector: "clear",
  18392. protocol: 'printing',
  18393. fn: function (){
  18394. var self=this;
  18395. return smalltalk.withContext(function($ctx1) {
  18396. _st(self._current())._clear();
  18397. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)})},
  18398. args: [],
  18399. source: "clear\x0a\x09self current clear",
  18400. messageSends: ["clear", "current"],
  18401. referencedClasses: []
  18402. }),
  18403. globals.Transcript.klass);
  18404. smalltalk.addMethod(
  18405. smalltalk.method({
  18406. selector: "cr",
  18407. protocol: 'printing',
  18408. fn: function (){
  18409. var self=this;
  18410. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  18411. return smalltalk.withContext(function($ctx1) {
  18412. _st(self._current())._show_(_st($String())._cr());
  18413. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)})},
  18414. args: [],
  18415. source: "cr\x0a\x09self current show: String cr",
  18416. messageSends: ["show:", "current", "cr"],
  18417. referencedClasses: ["String"]
  18418. }),
  18419. globals.Transcript.klass);
  18420. smalltalk.addMethod(
  18421. smalltalk.method({
  18422. selector: "inspect:",
  18423. protocol: 'printing',
  18424. fn: function (anObject){
  18425. var self=this;
  18426. return smalltalk.withContext(function($ctx1) {
  18427. self._show_(anObject);
  18428. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)})},
  18429. args: ["anObject"],
  18430. source: "inspect: anObject\x0a\x09self show: anObject",
  18431. messageSends: ["show:"],
  18432. referencedClasses: []
  18433. }),
  18434. globals.Transcript.klass);
  18435. smalltalk.addMethod(
  18436. smalltalk.method({
  18437. selector: "open",
  18438. protocol: 'instance creation',
  18439. fn: function (){
  18440. var self=this;
  18441. return smalltalk.withContext(function($ctx1) {
  18442. _st(self._current())._open();
  18443. return self}, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)})},
  18444. args: [],
  18445. source: "open\x0a\x09self current open",
  18446. messageSends: ["open", "current"],
  18447. referencedClasses: []
  18448. }),
  18449. globals.Transcript.klass);
  18450. smalltalk.addMethod(
  18451. smalltalk.method({
  18452. selector: "show:",
  18453. protocol: 'printing',
  18454. fn: function (anObject){
  18455. var self=this;
  18456. return smalltalk.withContext(function($ctx1) {
  18457. _st(self._current())._show_(anObject);
  18458. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)})},
  18459. args: ["anObject"],
  18460. source: "show: anObject\x0a\x09self current show: anObject",
  18461. messageSends: ["show:", "current"],
  18462. referencedClasses: []
  18463. }),
  18464. globals.Transcript.klass);
  18465. smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  18466. globals.Setting.comment="I represent a setting accessible via `Smalltalk settings`.\x0a\x0a## API\x0a\x0aA `Setting` value can be read using `value` and set using `value:`.\x0a\x0aSettings are accessed with `'key' asSetting` or `'key' asSettingIfAbsent: 'defaultValue'`.";
  18467. smalltalk.addMethod(
  18468. smalltalk.method({
  18469. selector: "defaultValue",
  18470. protocol: 'accessing',
  18471. fn: function (){
  18472. var self=this;
  18473. var $1;
  18474. $1=self["@defaultValue"];
  18475. return $1;
  18476. },
  18477. args: [],
  18478. source: "defaultValue\x0a\x09^ defaultValue",
  18479. messageSends: [],
  18480. referencedClasses: []
  18481. }),
  18482. globals.Setting);
  18483. smalltalk.addMethod(
  18484. smalltalk.method({
  18485. selector: "defaultValue:",
  18486. protocol: 'accessing',
  18487. fn: function (anObject){
  18488. var self=this;
  18489. self["@defaultValue"]=anObject;
  18490. return self},
  18491. args: ["anObject"],
  18492. source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
  18493. messageSends: [],
  18494. referencedClasses: []
  18495. }),
  18496. globals.Setting);
  18497. smalltalk.addMethod(
  18498. smalltalk.method({
  18499. selector: "key",
  18500. protocol: 'accessing',
  18501. fn: function (){
  18502. var self=this;
  18503. var $1;
  18504. $1=self["@key"];
  18505. return $1;
  18506. },
  18507. args: [],
  18508. source: "key\x0a\x09^ key",
  18509. messageSends: [],
  18510. referencedClasses: []
  18511. }),
  18512. globals.Setting);
  18513. smalltalk.addMethod(
  18514. smalltalk.method({
  18515. selector: "key:",
  18516. protocol: 'accessing',
  18517. fn: function (anObject){
  18518. var self=this;
  18519. self["@key"]=anObject;
  18520. return self},
  18521. args: ["anObject"],
  18522. source: "key: anObject\x0a\x09key := anObject",
  18523. messageSends: [],
  18524. referencedClasses: []
  18525. }),
  18526. globals.Setting);
  18527. smalltalk.addMethod(
  18528. smalltalk.method({
  18529. selector: "value",
  18530. protocol: 'accessing',
  18531. fn: function (){
  18532. var self=this;
  18533. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18534. return smalltalk.withContext(function($ctx1) {
  18535. var $1;
  18536. $1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  18537. return smalltalk.withContext(function($ctx2) {
  18538. return self._defaultValue();
  18539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  18540. return $1;
  18541. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)})},
  18542. args: [],
  18543. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  18544. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"],
  18545. referencedClasses: ["Smalltalk"]
  18546. }),
  18547. globals.Setting);
  18548. smalltalk.addMethod(
  18549. smalltalk.method({
  18550. selector: "value:",
  18551. protocol: 'accessing',
  18552. fn: function (aString){
  18553. var self=this;
  18554. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  18555. return smalltalk.withContext(function($ctx1) {
  18556. var $1;
  18557. $1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
  18558. return $1;
  18559. }, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)})},
  18560. args: ["aString"],
  18561. source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
  18562. messageSends: ["at:put:", "settings", "key"],
  18563. referencedClasses: ["Smalltalk"]
  18564. }),
  18565. globals.Setting);
  18566. smalltalk.addMethod(
  18567. smalltalk.method({
  18568. selector: "at:ifAbsent:",
  18569. protocol: 'instance creation',
  18570. fn: function (aString,anotherString){
  18571. var self=this;
  18572. return smalltalk.withContext(function($ctx1) {
  18573. var $2,$3,$1;
  18574. $2=($ctx1.supercall = true, globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []));
  18575. $ctx1.supercall = false;
  18576. _st($2)._key_(aString);
  18577. _st($2)._defaultValue_(anotherString);
  18578. $3=_st($2)._yourself();
  18579. $1=$3;
  18580. return $1;
  18581. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)})},
  18582. args: ["aString", "anotherString"],
  18583. source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
  18584. messageSends: ["key:", "new", "defaultValue:", "yourself"],
  18585. referencedClasses: []
  18586. }),
  18587. globals.Setting.klass);
  18588. smalltalk.addMethod(
  18589. smalltalk.method({
  18590. selector: "new",
  18591. protocol: 'instance creation',
  18592. fn: function (){
  18593. var self=this;
  18594. return smalltalk.withContext(function($ctx1) {
  18595. self._shouldNotImplement();
  18596. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)})},
  18597. args: [],
  18598. source: "new\x0a\x09self shouldNotImplement",
  18599. messageSends: ["shouldNotImplement"],
  18600. referencedClasses: []
  18601. }),
  18602. globals.Setting.klass);
  18603. smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
  18604. globals.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `smalltalk` declared in `support/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\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 or `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 package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `support/parser.js` parser file in order to work.";
  18605. smalltalk.addMethod(
  18606. smalltalk.method({
  18607. selector: "addGlobalJsVariable:",
  18608. protocol: 'globals',
  18609. fn: function (aString){
  18610. var self=this;
  18611. return smalltalk.withContext(function($ctx1) {
  18612. _st(self._globalJsVariables())._add_(aString);
  18613. return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  18614. args: ["aString"],
  18615. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  18616. messageSends: ["add:", "globalJsVariables"],
  18617. referencedClasses: []
  18618. }),
  18619. globals.SmalltalkImage);
  18620. smalltalk.addMethod(
  18621. smalltalk.method({
  18622. selector: "amdRequire",
  18623. protocol: 'accessing amd',
  18624. fn: function (){
  18625. var self=this;
  18626. return smalltalk.withContext(function($ctx1) {
  18627. var $1;
  18628. $1=_st(self._vm())._at_("amdRequire");
  18629. return $1;
  18630. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)})},
  18631. args: [],
  18632. source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
  18633. messageSends: ["at:", "vm"],
  18634. referencedClasses: []
  18635. }),
  18636. globals.SmalltalkImage);
  18637. smalltalk.addMethod(
  18638. smalltalk.method({
  18639. selector: "asSmalltalkException:",
  18640. protocol: 'error handling',
  18641. fn: function (anObject){
  18642. var self=this;
  18643. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  18644. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  18645. return smalltalk.withContext(function($ctx1) {
  18646. var $2,$1;
  18647. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  18648. return smalltalk.withContext(function($ctx2) {
  18649. return _st(anObject)._isKindOf_($Error());
  18650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  18651. if(smalltalk.assert($2)){
  18652. $1=anObject;
  18653. } else {
  18654. $1=_st($JavaScriptException())._on_(anObject);
  18655. };
  18656. return $1;
  18657. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)})},
  18658. args: ["anObject"],
  18659. 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 ]",
  18660. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
  18661. referencedClasses: ["Error", "JavaScriptException"]
  18662. }),
  18663. globals.SmalltalkImage);
  18664. smalltalk.addMethod(
  18665. smalltalk.method({
  18666. selector: "at:",
  18667. protocol: 'accessing',
  18668. fn: function (aString){
  18669. var self=this;
  18670. return smalltalk.withContext(function($ctx1) {
  18671. var $1;
  18672. self._deprecatedAPI();
  18673. $1=_st(self._globals())._at_(aString);
  18674. return $1;
  18675. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)})},
  18676. args: ["aString"],
  18677. source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
  18678. messageSends: ["deprecatedAPI", "at:", "globals"],
  18679. referencedClasses: []
  18680. }),
  18681. globals.SmalltalkImage);
  18682. smalltalk.addMethod(
  18683. smalltalk.method({
  18684. selector: "at:ifAbsent:",
  18685. protocol: 'accessing',
  18686. fn: function (aKey,aBlock){
  18687. var self=this;
  18688. return smalltalk.withContext(function($ctx1) {
  18689. var $2,$1;
  18690. $2=self._includesKey_(aKey);
  18691. if(smalltalk.assert($2)){
  18692. $1=self._at_(aKey);
  18693. } else {
  18694. $1=_st(aBlock)._value();
  18695. };
  18696. return $1;
  18697. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)})},
  18698. args: ["aKey", "aBlock"],
  18699. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  18700. messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
  18701. referencedClasses: []
  18702. }),
  18703. globals.SmalltalkImage);
  18704. smalltalk.addMethod(
  18705. smalltalk.method({
  18706. selector: "at:put:",
  18707. protocol: 'accessing',
  18708. fn: function (aString,anObject){
  18709. var self=this;
  18710. return smalltalk.withContext(function($ctx1) {
  18711. var $1;
  18712. self._deprecatedAPI();
  18713. $1=_st(self._globals())._at_put_(aString,anObject);
  18714. return $1;
  18715. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)})},
  18716. args: ["aString", "anObject"],
  18717. source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
  18718. messageSends: ["deprecatedAPI", "at:put:", "globals"],
  18719. referencedClasses: []
  18720. }),
  18721. globals.SmalltalkImage);
  18722. smalltalk.addMethod(
  18723. smalltalk.method({
  18724. selector: "basicCreatePackage:",
  18725. protocol: 'private',
  18726. fn: function (packageName){
  18727. var self=this;
  18728. return smalltalk.withContext(function($ctx1) {
  18729. return smalltalk.addPackage(packageName);
  18730. return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  18731. args: ["packageName"],
  18732. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
  18733. messageSends: [],
  18734. referencedClasses: []
  18735. }),
  18736. globals.SmalltalkImage);
  18737. smalltalk.addMethod(
  18738. smalltalk.method({
  18739. selector: "basicParse:",
  18740. protocol: 'private',
  18741. fn: function (aString){
  18742. var self=this;
  18743. function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  18744. return smalltalk.withContext(function($ctx1) {
  18745. var $1;
  18746. $1=_st($SmalltalkParser())._parse_(aString);
  18747. return $1;
  18748. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)})},
  18749. args: ["aString"],
  18750. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  18751. messageSends: ["parse:"],
  18752. referencedClasses: ["SmalltalkParser"]
  18753. }),
  18754. globals.SmalltalkImage);
  18755. smalltalk.addMethod(
  18756. smalltalk.method({
  18757. selector: "classes",
  18758. protocol: 'classes',
  18759. fn: function (){
  18760. var self=this;
  18761. return smalltalk.withContext(function($ctx1) {
  18762. return smalltalk.classes();
  18763. return self}, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)})},
  18764. args: [],
  18765. source: "classes\x0a\x09<return smalltalk.classes()>",
  18766. messageSends: [],
  18767. referencedClasses: []
  18768. }),
  18769. globals.SmalltalkImage);
  18770. smalltalk.addMethod(
  18771. smalltalk.method({
  18772. selector: "createPackage:",
  18773. protocol: 'packages',
  18774. fn: function (packageName){
  18775. var self=this;
  18776. var package_,announcement;
  18777. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  18778. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  18779. return smalltalk.withContext(function($ctx1) {
  18780. var $1,$2,$3;
  18781. package_=self._basicCreatePackage_(packageName);
  18782. $1=_st($PackageAdded())._new();
  18783. _st($1)._package_(package_);
  18784. $2=_st($1)._yourself();
  18785. announcement=$2;
  18786. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  18787. $3=package_;
  18788. return $3;
  18789. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)})},
  18790. args: ["packageName"],
  18791. source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
  18792. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
  18793. referencedClasses: ["PackageAdded", "SystemAnnouncer"]
  18794. }),
  18795. globals.SmalltalkImage);
  18796. smalltalk.addMethod(
  18797. smalltalk.method({
  18798. selector: "createPackage:properties:",
  18799. protocol: 'private',
  18800. fn: function (packageName,aDict){
  18801. var self=this;
  18802. return smalltalk.withContext(function($ctx1) {
  18803. var $1,$2;
  18804. self._deprecatedAPI();
  18805. $1=_st(aDict)._isEmpty();
  18806. if(! smalltalk.assert($1)){
  18807. self._error_("createPackage:properties: called with nonempty properties");
  18808. };
  18809. $2=self._createPackage_(packageName);
  18810. return $2;
  18811. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)})},
  18812. args: ["packageName", "aDict"],
  18813. 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",
  18814. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
  18815. referencedClasses: []
  18816. }),
  18817. globals.SmalltalkImage);
  18818. smalltalk.addMethod(
  18819. smalltalk.method({
  18820. selector: "current",
  18821. protocol: 'accessing',
  18822. fn: function (){
  18823. var self=this;
  18824. return smalltalk.withContext(function($ctx1) {
  18825. self._deprecatedAPI();
  18826. return self;
  18827. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)})},
  18828. args: [],
  18829. source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
  18830. messageSends: ["deprecatedAPI"],
  18831. referencedClasses: []
  18832. }),
  18833. globals.SmalltalkImage);
  18834. smalltalk.addMethod(
  18835. smalltalk.method({
  18836. selector: "defaultAmdNamespace",
  18837. protocol: 'accessing amd',
  18838. fn: function (){
  18839. var self=this;
  18840. return smalltalk.withContext(function($ctx1) {
  18841. var $1;
  18842. $1="transport.defaultAmdNamespace"._settingValue();
  18843. return $1;
  18844. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)})},
  18845. args: [],
  18846. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  18847. messageSends: ["settingValue"],
  18848. referencedClasses: []
  18849. }),
  18850. globals.SmalltalkImage);
  18851. smalltalk.addMethod(
  18852. smalltalk.method({
  18853. selector: "defaultAmdNamespace:",
  18854. protocol: 'accessing amd',
  18855. fn: function (aString){
  18856. var self=this;
  18857. return smalltalk.withContext(function($ctx1) {
  18858. "transport.defaultAmdNamespace"._settingValue_(aString);
  18859. return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)})},
  18860. args: ["aString"],
  18861. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  18862. messageSends: ["settingValue:"],
  18863. referencedClasses: []
  18864. }),
  18865. globals.SmalltalkImage);
  18866. smalltalk.addMethod(
  18867. smalltalk.method({
  18868. selector: "deleteClass:",
  18869. protocol: 'private',
  18870. fn: function (aClass){
  18871. var self=this;
  18872. return smalltalk.withContext(function($ctx1) {
  18873. smalltalk.removeClass(aClass);
  18874. return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)})},
  18875. args: ["aClass"],
  18876. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
  18877. messageSends: [],
  18878. referencedClasses: []
  18879. }),
  18880. globals.SmalltalkImage);
  18881. smalltalk.addMethod(
  18882. smalltalk.method({
  18883. selector: "deleteGlobalJsVariable:",
  18884. protocol: 'globals',
  18885. fn: function (aString){
  18886. var self=this;
  18887. return smalltalk.withContext(function($ctx1) {
  18888. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  18889. }));
  18890. return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)})},
  18891. args: ["aString"],
  18892. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  18893. messageSends: ["remove:ifAbsent:", "globalJsVariables"],
  18894. referencedClasses: []
  18895. }),
  18896. globals.SmalltalkImage);
  18897. smalltalk.addMethod(
  18898. smalltalk.method({
  18899. selector: "deletePackage:",
  18900. protocol: 'private',
  18901. fn: function (packageName){
  18902. var self=this;
  18903. return smalltalk.withContext(function($ctx1) {
  18904. delete smalltalk.packages[packageName];
  18905. return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)})},
  18906. args: ["packageName"],
  18907. 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]>",
  18908. messageSends: [],
  18909. referencedClasses: []
  18910. }),
  18911. globals.SmalltalkImage);
  18912. smalltalk.addMethod(
  18913. smalltalk.method({
  18914. selector: "globalJsVariables",
  18915. protocol: 'globals',
  18916. fn: function (){
  18917. var self=this;
  18918. return smalltalk.withContext(function($ctx1) {
  18919. return smalltalk.globalJsVariables;
  18920. return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)})},
  18921. args: [],
  18922. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
  18923. messageSends: [],
  18924. referencedClasses: []
  18925. }),
  18926. globals.SmalltalkImage);
  18927. smalltalk.addMethod(
  18928. smalltalk.method({
  18929. selector: "globals",
  18930. protocol: 'accessing',
  18931. fn: function (){
  18932. var self=this;
  18933. return smalltalk.withContext(function($ctx1) {
  18934. return globals;
  18935. return self}, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)})},
  18936. args: [],
  18937. source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
  18938. messageSends: [],
  18939. referencedClasses: []
  18940. }),
  18941. globals.SmalltalkImage);
  18942. smalltalk.addMethod(
  18943. smalltalk.method({
  18944. selector: "includesKey:",
  18945. protocol: 'accessing',
  18946. fn: function (aKey){
  18947. var self=this;
  18948. return smalltalk.withContext(function($ctx1) {
  18949. return smalltalk.hasOwnProperty(aKey);
  18950. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)})},
  18951. args: ["aKey"],
  18952. source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
  18953. messageSends: [],
  18954. referencedClasses: []
  18955. }),
  18956. globals.SmalltalkImage);
  18957. smalltalk.addMethod(
  18958. smalltalk.method({
  18959. selector: "isSmalltalkObject:",
  18960. protocol: 'testing',
  18961. fn: function (anObject){
  18962. var self=this;
  18963. return smalltalk.withContext(function($ctx1) {
  18964. return typeof anObject.klass !== 'undefined';
  18965. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)})},
  18966. args: ["anObject"],
  18967. 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'>",
  18968. messageSends: [],
  18969. referencedClasses: []
  18970. }),
  18971. globals.SmalltalkImage);
  18972. smalltalk.addMethod(
  18973. smalltalk.method({
  18974. selector: "packageAt:",
  18975. protocol: 'packages',
  18976. fn: function (packageName){
  18977. var self=this;
  18978. return smalltalk.withContext(function($ctx1) {
  18979. return smalltalk.packages[packageName];
  18980. return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)})},
  18981. args: ["packageName"],
  18982. source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
  18983. messageSends: [],
  18984. referencedClasses: []
  18985. }),
  18986. globals.SmalltalkImage);
  18987. smalltalk.addMethod(
  18988. smalltalk.method({
  18989. selector: "packageAt:ifAbsent:",
  18990. protocol: 'packages',
  18991. fn: function (packageName,aBlock){
  18992. var self=this;
  18993. return smalltalk.withContext(function($ctx1) {
  18994. var $2,$1;
  18995. $2=self._packageAt_(packageName);
  18996. $1=_st($2)._ifNil_(aBlock);
  18997. return $1;
  18998. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)})},
  18999. args: ["packageName", "aBlock"],
  19000. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  19001. messageSends: ["ifNil:", "packageAt:"],
  19002. referencedClasses: []
  19003. }),
  19004. globals.SmalltalkImage);
  19005. smalltalk.addMethod(
  19006. smalltalk.method({
  19007. selector: "packages",
  19008. protocol: 'packages',
  19009. fn: function (){
  19010. var self=this;
  19011. return smalltalk.withContext(function($ctx1) {
  19012. return Object.keys(smalltalk.packages).map(function(k) {
  19013. return smalltalk.packages[k];
  19014. })
  19015. ;
  19016. return self}, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)})},
  19017. args: [],
  19018. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys(smalltalk.packages).map(function(k) {\x0a\x09\x09\x09return smalltalk.packages[k];\x0a\x09\x09})\x0a\x09>",
  19019. messageSends: [],
  19020. referencedClasses: []
  19021. }),
  19022. globals.SmalltalkImage);
  19023. smalltalk.addMethod(
  19024. smalltalk.method({
  19025. selector: "parse:",
  19026. protocol: 'accessing',
  19027. fn: function (aString){
  19028. var self=this;
  19029. var result;
  19030. return smalltalk.withContext(function($ctx1) {
  19031. var $2,$3,$1;
  19032. _st((function(){
  19033. return smalltalk.withContext(function($ctx2) {
  19034. result=self._basicParse_(aString);
  19035. return result;
  19036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._tryCatch_((function(ex){
  19037. return smalltalk.withContext(function($ctx2) {
  19038. return _st(self._parseError_parsing_(ex,aString))._signal();
  19039. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  19040. $2=result;
  19041. _st($2)._source_(aString);
  19042. $3=_st($2)._yourself();
  19043. $1=$3;
  19044. return $1;
  19045. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)})},
  19046. args: ["aString"],
  19047. source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09[ result := self basicParse: aString ] \x0a\x09\x09tryCatch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
  19048. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
  19049. referencedClasses: []
  19050. }),
  19051. globals.SmalltalkImage);
  19052. smalltalk.addMethod(
  19053. smalltalk.method({
  19054. selector: "parseError:parsing:",
  19055. protocol: 'error handling',
  19056. fn: function (anException,aString){
  19057. var self=this;
  19058. function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  19059. return smalltalk.withContext(function($ctx1) {
  19060. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  19061. $2=_st($ParseError())._new();
  19062. $8=_st(anException)._basicAt_("line");
  19063. $ctx1.sendIdx["basicAt:"]=1;
  19064. $7="Parse error on line ".__comma($8);
  19065. $6=_st($7).__comma(" column ");
  19066. $ctx1.sendIdx[","]=4;
  19067. $9=_st(anException)._basicAt_("column");
  19068. $ctx1.sendIdx["basicAt:"]=2;
  19069. $5=_st($6).__comma($9);
  19070. $ctx1.sendIdx[","]=3;
  19071. $4=_st($5).__comma(" : Unexpected character ");
  19072. $ctx1.sendIdx[","]=2;
  19073. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  19074. $ctx1.sendIdx[","]=1;
  19075. $1=_st($2)._messageText_($3);
  19076. return $1;
  19077. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)})},
  19078. args: ["anException", "aString"],
  19079. 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')",
  19080. messageSends: ["messageText:", "new", ",", "basicAt:"],
  19081. referencedClasses: ["ParseError"]
  19082. }),
  19083. globals.SmalltalkImage);
  19084. smalltalk.addMethod(
  19085. smalltalk.method({
  19086. selector: "pseudoVariableNames",
  19087. protocol: 'accessing',
  19088. fn: function (){
  19089. var self=this;
  19090. var $1;
  19091. $1=["self", "super", "nil", "true", "false", "thisContext"];
  19092. return $1;
  19093. },
  19094. args: [],
  19095. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  19096. messageSends: [],
  19097. referencedClasses: []
  19098. }),
  19099. globals.SmalltalkImage);
  19100. smalltalk.addMethod(
  19101. smalltalk.method({
  19102. selector: "readJSObject:",
  19103. protocol: 'accessing',
  19104. fn: function (anObject){
  19105. var self=this;
  19106. return smalltalk.withContext(function($ctx1) {
  19107. return smalltalk.readJSObject(anObject);
  19108. return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)})},
  19109. args: ["anObject"],
  19110. source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
  19111. messageSends: [],
  19112. referencedClasses: []
  19113. }),
  19114. globals.SmalltalkImage);
  19115. smalltalk.addMethod(
  19116. smalltalk.method({
  19117. selector: "removeClass:",
  19118. protocol: 'classes',
  19119. fn: function (aClass){
  19120. var self=this;
  19121. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  19122. function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  19123. return smalltalk.withContext(function($ctx1) {
  19124. var $1,$2,$3;
  19125. $1=_st(aClass)._isMetaclass();
  19126. if(smalltalk.assert($1)){
  19127. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  19128. };
  19129. self._deleteClass_(aClass);
  19130. $2=_st($ClassRemoved())._new();
  19131. _st($2)._theClass_(aClass);
  19132. $3=_st($2)._yourself();
  19133. _st(_st($SystemAnnouncer())._current())._announce_($3);
  19134. return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)})},
  19135. args: ["aClass"],
  19136. 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)",
  19137. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
  19138. referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
  19139. }),
  19140. globals.SmalltalkImage);
  19141. smalltalk.addMethod(
  19142. smalltalk.method({
  19143. selector: "removePackage:",
  19144. protocol: 'packages',
  19145. fn: function (packageName){
  19146. var self=this;
  19147. var pkg;
  19148. return smalltalk.withContext(function($ctx1) {
  19149. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19150. return smalltalk.withContext(function($ctx2) {
  19151. return self._error_("Missing package: ".__comma(packageName));
  19152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  19153. _st(_st(pkg)._classes())._do_((function(each){
  19154. return smalltalk.withContext(function($ctx2) {
  19155. return self._removeClass_(each);
  19156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  19157. self._deletePackage_(packageName);
  19158. return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)})},
  19159. args: ["packageName"],
  19160. 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",
  19161. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
  19162. referencedClasses: []
  19163. }),
  19164. globals.SmalltalkImage);
  19165. smalltalk.addMethod(
  19166. smalltalk.method({
  19167. selector: "renamePackage:to:",
  19168. protocol: 'packages',
  19169. fn: function (packageName,newName){
  19170. var self=this;
  19171. var pkg;
  19172. return smalltalk.withContext(function($ctx1) {
  19173. var $1,$2,$receiver;
  19174. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  19175. return smalltalk.withContext(function($ctx2) {
  19176. $1="Missing package: ".__comma(packageName);
  19177. $ctx2.sendIdx[","]=1;
  19178. return self._error_($1);
  19179. $ctx2.sendIdx["error:"]=1;
  19180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  19181. $2=self._packageAt_(newName);
  19182. if(($receiver = $2) == null || $receiver.isNil){
  19183. $2;
  19184. } else {
  19185. self._error_("Already exists a package called: ".__comma(newName));
  19186. };
  19187. _st(self._at_("packages"))._at_put_(newName,pkg);
  19188. _st(pkg)._name_(newName);
  19189. self._deletePackage_(packageName);
  19190. return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)})},
  19191. args: ["packageName", "newName"],
  19192. 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 at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
  19193. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
  19194. referencedClasses: []
  19195. }),
  19196. globals.SmalltalkImage);
  19197. smalltalk.addMethod(
  19198. smalltalk.method({
  19199. selector: "reservedWords",
  19200. protocol: 'accessing',
  19201. fn: function (){
  19202. var self=this;
  19203. return smalltalk.withContext(function($ctx1) {
  19204. return smalltalk.reservedWords;
  19205. return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)})},
  19206. args: [],
  19207. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
  19208. messageSends: [],
  19209. referencedClasses: []
  19210. }),
  19211. globals.SmalltalkImage);
  19212. smalltalk.addMethod(
  19213. smalltalk.method({
  19214. selector: "settings",
  19215. protocol: 'accessing',
  19216. fn: function (){
  19217. var self=this;
  19218. function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  19219. return $SmalltalkSettings();
  19220. },
  19221. args: [],
  19222. source: "settings\x0a\x09^ SmalltalkSettings",
  19223. messageSends: [],
  19224. referencedClasses: ["SmalltalkSettings"]
  19225. }),
  19226. globals.SmalltalkImage);
  19227. smalltalk.addMethod(
  19228. smalltalk.method({
  19229. selector: "version",
  19230. protocol: 'accessing',
  19231. fn: function (){
  19232. var self=this;
  19233. return "0.13.0-pre";
  19234. },
  19235. args: [],
  19236. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  19237. messageSends: [],
  19238. referencedClasses: []
  19239. }),
  19240. globals.SmalltalkImage);
  19241. smalltalk.addMethod(
  19242. smalltalk.method({
  19243. selector: "vm",
  19244. protocol: 'accessing',
  19245. fn: function (){
  19246. var self=this;
  19247. return smalltalk.withContext(function($ctx1) {
  19248. return smalltalk;
  19249. return self}, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)})},
  19250. args: [],
  19251. source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
  19252. messageSends: [],
  19253. referencedClasses: []
  19254. }),
  19255. globals.SmalltalkImage);
  19256. globals.SmalltalkImage.klass.iVarNames = ['current'];
  19257. smalltalk.addMethod(
  19258. smalltalk.method({
  19259. selector: "current",
  19260. protocol: 'instance creation',
  19261. fn: function (){
  19262. var self=this;
  19263. return smalltalk.withContext(function($ctx1) {
  19264. var $2,$1,$receiver;
  19265. $2=self["@current"];
  19266. if(($receiver = $2) == null || $receiver.isNil){
  19267. self["@current"]=($ctx1.supercall = true, globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []));
  19268. $ctx1.supercall = false;
  19269. $1=self["@current"];
  19270. } else {
  19271. self._deprecatedAPI();
  19272. $1=self["@current"];
  19273. };
  19274. return $1;
  19275. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)})},
  19276. args: [],
  19277. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  19278. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"],
  19279. referencedClasses: []
  19280. }),
  19281. globals.SmalltalkImage.klass);
  19282. smalltalk.addMethod(
  19283. smalltalk.method({
  19284. selector: "initialize",
  19285. protocol: 'initialization',
  19286. fn: function (){
  19287. var self=this;
  19288. return smalltalk.withContext(function($ctx1) {
  19289. _st(globals)._at_put_("Smalltalk",self._current());
  19290. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)})},
  19291. args: [],
  19292. source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
  19293. messageSends: ["at:put:", "current"],
  19294. referencedClasses: []
  19295. }),
  19296. globals.SmalltalkImage.klass);
  19297. smalltalk.addMethod(
  19298. smalltalk.method({
  19299. selector: "new",
  19300. protocol: 'instance creation',
  19301. fn: function (){
  19302. var self=this;
  19303. return smalltalk.withContext(function($ctx1) {
  19304. self._shouldNotImplement();
  19305. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)})},
  19306. args: [],
  19307. source: "new\x0a\x09self shouldNotImplement",
  19308. messageSends: ["shouldNotImplement"],
  19309. referencedClasses: []
  19310. }),
  19311. globals.SmalltalkImage.klass);
  19312. smalltalk.addMethod(
  19313. smalltalk.method({
  19314. selector: "do:displayingProgress:",
  19315. protocol: '*Kernel-Infrastructure',
  19316. fn: function (aBlock,aString){
  19317. var self=this;
  19318. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  19319. return smalltalk.withContext(function($ctx1) {
  19320. _st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  19321. return self}, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)})},
  19322. args: ["aBlock", "aString"],
  19323. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  19324. messageSends: ["do:on:displaying:"],
  19325. referencedClasses: ["ProgressHandler"]
  19326. }),
  19327. globals.SequenceableCollection);
  19328. smalltalk.addMethod(
  19329. smalltalk.method({
  19330. selector: "asJavaScriptSelector",
  19331. protocol: '*Kernel-Infrastructure',
  19332. fn: function (){
  19333. var self=this;
  19334. return smalltalk.withContext(function($ctx1) {
  19335. var $1;
  19336. $1=self._replace_with_("^([a-zA-Z0-9]*).*$","$1");
  19337. return $1;
  19338. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)})},
  19339. args: [],
  19340. source: "asJavaScriptSelector\x0a\x09\x22Return first keyword of the selector, without trailing colon.\x22\x0a\x09^ self replace: '^([a-zA-Z0-9]*).*$' with: '$1'",
  19341. messageSends: ["replace:with:"],
  19342. referencedClasses: []
  19343. }),
  19344. globals.String);
  19345. smalltalk.addMethod(
  19346. smalltalk.method({
  19347. selector: "asSetting",
  19348. protocol: '*Kernel-Infrastructure',
  19349. fn: function (){
  19350. var self=this;
  19351. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19352. return smalltalk.withContext(function($ctx1) {
  19353. var $1;
  19354. $1=_st($Setting())._at_ifAbsent_(self,nil);
  19355. return $1;
  19356. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)})},
  19357. args: [],
  19358. source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
  19359. messageSends: ["at:ifAbsent:"],
  19360. referencedClasses: ["Setting"]
  19361. }),
  19362. globals.String);
  19363. smalltalk.addMethod(
  19364. smalltalk.method({
  19365. selector: "asSettingIfAbsent:",
  19366. protocol: '*Kernel-Infrastructure',
  19367. fn: function (aString){
  19368. var self=this;
  19369. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  19370. return smalltalk.withContext(function($ctx1) {
  19371. var $1;
  19372. $1=_st($Setting())._at_ifAbsent_(self,aString);
  19373. return $1;
  19374. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)})},
  19375. args: ["aString"],
  19376. source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
  19377. messageSends: ["at:ifAbsent:"],
  19378. referencedClasses: ["Setting"]
  19379. }),
  19380. globals.String);
  19381. smalltalk.addMethod(
  19382. smalltalk.method({
  19383. selector: "settingValue",
  19384. protocol: '*Kernel-Infrastructure',
  19385. fn: function (){
  19386. var self=this;
  19387. return smalltalk.withContext(function($ctx1) {
  19388. var $1;
  19389. $1=_st(self._asSetting())._value();
  19390. return $1;
  19391. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)})},
  19392. args: [],
  19393. source: "settingValue\x0a\x09^ self asSetting value",
  19394. messageSends: ["value", "asSetting"],
  19395. referencedClasses: []
  19396. }),
  19397. globals.String);
  19398. smalltalk.addMethod(
  19399. smalltalk.method({
  19400. selector: "settingValue:",
  19401. protocol: '*Kernel-Infrastructure',
  19402. fn: function (aString){
  19403. var self=this;
  19404. return smalltalk.withContext(function($ctx1) {
  19405. var $1;
  19406. $1=_st(self._asSetting())._value_(aString);
  19407. return $1;
  19408. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)})},
  19409. args: ["aString"],
  19410. source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
  19411. messageSends: ["value:", "asSetting"],
  19412. referencedClasses: []
  19413. }),
  19414. globals.String);
  19415. smalltalk.addMethod(
  19416. smalltalk.method({
  19417. selector: "settingValueIfAbsent:",
  19418. protocol: '*Kernel-Infrastructure',
  19419. fn: function (aString){
  19420. var self=this;
  19421. return smalltalk.withContext(function($ctx1) {
  19422. var $1;
  19423. $1=_st(self._asSettingIfAbsent_(aString))._value();
  19424. return $1;
  19425. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)})},
  19426. args: ["aString"],
  19427. source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
  19428. messageSends: ["value", "asSettingIfAbsent:"],
  19429. referencedClasses: []
  19430. }),
  19431. globals.String);
  19432. });
  19433. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  19434. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  19435. smalltalk.addPackage('Kernel-Exceptions');
  19436. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19437. smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
  19438. globals.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`.\x0aThese are used to represent error conditions that prevent the normal continuation of processing.\x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.";
  19439. smalltalk.addMethod(
  19440. smalltalk.method({
  19441. selector: "beHandled",
  19442. protocol: 'accessing',
  19443. fn: function (){
  19444. var self=this;
  19445. return smalltalk.withContext(function($ctx1) {
  19446. self.amberHandled = true;
  19447. return self}, function($ctx1) {$ctx1.fill(self,"beHandled",{},globals.Error)})},
  19448. args: [],
  19449. source: "beHandled\x0a\x09<self.amberHandled = true>",
  19450. messageSends: [],
  19451. referencedClasses: []
  19452. }),
  19453. globals.Error);
  19454. smalltalk.addMethod(
  19455. smalltalk.method({
  19456. selector: "beUnhandled",
  19457. protocol: 'accessing',
  19458. fn: function (){
  19459. var self=this;
  19460. return smalltalk.withContext(function($ctx1) {
  19461. self.amberHandled = false;
  19462. return self}, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},globals.Error)})},
  19463. args: [],
  19464. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  19465. messageSends: [],
  19466. referencedClasses: []
  19467. }),
  19468. globals.Error);
  19469. smalltalk.addMethod(
  19470. smalltalk.method({
  19471. selector: "context",
  19472. protocol: 'accessing',
  19473. fn: function (){
  19474. var self=this;
  19475. return smalltalk.withContext(function($ctx1) {
  19476. return self.context;
  19477. return self}, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)})},
  19478. args: [],
  19479. source: "context\x0a\x09<return self.context>",
  19480. messageSends: [],
  19481. referencedClasses: []
  19482. }),
  19483. globals.Error);
  19484. smalltalk.addMethod(
  19485. smalltalk.method({
  19486. selector: "initialize",
  19487. protocol: 'initialization',
  19488. fn: function (){
  19489. var self=this;
  19490. return smalltalk.withContext(function($ctx1) {
  19491. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  19492. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)})},
  19493. args: [],
  19494. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  19495. messageSends: ["messageText:", ",", "name", "class"],
  19496. referencedClasses: []
  19497. }),
  19498. globals.Error);
  19499. smalltalk.addMethod(
  19500. smalltalk.method({
  19501. selector: "isSmalltalkError",
  19502. protocol: 'testing',
  19503. fn: function (){
  19504. var self=this;
  19505. return smalltalk.withContext(function($ctx1) {
  19506. return self.smalltalkError === true;
  19507. return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)})},
  19508. args: [],
  19509. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  19510. messageSends: [],
  19511. referencedClasses: []
  19512. }),
  19513. globals.Error);
  19514. smalltalk.addMethod(
  19515. smalltalk.method({
  19516. selector: "jsStack",
  19517. protocol: 'accessing',
  19518. fn: function (){
  19519. var self=this;
  19520. return smalltalk.withContext(function($ctx1) {
  19521. return self.stack;
  19522. return self}, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)})},
  19523. args: [],
  19524. source: "jsStack\x0a\x09<return self.stack>",
  19525. messageSends: [],
  19526. referencedClasses: []
  19527. }),
  19528. globals.Error);
  19529. smalltalk.addMethod(
  19530. smalltalk.method({
  19531. selector: "messageText",
  19532. protocol: 'accessing',
  19533. fn: function (){
  19534. var self=this;
  19535. var $1;
  19536. $1=self["@messageText"];
  19537. return $1;
  19538. },
  19539. args: [],
  19540. source: "messageText\x0a\x09^ messageText",
  19541. messageSends: [],
  19542. referencedClasses: []
  19543. }),
  19544. globals.Error);
  19545. smalltalk.addMethod(
  19546. smalltalk.method({
  19547. selector: "messageText:",
  19548. protocol: 'accessing',
  19549. fn: function (aString){
  19550. var self=this;
  19551. self["@messageText"]=aString;
  19552. return self},
  19553. args: ["aString"],
  19554. source: "messageText: aString\x0a\x09messageText := aString",
  19555. messageSends: [],
  19556. referencedClasses: []
  19557. }),
  19558. globals.Error);
  19559. smalltalk.addMethod(
  19560. smalltalk.method({
  19561. selector: "resignal",
  19562. protocol: 'signaling',
  19563. fn: function (){
  19564. var self=this;
  19565. return smalltalk.withContext(function($ctx1) {
  19566. self.amberHandled = false;
  19567. throw(self);
  19568. ;
  19569. return self}, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)})},
  19570. args: [],
  19571. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  19572. messageSends: [],
  19573. referencedClasses: []
  19574. }),
  19575. globals.Error);
  19576. smalltalk.addMethod(
  19577. smalltalk.method({
  19578. selector: "signal",
  19579. protocol: 'signaling',
  19580. fn: function (){
  19581. var self=this;
  19582. return smalltalk.withContext(function($ctx1) {
  19583. self.amberHandled = false;
  19584. self.context = smalltalk.getThisContext();
  19585. self.smalltalkError = true; throw(self)
  19586. ;
  19587. return self}, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)})},
  19588. args: [],
  19589. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = smalltalk.getThisContext(); \x0a\x09\x09self.smalltalkError = true; throw(self)\x0a\x09>",
  19590. messageSends: [],
  19591. referencedClasses: []
  19592. }),
  19593. globals.Error);
  19594. smalltalk.addMethod(
  19595. smalltalk.method({
  19596. selector: "signal:",
  19597. protocol: 'signaling',
  19598. fn: function (aString){
  19599. var self=this;
  19600. return smalltalk.withContext(function($ctx1) {
  19601. self._messageText_(aString);
  19602. self._signal();
  19603. return self}, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)})},
  19604. args: ["aString"],
  19605. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  19606. messageSends: ["messageText:", "signal"],
  19607. referencedClasses: []
  19608. }),
  19609. globals.Error);
  19610. smalltalk.addMethod(
  19611. smalltalk.method({
  19612. selector: "signalerContext",
  19613. protocol: 'accessing',
  19614. fn: function (){
  19615. var self=this;
  19616. return smalltalk.withContext(function($ctx1) {
  19617. var $1;
  19618. $1=self._signalerContextFrom_(self._context());
  19619. return $1;
  19620. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},globals.Error)})},
  19621. args: [],
  19622. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  19623. messageSends: ["signalerContextFrom:", "context"],
  19624. referencedClasses: []
  19625. }),
  19626. globals.Error);
  19627. smalltalk.addMethod(
  19628. smalltalk.method({
  19629. selector: "signalerContextFrom:",
  19630. protocol: 'accessing',
  19631. fn: function (aContext){
  19632. var self=this;
  19633. return smalltalk.withContext(function($ctx1) {
  19634. var $4,$3,$2,$1;
  19635. $1=_st(aContext)._findContextSuchThat_((function(context){
  19636. return smalltalk.withContext(function($ctx2) {
  19637. $4=_st(context)._receiver();
  19638. $ctx2.sendIdx["receiver"]=1;
  19639. $3=_st($4).__eq_eq(self);
  19640. $ctx2.sendIdx["=="]=1;
  19641. $2=_st($3)._or_((function(){
  19642. return smalltalk.withContext(function($ctx3) {
  19643. return _st(_st(context)._receiver()).__eq_eq(self._class());
  19644. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  19645. return _st($2)._not();
  19646. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)})}));
  19647. return $1;
  19648. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Error)})},
  19649. args: ["aContext"],
  19650. source: "signalerContextFrom: aContext\x0a\x09\x22Find the first sender of signal(:), the first context which is neither \x0a\x09for an instance method nor for a class side method of Exception (or subclass).\x0a\x09This will make sure that the same context is found for both, `Error signal` \x0a\x09and `Error new signal`\x22\x0a\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ context receiver == self class ]) not ]",
  19651. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"],
  19652. referencedClasses: []
  19653. }),
  19654. globals.Error);
  19655. smalltalk.addMethod(
  19656. smalltalk.method({
  19657. selector: "wasHandled",
  19658. protocol: 'testing',
  19659. fn: function (){
  19660. var self=this;
  19661. return smalltalk.withContext(function($ctx1) {
  19662. return self.amberHandled || false;
  19663. return self}, function($ctx1) {$ctx1.fill(self,"wasHandled",{},globals.Error)})},
  19664. args: [],
  19665. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  19666. messageSends: [],
  19667. referencedClasses: []
  19668. }),
  19669. globals.Error);
  19670. smalltalk.addMethod(
  19671. smalltalk.method({
  19672. selector: "heliosClass",
  19673. protocol: 'helios',
  19674. fn: function (){
  19675. var self=this;
  19676. return "exception";
  19677. },
  19678. args: [],
  19679. source: "heliosClass\x0a\x09^ 'exception'",
  19680. messageSends: [],
  19681. referencedClasses: []
  19682. }),
  19683. globals.Error.klass);
  19684. smalltalk.addMethod(
  19685. smalltalk.method({
  19686. selector: "signal",
  19687. protocol: 'instance creation',
  19688. fn: function (){
  19689. var self=this;
  19690. return smalltalk.withContext(function($ctx1) {
  19691. var $1;
  19692. $1=_st(self._new())._signal();
  19693. return $1;
  19694. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)})},
  19695. args: [],
  19696. source: "signal\x0a\x09^ self new signal",
  19697. messageSends: ["signal", "new"],
  19698. referencedClasses: []
  19699. }),
  19700. globals.Error.klass);
  19701. smalltalk.addMethod(
  19702. smalltalk.method({
  19703. selector: "signal:",
  19704. protocol: 'instance creation',
  19705. fn: function (aString){
  19706. var self=this;
  19707. return smalltalk.withContext(function($ctx1) {
  19708. var $1;
  19709. $1=_st(self._new())._signal_(aString);
  19710. return $1;
  19711. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)})},
  19712. args: ["aString"],
  19713. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  19714. messageSends: ["signal:", "new"],
  19715. referencedClasses: []
  19716. }),
  19717. globals.Error.klass);
  19718. smalltalk.addClass('Halt', globals.Error, [], 'Kernel-Exceptions');
  19719. globals.Halt.comment="I am provided to support `Object>>#halt`.";
  19720. smalltalk.addMethod(
  19721. smalltalk.method({
  19722. selector: "messageText",
  19723. protocol: 'accessing',
  19724. fn: function (){
  19725. var self=this;
  19726. return "Halt encountered";
  19727. },
  19728. args: [],
  19729. source: "messageText\x0a\x09^ 'Halt encountered'",
  19730. messageSends: [],
  19731. referencedClasses: []
  19732. }),
  19733. globals.Halt);
  19734. smalltalk.addMethod(
  19735. smalltalk.method({
  19736. selector: "signalerContextFrom:",
  19737. protocol: 'accessing',
  19738. fn: function (aContext){
  19739. var self=this;
  19740. return smalltalk.withContext(function($ctx1) {
  19741. var $4,$3,$2,$1;
  19742. $1=_st(aContext)._findContextSuchThat_((function(context){
  19743. return smalltalk.withContext(function($ctx2) {
  19744. $4=_st(context)._receiver();
  19745. $ctx2.sendIdx["receiver"]=1;
  19746. $3=_st($4).__eq_eq(self);
  19747. $ctx2.sendIdx["=="]=1;
  19748. $2=_st($3)._or_((function(){
  19749. return smalltalk.withContext(function($ctx3) {
  19750. return _st(_st(_st(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  19751. return smalltalk.withContext(function($ctx4) {
  19752. return _st(_st(_st(context)._method())._selector()).__eq("halt");
  19753. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})}));
  19754. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  19755. $ctx2.sendIdx["or:"]=1;
  19756. return _st($2)._not();
  19757. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)})}));
  19758. return $1;
  19759. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Halt)})},
  19760. args: ["aContext"],
  19761. source: "signalerContextFrom: aContext\x0a\x09\x22specialized version to find the proper context to open the debugger on.\x0a\x09This will find the first context whose method is no longer on `Halt` or \x0a\x09`Halt class` nor is `#halt` method itself.\x22\x0a\x09\x0a\x09^ aContext findContextSuchThat: [ :context |\x0a\x09\x09(context receiver == self \x0a\x09\x09or: [ (context receiver == self class) \x0a\x09\x09or: [ context method selector = #halt ]]) not ]",
  19762. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"],
  19763. referencedClasses: []
  19764. }),
  19765. globals.Halt);
  19766. smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
  19767. globals.JavaScriptException.comment="A JavaScriptException is thrown when a non-Smalltalk exception occurs while in the Smalltalk stack.\x0aSee `boot.js` `inContext()` and `BlockClosure >> on:do:`";
  19768. smalltalk.addMethod(
  19769. smalltalk.method({
  19770. selector: "context:",
  19771. protocol: 'accessing',
  19772. fn: function (aMethodContext){
  19773. var self=this;
  19774. return smalltalk.withContext(function($ctx1) {
  19775. self.context = aMethodContext;
  19776. return self}, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)})},
  19777. args: ["aMethodContext"],
  19778. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  19779. messageSends: [],
  19780. referencedClasses: []
  19781. }),
  19782. globals.JavaScriptException);
  19783. smalltalk.addMethod(
  19784. smalltalk.method({
  19785. selector: "exception",
  19786. protocol: 'accessing',
  19787. fn: function (){
  19788. var self=this;
  19789. var $1;
  19790. $1=self["@exception"];
  19791. return $1;
  19792. },
  19793. args: [],
  19794. source: "exception\x0a\x09^ exception",
  19795. messageSends: [],
  19796. referencedClasses: []
  19797. }),
  19798. globals.JavaScriptException);
  19799. smalltalk.addMethod(
  19800. smalltalk.method({
  19801. selector: "exception:",
  19802. protocol: 'accessing',
  19803. fn: function (anException){
  19804. var self=this;
  19805. self["@exception"]=anException;
  19806. return self},
  19807. args: ["anException"],
  19808. source: "exception: anException\x0a\x09exception := anException",
  19809. messageSends: [],
  19810. referencedClasses: []
  19811. }),
  19812. globals.JavaScriptException);
  19813. smalltalk.addMethod(
  19814. smalltalk.method({
  19815. selector: "messageText",
  19816. protocol: 'accessing',
  19817. fn: function (){
  19818. var self=this;
  19819. return smalltalk.withContext(function($ctx1) {
  19820. return 'JavaScript exception: ' + self["@exception"].toString();
  19821. return self}, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)})},
  19822. args: [],
  19823. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  19824. messageSends: [],
  19825. referencedClasses: []
  19826. }),
  19827. globals.JavaScriptException);
  19828. smalltalk.addMethod(
  19829. smalltalk.method({
  19830. selector: "on:",
  19831. protocol: 'instance creation',
  19832. fn: function (anException){
  19833. var self=this;
  19834. return smalltalk.withContext(function($ctx1) {
  19835. var $2,$3,$1;
  19836. $2=self._new();
  19837. _st($2)._exception_(anException);
  19838. $3=_st($2)._yourself();
  19839. $1=$3;
  19840. return $1;
  19841. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)})},
  19842. args: ["anException"],
  19843. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  19844. messageSends: ["exception:", "new", "yourself"],
  19845. referencedClasses: []
  19846. }),
  19847. globals.JavaScriptException.klass);
  19848. smalltalk.addMethod(
  19849. smalltalk.method({
  19850. selector: "on:context:",
  19851. protocol: 'instance creation',
  19852. fn: function (anException,aMethodContext){
  19853. var self=this;
  19854. return smalltalk.withContext(function($ctx1) {
  19855. var $2,$3,$1;
  19856. $2=self._new();
  19857. _st($2)._exception_(anException);
  19858. _st($2)._context_(aMethodContext);
  19859. $3=_st($2)._yourself();
  19860. $1=$3;
  19861. return $1;
  19862. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)})},
  19863. args: ["anException", "aMethodContext"],
  19864. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  19865. messageSends: ["exception:", "new", "context:", "yourself"],
  19866. referencedClasses: []
  19867. }),
  19868. globals.JavaScriptException.klass);
  19869. smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  19870. globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  19871. smalltalk.addMethod(
  19872. smalltalk.method({
  19873. selector: "message",
  19874. protocol: 'accessing',
  19875. fn: function (){
  19876. var self=this;
  19877. var $1;
  19878. $1=self["@message"];
  19879. return $1;
  19880. },
  19881. args: [],
  19882. source: "message\x0a\x09^ message",
  19883. messageSends: [],
  19884. referencedClasses: []
  19885. }),
  19886. globals.MessageNotUnderstood);
  19887. smalltalk.addMethod(
  19888. smalltalk.method({
  19889. selector: "message:",
  19890. protocol: 'accessing',
  19891. fn: function (aMessage){
  19892. var self=this;
  19893. self["@message"]=aMessage;
  19894. return self},
  19895. args: ["aMessage"],
  19896. source: "message: aMessage\x0a\x09message := aMessage",
  19897. messageSends: [],
  19898. referencedClasses: []
  19899. }),
  19900. globals.MessageNotUnderstood);
  19901. smalltalk.addMethod(
  19902. smalltalk.method({
  19903. selector: "messageText",
  19904. protocol: 'accessing',
  19905. fn: function (){
  19906. var self=this;
  19907. return smalltalk.withContext(function($ctx1) {
  19908. var $1;
  19909. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  19910. $ctx1.sendIdx[","]=1;
  19911. return $1;
  19912. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)})},
  19913. args: [],
  19914. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  19915. messageSends: [",", "asString", "receiver", "selector", "message"],
  19916. referencedClasses: []
  19917. }),
  19918. globals.MessageNotUnderstood);
  19919. smalltalk.addMethod(
  19920. smalltalk.method({
  19921. selector: "receiver",
  19922. protocol: 'accessing',
  19923. fn: function (){
  19924. var self=this;
  19925. var $1;
  19926. $1=self["@receiver"];
  19927. return $1;
  19928. },
  19929. args: [],
  19930. source: "receiver\x0a\x09^ receiver",
  19931. messageSends: [],
  19932. referencedClasses: []
  19933. }),
  19934. globals.MessageNotUnderstood);
  19935. smalltalk.addMethod(
  19936. smalltalk.method({
  19937. selector: "receiver:",
  19938. protocol: 'accessing',
  19939. fn: function (anObject){
  19940. var self=this;
  19941. self["@receiver"]=anObject;
  19942. return self},
  19943. args: ["anObject"],
  19944. source: "receiver: anObject\x0a\x09receiver := anObject",
  19945. messageSends: [],
  19946. referencedClasses: []
  19947. }),
  19948. globals.MessageNotUnderstood);
  19949. smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
  19950. globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  19951. smalltalk.addMethod(
  19952. smalltalk.method({
  19953. selector: "object",
  19954. protocol: 'accessing',
  19955. fn: function (){
  19956. var self=this;
  19957. var $1;
  19958. $1=self["@object"];
  19959. return $1;
  19960. },
  19961. args: [],
  19962. source: "object\x0a\x09^ object",
  19963. messageSends: [],
  19964. referencedClasses: []
  19965. }),
  19966. globals.NonBooleanReceiver);
  19967. smalltalk.addMethod(
  19968. smalltalk.method({
  19969. selector: "object:",
  19970. protocol: 'accessing',
  19971. fn: function (anObject){
  19972. var self=this;
  19973. self["@object"]=anObject;
  19974. return self},
  19975. args: ["anObject"],
  19976. source: "object: anObject\x0a\x09object := anObject",
  19977. messageSends: [],
  19978. referencedClasses: []
  19979. }),
  19980. globals.NonBooleanReceiver);
  19981. smalltalk.addClass('PackageCommitError', globals.Error, [], 'Kernel-Exceptions');
  19982. globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  19983. });
  19984. define("amber_core/Kernel-Transcript", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  19985. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  19986. smalltalk.addPackage('Kernel-Transcript');
  19987. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19988. smalltalk.addClass('ConsoleTranscript', globals.Object, ['textarea'], 'Kernel-Transcript');
  19989. globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  19990. smalltalk.addMethod(
  19991. smalltalk.method({
  19992. selector: "clear",
  19993. protocol: 'printing',
  19994. fn: function (){
  19995. var self=this;
  19996. return self},
  19997. args: [],
  19998. source: "clear\x0a\x09\x22no op\x22",
  19999. messageSends: [],
  20000. referencedClasses: []
  20001. }),
  20002. globals.ConsoleTranscript);
  20003. smalltalk.addMethod(
  20004. smalltalk.method({
  20005. selector: "cr",
  20006. protocol: 'printing',
  20007. fn: function (){
  20008. var self=this;
  20009. return self},
  20010. args: [],
  20011. source: "cr\x0a\x09\x22no op\x22",
  20012. messageSends: [],
  20013. referencedClasses: []
  20014. }),
  20015. globals.ConsoleTranscript);
  20016. smalltalk.addMethod(
  20017. smalltalk.method({
  20018. selector: "open",
  20019. protocol: 'actions',
  20020. fn: function (){
  20021. var self=this;
  20022. return self},
  20023. args: [],
  20024. source: "open",
  20025. messageSends: [],
  20026. referencedClasses: []
  20027. }),
  20028. globals.ConsoleTranscript);
  20029. smalltalk.addMethod(
  20030. smalltalk.method({
  20031. selector: "show:",
  20032. protocol: 'printing',
  20033. fn: function (anObject){
  20034. var self=this;
  20035. return smalltalk.withContext(function($ctx1) {
  20036. console.log(String(_st(anObject)._asString()));
  20037. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)})},
  20038. args: ["anObject"],
  20039. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String(_st(anObject)._asString()))>",
  20040. messageSends: [],
  20041. referencedClasses: []
  20042. }),
  20043. globals.ConsoleTranscript);
  20044. smalltalk.addMethod(
  20045. smalltalk.method({
  20046. selector: "initialize",
  20047. protocol: 'initialization',
  20048. fn: function (){
  20049. var self=this;
  20050. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  20051. return smalltalk.withContext(function($ctx1) {
  20052. _st($Transcript())._registerIfNone_(self._new());
  20053. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)})},
  20054. args: [],
  20055. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  20056. messageSends: ["registerIfNone:", "new"],
  20057. referencedClasses: ["Transcript"]
  20058. }),
  20059. globals.ConsoleTranscript.klass);
  20060. });
  20061. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  20062. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  20063. smalltalk.addPackage('Kernel-Announcements');
  20064. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20065. smalltalk.addClass('AnnouncementSubscription', globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20066. globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20067. smalltalk.addMethod(
  20068. smalltalk.method({
  20069. selector: "announcementClass",
  20070. protocol: 'accessing',
  20071. fn: function (){
  20072. var self=this;
  20073. var $1;
  20074. $1=self["@announcementClass"];
  20075. return $1;
  20076. },
  20077. args: [],
  20078. source: "announcementClass\x0a\x09^ announcementClass",
  20079. messageSends: [],
  20080. referencedClasses: []
  20081. }),
  20082. globals.AnnouncementSubscription);
  20083. smalltalk.addMethod(
  20084. smalltalk.method({
  20085. selector: "announcementClass:",
  20086. protocol: 'accessing',
  20087. fn: function (aClass){
  20088. var self=this;
  20089. self["@announcementClass"]=aClass;
  20090. return self},
  20091. args: ["aClass"],
  20092. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20093. messageSends: [],
  20094. referencedClasses: []
  20095. }),
  20096. globals.AnnouncementSubscription);
  20097. smalltalk.addMethod(
  20098. smalltalk.method({
  20099. selector: "block",
  20100. protocol: 'accessing',
  20101. fn: function (){
  20102. var self=this;
  20103. return smalltalk.withContext(function($ctx1) {
  20104. var $1;
  20105. self._deprecatedAPI();
  20106. $1=self._valuable();
  20107. return $1;
  20108. }, function($ctx1) {$ctx1.fill(self,"block",{},globals.AnnouncementSubscription)})},
  20109. args: [],
  20110. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  20111. messageSends: ["deprecatedAPI", "valuable"],
  20112. referencedClasses: []
  20113. }),
  20114. globals.AnnouncementSubscription);
  20115. smalltalk.addMethod(
  20116. smalltalk.method({
  20117. selector: "block:",
  20118. protocol: 'accessing',
  20119. fn: function (aValuable){
  20120. var self=this;
  20121. return smalltalk.withContext(function($ctx1) {
  20122. self._deprecatedAPI();
  20123. self._valuable_(aValuable);
  20124. return self}, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},globals.AnnouncementSubscription)})},
  20125. args: ["aValuable"],
  20126. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  20127. messageSends: ["deprecatedAPI", "valuable:"],
  20128. referencedClasses: []
  20129. }),
  20130. globals.AnnouncementSubscription);
  20131. smalltalk.addMethod(
  20132. smalltalk.method({
  20133. selector: "deliver:",
  20134. protocol: 'announcing',
  20135. fn: function (anAnnouncement){
  20136. var self=this;
  20137. return smalltalk.withContext(function($ctx1) {
  20138. var $1;
  20139. $1=self._handlesAnnouncement_(anAnnouncement);
  20140. if(smalltalk.assert($1)){
  20141. _st(self._valuable())._value_(anAnnouncement);
  20142. };
  20143. return self}, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
  20144. args: ["anAnnouncement"],
  20145. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20146. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"],
  20147. referencedClasses: []
  20148. }),
  20149. globals.AnnouncementSubscription);
  20150. smalltalk.addMethod(
  20151. smalltalk.method({
  20152. selector: "handlesAnnouncement:",
  20153. protocol: 'announcing',
  20154. fn: function (anAnnouncement){
  20155. var self=this;
  20156. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  20157. return smalltalk.withContext(function($ctx1) {
  20158. var $3,$4,$2,$1,$receiver;
  20159. $3=_st($Smalltalk())._globals();
  20160. $ctx1.sendIdx["globals"]=1;
  20161. $4=_st(self._announcementClass())._name();
  20162. $ctx1.sendIdx["name"]=1;
  20163. $2=_st($3)._at_($4);
  20164. $ctx1.sendIdx["at:"]=1;
  20165. if(($receiver = $2) == null || $receiver.isNil){
  20166. return false;
  20167. } else {
  20168. var class_;
  20169. class_=$receiver;
  20170. $1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20171. };
  20172. return $1;
  20173. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)})},
  20174. args: ["anAnnouncement"],
  20175. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  20176. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
  20177. referencedClasses: ["Smalltalk"]
  20178. }),
  20179. globals.AnnouncementSubscription);
  20180. smalltalk.addMethod(
  20181. smalltalk.method({
  20182. selector: "receiver",
  20183. protocol: 'accessing',
  20184. fn: function (){
  20185. var self=this;
  20186. return smalltalk.withContext(function($ctx1) {
  20187. var $1;
  20188. $1=_st(self._valuable())._receiver();
  20189. return $1;
  20190. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AnnouncementSubscription)})},
  20191. args: [],
  20192. source: "receiver\x0a\x09^ self valuable receiver",
  20193. messageSends: ["receiver", "valuable"],
  20194. referencedClasses: []
  20195. }),
  20196. globals.AnnouncementSubscription);
  20197. smalltalk.addMethod(
  20198. smalltalk.method({
  20199. selector: "valuable",
  20200. protocol: 'accessing',
  20201. fn: function (){
  20202. var self=this;
  20203. var $1;
  20204. $1=self["@valuable"];
  20205. return $1;
  20206. },
  20207. args: [],
  20208. source: "valuable\x0a\x09^ valuable",
  20209. messageSends: [],
  20210. referencedClasses: []
  20211. }),
  20212. globals.AnnouncementSubscription);
  20213. smalltalk.addMethod(
  20214. smalltalk.method({
  20215. selector: "valuable:",
  20216. protocol: 'accessing',
  20217. fn: function (aValuable){
  20218. var self=this;
  20219. self["@valuable"]=aValuable;
  20220. return self},
  20221. args: ["aValuable"],
  20222. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20223. messageSends: [],
  20224. referencedClasses: []
  20225. }),
  20226. globals.AnnouncementSubscription);
  20227. smalltalk.addClass('AnnouncementValuable', globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20228. globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20229. smalltalk.addMethod(
  20230. smalltalk.method({
  20231. selector: "receiver",
  20232. protocol: 'accessing',
  20233. fn: function (){
  20234. var self=this;
  20235. var $1;
  20236. $1=self["@receiver"];
  20237. return $1;
  20238. },
  20239. args: [],
  20240. source: "receiver\x0a\x09^ receiver",
  20241. messageSends: [],
  20242. referencedClasses: []
  20243. }),
  20244. globals.AnnouncementValuable);
  20245. smalltalk.addMethod(
  20246. smalltalk.method({
  20247. selector: "receiver:",
  20248. protocol: 'accessing',
  20249. fn: function (anObject){
  20250. var self=this;
  20251. self["@receiver"]=anObject;
  20252. return self},
  20253. args: ["anObject"],
  20254. source: "receiver: anObject\x0a\x09receiver := anObject",
  20255. messageSends: [],
  20256. referencedClasses: []
  20257. }),
  20258. globals.AnnouncementValuable);
  20259. smalltalk.addMethod(
  20260. smalltalk.method({
  20261. selector: "valuable",
  20262. protocol: 'accessing',
  20263. fn: function (){
  20264. var self=this;
  20265. var $1;
  20266. $1=self["@valuable"];
  20267. return $1;
  20268. },
  20269. args: [],
  20270. source: "valuable\x0a\x09^ valuable",
  20271. messageSends: [],
  20272. referencedClasses: []
  20273. }),
  20274. globals.AnnouncementValuable);
  20275. smalltalk.addMethod(
  20276. smalltalk.method({
  20277. selector: "valuable:",
  20278. protocol: 'accessing',
  20279. fn: function (anObject){
  20280. var self=this;
  20281. self["@valuable"]=anObject;
  20282. return self},
  20283. args: ["anObject"],
  20284. source: "valuable: anObject\x0a\x09valuable := anObject",
  20285. messageSends: [],
  20286. referencedClasses: []
  20287. }),
  20288. globals.AnnouncementValuable);
  20289. smalltalk.addMethod(
  20290. smalltalk.method({
  20291. selector: "value",
  20292. protocol: 'evaluating',
  20293. fn: function (){
  20294. var self=this;
  20295. return smalltalk.withContext(function($ctx1) {
  20296. var $1;
  20297. $1=_st(self._valuable())._value();
  20298. return $1;
  20299. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AnnouncementValuable)})},
  20300. args: [],
  20301. source: "value\x0a\x09^ self valuable value",
  20302. messageSends: ["value", "valuable"],
  20303. referencedClasses: []
  20304. }),
  20305. globals.AnnouncementValuable);
  20306. smalltalk.addMethod(
  20307. smalltalk.method({
  20308. selector: "value:",
  20309. protocol: 'evaluating',
  20310. fn: function (anObject){
  20311. var self=this;
  20312. return smalltalk.withContext(function($ctx1) {
  20313. var $1;
  20314. $1=_st(self._valuable())._value_(anObject);
  20315. return $1;
  20316. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.AnnouncementValuable)})},
  20317. args: ["anObject"],
  20318. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20319. messageSends: ["value:", "valuable"],
  20320. referencedClasses: []
  20321. }),
  20322. globals.AnnouncementValuable);
  20323. smalltalk.addClass('Announcer', globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20324. globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  20325. smalltalk.addMethod(
  20326. smalltalk.method({
  20327. selector: "announce:",
  20328. protocol: 'announcing',
  20329. fn: function (anAnnouncement){
  20330. var self=this;
  20331. return smalltalk.withContext(function($ctx1) {
  20332. _st(self["@subscriptions"])._do_((function(each){
  20333. return smalltalk.withContext(function($ctx2) {
  20334. return _st(each)._deliver_(anAnnouncement);
  20335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  20336. return self}, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},globals.Announcer)})},
  20337. args: ["anAnnouncement"],
  20338. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20339. messageSends: ["do:", "deliver:"],
  20340. referencedClasses: []
  20341. }),
  20342. globals.Announcer);
  20343. smalltalk.addMethod(
  20344. smalltalk.method({
  20345. selector: "initialize",
  20346. protocol: 'initialization',
  20347. fn: function (){
  20348. var self=this;
  20349. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  20350. return smalltalk.withContext(function($ctx1) {
  20351. ($ctx1.supercall = true, globals.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []));
  20352. $ctx1.supercall = false;
  20353. self["@subscriptions"]=_st($OrderedCollection())._new();
  20354. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Announcer)})},
  20355. args: [],
  20356. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20357. messageSends: ["initialize", "new"],
  20358. referencedClasses: ["OrderedCollection"]
  20359. }),
  20360. globals.Announcer);
  20361. smalltalk.addMethod(
  20362. smalltalk.method({
  20363. selector: "on:do:",
  20364. protocol: 'subscribing',
  20365. fn: function (aClass,aBlock){
  20366. var self=this;
  20367. return smalltalk.withContext(function($ctx1) {
  20368. self._on_do_for_(aClass,aBlock,nil);
  20369. return self}, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},globals.Announcer)})},
  20370. args: ["aClass", "aBlock"],
  20371. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  20372. messageSends: ["on:do:for:"],
  20373. referencedClasses: []
  20374. }),
  20375. globals.Announcer);
  20376. smalltalk.addMethod(
  20377. smalltalk.method({
  20378. selector: "on:do:for:",
  20379. protocol: 'subscribing',
  20380. fn: function (aClass,aBlock,aReceiver){
  20381. var self=this;
  20382. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20383. function $AnnouncementValuable(){return globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  20384. return smalltalk.withContext(function($ctx1) {
  20385. var $1,$3,$4,$6,$7,$5,$8,$2;
  20386. $1=self["@subscriptions"];
  20387. $3=_st($AnnouncementSubscription())._new();
  20388. $ctx1.sendIdx["new"]=1;
  20389. $4=$3;
  20390. $6=_st($AnnouncementValuable())._new();
  20391. _st($6)._valuable_(aBlock);
  20392. _st($6)._receiver_(aReceiver);
  20393. $7=_st($6)._yourself();
  20394. $ctx1.sendIdx["yourself"]=1;
  20395. $5=$7;
  20396. _st($4)._valuable_($5);
  20397. $ctx1.sendIdx["valuable:"]=1;
  20398. _st($3)._announcementClass_(aClass);
  20399. $8=_st($3)._yourself();
  20400. $2=$8;
  20401. _st($1)._add_($2);
  20402. return self}, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},globals.Announcer)})},
  20403. args: ["aClass", "aBlock", "aReceiver"],
  20404. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  20405. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"],
  20406. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"]
  20407. }),
  20408. globals.Announcer);
  20409. smalltalk.addMethod(
  20410. smalltalk.method({
  20411. selector: "on:doOnce:",
  20412. protocol: 'subscribing',
  20413. fn: function (aClass,aBlock){
  20414. var self=this;
  20415. var subscription;
  20416. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20417. return smalltalk.withContext(function($ctx1) {
  20418. var $1,$2;
  20419. $1=_st($AnnouncementSubscription())._new();
  20420. _st($1)._announcementClass_(aClass);
  20421. $2=_st($1)._yourself();
  20422. subscription=$2;
  20423. _st(subscription)._valuable_((function(ann){
  20424. return smalltalk.withContext(function($ctx2) {
  20425. _st(self["@subscriptions"])._remove_(subscription);
  20426. return _st(aBlock)._value_(ann);
  20427. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)})}));
  20428. _st(self["@subscriptions"])._add_(subscription);
  20429. return self}, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},globals.Announcer)})},
  20430. args: ["aClass", "aBlock"],
  20431. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  20432. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"],
  20433. referencedClasses: ["AnnouncementSubscription"]
  20434. }),
  20435. globals.Announcer);
  20436. smalltalk.addMethod(
  20437. smalltalk.method({
  20438. selector: "on:send:to:",
  20439. protocol: 'subscribing',
  20440. fn: function (aClass,aSelector,anObject){
  20441. var self=this;
  20442. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  20443. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  20444. return smalltalk.withContext(function($ctx1) {
  20445. var $1,$3,$4,$6,$7,$5,$8,$2;
  20446. $1=self["@subscriptions"];
  20447. $3=_st($AnnouncementSubscription())._new();
  20448. $ctx1.sendIdx["new"]=1;
  20449. $4=$3;
  20450. $6=_st($MessageSend())._new();
  20451. _st($6)._receiver_(anObject);
  20452. _st($6)._selector_(aSelector);
  20453. $7=_st($6)._yourself();
  20454. $ctx1.sendIdx["yourself"]=1;
  20455. $5=$7;
  20456. _st($4)._valuable_($5);
  20457. _st($3)._announcementClass_(aClass);
  20458. $8=_st($3)._yourself();
  20459. $2=$8;
  20460. _st($1)._add_($2);
  20461. return self}, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},globals.Announcer)})},
  20462. args: ["aClass", "aSelector", "anObject"],
  20463. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  20464. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"],
  20465. referencedClasses: ["AnnouncementSubscription", "MessageSend"]
  20466. }),
  20467. globals.Announcer);
  20468. smalltalk.addMethod(
  20469. smalltalk.method({
  20470. selector: "unsubscribe:",
  20471. protocol: 'subscribing',
  20472. fn: function (anObject){
  20473. var self=this;
  20474. return smalltalk.withContext(function($ctx1) {
  20475. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  20476. return smalltalk.withContext(function($ctx2) {
  20477. return _st(_st(each)._receiver()).__eq(anObject);
  20478. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  20479. return self}, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},globals.Announcer)})},
  20480. args: ["anObject"],
  20481. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  20482. messageSends: ["reject:", "=", "receiver"],
  20483. referencedClasses: []
  20484. }),
  20485. globals.Announcer);
  20486. smalltalk.addClass('SystemAnnouncer', globals.Announcer, [], 'Kernel-Announcements');
  20487. globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  20488. globals.SystemAnnouncer.klass.iVarNames = ['current'];
  20489. smalltalk.addMethod(
  20490. smalltalk.method({
  20491. selector: "current",
  20492. protocol: 'accessing',
  20493. fn: function (){
  20494. var self=this;
  20495. return smalltalk.withContext(function($ctx1) {
  20496. var $2,$1,$receiver;
  20497. $2=self["@current"];
  20498. if(($receiver = $2) == null || $receiver.isNil){
  20499. self["@current"]=($ctx1.supercall = true, globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []));
  20500. $ctx1.supercall = false;
  20501. $1=self["@current"];
  20502. } else {
  20503. $1=$2;
  20504. };
  20505. return $1;
  20506. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SystemAnnouncer.klass)})},
  20507. args: [],
  20508. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  20509. messageSends: ["ifNil:", "new"],
  20510. referencedClasses: []
  20511. }),
  20512. globals.SystemAnnouncer.klass);
  20513. smalltalk.addMethod(
  20514. smalltalk.method({
  20515. selector: "new",
  20516. protocol: 'instance creation',
  20517. fn: function (){
  20518. var self=this;
  20519. return smalltalk.withContext(function($ctx1) {
  20520. self._shouldNotImplement();
  20521. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.SystemAnnouncer.klass)})},
  20522. args: [],
  20523. source: "new\x0a\x09self shouldNotImplement",
  20524. messageSends: ["shouldNotImplement"],
  20525. referencedClasses: []
  20526. }),
  20527. globals.SystemAnnouncer.klass);
  20528. smalltalk.addClass('SystemAnnouncement', globals.Object, [], 'Kernel-Announcements');
  20529. globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  20530. smalltalk.addMethod(
  20531. smalltalk.method({
  20532. selector: "heliosClass",
  20533. protocol: 'helios',
  20534. fn: function (){
  20535. var self=this;
  20536. return "announcement";
  20537. },
  20538. args: [],
  20539. source: "heliosClass\x0a\x09^ 'announcement'",
  20540. messageSends: [],
  20541. referencedClasses: []
  20542. }),
  20543. globals.SystemAnnouncement.klass);
  20544. smalltalk.addClass('ClassAnnouncement', globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  20545. globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  20546. smalltalk.addMethod(
  20547. smalltalk.method({
  20548. selector: "theClass",
  20549. protocol: 'accessing',
  20550. fn: function (){
  20551. var self=this;
  20552. var $1;
  20553. $1=self["@theClass"];
  20554. return $1;
  20555. },
  20556. args: [],
  20557. source: "theClass\x0a\x09^ theClass",
  20558. messageSends: [],
  20559. referencedClasses: []
  20560. }),
  20561. globals.ClassAnnouncement);
  20562. smalltalk.addMethod(
  20563. smalltalk.method({
  20564. selector: "theClass:",
  20565. protocol: 'accessing',
  20566. fn: function (aClass){
  20567. var self=this;
  20568. self["@theClass"]=aClass;
  20569. return self},
  20570. args: ["aClass"],
  20571. source: "theClass: aClass\x0a\x09theClass := aClass",
  20572. messageSends: [],
  20573. referencedClasses: []
  20574. }),
  20575. globals.ClassAnnouncement);
  20576. smalltalk.addClass('ClassAdded', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20577. globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  20578. smalltalk.addClass('ClassCommentChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20579. globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  20580. smalltalk.addClass('ClassDefinitionChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20581. globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  20582. smalltalk.addClass('ClassMigrated', globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  20583. globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  20584. smalltalk.addMethod(
  20585. smalltalk.method({
  20586. selector: "oldClass",
  20587. protocol: 'accessing',
  20588. fn: function (){
  20589. var self=this;
  20590. var $1;
  20591. $1=self["@oldClass"];
  20592. return $1;
  20593. },
  20594. args: [],
  20595. source: "oldClass\x0a\x09^ oldClass",
  20596. messageSends: [],
  20597. referencedClasses: []
  20598. }),
  20599. globals.ClassMigrated);
  20600. smalltalk.addMethod(
  20601. smalltalk.method({
  20602. selector: "oldClass:",
  20603. protocol: 'accessing',
  20604. fn: function (aClass){
  20605. var self=this;
  20606. self["@oldClass"]=aClass;
  20607. return self},
  20608. args: ["aClass"],
  20609. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  20610. messageSends: [],
  20611. referencedClasses: []
  20612. }),
  20613. globals.ClassMigrated);
  20614. smalltalk.addClass('ClassMoved', globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  20615. globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  20616. smalltalk.addMethod(
  20617. smalltalk.method({
  20618. selector: "oldPackage",
  20619. protocol: 'accessing',
  20620. fn: function (){
  20621. var self=this;
  20622. var $1;
  20623. $1=self["@oldPackage"];
  20624. return $1;
  20625. },
  20626. args: [],
  20627. source: "oldPackage\x0a\x09^ oldPackage",
  20628. messageSends: [],
  20629. referencedClasses: []
  20630. }),
  20631. globals.ClassMoved);
  20632. smalltalk.addMethod(
  20633. smalltalk.method({
  20634. selector: "oldPackage:",
  20635. protocol: 'accessing',
  20636. fn: function (aPackage){
  20637. var self=this;
  20638. self["@oldPackage"]=aPackage;
  20639. return self},
  20640. args: ["aPackage"],
  20641. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  20642. messageSends: [],
  20643. referencedClasses: []
  20644. }),
  20645. globals.ClassMoved);
  20646. smalltalk.addClass('ClassRemoved', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20647. globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  20648. smalltalk.addClass('ClassRenamed', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  20649. globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  20650. smalltalk.addClass('MethodAnnouncement', globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  20651. globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  20652. smalltalk.addMethod(
  20653. smalltalk.method({
  20654. selector: "method",
  20655. protocol: 'accessing',
  20656. fn: function (){
  20657. var self=this;
  20658. var $1;
  20659. $1=self["@method"];
  20660. return $1;
  20661. },
  20662. args: [],
  20663. source: "method\x0a\x09^ method",
  20664. messageSends: [],
  20665. referencedClasses: []
  20666. }),
  20667. globals.MethodAnnouncement);
  20668. smalltalk.addMethod(
  20669. smalltalk.method({
  20670. selector: "method:",
  20671. protocol: 'accessing',
  20672. fn: function (aCompiledMethod){
  20673. var self=this;
  20674. self["@method"]=aCompiledMethod;
  20675. return self},
  20676. args: ["aCompiledMethod"],
  20677. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  20678. messageSends: [],
  20679. referencedClasses: []
  20680. }),
  20681. globals.MethodAnnouncement);
  20682. smalltalk.addClass('MethodAdded', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  20683. globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  20684. smalltalk.addClass('MethodModified', globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  20685. globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  20686. smalltalk.addMethod(
  20687. smalltalk.method({
  20688. selector: "oldMethod",
  20689. protocol: 'accessing',
  20690. fn: function (){
  20691. var self=this;
  20692. var $1;
  20693. $1=self["@oldMethod"];
  20694. return $1;
  20695. },
  20696. args: [],
  20697. source: "oldMethod\x0a\x09^ oldMethod",
  20698. messageSends: [],
  20699. referencedClasses: []
  20700. }),
  20701. globals.MethodModified);
  20702. smalltalk.addMethod(
  20703. smalltalk.method({
  20704. selector: "oldMethod:",
  20705. protocol: 'accessing',
  20706. fn: function (aMethod){
  20707. var self=this;
  20708. self["@oldMethod"]=aMethod;
  20709. return self},
  20710. args: ["aMethod"],
  20711. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  20712. messageSends: [],
  20713. referencedClasses: []
  20714. }),
  20715. globals.MethodModified);
  20716. smalltalk.addClass('MethodMoved', globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  20717. globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  20718. smalltalk.addMethod(
  20719. smalltalk.method({
  20720. selector: "oldProtocol",
  20721. protocol: 'accessing',
  20722. fn: function (){
  20723. var self=this;
  20724. var $1;
  20725. $1=self["@oldProtocol"];
  20726. return $1;
  20727. },
  20728. args: [],
  20729. source: "oldProtocol\x0a\x09^ oldProtocol",
  20730. messageSends: [],
  20731. referencedClasses: []
  20732. }),
  20733. globals.MethodMoved);
  20734. smalltalk.addMethod(
  20735. smalltalk.method({
  20736. selector: "oldProtocol:",
  20737. protocol: 'accessing',
  20738. fn: function (aString){
  20739. var self=this;
  20740. self["@oldProtocol"]=aString;
  20741. return self},
  20742. args: ["aString"],
  20743. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  20744. messageSends: [],
  20745. referencedClasses: []
  20746. }),
  20747. globals.MethodMoved);
  20748. smalltalk.addClass('MethodRemoved', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  20749. globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  20750. smalltalk.addClass('PackageAnnouncement', globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  20751. globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  20752. smalltalk.addMethod(
  20753. smalltalk.method({
  20754. selector: "package",
  20755. protocol: 'accessing',
  20756. fn: function (){
  20757. var self=this;
  20758. var $1;
  20759. $1=self["@package"];
  20760. return $1;
  20761. },
  20762. args: [],
  20763. source: "package\x0a\x09^ package",
  20764. messageSends: [],
  20765. referencedClasses: []
  20766. }),
  20767. globals.PackageAnnouncement);
  20768. smalltalk.addMethod(
  20769. smalltalk.method({
  20770. selector: "package:",
  20771. protocol: 'accessing',
  20772. fn: function (aPackage){
  20773. var self=this;
  20774. self["@package"]=aPackage;
  20775. return self},
  20776. args: ["aPackage"],
  20777. source: "package: aPackage\x0a\x09package := aPackage",
  20778. messageSends: [],
  20779. referencedClasses: []
  20780. }),
  20781. globals.PackageAnnouncement);
  20782. smalltalk.addClass('PackageAdded', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20783. globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  20784. smalltalk.addClass('PackageClean', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20785. globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  20786. smalltalk.addClass('PackageDirty', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20787. globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  20788. smalltalk.addClass('PackageRemoved', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  20789. globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  20790. smalltalk.addClass('ProtocolAnnouncement', globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  20791. globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  20792. smalltalk.addMethod(
  20793. smalltalk.method({
  20794. selector: "package",
  20795. protocol: 'accessing',
  20796. fn: function (){
  20797. var self=this;
  20798. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  20799. return smalltalk.withContext(function($ctx1) {
  20800. var $2,$1,$3,$4;
  20801. $2=self._protocol();
  20802. $ctx1.sendIdx["protocol"]=1;
  20803. $1=_st($2)._beginsWith_("*");
  20804. if(! smalltalk.assert($1)){
  20805. $3=_st(self._theClass())._package();
  20806. return $3;
  20807. };
  20808. $4=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  20809. return nil;
  20810. }));
  20811. return $4;
  20812. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.ProtocolAnnouncement)})},
  20813. args: [],
  20814. source: "package\x0a\x0a\x09(self protocol beginsWith: '*') ifFalse: [\x0a\x09\x09^ self theClass package ].\x0a\x09\x09\x0a\x09^ Package \x0a\x09\x09named: self protocol allButFirst\x0a\x09\x09ifAbsent: [ nil ]",
  20815. messageSends: ["ifFalse:", "beginsWith:", "protocol", "package", "theClass", "named:ifAbsent:", "allButFirst"],
  20816. referencedClasses: ["Package"]
  20817. }),
  20818. globals.ProtocolAnnouncement);
  20819. smalltalk.addMethod(
  20820. smalltalk.method({
  20821. selector: "protocol",
  20822. protocol: 'accessing',
  20823. fn: function (){
  20824. var self=this;
  20825. var $1;
  20826. $1=self["@protocol"];
  20827. return $1;
  20828. },
  20829. args: [],
  20830. source: "protocol\x0a\x09^ protocol",
  20831. messageSends: [],
  20832. referencedClasses: []
  20833. }),
  20834. globals.ProtocolAnnouncement);
  20835. smalltalk.addMethod(
  20836. smalltalk.method({
  20837. selector: "protocol:",
  20838. protocol: 'accessing',
  20839. fn: function (aString){
  20840. var self=this;
  20841. self["@protocol"]=aString;
  20842. return self},
  20843. args: ["aString"],
  20844. source: "protocol: aString\x0a\x09protocol := aString",
  20845. messageSends: [],
  20846. referencedClasses: []
  20847. }),
  20848. globals.ProtocolAnnouncement);
  20849. smalltalk.addMethod(
  20850. smalltalk.method({
  20851. selector: "theClass",
  20852. protocol: 'accessing',
  20853. fn: function (){
  20854. var self=this;
  20855. var $1;
  20856. $1=self["@theClass"];
  20857. return $1;
  20858. },
  20859. args: [],
  20860. source: "theClass\x0a\x09^ theClass",
  20861. messageSends: [],
  20862. referencedClasses: []
  20863. }),
  20864. globals.ProtocolAnnouncement);
  20865. smalltalk.addMethod(
  20866. smalltalk.method({
  20867. selector: "theClass:",
  20868. protocol: 'accessing',
  20869. fn: function (aClass){
  20870. var self=this;
  20871. self["@theClass"]=aClass;
  20872. return self},
  20873. args: ["aClass"],
  20874. source: "theClass: aClass\x0a\x09theClass := aClass",
  20875. messageSends: [],
  20876. referencedClasses: []
  20877. }),
  20878. globals.ProtocolAnnouncement);
  20879. smalltalk.addClass('ProtocolAdded', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  20880. globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  20881. smalltalk.addClass('ProtocolRemoved', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  20882. globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  20883. });
  20884. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){
  20885. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  20886. smalltalk.addPackage('Compiler-Exceptions');
  20887. smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20888. smalltalk.addClass('CompilerError', globals.Error, [], 'Compiler-Exceptions');
  20889. globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  20890. smalltalk.addClass('ParseError', globals.CompilerError, [], 'Compiler-Exceptions');
  20891. globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  20892. smalltalk.addClass('SemanticError', globals.CompilerError, [], 'Compiler-Exceptions');
  20893. globals.SemanticError.comment="I represent an abstract semantic error thrown by the SemanticAnalyzer.\x0aSemantic errors can be unknown variable errors, etc.\x0aSee my subclasses for concrete errors.\x0a\x0aThe IDE should catch instances of Semantic error to deal with them when compiling";
  20894. smalltalk.addClass('InliningError', globals.SemanticError, [], 'Compiler-Exceptions');
  20895. globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  20896. smalltalk.addClass('InvalidAssignmentError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  20897. globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  20898. smalltalk.addMethod(
  20899. smalltalk.method({
  20900. selector: "messageText",
  20901. protocol: 'accessing',
  20902. fn: function (){
  20903. var self=this;
  20904. return smalltalk.withContext(function($ctx1) {
  20905. var $1;
  20906. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  20907. return $1;
  20908. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.InvalidAssignmentError)})},
  20909. args: [],
  20910. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  20911. messageSends: [",", "variableName"],
  20912. referencedClasses: []
  20913. }),
  20914. globals.InvalidAssignmentError);
  20915. smalltalk.addMethod(
  20916. smalltalk.method({
  20917. selector: "variableName",
  20918. protocol: 'accessing',
  20919. fn: function (){
  20920. var self=this;
  20921. var $1;
  20922. $1=self["@variableName"];
  20923. return $1;
  20924. },
  20925. args: [],
  20926. source: "variableName\x0a\x09^ variableName",
  20927. messageSends: [],
  20928. referencedClasses: []
  20929. }),
  20930. globals.InvalidAssignmentError);
  20931. smalltalk.addMethod(
  20932. smalltalk.method({
  20933. selector: "variableName:",
  20934. protocol: 'accessing',
  20935. fn: function (aString){
  20936. var self=this;
  20937. self["@variableName"]=aString;
  20938. return self},
  20939. args: ["aString"],
  20940. source: "variableName: aString\x0a\x09variableName := aString",
  20941. messageSends: [],
  20942. referencedClasses: []
  20943. }),
  20944. globals.InvalidAssignmentError);
  20945. smalltalk.addClass('ShadowingVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  20946. globals.ShadowingVariableError.comment="I get signaled when a variable in a block or method scope shadows a variable of the same name in an outer scope.";
  20947. smalltalk.addMethod(
  20948. smalltalk.method({
  20949. selector: "messageText",
  20950. protocol: 'accessing',
  20951. fn: function (){
  20952. var self=this;
  20953. return smalltalk.withContext(function($ctx1) {
  20954. var $1;
  20955. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  20956. $ctx1.sendIdx[","]=1;
  20957. return $1;
  20958. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.ShadowingVariableError)})},
  20959. args: [],
  20960. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  20961. messageSends: [",", "variableName"],
  20962. referencedClasses: []
  20963. }),
  20964. globals.ShadowingVariableError);
  20965. smalltalk.addMethod(
  20966. smalltalk.method({
  20967. selector: "variableName",
  20968. protocol: 'accessing',
  20969. fn: function (){
  20970. var self=this;
  20971. var $1;
  20972. $1=self["@variableName"];
  20973. return $1;
  20974. },
  20975. args: [],
  20976. source: "variableName\x0a\x09^ variableName",
  20977. messageSends: [],
  20978. referencedClasses: []
  20979. }),
  20980. globals.ShadowingVariableError);
  20981. smalltalk.addMethod(
  20982. smalltalk.method({
  20983. selector: "variableName:",
  20984. protocol: 'accessing',
  20985. fn: function (aString){
  20986. var self=this;
  20987. self["@variableName"]=aString;
  20988. return self},
  20989. args: ["aString"],
  20990. source: "variableName: aString\x0a\x09variableName := aString",
  20991. messageSends: [],
  20992. referencedClasses: []
  20993. }),
  20994. globals.ShadowingVariableError);
  20995. smalltalk.addClass('UnknownVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  20996. globals.UnknownVariableError.comment="I get signaled when a variable is not defined.\x0aThe default behavior is to allow it, as this is how Amber currently is able to seamlessly send messages to JavaScript objects.";
  20997. smalltalk.addMethod(
  20998. smalltalk.method({
  20999. selector: "messageText",
  21000. protocol: 'accessing',
  21001. fn: function (){
  21002. var self=this;
  21003. return smalltalk.withContext(function($ctx1) {
  21004. var $1;
  21005. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  21006. $ctx1.sendIdx[","]=1;
  21007. return $1;
  21008. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.UnknownVariableError)})},
  21009. args: [],
  21010. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  21011. messageSends: [",", "variableName"],
  21012. referencedClasses: []
  21013. }),
  21014. globals.UnknownVariableError);
  21015. smalltalk.addMethod(
  21016. smalltalk.method({
  21017. selector: "variableName",
  21018. protocol: 'accessing',
  21019. fn: function (){
  21020. var self=this;
  21021. var $1;
  21022. $1=self["@variableName"];
  21023. return $1;
  21024. },
  21025. args: [],
  21026. source: "variableName\x0a\x09^ variableName",
  21027. messageSends: [],
  21028. referencedClasses: []
  21029. }),
  21030. globals.UnknownVariableError);
  21031. smalltalk.addMethod(
  21032. smalltalk.method({
  21033. selector: "variableName:",
  21034. protocol: 'accessing',
  21035. fn: function (aString){
  21036. var self=this;
  21037. self["@variableName"]=aString;
  21038. return self},
  21039. args: ["aString"],
  21040. source: "variableName: aString\x0a\x09variableName := aString",
  21041. messageSends: [],
  21042. referencedClasses: []
  21043. }),
  21044. globals.UnknownVariableError);
  21045. smalltalk.addClass('RethrowErrorHandler', globals.Object, [], 'Compiler-Exceptions');
  21046. globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  21047. smalltalk.addMethod(
  21048. smalltalk.method({
  21049. selector: "basicSignal:",
  21050. protocol: 'error handling',
  21051. fn: function (anError){
  21052. var self=this;
  21053. return smalltalk.withContext(function($ctx1) {
  21054. throw anError;
  21055. return self}, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},globals.RethrowErrorHandler)})},
  21056. args: ["anError"],
  21057. source: "basicSignal: anError\x0a <throw anError>",
  21058. messageSends: [],
  21059. referencedClasses: []
  21060. }),
  21061. globals.RethrowErrorHandler);
  21062. smalltalk.addMethod(
  21063. smalltalk.method({
  21064. selector: "handleError:",
  21065. protocol: 'error handling',
  21066. fn: function (anError){
  21067. var self=this;
  21068. return smalltalk.withContext(function($ctx1) {
  21069. self._basicSignal_(anError);
  21070. return self}, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.RethrowErrorHandler)})},
  21071. args: ["anError"],
  21072. source: "handleError: anError\x0a self basicSignal: anError",
  21073. messageSends: ["basicSignal:"],
  21074. referencedClasses: []
  21075. }),
  21076. globals.RethrowErrorHandler);
  21077. });
  21078. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Collections"], function($boot){
  21079. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  21080. smalltalk.addPackage('Compiler-Core');
  21081. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21082. smalltalk.addClass('AbstractCodeGenerator', globals.Object, ['currentClass', 'source'], 'Compiler-Core');
  21083. globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  21084. smalltalk.addMethod(
  21085. smalltalk.method({
  21086. selector: "classNameFor:",
  21087. protocol: 'accessing',
  21088. fn: function (aClass){
  21089. var self=this;
  21090. return smalltalk.withContext(function($ctx1) {
  21091. var $2,$3,$4,$1;
  21092. $2=_st(aClass)._isMetaclass();
  21093. if(smalltalk.assert($2)){
  21094. $3=_st(_st(aClass)._instanceClass())._name();
  21095. $ctx1.sendIdx["name"]=1;
  21096. $1=_st($3).__comma(".klass");
  21097. } else {
  21098. $4=_st(aClass)._isNil();
  21099. if(smalltalk.assert($4)){
  21100. $1="nil";
  21101. } else {
  21102. $1=_st(aClass)._name();
  21103. };
  21104. };
  21105. return $1;
  21106. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractCodeGenerator)})},
  21107. args: ["aClass"],
  21108. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  21109. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  21110. referencedClasses: []
  21111. }),
  21112. globals.AbstractCodeGenerator);
  21113. smalltalk.addMethod(
  21114. smalltalk.method({
  21115. selector: "compileNode:",
  21116. protocol: 'compiling',
  21117. fn: function (aNode){
  21118. var self=this;
  21119. return smalltalk.withContext(function($ctx1) {
  21120. self._subclassResponsibility();
  21121. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},globals.AbstractCodeGenerator)})},
  21122. args: ["aNode"],
  21123. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  21124. messageSends: ["subclassResponsibility"],
  21125. referencedClasses: []
  21126. }),
  21127. globals.AbstractCodeGenerator);
  21128. smalltalk.addMethod(
  21129. smalltalk.method({
  21130. selector: "currentClass",
  21131. protocol: 'accessing',
  21132. fn: function (){
  21133. var self=this;
  21134. var $1;
  21135. $1=self["@currentClass"];
  21136. return $1;
  21137. },
  21138. args: [],
  21139. source: "currentClass\x0a\x09^ currentClass",
  21140. messageSends: [],
  21141. referencedClasses: []
  21142. }),
  21143. globals.AbstractCodeGenerator);
  21144. smalltalk.addMethod(
  21145. smalltalk.method({
  21146. selector: "currentClass:",
  21147. protocol: 'accessing',
  21148. fn: function (aClass){
  21149. var self=this;
  21150. self["@currentClass"]=aClass;
  21151. return self},
  21152. args: ["aClass"],
  21153. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  21154. messageSends: [],
  21155. referencedClasses: []
  21156. }),
  21157. globals.AbstractCodeGenerator);
  21158. smalltalk.addMethod(
  21159. smalltalk.method({
  21160. selector: "pseudoVariables",
  21161. protocol: 'accessing',
  21162. fn: function (){
  21163. var self=this;
  21164. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21165. return smalltalk.withContext(function($ctx1) {
  21166. var $1;
  21167. $1=_st($Smalltalk())._pseudoVariableNames();
  21168. return $1;
  21169. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},globals.AbstractCodeGenerator)})},
  21170. args: [],
  21171. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  21172. messageSends: ["pseudoVariableNames"],
  21173. referencedClasses: ["Smalltalk"]
  21174. }),
  21175. globals.AbstractCodeGenerator);
  21176. smalltalk.addMethod(
  21177. smalltalk.method({
  21178. selector: "source",
  21179. protocol: 'accessing',
  21180. fn: function (){
  21181. var self=this;
  21182. return smalltalk.withContext(function($ctx1) {
  21183. var $2,$1,$receiver;
  21184. $2=self["@source"];
  21185. if(($receiver = $2) == null || $receiver.isNil){
  21186. $1="";
  21187. } else {
  21188. $1=$2;
  21189. };
  21190. return $1;
  21191. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.AbstractCodeGenerator)})},
  21192. args: [],
  21193. source: "source\x0a\x09^ source ifNil: [ '' ]",
  21194. messageSends: ["ifNil:"],
  21195. referencedClasses: []
  21196. }),
  21197. globals.AbstractCodeGenerator);
  21198. smalltalk.addMethod(
  21199. smalltalk.method({
  21200. selector: "source:",
  21201. protocol: 'accessing',
  21202. fn: function (aString){
  21203. var self=this;
  21204. self["@source"]=aString;
  21205. return self},
  21206. args: ["aString"],
  21207. source: "source: aString\x0a\x09source := aString",
  21208. messageSends: [],
  21209. referencedClasses: []
  21210. }),
  21211. globals.AbstractCodeGenerator);
  21212. smalltalk.addClass('CodeGenerator', globals.AbstractCodeGenerator, [], 'Compiler-Core');
  21213. globals.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation.";
  21214. smalltalk.addMethod(
  21215. smalltalk.method({
  21216. selector: "compileNode:",
  21217. protocol: 'compiling',
  21218. fn: function (aNode){
  21219. var self=this;
  21220. var ir,stream;
  21221. return smalltalk.withContext(function($ctx1) {
  21222. var $2,$3,$1;
  21223. _st(self._semanticAnalyzer())._visit_(aNode);
  21224. $ctx1.sendIdx["visit:"]=1;
  21225. ir=_st(self._translator())._visit_(aNode);
  21226. $ctx1.sendIdx["visit:"]=2;
  21227. $2=self._irTranslator();
  21228. _st($2)._currentClass_(self._currentClass());
  21229. _st($2)._visit_(ir);
  21230. $3=_st($2)._contents();
  21231. $1=$3;
  21232. return $1;
  21233. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.CodeGenerator)})},
  21234. args: ["aNode"],
  21235. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  21236. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"],
  21237. referencedClasses: []
  21238. }),
  21239. globals.CodeGenerator);
  21240. smalltalk.addMethod(
  21241. smalltalk.method({
  21242. selector: "irTranslator",
  21243. protocol: 'compiling',
  21244. fn: function (){
  21245. var self=this;
  21246. function $IRJSTranslator(){return globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  21247. return smalltalk.withContext(function($ctx1) {
  21248. var $1;
  21249. $1=_st($IRJSTranslator())._new();
  21250. return $1;
  21251. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.CodeGenerator)})},
  21252. args: [],
  21253. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  21254. messageSends: ["new"],
  21255. referencedClasses: ["IRJSTranslator"]
  21256. }),
  21257. globals.CodeGenerator);
  21258. smalltalk.addMethod(
  21259. smalltalk.method({
  21260. selector: "semanticAnalyzer",
  21261. protocol: 'compiling',
  21262. fn: function (){
  21263. var self=this;
  21264. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  21265. return smalltalk.withContext(function($ctx1) {
  21266. var $1;
  21267. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  21268. return $1;
  21269. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},globals.CodeGenerator)})},
  21270. args: [],
  21271. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  21272. messageSends: ["on:", "currentClass"],
  21273. referencedClasses: ["SemanticAnalyzer"]
  21274. }),
  21275. globals.CodeGenerator);
  21276. smalltalk.addMethod(
  21277. smalltalk.method({
  21278. selector: "translator",
  21279. protocol: 'compiling',
  21280. fn: function (){
  21281. var self=this;
  21282. function $IRASTTranslator(){return globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  21283. return smalltalk.withContext(function($ctx1) {
  21284. var $2,$3,$1;
  21285. $2=_st($IRASTTranslator())._new();
  21286. _st($2)._source_(self._source());
  21287. _st($2)._theClass_(self._currentClass());
  21288. $3=_st($2)._yourself();
  21289. $1=$3;
  21290. return $1;
  21291. }, function($ctx1) {$ctx1.fill(self,"translator",{},globals.CodeGenerator)})},
  21292. args: [],
  21293. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  21294. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"],
  21295. referencedClasses: ["IRASTTranslator"]
  21296. }),
  21297. globals.CodeGenerator);
  21298. smalltalk.addClass('Compiler', globals.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  21299. globals.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`.\x0aThe default code generator is an instance of `InlinedCodeGenerator`";
  21300. smalltalk.addMethod(
  21301. smalltalk.method({
  21302. selector: "codeGeneratorClass",
  21303. protocol: 'accessing',
  21304. fn: function (){
  21305. var self=this;
  21306. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  21307. return smalltalk.withContext(function($ctx1) {
  21308. var $2,$1,$receiver;
  21309. $2=self["@codeGeneratorClass"];
  21310. if(($receiver = $2) == null || $receiver.isNil){
  21311. $1=$InliningCodeGenerator();
  21312. } else {
  21313. $1=$2;
  21314. };
  21315. return $1;
  21316. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},globals.Compiler)})},
  21317. args: [],
  21318. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  21319. messageSends: ["ifNil:"],
  21320. referencedClasses: ["InliningCodeGenerator"]
  21321. }),
  21322. globals.Compiler);
  21323. smalltalk.addMethod(
  21324. smalltalk.method({
  21325. selector: "codeGeneratorClass:",
  21326. protocol: 'accessing',
  21327. fn: function (aClass){
  21328. var self=this;
  21329. self["@codeGeneratorClass"]=aClass;
  21330. return self},
  21331. args: ["aClass"],
  21332. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  21333. messageSends: [],
  21334. referencedClasses: []
  21335. }),
  21336. globals.Compiler);
  21337. smalltalk.addMethod(
  21338. smalltalk.method({
  21339. selector: "compile:",
  21340. protocol: 'compiling',
  21341. fn: function (aString){
  21342. var self=this;
  21343. return smalltalk.withContext(function($ctx1) {
  21344. var $1;
  21345. $1=self._compileNode_(self._parse_(aString));
  21346. return $1;
  21347. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Compiler)})},
  21348. args: ["aString"],
  21349. source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
  21350. messageSends: ["compileNode:", "parse:"],
  21351. referencedClasses: []
  21352. }),
  21353. globals.Compiler);
  21354. smalltalk.addMethod(
  21355. smalltalk.method({
  21356. selector: "compile:forClass:",
  21357. protocol: 'compiling',
  21358. fn: function (aString,aClass){
  21359. var self=this;
  21360. return smalltalk.withContext(function($ctx1) {
  21361. var $1;
  21362. self._currentClass_(aClass);
  21363. self._source_(aString);
  21364. $1=self._compile_(aString);
  21365. return $1;
  21366. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},globals.Compiler)})},
  21367. args: ["aString", "aClass"],
  21368. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
  21369. messageSends: ["currentClass:", "source:", "compile:"],
  21370. referencedClasses: []
  21371. }),
  21372. globals.Compiler);
  21373. smalltalk.addMethod(
  21374. smalltalk.method({
  21375. selector: "compileExpression:",
  21376. protocol: 'compiling',
  21377. fn: function (aString){
  21378. var self=this;
  21379. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  21380. return smalltalk.withContext(function($ctx1) {
  21381. var $1,$2;
  21382. self._currentClass_($DoIt());
  21383. $1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  21384. $ctx1.sendIdx[","]=1;
  21385. self._source_($1);
  21386. $2=self._compileNode_(self._parse_(self._source()));
  21387. return $2;
  21388. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},globals.Compiler)})},
  21389. args: ["aString"],
  21390. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  21391. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
  21392. referencedClasses: ["DoIt"]
  21393. }),
  21394. globals.Compiler);
  21395. smalltalk.addMethod(
  21396. smalltalk.method({
  21397. selector: "compileExpression:on:",
  21398. protocol: 'compiling',
  21399. fn: function (aString,anObject){
  21400. var self=this;
  21401. return smalltalk.withContext(function($ctx1) {
  21402. var $1,$2;
  21403. self._currentClass_(_st(anObject)._class());
  21404. $1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  21405. $ctx1.sendIdx[","]=1;
  21406. self._source_($1);
  21407. $2=self._compileNode_(self._parse_(self._source()));
  21408. return $2;
  21409. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},globals.Compiler)})},
  21410. args: ["aString", "anObject"],
  21411. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  21412. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"],
  21413. referencedClasses: []
  21414. }),
  21415. globals.Compiler);
  21416. smalltalk.addMethod(
  21417. smalltalk.method({
  21418. selector: "compileNode:",
  21419. protocol: 'compiling',
  21420. fn: function (aNode){
  21421. var self=this;
  21422. var generator,result;
  21423. return smalltalk.withContext(function($ctx1) {
  21424. var $1,$2,$3;
  21425. generator=_st(self._codeGeneratorClass())._new();
  21426. $1=generator;
  21427. _st($1)._source_(self._source());
  21428. $2=_st($1)._currentClass_(self._currentClass());
  21429. result=_st(generator)._compileNode_(aNode);
  21430. self._unknownVariables_([]);
  21431. $3=result;
  21432. return $3;
  21433. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},globals.Compiler)})},
  21434. args: ["aNode"],
  21435. source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^ result",
  21436. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
  21437. referencedClasses: []
  21438. }),
  21439. globals.Compiler);
  21440. smalltalk.addMethod(
  21441. smalltalk.method({
  21442. selector: "currentClass",
  21443. protocol: 'accessing',
  21444. fn: function (){
  21445. var self=this;
  21446. var $1;
  21447. $1=self["@currentClass"];
  21448. return $1;
  21449. },
  21450. args: [],
  21451. source: "currentClass\x0a\x09^ currentClass",
  21452. messageSends: [],
  21453. referencedClasses: []
  21454. }),
  21455. globals.Compiler);
  21456. smalltalk.addMethod(
  21457. smalltalk.method({
  21458. selector: "currentClass:",
  21459. protocol: 'accessing',
  21460. fn: function (aClass){
  21461. var self=this;
  21462. self["@currentClass"]=aClass;
  21463. return self},
  21464. args: ["aClass"],
  21465. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  21466. messageSends: [],
  21467. referencedClasses: []
  21468. }),
  21469. globals.Compiler);
  21470. smalltalk.addMethod(
  21471. smalltalk.method({
  21472. selector: "eval:",
  21473. protocol: 'compiling',
  21474. fn: function (aString){
  21475. var self=this;
  21476. return smalltalk.withContext(function($ctx1) {
  21477. return eval(aString);
  21478. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},globals.Compiler)})},
  21479. args: ["aString"],
  21480. source: "eval: aString\x0a\x09<return eval(aString)>",
  21481. messageSends: [],
  21482. referencedClasses: []
  21483. }),
  21484. globals.Compiler);
  21485. smalltalk.addMethod(
  21486. smalltalk.method({
  21487. selector: "evaluateExpression:",
  21488. protocol: 'compiling',
  21489. fn: function (aString){
  21490. var self=this;
  21491. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  21492. return smalltalk.withContext(function($ctx1) {
  21493. var $1;
  21494. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  21495. return $1;
  21496. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},globals.Compiler)})},
  21497. args: ["aString"],
  21498. source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09^ self evaluateExpression: aString on: DoIt new",
  21499. messageSends: ["evaluateExpression:on:", "new"],
  21500. referencedClasses: ["DoIt"]
  21501. }),
  21502. globals.Compiler);
  21503. smalltalk.addMethod(
  21504. smalltalk.method({
  21505. selector: "evaluateExpression:on:",
  21506. protocol: 'compiling',
  21507. fn: function (aString,anObject){
  21508. var self=this;
  21509. var result,method;
  21510. return smalltalk.withContext(function($ctx1) {
  21511. var $1,$2;
  21512. method=self._eval_(self._compileExpression_on_(aString,anObject));
  21513. _st(method)._protocol_("**xxxDoIt");
  21514. $1=_st(anObject)._class();
  21515. $ctx1.sendIdx["class"]=1;
  21516. _st($1)._addCompiledMethod_(method);
  21517. result=_st(anObject)._xxxDoIt();
  21518. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  21519. $2=result;
  21520. return $2;
  21521. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},globals.Compiler)})},
  21522. args: ["aString", "anObject"],
  21523. source: "evaluateExpression: aString on: anObject\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression with anObject as the receiver and answer the returned object\x22\x0a\x09| result method |\x0a\x09method := self eval: (self compileExpression: aString on: anObject).\x0a\x09method protocol: '**xxxDoIt'.\x0a\x09anObject class addCompiledMethod: method.\x0a\x09result := anObject xxxDoIt.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09^ result",
  21524. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"],
  21525. referencedClasses: []
  21526. }),
  21527. globals.Compiler);
  21528. smalltalk.addMethod(
  21529. smalltalk.method({
  21530. selector: "install:forClass:protocol:",
  21531. protocol: 'compiling',
  21532. fn: function (aString,aBehavior,anotherString){
  21533. var self=this;
  21534. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  21535. return smalltalk.withContext(function($ctx1) {
  21536. var $1;
  21537. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  21538. return $1;
  21539. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},globals.Compiler)})},
  21540. args: ["aString", "aBehavior", "anotherString"],
  21541. source: "install: aString forClass: aBehavior protocol: anotherString\x0a\x09^ ClassBuilder new\x0a\x09\x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a\x09\x09forClass: aBehavior\x0a\x09\x09protocol: anotherString",
  21542. messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"],
  21543. referencedClasses: ["ClassBuilder"]
  21544. }),
  21545. globals.Compiler);
  21546. smalltalk.addMethod(
  21547. smalltalk.method({
  21548. selector: "parse:",
  21549. protocol: 'compiling',
  21550. fn: function (aString){
  21551. var self=this;
  21552. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21553. return smalltalk.withContext(function($ctx1) {
  21554. var $1;
  21555. $1=_st($Smalltalk())._parse_(aString);
  21556. return $1;
  21557. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.Compiler)})},
  21558. args: ["aString"],
  21559. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  21560. messageSends: ["parse:"],
  21561. referencedClasses: ["Smalltalk"]
  21562. }),
  21563. globals.Compiler);
  21564. smalltalk.addMethod(
  21565. smalltalk.method({
  21566. selector: "parseExpression:",
  21567. protocol: 'compiling',
  21568. fn: function (aString){
  21569. var self=this;
  21570. return smalltalk.withContext(function($ctx1) {
  21571. var $2,$1;
  21572. $2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  21573. $ctx1.sendIdx[","]=1;
  21574. $1=self._parse_($2);
  21575. return $1;
  21576. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},globals.Compiler)})},
  21577. args: ["aString"],
  21578. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  21579. messageSends: ["parse:", ","],
  21580. referencedClasses: []
  21581. }),
  21582. globals.Compiler);
  21583. smalltalk.addMethod(
  21584. smalltalk.method({
  21585. selector: "recompile:",
  21586. protocol: 'compiling',
  21587. fn: function (aClass){
  21588. var self=this;
  21589. return smalltalk.withContext(function($ctx1) {
  21590. var $1;
  21591. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  21592. return smalltalk.withContext(function($ctx2) {
  21593. return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
  21594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Recompiling ".__comma(_st(aClass)._name()));
  21595. $1=_st(aClass)._isMetaclass();
  21596. if(! smalltalk.assert($1)){
  21597. self._recompile_(_st(aClass)._class());
  21598. };
  21599. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler)})},
  21600. args: ["aClass"],
  21601. source: "recompile: aClass\x0a\x09aClass methodDictionary values\x0a\x09\x09do: [ :each | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09install: each source \x0a\x09\x09\x09\x09forClass: aClass \x0a\x09\x09\x09\x09protocol: each protocol ]\x0a\x09\x09displayingProgress: 'Recompiling ', aClass name.\x0a\x09aClass isMetaclass ifFalse: [ self recompile: aClass class ]",
  21602. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"],
  21603. referencedClasses: []
  21604. }),
  21605. globals.Compiler);
  21606. smalltalk.addMethod(
  21607. smalltalk.method({
  21608. selector: "recompileAll",
  21609. protocol: 'compiling',
  21610. fn: function (){
  21611. var self=this;
  21612. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21613. return smalltalk.withContext(function($ctx1) {
  21614. _st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
  21615. return smalltalk.withContext(function($ctx2) {
  21616. return self._recompile_(each);
  21617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
  21618. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler)})},
  21619. args: [],
  21620. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  21621. messageSends: ["do:displayingProgress:", "classes", "recompile:"],
  21622. referencedClasses: ["Smalltalk"]
  21623. }),
  21624. globals.Compiler);
  21625. smalltalk.addMethod(
  21626. smalltalk.method({
  21627. selector: "source",
  21628. protocol: 'accessing',
  21629. fn: function (){
  21630. var self=this;
  21631. return smalltalk.withContext(function($ctx1) {
  21632. var $2,$1,$receiver;
  21633. $2=self["@source"];
  21634. if(($receiver = $2) == null || $receiver.isNil){
  21635. $1="";
  21636. } else {
  21637. $1=$2;
  21638. };
  21639. return $1;
  21640. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Compiler)})},
  21641. args: [],
  21642. source: "source\x0a\x09^ source ifNil: [ '' ]",
  21643. messageSends: ["ifNil:"],
  21644. referencedClasses: []
  21645. }),
  21646. globals.Compiler);
  21647. smalltalk.addMethod(
  21648. smalltalk.method({
  21649. selector: "source:",
  21650. protocol: 'accessing',
  21651. fn: function (aString){
  21652. var self=this;
  21653. self["@source"]=aString;
  21654. return self},
  21655. args: ["aString"],
  21656. source: "source: aString\x0a\x09source := aString",
  21657. messageSends: [],
  21658. referencedClasses: []
  21659. }),
  21660. globals.Compiler);
  21661. smalltalk.addMethod(
  21662. smalltalk.method({
  21663. selector: "unknownVariables",
  21664. protocol: 'accessing',
  21665. fn: function (){
  21666. var self=this;
  21667. var $1;
  21668. $1=self["@unknownVariables"];
  21669. return $1;
  21670. },
  21671. args: [],
  21672. source: "unknownVariables\x0a\x09^ unknownVariables",
  21673. messageSends: [],
  21674. referencedClasses: []
  21675. }),
  21676. globals.Compiler);
  21677. smalltalk.addMethod(
  21678. smalltalk.method({
  21679. selector: "unknownVariables:",
  21680. protocol: 'accessing',
  21681. fn: function (aCollection){
  21682. var self=this;
  21683. self["@unknownVariables"]=aCollection;
  21684. return self},
  21685. args: ["aCollection"],
  21686. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  21687. messageSends: [],
  21688. referencedClasses: []
  21689. }),
  21690. globals.Compiler);
  21691. smalltalk.addMethod(
  21692. smalltalk.method({
  21693. selector: "recompile:",
  21694. protocol: 'compiling',
  21695. fn: function (aClass){
  21696. var self=this;
  21697. return smalltalk.withContext(function($ctx1) {
  21698. _st(self._new())._recompile_(aClass);
  21699. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler.klass)})},
  21700. args: ["aClass"],
  21701. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  21702. messageSends: ["recompile:", "new"],
  21703. referencedClasses: []
  21704. }),
  21705. globals.Compiler.klass);
  21706. smalltalk.addMethod(
  21707. smalltalk.method({
  21708. selector: "recompileAll",
  21709. protocol: 'compiling',
  21710. fn: function (){
  21711. var self=this;
  21712. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  21713. return smalltalk.withContext(function($ctx1) {
  21714. _st(_st($Smalltalk())._classes())._do_((function(each){
  21715. return smalltalk.withContext(function($ctx2) {
  21716. return self._recompile_(each);
  21717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21718. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler.klass)})},
  21719. args: [],
  21720. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  21721. messageSends: ["do:", "classes", "recompile:"],
  21722. referencedClasses: ["Smalltalk"]
  21723. }),
  21724. globals.Compiler.klass);
  21725. smalltalk.addClass('DoIt', globals.Object, [], 'Compiler-Core');
  21726. globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  21727. smalltalk.addClass('Evaluator', globals.InterfacingObject, [], 'Compiler-Core');
  21728. globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  21729. smalltalk.addMethod(
  21730. smalltalk.method({
  21731. selector: "evaluate:context:",
  21732. protocol: 'evaluating',
  21733. fn: function (aString,aContext){
  21734. var self=this;
  21735. var compiler,ast;
  21736. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  21737. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  21738. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  21739. return smalltalk.withContext(function($ctx1) {
  21740. var $1,$2,$3,$4;
  21741. var $early={};
  21742. try {
  21743. compiler=_st($Compiler())._new();
  21744. _st((function(){
  21745. return smalltalk.withContext(function($ctx2) {
  21746. ast=_st(compiler)._parseExpression_(aString);
  21747. return ast;
  21748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  21749. return smalltalk.withContext(function($ctx2) {
  21750. $1=self._alert_(_st(ex)._messageText());
  21751. throw $early=[$1];
  21752. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  21753. $2=_st($AISemanticAnalyzer())._on_(_st(_st(aContext)._receiver())._class());
  21754. _st($2)._context_(aContext);
  21755. $3=_st($2)._visit_(ast);
  21756. $4=_st(aContext)._evaluateNode_(ast);
  21757. return $4;
  21758. }
  21759. catch(e) {if(e===$early)return e[0]; throw e}
  21760. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},globals.Evaluator)})},
  21761. args: ["aString", "aContext"],
  21762. source: "evaluate: aString context: aContext\x0a\x09\x22Similar to #evaluate:for:, with the following differences:\x0a\x09- instead of compiling and running `aString`, `aString` is interpreted using an `ASTInterpreter`\x0a\x09- instead of evaluating against a receiver, evaluate in the context of `aContext`\x22\x0a\x0a\x09| compiler ast |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ ast := compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x09\x09\x0a\x09(AISemanticAnalyzer on: aContext receiver class)\x0a\x09\x09context: aContext;\x0a\x09\x09visit: ast.\x0a\x0a\x09^ aContext evaluateNode: ast",
  21763. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"],
  21764. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"]
  21765. }),
  21766. globals.Evaluator);
  21767. smalltalk.addMethod(
  21768. smalltalk.method({
  21769. selector: "evaluate:for:",
  21770. protocol: 'evaluating',
  21771. fn: function (aString,anObject){
  21772. var self=this;
  21773. return smalltalk.withContext(function($ctx1) {
  21774. var $1;
  21775. $1=_st(anObject)._evaluate_on_(aString,self);
  21776. return $1;
  21777. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator)})},
  21778. args: ["aString", "anObject"],
  21779. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  21780. messageSends: ["evaluate:on:"],
  21781. referencedClasses: []
  21782. }),
  21783. globals.Evaluator);
  21784. smalltalk.addMethod(
  21785. smalltalk.method({
  21786. selector: "evaluate:receiver:",
  21787. protocol: 'evaluating',
  21788. fn: function (aString,anObject){
  21789. var self=this;
  21790. var compiler;
  21791. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  21792. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  21793. return smalltalk.withContext(function($ctx1) {
  21794. var $1,$2;
  21795. var $early={};
  21796. try {
  21797. compiler=_st($Compiler())._new();
  21798. _st((function(){
  21799. return smalltalk.withContext(function($ctx2) {
  21800. return _st(compiler)._parseExpression_(aString);
  21801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  21802. return smalltalk.withContext(function($ctx2) {
  21803. $1=self._alert_(_st(ex)._messageText());
  21804. throw $early=[$1];
  21805. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})}));
  21806. $2=_st(compiler)._evaluateExpression_on_(aString,anObject);
  21807. return $2;
  21808. }
  21809. catch(e) {if(e===$early)return e[0]; throw e}
  21810. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},globals.Evaluator)})},
  21811. args: ["aString", "anObject"],
  21812. source: "evaluate: aString receiver: anObject\x0a\x09| compiler |\x0a\x09\x0a\x09compiler := Compiler new.\x0a\x09[ compiler parseExpression: aString ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :ex | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  21813. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"],
  21814. referencedClasses: ["Compiler", "Error"]
  21815. }),
  21816. globals.Evaluator);
  21817. smalltalk.addMethod(
  21818. smalltalk.method({
  21819. selector: "evaluate:for:",
  21820. protocol: 'instance creation',
  21821. fn: function (aString,anObject){
  21822. var self=this;
  21823. return smalltalk.withContext(function($ctx1) {
  21824. var $1;
  21825. $1=_st(self._new())._evaluate_for_(aString,anObject);
  21826. return $1;
  21827. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator.klass)})},
  21828. args: ["aString", "anObject"],
  21829. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  21830. messageSends: ["evaluate:for:", "new"],
  21831. referencedClasses: []
  21832. }),
  21833. globals.Evaluator.klass);
  21834. smalltalk.addClass('NodeVisitor', globals.Object, [], 'Compiler-Core');
  21835. globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  21836. smalltalk.addMethod(
  21837. smalltalk.method({
  21838. selector: "visit:",
  21839. protocol: 'visiting',
  21840. fn: function (aNode){
  21841. var self=this;
  21842. return smalltalk.withContext(function($ctx1) {
  21843. var $1;
  21844. $1=_st(aNode)._accept_(self);
  21845. return $1;
  21846. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.NodeVisitor)})},
  21847. args: ["aNode"],
  21848. source: "visit: aNode\x0a\x09^ aNode accept: self",
  21849. messageSends: ["accept:"],
  21850. referencedClasses: []
  21851. }),
  21852. globals.NodeVisitor);
  21853. smalltalk.addMethod(
  21854. smalltalk.method({
  21855. selector: "visitAll:",
  21856. protocol: 'visiting',
  21857. fn: function (aCollection){
  21858. var self=this;
  21859. return smalltalk.withContext(function($ctx1) {
  21860. var $1;
  21861. $1=_st(aCollection)._collect_((function(each){
  21862. return smalltalk.withContext(function($ctx2) {
  21863. return self._visit_(each);
  21864. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  21865. return $1;
  21866. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},globals.NodeVisitor)})},
  21867. args: ["aCollection"],
  21868. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  21869. messageSends: ["collect:", "visit:"],
  21870. referencedClasses: []
  21871. }),
  21872. globals.NodeVisitor);
  21873. smalltalk.addMethod(
  21874. smalltalk.method({
  21875. selector: "visitAssignmentNode:",
  21876. protocol: 'visiting',
  21877. fn: function (aNode){
  21878. var self=this;
  21879. return smalltalk.withContext(function($ctx1) {
  21880. var $1;
  21881. $1=self._visitNode_(aNode);
  21882. return $1;
  21883. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.NodeVisitor)})},
  21884. args: ["aNode"],
  21885. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  21886. messageSends: ["visitNode:"],
  21887. referencedClasses: []
  21888. }),
  21889. globals.NodeVisitor);
  21890. smalltalk.addMethod(
  21891. smalltalk.method({
  21892. selector: "visitBlockNode:",
  21893. protocol: 'visiting',
  21894. fn: function (aNode){
  21895. var self=this;
  21896. return smalltalk.withContext(function($ctx1) {
  21897. var $1;
  21898. $1=self._visitNode_(aNode);
  21899. return $1;
  21900. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.NodeVisitor)})},
  21901. args: ["aNode"],
  21902. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  21903. messageSends: ["visitNode:"],
  21904. referencedClasses: []
  21905. }),
  21906. globals.NodeVisitor);
  21907. smalltalk.addMethod(
  21908. smalltalk.method({
  21909. selector: "visitBlockSequenceNode:",
  21910. protocol: 'visiting',
  21911. fn: function (aNode){
  21912. var self=this;
  21913. return smalltalk.withContext(function($ctx1) {
  21914. var $1;
  21915. $1=self._visitSequenceNode_(aNode);
  21916. return $1;
  21917. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
  21918. args: ["aNode"],
  21919. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  21920. messageSends: ["visitSequenceNode:"],
  21921. referencedClasses: []
  21922. }),
  21923. globals.NodeVisitor);
  21924. smalltalk.addMethod(
  21925. smalltalk.method({
  21926. selector: "visitCascadeNode:",
  21927. protocol: 'visiting',
  21928. fn: function (aNode){
  21929. var self=this;
  21930. return smalltalk.withContext(function($ctx1) {
  21931. var $1;
  21932. $1=self._visitNode_(aNode);
  21933. return $1;
  21934. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.NodeVisitor)})},
  21935. args: ["aNode"],
  21936. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  21937. messageSends: ["visitNode:"],
  21938. referencedClasses: []
  21939. }),
  21940. globals.NodeVisitor);
  21941. smalltalk.addMethod(
  21942. smalltalk.method({
  21943. selector: "visitDynamicArrayNode:",
  21944. protocol: 'visiting',
  21945. fn: function (aNode){
  21946. var self=this;
  21947. return smalltalk.withContext(function($ctx1) {
  21948. var $1;
  21949. $1=self._visitNode_(aNode);
  21950. return $1;
  21951. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},globals.NodeVisitor)})},
  21952. args: ["aNode"],
  21953. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  21954. messageSends: ["visitNode:"],
  21955. referencedClasses: []
  21956. }),
  21957. globals.NodeVisitor);
  21958. smalltalk.addMethod(
  21959. smalltalk.method({
  21960. selector: "visitDynamicDictionaryNode:",
  21961. protocol: 'visiting',
  21962. fn: function (aNode){
  21963. var self=this;
  21964. return smalltalk.withContext(function($ctx1) {
  21965. var $1;
  21966. $1=self._visitNode_(aNode);
  21967. return $1;
  21968. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},globals.NodeVisitor)})},
  21969. args: ["aNode"],
  21970. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  21971. messageSends: ["visitNode:"],
  21972. referencedClasses: []
  21973. }),
  21974. globals.NodeVisitor);
  21975. smalltalk.addMethod(
  21976. smalltalk.method({
  21977. selector: "visitJSStatementNode:",
  21978. protocol: 'visiting',
  21979. fn: function (aNode){
  21980. var self=this;
  21981. return smalltalk.withContext(function($ctx1) {
  21982. var $1;
  21983. $1=self._visitNode_(aNode);
  21984. return $1;
  21985. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.NodeVisitor)})},
  21986. args: ["aNode"],
  21987. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  21988. messageSends: ["visitNode:"],
  21989. referencedClasses: []
  21990. }),
  21991. globals.NodeVisitor);
  21992. smalltalk.addMethod(
  21993. smalltalk.method({
  21994. selector: "visitMethodNode:",
  21995. protocol: 'visiting',
  21996. fn: function (aNode){
  21997. var self=this;
  21998. return smalltalk.withContext(function($ctx1) {
  21999. var $1;
  22000. $1=self._visitNode_(aNode);
  22001. return $1;
  22002. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.NodeVisitor)})},
  22003. args: ["aNode"],
  22004. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  22005. messageSends: ["visitNode:"],
  22006. referencedClasses: []
  22007. }),
  22008. globals.NodeVisitor);
  22009. smalltalk.addMethod(
  22010. smalltalk.method({
  22011. selector: "visitNode:",
  22012. protocol: 'visiting',
  22013. fn: function (aNode){
  22014. var self=this;
  22015. return smalltalk.withContext(function($ctx1) {
  22016. var $1;
  22017. $1=self._visitAll_(_st(aNode)._nodes());
  22018. return $1;
  22019. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},globals.NodeVisitor)})},
  22020. args: ["aNode"],
  22021. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  22022. messageSends: ["visitAll:", "nodes"],
  22023. referencedClasses: []
  22024. }),
  22025. globals.NodeVisitor);
  22026. smalltalk.addMethod(
  22027. smalltalk.method({
  22028. selector: "visitReturnNode:",
  22029. protocol: 'visiting',
  22030. fn: function (aNode){
  22031. var self=this;
  22032. return smalltalk.withContext(function($ctx1) {
  22033. var $1;
  22034. $1=self._visitNode_(aNode);
  22035. return $1;
  22036. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.NodeVisitor)})},
  22037. args: ["aNode"],
  22038. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  22039. messageSends: ["visitNode:"],
  22040. referencedClasses: []
  22041. }),
  22042. globals.NodeVisitor);
  22043. smalltalk.addMethod(
  22044. smalltalk.method({
  22045. selector: "visitSendNode:",
  22046. protocol: 'visiting',
  22047. fn: function (aNode){
  22048. var self=this;
  22049. return smalltalk.withContext(function($ctx1) {
  22050. var $1;
  22051. $1=self._visitNode_(aNode);
  22052. return $1;
  22053. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.NodeVisitor)})},
  22054. args: ["aNode"],
  22055. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  22056. messageSends: ["visitNode:"],
  22057. referencedClasses: []
  22058. }),
  22059. globals.NodeVisitor);
  22060. smalltalk.addMethod(
  22061. smalltalk.method({
  22062. selector: "visitSequenceNode:",
  22063. protocol: 'visiting',
  22064. fn: function (aNode){
  22065. var self=this;
  22066. return smalltalk.withContext(function($ctx1) {
  22067. var $1;
  22068. $1=self._visitNode_(aNode);
  22069. return $1;
  22070. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.NodeVisitor)})},
  22071. args: ["aNode"],
  22072. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  22073. messageSends: ["visitNode:"],
  22074. referencedClasses: []
  22075. }),
  22076. globals.NodeVisitor);
  22077. smalltalk.addMethod(
  22078. smalltalk.method({
  22079. selector: "visitValueNode:",
  22080. protocol: 'visiting',
  22081. fn: function (aNode){
  22082. var self=this;
  22083. return smalltalk.withContext(function($ctx1) {
  22084. var $1;
  22085. $1=self._visitNode_(aNode);
  22086. return $1;
  22087. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.NodeVisitor)})},
  22088. args: ["aNode"],
  22089. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  22090. messageSends: ["visitNode:"],
  22091. referencedClasses: []
  22092. }),
  22093. globals.NodeVisitor);
  22094. smalltalk.addMethod(
  22095. smalltalk.method({
  22096. selector: "visitVariableNode:",
  22097. protocol: 'visiting',
  22098. fn: function (aNode){
  22099. var self=this;
  22100. return smalltalk.withContext(function($ctx1) {
  22101. var $1;
  22102. $1=self._visitNode_(aNode);
  22103. return $1;
  22104. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.NodeVisitor)})},
  22105. args: ["aNode"],
  22106. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  22107. messageSends: ["visitNode:"],
  22108. referencedClasses: []
  22109. }),
  22110. globals.NodeVisitor);
  22111. smalltalk.addMethod(
  22112. smalltalk.method({
  22113. selector: "asVariableName",
  22114. protocol: '*Compiler-Core',
  22115. fn: function (){
  22116. var self=this;
  22117. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  22118. return smalltalk.withContext(function($ctx1) {
  22119. var $2,$1;
  22120. $2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
  22121. if(smalltalk.assert($2)){
  22122. $1=self.__comma("_");
  22123. } else {
  22124. $1=self;
  22125. };
  22126. return $1;
  22127. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},globals.String)})},
  22128. args: [],
  22129. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  22130. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","],
  22131. referencedClasses: ["Smalltalk"]
  22132. }),
  22133. globals.String);
  22134. });
  22135. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  22136. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  22137. smalltalk.addPackage('Compiler-AST');
  22138. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22139. smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  22140. globals.Node.comment="I am the abstract root class of the abstract syntax tree.\x0a\x0aConcrete classes should implement `#accept:` to allow visiting.\x0a\x0a`position` holds a point containing line and column number of the symbol location in the original source file.";
  22141. smalltalk.addMethod(
  22142. smalltalk.method({
  22143. selector: "accept:",
  22144. protocol: 'visiting',
  22145. fn: function (aVisitor){
  22146. var self=this;
  22147. return smalltalk.withContext(function($ctx1) {
  22148. var $1;
  22149. $1=_st(aVisitor)._visitNode_(self);
  22150. return $1;
  22151. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)})},
  22152. args: ["aVisitor"],
  22153. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  22154. messageSends: ["visitNode:"],
  22155. referencedClasses: []
  22156. }),
  22157. globals.Node);
  22158. smalltalk.addMethod(
  22159. smalltalk.method({
  22160. selector: "addNode:",
  22161. protocol: 'accessing',
  22162. fn: function (aNode){
  22163. var self=this;
  22164. return smalltalk.withContext(function($ctx1) {
  22165. _st(self._nodes())._add_(aNode);
  22166. _st(aNode)._parent_(self);
  22167. return self}, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)})},
  22168. args: ["aNode"],
  22169. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  22170. messageSends: ["add:", "nodes", "parent:"],
  22171. referencedClasses: []
  22172. }),
  22173. globals.Node);
  22174. smalltalk.addMethod(
  22175. smalltalk.method({
  22176. selector: "allNodes",
  22177. protocol: 'accessing',
  22178. fn: function (){
  22179. var self=this;
  22180. var allNodes;
  22181. return smalltalk.withContext(function($ctx1) {
  22182. var $1,$2;
  22183. $1=self._nodes();
  22184. $ctx1.sendIdx["nodes"]=1;
  22185. allNodes=_st($1)._asSet();
  22186. _st(self._nodes())._do_((function(each){
  22187. return smalltalk.withContext(function($ctx2) {
  22188. return _st(allNodes)._addAll_(_st(each)._allNodes());
  22189. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22190. $2=allNodes;
  22191. return $2;
  22192. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},globals.Node)})},
  22193. args: [],
  22194. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  22195. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"],
  22196. referencedClasses: []
  22197. }),
  22198. globals.Node);
  22199. smalltalk.addMethod(
  22200. smalltalk.method({
  22201. selector: "inPosition:",
  22202. protocol: 'testing',
  22203. fn: function (aPoint){
  22204. var self=this;
  22205. return smalltalk.withContext(function($ctx1) {
  22206. var $1;
  22207. $1=_st(_st(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  22208. return smalltalk.withContext(function($ctx2) {
  22209. return _st(self._positionEnd()).__gt_eq(aPoint);
  22210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  22211. return $1;
  22212. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},globals.Node)})},
  22213. args: ["aPoint"],
  22214. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  22215. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"],
  22216. referencedClasses: []
  22217. }),
  22218. globals.Node);
  22219. smalltalk.addMethod(
  22220. smalltalk.method({
  22221. selector: "isAssignmentNode",
  22222. protocol: 'testing',
  22223. fn: function (){
  22224. var self=this;
  22225. return false;
  22226. },
  22227. args: [],
  22228. source: "isAssignmentNode\x0a\x09^ false",
  22229. messageSends: [],
  22230. referencedClasses: []
  22231. }),
  22232. globals.Node);
  22233. smalltalk.addMethod(
  22234. smalltalk.method({
  22235. selector: "isBlockNode",
  22236. protocol: 'testing',
  22237. fn: function (){
  22238. var self=this;
  22239. return false;
  22240. },
  22241. args: [],
  22242. source: "isBlockNode\x0a\x09^ false",
  22243. messageSends: [],
  22244. referencedClasses: []
  22245. }),
  22246. globals.Node);
  22247. smalltalk.addMethod(
  22248. smalltalk.method({
  22249. selector: "isBlockSequenceNode",
  22250. protocol: 'testing',
  22251. fn: function (){
  22252. var self=this;
  22253. return false;
  22254. },
  22255. args: [],
  22256. source: "isBlockSequenceNode\x0a\x09^ false",
  22257. messageSends: [],
  22258. referencedClasses: []
  22259. }),
  22260. globals.Node);
  22261. smalltalk.addMethod(
  22262. smalltalk.method({
  22263. selector: "isCascadeNode",
  22264. protocol: 'testing',
  22265. fn: function (){
  22266. var self=this;
  22267. return false;
  22268. },
  22269. args: [],
  22270. source: "isCascadeNode\x0a\x09^ false",
  22271. messageSends: [],
  22272. referencedClasses: []
  22273. }),
  22274. globals.Node);
  22275. smalltalk.addMethod(
  22276. smalltalk.method({
  22277. selector: "isImmutable",
  22278. protocol: 'testing',
  22279. fn: function (){
  22280. var self=this;
  22281. return false;
  22282. },
  22283. args: [],
  22284. source: "isImmutable\x0a\x09^ false",
  22285. messageSends: [],
  22286. referencedClasses: []
  22287. }),
  22288. globals.Node);
  22289. smalltalk.addMethod(
  22290. smalltalk.method({
  22291. selector: "isJSStatementNode",
  22292. protocol: 'testing',
  22293. fn: function (){
  22294. var self=this;
  22295. return false;
  22296. },
  22297. args: [],
  22298. source: "isJSStatementNode\x0a\x09^ false",
  22299. messageSends: [],
  22300. referencedClasses: []
  22301. }),
  22302. globals.Node);
  22303. smalltalk.addMethod(
  22304. smalltalk.method({
  22305. selector: "isLastChild",
  22306. protocol: 'testing',
  22307. fn: function (){
  22308. var self=this;
  22309. return smalltalk.withContext(function($ctx1) {
  22310. var $1;
  22311. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  22312. return $1;
  22313. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)})},
  22314. args: [],
  22315. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  22316. messageSends: ["=", "last", "nodes", "parent"],
  22317. referencedClasses: []
  22318. }),
  22319. globals.Node);
  22320. smalltalk.addMethod(
  22321. smalltalk.method({
  22322. selector: "isNavigationNode",
  22323. protocol: 'testing',
  22324. fn: function (){
  22325. var self=this;
  22326. return false;
  22327. },
  22328. args: [],
  22329. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  22330. messageSends: [],
  22331. referencedClasses: []
  22332. }),
  22333. globals.Node);
  22334. smalltalk.addMethod(
  22335. smalltalk.method({
  22336. selector: "isNode",
  22337. protocol: 'testing',
  22338. fn: function (){
  22339. var self=this;
  22340. return true;
  22341. },
  22342. args: [],
  22343. source: "isNode\x0a\x09^ true",
  22344. messageSends: [],
  22345. referencedClasses: []
  22346. }),
  22347. globals.Node);
  22348. smalltalk.addMethod(
  22349. smalltalk.method({
  22350. selector: "isReferenced",
  22351. protocol: 'testing',
  22352. fn: function (){
  22353. var self=this;
  22354. return smalltalk.withContext(function($ctx1) {
  22355. var $4,$3,$2,$1;
  22356. $4=self._parent();
  22357. $ctx1.sendIdx["parent"]=1;
  22358. $3=_st($4)._isSequenceNode();
  22359. $2=_st($3)._or_((function(){
  22360. return smalltalk.withContext(function($ctx2) {
  22361. return _st(self._parent())._isAssignmentNode();
  22362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  22363. $1=_st($2)._not();
  22364. return $1;
  22365. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)})},
  22366. args: [],
  22367. source: "isReferenced\x0a\x09\x22Answer true if the receiver is referenced by other nodes.\x0a\x09Do not take sequences or assignments into account\x22\x0a\x09\x0a\x09^ (self parent isSequenceNode or: [\x0a\x09\x09self parent isAssignmentNode ]) not",
  22368. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"],
  22369. referencedClasses: []
  22370. }),
  22371. globals.Node);
  22372. smalltalk.addMethod(
  22373. smalltalk.method({
  22374. selector: "isReturnNode",
  22375. protocol: 'testing',
  22376. fn: function (){
  22377. var self=this;
  22378. return false;
  22379. },
  22380. args: [],
  22381. source: "isReturnNode\x0a\x09^ false",
  22382. messageSends: [],
  22383. referencedClasses: []
  22384. }),
  22385. globals.Node);
  22386. smalltalk.addMethod(
  22387. smalltalk.method({
  22388. selector: "isSendNode",
  22389. protocol: 'testing',
  22390. fn: function (){
  22391. var self=this;
  22392. return false;
  22393. },
  22394. args: [],
  22395. source: "isSendNode\x0a\x09^ false",
  22396. messageSends: [],
  22397. referencedClasses: []
  22398. }),
  22399. globals.Node);
  22400. smalltalk.addMethod(
  22401. smalltalk.method({
  22402. selector: "isSequenceNode",
  22403. protocol: 'testing',
  22404. fn: function (){
  22405. var self=this;
  22406. return false;
  22407. },
  22408. args: [],
  22409. source: "isSequenceNode\x0a\x09^ false",
  22410. messageSends: [],
  22411. referencedClasses: []
  22412. }),
  22413. globals.Node);
  22414. smalltalk.addMethod(
  22415. smalltalk.method({
  22416. selector: "isValueNode",
  22417. protocol: 'testing',
  22418. fn: function (){
  22419. var self=this;
  22420. return false;
  22421. },
  22422. args: [],
  22423. source: "isValueNode\x0a\x09^ false",
  22424. messageSends: [],
  22425. referencedClasses: []
  22426. }),
  22427. globals.Node);
  22428. smalltalk.addMethod(
  22429. smalltalk.method({
  22430. selector: "isVariableNode",
  22431. protocol: 'testing',
  22432. fn: function (){
  22433. var self=this;
  22434. return false;
  22435. },
  22436. args: [],
  22437. source: "isVariableNode\x0a\x09^ false",
  22438. messageSends: [],
  22439. referencedClasses: []
  22440. }),
  22441. globals.Node);
  22442. smalltalk.addMethod(
  22443. smalltalk.method({
  22444. selector: "method",
  22445. protocol: 'accessing',
  22446. fn: function (){
  22447. var self=this;
  22448. return smalltalk.withContext(function($ctx1) {
  22449. var $2,$1,$receiver;
  22450. $2=self._parent();
  22451. if(($receiver = $2) == null || $receiver.isNil){
  22452. $1=$2;
  22453. } else {
  22454. var node;
  22455. node=$receiver;
  22456. $1=_st(node)._method();
  22457. };
  22458. return $1;
  22459. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)})},
  22460. args: [],
  22461. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  22462. messageSends: ["ifNotNil:", "parent", "method"],
  22463. referencedClasses: []
  22464. }),
  22465. globals.Node);
  22466. smalltalk.addMethod(
  22467. smalltalk.method({
  22468. selector: "navigationNodeAt:ifAbsent:",
  22469. protocol: 'accessing',
  22470. fn: function (aPoint,aBlock){
  22471. var self=this;
  22472. var children;
  22473. return smalltalk.withContext(function($ctx1) {
  22474. var $1,$4,$3,$2;
  22475. var $early={};
  22476. try {
  22477. children=_st(self._allNodes())._select_((function(each){
  22478. return smalltalk.withContext(function($ctx2) {
  22479. return _st(_st(each)._isNavigationNode())._and_((function(){
  22480. return smalltalk.withContext(function($ctx3) {
  22481. return _st(each)._inPosition_(aPoint);
  22482. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  22483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22484. _st(children)._ifEmpty_((function(){
  22485. return smalltalk.withContext(function($ctx2) {
  22486. $1=_st(aBlock)._value();
  22487. throw $early=[$1];
  22488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  22489. $2=_st(_st(_st(children)._asArray())._sort_((function(a,b){
  22490. return smalltalk.withContext(function($ctx2) {
  22491. $4=_st(a)._positionStart();
  22492. $ctx2.sendIdx["positionStart"]=1;
  22493. $3=_st($4)._dist_(aPoint);
  22494. $ctx2.sendIdx["dist:"]=1;
  22495. return _st($3).__lt_eq(_st(_st(b)._positionStart())._dist_(aPoint));
  22496. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)})})))._first();
  22497. return $2;
  22498. }
  22499. catch(e) {if(e===$early)return e[0]; throw e}
  22500. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},globals.Node)})},
  22501. args: ["aPoint", "aBlock"],
  22502. source: "navigationNodeAt: aPoint ifAbsent: aBlock\x0a\x09\x22Answer the navigation node in the receiver's tree at aPoint \x0a\x09or nil if no navigation node was found.\x0a\x09\x0a\x09See `node >> isNaviationNode`\x22\x0a\x09\x0a\x09| children |\x0a\x09\x0a\x09children := self allNodes select: [ :each | \x0a\x09\x09each isNavigationNode and: [ each inPosition: aPoint ] ].\x0a\x09\x0a\x09children ifEmpty: [ ^ aBlock value ].\x0a\x09\x0a\x09^ (children asArray sort: [ :a :b | \x0a\x09\x09(a positionStart dist: aPoint) <= \x0a\x09\x09(b positionStart dist: aPoint) ]) first",
  22503. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"],
  22504. referencedClasses: []
  22505. }),
  22506. globals.Node);
  22507. smalltalk.addMethod(
  22508. smalltalk.method({
  22509. selector: "nextChild",
  22510. protocol: 'accessing',
  22511. fn: function (){
  22512. var self=this;
  22513. return smalltalk.withContext(function($ctx1) {
  22514. var $3,$2,$1;
  22515. $3=self._nodes();
  22516. $ctx1.sendIdx["nodes"]=1;
  22517. $2=_st($3)._isEmpty();
  22518. if(smalltalk.assert($2)){
  22519. $1=self;
  22520. } else {
  22521. $1=_st(_st(self._nodes())._first())._nextChild();
  22522. };
  22523. return $1;
  22524. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)})},
  22525. args: [],
  22526. source: "nextChild\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the receiver to answer the next node to be evaluated\x22\x0a\x09\x0a\x09^ self nodes isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self nodes first nextChild ]",
  22527. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"],
  22528. referencedClasses: []
  22529. }),
  22530. globals.Node);
  22531. smalltalk.addMethod(
  22532. smalltalk.method({
  22533. selector: "nextNode",
  22534. protocol: 'accessing',
  22535. fn: function (){
  22536. var self=this;
  22537. return smalltalk.withContext(function($ctx1) {
  22538. var $2,$1,$receiver;
  22539. $2=self._parent();
  22540. if(($receiver = $2) == null || $receiver.isNil){
  22541. $1=$2;
  22542. } else {
  22543. var node;
  22544. node=$receiver;
  22545. $1=_st(node)._nextNode_(self);
  22546. };
  22547. return $1;
  22548. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)})},
  22549. args: [],
  22550. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  22551. messageSends: ["ifNotNil:", "parent", "nextNode:"],
  22552. referencedClasses: []
  22553. }),
  22554. globals.Node);
  22555. smalltalk.addMethod(
  22556. smalltalk.method({
  22557. selector: "nextNode:",
  22558. protocol: 'accessing',
  22559. fn: function (aNode){
  22560. var self=this;
  22561. var next;
  22562. return smalltalk.withContext(function($ctx1) {
  22563. var $1,$2;
  22564. var $early={};
  22565. try {
  22566. $1=self._nodes();
  22567. $ctx1.sendIdx["nodes"]=1;
  22568. next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  22569. throw $early=[self];
  22570. }));
  22571. $2=_st(next)._nextChild();
  22572. return $2;
  22573. }
  22574. catch(e) {if(e===$early)return e[0]; throw e}
  22575. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)})},
  22576. args: ["aNode"],
  22577. source: "nextNode: aNode\x0a\x09\x22Answer the next node after aNode.\x0a\x09Recurse into the possible children of the next node to answer the next node to be evaluated\x22\x0a\x09\x0a\x09| next |\x0a\x09\x0a\x09next := self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ self ].\x0a\x09\x0a\x09^ next nextChild",
  22578. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"],
  22579. referencedClasses: []
  22580. }),
  22581. globals.Node);
  22582. smalltalk.addMethod(
  22583. smalltalk.method({
  22584. selector: "nodes",
  22585. protocol: 'accessing',
  22586. fn: function (){
  22587. var self=this;
  22588. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  22589. return smalltalk.withContext(function($ctx1) {
  22590. var $2,$1,$receiver;
  22591. $2=self["@nodes"];
  22592. if(($receiver = $2) == null || $receiver.isNil){
  22593. self["@nodes"]=_st($Array())._new();
  22594. $1=self["@nodes"];
  22595. } else {
  22596. $1=$2;
  22597. };
  22598. return $1;
  22599. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)})},
  22600. args: [],
  22601. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  22602. messageSends: ["ifNil:", "new"],
  22603. referencedClasses: ["Array"]
  22604. }),
  22605. globals.Node);
  22606. smalltalk.addMethod(
  22607. smalltalk.method({
  22608. selector: "nodes:",
  22609. protocol: 'building',
  22610. fn: function (aCollection){
  22611. var self=this;
  22612. return smalltalk.withContext(function($ctx1) {
  22613. self["@nodes"]=aCollection;
  22614. _st(aCollection)._do_((function(each){
  22615. return smalltalk.withContext(function($ctx2) {
  22616. return _st(each)._parent_(self);
  22617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22618. return self}, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)})},
  22619. args: ["aCollection"],
  22620. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  22621. messageSends: ["do:", "parent:"],
  22622. referencedClasses: []
  22623. }),
  22624. globals.Node);
  22625. smalltalk.addMethod(
  22626. smalltalk.method({
  22627. selector: "parent",
  22628. protocol: 'accessing',
  22629. fn: function (){
  22630. var self=this;
  22631. var $1;
  22632. $1=self["@parent"];
  22633. return $1;
  22634. },
  22635. args: [],
  22636. source: "parent\x0a\x09^ parent",
  22637. messageSends: [],
  22638. referencedClasses: []
  22639. }),
  22640. globals.Node);
  22641. smalltalk.addMethod(
  22642. smalltalk.method({
  22643. selector: "parent:",
  22644. protocol: 'accessing',
  22645. fn: function (aNode){
  22646. var self=this;
  22647. self["@parent"]=aNode;
  22648. return self},
  22649. args: ["aNode"],
  22650. source: "parent: aNode\x0a\x09parent := aNode",
  22651. messageSends: [],
  22652. referencedClasses: []
  22653. }),
  22654. globals.Node);
  22655. smalltalk.addMethod(
  22656. smalltalk.method({
  22657. selector: "position",
  22658. protocol: 'accessing',
  22659. fn: function (){
  22660. var self=this;
  22661. return smalltalk.withContext(function($ctx1) {
  22662. var $2,$3,$1,$receiver;
  22663. $2=self["@position"];
  22664. if(($receiver = $2) == null || $receiver.isNil){
  22665. $3=self._parent();
  22666. if(($receiver = $3) == null || $receiver.isNil){
  22667. $1=$3;
  22668. } else {
  22669. var node;
  22670. node=$receiver;
  22671. $1=_st(node)._position();
  22672. };
  22673. } else {
  22674. $1=$2;
  22675. };
  22676. return $1;
  22677. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)})},
  22678. args: [],
  22679. source: "position\x0a\x09\x22answer the line and column of the receiver in the source code\x22\x0a\x09\x0a\x09^ position ifNil: [ \x0a\x09\x09self parent ifNotNil: [ :node | node position ] ]",
  22680. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"],
  22681. referencedClasses: []
  22682. }),
  22683. globals.Node);
  22684. smalltalk.addMethod(
  22685. smalltalk.method({
  22686. selector: "position:",
  22687. protocol: 'accessing',
  22688. fn: function (aPosition){
  22689. var self=this;
  22690. self["@position"]=aPosition;
  22691. return self},
  22692. args: ["aPosition"],
  22693. source: "position: aPosition\x0a\x09position := aPosition",
  22694. messageSends: [],
  22695. referencedClasses: []
  22696. }),
  22697. globals.Node);
  22698. smalltalk.addMethod(
  22699. smalltalk.method({
  22700. selector: "positionEnd",
  22701. protocol: 'accessing',
  22702. fn: function (){
  22703. var self=this;
  22704. return smalltalk.withContext(function($ctx1) {
  22705. var $2,$7,$6,$5,$4,$3,$1;
  22706. $2=self._positionStart();
  22707. $7=self._source();
  22708. $ctx1.sendIdx["source"]=1;
  22709. $6=_st($7)._lines();
  22710. $ctx1.sendIdx["lines"]=1;
  22711. $5=_st($6)._size();
  22712. $ctx1.sendIdx["size"]=1;
  22713. $4=_st($5).__minus((1));
  22714. $ctx1.sendIdx["-"]=1;
  22715. $3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
  22716. $1=_st($2).__plus($3);
  22717. return $1;
  22718. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)})},
  22719. args: [],
  22720. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  22721. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"],
  22722. referencedClasses: []
  22723. }),
  22724. globals.Node);
  22725. smalltalk.addMethod(
  22726. smalltalk.method({
  22727. selector: "positionStart",
  22728. protocol: 'accessing',
  22729. fn: function (){
  22730. var self=this;
  22731. return smalltalk.withContext(function($ctx1) {
  22732. var $1;
  22733. $1=self._position();
  22734. return $1;
  22735. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)})},
  22736. args: [],
  22737. source: "positionStart\x0a\x09^ self position",
  22738. messageSends: ["position"],
  22739. referencedClasses: []
  22740. }),
  22741. globals.Node);
  22742. smalltalk.addMethod(
  22743. smalltalk.method({
  22744. selector: "postCopy",
  22745. protocol: 'copying',
  22746. fn: function (){
  22747. var self=this;
  22748. return smalltalk.withContext(function($ctx1) {
  22749. ($ctx1.supercall = true, globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []));
  22750. $ctx1.supercall = false;
  22751. _st(self._nodes())._do_((function(each){
  22752. return smalltalk.withContext(function($ctx2) {
  22753. return _st(each)._parent_(self);
  22754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  22755. return self}, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)})},
  22756. args: [],
  22757. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  22758. messageSends: ["postCopy", "do:", "nodes", "parent:"],
  22759. referencedClasses: []
  22760. }),
  22761. globals.Node);
  22762. smalltalk.addMethod(
  22763. smalltalk.method({
  22764. selector: "requiresSmalltalkContext",
  22765. protocol: 'testing',
  22766. fn: function (){
  22767. var self=this;
  22768. return smalltalk.withContext(function($ctx1) {
  22769. var $1;
  22770. $1=_st(_st(self._nodes())._detect_ifNone_((function(each){
  22771. return smalltalk.withContext(function($ctx2) {
  22772. return _st(each)._requiresSmalltalkContext();
  22773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  22774. return nil;
  22775. })))._notNil();
  22776. return $1;
  22777. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)})},
  22778. args: [],
  22779. source: "requiresSmalltalkContext\x0a\x09\x22Answer true if the receiver requires a smalltalk context.\x0a\x09Only send nodes require a context.\x0a\x09\x0a\x09If no node requires a context, the method will be compiled without one.\x0a\x09See `IRJSTranslator` and `JSStream` for context creation\x22\x0a\x09\x0a\x09^ (self nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  22780. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"],
  22781. referencedClasses: []
  22782. }),
  22783. globals.Node);
  22784. smalltalk.addMethod(
  22785. smalltalk.method({
  22786. selector: "shouldBeAliased",
  22787. protocol: 'accessing',
  22788. fn: function (){
  22789. var self=this;
  22790. return smalltalk.withContext(function($ctx1) {
  22791. var $2,$1,$receiver;
  22792. $2=self["@shouldBeAliased"];
  22793. if(($receiver = $2) == null || $receiver.isNil){
  22794. $1=false;
  22795. } else {
  22796. $1=$2;
  22797. };
  22798. return $1;
  22799. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)})},
  22800. args: [],
  22801. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  22802. messageSends: ["ifNil:"],
  22803. referencedClasses: []
  22804. }),
  22805. globals.Node);
  22806. smalltalk.addMethod(
  22807. smalltalk.method({
  22808. selector: "shouldBeAliased:",
  22809. protocol: 'accessing',
  22810. fn: function (aBoolean){
  22811. var self=this;
  22812. self["@shouldBeAliased"]=aBoolean;
  22813. return self},
  22814. args: ["aBoolean"],
  22815. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  22816. messageSends: [],
  22817. referencedClasses: []
  22818. }),
  22819. globals.Node);
  22820. smalltalk.addMethod(
  22821. smalltalk.method({
  22822. selector: "shouldBeInlined",
  22823. protocol: 'accessing',
  22824. fn: function (){
  22825. var self=this;
  22826. return smalltalk.withContext(function($ctx1) {
  22827. var $2,$1,$receiver;
  22828. $2=self["@shouldBeInlined"];
  22829. if(($receiver = $2) == null || $receiver.isNil){
  22830. $1=false;
  22831. } else {
  22832. $1=$2;
  22833. };
  22834. return $1;
  22835. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)})},
  22836. args: [],
  22837. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  22838. messageSends: ["ifNil:"],
  22839. referencedClasses: []
  22840. }),
  22841. globals.Node);
  22842. smalltalk.addMethod(
  22843. smalltalk.method({
  22844. selector: "shouldBeInlined:",
  22845. protocol: 'accessing',
  22846. fn: function (aBoolean){
  22847. var self=this;
  22848. self["@shouldBeInlined"]=aBoolean;
  22849. return self},
  22850. args: ["aBoolean"],
  22851. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  22852. messageSends: [],
  22853. referencedClasses: []
  22854. }),
  22855. globals.Node);
  22856. smalltalk.addMethod(
  22857. smalltalk.method({
  22858. selector: "size",
  22859. protocol: 'accessing',
  22860. fn: function (){
  22861. var self=this;
  22862. return smalltalk.withContext(function($ctx1) {
  22863. var $1;
  22864. $1=_st(self._source())._size();
  22865. return $1;
  22866. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)})},
  22867. args: [],
  22868. source: "size\x0a\x09^ self source size",
  22869. messageSends: ["size", "source"],
  22870. referencedClasses: []
  22871. }),
  22872. globals.Node);
  22873. smalltalk.addMethod(
  22874. smalltalk.method({
  22875. selector: "source",
  22876. protocol: 'accessing',
  22877. fn: function (){
  22878. var self=this;
  22879. return smalltalk.withContext(function($ctx1) {
  22880. var $2,$1,$receiver;
  22881. $2=self["@source"];
  22882. if(($receiver = $2) == null || $receiver.isNil){
  22883. $1="";
  22884. } else {
  22885. $1=$2;
  22886. };
  22887. return $1;
  22888. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)})},
  22889. args: [],
  22890. source: "source\x0a\x09^ source ifNil: [ '' ]",
  22891. messageSends: ["ifNil:"],
  22892. referencedClasses: []
  22893. }),
  22894. globals.Node);
  22895. smalltalk.addMethod(
  22896. smalltalk.method({
  22897. selector: "source:",
  22898. protocol: 'accessing',
  22899. fn: function (aString){
  22900. var self=this;
  22901. self["@source"]=aString;
  22902. return self},
  22903. args: ["aString"],
  22904. source: "source: aString\x0a\x09source := aString",
  22905. messageSends: [],
  22906. referencedClasses: []
  22907. }),
  22908. globals.Node);
  22909. smalltalk.addMethod(
  22910. smalltalk.method({
  22911. selector: "stopOnStepping",
  22912. protocol: 'testing',
  22913. fn: function (){
  22914. var self=this;
  22915. return false;
  22916. },
  22917. args: [],
  22918. source: "stopOnStepping\x0a\x09^ false",
  22919. messageSends: [],
  22920. referencedClasses: []
  22921. }),
  22922. globals.Node);
  22923. smalltalk.addMethod(
  22924. smalltalk.method({
  22925. selector: "subtreeNeedsAliasing",
  22926. protocol: 'testing',
  22927. fn: function (){
  22928. var self=this;
  22929. return smalltalk.withContext(function($ctx1) {
  22930. var $1;
  22931. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  22932. return smalltalk.withContext(function($ctx2) {
  22933. return self._shouldBeInlined();
  22934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._or_((function(){
  22935. return smalltalk.withContext(function($ctx2) {
  22936. return _st(self._nodes())._anySatisfy_((function(each){
  22937. return smalltalk.withContext(function($ctx3) {
  22938. return _st(each)._subtreeNeedsAliasing();
  22939. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  22940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  22941. $ctx1.sendIdx["or:"]=1;
  22942. return $1;
  22943. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)})},
  22944. args: [],
  22945. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  22946. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"],
  22947. referencedClasses: []
  22948. }),
  22949. globals.Node);
  22950. smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
  22951. globals.AssignmentNode.comment="I represent an assignment node.";
  22952. smalltalk.addMethod(
  22953. smalltalk.method({
  22954. selector: "accept:",
  22955. protocol: 'visiting',
  22956. fn: function (aVisitor){
  22957. var self=this;
  22958. return smalltalk.withContext(function($ctx1) {
  22959. var $1;
  22960. $1=_st(aVisitor)._visitAssignmentNode_(self);
  22961. return $1;
  22962. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)})},
  22963. args: ["aVisitor"],
  22964. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  22965. messageSends: ["visitAssignmentNode:"],
  22966. referencedClasses: []
  22967. }),
  22968. globals.AssignmentNode);
  22969. smalltalk.addMethod(
  22970. smalltalk.method({
  22971. selector: "isAssignmentNode",
  22972. protocol: 'testing',
  22973. fn: function (){
  22974. var self=this;
  22975. return true;
  22976. },
  22977. args: [],
  22978. source: "isAssignmentNode\x0a\x09^ true",
  22979. messageSends: [],
  22980. referencedClasses: []
  22981. }),
  22982. globals.AssignmentNode);
  22983. smalltalk.addMethod(
  22984. smalltalk.method({
  22985. selector: "left",
  22986. protocol: 'accessing',
  22987. fn: function (){
  22988. var self=this;
  22989. var $1;
  22990. $1=self["@left"];
  22991. return $1;
  22992. },
  22993. args: [],
  22994. source: "left\x0a\x09^ left",
  22995. messageSends: [],
  22996. referencedClasses: []
  22997. }),
  22998. globals.AssignmentNode);
  22999. smalltalk.addMethod(
  23000. smalltalk.method({
  23001. selector: "left:",
  23002. protocol: 'accessing',
  23003. fn: function (aNode){
  23004. var self=this;
  23005. return smalltalk.withContext(function($ctx1) {
  23006. self["@left"]=aNode;
  23007. _st(aNode)._parent_(self);
  23008. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)})},
  23009. args: ["aNode"],
  23010. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  23011. messageSends: ["parent:"],
  23012. referencedClasses: []
  23013. }),
  23014. globals.AssignmentNode);
  23015. smalltalk.addMethod(
  23016. smalltalk.method({
  23017. selector: "nodes",
  23018. protocol: 'accessing',
  23019. fn: function (){
  23020. var self=this;
  23021. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  23022. return smalltalk.withContext(function($ctx1) {
  23023. var $1;
  23024. $1=_st($Array())._with_with_(self._left(),self._right());
  23025. return $1;
  23026. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)})},
  23027. args: [],
  23028. source: "nodes\x0a\x09^ Array with: self left with: self right",
  23029. messageSends: ["with:with:", "left", "right"],
  23030. referencedClasses: ["Array"]
  23031. }),
  23032. globals.AssignmentNode);
  23033. smalltalk.addMethod(
  23034. smalltalk.method({
  23035. selector: "right",
  23036. protocol: 'accessing',
  23037. fn: function (){
  23038. var self=this;
  23039. var $1;
  23040. $1=self["@right"];
  23041. return $1;
  23042. },
  23043. args: [],
  23044. source: "right\x0a\x09^ right",
  23045. messageSends: [],
  23046. referencedClasses: []
  23047. }),
  23048. globals.AssignmentNode);
  23049. smalltalk.addMethod(
  23050. smalltalk.method({
  23051. selector: "right:",
  23052. protocol: 'accessing',
  23053. fn: function (aNode){
  23054. var self=this;
  23055. return smalltalk.withContext(function($ctx1) {
  23056. self["@right"]=aNode;
  23057. _st(aNode)._parent_(self);
  23058. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)})},
  23059. args: ["aNode"],
  23060. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  23061. messageSends: ["parent:"],
  23062. referencedClasses: []
  23063. }),
  23064. globals.AssignmentNode);
  23065. smalltalk.addMethod(
  23066. smalltalk.method({
  23067. selector: "shouldBeAliased",
  23068. protocol: 'testing',
  23069. fn: function (){
  23070. var self=this;
  23071. return smalltalk.withContext(function($ctx1) {
  23072. var $2,$1;
  23073. $2=($ctx1.supercall = true, globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  23074. $ctx1.supercall = false;
  23075. $1=_st($2)._or_((function(){
  23076. return smalltalk.withContext(function($ctx2) {
  23077. return self._isReferenced();
  23078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23079. return $1;
  23080. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)})},
  23081. args: [],
  23082. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  23083. messageSends: ["or:", "shouldBeAliased", "isReferenced"],
  23084. referencedClasses: []
  23085. }),
  23086. globals.AssignmentNode);
  23087. smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  23088. globals.BlockNode.comment="I represent an block closure node.";
  23089. smalltalk.addMethod(
  23090. smalltalk.method({
  23091. selector: "accept:",
  23092. protocol: 'visiting',
  23093. fn: function (aVisitor){
  23094. var self=this;
  23095. return smalltalk.withContext(function($ctx1) {
  23096. var $1;
  23097. $1=_st(aVisitor)._visitBlockNode_(self);
  23098. return $1;
  23099. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)})},
  23100. args: ["aVisitor"],
  23101. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  23102. messageSends: ["visitBlockNode:"],
  23103. referencedClasses: []
  23104. }),
  23105. globals.BlockNode);
  23106. smalltalk.addMethod(
  23107. smalltalk.method({
  23108. selector: "isBlockNode",
  23109. protocol: 'testing',
  23110. fn: function (){
  23111. var self=this;
  23112. return true;
  23113. },
  23114. args: [],
  23115. source: "isBlockNode\x0a\x09^ true",
  23116. messageSends: [],
  23117. referencedClasses: []
  23118. }),
  23119. globals.BlockNode);
  23120. smalltalk.addMethod(
  23121. smalltalk.method({
  23122. selector: "nextChild",
  23123. protocol: 'accessing',
  23124. fn: function (){
  23125. var self=this;
  23126. return self;
  23127. },
  23128. args: [],
  23129. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  23130. messageSends: [],
  23131. referencedClasses: []
  23132. }),
  23133. globals.BlockNode);
  23134. smalltalk.addMethod(
  23135. smalltalk.method({
  23136. selector: "nextNode:",
  23137. protocol: 'accessing',
  23138. fn: function (aNode){
  23139. var self=this;
  23140. return self;
  23141. },
  23142. args: ["aNode"],
  23143. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  23144. messageSends: [],
  23145. referencedClasses: []
  23146. }),
  23147. globals.BlockNode);
  23148. smalltalk.addMethod(
  23149. smalltalk.method({
  23150. selector: "parameters",
  23151. protocol: 'accessing',
  23152. fn: function (){
  23153. var self=this;
  23154. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  23155. return smalltalk.withContext(function($ctx1) {
  23156. var $2,$1,$receiver;
  23157. $2=self["@parameters"];
  23158. if(($receiver = $2) == null || $receiver.isNil){
  23159. self["@parameters"]=_st($Array())._new();
  23160. $1=self["@parameters"];
  23161. } else {
  23162. $1=$2;
  23163. };
  23164. return $1;
  23165. }, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)})},
  23166. args: [],
  23167. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  23168. messageSends: ["ifNil:", "new"],
  23169. referencedClasses: ["Array"]
  23170. }),
  23171. globals.BlockNode);
  23172. smalltalk.addMethod(
  23173. smalltalk.method({
  23174. selector: "parameters:",
  23175. protocol: 'accessing',
  23176. fn: function (aCollection){
  23177. var self=this;
  23178. self["@parameters"]=aCollection;
  23179. return self},
  23180. args: ["aCollection"],
  23181. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  23182. messageSends: [],
  23183. referencedClasses: []
  23184. }),
  23185. globals.BlockNode);
  23186. smalltalk.addMethod(
  23187. smalltalk.method({
  23188. selector: "scope",
  23189. protocol: 'accessing',
  23190. fn: function (){
  23191. var self=this;
  23192. var $1;
  23193. $1=self["@scope"];
  23194. return $1;
  23195. },
  23196. args: [],
  23197. source: "scope\x0a\x09^ scope",
  23198. messageSends: [],
  23199. referencedClasses: []
  23200. }),
  23201. globals.BlockNode);
  23202. smalltalk.addMethod(
  23203. smalltalk.method({
  23204. selector: "scope:",
  23205. protocol: 'accessing',
  23206. fn: function (aLexicalScope){
  23207. var self=this;
  23208. self["@scope"]=aLexicalScope;
  23209. return self},
  23210. args: ["aLexicalScope"],
  23211. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  23212. messageSends: [],
  23213. referencedClasses: []
  23214. }),
  23215. globals.BlockNode);
  23216. smalltalk.addMethod(
  23217. smalltalk.method({
  23218. selector: "subtreeNeedsAliasing",
  23219. protocol: 'testing',
  23220. fn: function (){
  23221. var self=this;
  23222. return smalltalk.withContext(function($ctx1) {
  23223. var $1;
  23224. $1=_st(self._shouldBeAliased())._or_((function(){
  23225. return smalltalk.withContext(function($ctx2) {
  23226. return self._shouldBeInlined();
  23227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  23228. return $1;
  23229. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)})},
  23230. args: [],
  23231. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  23232. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"],
  23233. referencedClasses: []
  23234. }),
  23235. globals.BlockNode);
  23236. smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
  23237. globals.CascadeNode.comment="I represent an cascade node.";
  23238. smalltalk.addMethod(
  23239. smalltalk.method({
  23240. selector: "accept:",
  23241. protocol: 'visiting',
  23242. fn: function (aVisitor){
  23243. var self=this;
  23244. return smalltalk.withContext(function($ctx1) {
  23245. var $1;
  23246. $1=_st(aVisitor)._visitCascadeNode_(self);
  23247. return $1;
  23248. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)})},
  23249. args: ["aVisitor"],
  23250. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  23251. messageSends: ["visitCascadeNode:"],
  23252. referencedClasses: []
  23253. }),
  23254. globals.CascadeNode);
  23255. smalltalk.addMethod(
  23256. smalltalk.method({
  23257. selector: "isCascadeNode",
  23258. protocol: 'testing',
  23259. fn: function (){
  23260. var self=this;
  23261. return true;
  23262. },
  23263. args: [],
  23264. source: "isCascadeNode\x0a\x09^ true",
  23265. messageSends: [],
  23266. referencedClasses: []
  23267. }),
  23268. globals.CascadeNode);
  23269. smalltalk.addMethod(
  23270. smalltalk.method({
  23271. selector: "receiver",
  23272. protocol: 'accessing',
  23273. fn: function (){
  23274. var self=this;
  23275. var $1;
  23276. $1=self["@receiver"];
  23277. return $1;
  23278. },
  23279. args: [],
  23280. source: "receiver\x0a\x09^ receiver",
  23281. messageSends: [],
  23282. referencedClasses: []
  23283. }),
  23284. globals.CascadeNode);
  23285. smalltalk.addMethod(
  23286. smalltalk.method({
  23287. selector: "receiver:",
  23288. protocol: 'accessing',
  23289. fn: function (aNode){
  23290. var self=this;
  23291. self["@receiver"]=aNode;
  23292. return self},
  23293. args: ["aNode"],
  23294. source: "receiver: aNode\x0a\x09receiver := aNode",
  23295. messageSends: [],
  23296. referencedClasses: []
  23297. }),
  23298. globals.CascadeNode);
  23299. smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
  23300. globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  23301. smalltalk.addMethod(
  23302. smalltalk.method({
  23303. selector: "accept:",
  23304. protocol: 'visiting',
  23305. fn: function (aVisitor){
  23306. var self=this;
  23307. return smalltalk.withContext(function($ctx1) {
  23308. var $1;
  23309. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  23310. return $1;
  23311. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)})},
  23312. args: ["aVisitor"],
  23313. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  23314. messageSends: ["visitDynamicArrayNode:"],
  23315. referencedClasses: []
  23316. }),
  23317. globals.DynamicArrayNode);
  23318. smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
  23319. globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  23320. smalltalk.addMethod(
  23321. smalltalk.method({
  23322. selector: "accept:",
  23323. protocol: 'visiting',
  23324. fn: function (aVisitor){
  23325. var self=this;
  23326. return smalltalk.withContext(function($ctx1) {
  23327. var $1;
  23328. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  23329. return $1;
  23330. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)})},
  23331. args: ["aVisitor"],
  23332. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  23333. messageSends: ["visitDynamicDictionaryNode:"],
  23334. referencedClasses: []
  23335. }),
  23336. globals.DynamicDictionaryNode);
  23337. smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
  23338. globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  23339. smalltalk.addMethod(
  23340. smalltalk.method({
  23341. selector: "accept:",
  23342. protocol: 'visiting',
  23343. fn: function (aVisitor){
  23344. var self=this;
  23345. return smalltalk.withContext(function($ctx1) {
  23346. var $1;
  23347. $1=_st(aVisitor)._visitJSStatementNode_(self);
  23348. return $1;
  23349. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)})},
  23350. args: ["aVisitor"],
  23351. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  23352. messageSends: ["visitJSStatementNode:"],
  23353. referencedClasses: []
  23354. }),
  23355. globals.JSStatementNode);
  23356. smalltalk.addMethod(
  23357. smalltalk.method({
  23358. selector: "isJSStatementNode",
  23359. protocol: 'testing',
  23360. fn: function (){
  23361. var self=this;
  23362. return true;
  23363. },
  23364. args: [],
  23365. source: "isJSStatementNode\x0a\x09^ true",
  23366. messageSends: [],
  23367. referencedClasses: []
  23368. }),
  23369. globals.JSStatementNode);
  23370. smalltalk.addMethod(
  23371. smalltalk.method({
  23372. selector: "requiresSmalltalkContext",
  23373. protocol: 'testing',
  23374. fn: function (){
  23375. var self=this;
  23376. return true;
  23377. },
  23378. args: [],
  23379. source: "requiresSmalltalkContext\x0a\x09^ true",
  23380. messageSends: [],
  23381. referencedClasses: []
  23382. }),
  23383. globals.JSStatementNode);
  23384. smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  23385. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  23386. smalltalk.addMethod(
  23387. smalltalk.method({
  23388. selector: "accept:",
  23389. protocol: 'visiting',
  23390. fn: function (aVisitor){
  23391. var self=this;
  23392. return smalltalk.withContext(function($ctx1) {
  23393. var $1;
  23394. $1=_st(aVisitor)._visitMethodNode_(self);
  23395. return $1;
  23396. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)})},
  23397. args: ["aVisitor"],
  23398. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  23399. messageSends: ["visitMethodNode:"],
  23400. referencedClasses: []
  23401. }),
  23402. globals.MethodNode);
  23403. smalltalk.addMethod(
  23404. smalltalk.method({
  23405. selector: "arguments",
  23406. protocol: 'accessing',
  23407. fn: function (){
  23408. var self=this;
  23409. return smalltalk.withContext(function($ctx1) {
  23410. var $2,$1,$receiver;
  23411. $2=self["@arguments"];
  23412. if(($receiver = $2) == null || $receiver.isNil){
  23413. $1=[];
  23414. } else {
  23415. $1=$2;
  23416. };
  23417. return $1;
  23418. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)})},
  23419. args: [],
  23420. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  23421. messageSends: ["ifNil:"],
  23422. referencedClasses: []
  23423. }),
  23424. globals.MethodNode);
  23425. smalltalk.addMethod(
  23426. smalltalk.method({
  23427. selector: "arguments:",
  23428. protocol: 'accessing',
  23429. fn: function (aCollection){
  23430. var self=this;
  23431. self["@arguments"]=aCollection;
  23432. return self},
  23433. args: ["aCollection"],
  23434. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  23435. messageSends: [],
  23436. referencedClasses: []
  23437. }),
  23438. globals.MethodNode);
  23439. smalltalk.addMethod(
  23440. smalltalk.method({
  23441. selector: "classReferences",
  23442. protocol: 'accessing',
  23443. fn: function (){
  23444. var self=this;
  23445. var $1;
  23446. $1=self["@classReferences"];
  23447. return $1;
  23448. },
  23449. args: [],
  23450. source: "classReferences\x0a\x09^ classReferences",
  23451. messageSends: [],
  23452. referencedClasses: []
  23453. }),
  23454. globals.MethodNode);
  23455. smalltalk.addMethod(
  23456. smalltalk.method({
  23457. selector: "classReferences:",
  23458. protocol: 'accessing',
  23459. fn: function (aCollection){
  23460. var self=this;
  23461. self["@classReferences"]=aCollection;
  23462. return self},
  23463. args: ["aCollection"],
  23464. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  23465. messageSends: [],
  23466. referencedClasses: []
  23467. }),
  23468. globals.MethodNode);
  23469. smalltalk.addMethod(
  23470. smalltalk.method({
  23471. selector: "messageSends",
  23472. protocol: 'accessing',
  23473. fn: function (){
  23474. var self=this;
  23475. return smalltalk.withContext(function($ctx1) {
  23476. var $1;
  23477. $1=_st(self._sendIndexes())._keys();
  23478. return $1;
  23479. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)})},
  23480. args: [],
  23481. source: "messageSends\x0a\x09^ self sendIndexes keys",
  23482. messageSends: ["keys", "sendIndexes"],
  23483. referencedClasses: []
  23484. }),
  23485. globals.MethodNode);
  23486. smalltalk.addMethod(
  23487. smalltalk.method({
  23488. selector: "method",
  23489. protocol: 'accessing',
  23490. fn: function (){
  23491. var self=this;
  23492. return self;
  23493. },
  23494. args: [],
  23495. source: "method\x0a\x09^ self",
  23496. messageSends: [],
  23497. referencedClasses: []
  23498. }),
  23499. globals.MethodNode);
  23500. smalltalk.addMethod(
  23501. smalltalk.method({
  23502. selector: "scope",
  23503. protocol: 'accessing',
  23504. fn: function (){
  23505. var self=this;
  23506. var $1;
  23507. $1=self["@scope"];
  23508. return $1;
  23509. },
  23510. args: [],
  23511. source: "scope\x0a\x09^ scope",
  23512. messageSends: [],
  23513. referencedClasses: []
  23514. }),
  23515. globals.MethodNode);
  23516. smalltalk.addMethod(
  23517. smalltalk.method({
  23518. selector: "scope:",
  23519. protocol: 'accessing',
  23520. fn: function (aMethodScope){
  23521. var self=this;
  23522. self["@scope"]=aMethodScope;
  23523. return self},
  23524. args: ["aMethodScope"],
  23525. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  23526. messageSends: [],
  23527. referencedClasses: []
  23528. }),
  23529. globals.MethodNode);
  23530. smalltalk.addMethod(
  23531. smalltalk.method({
  23532. selector: "selector",
  23533. protocol: 'accessing',
  23534. fn: function (){
  23535. var self=this;
  23536. var $1;
  23537. $1=self["@selector"];
  23538. return $1;
  23539. },
  23540. args: [],
  23541. source: "selector\x0a\x09^ selector",
  23542. messageSends: [],
  23543. referencedClasses: []
  23544. }),
  23545. globals.MethodNode);
  23546. smalltalk.addMethod(
  23547. smalltalk.method({
  23548. selector: "selector:",
  23549. protocol: 'accessing',
  23550. fn: function (aString){
  23551. var self=this;
  23552. self["@selector"]=aString;
  23553. return self},
  23554. args: ["aString"],
  23555. source: "selector: aString\x0a\x09selector := aString",
  23556. messageSends: [],
  23557. referencedClasses: []
  23558. }),
  23559. globals.MethodNode);
  23560. smalltalk.addMethod(
  23561. smalltalk.method({
  23562. selector: "sendIndexes",
  23563. protocol: 'accessing',
  23564. fn: function (){
  23565. var self=this;
  23566. var $1;
  23567. $1=self["@sendIndexes"];
  23568. return $1;
  23569. },
  23570. args: [],
  23571. source: "sendIndexes\x0a\x09^ sendIndexes",
  23572. messageSends: [],
  23573. referencedClasses: []
  23574. }),
  23575. globals.MethodNode);
  23576. smalltalk.addMethod(
  23577. smalltalk.method({
  23578. selector: "sendIndexes:",
  23579. protocol: 'accessing',
  23580. fn: function (aDictionary){
  23581. var self=this;
  23582. self["@sendIndexes"]=aDictionary;
  23583. return self},
  23584. args: ["aDictionary"],
  23585. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  23586. messageSends: [],
  23587. referencedClasses: []
  23588. }),
  23589. globals.MethodNode);
  23590. smalltalk.addMethod(
  23591. smalltalk.method({
  23592. selector: "sequenceNode",
  23593. protocol: 'accessing',
  23594. fn: function (){
  23595. var self=this;
  23596. return smalltalk.withContext(function($ctx1) {
  23597. var $1;
  23598. var $early={};
  23599. try {
  23600. _st(self._nodes())._do_((function(each){
  23601. return smalltalk.withContext(function($ctx2) {
  23602. $1=_st(each)._isSequenceNode();
  23603. if(smalltalk.assert($1)){
  23604. throw $early=[each];
  23605. };
  23606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23607. return nil;
  23608. }
  23609. catch(e) {if(e===$early)return e[0]; throw e}
  23610. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},globals.MethodNode)})},
  23611. args: [],
  23612. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  23613. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"],
  23614. referencedClasses: []
  23615. }),
  23616. globals.MethodNode);
  23617. smalltalk.addMethod(
  23618. smalltalk.method({
  23619. selector: "source",
  23620. protocol: 'accessing',
  23621. fn: function (){
  23622. var self=this;
  23623. var $1;
  23624. $1=self["@source"];
  23625. return $1;
  23626. },
  23627. args: [],
  23628. source: "source\x0a\x09^ source",
  23629. messageSends: [],
  23630. referencedClasses: []
  23631. }),
  23632. globals.MethodNode);
  23633. smalltalk.addMethod(
  23634. smalltalk.method({
  23635. selector: "source:",
  23636. protocol: 'accessing',
  23637. fn: function (aString){
  23638. var self=this;
  23639. self["@source"]=aString;
  23640. return self},
  23641. args: ["aString"],
  23642. source: "source: aString\x0a\x09source := aString",
  23643. messageSends: [],
  23644. referencedClasses: []
  23645. }),
  23646. globals.MethodNode);
  23647. smalltalk.addMethod(
  23648. smalltalk.method({
  23649. selector: "superSends",
  23650. protocol: 'accessing',
  23651. fn: function (){
  23652. var self=this;
  23653. var $1;
  23654. $1=self["@superSends"];
  23655. return $1;
  23656. },
  23657. args: [],
  23658. source: "superSends\x0a\x09^ superSends",
  23659. messageSends: [],
  23660. referencedClasses: []
  23661. }),
  23662. globals.MethodNode);
  23663. smalltalk.addMethod(
  23664. smalltalk.method({
  23665. selector: "superSends:",
  23666. protocol: 'accessing',
  23667. fn: function (aCollection){
  23668. var self=this;
  23669. self["@superSends"]=aCollection;
  23670. return self},
  23671. args: ["aCollection"],
  23672. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  23673. messageSends: [],
  23674. referencedClasses: []
  23675. }),
  23676. globals.MethodNode);
  23677. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  23678. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  23679. smalltalk.addMethod(
  23680. smalltalk.method({
  23681. selector: "accept:",
  23682. protocol: 'visiting',
  23683. fn: function (aVisitor){
  23684. var self=this;
  23685. return smalltalk.withContext(function($ctx1) {
  23686. var $1;
  23687. $1=_st(aVisitor)._visitReturnNode_(self);
  23688. return $1;
  23689. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)})},
  23690. args: ["aVisitor"],
  23691. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  23692. messageSends: ["visitReturnNode:"],
  23693. referencedClasses: []
  23694. }),
  23695. globals.ReturnNode);
  23696. smalltalk.addMethod(
  23697. smalltalk.method({
  23698. selector: "isReturnNode",
  23699. protocol: 'testing',
  23700. fn: function (){
  23701. var self=this;
  23702. return true;
  23703. },
  23704. args: [],
  23705. source: "isReturnNode\x0a\x09^ true",
  23706. messageSends: [],
  23707. referencedClasses: []
  23708. }),
  23709. globals.ReturnNode);
  23710. smalltalk.addMethod(
  23711. smalltalk.method({
  23712. selector: "nonLocalReturn",
  23713. protocol: 'testing',
  23714. fn: function (){
  23715. var self=this;
  23716. return smalltalk.withContext(function($ctx1) {
  23717. var $1;
  23718. $1=_st(_st(self._scope())._isMethodScope())._not();
  23719. return $1;
  23720. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)})},
  23721. args: [],
  23722. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  23723. messageSends: ["not", "isMethodScope", "scope"],
  23724. referencedClasses: []
  23725. }),
  23726. globals.ReturnNode);
  23727. smalltalk.addMethod(
  23728. smalltalk.method({
  23729. selector: "scope",
  23730. protocol: 'accessing',
  23731. fn: function (){
  23732. var self=this;
  23733. var $1;
  23734. $1=self["@scope"];
  23735. return $1;
  23736. },
  23737. args: [],
  23738. source: "scope\x0a\x09^ scope",
  23739. messageSends: [],
  23740. referencedClasses: []
  23741. }),
  23742. globals.ReturnNode);
  23743. smalltalk.addMethod(
  23744. smalltalk.method({
  23745. selector: "scope:",
  23746. protocol: 'accessing',
  23747. fn: function (aLexicalScope){
  23748. var self=this;
  23749. self["@scope"]=aLexicalScope;
  23750. return self},
  23751. args: ["aLexicalScope"],
  23752. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  23753. messageSends: [],
  23754. referencedClasses: []
  23755. }),
  23756. globals.ReturnNode);
  23757. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  23758. globals.SendNode.comment="I represent an message send node.";
  23759. smalltalk.addMethod(
  23760. smalltalk.method({
  23761. selector: "accept:",
  23762. protocol: 'visiting',
  23763. fn: function (aVisitor){
  23764. var self=this;
  23765. return smalltalk.withContext(function($ctx1) {
  23766. var $1;
  23767. $1=_st(aVisitor)._visitSendNode_(self);
  23768. return $1;
  23769. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)})},
  23770. args: ["aVisitor"],
  23771. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  23772. messageSends: ["visitSendNode:"],
  23773. referencedClasses: []
  23774. }),
  23775. globals.SendNode);
  23776. smalltalk.addMethod(
  23777. smalltalk.method({
  23778. selector: "arguments",
  23779. protocol: 'accessing',
  23780. fn: function (){
  23781. var self=this;
  23782. return smalltalk.withContext(function($ctx1) {
  23783. var $2,$1,$receiver;
  23784. $2=self["@arguments"];
  23785. if(($receiver = $2) == null || $receiver.isNil){
  23786. self["@arguments"]=[];
  23787. $1=self["@arguments"];
  23788. } else {
  23789. $1=$2;
  23790. };
  23791. return $1;
  23792. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)})},
  23793. args: [],
  23794. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  23795. messageSends: ["ifNil:"],
  23796. referencedClasses: []
  23797. }),
  23798. globals.SendNode);
  23799. smalltalk.addMethod(
  23800. smalltalk.method({
  23801. selector: "arguments:",
  23802. protocol: 'accessing',
  23803. fn: function (aCollection){
  23804. var self=this;
  23805. return smalltalk.withContext(function($ctx1) {
  23806. self["@arguments"]=aCollection;
  23807. _st(aCollection)._do_((function(each){
  23808. return smalltalk.withContext(function($ctx2) {
  23809. return _st(each)._parent_(self);
  23810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  23811. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)})},
  23812. args: ["aCollection"],
  23813. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  23814. messageSends: ["do:", "parent:"],
  23815. referencedClasses: []
  23816. }),
  23817. globals.SendNode);
  23818. smalltalk.addMethod(
  23819. smalltalk.method({
  23820. selector: "cascadeNodeWithMessages:",
  23821. protocol: 'accessing',
  23822. fn: function (aCollection){
  23823. var self=this;
  23824. var first;
  23825. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  23826. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  23827. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  23828. return smalltalk.withContext(function($ctx1) {
  23829. var $1,$2,$4,$5,$3;
  23830. $1=_st($SendNode())._new();
  23831. $ctx1.sendIdx["new"]=1;
  23832. _st($1)._selector_(self._selector());
  23833. _st($1)._arguments_(self._arguments());
  23834. $2=_st($1)._yourself();
  23835. $ctx1.sendIdx["yourself"]=1;
  23836. first=$2;
  23837. $4=_st($CascadeNode())._new();
  23838. _st($4)._receiver_(self._receiver());
  23839. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  23840. $5=_st($4)._yourself();
  23841. $3=$5;
  23842. return $3;
  23843. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)})},
  23844. args: ["aCollection"],
  23845. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  23846. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"],
  23847. referencedClasses: ["SendNode", "CascadeNode", "Array"]
  23848. }),
  23849. globals.SendNode);
  23850. smalltalk.addMethod(
  23851. smalltalk.method({
  23852. selector: "index",
  23853. protocol: 'accessing',
  23854. fn: function (){
  23855. var self=this;
  23856. var $1;
  23857. $1=self["@index"];
  23858. return $1;
  23859. },
  23860. args: [],
  23861. source: "index\x0a\x09^ index",
  23862. messageSends: [],
  23863. referencedClasses: []
  23864. }),
  23865. globals.SendNode);
  23866. smalltalk.addMethod(
  23867. smalltalk.method({
  23868. selector: "index:",
  23869. protocol: 'accessing',
  23870. fn: function (anInteger){
  23871. var self=this;
  23872. self["@index"]=anInteger;
  23873. return self},
  23874. args: ["anInteger"],
  23875. source: "index: anInteger\x0a\x09index := anInteger",
  23876. messageSends: [],
  23877. referencedClasses: []
  23878. }),
  23879. globals.SendNode);
  23880. smalltalk.addMethod(
  23881. smalltalk.method({
  23882. selector: "isCascadeSendNode",
  23883. protocol: 'testing',
  23884. fn: function (){
  23885. var self=this;
  23886. return smalltalk.withContext(function($ctx1) {
  23887. var $1;
  23888. $1=_st(self._parent())._isCascadeNode();
  23889. return $1;
  23890. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)})},
  23891. args: [],
  23892. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  23893. messageSends: ["isCascadeNode", "parent"],
  23894. referencedClasses: []
  23895. }),
  23896. globals.SendNode);
  23897. smalltalk.addMethod(
  23898. smalltalk.method({
  23899. selector: "isNavigationNode",
  23900. protocol: 'testing',
  23901. fn: function (){
  23902. var self=this;
  23903. return true;
  23904. },
  23905. args: [],
  23906. source: "isNavigationNode\x0a\x09^ true",
  23907. messageSends: [],
  23908. referencedClasses: []
  23909. }),
  23910. globals.SendNode);
  23911. smalltalk.addMethod(
  23912. smalltalk.method({
  23913. selector: "isSendNode",
  23914. protocol: 'testing',
  23915. fn: function (){
  23916. var self=this;
  23917. return true;
  23918. },
  23919. args: [],
  23920. source: "isSendNode\x0a\x09^ true",
  23921. messageSends: [],
  23922. referencedClasses: []
  23923. }),
  23924. globals.SendNode);
  23925. smalltalk.addMethod(
  23926. smalltalk.method({
  23927. selector: "navigationLink",
  23928. protocol: 'accessing',
  23929. fn: function (){
  23930. var self=this;
  23931. return smalltalk.withContext(function($ctx1) {
  23932. var $1;
  23933. $1=self._selector();
  23934. return $1;
  23935. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)})},
  23936. args: [],
  23937. source: "navigationLink\x0a\x09^ self selector",
  23938. messageSends: ["selector"],
  23939. referencedClasses: []
  23940. }),
  23941. globals.SendNode);
  23942. smalltalk.addMethod(
  23943. smalltalk.method({
  23944. selector: "nodes",
  23945. protocol: 'accessing',
  23946. fn: function (){
  23947. var self=this;
  23948. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  23949. return smalltalk.withContext(function($ctx1) {
  23950. var $1,$3,$2,$5,$6,$4,$receiver;
  23951. $1=self._receiver();
  23952. $ctx1.sendIdx["receiver"]=1;
  23953. if(($receiver = $1) == null || $receiver.isNil){
  23954. $3=self._arguments();
  23955. $ctx1.sendIdx["arguments"]=1;
  23956. $2=_st($3)._copy();
  23957. return $2;
  23958. } else {
  23959. $1;
  23960. };
  23961. $5=_st($Array())._with_(self._receiver());
  23962. _st($5)._addAll_(self._arguments());
  23963. $6=_st($5)._yourself();
  23964. $4=$6;
  23965. return $4;
  23966. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)})},
  23967. args: [],
  23968. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  23969. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"],
  23970. referencedClasses: ["Array"]
  23971. }),
  23972. globals.SendNode);
  23973. smalltalk.addMethod(
  23974. smalltalk.method({
  23975. selector: "receiver",
  23976. protocol: 'accessing',
  23977. fn: function (){
  23978. var self=this;
  23979. var $1;
  23980. $1=self["@receiver"];
  23981. return $1;
  23982. },
  23983. args: [],
  23984. source: "receiver\x0a\x09^ receiver",
  23985. messageSends: [],
  23986. referencedClasses: []
  23987. }),
  23988. globals.SendNode);
  23989. smalltalk.addMethod(
  23990. smalltalk.method({
  23991. selector: "receiver:",
  23992. protocol: 'accessing',
  23993. fn: function (aNode){
  23994. var self=this;
  23995. return smalltalk.withContext(function($ctx1) {
  23996. var $1;
  23997. self["@receiver"]=aNode;
  23998. $1=_st(aNode)._isNode();
  23999. if(smalltalk.assert($1)){
  24000. _st(aNode)._parent_(self);
  24001. };
  24002. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)})},
  24003. args: ["aNode"],
  24004. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  24005. messageSends: ["ifTrue:", "isNode", "parent:"],
  24006. referencedClasses: []
  24007. }),
  24008. globals.SendNode);
  24009. smalltalk.addMethod(
  24010. smalltalk.method({
  24011. selector: "requiresSmalltalkContext",
  24012. protocol: 'testing',
  24013. fn: function (){
  24014. var self=this;
  24015. return true;
  24016. },
  24017. args: [],
  24018. source: "requiresSmalltalkContext\x0a\x09^ true",
  24019. messageSends: [],
  24020. referencedClasses: []
  24021. }),
  24022. globals.SendNode);
  24023. smalltalk.addMethod(
  24024. smalltalk.method({
  24025. selector: "selector",
  24026. protocol: 'accessing',
  24027. fn: function (){
  24028. var self=this;
  24029. var $1;
  24030. $1=self["@selector"];
  24031. return $1;
  24032. },
  24033. args: [],
  24034. source: "selector\x0a\x09^ selector",
  24035. messageSends: [],
  24036. referencedClasses: []
  24037. }),
  24038. globals.SendNode);
  24039. smalltalk.addMethod(
  24040. smalltalk.method({
  24041. selector: "selector:",
  24042. protocol: 'accessing',
  24043. fn: function (aString){
  24044. var self=this;
  24045. self["@selector"]=aString;
  24046. return self},
  24047. args: ["aString"],
  24048. source: "selector: aString\x0a\x09selector := aString",
  24049. messageSends: [],
  24050. referencedClasses: []
  24051. }),
  24052. globals.SendNode);
  24053. smalltalk.addMethod(
  24054. smalltalk.method({
  24055. selector: "shouldBeAliased",
  24056. protocol: 'testing',
  24057. fn: function (){
  24058. var self=this;
  24059. var sends;
  24060. return smalltalk.withContext(function($ctx1) {
  24061. var $2,$1;
  24062. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  24063. $2=($ctx1.supercall = true, globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  24064. $ctx1.supercall = false;
  24065. $1=_st($2)._or_((function(){
  24066. return smalltalk.withContext(function($ctx2) {
  24067. return _st(self._isReferenced())._and_((function(){
  24068. return smalltalk.withContext(function($ctx3) {
  24069. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  24070. return smalltalk.withContext(function($ctx4) {
  24071. return _st(self._index()).__lt(sends);
  24072. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)})})))._or_((function(){
  24073. return smalltalk.withContext(function($ctx4) {
  24074. return self._superSend();
  24075. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)})}));
  24076. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  24077. $ctx2.sendIdx["and:"]=1;
  24078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24079. $ctx1.sendIdx["or:"]=1;
  24080. return $1;
  24081. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)})},
  24082. args: [],
  24083. source: "shouldBeAliased\x0a\x09\x22Because we keep track of send indexes, some send nodes need additional care for aliasing. \x0a\x09See IRJSVisitor >> visitIRSend:\x22\x0a\x09\x0a\x09| sends |\x0a\x09\x0a\x09sends := (self method sendIndexes at: self selector) size.\x0a\x09\x0a\x09^ (super shouldBeAliased or: [\x0a\x09\x09self isReferenced and: [\x0a\x09\x09\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  24084. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"],
  24085. referencedClasses: []
  24086. }),
  24087. globals.SendNode);
  24088. smalltalk.addMethod(
  24089. smalltalk.method({
  24090. selector: "stopOnStepping",
  24091. protocol: 'testing',
  24092. fn: function (){
  24093. var self=this;
  24094. return true;
  24095. },
  24096. args: [],
  24097. source: "stopOnStepping\x0a\x09^ true",
  24098. messageSends: [],
  24099. referencedClasses: []
  24100. }),
  24101. globals.SendNode);
  24102. smalltalk.addMethod(
  24103. smalltalk.method({
  24104. selector: "superSend",
  24105. protocol: 'accessing',
  24106. fn: function (){
  24107. var self=this;
  24108. return smalltalk.withContext(function($ctx1) {
  24109. var $2,$1,$receiver;
  24110. $2=self["@superSend"];
  24111. if(($receiver = $2) == null || $receiver.isNil){
  24112. $1=false;
  24113. } else {
  24114. $1=$2;
  24115. };
  24116. return $1;
  24117. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)})},
  24118. args: [],
  24119. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  24120. messageSends: ["ifNil:"],
  24121. referencedClasses: []
  24122. }),
  24123. globals.SendNode);
  24124. smalltalk.addMethod(
  24125. smalltalk.method({
  24126. selector: "superSend:",
  24127. protocol: 'accessing',
  24128. fn: function (aBoolean){
  24129. var self=this;
  24130. self["@superSend"]=aBoolean;
  24131. return self},
  24132. args: ["aBoolean"],
  24133. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  24134. messageSends: [],
  24135. referencedClasses: []
  24136. }),
  24137. globals.SendNode);
  24138. smalltalk.addMethod(
  24139. smalltalk.method({
  24140. selector: "valueForReceiver:",
  24141. protocol: 'accessing',
  24142. fn: function (anObject){
  24143. var self=this;
  24144. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  24145. return smalltalk.withContext(function($ctx1) {
  24146. var $2,$3,$5,$4,$6,$1,$receiver;
  24147. $2=_st($SendNode())._new();
  24148. _st($2)._position_(self._position());
  24149. _st($2)._source_(self._source());
  24150. $3=$2;
  24151. $5=self._receiver();
  24152. $ctx1.sendIdx["receiver"]=1;
  24153. if(($receiver = $5) == null || $receiver.isNil){
  24154. $4=anObject;
  24155. } else {
  24156. $4=_st(self._receiver())._valueForReceiver_(anObject);
  24157. };
  24158. _st($3)._receiver_($4);
  24159. _st($2)._selector_(self._selector());
  24160. _st($2)._arguments_(self._arguments());
  24161. $6=_st($2)._yourself();
  24162. $1=$6;
  24163. return $1;
  24164. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)})},
  24165. args: ["anObject"],
  24166. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  24167. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"],
  24168. referencedClasses: ["SendNode"]
  24169. }),
  24170. globals.SendNode);
  24171. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  24172. globals.SequenceNode.comment="I represent an sequence node. A sequence represent a set of instructions inside the same scope (the method scope or a block scope).";
  24173. smalltalk.addMethod(
  24174. smalltalk.method({
  24175. selector: "accept:",
  24176. protocol: 'visiting',
  24177. fn: function (aVisitor){
  24178. var self=this;
  24179. return smalltalk.withContext(function($ctx1) {
  24180. var $1;
  24181. $1=_st(aVisitor)._visitSequenceNode_(self);
  24182. return $1;
  24183. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)})},
  24184. args: ["aVisitor"],
  24185. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  24186. messageSends: ["visitSequenceNode:"],
  24187. referencedClasses: []
  24188. }),
  24189. globals.SequenceNode);
  24190. smalltalk.addMethod(
  24191. smalltalk.method({
  24192. selector: "asBlockSequenceNode",
  24193. protocol: 'converting',
  24194. fn: function (){
  24195. var self=this;
  24196. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  24197. return smalltalk.withContext(function($ctx1) {
  24198. var $2,$3,$1;
  24199. $2=_st($BlockSequenceNode())._new();
  24200. _st($2)._position_(self._position());
  24201. _st($2)._source_(self._source());
  24202. _st($2)._nodes_(self._nodes());
  24203. _st($2)._temps_(self._temps());
  24204. $3=_st($2)._yourself();
  24205. $1=$3;
  24206. return $1;
  24207. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)})},
  24208. args: [],
  24209. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  24210. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"],
  24211. referencedClasses: ["BlockSequenceNode"]
  24212. }),
  24213. globals.SequenceNode);
  24214. smalltalk.addMethod(
  24215. smalltalk.method({
  24216. selector: "isSequenceNode",
  24217. protocol: 'testing',
  24218. fn: function (){
  24219. var self=this;
  24220. return true;
  24221. },
  24222. args: [],
  24223. source: "isSequenceNode\x0a\x09^ true",
  24224. messageSends: [],
  24225. referencedClasses: []
  24226. }),
  24227. globals.SequenceNode);
  24228. smalltalk.addMethod(
  24229. smalltalk.method({
  24230. selector: "scope",
  24231. protocol: 'accessing',
  24232. fn: function (){
  24233. var self=this;
  24234. var $1;
  24235. $1=self["@scope"];
  24236. return $1;
  24237. },
  24238. args: [],
  24239. source: "scope\x0a\x09^ scope",
  24240. messageSends: [],
  24241. referencedClasses: []
  24242. }),
  24243. globals.SequenceNode);
  24244. smalltalk.addMethod(
  24245. smalltalk.method({
  24246. selector: "scope:",
  24247. protocol: 'accessing',
  24248. fn: function (aLexicalScope){
  24249. var self=this;
  24250. self["@scope"]=aLexicalScope;
  24251. return self},
  24252. args: ["aLexicalScope"],
  24253. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  24254. messageSends: [],
  24255. referencedClasses: []
  24256. }),
  24257. globals.SequenceNode);
  24258. smalltalk.addMethod(
  24259. smalltalk.method({
  24260. selector: "temps",
  24261. protocol: 'accessing',
  24262. fn: function (){
  24263. var self=this;
  24264. return smalltalk.withContext(function($ctx1) {
  24265. var $2,$1,$receiver;
  24266. $2=self["@temps"];
  24267. if(($receiver = $2) == null || $receiver.isNil){
  24268. $1=[];
  24269. } else {
  24270. $1=$2;
  24271. };
  24272. return $1;
  24273. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)})},
  24274. args: [],
  24275. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  24276. messageSends: ["ifNil:"],
  24277. referencedClasses: []
  24278. }),
  24279. globals.SequenceNode);
  24280. smalltalk.addMethod(
  24281. smalltalk.method({
  24282. selector: "temps:",
  24283. protocol: 'accessing',
  24284. fn: function (aCollection){
  24285. var self=this;
  24286. self["@temps"]=aCollection;
  24287. return self},
  24288. args: ["aCollection"],
  24289. source: "temps: aCollection\x0a\x09temps := aCollection",
  24290. messageSends: [],
  24291. referencedClasses: []
  24292. }),
  24293. globals.SequenceNode);
  24294. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  24295. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  24296. smalltalk.addMethod(
  24297. smalltalk.method({
  24298. selector: "accept:",
  24299. protocol: 'visiting',
  24300. fn: function (aVisitor){
  24301. var self=this;
  24302. return smalltalk.withContext(function($ctx1) {
  24303. var $1;
  24304. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  24305. return $1;
  24306. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)})},
  24307. args: ["aVisitor"],
  24308. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  24309. messageSends: ["visitBlockSequenceNode:"],
  24310. referencedClasses: []
  24311. }),
  24312. globals.BlockSequenceNode);
  24313. smalltalk.addMethod(
  24314. smalltalk.method({
  24315. selector: "isBlockSequenceNode",
  24316. protocol: 'testing',
  24317. fn: function (){
  24318. var self=this;
  24319. return true;
  24320. },
  24321. args: [],
  24322. source: "isBlockSequenceNode\x0a\x09^ true",
  24323. messageSends: [],
  24324. referencedClasses: []
  24325. }),
  24326. globals.BlockSequenceNode);
  24327. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  24328. globals.ValueNode.comment="I represent a value node.";
  24329. smalltalk.addMethod(
  24330. smalltalk.method({
  24331. selector: "accept:",
  24332. protocol: 'visiting',
  24333. fn: function (aVisitor){
  24334. var self=this;
  24335. return smalltalk.withContext(function($ctx1) {
  24336. var $1;
  24337. $1=_st(aVisitor)._visitValueNode_(self);
  24338. return $1;
  24339. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)})},
  24340. args: ["aVisitor"],
  24341. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  24342. messageSends: ["visitValueNode:"],
  24343. referencedClasses: []
  24344. }),
  24345. globals.ValueNode);
  24346. smalltalk.addMethod(
  24347. smalltalk.method({
  24348. selector: "isImmutable",
  24349. protocol: 'testing',
  24350. fn: function (){
  24351. var self=this;
  24352. return smalltalk.withContext(function($ctx1) {
  24353. var $1;
  24354. $1=_st(self._value())._isImmutable();
  24355. return $1;
  24356. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)})},
  24357. args: [],
  24358. source: "isImmutable\x0a\x09^ self value isImmutable",
  24359. messageSends: ["isImmutable", "value"],
  24360. referencedClasses: []
  24361. }),
  24362. globals.ValueNode);
  24363. smalltalk.addMethod(
  24364. smalltalk.method({
  24365. selector: "isValueNode",
  24366. protocol: 'testing',
  24367. fn: function (){
  24368. var self=this;
  24369. return true;
  24370. },
  24371. args: [],
  24372. source: "isValueNode\x0a\x09^ true",
  24373. messageSends: [],
  24374. referencedClasses: []
  24375. }),
  24376. globals.ValueNode);
  24377. smalltalk.addMethod(
  24378. smalltalk.method({
  24379. selector: "value",
  24380. protocol: 'accessing',
  24381. fn: function (){
  24382. var self=this;
  24383. var $1;
  24384. $1=self["@value"];
  24385. return $1;
  24386. },
  24387. args: [],
  24388. source: "value\x0a\x09^ value",
  24389. messageSends: [],
  24390. referencedClasses: []
  24391. }),
  24392. globals.ValueNode);
  24393. smalltalk.addMethod(
  24394. smalltalk.method({
  24395. selector: "value:",
  24396. protocol: 'accessing',
  24397. fn: function (anObject){
  24398. var self=this;
  24399. self["@value"]=anObject;
  24400. return self},
  24401. args: ["anObject"],
  24402. source: "value: anObject\x0a\x09value := anObject",
  24403. messageSends: [],
  24404. referencedClasses: []
  24405. }),
  24406. globals.ValueNode);
  24407. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  24408. globals.VariableNode.comment="I represent an variable node.";
  24409. smalltalk.addMethod(
  24410. smalltalk.method({
  24411. selector: "accept:",
  24412. protocol: 'visiting',
  24413. fn: function (aVisitor){
  24414. var self=this;
  24415. return smalltalk.withContext(function($ctx1) {
  24416. var $1;
  24417. $1=_st(aVisitor)._visitVariableNode_(self);
  24418. return $1;
  24419. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)})},
  24420. args: ["aVisitor"],
  24421. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  24422. messageSends: ["visitVariableNode:"],
  24423. referencedClasses: []
  24424. }),
  24425. globals.VariableNode);
  24426. smalltalk.addMethod(
  24427. smalltalk.method({
  24428. selector: "alias",
  24429. protocol: 'accessing',
  24430. fn: function (){
  24431. var self=this;
  24432. return smalltalk.withContext(function($ctx1) {
  24433. var $1;
  24434. $1=_st(self._binding())._alias();
  24435. return $1;
  24436. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)})},
  24437. args: [],
  24438. source: "alias\x0a\x09^ self binding alias",
  24439. messageSends: ["alias", "binding"],
  24440. referencedClasses: []
  24441. }),
  24442. globals.VariableNode);
  24443. smalltalk.addMethod(
  24444. smalltalk.method({
  24445. selector: "assigned",
  24446. protocol: 'accessing',
  24447. fn: function (){
  24448. var self=this;
  24449. return smalltalk.withContext(function($ctx1) {
  24450. var $2,$1,$receiver;
  24451. $2=self["@assigned"];
  24452. if(($receiver = $2) == null || $receiver.isNil){
  24453. $1=false;
  24454. } else {
  24455. $1=$2;
  24456. };
  24457. return $1;
  24458. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)})},
  24459. args: [],
  24460. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  24461. messageSends: ["ifNil:"],
  24462. referencedClasses: []
  24463. }),
  24464. globals.VariableNode);
  24465. smalltalk.addMethod(
  24466. smalltalk.method({
  24467. selector: "assigned:",
  24468. protocol: 'accessing',
  24469. fn: function (aBoolean){
  24470. var self=this;
  24471. self["@assigned"]=aBoolean;
  24472. return self},
  24473. args: ["aBoolean"],
  24474. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  24475. messageSends: [],
  24476. referencedClasses: []
  24477. }),
  24478. globals.VariableNode);
  24479. smalltalk.addMethod(
  24480. smalltalk.method({
  24481. selector: "beAssigned",
  24482. protocol: 'accessing',
  24483. fn: function (){
  24484. var self=this;
  24485. return smalltalk.withContext(function($ctx1) {
  24486. _st(self._binding())._validateAssignment();
  24487. self["@assigned"]=true;
  24488. return self}, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)})},
  24489. args: [],
  24490. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  24491. messageSends: ["validateAssignment", "binding"],
  24492. referencedClasses: []
  24493. }),
  24494. globals.VariableNode);
  24495. smalltalk.addMethod(
  24496. smalltalk.method({
  24497. selector: "binding",
  24498. protocol: 'accessing',
  24499. fn: function (){
  24500. var self=this;
  24501. var $1;
  24502. $1=self["@binding"];
  24503. return $1;
  24504. },
  24505. args: [],
  24506. source: "binding\x0a\x09^ binding",
  24507. messageSends: [],
  24508. referencedClasses: []
  24509. }),
  24510. globals.VariableNode);
  24511. smalltalk.addMethod(
  24512. smalltalk.method({
  24513. selector: "binding:",
  24514. protocol: 'accessing',
  24515. fn: function (aScopeVar){
  24516. var self=this;
  24517. self["@binding"]=aScopeVar;
  24518. return self},
  24519. args: ["aScopeVar"],
  24520. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  24521. messageSends: [],
  24522. referencedClasses: []
  24523. }),
  24524. globals.VariableNode);
  24525. smalltalk.addMethod(
  24526. smalltalk.method({
  24527. selector: "isArgument",
  24528. protocol: 'testing',
  24529. fn: function (){
  24530. var self=this;
  24531. return smalltalk.withContext(function($ctx1) {
  24532. var $1;
  24533. $1=_st(self._binding())._isArgVar();
  24534. return $1;
  24535. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)})},
  24536. args: [],
  24537. source: "isArgument\x0a\x09^ self binding isArgVar",
  24538. messageSends: ["isArgVar", "binding"],
  24539. referencedClasses: []
  24540. }),
  24541. globals.VariableNode);
  24542. smalltalk.addMethod(
  24543. smalltalk.method({
  24544. selector: "isImmutable",
  24545. protocol: 'testing',
  24546. fn: function (){
  24547. var self=this;
  24548. return smalltalk.withContext(function($ctx1) {
  24549. var $1;
  24550. $1=_st(self._binding())._isImmutable();
  24551. return $1;
  24552. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)})},
  24553. args: [],
  24554. source: "isImmutable\x0a\x09^ self binding isImmutable",
  24555. messageSends: ["isImmutable", "binding"],
  24556. referencedClasses: []
  24557. }),
  24558. globals.VariableNode);
  24559. smalltalk.addMethod(
  24560. smalltalk.method({
  24561. selector: "isNavigationNode",
  24562. protocol: 'testing',
  24563. fn: function (){
  24564. var self=this;
  24565. return true;
  24566. },
  24567. args: [],
  24568. source: "isNavigationNode\x0a\x09^ true",
  24569. messageSends: [],
  24570. referencedClasses: []
  24571. }),
  24572. globals.VariableNode);
  24573. smalltalk.addMethod(
  24574. smalltalk.method({
  24575. selector: "isVariableNode",
  24576. protocol: 'testing',
  24577. fn: function (){
  24578. var self=this;
  24579. return true;
  24580. },
  24581. args: [],
  24582. source: "isVariableNode\x0a\x09^ true",
  24583. messageSends: [],
  24584. referencedClasses: []
  24585. }),
  24586. globals.VariableNode);
  24587. smalltalk.addMethod(
  24588. smalltalk.method({
  24589. selector: "navigationLink",
  24590. protocol: 'accessing',
  24591. fn: function (){
  24592. var self=this;
  24593. return smalltalk.withContext(function($ctx1) {
  24594. var $1;
  24595. $1=self._value();
  24596. return $1;
  24597. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)})},
  24598. args: [],
  24599. source: "navigationLink\x0a\x09^ self value",
  24600. messageSends: ["value"],
  24601. referencedClasses: []
  24602. }),
  24603. globals.VariableNode);
  24604. smalltalk.addMethod(
  24605. smalltalk.method({
  24606. selector: "ast",
  24607. protocol: '*Compiler-AST',
  24608. fn: function (){
  24609. var self=this;
  24610. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  24611. return smalltalk.withContext(function($ctx1) {
  24612. var $1,$2;
  24613. $1=self._source();
  24614. $ctx1.sendIdx["source"]=1;
  24615. _st($1)._ifEmpty_((function(){
  24616. return smalltalk.withContext(function($ctx2) {
  24617. return self._error_("Method source is empty");
  24618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  24619. $2=_st($Smalltalk())._parse_(self._source());
  24620. return $2;
  24621. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)})},
  24622. args: [],
  24623. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  24624. messageSends: ["ifEmpty:", "source", "error:", "parse:"],
  24625. referencedClasses: ["Smalltalk"]
  24626. }),
  24627. globals.CompiledMethod);
  24628. smalltalk.addMethod(
  24629. smalltalk.method({
  24630. selector: "isNode",
  24631. protocol: '*Compiler-AST',
  24632. fn: function (){
  24633. var self=this;
  24634. return false;
  24635. },
  24636. args: [],
  24637. source: "isNode\x0a\x09^ false",
  24638. messageSends: [],
  24639. referencedClasses: []
  24640. }),
  24641. globals.Object);
  24642. });
  24643. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  24644. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  24645. smalltalk.addPackage('Compiler-IR');
  24646. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24647. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  24648. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  24649. smalltalk.addMethod(
  24650. smalltalk.method({
  24651. selector: "alias:",
  24652. protocol: 'visiting',
  24653. fn: function (aNode){
  24654. var self=this;
  24655. var variable;
  24656. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  24657. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  24658. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24659. return smalltalk.withContext(function($ctx1) {
  24660. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  24661. $1=_st(aNode)._isImmutable();
  24662. if(smalltalk.assert($1)){
  24663. $2=self._visit_(aNode);
  24664. $ctx1.sendIdx["visit:"]=1;
  24665. return $2;
  24666. };
  24667. $3=_st($IRVariable())._new();
  24668. $ctx1.sendIdx["new"]=1;
  24669. $4=$3;
  24670. $6=_st($AliasVar())._new();
  24671. $ctx1.sendIdx["new"]=2;
  24672. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  24673. _st($4)._variable_($5);
  24674. $7=_st($3)._yourself();
  24675. $ctx1.sendIdx["yourself"]=1;
  24676. variable=$7;
  24677. $8=self._sequence();
  24678. $10=_st($IRAssignment())._new();
  24679. _st($10)._add_(variable);
  24680. $ctx1.sendIdx["add:"]=2;
  24681. _st($10)._add_(self._visit_(aNode));
  24682. $ctx1.sendIdx["add:"]=3;
  24683. $11=_st($10)._yourself();
  24684. $9=$11;
  24685. _st($8)._add_($9);
  24686. $ctx1.sendIdx["add:"]=1;
  24687. _st(_st(self._method())._internalVariables())._add_(variable);
  24688. $12=variable;
  24689. return $12;
  24690. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)})},
  24691. args: ["aNode"],
  24692. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new\x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias);\x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  24693. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"],
  24694. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"]
  24695. }),
  24696. globals.IRASTTranslator);
  24697. smalltalk.addMethod(
  24698. smalltalk.method({
  24699. selector: "aliasTemporally:",
  24700. protocol: 'visiting',
  24701. fn: function (aCollection){
  24702. var self=this;
  24703. var threshold,result;
  24704. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  24705. return smalltalk.withContext(function($ctx1) {
  24706. var $1,$2,$4,$3,$5;
  24707. threshold=(0);
  24708. _st(aCollection)._withIndexDo_((function(each,i){
  24709. return smalltalk.withContext(function($ctx2) {
  24710. $1=_st(each)._subtreeNeedsAliasing();
  24711. if(smalltalk.assert($1)){
  24712. threshold=i;
  24713. return threshold;
  24714. };
  24715. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  24716. $ctx1.sendIdx["withIndexDo:"]=1;
  24717. result=_st($OrderedCollection())._new();
  24718. _st(aCollection)._withIndexDo_((function(each,i){
  24719. return smalltalk.withContext(function($ctx2) {
  24720. $2=result;
  24721. $4=_st(i).__lt_eq(threshold);
  24722. if(smalltalk.assert($4)){
  24723. $3=self._alias_(each);
  24724. } else {
  24725. $3=self._visit_(each);
  24726. };
  24727. return _st($2)._add_($3);
  24728. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  24729. $5=result;
  24730. return $5;
  24731. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)})},
  24732. args: ["aCollection"],
  24733. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/amber/issues/296\x0a\x09\x0a\x09If a node is aliased, all preceding ones are aliased as well.\x0a\x09The tree is iterated twice. First we get the aliasing dependency,\x0a\x09then the aliasing itself is done\x22\x0a\x0a\x09| threshold result |\x0a\x09threshold := 0.\x0a\x09\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09each subtreeNeedsAliasing\x0a\x09\x09\x09ifTrue: [ threshold := i ] ].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09aCollection withIndexDo: [ :each :i |\x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ]) ].\x0a\x0a\x09^ result",
  24734. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"],
  24735. referencedClasses: ["OrderedCollection"]
  24736. }),
  24737. globals.IRASTTranslator);
  24738. smalltalk.addMethod(
  24739. smalltalk.method({
  24740. selector: "method",
  24741. protocol: 'accessing',
  24742. fn: function (){
  24743. var self=this;
  24744. var $1;
  24745. $1=self["@method"];
  24746. return $1;
  24747. },
  24748. args: [],
  24749. source: "method\x0a\x09^ method",
  24750. messageSends: [],
  24751. referencedClasses: []
  24752. }),
  24753. globals.IRASTTranslator);
  24754. smalltalk.addMethod(
  24755. smalltalk.method({
  24756. selector: "method:",
  24757. protocol: 'accessing',
  24758. fn: function (anIRMethod){
  24759. var self=this;
  24760. self["@method"]=anIRMethod;
  24761. return self},
  24762. args: ["anIRMethod"],
  24763. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  24764. messageSends: [],
  24765. referencedClasses: []
  24766. }),
  24767. globals.IRASTTranslator);
  24768. smalltalk.addMethod(
  24769. smalltalk.method({
  24770. selector: "nextAlias",
  24771. protocol: 'accessing',
  24772. fn: function (){
  24773. var self=this;
  24774. return smalltalk.withContext(function($ctx1) {
  24775. var $1,$2,$receiver;
  24776. $1=self["@nextAlias"];
  24777. if(($receiver = $1) == null || $receiver.isNil){
  24778. self["@nextAlias"]=(0);
  24779. self["@nextAlias"];
  24780. } else {
  24781. $1;
  24782. };
  24783. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  24784. $2=_st(self["@nextAlias"])._asString();
  24785. return $2;
  24786. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)})},
  24787. args: [],
  24788. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  24789. messageSends: ["ifNil:", "+", "asString"],
  24790. referencedClasses: []
  24791. }),
  24792. globals.IRASTTranslator);
  24793. smalltalk.addMethod(
  24794. smalltalk.method({
  24795. selector: "sequence",
  24796. protocol: 'accessing',
  24797. fn: function (){
  24798. var self=this;
  24799. var $1;
  24800. $1=self["@sequence"];
  24801. return $1;
  24802. },
  24803. args: [],
  24804. source: "sequence\x0a\x09^ sequence",
  24805. messageSends: [],
  24806. referencedClasses: []
  24807. }),
  24808. globals.IRASTTranslator);
  24809. smalltalk.addMethod(
  24810. smalltalk.method({
  24811. selector: "sequence:",
  24812. protocol: 'accessing',
  24813. fn: function (anIRSequence){
  24814. var self=this;
  24815. self["@sequence"]=anIRSequence;
  24816. return self},
  24817. args: ["anIRSequence"],
  24818. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  24819. messageSends: [],
  24820. referencedClasses: []
  24821. }),
  24822. globals.IRASTTranslator);
  24823. smalltalk.addMethod(
  24824. smalltalk.method({
  24825. selector: "source",
  24826. protocol: 'accessing',
  24827. fn: function (){
  24828. var self=this;
  24829. var $1;
  24830. $1=self["@source"];
  24831. return $1;
  24832. },
  24833. args: [],
  24834. source: "source\x0a\x09^ source",
  24835. messageSends: [],
  24836. referencedClasses: []
  24837. }),
  24838. globals.IRASTTranslator);
  24839. smalltalk.addMethod(
  24840. smalltalk.method({
  24841. selector: "source:",
  24842. protocol: 'accessing',
  24843. fn: function (aString){
  24844. var self=this;
  24845. self["@source"]=aString;
  24846. return self},
  24847. args: ["aString"],
  24848. source: "source: aString\x0a\x09source := aString",
  24849. messageSends: [],
  24850. referencedClasses: []
  24851. }),
  24852. globals.IRASTTranslator);
  24853. smalltalk.addMethod(
  24854. smalltalk.method({
  24855. selector: "theClass",
  24856. protocol: 'accessing',
  24857. fn: function (){
  24858. var self=this;
  24859. var $1;
  24860. $1=self["@theClass"];
  24861. return $1;
  24862. },
  24863. args: [],
  24864. source: "theClass\x0a\x09^ theClass",
  24865. messageSends: [],
  24866. referencedClasses: []
  24867. }),
  24868. globals.IRASTTranslator);
  24869. smalltalk.addMethod(
  24870. smalltalk.method({
  24871. selector: "theClass:",
  24872. protocol: 'accessing',
  24873. fn: function (aClass){
  24874. var self=this;
  24875. self["@theClass"]=aClass;
  24876. return self},
  24877. args: ["aClass"],
  24878. source: "theClass: aClass\x0a\x09theClass := aClass",
  24879. messageSends: [],
  24880. referencedClasses: []
  24881. }),
  24882. globals.IRASTTranslator);
  24883. smalltalk.addMethod(
  24884. smalltalk.method({
  24885. selector: "visitAssignmentNode:",
  24886. protocol: 'visiting',
  24887. fn: function (aNode){
  24888. var self=this;
  24889. var left,right,assignment;
  24890. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  24891. return smalltalk.withContext(function($ctx1) {
  24892. var $1,$3,$4,$2,$5;
  24893. right=self._visit_(_st(aNode)._right());
  24894. $ctx1.sendIdx["visit:"]=1;
  24895. left=self._visit_(_st(aNode)._left());
  24896. $1=self._sequence();
  24897. $3=_st($IRAssignment())._new();
  24898. _st($3)._add_(left);
  24899. $ctx1.sendIdx["add:"]=2;
  24900. _st($3)._add_(right);
  24901. $4=_st($3)._yourself();
  24902. $2=$4;
  24903. _st($1)._add_($2);
  24904. $ctx1.sendIdx["add:"]=1;
  24905. $5=left;
  24906. return $5;
  24907. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)})},
  24908. args: ["aNode"],
  24909. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  24910. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"],
  24911. referencedClasses: ["IRAssignment"]
  24912. }),
  24913. globals.IRASTTranslator);
  24914. smalltalk.addMethod(
  24915. smalltalk.method({
  24916. selector: "visitBlockNode:",
  24917. protocol: 'visiting',
  24918. fn: function (aNode){
  24919. var self=this;
  24920. var closure;
  24921. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  24922. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  24923. return smalltalk.withContext(function($ctx1) {
  24924. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  24925. $1=_st($IRClosure())._new();
  24926. $ctx1.sendIdx["new"]=1;
  24927. _st($1)._arguments_(_st(aNode)._parameters());
  24928. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  24929. $2=$1;
  24930. $3=_st(aNode)._scope();
  24931. $ctx1.sendIdx["scope"]=1;
  24932. _st($2)._scope_($3);
  24933. $ctx1.sendIdx["scope:"]=1;
  24934. $4=_st($1)._yourself();
  24935. $ctx1.sendIdx["yourself"]=1;
  24936. closure=$4;
  24937. $6=_st(aNode)._scope();
  24938. $ctx1.sendIdx["scope"]=2;
  24939. $5=_st($6)._temps();
  24940. _st($5)._do_((function(each){
  24941. return smalltalk.withContext(function($ctx2) {
  24942. $7=_st($IRTempDeclaration())._new();
  24943. _st($7)._name_(_st(each)._name());
  24944. _st($7)._scope_(_st(aNode)._scope());
  24945. $8=_st($7)._yourself();
  24946. return _st(closure)._add_($8);
  24947. $ctx2.sendIdx["add:"]=1;
  24948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  24949. $ctx1.sendIdx["do:"]=1;
  24950. _st(_st(aNode)._nodes())._do_((function(each){
  24951. return smalltalk.withContext(function($ctx2) {
  24952. return _st(closure)._add_(self._visit_(each));
  24953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  24954. $9=closure;
  24955. return $9;
  24956. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)})},
  24957. args: ["aNode"],
  24958. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  24959. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
  24960. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  24961. }),
  24962. globals.IRASTTranslator);
  24963. smalltalk.addMethod(
  24964. smalltalk.method({
  24965. selector: "visitBlockSequenceNode:",
  24966. protocol: 'visiting',
  24967. fn: function (aNode){
  24968. var self=this;
  24969. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  24970. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  24971. return smalltalk.withContext(function($ctx1) {
  24972. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  24973. $2=_st($IRBlockSequence())._new();
  24974. $ctx1.sendIdx["new"]=1;
  24975. $1=self._withSequence_do_($2,(function(){
  24976. return smalltalk.withContext(function($ctx2) {
  24977. $3=_st(aNode)._nodes();
  24978. $ctx2.sendIdx["nodes"]=1;
  24979. return _st($3)._ifNotEmpty_((function(){
  24980. return smalltalk.withContext(function($ctx3) {
  24981. $5=_st(aNode)._nodes();
  24982. $ctx3.sendIdx["nodes"]=2;
  24983. $4=_st($5)._allButLast();
  24984. _st($4)._do_((function(each){
  24985. return smalltalk.withContext(function($ctx4) {
  24986. $6=self._sequence();
  24987. $ctx4.sendIdx["sequence"]=1;
  24988. $7=self._visitOrAlias_(each);
  24989. $ctx4.sendIdx["visitOrAlias:"]=1;
  24990. return _st($6)._add_($7);
  24991. $ctx4.sendIdx["add:"]=1;
  24992. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  24993. $10=_st(aNode)._nodes();
  24994. $ctx3.sendIdx["nodes"]=3;
  24995. $9=_st($10)._last();
  24996. $ctx3.sendIdx["last"]=1;
  24997. $8=_st($9)._isReturnNode();
  24998. if(smalltalk.assert($8)){
  24999. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  25000. } else {
  25001. $11=self._sequence();
  25002. $ctx3.sendIdx["sequence"]=2;
  25003. $13=_st($IRBlockReturn())._new();
  25004. $14=$13;
  25005. $17=_st(aNode)._nodes();
  25006. $ctx3.sendIdx["nodes"]=4;
  25007. $16=_st($17)._last();
  25008. $ctx3.sendIdx["last"]=2;
  25009. $15=self._visitOrAlias_($16);
  25010. $ctx3.sendIdx["visitOrAlias:"]=2;
  25011. _st($14)._add_($15);
  25012. $ctx3.sendIdx["add:"]=3;
  25013. $18=_st($13)._yourself();
  25014. $12=$18;
  25015. return _st($11)._add_($12);
  25016. $ctx3.sendIdx["add:"]=2;
  25017. };
  25018. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  25019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  25020. return $1;
  25021. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25022. args: ["aNode"],
  25023. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  25024. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"],
  25025. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  25026. }),
  25027. globals.IRASTTranslator);
  25028. smalltalk.addMethod(
  25029. smalltalk.method({
  25030. selector: "visitCascadeNode:",
  25031. protocol: 'visiting',
  25032. fn: function (aNode){
  25033. var self=this;
  25034. var alias,receiver;
  25035. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  25036. return smalltalk.withContext(function($ctx1) {
  25037. var $2,$1,$3,$5,$4,$6;
  25038. $2=_st(aNode)._receiver();
  25039. $ctx1.sendIdx["receiver"]=1;
  25040. $1=_st($2)._isImmutable();
  25041. if(smalltalk.assert($1)){
  25042. receiver=_st(aNode)._receiver();
  25043. $ctx1.sendIdx["receiver"]=2;
  25044. receiver;
  25045. } else {
  25046. alias=self._alias_(_st(aNode)._receiver());
  25047. $ctx1.sendIdx["alias:"]=1;
  25048. alias;
  25049. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  25050. receiver;
  25051. };
  25052. $3=_st(aNode)._nodes();
  25053. $ctx1.sendIdx["nodes"]=1;
  25054. _st($3)._do_((function(each){
  25055. return smalltalk.withContext(function($ctx2) {
  25056. return _st(each)._receiver_(receiver);
  25057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  25058. $ctx1.sendIdx["do:"]=1;
  25059. $5=_st(aNode)._nodes();
  25060. $ctx1.sendIdx["nodes"]=2;
  25061. $4=_st($5)._allButLast();
  25062. _st($4)._do_((function(each){
  25063. return smalltalk.withContext(function($ctx2) {
  25064. return _st(self._sequence())._add_(self._visit_(each));
  25065. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  25066. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  25067. return $6;
  25068. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)})},
  25069. args: ["aNode"],
  25070. source: "visitCascadeNode: aNode\x0a\x09| alias receiver |\x0a\x0a\x09aNode receiver isImmutable \x0a\x09\x09ifTrue: [ receiver := aNode receiver ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09\x09receiver := VariableNode new binding: alias variable ].\x0a\x09\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  25071. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"],
  25072. referencedClasses: ["VariableNode"]
  25073. }),
  25074. globals.IRASTTranslator);
  25075. smalltalk.addMethod(
  25076. smalltalk.method({
  25077. selector: "visitDynamicArrayNode:",
  25078. protocol: 'visiting',
  25079. fn: function (aNode){
  25080. var self=this;
  25081. var array;
  25082. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  25083. return smalltalk.withContext(function($ctx1) {
  25084. var $1;
  25085. array=_st($IRDynamicArray())._new();
  25086. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  25087. return smalltalk.withContext(function($ctx2) {
  25088. return _st(array)._add_(each);
  25089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25090. $1=array;
  25091. return $1;
  25092. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)})},
  25093. args: ["aNode"],
  25094. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  25095. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  25096. referencedClasses: ["IRDynamicArray"]
  25097. }),
  25098. globals.IRASTTranslator);
  25099. smalltalk.addMethod(
  25100. smalltalk.method({
  25101. selector: "visitDynamicDictionaryNode:",
  25102. protocol: 'visiting',
  25103. fn: function (aNode){
  25104. var self=this;
  25105. var dictionary;
  25106. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  25107. return smalltalk.withContext(function($ctx1) {
  25108. var $1;
  25109. dictionary=_st($IRDynamicDictionary())._new();
  25110. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  25111. return smalltalk.withContext(function($ctx2) {
  25112. return _st(dictionary)._add_(each);
  25113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25114. $1=dictionary;
  25115. return $1;
  25116. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)})},
  25117. args: ["aNode"],
  25118. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  25119. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"],
  25120. referencedClasses: ["IRDynamicDictionary"]
  25121. }),
  25122. globals.IRASTTranslator);
  25123. smalltalk.addMethod(
  25124. smalltalk.method({
  25125. selector: "visitJSStatementNode:",
  25126. protocol: 'visiting',
  25127. fn: function (aNode){
  25128. var self=this;
  25129. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  25130. return smalltalk.withContext(function($ctx1) {
  25131. var $2,$3,$1;
  25132. $2=_st($IRVerbatim())._new();
  25133. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  25134. $3=_st($2)._yourself();
  25135. $1=$3;
  25136. return $1;
  25137. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25138. args: ["aNode"],
  25139. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  25140. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"],
  25141. referencedClasses: ["IRVerbatim"]
  25142. }),
  25143. globals.IRASTTranslator);
  25144. smalltalk.addMethod(
  25145. smalltalk.method({
  25146. selector: "visitMethodNode:",
  25147. protocol: 'visiting',
  25148. fn: function (aNode){
  25149. var self=this;
  25150. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  25151. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  25152. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  25153. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  25154. return smalltalk.withContext(function($ctx1) {
  25155. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$18,$19,$17,$20,$21,$22;
  25156. $2=_st($IRMethod())._new();
  25157. $ctx1.sendIdx["new"]=1;
  25158. _st($2)._source_(_st(self._source())._crlfSanitized());
  25159. _st($2)._theClass_(self._theClass());
  25160. _st($2)._arguments_(_st(aNode)._arguments());
  25161. _st($2)._selector_(_st(aNode)._selector());
  25162. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  25163. _st($2)._superSends_(_st(aNode)._superSends());
  25164. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  25165. _st($2)._classReferences_(_st(aNode)._classReferences());
  25166. $3=$2;
  25167. $4=_st(aNode)._scope();
  25168. $ctx1.sendIdx["scope"]=1;
  25169. _st($3)._scope_($4);
  25170. $ctx1.sendIdx["scope:"]=1;
  25171. $5=_st($2)._yourself();
  25172. $ctx1.sendIdx["yourself"]=1;
  25173. $1=$5;
  25174. self._method_($1);
  25175. $7=_st(aNode)._scope();
  25176. $ctx1.sendIdx["scope"]=2;
  25177. $6=_st($7)._temps();
  25178. _st($6)._do_((function(each){
  25179. return smalltalk.withContext(function($ctx2) {
  25180. $8=self._method();
  25181. $ctx2.sendIdx["method"]=1;
  25182. $10=_st($IRTempDeclaration())._new();
  25183. $ctx2.sendIdx["new"]=2;
  25184. _st($10)._name_(_st(each)._name());
  25185. $11=$10;
  25186. $12=_st(aNode)._scope();
  25187. $ctx2.sendIdx["scope"]=3;
  25188. _st($11)._scope_($12);
  25189. $13=_st($10)._yourself();
  25190. $ctx2.sendIdx["yourself"]=2;
  25191. $9=$13;
  25192. return _st($8)._add_($9);
  25193. $ctx2.sendIdx["add:"]=1;
  25194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25195. $ctx1.sendIdx["do:"]=1;
  25196. _st(_st(aNode)._nodes())._do_((function(each){
  25197. return smalltalk.withContext(function($ctx2) {
  25198. $14=self._method();
  25199. $ctx2.sendIdx["method"]=2;
  25200. return _st($14)._add_(self._visit_(each));
  25201. $ctx2.sendIdx["add:"]=2;
  25202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  25203. $16=_st(aNode)._scope();
  25204. $ctx1.sendIdx["scope"]=4;
  25205. $15=_st($16)._hasLocalReturn();
  25206. if(! smalltalk.assert($15)){
  25207. $18=self._method();
  25208. $ctx1.sendIdx["method"]=3;
  25209. $19=_st($IRReturn())._new();
  25210. $ctx1.sendIdx["new"]=3;
  25211. $17=_st($18)._add_($19);
  25212. $20=_st($IRVariable())._new();
  25213. _st($20)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  25214. $21=_st($20)._yourself();
  25215. _st($17)._add_($21);
  25216. $ctx1.sendIdx["add:"]=3;
  25217. };
  25218. $22=self._method();
  25219. return $22;
  25220. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25221. args: ["aNode"],
  25222. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source crlfSanitized;\x0a\x09\x09theClass: self theClass;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09sendIndexes: aNode sendIndexes;\x0a\x09\x09superSends: aNode superSends;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
  25223. messageSends: ["method:", "source:", "new", "crlfSanitized", "source", "theClass:", "theClass", "arguments:", "arguments", "selector:", "selector", "sendIndexes:", "sendIndexes", "superSends:", "superSends", "requiresSmalltalkContext:", "requiresSmalltalkContext", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "temps", "add:", "method", "name:", "name", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"],
  25224. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable"]
  25225. }),
  25226. globals.IRASTTranslator);
  25227. smalltalk.addMethod(
  25228. smalltalk.method({
  25229. selector: "visitOrAlias:",
  25230. protocol: 'visiting',
  25231. fn: function (aNode){
  25232. var self=this;
  25233. return smalltalk.withContext(function($ctx1) {
  25234. var $2,$1;
  25235. $2=_st(aNode)._shouldBeAliased();
  25236. if(smalltalk.assert($2)){
  25237. $1=self._alias_(aNode);
  25238. } else {
  25239. $1=self._visit_(aNode);
  25240. };
  25241. return $1;
  25242. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)})},
  25243. args: ["aNode"],
  25244. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  25245. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"],
  25246. referencedClasses: []
  25247. }),
  25248. globals.IRASTTranslator);
  25249. smalltalk.addMethod(
  25250. smalltalk.method({
  25251. selector: "visitReturnNode:",
  25252. protocol: 'visiting',
  25253. fn: function (aNode){
  25254. var self=this;
  25255. var return_;
  25256. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  25257. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  25258. return smalltalk.withContext(function($ctx1) {
  25259. var $1,$2;
  25260. $1=_st(aNode)._nonLocalReturn();
  25261. if(smalltalk.assert($1)){
  25262. return_=_st($IRNonLocalReturn())._new();
  25263. $ctx1.sendIdx["new"]=1;
  25264. } else {
  25265. return_=_st($IRReturn())._new();
  25266. };
  25267. _st(return_)._scope_(_st(aNode)._scope());
  25268. _st(_st(aNode)._nodes())._do_((function(each){
  25269. return smalltalk.withContext(function($ctx2) {
  25270. return _st(return_)._add_(self._alias_(each));
  25271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  25272. $2=return_;
  25273. return $2;
  25274. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)})},
  25275. args: ["aNode"],
  25276. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn\x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
  25277. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"],
  25278. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  25279. }),
  25280. globals.IRASTTranslator);
  25281. smalltalk.addMethod(
  25282. smalltalk.method({
  25283. selector: "visitSendNode:",
  25284. protocol: 'visiting',
  25285. fn: function (aNode){
  25286. var self=this;
  25287. var send,all,receiver,arguments;
  25288. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  25289. return smalltalk.withContext(function($ctx1) {
  25290. var $1,$2,$3,$4;
  25291. send=_st($IRSend())._new();
  25292. $1=send;
  25293. _st($1)._selector_(_st(aNode)._selector());
  25294. $2=_st($1)._index_(_st(aNode)._index());
  25295. $3=_st(aNode)._superSend();
  25296. if(smalltalk.assert($3)){
  25297. _st(send)._classSend_(_st(self._theClass())._superclass());
  25298. };
  25299. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  25300. receiver=_st(all)._first();
  25301. arguments=_st(all)._allButFirst();
  25302. _st(send)._add_(receiver);
  25303. $ctx1.sendIdx["add:"]=1;
  25304. _st(arguments)._do_((function(each){
  25305. return smalltalk.withContext(function($ctx2) {
  25306. return _st(send)._add_(each);
  25307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  25308. $4=send;
  25309. return $4;
  25310. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)})},
  25311. args: ["aNode"],
  25312. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send\x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a\x09\x0a\x09all := self aliasTemporally: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  25313. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"],
  25314. referencedClasses: ["IRSend"]
  25315. }),
  25316. globals.IRASTTranslator);
  25317. smalltalk.addMethod(
  25318. smalltalk.method({
  25319. selector: "visitSequenceNode:",
  25320. protocol: 'visiting',
  25321. fn: function (aNode){
  25322. var self=this;
  25323. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  25324. return smalltalk.withContext(function($ctx1) {
  25325. var $2,$1;
  25326. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  25327. return smalltalk.withContext(function($ctx2) {
  25328. return _st(_st(aNode)._nodes())._do_((function(each){
  25329. var instruction;
  25330. return smalltalk.withContext(function($ctx3) {
  25331. instruction=self._visitOrAlias_(each);
  25332. instruction;
  25333. $2=_st(instruction)._isVariable();
  25334. if(! smalltalk.assert($2)){
  25335. return _st(self._sequence())._add_(instruction);
  25336. };
  25337. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)})}));
  25338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  25339. return $1;
  25340. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25341. args: ["aNode"],
  25342. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visitOrAlias: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ] ]]",
  25343. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"],
  25344. referencedClasses: ["IRSequence"]
  25345. }),
  25346. globals.IRASTTranslator);
  25347. smalltalk.addMethod(
  25348. smalltalk.method({
  25349. selector: "visitValueNode:",
  25350. protocol: 'visiting',
  25351. fn: function (aNode){
  25352. var self=this;
  25353. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  25354. return smalltalk.withContext(function($ctx1) {
  25355. var $2,$3,$1;
  25356. $2=_st($IRValue())._new();
  25357. _st($2)._value_(_st(aNode)._value());
  25358. $3=_st($2)._yourself();
  25359. $1=$3;
  25360. return $1;
  25361. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25362. args: ["aNode"],
  25363. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  25364. messageSends: ["value:", "new", "value", "yourself"],
  25365. referencedClasses: ["IRValue"]
  25366. }),
  25367. globals.IRASTTranslator);
  25368. smalltalk.addMethod(
  25369. smalltalk.method({
  25370. selector: "visitVariableNode:",
  25371. protocol: 'visiting',
  25372. fn: function (aNode){
  25373. var self=this;
  25374. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  25375. return smalltalk.withContext(function($ctx1) {
  25376. var $2,$3,$1;
  25377. $2=_st($IRVariable())._new();
  25378. _st($2)._variable_(_st(aNode)._binding());
  25379. $3=_st($2)._yourself();
  25380. $1=$3;
  25381. return $1;
  25382. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)})},
  25383. args: ["aNode"],
  25384. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  25385. messageSends: ["variable:", "new", "binding", "yourself"],
  25386. referencedClasses: ["IRVariable"]
  25387. }),
  25388. globals.IRASTTranslator);
  25389. smalltalk.addMethod(
  25390. smalltalk.method({
  25391. selector: "withSequence:do:",
  25392. protocol: 'accessing',
  25393. fn: function (aSequence,aBlock){
  25394. var self=this;
  25395. var outerSequence;
  25396. return smalltalk.withContext(function($ctx1) {
  25397. outerSequence=self._sequence();
  25398. self._sequence_(aSequence);
  25399. $ctx1.sendIdx["sequence:"]=1;
  25400. _st(aBlock)._value();
  25401. self._sequence_(outerSequence);
  25402. return aSequence;
  25403. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)})},
  25404. args: ["aSequence", "aBlock"],
  25405. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  25406. messageSends: ["sequence", "sequence:", "value"],
  25407. referencedClasses: []
  25408. }),
  25409. globals.IRASTTranslator);
  25410. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  25411. globals.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream.";
  25412. smalltalk.addMethod(
  25413. smalltalk.method({
  25414. selector: "accept:",
  25415. protocol: 'visiting',
  25416. fn: function (aVisitor){
  25417. var self=this;
  25418. return smalltalk.withContext(function($ctx1) {
  25419. var $1;
  25420. $1=_st(aVisitor)._visitIRInstruction_(self);
  25421. return $1;
  25422. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)})},
  25423. args: ["aVisitor"],
  25424. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  25425. messageSends: ["visitIRInstruction:"],
  25426. referencedClasses: []
  25427. }),
  25428. globals.IRInstruction);
  25429. smalltalk.addMethod(
  25430. smalltalk.method({
  25431. selector: "add:",
  25432. protocol: 'building',
  25433. fn: function (anObject){
  25434. var self=this;
  25435. return smalltalk.withContext(function($ctx1) {
  25436. var $1;
  25437. _st(anObject)._parent_(self);
  25438. $1=_st(self._instructions())._add_(anObject);
  25439. return $1;
  25440. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)})},
  25441. args: ["anObject"],
  25442. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  25443. messageSends: ["parent:", "add:", "instructions"],
  25444. referencedClasses: []
  25445. }),
  25446. globals.IRInstruction);
  25447. smalltalk.addMethod(
  25448. smalltalk.method({
  25449. selector: "canBeAssigned",
  25450. protocol: 'testing',
  25451. fn: function (){
  25452. var self=this;
  25453. return true;
  25454. },
  25455. args: [],
  25456. source: "canBeAssigned\x0a\x09^ true",
  25457. messageSends: [],
  25458. referencedClasses: []
  25459. }),
  25460. globals.IRInstruction);
  25461. smalltalk.addMethod(
  25462. smalltalk.method({
  25463. selector: "instructions",
  25464. protocol: 'accessing',
  25465. fn: function (){
  25466. var self=this;
  25467. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  25468. return smalltalk.withContext(function($ctx1) {
  25469. var $2,$1,$receiver;
  25470. $2=self["@instructions"];
  25471. if(($receiver = $2) == null || $receiver.isNil){
  25472. self["@instructions"]=_st($OrderedCollection())._new();
  25473. $1=self["@instructions"];
  25474. } else {
  25475. $1=$2;
  25476. };
  25477. return $1;
  25478. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)})},
  25479. args: [],
  25480. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  25481. messageSends: ["ifNil:", "new"],
  25482. referencedClasses: ["OrderedCollection"]
  25483. }),
  25484. globals.IRInstruction);
  25485. smalltalk.addMethod(
  25486. smalltalk.method({
  25487. selector: "isClosure",
  25488. protocol: 'testing',
  25489. fn: function (){
  25490. var self=this;
  25491. return false;
  25492. },
  25493. args: [],
  25494. source: "isClosure\x0a\x09^ false",
  25495. messageSends: [],
  25496. referencedClasses: []
  25497. }),
  25498. globals.IRInstruction);
  25499. smalltalk.addMethod(
  25500. smalltalk.method({
  25501. selector: "isInlined",
  25502. protocol: 'testing',
  25503. fn: function (){
  25504. var self=this;
  25505. return false;
  25506. },
  25507. args: [],
  25508. source: "isInlined\x0a\x09^ false",
  25509. messageSends: [],
  25510. referencedClasses: []
  25511. }),
  25512. globals.IRInstruction);
  25513. smalltalk.addMethod(
  25514. smalltalk.method({
  25515. selector: "isLocalReturn",
  25516. protocol: 'testing',
  25517. fn: function (){
  25518. var self=this;
  25519. return false;
  25520. },
  25521. args: [],
  25522. source: "isLocalReturn\x0a\x09^ false",
  25523. messageSends: [],
  25524. referencedClasses: []
  25525. }),
  25526. globals.IRInstruction);
  25527. smalltalk.addMethod(
  25528. smalltalk.method({
  25529. selector: "isMethod",
  25530. protocol: 'testing',
  25531. fn: function (){
  25532. var self=this;
  25533. return false;
  25534. },
  25535. args: [],
  25536. source: "isMethod\x0a\x09^ false",
  25537. messageSends: [],
  25538. referencedClasses: []
  25539. }),
  25540. globals.IRInstruction);
  25541. smalltalk.addMethod(
  25542. smalltalk.method({
  25543. selector: "isReturn",
  25544. protocol: 'testing',
  25545. fn: function (){
  25546. var self=this;
  25547. return false;
  25548. },
  25549. args: [],
  25550. source: "isReturn\x0a\x09^ false",
  25551. messageSends: [],
  25552. referencedClasses: []
  25553. }),
  25554. globals.IRInstruction);
  25555. smalltalk.addMethod(
  25556. smalltalk.method({
  25557. selector: "isSend",
  25558. protocol: 'testing',
  25559. fn: function (){
  25560. var self=this;
  25561. return false;
  25562. },
  25563. args: [],
  25564. source: "isSend\x0a\x09^ false",
  25565. messageSends: [],
  25566. referencedClasses: []
  25567. }),
  25568. globals.IRInstruction);
  25569. smalltalk.addMethod(
  25570. smalltalk.method({
  25571. selector: "isSequence",
  25572. protocol: 'testing',
  25573. fn: function (){
  25574. var self=this;
  25575. return false;
  25576. },
  25577. args: [],
  25578. source: "isSequence\x0a\x09^ false",
  25579. messageSends: [],
  25580. referencedClasses: []
  25581. }),
  25582. globals.IRInstruction);
  25583. smalltalk.addMethod(
  25584. smalltalk.method({
  25585. selector: "isTempDeclaration",
  25586. protocol: 'testing',
  25587. fn: function (){
  25588. var self=this;
  25589. return false;
  25590. },
  25591. args: [],
  25592. source: "isTempDeclaration\x0a\x09^ false",
  25593. messageSends: [],
  25594. referencedClasses: []
  25595. }),
  25596. globals.IRInstruction);
  25597. smalltalk.addMethod(
  25598. smalltalk.method({
  25599. selector: "isVariable",
  25600. protocol: 'testing',
  25601. fn: function (){
  25602. var self=this;
  25603. return false;
  25604. },
  25605. args: [],
  25606. source: "isVariable\x0a\x09^ false",
  25607. messageSends: [],
  25608. referencedClasses: []
  25609. }),
  25610. globals.IRInstruction);
  25611. smalltalk.addMethod(
  25612. smalltalk.method({
  25613. selector: "method",
  25614. protocol: 'accessing',
  25615. fn: function (){
  25616. var self=this;
  25617. return smalltalk.withContext(function($ctx1) {
  25618. var $1;
  25619. $1=_st(self._parent())._method();
  25620. return $1;
  25621. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)})},
  25622. args: [],
  25623. source: "method\x0a\x09^ self parent method",
  25624. messageSends: ["method", "parent"],
  25625. referencedClasses: []
  25626. }),
  25627. globals.IRInstruction);
  25628. smalltalk.addMethod(
  25629. smalltalk.method({
  25630. selector: "needsBoxingAsReceiver",
  25631. protocol: 'testing',
  25632. fn: function (){
  25633. var self=this;
  25634. return true;
  25635. },
  25636. args: [],
  25637. source: "needsBoxingAsReceiver\x0a\x09^ true",
  25638. messageSends: [],
  25639. referencedClasses: []
  25640. }),
  25641. globals.IRInstruction);
  25642. smalltalk.addMethod(
  25643. smalltalk.method({
  25644. selector: "parent",
  25645. protocol: 'accessing',
  25646. fn: function (){
  25647. var self=this;
  25648. var $1;
  25649. $1=self["@parent"];
  25650. return $1;
  25651. },
  25652. args: [],
  25653. source: "parent\x0a\x09^ parent",
  25654. messageSends: [],
  25655. referencedClasses: []
  25656. }),
  25657. globals.IRInstruction);
  25658. smalltalk.addMethod(
  25659. smalltalk.method({
  25660. selector: "parent:",
  25661. protocol: 'accessing',
  25662. fn: function (anIRInstruction){
  25663. var self=this;
  25664. self["@parent"]=anIRInstruction;
  25665. return self},
  25666. args: ["anIRInstruction"],
  25667. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  25668. messageSends: [],
  25669. referencedClasses: []
  25670. }),
  25671. globals.IRInstruction);
  25672. smalltalk.addMethod(
  25673. smalltalk.method({
  25674. selector: "remove",
  25675. protocol: 'building',
  25676. fn: function (){
  25677. var self=this;
  25678. return smalltalk.withContext(function($ctx1) {
  25679. _st(self._parent())._remove_(self);
  25680. return self}, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)})},
  25681. args: [],
  25682. source: "remove\x0a\x09self parent remove: self",
  25683. messageSends: ["remove:", "parent"],
  25684. referencedClasses: []
  25685. }),
  25686. globals.IRInstruction);
  25687. smalltalk.addMethod(
  25688. smalltalk.method({
  25689. selector: "remove:",
  25690. protocol: 'building',
  25691. fn: function (anIRInstruction){
  25692. var self=this;
  25693. return smalltalk.withContext(function($ctx1) {
  25694. _st(self._instructions())._remove_(anIRInstruction);
  25695. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  25696. args: ["anIRInstruction"],
  25697. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  25698. messageSends: ["remove:", "instructions"],
  25699. referencedClasses: []
  25700. }),
  25701. globals.IRInstruction);
  25702. smalltalk.addMethod(
  25703. smalltalk.method({
  25704. selector: "replace:with:",
  25705. protocol: 'building',
  25706. fn: function (anIRInstruction,anotherIRInstruction){
  25707. var self=this;
  25708. return smalltalk.withContext(function($ctx1) {
  25709. var $1;
  25710. _st(anotherIRInstruction)._parent_(self);
  25711. $1=self._instructions();
  25712. $ctx1.sendIdx["instructions"]=1;
  25713. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  25714. return self}, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)})},
  25715. args: ["anIRInstruction", "anotherIRInstruction"],
  25716. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  25717. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"],
  25718. referencedClasses: []
  25719. }),
  25720. globals.IRInstruction);
  25721. smalltalk.addMethod(
  25722. smalltalk.method({
  25723. selector: "replaceWith:",
  25724. protocol: 'building',
  25725. fn: function (anIRInstruction){
  25726. var self=this;
  25727. return smalltalk.withContext(function($ctx1) {
  25728. _st(self._parent())._replace_with_(self,anIRInstruction);
  25729. return self}, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)})},
  25730. args: ["anIRInstruction"],
  25731. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  25732. messageSends: ["replace:with:", "parent"],
  25733. referencedClasses: []
  25734. }),
  25735. globals.IRInstruction);
  25736. smalltalk.addMethod(
  25737. smalltalk.method({
  25738. selector: "scope",
  25739. protocol: 'accessing',
  25740. fn: function (){
  25741. var self=this;
  25742. return smalltalk.withContext(function($ctx1) {
  25743. var $2,$1,$receiver;
  25744. $2=self._parent();
  25745. if(($receiver = $2) == null || $receiver.isNil){
  25746. $1=$2;
  25747. } else {
  25748. var node;
  25749. node=$receiver;
  25750. $1=_st(node)._scope();
  25751. };
  25752. return $1;
  25753. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)})},
  25754. args: [],
  25755. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  25756. messageSends: ["ifNotNil:", "parent", "scope"],
  25757. referencedClasses: []
  25758. }),
  25759. globals.IRInstruction);
  25760. smalltalk.addMethod(
  25761. smalltalk.method({
  25762. selector: "on:",
  25763. protocol: 'instance creation',
  25764. fn: function (aBuilder){
  25765. var self=this;
  25766. return smalltalk.withContext(function($ctx1) {
  25767. var $2,$3,$1;
  25768. $2=self._new();
  25769. _st($2)._builder_(aBuilder);
  25770. $3=_st($2)._yourself();
  25771. $1=$3;
  25772. return $1;
  25773. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)})},
  25774. args: ["aBuilder"],
  25775. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  25776. messageSends: ["builder:", "new", "yourself"],
  25777. referencedClasses: []
  25778. }),
  25779. globals.IRInstruction.klass);
  25780. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  25781. smalltalk.addMethod(
  25782. smalltalk.method({
  25783. selector: "accept:",
  25784. protocol: 'visiting',
  25785. fn: function (aVisitor){
  25786. var self=this;
  25787. return smalltalk.withContext(function($ctx1) {
  25788. var $1;
  25789. $1=_st(aVisitor)._visitIRAssignment_(self);
  25790. return $1;
  25791. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)})},
  25792. args: ["aVisitor"],
  25793. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  25794. messageSends: ["visitIRAssignment:"],
  25795. referencedClasses: []
  25796. }),
  25797. globals.IRAssignment);
  25798. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  25799. smalltalk.addMethod(
  25800. smalltalk.method({
  25801. selector: "accept:",
  25802. protocol: 'visiting',
  25803. fn: function (aVisitor){
  25804. var self=this;
  25805. return smalltalk.withContext(function($ctx1) {
  25806. var $1;
  25807. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  25808. return $1;
  25809. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)})},
  25810. args: ["aVisitor"],
  25811. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  25812. messageSends: ["visitIRDynamicArray:"],
  25813. referencedClasses: []
  25814. }),
  25815. globals.IRDynamicArray);
  25816. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  25817. smalltalk.addMethod(
  25818. smalltalk.method({
  25819. selector: "accept:",
  25820. protocol: 'visiting',
  25821. fn: function (aVisitor){
  25822. var self=this;
  25823. return smalltalk.withContext(function($ctx1) {
  25824. var $1;
  25825. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  25826. return $1;
  25827. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)})},
  25828. args: ["aVisitor"],
  25829. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  25830. messageSends: ["visitIRDynamicDictionary:"],
  25831. referencedClasses: []
  25832. }),
  25833. globals.IRDynamicDictionary);
  25834. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  25835. smalltalk.addMethod(
  25836. smalltalk.method({
  25837. selector: "scope",
  25838. protocol: 'accessing',
  25839. fn: function (){
  25840. var self=this;
  25841. var $1;
  25842. $1=self["@scope"];
  25843. return $1;
  25844. },
  25845. args: [],
  25846. source: "scope\x0a\x09^ scope",
  25847. messageSends: [],
  25848. referencedClasses: []
  25849. }),
  25850. globals.IRScopedInstruction);
  25851. smalltalk.addMethod(
  25852. smalltalk.method({
  25853. selector: "scope:",
  25854. protocol: 'accessing',
  25855. fn: function (aScope){
  25856. var self=this;
  25857. self["@scope"]=aScope;
  25858. return self},
  25859. args: ["aScope"],
  25860. source: "scope: aScope\x0a\x09scope := aScope",
  25861. messageSends: [],
  25862. referencedClasses: []
  25863. }),
  25864. globals.IRScopedInstruction);
  25865. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  25866. smalltalk.addMethod(
  25867. smalltalk.method({
  25868. selector: "arguments",
  25869. protocol: 'accessing',
  25870. fn: function (){
  25871. var self=this;
  25872. return smalltalk.withContext(function($ctx1) {
  25873. var $2,$1,$receiver;
  25874. $2=self["@arguments"];
  25875. if(($receiver = $2) == null || $receiver.isNil){
  25876. $1=[];
  25877. } else {
  25878. $1=$2;
  25879. };
  25880. return $1;
  25881. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)})},
  25882. args: [],
  25883. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  25884. messageSends: ["ifNil:"],
  25885. referencedClasses: []
  25886. }),
  25887. globals.IRClosureInstruction);
  25888. smalltalk.addMethod(
  25889. smalltalk.method({
  25890. selector: "arguments:",
  25891. protocol: 'accessing',
  25892. fn: function (aCollection){
  25893. var self=this;
  25894. self["@arguments"]=aCollection;
  25895. return self},
  25896. args: ["aCollection"],
  25897. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  25898. messageSends: [],
  25899. referencedClasses: []
  25900. }),
  25901. globals.IRClosureInstruction);
  25902. smalltalk.addMethod(
  25903. smalltalk.method({
  25904. selector: "locals",
  25905. protocol: 'accessing',
  25906. fn: function (){
  25907. var self=this;
  25908. return smalltalk.withContext(function($ctx1) {
  25909. var $2,$3,$1;
  25910. $2=_st(self._arguments())._copy();
  25911. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  25912. return smalltalk.withContext(function($ctx2) {
  25913. return _st(each)._name();
  25914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  25915. $3=_st($2)._yourself();
  25916. $1=$3;
  25917. return $1;
  25918. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)})},
  25919. args: [],
  25920. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  25921. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"],
  25922. referencedClasses: []
  25923. }),
  25924. globals.IRClosureInstruction);
  25925. smalltalk.addMethod(
  25926. smalltalk.method({
  25927. selector: "requiresSmalltalkContext",
  25928. protocol: 'accessing',
  25929. fn: function (){
  25930. var self=this;
  25931. return smalltalk.withContext(function($ctx1) {
  25932. var $2,$1,$receiver;
  25933. $2=self["@requiresSmalltalkContext"];
  25934. if(($receiver = $2) == null || $receiver.isNil){
  25935. $1=false;
  25936. } else {
  25937. $1=$2;
  25938. };
  25939. return $1;
  25940. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)})},
  25941. args: [],
  25942. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  25943. messageSends: ["ifNil:"],
  25944. referencedClasses: []
  25945. }),
  25946. globals.IRClosureInstruction);
  25947. smalltalk.addMethod(
  25948. smalltalk.method({
  25949. selector: "requiresSmalltalkContext:",
  25950. protocol: 'accessing',
  25951. fn: function (anObject){
  25952. var self=this;
  25953. self["@requiresSmalltalkContext"]=anObject;
  25954. return self},
  25955. args: ["anObject"],
  25956. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  25957. messageSends: [],
  25958. referencedClasses: []
  25959. }),
  25960. globals.IRClosureInstruction);
  25961. smalltalk.addMethod(
  25962. smalltalk.method({
  25963. selector: "scope:",
  25964. protocol: 'accessing',
  25965. fn: function (aScope){
  25966. var self=this;
  25967. return smalltalk.withContext(function($ctx1) {
  25968. ($ctx1.supercall = true, globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
  25969. $ctx1.supercall = false;
  25970. _st(aScope)._instruction_(self);
  25971. return self}, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)})},
  25972. args: ["aScope"],
  25973. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  25974. messageSends: ["scope:", "instruction:"],
  25975. referencedClasses: []
  25976. }),
  25977. globals.IRClosureInstruction);
  25978. smalltalk.addMethod(
  25979. smalltalk.method({
  25980. selector: "tempDeclarations",
  25981. protocol: 'accessing',
  25982. fn: function (){
  25983. var self=this;
  25984. return smalltalk.withContext(function($ctx1) {
  25985. var $1;
  25986. $1=_st(self._instructions())._select_((function(each){
  25987. return smalltalk.withContext(function($ctx2) {
  25988. return _st(each)._isTempDeclaration();
  25989. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  25990. return $1;
  25991. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)})},
  25992. args: [],
  25993. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  25994. messageSends: ["select:", "instructions", "isTempDeclaration"],
  25995. referencedClasses: []
  25996. }),
  25997. globals.IRClosureInstruction);
  25998. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  25999. smalltalk.addMethod(
  26000. smalltalk.method({
  26001. selector: "accept:",
  26002. protocol: 'visiting',
  26003. fn: function (aVisitor){
  26004. var self=this;
  26005. return smalltalk.withContext(function($ctx1) {
  26006. var $1;
  26007. $1=_st(aVisitor)._visitIRClosure_(self);
  26008. return $1;
  26009. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)})},
  26010. args: ["aVisitor"],
  26011. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  26012. messageSends: ["visitIRClosure:"],
  26013. referencedClasses: []
  26014. }),
  26015. globals.IRClosure);
  26016. smalltalk.addMethod(
  26017. smalltalk.method({
  26018. selector: "isClosure",
  26019. protocol: 'testing',
  26020. fn: function (){
  26021. var self=this;
  26022. return true;
  26023. },
  26024. args: [],
  26025. source: "isClosure\x0a\x09^ true",
  26026. messageSends: [],
  26027. referencedClasses: []
  26028. }),
  26029. globals.IRClosure);
  26030. smalltalk.addMethod(
  26031. smalltalk.method({
  26032. selector: "sequence",
  26033. protocol: 'accessing',
  26034. fn: function (){
  26035. var self=this;
  26036. return smalltalk.withContext(function($ctx1) {
  26037. var $1;
  26038. $1=_st(self._instructions())._last();
  26039. return $1;
  26040. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)})},
  26041. args: [],
  26042. source: "sequence\x0a\x09^ self instructions last",
  26043. messageSends: ["last", "instructions"],
  26044. referencedClasses: []
  26045. }),
  26046. globals.IRClosure);
  26047. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  26048. globals.IRMethod.comment="I am a method instruction";
  26049. smalltalk.addMethod(
  26050. smalltalk.method({
  26051. selector: "accept:",
  26052. protocol: 'visiting',
  26053. fn: function (aVisitor){
  26054. var self=this;
  26055. return smalltalk.withContext(function($ctx1) {
  26056. var $1;
  26057. $1=_st(aVisitor)._visitIRMethod_(self);
  26058. return $1;
  26059. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)})},
  26060. args: ["aVisitor"],
  26061. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  26062. messageSends: ["visitIRMethod:"],
  26063. referencedClasses: []
  26064. }),
  26065. globals.IRMethod);
  26066. smalltalk.addMethod(
  26067. smalltalk.method({
  26068. selector: "classReferences",
  26069. protocol: 'accessing',
  26070. fn: function (){
  26071. var self=this;
  26072. var $1;
  26073. $1=self["@classReferences"];
  26074. return $1;
  26075. },
  26076. args: [],
  26077. source: "classReferences\x0a\x09^ classReferences",
  26078. messageSends: [],
  26079. referencedClasses: []
  26080. }),
  26081. globals.IRMethod);
  26082. smalltalk.addMethod(
  26083. smalltalk.method({
  26084. selector: "classReferences:",
  26085. protocol: 'accessing',
  26086. fn: function (aCollection){
  26087. var self=this;
  26088. self["@classReferences"]=aCollection;
  26089. return self},
  26090. args: ["aCollection"],
  26091. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  26092. messageSends: [],
  26093. referencedClasses: []
  26094. }),
  26095. globals.IRMethod);
  26096. smalltalk.addMethod(
  26097. smalltalk.method({
  26098. selector: "internalVariables",
  26099. protocol: 'accessing',
  26100. fn: function (){
  26101. var self=this;
  26102. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  26103. return smalltalk.withContext(function($ctx1) {
  26104. var $2,$1,$receiver;
  26105. $2=self["@internalVariables"];
  26106. if(($receiver = $2) == null || $receiver.isNil){
  26107. self["@internalVariables"]=_st($Set())._new();
  26108. $1=self["@internalVariables"];
  26109. } else {
  26110. $1=$2;
  26111. };
  26112. return $1;
  26113. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)})},
  26114. args: [],
  26115. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  26116. messageSends: ["ifNil:", "new"],
  26117. referencedClasses: ["Set"]
  26118. }),
  26119. globals.IRMethod);
  26120. smalltalk.addMethod(
  26121. smalltalk.method({
  26122. selector: "isMethod",
  26123. protocol: 'accessing',
  26124. fn: function (){
  26125. var self=this;
  26126. return true;
  26127. },
  26128. args: [],
  26129. source: "isMethod\x0a\x09^ true",
  26130. messageSends: [],
  26131. referencedClasses: []
  26132. }),
  26133. globals.IRMethod);
  26134. smalltalk.addMethod(
  26135. smalltalk.method({
  26136. selector: "messageSends",
  26137. protocol: 'accessing',
  26138. fn: function (){
  26139. var self=this;
  26140. return smalltalk.withContext(function($ctx1) {
  26141. var $1;
  26142. $1=_st(self._sendIndexes())._keys();
  26143. return $1;
  26144. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)})},
  26145. args: [],
  26146. source: "messageSends\x0a\x09^ self sendIndexes keys",
  26147. messageSends: ["keys", "sendIndexes"],
  26148. referencedClasses: []
  26149. }),
  26150. globals.IRMethod);
  26151. smalltalk.addMethod(
  26152. smalltalk.method({
  26153. selector: "method",
  26154. protocol: 'accessing',
  26155. fn: function (){
  26156. var self=this;
  26157. return self;
  26158. },
  26159. args: [],
  26160. source: "method\x0a\x09^ self",
  26161. messageSends: [],
  26162. referencedClasses: []
  26163. }),
  26164. globals.IRMethod);
  26165. smalltalk.addMethod(
  26166. smalltalk.method({
  26167. selector: "selector",
  26168. protocol: 'accessing',
  26169. fn: function (){
  26170. var self=this;
  26171. var $1;
  26172. $1=self["@selector"];
  26173. return $1;
  26174. },
  26175. args: [],
  26176. source: "selector\x0a\x09^ selector",
  26177. messageSends: [],
  26178. referencedClasses: []
  26179. }),
  26180. globals.IRMethod);
  26181. smalltalk.addMethod(
  26182. smalltalk.method({
  26183. selector: "selector:",
  26184. protocol: 'accessing',
  26185. fn: function (aString){
  26186. var self=this;
  26187. self["@selector"]=aString;
  26188. return self},
  26189. args: ["aString"],
  26190. source: "selector: aString\x0a\x09selector := aString",
  26191. messageSends: [],
  26192. referencedClasses: []
  26193. }),
  26194. globals.IRMethod);
  26195. smalltalk.addMethod(
  26196. smalltalk.method({
  26197. selector: "sendIndexes",
  26198. protocol: 'accessing',
  26199. fn: function (){
  26200. var self=this;
  26201. var $1;
  26202. $1=self["@sendIndexes"];
  26203. return $1;
  26204. },
  26205. args: [],
  26206. source: "sendIndexes\x0a\x09^ sendIndexes",
  26207. messageSends: [],
  26208. referencedClasses: []
  26209. }),
  26210. globals.IRMethod);
  26211. smalltalk.addMethod(
  26212. smalltalk.method({
  26213. selector: "sendIndexes:",
  26214. protocol: 'accessing',
  26215. fn: function (aDictionary){
  26216. var self=this;
  26217. self["@sendIndexes"]=aDictionary;
  26218. return self},
  26219. args: ["aDictionary"],
  26220. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  26221. messageSends: [],
  26222. referencedClasses: []
  26223. }),
  26224. globals.IRMethod);
  26225. smalltalk.addMethod(
  26226. smalltalk.method({
  26227. selector: "source",
  26228. protocol: 'accessing',
  26229. fn: function (){
  26230. var self=this;
  26231. var $1;
  26232. $1=self["@source"];
  26233. return $1;
  26234. },
  26235. args: [],
  26236. source: "source\x0a\x09^ source",
  26237. messageSends: [],
  26238. referencedClasses: []
  26239. }),
  26240. globals.IRMethod);
  26241. smalltalk.addMethod(
  26242. smalltalk.method({
  26243. selector: "source:",
  26244. protocol: 'accessing',
  26245. fn: function (aString){
  26246. var self=this;
  26247. self["@source"]=aString;
  26248. return self},
  26249. args: ["aString"],
  26250. source: "source: aString\x0a\x09source := aString",
  26251. messageSends: [],
  26252. referencedClasses: []
  26253. }),
  26254. globals.IRMethod);
  26255. smalltalk.addMethod(
  26256. smalltalk.method({
  26257. selector: "superSends",
  26258. protocol: 'accessing',
  26259. fn: function (){
  26260. var self=this;
  26261. var $1;
  26262. $1=self["@superSends"];
  26263. return $1;
  26264. },
  26265. args: [],
  26266. source: "superSends\x0a\x09^ superSends",
  26267. messageSends: [],
  26268. referencedClasses: []
  26269. }),
  26270. globals.IRMethod);
  26271. smalltalk.addMethod(
  26272. smalltalk.method({
  26273. selector: "superSends:",
  26274. protocol: 'accessing',
  26275. fn: function (aCollection){
  26276. var self=this;
  26277. self["@superSends"]=aCollection;
  26278. return self},
  26279. args: ["aCollection"],
  26280. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  26281. messageSends: [],
  26282. referencedClasses: []
  26283. }),
  26284. globals.IRMethod);
  26285. smalltalk.addMethod(
  26286. smalltalk.method({
  26287. selector: "theClass",
  26288. protocol: 'accessing',
  26289. fn: function (){
  26290. var self=this;
  26291. var $1;
  26292. $1=self["@theClass"];
  26293. return $1;
  26294. },
  26295. args: [],
  26296. source: "theClass\x0a\x09^ theClass",
  26297. messageSends: [],
  26298. referencedClasses: []
  26299. }),
  26300. globals.IRMethod);
  26301. smalltalk.addMethod(
  26302. smalltalk.method({
  26303. selector: "theClass:",
  26304. protocol: 'accessing',
  26305. fn: function (aClass){
  26306. var self=this;
  26307. self["@theClass"]=aClass;
  26308. return self},
  26309. args: ["aClass"],
  26310. source: "theClass: aClass\x0a\x09theClass := aClass",
  26311. messageSends: [],
  26312. referencedClasses: []
  26313. }),
  26314. globals.IRMethod);
  26315. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  26316. globals.IRReturn.comment="I am a local return instruction.";
  26317. smalltalk.addMethod(
  26318. smalltalk.method({
  26319. selector: "accept:",
  26320. protocol: 'visiting',
  26321. fn: function (aVisitor){
  26322. var self=this;
  26323. return smalltalk.withContext(function($ctx1) {
  26324. var $1;
  26325. $1=_st(aVisitor)._visitIRReturn_(self);
  26326. return $1;
  26327. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)})},
  26328. args: ["aVisitor"],
  26329. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  26330. messageSends: ["visitIRReturn:"],
  26331. referencedClasses: []
  26332. }),
  26333. globals.IRReturn);
  26334. smalltalk.addMethod(
  26335. smalltalk.method({
  26336. selector: "canBeAssigned",
  26337. protocol: 'testing',
  26338. fn: function (){
  26339. var self=this;
  26340. return false;
  26341. },
  26342. args: [],
  26343. source: "canBeAssigned\x0a\x09^ false",
  26344. messageSends: [],
  26345. referencedClasses: []
  26346. }),
  26347. globals.IRReturn);
  26348. smalltalk.addMethod(
  26349. smalltalk.method({
  26350. selector: "isBlockReturn",
  26351. protocol: 'testing',
  26352. fn: function (){
  26353. var self=this;
  26354. return false;
  26355. },
  26356. args: [],
  26357. source: "isBlockReturn\x0a\x09^ false",
  26358. messageSends: [],
  26359. referencedClasses: []
  26360. }),
  26361. globals.IRReturn);
  26362. smalltalk.addMethod(
  26363. smalltalk.method({
  26364. selector: "isLocalReturn",
  26365. protocol: 'testing',
  26366. fn: function (){
  26367. var self=this;
  26368. return true;
  26369. },
  26370. args: [],
  26371. source: "isLocalReturn\x0a\x09^ true",
  26372. messageSends: [],
  26373. referencedClasses: []
  26374. }),
  26375. globals.IRReturn);
  26376. smalltalk.addMethod(
  26377. smalltalk.method({
  26378. selector: "isNonLocalReturn",
  26379. protocol: 'testing',
  26380. fn: function (){
  26381. var self=this;
  26382. return smalltalk.withContext(function($ctx1) {
  26383. var $1;
  26384. $1=_st(self._isLocalReturn())._not();
  26385. return $1;
  26386. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)})},
  26387. args: [],
  26388. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  26389. messageSends: ["not", "isLocalReturn"],
  26390. referencedClasses: []
  26391. }),
  26392. globals.IRReturn);
  26393. smalltalk.addMethod(
  26394. smalltalk.method({
  26395. selector: "isReturn",
  26396. protocol: 'testing',
  26397. fn: function (){
  26398. var self=this;
  26399. return true;
  26400. },
  26401. args: [],
  26402. source: "isReturn\x0a\x09^ true",
  26403. messageSends: [],
  26404. referencedClasses: []
  26405. }),
  26406. globals.IRReturn);
  26407. smalltalk.addMethod(
  26408. smalltalk.method({
  26409. selector: "scope",
  26410. protocol: 'accessing',
  26411. fn: function (){
  26412. var self=this;
  26413. return smalltalk.withContext(function($ctx1) {
  26414. var $2,$1,$receiver;
  26415. $2=self["@scope"];
  26416. if(($receiver = $2) == null || $receiver.isNil){
  26417. $1=_st(self._parent())._scope();
  26418. } else {
  26419. $1=$2;
  26420. };
  26421. return $1;
  26422. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)})},
  26423. args: [],
  26424. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  26425. messageSends: ["ifNil:", "scope", "parent"],
  26426. referencedClasses: []
  26427. }),
  26428. globals.IRReturn);
  26429. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  26430. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  26431. smalltalk.addMethod(
  26432. smalltalk.method({
  26433. selector: "accept:",
  26434. protocol: 'visiting',
  26435. fn: function (aVisitor){
  26436. var self=this;
  26437. return smalltalk.withContext(function($ctx1) {
  26438. var $1;
  26439. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  26440. return $1;
  26441. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)})},
  26442. args: ["aVisitor"],
  26443. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  26444. messageSends: ["visitIRBlockReturn:"],
  26445. referencedClasses: []
  26446. }),
  26447. globals.IRBlockReturn);
  26448. smalltalk.addMethod(
  26449. smalltalk.method({
  26450. selector: "isBlockReturn",
  26451. protocol: 'testing',
  26452. fn: function (){
  26453. var self=this;
  26454. return true;
  26455. },
  26456. args: [],
  26457. source: "isBlockReturn\x0a\x09^ true",
  26458. messageSends: [],
  26459. referencedClasses: []
  26460. }),
  26461. globals.IRBlockReturn);
  26462. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  26463. globals.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JavaScript statement.\x0a\x0aSee `IRNonLocalReturnHandling` class.";
  26464. smalltalk.addMethod(
  26465. smalltalk.method({
  26466. selector: "accept:",
  26467. protocol: 'visiting',
  26468. fn: function (aVisitor){
  26469. var self=this;
  26470. return smalltalk.withContext(function($ctx1) {
  26471. var $1;
  26472. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  26473. return $1;
  26474. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)})},
  26475. args: ["aVisitor"],
  26476. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  26477. messageSends: ["visitIRNonLocalReturn:"],
  26478. referencedClasses: []
  26479. }),
  26480. globals.IRNonLocalReturn);
  26481. smalltalk.addMethod(
  26482. smalltalk.method({
  26483. selector: "isLocalReturn",
  26484. protocol: 'testing',
  26485. fn: function (){
  26486. var self=this;
  26487. return false;
  26488. },
  26489. args: [],
  26490. source: "isLocalReturn\x0a\x09^ false",
  26491. messageSends: [],
  26492. referencedClasses: []
  26493. }),
  26494. globals.IRNonLocalReturn);
  26495. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  26496. smalltalk.addMethod(
  26497. smalltalk.method({
  26498. selector: "accept:",
  26499. protocol: 'visiting',
  26500. fn: function (aVisitor){
  26501. var self=this;
  26502. return smalltalk.withContext(function($ctx1) {
  26503. var $1;
  26504. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  26505. return $1;
  26506. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)})},
  26507. args: ["aVisitor"],
  26508. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  26509. messageSends: ["visitIRTempDeclaration:"],
  26510. referencedClasses: []
  26511. }),
  26512. globals.IRTempDeclaration);
  26513. smalltalk.addMethod(
  26514. smalltalk.method({
  26515. selector: "isTempDeclaration",
  26516. protocol: 'testing',
  26517. fn: function (){
  26518. var self=this;
  26519. return true;
  26520. },
  26521. args: [],
  26522. source: "isTempDeclaration\x0a\x09^ true",
  26523. messageSends: [],
  26524. referencedClasses: []
  26525. }),
  26526. globals.IRTempDeclaration);
  26527. smalltalk.addMethod(
  26528. smalltalk.method({
  26529. selector: "name",
  26530. protocol: 'accessing',
  26531. fn: function (){
  26532. var self=this;
  26533. var $1;
  26534. $1=self["@name"];
  26535. return $1;
  26536. },
  26537. args: [],
  26538. source: "name\x0a\x09^ name",
  26539. messageSends: [],
  26540. referencedClasses: []
  26541. }),
  26542. globals.IRTempDeclaration);
  26543. smalltalk.addMethod(
  26544. smalltalk.method({
  26545. selector: "name:",
  26546. protocol: 'accessing',
  26547. fn: function (aString){
  26548. var self=this;
  26549. self["@name"]=aString;
  26550. return self},
  26551. args: ["aString"],
  26552. source: "name: aString\x0a\x09name := aString",
  26553. messageSends: [],
  26554. referencedClasses: []
  26555. }),
  26556. globals.IRTempDeclaration);
  26557. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  26558. globals.IRSend.comment="I am a message send instruction.";
  26559. smalltalk.addMethod(
  26560. smalltalk.method({
  26561. selector: "accept:",
  26562. protocol: 'visiting',
  26563. fn: function (aVisitor){
  26564. var self=this;
  26565. return smalltalk.withContext(function($ctx1) {
  26566. var $1;
  26567. $1=_st(aVisitor)._visitIRSend_(self);
  26568. return $1;
  26569. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)})},
  26570. args: ["aVisitor"],
  26571. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  26572. messageSends: ["visitIRSend:"],
  26573. referencedClasses: []
  26574. }),
  26575. globals.IRSend);
  26576. smalltalk.addMethod(
  26577. smalltalk.method({
  26578. selector: "classSend",
  26579. protocol: 'accessing',
  26580. fn: function (){
  26581. var self=this;
  26582. var $1;
  26583. $1=self["@classSend"];
  26584. return $1;
  26585. },
  26586. args: [],
  26587. source: "classSend\x0a\x09^ classSend",
  26588. messageSends: [],
  26589. referencedClasses: []
  26590. }),
  26591. globals.IRSend);
  26592. smalltalk.addMethod(
  26593. smalltalk.method({
  26594. selector: "classSend:",
  26595. protocol: 'accessing',
  26596. fn: function (aClass){
  26597. var self=this;
  26598. self["@classSend"]=aClass;
  26599. return self},
  26600. args: ["aClass"],
  26601. source: "classSend: aClass\x0a\x09classSend := aClass",
  26602. messageSends: [],
  26603. referencedClasses: []
  26604. }),
  26605. globals.IRSend);
  26606. smalltalk.addMethod(
  26607. smalltalk.method({
  26608. selector: "index",
  26609. protocol: 'accessing',
  26610. fn: function (){
  26611. var self=this;
  26612. var $1;
  26613. $1=self["@index"];
  26614. return $1;
  26615. },
  26616. args: [],
  26617. source: "index\x0a\x09^ index",
  26618. messageSends: [],
  26619. referencedClasses: []
  26620. }),
  26621. globals.IRSend);
  26622. smalltalk.addMethod(
  26623. smalltalk.method({
  26624. selector: "index:",
  26625. protocol: 'accessing',
  26626. fn: function (anInteger){
  26627. var self=this;
  26628. self["@index"]=anInteger;
  26629. return self},
  26630. args: ["anInteger"],
  26631. source: "index: anInteger\x0a\x09index := anInteger",
  26632. messageSends: [],
  26633. referencedClasses: []
  26634. }),
  26635. globals.IRSend);
  26636. smalltalk.addMethod(
  26637. smalltalk.method({
  26638. selector: "isSend",
  26639. protocol: 'testing',
  26640. fn: function (){
  26641. var self=this;
  26642. return true;
  26643. },
  26644. args: [],
  26645. source: "isSend\x0a\x09^ true",
  26646. messageSends: [],
  26647. referencedClasses: []
  26648. }),
  26649. globals.IRSend);
  26650. smalltalk.addMethod(
  26651. smalltalk.method({
  26652. selector: "selector",
  26653. protocol: 'accessing',
  26654. fn: function (){
  26655. var self=this;
  26656. var $1;
  26657. $1=self["@selector"];
  26658. return $1;
  26659. },
  26660. args: [],
  26661. source: "selector\x0a\x09^ selector",
  26662. messageSends: [],
  26663. referencedClasses: []
  26664. }),
  26665. globals.IRSend);
  26666. smalltalk.addMethod(
  26667. smalltalk.method({
  26668. selector: "selector:",
  26669. protocol: 'accessing',
  26670. fn: function (aString){
  26671. var self=this;
  26672. self["@selector"]=aString;
  26673. return self},
  26674. args: ["aString"],
  26675. source: "selector: aString\x0a\x09selector := aString",
  26676. messageSends: [],
  26677. referencedClasses: []
  26678. }),
  26679. globals.IRSend);
  26680. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  26681. smalltalk.addMethod(
  26682. smalltalk.method({
  26683. selector: "accept:",
  26684. protocol: 'visiting',
  26685. fn: function (aVisitor){
  26686. var self=this;
  26687. return smalltalk.withContext(function($ctx1) {
  26688. var $1;
  26689. $1=_st(aVisitor)._visitIRSequence_(self);
  26690. return $1;
  26691. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)})},
  26692. args: ["aVisitor"],
  26693. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  26694. messageSends: ["visitIRSequence:"],
  26695. referencedClasses: []
  26696. }),
  26697. globals.IRSequence);
  26698. smalltalk.addMethod(
  26699. smalltalk.method({
  26700. selector: "isSequence",
  26701. protocol: 'testing',
  26702. fn: function (){
  26703. var self=this;
  26704. return true;
  26705. },
  26706. args: [],
  26707. source: "isSequence\x0a\x09^ true",
  26708. messageSends: [],
  26709. referencedClasses: []
  26710. }),
  26711. globals.IRSequence);
  26712. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  26713. smalltalk.addMethod(
  26714. smalltalk.method({
  26715. selector: "accept:",
  26716. protocol: 'visiting',
  26717. fn: function (aVisitor){
  26718. var self=this;
  26719. return smalltalk.withContext(function($ctx1) {
  26720. var $1;
  26721. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  26722. return $1;
  26723. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)})},
  26724. args: ["aVisitor"],
  26725. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  26726. messageSends: ["visitIRBlockSequence:"],
  26727. referencedClasses: []
  26728. }),
  26729. globals.IRBlockSequence);
  26730. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  26731. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  26732. smalltalk.addMethod(
  26733. smalltalk.method({
  26734. selector: "accept:",
  26735. protocol: 'visiting',
  26736. fn: function (aVisitor){
  26737. var self=this;
  26738. return smalltalk.withContext(function($ctx1) {
  26739. var $1;
  26740. $1=_st(aVisitor)._visitIRValue_(self);
  26741. return $1;
  26742. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)})},
  26743. args: ["aVisitor"],
  26744. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  26745. messageSends: ["visitIRValue:"],
  26746. referencedClasses: []
  26747. }),
  26748. globals.IRValue);
  26749. smalltalk.addMethod(
  26750. smalltalk.method({
  26751. selector: "needsBoxingAsReceiver",
  26752. protocol: 'testing',
  26753. fn: function (){
  26754. var self=this;
  26755. return false;
  26756. },
  26757. args: [],
  26758. source: "needsBoxingAsReceiver\x0a\x09^ false",
  26759. messageSends: [],
  26760. referencedClasses: []
  26761. }),
  26762. globals.IRValue);
  26763. smalltalk.addMethod(
  26764. smalltalk.method({
  26765. selector: "value",
  26766. protocol: 'accessing',
  26767. fn: function (){
  26768. var self=this;
  26769. var $1;
  26770. $1=self["@value"];
  26771. return $1;
  26772. },
  26773. args: [],
  26774. source: "value\x0a\x09^ value",
  26775. messageSends: [],
  26776. referencedClasses: []
  26777. }),
  26778. globals.IRValue);
  26779. smalltalk.addMethod(
  26780. smalltalk.method({
  26781. selector: "value:",
  26782. protocol: 'accessing',
  26783. fn: function (aString){
  26784. var self=this;
  26785. self["@value"]=aString;
  26786. return self},
  26787. args: ["aString"],
  26788. source: "value: aString\x0a\x09value := aString",
  26789. messageSends: [],
  26790. referencedClasses: []
  26791. }),
  26792. globals.IRValue);
  26793. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  26794. globals.IRVariable.comment="I am a variable instruction.";
  26795. smalltalk.addMethod(
  26796. smalltalk.method({
  26797. selector: "accept:",
  26798. protocol: 'visiting',
  26799. fn: function (aVisitor){
  26800. var self=this;
  26801. return smalltalk.withContext(function($ctx1) {
  26802. var $1;
  26803. $1=_st(aVisitor)._visitIRVariable_(self);
  26804. return $1;
  26805. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)})},
  26806. args: ["aVisitor"],
  26807. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  26808. messageSends: ["visitIRVariable:"],
  26809. referencedClasses: []
  26810. }),
  26811. globals.IRVariable);
  26812. smalltalk.addMethod(
  26813. smalltalk.method({
  26814. selector: "isVariable",
  26815. protocol: 'testing',
  26816. fn: function (){
  26817. var self=this;
  26818. return true;
  26819. },
  26820. args: [],
  26821. source: "isVariable\x0a\x09^ true",
  26822. messageSends: [],
  26823. referencedClasses: []
  26824. }),
  26825. globals.IRVariable);
  26826. smalltalk.addMethod(
  26827. smalltalk.method({
  26828. selector: "needsBoxingAsReceiver",
  26829. protocol: 'testing',
  26830. fn: function (){
  26831. var self=this;
  26832. return smalltalk.withContext(function($ctx1) {
  26833. var $1;
  26834. $1=_st(_st(self._variable())._isPseudoVar())._not();
  26835. return $1;
  26836. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)})},
  26837. args: [],
  26838. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  26839. messageSends: ["not", "isPseudoVar", "variable"],
  26840. referencedClasses: []
  26841. }),
  26842. globals.IRVariable);
  26843. smalltalk.addMethod(
  26844. smalltalk.method({
  26845. selector: "variable",
  26846. protocol: 'accessing',
  26847. fn: function (){
  26848. var self=this;
  26849. var $1;
  26850. $1=self["@variable"];
  26851. return $1;
  26852. },
  26853. args: [],
  26854. source: "variable\x0a\x09^ variable",
  26855. messageSends: [],
  26856. referencedClasses: []
  26857. }),
  26858. globals.IRVariable);
  26859. smalltalk.addMethod(
  26860. smalltalk.method({
  26861. selector: "variable:",
  26862. protocol: 'accessing',
  26863. fn: function (aScopeVariable){
  26864. var self=this;
  26865. self["@variable"]=aScopeVariable;
  26866. return self},
  26867. args: ["aScopeVariable"],
  26868. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  26869. messageSends: [],
  26870. referencedClasses: []
  26871. }),
  26872. globals.IRVariable);
  26873. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  26874. smalltalk.addMethod(
  26875. smalltalk.method({
  26876. selector: "accept:",
  26877. protocol: 'visiting',
  26878. fn: function (aVisitor){
  26879. var self=this;
  26880. return smalltalk.withContext(function($ctx1) {
  26881. var $1;
  26882. $1=_st(aVisitor)._visitIRVerbatim_(self);
  26883. return $1;
  26884. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)})},
  26885. args: ["aVisitor"],
  26886. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  26887. messageSends: ["visitIRVerbatim:"],
  26888. referencedClasses: []
  26889. }),
  26890. globals.IRVerbatim);
  26891. smalltalk.addMethod(
  26892. smalltalk.method({
  26893. selector: "source",
  26894. protocol: 'accessing',
  26895. fn: function (){
  26896. var self=this;
  26897. var $1;
  26898. $1=self["@source"];
  26899. return $1;
  26900. },
  26901. args: [],
  26902. source: "source\x0a\x09^ source",
  26903. messageSends: [],
  26904. referencedClasses: []
  26905. }),
  26906. globals.IRVerbatim);
  26907. smalltalk.addMethod(
  26908. smalltalk.method({
  26909. selector: "source:",
  26910. protocol: 'accessing',
  26911. fn: function (aString){
  26912. var self=this;
  26913. self["@source"]=aString;
  26914. return self},
  26915. args: ["aString"],
  26916. source: "source: aString\x0a\x09source := aString",
  26917. messageSends: [],
  26918. referencedClasses: []
  26919. }),
  26920. globals.IRVerbatim);
  26921. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  26922. smalltalk.addMethod(
  26923. smalltalk.method({
  26924. selector: "visit:",
  26925. protocol: 'visiting',
  26926. fn: function (anIRInstruction){
  26927. var self=this;
  26928. return smalltalk.withContext(function($ctx1) {
  26929. var $1;
  26930. $1=_st(anIRInstruction)._accept_(self);
  26931. return $1;
  26932. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  26933. args: ["anIRInstruction"],
  26934. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  26935. messageSends: ["accept:"],
  26936. referencedClasses: []
  26937. }),
  26938. globals.IRVisitor);
  26939. smalltalk.addMethod(
  26940. smalltalk.method({
  26941. selector: "visitIRAssignment:",
  26942. protocol: 'visiting',
  26943. fn: function (anIRAssignment){
  26944. var self=this;
  26945. return smalltalk.withContext(function($ctx1) {
  26946. var $1;
  26947. $1=self._visitIRInstruction_(anIRAssignment);
  26948. return $1;
  26949. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)})},
  26950. args: ["anIRAssignment"],
  26951. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  26952. messageSends: ["visitIRInstruction:"],
  26953. referencedClasses: []
  26954. }),
  26955. globals.IRVisitor);
  26956. smalltalk.addMethod(
  26957. smalltalk.method({
  26958. selector: "visitIRBlockReturn:",
  26959. protocol: 'visiting',
  26960. fn: function (anIRBlockReturn){
  26961. var self=this;
  26962. return smalltalk.withContext(function($ctx1) {
  26963. var $1;
  26964. $1=self._visitIRReturn_(anIRBlockReturn);
  26965. return $1;
  26966. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)})},
  26967. args: ["anIRBlockReturn"],
  26968. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  26969. messageSends: ["visitIRReturn:"],
  26970. referencedClasses: []
  26971. }),
  26972. globals.IRVisitor);
  26973. smalltalk.addMethod(
  26974. smalltalk.method({
  26975. selector: "visitIRBlockSequence:",
  26976. protocol: 'visiting',
  26977. fn: function (anIRBlockSequence){
  26978. var self=this;
  26979. return smalltalk.withContext(function($ctx1) {
  26980. var $1;
  26981. $1=self._visitIRSequence_(anIRBlockSequence);
  26982. return $1;
  26983. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)})},
  26984. args: ["anIRBlockSequence"],
  26985. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  26986. messageSends: ["visitIRSequence:"],
  26987. referencedClasses: []
  26988. }),
  26989. globals.IRVisitor);
  26990. smalltalk.addMethod(
  26991. smalltalk.method({
  26992. selector: "visitIRClosure:",
  26993. protocol: 'visiting',
  26994. fn: function (anIRClosure){
  26995. var self=this;
  26996. return smalltalk.withContext(function($ctx1) {
  26997. var $1;
  26998. $1=self._visitIRInstruction_(anIRClosure);
  26999. return $1;
  27000. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)})},
  27001. args: ["anIRClosure"],
  27002. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  27003. messageSends: ["visitIRInstruction:"],
  27004. referencedClasses: []
  27005. }),
  27006. globals.IRVisitor);
  27007. smalltalk.addMethod(
  27008. smalltalk.method({
  27009. selector: "visitIRDynamicArray:",
  27010. protocol: 'visiting',
  27011. fn: function (anIRDynamicArray){
  27012. var self=this;
  27013. return smalltalk.withContext(function($ctx1) {
  27014. var $1;
  27015. $1=self._visitIRInstruction_(anIRDynamicArray);
  27016. return $1;
  27017. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)})},
  27018. args: ["anIRDynamicArray"],
  27019. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  27020. messageSends: ["visitIRInstruction:"],
  27021. referencedClasses: []
  27022. }),
  27023. globals.IRVisitor);
  27024. smalltalk.addMethod(
  27025. smalltalk.method({
  27026. selector: "visitIRDynamicDictionary:",
  27027. protocol: 'visiting',
  27028. fn: function (anIRDynamicDictionary){
  27029. var self=this;
  27030. return smalltalk.withContext(function($ctx1) {
  27031. var $1;
  27032. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  27033. return $1;
  27034. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)})},
  27035. args: ["anIRDynamicDictionary"],
  27036. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  27037. messageSends: ["visitIRInstruction:"],
  27038. referencedClasses: []
  27039. }),
  27040. globals.IRVisitor);
  27041. smalltalk.addMethod(
  27042. smalltalk.method({
  27043. selector: "visitIRInlinedClosure:",
  27044. protocol: 'visiting',
  27045. fn: function (anIRInlinedClosure){
  27046. var self=this;
  27047. return smalltalk.withContext(function($ctx1) {
  27048. var $1;
  27049. $1=self._visitIRClosure_(anIRInlinedClosure);
  27050. return $1;
  27051. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)})},
  27052. args: ["anIRInlinedClosure"],
  27053. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  27054. messageSends: ["visitIRClosure:"],
  27055. referencedClasses: []
  27056. }),
  27057. globals.IRVisitor);
  27058. smalltalk.addMethod(
  27059. smalltalk.method({
  27060. selector: "visitIRInlinedSequence:",
  27061. protocol: 'visiting',
  27062. fn: function (anIRInlinedSequence){
  27063. var self=this;
  27064. return smalltalk.withContext(function($ctx1) {
  27065. var $1;
  27066. $1=self._visitIRSequence_(anIRInlinedSequence);
  27067. return $1;
  27068. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)})},
  27069. args: ["anIRInlinedSequence"],
  27070. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  27071. messageSends: ["visitIRSequence:"],
  27072. referencedClasses: []
  27073. }),
  27074. globals.IRVisitor);
  27075. smalltalk.addMethod(
  27076. smalltalk.method({
  27077. selector: "visitIRInstruction:",
  27078. protocol: 'visiting',
  27079. fn: function (anIRInstruction){
  27080. var self=this;
  27081. return smalltalk.withContext(function($ctx1) {
  27082. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  27083. return smalltalk.withContext(function($ctx2) {
  27084. return self._visit_(each);
  27085. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  27086. return anIRInstruction;
  27087. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)})},
  27088. args: ["anIRInstruction"],
  27089. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  27090. messageSends: ["do:", "instructions", "visit:"],
  27091. referencedClasses: []
  27092. }),
  27093. globals.IRVisitor);
  27094. smalltalk.addMethod(
  27095. smalltalk.method({
  27096. selector: "visitIRMethod:",
  27097. protocol: 'visiting',
  27098. fn: function (anIRMethod){
  27099. var self=this;
  27100. return smalltalk.withContext(function($ctx1) {
  27101. var $1;
  27102. $1=self._visitIRInstruction_(anIRMethod);
  27103. return $1;
  27104. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)})},
  27105. args: ["anIRMethod"],
  27106. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  27107. messageSends: ["visitIRInstruction:"],
  27108. referencedClasses: []
  27109. }),
  27110. globals.IRVisitor);
  27111. smalltalk.addMethod(
  27112. smalltalk.method({
  27113. selector: "visitIRNonLocalReturn:",
  27114. protocol: 'visiting',
  27115. fn: function (anIRNonLocalReturn){
  27116. var self=this;
  27117. return smalltalk.withContext(function($ctx1) {
  27118. var $1;
  27119. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  27120. return $1;
  27121. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)})},
  27122. args: ["anIRNonLocalReturn"],
  27123. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  27124. messageSends: ["visitIRInstruction:"],
  27125. referencedClasses: []
  27126. }),
  27127. globals.IRVisitor);
  27128. smalltalk.addMethod(
  27129. smalltalk.method({
  27130. selector: "visitIRNonLocalReturnHandling:",
  27131. protocol: 'visiting',
  27132. fn: function (anIRNonLocalReturnHandling){
  27133. var self=this;
  27134. return smalltalk.withContext(function($ctx1) {
  27135. var $1;
  27136. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  27137. return $1;
  27138. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)})},
  27139. args: ["anIRNonLocalReturnHandling"],
  27140. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  27141. messageSends: ["visitIRInstruction:"],
  27142. referencedClasses: []
  27143. }),
  27144. globals.IRVisitor);
  27145. smalltalk.addMethod(
  27146. smalltalk.method({
  27147. selector: "visitIRReturn:",
  27148. protocol: 'visiting',
  27149. fn: function (anIRReturn){
  27150. var self=this;
  27151. return smalltalk.withContext(function($ctx1) {
  27152. var $1;
  27153. $1=self._visitIRInstruction_(anIRReturn);
  27154. return $1;
  27155. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)})},
  27156. args: ["anIRReturn"],
  27157. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  27158. messageSends: ["visitIRInstruction:"],
  27159. referencedClasses: []
  27160. }),
  27161. globals.IRVisitor);
  27162. smalltalk.addMethod(
  27163. smalltalk.method({
  27164. selector: "visitIRSend:",
  27165. protocol: 'visiting',
  27166. fn: function (anIRSend){
  27167. var self=this;
  27168. return smalltalk.withContext(function($ctx1) {
  27169. var $1;
  27170. $1=self._visitIRInstruction_(anIRSend);
  27171. return $1;
  27172. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)})},
  27173. args: ["anIRSend"],
  27174. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  27175. messageSends: ["visitIRInstruction:"],
  27176. referencedClasses: []
  27177. }),
  27178. globals.IRVisitor);
  27179. smalltalk.addMethod(
  27180. smalltalk.method({
  27181. selector: "visitIRSequence:",
  27182. protocol: 'visiting',
  27183. fn: function (anIRSequence){
  27184. var self=this;
  27185. return smalltalk.withContext(function($ctx1) {
  27186. var $1;
  27187. $1=self._visitIRInstruction_(anIRSequence);
  27188. return $1;
  27189. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)})},
  27190. args: ["anIRSequence"],
  27191. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  27192. messageSends: ["visitIRInstruction:"],
  27193. referencedClasses: []
  27194. }),
  27195. globals.IRVisitor);
  27196. smalltalk.addMethod(
  27197. smalltalk.method({
  27198. selector: "visitIRTempDeclaration:",
  27199. protocol: 'visiting',
  27200. fn: function (anIRTempDeclaration){
  27201. var self=this;
  27202. return smalltalk.withContext(function($ctx1) {
  27203. var $1;
  27204. $1=self._visitIRInstruction_(anIRTempDeclaration);
  27205. return $1;
  27206. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)})},
  27207. args: ["anIRTempDeclaration"],
  27208. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  27209. messageSends: ["visitIRInstruction:"],
  27210. referencedClasses: []
  27211. }),
  27212. globals.IRVisitor);
  27213. smalltalk.addMethod(
  27214. smalltalk.method({
  27215. selector: "visitIRValue:",
  27216. protocol: 'visiting',
  27217. fn: function (anIRValue){
  27218. var self=this;
  27219. return smalltalk.withContext(function($ctx1) {
  27220. var $1;
  27221. $1=self._visitIRInstruction_(anIRValue);
  27222. return $1;
  27223. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)})},
  27224. args: ["anIRValue"],
  27225. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  27226. messageSends: ["visitIRInstruction:"],
  27227. referencedClasses: []
  27228. }),
  27229. globals.IRVisitor);
  27230. smalltalk.addMethod(
  27231. smalltalk.method({
  27232. selector: "visitIRVariable:",
  27233. protocol: 'visiting',
  27234. fn: function (anIRVariable){
  27235. var self=this;
  27236. return smalltalk.withContext(function($ctx1) {
  27237. var $1;
  27238. $1=self._visitIRInstruction_(anIRVariable);
  27239. return $1;
  27240. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)})},
  27241. args: ["anIRVariable"],
  27242. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  27243. messageSends: ["visitIRInstruction:"],
  27244. referencedClasses: []
  27245. }),
  27246. globals.IRVisitor);
  27247. smalltalk.addMethod(
  27248. smalltalk.method({
  27249. selector: "visitIRVerbatim:",
  27250. protocol: 'visiting',
  27251. fn: function (anIRVerbatim){
  27252. var self=this;
  27253. return smalltalk.withContext(function($ctx1) {
  27254. var $1;
  27255. $1=self._visitIRInstruction_(anIRVerbatim);
  27256. return $1;
  27257. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)})},
  27258. args: ["anIRVerbatim"],
  27259. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  27260. messageSends: ["visitIRInstruction:"],
  27261. referencedClasses: []
  27262. }),
  27263. globals.IRVisitor);
  27264. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  27265. smalltalk.addMethod(
  27266. smalltalk.method({
  27267. selector: "contents",
  27268. protocol: 'accessing',
  27269. fn: function (){
  27270. var self=this;
  27271. return smalltalk.withContext(function($ctx1) {
  27272. var $1;
  27273. $1=_st(self._stream())._contents();
  27274. return $1;
  27275. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)})},
  27276. args: [],
  27277. source: "contents\x0a\x09^ self stream contents",
  27278. messageSends: ["contents", "stream"],
  27279. referencedClasses: []
  27280. }),
  27281. globals.IRJSTranslator);
  27282. smalltalk.addMethod(
  27283. smalltalk.method({
  27284. selector: "currentClass",
  27285. protocol: 'accessing',
  27286. fn: function (){
  27287. var self=this;
  27288. var $1;
  27289. $1=self["@currentClass"];
  27290. return $1;
  27291. },
  27292. args: [],
  27293. source: "currentClass\x0a\x09^ currentClass",
  27294. messageSends: [],
  27295. referencedClasses: []
  27296. }),
  27297. globals.IRJSTranslator);
  27298. smalltalk.addMethod(
  27299. smalltalk.method({
  27300. selector: "currentClass:",
  27301. protocol: 'accessing',
  27302. fn: function (aClass){
  27303. var self=this;
  27304. self["@currentClass"]=aClass;
  27305. return self},
  27306. args: ["aClass"],
  27307. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  27308. messageSends: [],
  27309. referencedClasses: []
  27310. }),
  27311. globals.IRJSTranslator);
  27312. smalltalk.addMethod(
  27313. smalltalk.method({
  27314. selector: "initialize",
  27315. protocol: 'initialization',
  27316. fn: function (){
  27317. var self=this;
  27318. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  27319. return smalltalk.withContext(function($ctx1) {
  27320. ($ctx1.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
  27321. $ctx1.supercall = false;
  27322. self["@stream"]=_st($JSStream())._new();
  27323. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)})},
  27324. args: [],
  27325. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  27326. messageSends: ["initialize", "new"],
  27327. referencedClasses: ["JSStream"]
  27328. }),
  27329. globals.IRJSTranslator);
  27330. smalltalk.addMethod(
  27331. smalltalk.method({
  27332. selector: "stream",
  27333. protocol: 'accessing',
  27334. fn: function (){
  27335. var self=this;
  27336. var $1;
  27337. $1=self["@stream"];
  27338. return $1;
  27339. },
  27340. args: [],
  27341. source: "stream\x0a\x09^ stream",
  27342. messageSends: [],
  27343. referencedClasses: []
  27344. }),
  27345. globals.IRJSTranslator);
  27346. smalltalk.addMethod(
  27347. smalltalk.method({
  27348. selector: "stream:",
  27349. protocol: 'accessing',
  27350. fn: function (aStream){
  27351. var self=this;
  27352. self["@stream"]=aStream;
  27353. return self},
  27354. args: ["aStream"],
  27355. source: "stream: aStream\x0a\x09stream := aStream",
  27356. messageSends: [],
  27357. referencedClasses: []
  27358. }),
  27359. globals.IRJSTranslator);
  27360. smalltalk.addMethod(
  27361. smalltalk.method({
  27362. selector: "visitIRAssignment:",
  27363. protocol: 'visiting',
  27364. fn: function (anIRAssignment){
  27365. var self=this;
  27366. return smalltalk.withContext(function($ctx1) {
  27367. var $2,$1;
  27368. $2=_st(anIRAssignment)._instructions();
  27369. $ctx1.sendIdx["instructions"]=1;
  27370. $1=_st($2)._first();
  27371. self._visit_($1);
  27372. $ctx1.sendIdx["visit:"]=1;
  27373. _st(self._stream())._nextPutAssignment();
  27374. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  27375. return self}, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)})},
  27376. args: ["anIRAssignment"],
  27377. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  27378. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  27379. referencedClasses: []
  27380. }),
  27381. globals.IRJSTranslator);
  27382. smalltalk.addMethod(
  27383. smalltalk.method({
  27384. selector: "visitIRClosure:",
  27385. protocol: 'visiting',
  27386. fn: function (anIRClosure){
  27387. var self=this;
  27388. return smalltalk.withContext(function($ctx1) {
  27389. var $1,$2;
  27390. $1=self._stream();
  27391. $ctx1.sendIdx["stream"]=1;
  27392. _st($1)._nextPutClosureWith_arguments_((function(){
  27393. return smalltalk.withContext(function($ctx2) {
  27394. $2=self._stream();
  27395. $ctx2.sendIdx["stream"]=2;
  27396. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  27397. return smalltalk.withContext(function($ctx3) {
  27398. return _st(_st(each)._name())._asVariableName();
  27399. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})})));
  27400. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  27401. return smalltalk.withContext(function($ctx3) {
  27402. return ($ctx3.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
  27403. $ctx3.supercall = false;
  27404. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  27405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),_st(anIRClosure)._arguments());
  27406. return self}, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)})},
  27407. args: ["anIRClosure"],
  27408. source: "visitIRClosure: anIRClosure\x0a\x09self stream\x0a\x09\x09nextPutClosureWith: [\x0a\x09\x09\x09self stream nextPutVars: (anIRClosure tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09self stream\x0a\x09\x09\x09\x09nextPutBlockContextFor: anIRClosure\x0a\x09\x09\x09\x09during: [ super visitIRClosure: anIRClosure ] ]\x0a\x09\x09arguments: anIRClosure arguments",
  27409. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"],
  27410. referencedClasses: []
  27411. }),
  27412. globals.IRJSTranslator);
  27413. smalltalk.addMethod(
  27414. smalltalk.method({
  27415. selector: "visitIRDynamicArray:",
  27416. protocol: 'visiting',
  27417. fn: function (anIRDynamicArray){
  27418. var self=this;
  27419. return smalltalk.withContext(function($ctx1) {
  27420. var $1;
  27421. $1=self._stream();
  27422. $ctx1.sendIdx["stream"]=1;
  27423. _st($1)._nextPutAll_("[");
  27424. $ctx1.sendIdx["nextPutAll:"]=1;
  27425. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  27426. return smalltalk.withContext(function($ctx2) {
  27427. return self._visit_(each);
  27428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  27429. return smalltalk.withContext(function($ctx2) {
  27430. return _st(self._stream())._nextPutAll_(",");
  27431. $ctx2.sendIdx["nextPutAll:"]=2;
  27432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27433. _st(self["@stream"])._nextPutAll_("]");
  27434. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)})},
  27435. args: ["anIRDynamicArray"],
  27436. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  27437. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  27438. referencedClasses: []
  27439. }),
  27440. globals.IRJSTranslator);
  27441. smalltalk.addMethod(
  27442. smalltalk.method({
  27443. selector: "visitIRDynamicDictionary:",
  27444. protocol: 'visiting',
  27445. fn: function (anIRDynamicDictionary){
  27446. var self=this;
  27447. return smalltalk.withContext(function($ctx1) {
  27448. var $1,$2;
  27449. $1=self._stream();
  27450. $ctx1.sendIdx["stream"]=1;
  27451. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  27452. $ctx1.sendIdx["nextPutAll:"]=1;
  27453. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  27454. return smalltalk.withContext(function($ctx2) {
  27455. return self._visit_(each);
  27456. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  27457. return smalltalk.withContext(function($ctx2) {
  27458. $2=self._stream();
  27459. $ctx2.sendIdx["stream"]=2;
  27460. return _st($2)._nextPutAll_(",");
  27461. $ctx2.sendIdx["nextPutAll:"]=2;
  27462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27463. _st(self._stream())._nextPutAll_("])");
  27464. return self}, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)})},
  27465. args: ["anIRDynamicDictionary"],
  27466. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'globals.HashedCollection._newFromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions\x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  27467. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"],
  27468. referencedClasses: []
  27469. }),
  27470. globals.IRJSTranslator);
  27471. smalltalk.addMethod(
  27472. smalltalk.method({
  27473. selector: "visitIRMethod:",
  27474. protocol: 'visiting',
  27475. fn: function (anIRMethod){
  27476. var self=this;
  27477. return smalltalk.withContext(function($ctx1) {
  27478. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  27479. $1=self._stream();
  27480. $ctx1.sendIdx["stream"]=1;
  27481. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  27482. return smalltalk.withContext(function($ctx2) {
  27483. $2=self._stream();
  27484. $ctx2.sendIdx["stream"]=2;
  27485. return _st($2)._nextPutFunctionWith_arguments_((function(){
  27486. return smalltalk.withContext(function($ctx3) {
  27487. $3=self._stream();
  27488. $ctx3.sendIdx["stream"]=3;
  27489. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  27490. return smalltalk.withContext(function($ctx4) {
  27491. return _st(_st(each)._name())._asVariableName();
  27492. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)})}));
  27493. $ctx3.sendIdx["collect:"]=1;
  27494. _st($3)._nextPutVars_($4);
  27495. $ctx3.sendIdx["nextPutVars:"]=1;
  27496. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  27497. return smalltalk.withContext(function($ctx4) {
  27498. $5=self._stream();
  27499. $ctx4.sendIdx["stream"]=4;
  27500. return _st($5)._nextPutClassRefFunction_(each);
  27501. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)})}));
  27502. $6=self._stream();
  27503. $ctx3.sendIdx["stream"]=5;
  27504. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  27505. return smalltalk.withContext(function($ctx4) {
  27506. $8=_st(anIRMethod)._internalVariables();
  27507. $ctx4.sendIdx["internalVariables"]=1;
  27508. $7=_st($8)._notEmpty();
  27509. if(smalltalk.assert($7)){
  27510. $9=self._stream();
  27511. $ctx4.sendIdx["stream"]=6;
  27512. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  27513. return smalltalk.withContext(function($ctx5) {
  27514. return _st(_st(each)._variable())._alias();
  27515. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)})})));
  27516. };
  27517. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  27518. if(smalltalk.assert($10)){
  27519. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  27520. return smalltalk.withContext(function($ctx5) {
  27521. return ($ctx5.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  27522. $ctx5.supercall = false;
  27523. $ctx5.sendIdx["visitIRMethod:"]=1;
  27524. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)})}));
  27525. } else {
  27526. return ($ctx4.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  27527. $ctx4.supercall = false;
  27528. };
  27529. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)})}));
  27530. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),_st(anIRMethod)._arguments());
  27531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27532. return self}, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)})},
  27533. args: ["anIRMethod"],
  27534. source: "visitIRMethod: anIRMethod\x0a\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod\x0a\x09\x09with: [ self stream\x0a\x09\x09\x09nextPutFunctionWith: [\x0a\x09\x09\x09\x09self stream nextPutVars: (anIRMethod tempDeclarations collect: [ :each |\x0a\x09\x09\x09\x09\x09each name asVariableName ]).\x0a\x09\x09\x09\x09anIRMethod classReferences do: [ :each | self stream nextPutClassRefFunction: each ].\x0a\x09\x09\x09\x09self stream nextPutContextFor: anIRMethod during: [\x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ] ]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ] ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  27535. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "classReferences", "nextPutClassRefFunction:", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"],
  27536. referencedClasses: []
  27537. }),
  27538. globals.IRJSTranslator);
  27539. smalltalk.addMethod(
  27540. smalltalk.method({
  27541. selector: "visitIRNonLocalReturn:",
  27542. protocol: 'visiting',
  27543. fn: function (anIRNonLocalReturn){
  27544. var self=this;
  27545. return smalltalk.withContext(function($ctx1) {
  27546. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  27547. return smalltalk.withContext(function($ctx2) {
  27548. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  27549. $ctx2.supercall = false;
  27550. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27551. return self}, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)})},
  27552. args: ["anIRNonLocalReturn"],
  27553. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  27554. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"],
  27555. referencedClasses: []
  27556. }),
  27557. globals.IRJSTranslator);
  27558. smalltalk.addMethod(
  27559. smalltalk.method({
  27560. selector: "visitIRReturn:",
  27561. protocol: 'visiting',
  27562. fn: function (anIRReturn){
  27563. var self=this;
  27564. return smalltalk.withContext(function($ctx1) {
  27565. _st(self._stream())._nextPutReturnWith_((function(){
  27566. return smalltalk.withContext(function($ctx2) {
  27567. return ($ctx2.supercall = true, globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  27568. $ctx2.supercall = false;
  27569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27570. return self}, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)})},
  27571. args: ["anIRReturn"],
  27572. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  27573. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"],
  27574. referencedClasses: []
  27575. }),
  27576. globals.IRJSTranslator);
  27577. smalltalk.addMethod(
  27578. smalltalk.method({
  27579. selector: "visitIRSend:",
  27580. protocol: 'visiting',
  27581. fn: function (anIRSend){
  27582. var self=this;
  27583. var sends;
  27584. return smalltalk.withContext(function($ctx1) {
  27585. var $1,$2,$receiver;
  27586. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  27587. $1=_st(anIRSend)._classSend();
  27588. if(($receiver = $1) == null || $receiver.isNil){
  27589. self._visitSend_(anIRSend);
  27590. } else {
  27591. self._visitSuperSend_(anIRSend);
  27592. };
  27593. $2=_st(_st(sends).__gt((1)))._and_((function(){
  27594. return smalltalk.withContext(function($ctx2) {
  27595. return _st(_st(anIRSend)._index()).__lt(sends);
  27596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  27597. if(smalltalk.assert($2)){
  27598. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  27599. };
  27600. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)})},
  27601. args: ["anIRSend"],
  27602. source: "visitIRSend: anIRSend\x0a\x09| sends |\x0a\x09sends := (anIRSend method sendIndexes at: anIRSend selector) size.\x0a\x09\x0a\x09anIRSend classSend\x0a\x09\x09ifNil: [ self visitSend: anIRSend ]\x0a\x09\x09ifNotNil: [ self visitSuperSend: anIRSend ].\x0a\x09\x09\x0a\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  27603. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"],
  27604. referencedClasses: []
  27605. }),
  27606. globals.IRJSTranslator);
  27607. smalltalk.addMethod(
  27608. smalltalk.method({
  27609. selector: "visitIRSequence:",
  27610. protocol: 'visiting',
  27611. fn: function (anIRSequence){
  27612. var self=this;
  27613. return smalltalk.withContext(function($ctx1) {
  27614. var $1;
  27615. $1=self._stream();
  27616. $ctx1.sendIdx["stream"]=1;
  27617. _st($1)._nextPutSequenceWith_((function(){
  27618. return smalltalk.withContext(function($ctx2) {
  27619. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  27620. return smalltalk.withContext(function($ctx3) {
  27621. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  27622. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  27623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27624. return self}, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)})},
  27625. args: ["anIRSequence"],
  27626. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  27627. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"],
  27628. referencedClasses: []
  27629. }),
  27630. globals.IRJSTranslator);
  27631. smalltalk.addMethod(
  27632. smalltalk.method({
  27633. selector: "visitIRTempDeclaration:",
  27634. protocol: 'visiting',
  27635. fn: function (anIRTempDeclaration){
  27636. var self=this;
  27637. return self},
  27638. args: ["anIRTempDeclaration"],
  27639. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  27640. messageSends: [],
  27641. referencedClasses: []
  27642. }),
  27643. globals.IRJSTranslator);
  27644. smalltalk.addMethod(
  27645. smalltalk.method({
  27646. selector: "visitIRValue:",
  27647. protocol: 'visiting',
  27648. fn: function (anIRValue){
  27649. var self=this;
  27650. return smalltalk.withContext(function($ctx1) {
  27651. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  27652. return self}, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)})},
  27653. args: ["anIRValue"],
  27654. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  27655. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"],
  27656. referencedClasses: []
  27657. }),
  27658. globals.IRJSTranslator);
  27659. smalltalk.addMethod(
  27660. smalltalk.method({
  27661. selector: "visitIRVariable:",
  27662. protocol: 'visiting',
  27663. fn: function (anIRVariable){
  27664. var self=this;
  27665. return smalltalk.withContext(function($ctx1) {
  27666. var $3,$2,$1,$4;
  27667. $3=_st(anIRVariable)._variable();
  27668. $ctx1.sendIdx["variable"]=1;
  27669. $2=_st($3)._name();
  27670. $1=_st($2).__eq("thisContext");
  27671. if(smalltalk.assert($1)){
  27672. $4=self._stream();
  27673. $ctx1.sendIdx["stream"]=1;
  27674. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  27675. $ctx1.sendIdx["nextPutAll:"]=1;
  27676. } else {
  27677. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  27678. };
  27679. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)})},
  27680. args: ["anIRVariable"],
  27681. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a\x09\x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a\x09\x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  27682. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"],
  27683. referencedClasses: []
  27684. }),
  27685. globals.IRJSTranslator);
  27686. smalltalk.addMethod(
  27687. smalltalk.method({
  27688. selector: "visitIRVerbatim:",
  27689. protocol: 'visiting',
  27690. fn: function (anIRVerbatim){
  27691. var self=this;
  27692. return smalltalk.withContext(function($ctx1) {
  27693. var $1;
  27694. $1=self._stream();
  27695. $ctx1.sendIdx["stream"]=1;
  27696. _st($1)._nextPutStatementWith_((function(){
  27697. return smalltalk.withContext(function($ctx2) {
  27698. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  27699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  27700. return self}, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)})},
  27701. args: ["anIRVerbatim"],
  27702. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  27703. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"],
  27704. referencedClasses: []
  27705. }),
  27706. globals.IRJSTranslator);
  27707. smalltalk.addMethod(
  27708. smalltalk.method({
  27709. selector: "visitReceiver:",
  27710. protocol: 'visiting',
  27711. fn: function (anIRInstruction){
  27712. var self=this;
  27713. return smalltalk.withContext(function($ctx1) {
  27714. var $1,$2,$3;
  27715. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  27716. if(! smalltalk.assert($1)){
  27717. $2=self._visit_(anIRInstruction);
  27718. $ctx1.sendIdx["visit:"]=1;
  27719. return $2;
  27720. };
  27721. $3=self._stream();
  27722. $ctx1.sendIdx["stream"]=1;
  27723. _st($3)._nextPutAll_("_st(");
  27724. $ctx1.sendIdx["nextPutAll:"]=1;
  27725. self._visit_(anIRInstruction);
  27726. _st(self._stream())._nextPutAll_(")");
  27727. return self}, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)})},
  27728. args: ["anIRInstruction"],
  27729. source: "visitReceiver: anIRInstruction\x0a\x09anIRInstruction needsBoxingAsReceiver ifFalse: [ ^ self visit: anIRInstruction ].\x0a\x09\x0a\x09self stream nextPutAll: '_st('.\x0a\x09self visit: anIRInstruction.\x0a\x09self stream nextPutAll: ')'",
  27730. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"],
  27731. referencedClasses: []
  27732. }),
  27733. globals.IRJSTranslator);
  27734. smalltalk.addMethod(
  27735. smalltalk.method({
  27736. selector: "visitSend:",
  27737. protocol: 'visiting',
  27738. fn: function (anIRSend){
  27739. var self=this;
  27740. return smalltalk.withContext(function($ctx1) {
  27741. var $2,$1,$3,$4,$5;
  27742. $2=_st(anIRSend)._instructions();
  27743. $ctx1.sendIdx["instructions"]=1;
  27744. $1=_st($2)._first();
  27745. self._visitReceiver_($1);
  27746. $3=self._stream();
  27747. $ctx1.sendIdx["stream"]=1;
  27748. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asSelector())).__comma("(");
  27749. $ctx1.sendIdx[","]=1;
  27750. _st($3)._nextPutAll_($4);
  27751. $ctx1.sendIdx["nextPutAll:"]=1;
  27752. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  27753. return smalltalk.withContext(function($ctx2) {
  27754. return self._visit_(each);
  27755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  27756. return smalltalk.withContext(function($ctx2) {
  27757. $5=self._stream();
  27758. $ctx2.sendIdx["stream"]=2;
  27759. return _st($5)._nextPutAll_(",");
  27760. $ctx2.sendIdx["nextPutAll:"]=2;
  27761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27762. _st(self._stream())._nextPutAll_(")");
  27763. return self}, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  27764. args: ["anIRSend"],
  27765. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asSelector, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  27766. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "visit:"],
  27767. referencedClasses: []
  27768. }),
  27769. globals.IRJSTranslator);
  27770. smalltalk.addMethod(
  27771. smalltalk.method({
  27772. selector: "visitSuperSend:",
  27773. protocol: 'visiting',
  27774. fn: function (anIRSend){
  27775. var self=this;
  27776. return smalltalk.withContext(function($ctx1) {
  27777. var $1,$2,$6,$5,$4,$3,$7,$8,$9,$11,$10,$12,$13,$14,$15;
  27778. $1=self._stream();
  27779. $ctx1.sendIdx["stream"]=1;
  27780. $2=$1;
  27781. $6=_st(anIRSend)._scope();
  27782. $ctx1.sendIdx["scope"]=1;
  27783. $5=_st($6)._alias();
  27784. $ctx1.sendIdx["alias"]=1;
  27785. $4="(".__comma($5);
  27786. $ctx1.sendIdx[","]=2;
  27787. $3=_st($4).__comma(".supercall = true, ");
  27788. $ctx1.sendIdx[","]=1;
  27789. _st($2)._nextPutAll_($3);
  27790. $ctx1.sendIdx["nextPutAll:"]=1;
  27791. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  27792. $ctx1.sendIdx["nextPutAll:"]=2;
  27793. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  27794. $ctx1.sendIdx["nextPutAll:"]=3;
  27795. $7=$1;
  27796. $8=_st(_st(_st(anIRSend)._selector())._asSelector()).__comma(".apply(");
  27797. $ctx1.sendIdx[","]=3;
  27798. _st($7)._nextPutAll_($8);
  27799. $ctx1.sendIdx["nextPutAll:"]=4;
  27800. $9=_st($1)._nextPutAll_("_st(");
  27801. $ctx1.sendIdx["nextPutAll:"]=5;
  27802. $11=_st(anIRSend)._instructions();
  27803. $ctx1.sendIdx["instructions"]=1;
  27804. $10=_st($11)._first();
  27805. self._visit_($10);
  27806. $ctx1.sendIdx["visit:"]=1;
  27807. $12=self._stream();
  27808. $ctx1.sendIdx["stream"]=2;
  27809. _st($12)._nextPutAll_("), [");
  27810. $ctx1.sendIdx["nextPutAll:"]=6;
  27811. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  27812. return smalltalk.withContext(function($ctx2) {
  27813. return self._visit_(each);
  27814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  27815. return smalltalk.withContext(function($ctx2) {
  27816. $13=self._stream();
  27817. $ctx2.sendIdx["stream"]=3;
  27818. return _st($13)._nextPutAll_(",");
  27819. $ctx2.sendIdx["nextPutAll:"]=7;
  27820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  27821. $14=self._stream();
  27822. _st($14)._nextPutAll_("]));");
  27823. $ctx1.sendIdx["nextPutAll:"]=8;
  27824. _st($14)._lf();
  27825. $15=_st($14)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false"));
  27826. return self}, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)})},
  27827. args: ["anIRSend"],
  27828. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '(', anIRSend scope alias, '.supercall = true, ';\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asSelector, '.apply(';\x0a\x09\x09nextPutAll: '_st('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: '), ['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream \x0a\x09\x09nextPutAll: ']));'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false'",
  27829. messageSends: ["nextPutAll:", "stream", ",", "alias", "scope", "asJavascript", "currentClass", "asSelector", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst", "lf"],
  27830. referencedClasses: []
  27831. }),
  27832. globals.IRJSTranslator);
  27833. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  27834. smalltalk.addMethod(
  27835. smalltalk.method({
  27836. selector: "contents",
  27837. protocol: 'accessing',
  27838. fn: function (){
  27839. var self=this;
  27840. return smalltalk.withContext(function($ctx1) {
  27841. var $1;
  27842. $1=_st(self["@stream"])._contents();
  27843. return $1;
  27844. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)})},
  27845. args: [],
  27846. source: "contents\x0a\x09^ stream contents",
  27847. messageSends: ["contents"],
  27848. referencedClasses: []
  27849. }),
  27850. globals.JSStream);
  27851. smalltalk.addMethod(
  27852. smalltalk.method({
  27853. selector: "initialize",
  27854. protocol: 'initialization',
  27855. fn: function (){
  27856. var self=this;
  27857. return smalltalk.withContext(function($ctx1) {
  27858. ($ctx1.supercall = true, globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
  27859. $ctx1.supercall = false;
  27860. self["@stream"]=""._writeStream();
  27861. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)})},
  27862. args: [],
  27863. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  27864. messageSends: ["initialize", "writeStream"],
  27865. referencedClasses: []
  27866. }),
  27867. globals.JSStream);
  27868. smalltalk.addMethod(
  27869. smalltalk.method({
  27870. selector: "lf",
  27871. protocol: 'streaming',
  27872. fn: function (){
  27873. var self=this;
  27874. return smalltalk.withContext(function($ctx1) {
  27875. _st(self["@stream"])._lf();
  27876. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)})},
  27877. args: [],
  27878. source: "lf\x0a\x09stream lf",
  27879. messageSends: ["lf"],
  27880. referencedClasses: []
  27881. }),
  27882. globals.JSStream);
  27883. smalltalk.addMethod(
  27884. smalltalk.method({
  27885. selector: "nextPut:",
  27886. protocol: 'streaming',
  27887. fn: function (aString){
  27888. var self=this;
  27889. return smalltalk.withContext(function($ctx1) {
  27890. _st(self["@stream"])._nextPut_(aString);
  27891. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)})},
  27892. args: ["aString"],
  27893. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  27894. messageSends: ["nextPut:"],
  27895. referencedClasses: []
  27896. }),
  27897. globals.JSStream);
  27898. smalltalk.addMethod(
  27899. smalltalk.method({
  27900. selector: "nextPutAll:",
  27901. protocol: 'streaming',
  27902. fn: function (aString){
  27903. var self=this;
  27904. return smalltalk.withContext(function($ctx1) {
  27905. _st(self["@stream"])._nextPutAll_(aString);
  27906. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)})},
  27907. args: ["aString"],
  27908. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  27909. messageSends: ["nextPutAll:"],
  27910. referencedClasses: []
  27911. }),
  27912. globals.JSStream);
  27913. smalltalk.addMethod(
  27914. smalltalk.method({
  27915. selector: "nextPutAssignment",
  27916. protocol: 'streaming',
  27917. fn: function (){
  27918. var self=this;
  27919. return smalltalk.withContext(function($ctx1) {
  27920. _st(self["@stream"])._nextPutAll_("=");
  27921. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)})},
  27922. args: [],
  27923. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  27924. messageSends: ["nextPutAll:"],
  27925. referencedClasses: []
  27926. }),
  27927. globals.JSStream);
  27928. smalltalk.addMethod(
  27929. smalltalk.method({
  27930. selector: "nextPutBlockContextFor:during:",
  27931. protocol: 'streaming',
  27932. fn: function (anIRClosure,aBlock){
  27933. var self=this;
  27934. return smalltalk.withContext(function($ctx1) {
  27935. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$24,$23,$22,$21,$20,$19,$18;
  27936. $1=_st(anIRClosure)._requiresSmalltalkContext();
  27937. if(! smalltalk.assert($1)){
  27938. $2=_st(aBlock)._value();
  27939. $ctx1.sendIdx["value"]=1;
  27940. return $2;
  27941. };
  27942. $6=_st(anIRClosure)._scope();
  27943. $ctx1.sendIdx["scope"]=1;
  27944. $5=_st($6)._alias();
  27945. $ctx1.sendIdx["alias"]=1;
  27946. $4="return smalltalk.withContext(function(".__comma($5);
  27947. $ctx1.sendIdx[","]=2;
  27948. $3=_st($4).__comma(") {");
  27949. $ctx1.sendIdx[","]=1;
  27950. self._nextPutAll_($3);
  27951. $ctx1.sendIdx["nextPutAll:"]=1;
  27952. $7=self._lf();
  27953. _st(aBlock)._value();
  27954. $11=_st(anIRClosure)._scope();
  27955. $ctx1.sendIdx["scope"]=2;
  27956. $10=_st($11)._alias();
  27957. $ctx1.sendIdx["alias"]=2;
  27958. $9="}, function(".__comma($10);
  27959. $ctx1.sendIdx[","]=4;
  27960. $8=_st($9).__comma(") {");
  27961. $ctx1.sendIdx[","]=3;
  27962. self._nextPutAll_($8);
  27963. $ctx1.sendIdx["nextPutAll:"]=2;
  27964. $15=_st(anIRClosure)._scope();
  27965. $ctx1.sendIdx["scope"]=3;
  27966. $14=_st($15)._alias();
  27967. $ctx1.sendIdx["alias"]=3;
  27968. $13=_st($14).__comma(".fillBlock({");
  27969. $ctx1.sendIdx[","]=5;
  27970. $12=self._nextPutAll_($13);
  27971. $ctx1.sendIdx["nextPutAll:"]=3;
  27972. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  27973. return smalltalk.withContext(function($ctx2) {
  27974. $16=_st(each)._asVariableName();
  27975. $ctx2.sendIdx["asVariableName"]=1;
  27976. self._nextPutAll_($16);
  27977. $ctx2.sendIdx["nextPutAll:"]=4;
  27978. self._nextPutAll_(":");
  27979. $ctx2.sendIdx["nextPutAll:"]=5;
  27980. $17=self._nextPutAll_(_st(each)._asVariableName());
  27981. $ctx2.sendIdx["nextPutAll:"]=6;
  27982. return $17;
  27983. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  27984. return smalltalk.withContext(function($ctx2) {
  27985. return self._nextPutAll_(",");
  27986. $ctx2.sendIdx["nextPutAll:"]=7;
  27987. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  27988. self._nextPutAll_("},");
  27989. $ctx1.sendIdx["nextPutAll:"]=8;
  27990. $24=_st(anIRClosure)._scope();
  27991. $ctx1.sendIdx["scope"]=4;
  27992. $23=_st($24)._outerScope();
  27993. $22=_st($23)._alias();
  27994. $21=_st($22).__comma(",");
  27995. $20=_st($21).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  27996. $ctx1.sendIdx[","]=7;
  27997. $19=_st($20).__comma(")})");
  27998. $ctx1.sendIdx[","]=6;
  27999. $18=self._nextPutAll_($19);
  28000. return self}, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)})},
  28001. args: ["anIRClosure", "aBlock"],
  28002. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {'; lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', anIRClosure scope alias, ') {';\x0a\x09\x09nextPutAll: anIRClosure scope alias, '.fillBlock({'.\x0a\x09\x0a\x09anIRClosure locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: anIRClosure scope outerScope alias, ',', anIRClosure scope blockIndex asString, ')})'",
  28003. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"],
  28004. referencedClasses: []
  28005. }),
  28006. globals.JSStream);
  28007. smalltalk.addMethod(
  28008. smalltalk.method({
  28009. selector: "nextPutClassRefFunction:",
  28010. protocol: 'streaming',
  28011. fn: function (aString){
  28012. var self=this;
  28013. return smalltalk.withContext(function($ctx1) {
  28014. var $1,$2;
  28015. $1=self["@stream"];
  28016. _st($1)._nextPutAll_("function $");
  28017. $ctx1.sendIdx["nextPutAll:"]=1;
  28018. _st($1)._nextPutAll_(aString);
  28019. $ctx1.sendIdx["nextPutAll:"]=2;
  28020. _st($1)._nextPutAll_("(){return globals.");
  28021. $ctx1.sendIdx["nextPutAll:"]=3;
  28022. _st($1)._nextPutAll_(aString);
  28023. $ctx1.sendIdx["nextPutAll:"]=4;
  28024. _st($1)._nextPutAll_("||(typeof ");
  28025. $ctx1.sendIdx["nextPutAll:"]=5;
  28026. _st($1)._nextPutAll_(aString);
  28027. $ctx1.sendIdx["nextPutAll:"]=6;
  28028. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  28029. $ctx1.sendIdx["nextPutAll:"]=7;
  28030. _st($1)._nextPutAll_(aString);
  28031. $ctx1.sendIdx["nextPutAll:"]=8;
  28032. _st($1)._nextPutAll_(")}");
  28033. $2=_st($1)._lf();
  28034. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)})},
  28035. args: ["aString"],
  28036. source: "nextPutClassRefFunction: aString\x0a\x09\x22Creates an inner function $aString into method and called as `$Foo()`whenever the global is accessed.\x0a\x09This ensures that undefined global access will answer `nil`\x22\x0a\x09\x0a\x09stream\x0a\x09\x09nextPutAll: 'function $';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '(){return globals.';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '||(typeof ';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: '==\x22undefined\x22?nil:';\x0a\x09\x09nextPutAll: aString;\x0a\x09\x09nextPutAll: ')}';\x0a\x09\x09lf",
  28037. messageSends: ["nextPutAll:", "lf"],
  28038. referencedClasses: []
  28039. }),
  28040. globals.JSStream);
  28041. smalltalk.addMethod(
  28042. smalltalk.method({
  28043. selector: "nextPutClosureWith:arguments:",
  28044. protocol: 'streaming',
  28045. fn: function (aBlock,anArray){
  28046. var self=this;
  28047. return smalltalk.withContext(function($ctx1) {
  28048. var $1,$2;
  28049. _st(self["@stream"])._nextPutAll_("(function(");
  28050. $ctx1.sendIdx["nextPutAll:"]=1;
  28051. _st(anArray)._do_separatedBy_((function(each){
  28052. return smalltalk.withContext(function($ctx2) {
  28053. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  28054. $ctx2.sendIdx["nextPutAll:"]=2;
  28055. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  28056. return smalltalk.withContext(function($ctx2) {
  28057. return _st(self["@stream"])._nextPut_(",");
  28058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  28059. $1=self["@stream"];
  28060. _st($1)._nextPutAll_("){");
  28061. $ctx1.sendIdx["nextPutAll:"]=3;
  28062. $2=_st($1)._lf();
  28063. _st(aBlock)._value();
  28064. _st(self["@stream"])._nextPutAll_("})");
  28065. return self}, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
  28066. args: ["aBlock", "anArray"],
  28067. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '})'",
  28068. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  28069. referencedClasses: []
  28070. }),
  28071. globals.JSStream);
  28072. smalltalk.addMethod(
  28073. smalltalk.method({
  28074. selector: "nextPutContextFor:during:",
  28075. protocol: 'streaming',
  28076. fn: function (aMethod,aBlock){
  28077. var self=this;
  28078. return smalltalk.withContext(function($ctx1) {
  28079. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  28080. $1=_st(aMethod)._requiresSmalltalkContext();
  28081. if(! smalltalk.assert($1)){
  28082. $2=_st(aBlock)._value();
  28083. $ctx1.sendIdx["value"]=1;
  28084. return $2;
  28085. };
  28086. $6=_st(aMethod)._scope();
  28087. $ctx1.sendIdx["scope"]=1;
  28088. $5=_st($6)._alias();
  28089. $ctx1.sendIdx["alias"]=1;
  28090. $4="return smalltalk.withContext(function(".__comma($5);
  28091. $ctx1.sendIdx[","]=2;
  28092. $3=_st($4).__comma(") { ");
  28093. $ctx1.sendIdx[","]=1;
  28094. self._nextPutAll_($3);
  28095. $ctx1.sendIdx["nextPutAll:"]=1;
  28096. $7=self._lf();
  28097. _st(aBlock)._value();
  28098. $12=_st(aMethod)._scope();
  28099. $ctx1.sendIdx["scope"]=2;
  28100. $11=_st($12)._alias();
  28101. $ctx1.sendIdx["alias"]=2;
  28102. $10="}, function(".__comma($11);
  28103. $ctx1.sendIdx[","]=5;
  28104. $9=_st($10).__comma(") {");
  28105. $ctx1.sendIdx[","]=4;
  28106. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  28107. $ctx1.sendIdx[","]=3;
  28108. self._nextPutAll_($8);
  28109. $ctx1.sendIdx["nextPutAll:"]=2;
  28110. $16=_st(_st(aMethod)._selector())._asJavascript();
  28111. $ctx1.sendIdx["asJavascript"]=1;
  28112. $15=".fill(self,".__comma($16);
  28113. $14=_st($15).__comma(",{");
  28114. $ctx1.sendIdx[","]=6;
  28115. $13=self._nextPutAll_($14);
  28116. $ctx1.sendIdx["nextPutAll:"]=3;
  28117. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  28118. return smalltalk.withContext(function($ctx2) {
  28119. $17=_st(each)._asVariableName();
  28120. $ctx2.sendIdx["asVariableName"]=1;
  28121. self._nextPutAll_($17);
  28122. $ctx2.sendIdx["nextPutAll:"]=4;
  28123. self._nextPutAll_(":");
  28124. $ctx2.sendIdx["nextPutAll:"]=5;
  28125. $18=self._nextPutAll_(_st(each)._asVariableName());
  28126. $ctx2.sendIdx["nextPutAll:"]=6;
  28127. return $18;
  28128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  28129. return smalltalk.withContext(function($ctx2) {
  28130. return self._nextPutAll_(",");
  28131. $ctx2.sendIdx["nextPutAll:"]=7;
  28132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  28133. self._nextPutAll_("},");
  28134. $ctx1.sendIdx["nextPutAll:"]=8;
  28135. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  28136. $ctx1.sendIdx["nextPutAll:"]=9;
  28137. $19=self._nextPutAll_(")})");
  28138. return self}, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
  28139. args: ["aMethod", "aBlock"],
  28140. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { '; lf.\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '}, function(', aMethod scope alias, ') {', aMethod scope alias;\x0a\x09\x09nextPutAll: '.fill(self,', aMethod selector asJavascript, ',{'.\x0a\x0a\x09aMethod locals\x0a\x09\x09do: [ :each |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09nextPutAll: each asVariableName;\x0a\x09\x09\x09\x09nextPutAll: ':';\x0a\x09\x09\x09\x09nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ self nextPutAll: ',' ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '},';\x0a\x09\x09nextPutAll: aMethod theClass asJavascript;\x0a\x09\x09nextPutAll: ')})'",
  28141. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", ",", "alias", "scope", "lf", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"],
  28142. referencedClasses: []
  28143. }),
  28144. globals.JSStream);
  28145. smalltalk.addMethod(
  28146. smalltalk.method({
  28147. selector: "nextPutFunctionWith:arguments:",
  28148. protocol: 'streaming',
  28149. fn: function (aBlock,anArray){
  28150. var self=this;
  28151. return smalltalk.withContext(function($ctx1) {
  28152. var $1,$2,$3,$4;
  28153. _st(self["@stream"])._nextPutAll_("fn: function(");
  28154. $ctx1.sendIdx["nextPutAll:"]=1;
  28155. _st(anArray)._do_separatedBy_((function(each){
  28156. return smalltalk.withContext(function($ctx2) {
  28157. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  28158. $ctx2.sendIdx["nextPutAll:"]=2;
  28159. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  28160. return smalltalk.withContext(function($ctx2) {
  28161. return _st(self["@stream"])._nextPut_(",");
  28162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  28163. $1=self["@stream"];
  28164. _st($1)._nextPutAll_("){");
  28165. $ctx1.sendIdx["nextPutAll:"]=3;
  28166. $2=_st($1)._lf();
  28167. $ctx1.sendIdx["lf"]=1;
  28168. $3=self["@stream"];
  28169. _st($3)._nextPutAll_("var self=this;");
  28170. $ctx1.sendIdx["nextPutAll:"]=4;
  28171. $4=_st($3)._lf();
  28172. _st(aBlock)._value();
  28173. _st(self["@stream"])._nextPutAll_("}");
  28174. return self}, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)})},
  28175. args: ["aBlock", "anArray"],
  28176. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray\x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '}'",
  28177. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  28178. referencedClasses: []
  28179. }),
  28180. globals.JSStream);
  28181. smalltalk.addMethod(
  28182. smalltalk.method({
  28183. selector: "nextPutIf:with:",
  28184. protocol: 'streaming',
  28185. fn: function (aBlock,anotherBlock){
  28186. var self=this;
  28187. return smalltalk.withContext(function($ctx1) {
  28188. var $1,$2;
  28189. _st(self["@stream"])._nextPutAll_("if(");
  28190. $ctx1.sendIdx["nextPutAll:"]=1;
  28191. _st(aBlock)._value();
  28192. $ctx1.sendIdx["value"]=1;
  28193. $1=self["@stream"];
  28194. _st($1)._nextPutAll_("){");
  28195. $ctx1.sendIdx["nextPutAll:"]=2;
  28196. $2=_st($1)._lf();
  28197. _st(anotherBlock)._value();
  28198. _st(self["@stream"])._nextPutAll_("}");
  28199. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)})},
  28200. args: ["aBlock", "anotherBlock"],
  28201. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  28202. messageSends: ["nextPutAll:", "value", "lf"],
  28203. referencedClasses: []
  28204. }),
  28205. globals.JSStream);
  28206. smalltalk.addMethod(
  28207. smalltalk.method({
  28208. selector: "nextPutIfElse:with:with:",
  28209. protocol: 'streaming',
  28210. fn: function (aBlock,ifBlock,elseBlock){
  28211. var self=this;
  28212. return smalltalk.withContext(function($ctx1) {
  28213. var $1,$2,$3,$4;
  28214. _st(self["@stream"])._nextPutAll_("if(");
  28215. $ctx1.sendIdx["nextPutAll:"]=1;
  28216. _st(aBlock)._value();
  28217. $ctx1.sendIdx["value"]=1;
  28218. $1=self["@stream"];
  28219. _st($1)._nextPutAll_("){");
  28220. $ctx1.sendIdx["nextPutAll:"]=2;
  28221. $2=_st($1)._lf();
  28222. $ctx1.sendIdx["lf"]=1;
  28223. _st(ifBlock)._value();
  28224. $ctx1.sendIdx["value"]=2;
  28225. $3=self["@stream"];
  28226. _st($3)._nextPutAll_("} else {");
  28227. $ctx1.sendIdx["nextPutAll:"]=3;
  28228. $4=_st($3)._lf();
  28229. _st(elseBlock)._value();
  28230. _st(self["@stream"])._nextPutAll_("}");
  28231. return self}, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)})},
  28232. args: ["aBlock", "ifBlock", "elseBlock"],
  28233. source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  28234. messageSends: ["nextPutAll:", "value", "lf"],
  28235. referencedClasses: []
  28236. }),
  28237. globals.JSStream);
  28238. smalltalk.addMethod(
  28239. smalltalk.method({
  28240. selector: "nextPutMethodDeclaration:with:",
  28241. protocol: 'streaming',
  28242. fn: function (aMethod,aBlock){
  28243. var self=this;
  28244. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  28245. return smalltalk.withContext(function($ctx1) {
  28246. var $1,$2,$5,$4,$3,$6,$9,$8,$7,$10,$11,$12,$15,$14,$13,$16,$19,$18,$17,$20,$23,$22,$21,$24,$25,$26;
  28247. $1=self["@stream"];
  28248. _st($1)._nextPutAll_("smalltalk.method({");
  28249. $ctx1.sendIdx["nextPutAll:"]=1;
  28250. _st($1)._lf();
  28251. $ctx1.sendIdx["lf"]=1;
  28252. $2=$1;
  28253. $5=_st(_st(aMethod)._selector())._asJavascript();
  28254. $ctx1.sendIdx["asJavascript"]=1;
  28255. $4="selector: ".__comma($5);
  28256. $ctx1.sendIdx[","]=2;
  28257. $3=_st($4).__comma(",");
  28258. $ctx1.sendIdx[","]=1;
  28259. _st($2)._nextPutAll_($3);
  28260. $ctx1.sendIdx["nextPutAll:"]=2;
  28261. _st($1)._lf();
  28262. $ctx1.sendIdx["lf"]=2;
  28263. $6=$1;
  28264. $9=_st(_st(aMethod)._source())._asJavascript();
  28265. $ctx1.sendIdx["asJavascript"]=2;
  28266. $8="source: ".__comma($9);
  28267. $ctx1.sendIdx[","]=4;
  28268. $7=_st($8).__comma(",");
  28269. $ctx1.sendIdx[","]=3;
  28270. _st($6)._nextPutAll_($7);
  28271. $ctx1.sendIdx["nextPutAll:"]=3;
  28272. $10=_st($1)._lf();
  28273. $ctx1.sendIdx["lf"]=3;
  28274. _st(aBlock)._value();
  28275. $ctx1.sendIdx["value"]=1;
  28276. $11=self["@stream"];
  28277. $12=$11;
  28278. $15=_st($String())._lf();
  28279. $ctx1.sendIdx["lf"]=4;
  28280. $14=",".__comma($15);
  28281. $ctx1.sendIdx[","]=6;
  28282. $13=_st($14).__comma("messageSends: ");
  28283. $ctx1.sendIdx[","]=5;
  28284. _st($12)._nextPutAll_($13);
  28285. $ctx1.sendIdx["nextPutAll:"]=4;
  28286. $16=$11;
  28287. $19=_st(_st(aMethod)._messageSends())._asArray();
  28288. $ctx1.sendIdx["asArray"]=1;
  28289. $18=_st($19)._asJavascript();
  28290. $ctx1.sendIdx["asJavascript"]=3;
  28291. $17=_st($18).__comma(",");
  28292. $ctx1.sendIdx[","]=7;
  28293. _st($16)._nextPutAll_($17);
  28294. $ctx1.sendIdx["nextPutAll:"]=5;
  28295. _st($11)._lf();
  28296. $ctx1.sendIdx["lf"]=5;
  28297. $20=$11;
  28298. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  28299. return smalltalk.withContext(function($ctx2) {
  28300. return _st(each)._value();
  28301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asArray())._asJavascript();
  28302. $ctx1.sendIdx["asJavascript"]=4;
  28303. $22="args: ".__comma($23);
  28304. $21=_st($22).__comma(",");
  28305. $ctx1.sendIdx[","]=8;
  28306. _st($20)._nextPutAll_($21);
  28307. $ctx1.sendIdx["nextPutAll:"]=6;
  28308. _st($11)._lf();
  28309. $24=_st($11)._nextPutAll_("referencedClasses: [");
  28310. $ctx1.sendIdx["nextPutAll:"]=7;
  28311. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  28312. return smalltalk.withContext(function($ctx2) {
  28313. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  28314. $ctx2.sendIdx["nextPutAll:"]=8;
  28315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  28316. return smalltalk.withContext(function($ctx2) {
  28317. return _st(self["@stream"])._nextPutAll_(",");
  28318. $ctx2.sendIdx["nextPutAll:"]=9;
  28319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  28320. $25=self["@stream"];
  28321. _st($25)._nextPutAll_("]");
  28322. $ctx1.sendIdx["nextPutAll:"]=10;
  28323. $26=_st($25)._nextPutAll_("})");
  28324. return self}, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)})},
  28325. args: ["aMethod", "aBlock"],
  28326. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences\x0a\x09\x09do: [ :each | stream nextPutAll: each asJavascript ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream\x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  28327. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  28328. referencedClasses: ["String"]
  28329. }),
  28330. globals.JSStream);
  28331. smalltalk.addMethod(
  28332. smalltalk.method({
  28333. selector: "nextPutNonLocalReturnHandlingWith:",
  28334. protocol: 'streaming',
  28335. fn: function (aBlock){
  28336. var self=this;
  28337. return smalltalk.withContext(function($ctx1) {
  28338. var $1,$2,$3,$4;
  28339. $1=self["@stream"];
  28340. _st($1)._nextPutAll_("var $early={};");
  28341. $ctx1.sendIdx["nextPutAll:"]=1;
  28342. _st($1)._lf();
  28343. $ctx1.sendIdx["lf"]=1;
  28344. _st($1)._nextPutAll_("try {");
  28345. $ctx1.sendIdx["nextPutAll:"]=2;
  28346. $2=_st($1)._lf();
  28347. $ctx1.sendIdx["lf"]=2;
  28348. _st(aBlock)._value();
  28349. $3=self["@stream"];
  28350. _st($3)._nextPutAll_("}");
  28351. $ctx1.sendIdx["nextPutAll:"]=3;
  28352. _st($3)._lf();
  28353. $ctx1.sendIdx["lf"]=3;
  28354. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  28355. $4=_st($3)._lf();
  28356. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)})},
  28357. args: ["aBlock"],
  28358. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream\x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream\x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  28359. messageSends: ["nextPutAll:", "lf", "value"],
  28360. referencedClasses: []
  28361. }),
  28362. globals.JSStream);
  28363. smalltalk.addMethod(
  28364. smalltalk.method({
  28365. selector: "nextPutNonLocalReturnWith:",
  28366. protocol: 'streaming',
  28367. fn: function (aBlock){
  28368. var self=this;
  28369. return smalltalk.withContext(function($ctx1) {
  28370. _st(self["@stream"])._nextPutAll_("throw $early=[");
  28371. $ctx1.sendIdx["nextPutAll:"]=1;
  28372. _st(aBlock)._value();
  28373. _st(self["@stream"])._nextPutAll_("]");
  28374. return self}, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  28375. args: ["aBlock"],
  28376. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  28377. messageSends: ["nextPutAll:", "value"],
  28378. referencedClasses: []
  28379. }),
  28380. globals.JSStream);
  28381. smalltalk.addMethod(
  28382. smalltalk.method({
  28383. selector: "nextPutReturn",
  28384. protocol: 'streaming',
  28385. fn: function (){
  28386. var self=this;
  28387. return smalltalk.withContext(function($ctx1) {
  28388. _st(self["@stream"])._nextPutAll_("return ");
  28389. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)})},
  28390. args: [],
  28391. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  28392. messageSends: ["nextPutAll:"],
  28393. referencedClasses: []
  28394. }),
  28395. globals.JSStream);
  28396. smalltalk.addMethod(
  28397. smalltalk.method({
  28398. selector: "nextPutReturnWith:",
  28399. protocol: 'streaming',
  28400. fn: function (aBlock){
  28401. var self=this;
  28402. return smalltalk.withContext(function($ctx1) {
  28403. self._nextPutReturn();
  28404. _st(aBlock)._value();
  28405. return self}, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)})},
  28406. args: ["aBlock"],
  28407. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  28408. messageSends: ["nextPutReturn", "value"],
  28409. referencedClasses: []
  28410. }),
  28411. globals.JSStream);
  28412. smalltalk.addMethod(
  28413. smalltalk.method({
  28414. selector: "nextPutSendIndexFor:",
  28415. protocol: 'streaming',
  28416. fn: function (anIRSend){
  28417. var self=this;
  28418. return smalltalk.withContext(function($ctx1) {
  28419. var $1;
  28420. self._nextPutAll_(";");
  28421. $ctx1.sendIdx["nextPutAll:"]=1;
  28422. self._lf();
  28423. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  28424. $ctx1.sendIdx["nextPutAll:"]=2;
  28425. self._nextPutAll_(".sendIdx[");
  28426. $ctx1.sendIdx["nextPutAll:"]=3;
  28427. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  28428. $ctx1.sendIdx["nextPutAll:"]=4;
  28429. self._nextPutAll_("]=");
  28430. $ctx1.sendIdx["nextPutAll:"]=5;
  28431. $1=self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  28432. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)})},
  28433. args: ["anIRSend"],
  28434. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias;\x0a\x09\x09nextPutAll: '.sendIdx[';\x0a\x09\x09nextPutAll: anIRSend selector asJavascript;\x0a\x09\x09nextPutAll: ']=';\x0a\x09\x09nextPutAll: anIRSend index asString",
  28435. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"],
  28436. referencedClasses: []
  28437. }),
  28438. globals.JSStream);
  28439. smalltalk.addMethod(
  28440. smalltalk.method({
  28441. selector: "nextPutSequenceWith:",
  28442. protocol: 'streaming',
  28443. fn: function (aBlock){
  28444. var self=this;
  28445. return smalltalk.withContext(function($ctx1) {
  28446. _st(aBlock)._value();
  28447. return self}, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)})},
  28448. args: ["aBlock"],
  28449. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  28450. messageSends: ["value"],
  28451. referencedClasses: []
  28452. }),
  28453. globals.JSStream);
  28454. smalltalk.addMethod(
  28455. smalltalk.method({
  28456. selector: "nextPutStatementWith:",
  28457. protocol: 'streaming',
  28458. fn: function (aBlock){
  28459. var self=this;
  28460. return smalltalk.withContext(function($ctx1) {
  28461. var $1,$2;
  28462. _st(aBlock)._value();
  28463. $1=self["@stream"];
  28464. _st($1)._nextPutAll_(";");
  28465. $2=_st($1)._lf();
  28466. return self}, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)})},
  28467. args: ["aBlock"],
  28468. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  28469. messageSends: ["value", "nextPutAll:", "lf"],
  28470. referencedClasses: []
  28471. }),
  28472. globals.JSStream);
  28473. smalltalk.addMethod(
  28474. smalltalk.method({
  28475. selector: "nextPutVars:",
  28476. protocol: 'streaming',
  28477. fn: function (aCollection){
  28478. var self=this;
  28479. return smalltalk.withContext(function($ctx1) {
  28480. var $1,$2;
  28481. var $early={};
  28482. try {
  28483. _st(aCollection)._ifEmpty_((function(){
  28484. throw $early=[self];
  28485. }));
  28486. _st(self["@stream"])._nextPutAll_("var ");
  28487. $ctx1.sendIdx["nextPutAll:"]=1;
  28488. _st(aCollection)._do_separatedBy_((function(each){
  28489. return smalltalk.withContext(function($ctx2) {
  28490. return _st(self["@stream"])._nextPutAll_(each);
  28491. $ctx2.sendIdx["nextPutAll:"]=2;
  28492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  28493. return smalltalk.withContext(function($ctx2) {
  28494. return _st(self["@stream"])._nextPutAll_(",");
  28495. $ctx2.sendIdx["nextPutAll:"]=3;
  28496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  28497. $1=self["@stream"];
  28498. _st($1)._nextPutAll_(";");
  28499. $2=_st($1)._lf();
  28500. return self}
  28501. catch(e) {if(e===$early)return e[0]; throw e}
  28502. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)})},
  28503. args: ["aCollection"],
  28504. source: "nextPutVars: aCollection\x0a\x09aCollection ifEmpty: [ ^ self ].\x0a\x09\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection\x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  28505. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"],
  28506. referencedClasses: []
  28507. }),
  28508. globals.JSStream);
  28509. smalltalk.addMethod(
  28510. smalltalk.method({
  28511. selector: "appendToInstruction:",
  28512. protocol: '*Compiler-IR',
  28513. fn: function (anIRInstruction){
  28514. var self=this;
  28515. return smalltalk.withContext(function($ctx1) {
  28516. _st(anIRInstruction)._appendBlock_(self);
  28517. return self}, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)})},
  28518. args: ["anIRInstruction"],
  28519. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  28520. messageSends: ["appendBlock:"],
  28521. referencedClasses: []
  28522. }),
  28523. globals.BlockClosure);
  28524. });
  28525. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  28526. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  28527. smalltalk.addPackage('Compiler-Inlining');
  28528. smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28529. smalltalk.addClass('IRInlinedAssignment', globals.IRAssignment, [], 'Compiler-Inlining');
  28530. globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  28531. smalltalk.addMethod(
  28532. smalltalk.method({
  28533. selector: "accept:",
  28534. protocol: 'visiting',
  28535. fn: function (aVisitor){
  28536. var self=this;
  28537. return smalltalk.withContext(function($ctx1) {
  28538. var $1;
  28539. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  28540. return $1;
  28541. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)})},
  28542. args: ["aVisitor"],
  28543. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  28544. messageSends: ["visitIRInlinedAssignment:"],
  28545. referencedClasses: []
  28546. }),
  28547. globals.IRInlinedAssignment);
  28548. smalltalk.addMethod(
  28549. smalltalk.method({
  28550. selector: "isInlined",
  28551. protocol: 'testing',
  28552. fn: function (){
  28553. var self=this;
  28554. return true;
  28555. },
  28556. args: [],
  28557. source: "isInlined\x0a\x09^ true",
  28558. messageSends: [],
  28559. referencedClasses: []
  28560. }),
  28561. globals.IRInlinedAssignment);
  28562. smalltalk.addClass('IRInlinedClosure', globals.IRClosure, [], 'Compiler-Inlining');
  28563. globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  28564. smalltalk.addMethod(
  28565. smalltalk.method({
  28566. selector: "accept:",
  28567. protocol: 'visiting',
  28568. fn: function (aVisitor){
  28569. var self=this;
  28570. return smalltalk.withContext(function($ctx1) {
  28571. _st(aVisitor)._visitIRInlinedClosure_(self);
  28572. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)})},
  28573. args: ["aVisitor"],
  28574. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  28575. messageSends: ["visitIRInlinedClosure:"],
  28576. referencedClasses: []
  28577. }),
  28578. globals.IRInlinedClosure);
  28579. smalltalk.addMethod(
  28580. smalltalk.method({
  28581. selector: "isInlined",
  28582. protocol: 'testing',
  28583. fn: function (){
  28584. var self=this;
  28585. return true;
  28586. },
  28587. args: [],
  28588. source: "isInlined\x0a\x09^ true",
  28589. messageSends: [],
  28590. referencedClasses: []
  28591. }),
  28592. globals.IRInlinedClosure);
  28593. smalltalk.addClass('IRInlinedReturn', globals.IRReturn, [], 'Compiler-Inlining');
  28594. globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  28595. smalltalk.addMethod(
  28596. smalltalk.method({
  28597. selector: "accept:",
  28598. protocol: 'visiting',
  28599. fn: function (aVisitor){
  28600. var self=this;
  28601. return smalltalk.withContext(function($ctx1) {
  28602. var $1;
  28603. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  28604. return $1;
  28605. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)})},
  28606. args: ["aVisitor"],
  28607. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  28608. messageSends: ["visitIRInlinedReturn:"],
  28609. referencedClasses: []
  28610. }),
  28611. globals.IRInlinedReturn);
  28612. smalltalk.addMethod(
  28613. smalltalk.method({
  28614. selector: "isInlined",
  28615. protocol: 'testing',
  28616. fn: function (){
  28617. var self=this;
  28618. return true;
  28619. },
  28620. args: [],
  28621. source: "isInlined\x0a\x09^ true",
  28622. messageSends: [],
  28623. referencedClasses: []
  28624. }),
  28625. globals.IRInlinedReturn);
  28626. smalltalk.addClass('IRInlinedSend', globals.IRSend, [], 'Compiler-Inlining');
  28627. globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  28628. smalltalk.addMethod(
  28629. smalltalk.method({
  28630. selector: "accept:",
  28631. protocol: 'visiting',
  28632. fn: function (aVisitor){
  28633. var self=this;
  28634. return smalltalk.withContext(function($ctx1) {
  28635. _st(aVisitor)._visitInlinedSend_(self);
  28636. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)})},
  28637. args: ["aVisitor"],
  28638. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  28639. messageSends: ["visitInlinedSend:"],
  28640. referencedClasses: []
  28641. }),
  28642. globals.IRInlinedSend);
  28643. smalltalk.addMethod(
  28644. smalltalk.method({
  28645. selector: "internalVariables",
  28646. protocol: 'accessing',
  28647. fn: function (){
  28648. var self=this;
  28649. var $1;
  28650. $1=[];
  28651. return $1;
  28652. },
  28653. args: [],
  28654. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  28655. messageSends: [],
  28656. referencedClasses: []
  28657. }),
  28658. globals.IRInlinedSend);
  28659. smalltalk.addMethod(
  28660. smalltalk.method({
  28661. selector: "isInlined",
  28662. protocol: 'testing',
  28663. fn: function (){
  28664. var self=this;
  28665. return true;
  28666. },
  28667. args: [],
  28668. source: "isInlined\x0a\x09^ true",
  28669. messageSends: [],
  28670. referencedClasses: []
  28671. }),
  28672. globals.IRInlinedSend);
  28673. smalltalk.addClass('IRInlinedIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  28674. globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  28675. smalltalk.addMethod(
  28676. smalltalk.method({
  28677. selector: "accept:",
  28678. protocol: 'visiting',
  28679. fn: function (aVisitor){
  28680. var self=this;
  28681. return smalltalk.withContext(function($ctx1) {
  28682. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  28683. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)})},
  28684. args: ["aVisitor"],
  28685. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  28686. messageSends: ["visitIRInlinedIfFalse:"],
  28687. referencedClasses: []
  28688. }),
  28689. globals.IRInlinedIfFalse);
  28690. smalltalk.addClass('IRInlinedIfNilIfNotNil', globals.IRInlinedSend, [], 'Compiler-Inlining');
  28691. globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  28692. smalltalk.addMethod(
  28693. smalltalk.method({
  28694. selector: "accept:",
  28695. protocol: 'visiting',
  28696. fn: function (aVisitor){
  28697. var self=this;
  28698. return smalltalk.withContext(function($ctx1) {
  28699. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  28700. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)})},
  28701. args: ["aVisitor"],
  28702. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  28703. messageSends: ["visitIRInlinedIfNilIfNotNil:"],
  28704. referencedClasses: []
  28705. }),
  28706. globals.IRInlinedIfNilIfNotNil);
  28707. smalltalk.addMethod(
  28708. smalltalk.method({
  28709. selector: "internalVariables",
  28710. protocol: 'accessing',
  28711. fn: function (){
  28712. var self=this;
  28713. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  28714. return smalltalk.withContext(function($ctx1) {
  28715. var $1;
  28716. $1=_st($Array())._with_(self._receiverInternalVariable());
  28717. return $1;
  28718. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRInlinedIfNilIfNotNil)})},
  28719. args: [],
  28720. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  28721. messageSends: ["with:", "receiverInternalVariable"],
  28722. referencedClasses: ["Array"]
  28723. }),
  28724. globals.IRInlinedIfNilIfNotNil);
  28725. smalltalk.addMethod(
  28726. smalltalk.method({
  28727. selector: "receiverInternalVariable",
  28728. protocol: 'accessing',
  28729. fn: function (){
  28730. var self=this;
  28731. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  28732. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  28733. return smalltalk.withContext(function($ctx1) {
  28734. var $2,$3,$1;
  28735. $2=_st($IRVariable())._new();
  28736. $ctx1.sendIdx["new"]=1;
  28737. _st($2)._variable_(_st(_st($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  28738. $3=_st($2)._yourself();
  28739. $1=$3;
  28740. return $1;
  28741. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},globals.IRInlinedIfNilIfNotNil)})},
  28742. args: [],
  28743. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  28744. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"],
  28745. referencedClasses: ["IRVariable", "AliasVar"]
  28746. }),
  28747. globals.IRInlinedIfNilIfNotNil);
  28748. smalltalk.addMethod(
  28749. smalltalk.method({
  28750. selector: "receiverInternalVariableName",
  28751. protocol: 'accessing',
  28752. fn: function (){
  28753. var self=this;
  28754. return "$receiver";
  28755. },
  28756. args: [],
  28757. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  28758. messageSends: [],
  28759. referencedClasses: []
  28760. }),
  28761. globals.IRInlinedIfNilIfNotNil);
  28762. smalltalk.addClass('IRInlinedIfTrue', globals.IRInlinedSend, [], 'Compiler-Inlining');
  28763. globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  28764. smalltalk.addMethod(
  28765. smalltalk.method({
  28766. selector: "accept:",
  28767. protocol: 'visiting',
  28768. fn: function (aVisitor){
  28769. var self=this;
  28770. return smalltalk.withContext(function($ctx1) {
  28771. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  28772. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)})},
  28773. args: ["aVisitor"],
  28774. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  28775. messageSends: ["visitIRInlinedIfTrue:"],
  28776. referencedClasses: []
  28777. }),
  28778. globals.IRInlinedIfTrue);
  28779. smalltalk.addClass('IRInlinedIfTrueIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  28780. globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  28781. smalltalk.addMethod(
  28782. smalltalk.method({
  28783. selector: "accept:",
  28784. protocol: 'visiting',
  28785. fn: function (aVisitor){
  28786. var self=this;
  28787. return smalltalk.withContext(function($ctx1) {
  28788. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  28789. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)})},
  28790. args: ["aVisitor"],
  28791. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  28792. messageSends: ["visitIRInlinedIfTrueIfFalse:"],
  28793. referencedClasses: []
  28794. }),
  28795. globals.IRInlinedIfTrueIfFalse);
  28796. smalltalk.addClass('IRInlinedSequence', globals.IRBlockSequence, [], 'Compiler-Inlining');
  28797. globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  28798. smalltalk.addMethod(
  28799. smalltalk.method({
  28800. selector: "accept:",
  28801. protocol: 'visiting',
  28802. fn: function (aVisitor){
  28803. var self=this;
  28804. return smalltalk.withContext(function($ctx1) {
  28805. _st(aVisitor)._visitIRInlinedSequence_(self);
  28806. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)})},
  28807. args: ["aVisitor"],
  28808. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  28809. messageSends: ["visitIRInlinedSequence:"],
  28810. referencedClasses: []
  28811. }),
  28812. globals.IRInlinedSequence);
  28813. smalltalk.addMethod(
  28814. smalltalk.method({
  28815. selector: "isInlined",
  28816. protocol: 'testing',
  28817. fn: function (){
  28818. var self=this;
  28819. return true;
  28820. },
  28821. args: [],
  28822. source: "isInlined\x0a\x09^ true",
  28823. messageSends: [],
  28824. referencedClasses: []
  28825. }),
  28826. globals.IRInlinedSequence);
  28827. smalltalk.addClass('IRInliner', globals.IRVisitor, [], 'Compiler-Inlining');
  28828. globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`";
  28829. smalltalk.addMethod(
  28830. smalltalk.method({
  28831. selector: "assignmentInliner",
  28832. protocol: 'factory',
  28833. fn: function (){
  28834. var self=this;
  28835. function $IRAssignmentInliner(){return globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  28836. return smalltalk.withContext(function($ctx1) {
  28837. var $2,$3,$1;
  28838. $2=_st($IRAssignmentInliner())._new();
  28839. _st($2)._translator_(self);
  28840. $3=_st($2)._yourself();
  28841. $1=$3;
  28842. return $1;
  28843. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)})},
  28844. args: [],
  28845. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  28846. messageSends: ["translator:", "new", "yourself"],
  28847. referencedClasses: ["IRAssignmentInliner"]
  28848. }),
  28849. globals.IRInliner);
  28850. smalltalk.addMethod(
  28851. smalltalk.method({
  28852. selector: "returnInliner",
  28853. protocol: 'factory',
  28854. fn: function (){
  28855. var self=this;
  28856. function $IRReturnInliner(){return globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  28857. return smalltalk.withContext(function($ctx1) {
  28858. var $2,$3,$1;
  28859. $2=_st($IRReturnInliner())._new();
  28860. _st($2)._translator_(self);
  28861. $3=_st($2)._yourself();
  28862. $1=$3;
  28863. return $1;
  28864. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)})},
  28865. args: [],
  28866. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  28867. messageSends: ["translator:", "new", "yourself"],
  28868. referencedClasses: ["IRReturnInliner"]
  28869. }),
  28870. globals.IRInliner);
  28871. smalltalk.addMethod(
  28872. smalltalk.method({
  28873. selector: "sendInliner",
  28874. protocol: 'factory',
  28875. fn: function (){
  28876. var self=this;
  28877. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  28878. return smalltalk.withContext(function($ctx1) {
  28879. var $2,$3,$1;
  28880. $2=_st($IRSendInliner())._new();
  28881. _st($2)._translator_(self);
  28882. $3=_st($2)._yourself();
  28883. $1=$3;
  28884. return $1;
  28885. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)})},
  28886. args: [],
  28887. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  28888. messageSends: ["translator:", "new", "yourself"],
  28889. referencedClasses: ["IRSendInliner"]
  28890. }),
  28891. globals.IRInliner);
  28892. smalltalk.addMethod(
  28893. smalltalk.method({
  28894. selector: "shouldInlineAssignment:",
  28895. protocol: 'testing',
  28896. fn: function (anIRAssignment){
  28897. var self=this;
  28898. return smalltalk.withContext(function($ctx1) {
  28899. var $4,$3,$2,$1;
  28900. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  28901. return smalltalk.withContext(function($ctx2) {
  28902. $4=_st(anIRAssignment)._instructions();
  28903. $ctx2.sendIdx["instructions"]=1;
  28904. $3=_st($4)._last();
  28905. $ctx2.sendIdx["last"]=1;
  28906. $2=_st($3)._isSend();
  28907. return _st($2)._and_((function(){
  28908. return smalltalk.withContext(function($ctx3) {
  28909. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  28910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  28911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28912. $ctx1.sendIdx["and:"]=1;
  28913. return $1;
  28914. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
  28915. args: ["anIRAssignment"],
  28916. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  28917. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"],
  28918. referencedClasses: []
  28919. }),
  28920. globals.IRInliner);
  28921. smalltalk.addMethod(
  28922. smalltalk.method({
  28923. selector: "shouldInlineReturn:",
  28924. protocol: 'testing',
  28925. fn: function (anIRReturn){
  28926. var self=this;
  28927. return smalltalk.withContext(function($ctx1) {
  28928. var $4,$3,$2,$1;
  28929. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  28930. return smalltalk.withContext(function($ctx2) {
  28931. $4=_st(anIRReturn)._instructions();
  28932. $ctx2.sendIdx["instructions"]=1;
  28933. $3=_st($4)._first();
  28934. $ctx2.sendIdx["first"]=1;
  28935. $2=_st($3)._isSend();
  28936. return _st($2)._and_((function(){
  28937. return smalltalk.withContext(function($ctx3) {
  28938. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  28939. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  28940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28941. $ctx1.sendIdx["and:"]=1;
  28942. return $1;
  28943. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
  28944. args: ["anIRReturn"],
  28945. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  28946. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"],
  28947. referencedClasses: []
  28948. }),
  28949. globals.IRInliner);
  28950. smalltalk.addMethod(
  28951. smalltalk.method({
  28952. selector: "shouldInlineSend:",
  28953. protocol: 'testing',
  28954. fn: function (anIRSend){
  28955. var self=this;
  28956. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  28957. return smalltalk.withContext(function($ctx1) {
  28958. var $1;
  28959. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  28960. return smalltalk.withContext(function($ctx2) {
  28961. return _st($IRSendInliner())._shouldInline_(anIRSend);
  28962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  28963. return $1;
  28964. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)})},
  28965. args: ["anIRSend"],
  28966. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  28967. messageSends: ["and:", "not", "isInlined", "shouldInline:"],
  28968. referencedClasses: ["IRSendInliner"]
  28969. }),
  28970. globals.IRInliner);
  28971. smalltalk.addMethod(
  28972. smalltalk.method({
  28973. selector: "transformNonLocalReturn:",
  28974. protocol: 'visiting',
  28975. fn: function (anIRNonLocalReturn){
  28976. var self=this;
  28977. var localReturn;
  28978. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  28979. return smalltalk.withContext(function($ctx1) {
  28980. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  28981. $2=_st(anIRNonLocalReturn)._scope();
  28982. $ctx1.sendIdx["scope"]=1;
  28983. $1=_st($2)._canInlineNonLocalReturns();
  28984. if(smalltalk.assert($1)){
  28985. $4=_st(anIRNonLocalReturn)._scope();
  28986. $ctx1.sendIdx["scope"]=2;
  28987. $3=_st($4)._methodScope();
  28988. $5=_st(anIRNonLocalReturn)._scope();
  28989. $ctx1.sendIdx["scope"]=3;
  28990. _st($3)._removeNonLocalReturn_($5);
  28991. $6=_st($IRReturn())._new();
  28992. _st($6)._scope_(_st(anIRNonLocalReturn)._scope());
  28993. $7=_st($6)._yourself();
  28994. localReturn=$7;
  28995. localReturn;
  28996. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  28997. return smalltalk.withContext(function($ctx2) {
  28998. return _st(localReturn)._add_(each);
  28999. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29000. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  29001. $8=localReturn;
  29002. return $8;
  29003. };
  29004. $9=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  29005. $ctx1.supercall = false;
  29006. return $9;
  29007. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)})},
  29008. args: ["anIRNonLocalReturn"],
  29009. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  29010. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"],
  29011. referencedClasses: ["IRReturn"]
  29012. }),
  29013. globals.IRInliner);
  29014. smalltalk.addMethod(
  29015. smalltalk.method({
  29016. selector: "visitIRAssignment:",
  29017. protocol: 'visiting',
  29018. fn: function (anIRAssignment){
  29019. var self=this;
  29020. return smalltalk.withContext(function($ctx1) {
  29021. var $2,$1;
  29022. $2=self._shouldInlineAssignment_(anIRAssignment);
  29023. if(smalltalk.assert($2)){
  29024. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  29025. } else {
  29026. $1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]));
  29027. $ctx1.supercall = false;
  29028. };
  29029. return $1;
  29030. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
  29031. args: ["anIRAssignment"],
  29032. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  29033. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"],
  29034. referencedClasses: []
  29035. }),
  29036. globals.IRInliner);
  29037. smalltalk.addMethod(
  29038. smalltalk.method({
  29039. selector: "visitIRNonLocalReturn:",
  29040. protocol: 'visiting',
  29041. fn: function (anIRNonLocalReturn){
  29042. var self=this;
  29043. return smalltalk.withContext(function($ctx1) {
  29044. var $1;
  29045. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  29046. return $1;
  29047. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)})},
  29048. args: ["anIRNonLocalReturn"],
  29049. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  29050. messageSends: ["transformNonLocalReturn:"],
  29051. referencedClasses: []
  29052. }),
  29053. globals.IRInliner);
  29054. smalltalk.addMethod(
  29055. smalltalk.method({
  29056. selector: "visitIRReturn:",
  29057. protocol: 'visiting',
  29058. fn: function (anIRReturn){
  29059. var self=this;
  29060. return smalltalk.withContext(function($ctx1) {
  29061. var $2,$1;
  29062. $2=self._shouldInlineReturn_(anIRReturn);
  29063. if(smalltalk.assert($2)){
  29064. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  29065. } else {
  29066. $1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  29067. $ctx1.supercall = false;
  29068. };
  29069. return $1;
  29070. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
  29071. args: ["anIRReturn"],
  29072. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  29073. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"],
  29074. referencedClasses: []
  29075. }),
  29076. globals.IRInliner);
  29077. smalltalk.addMethod(
  29078. smalltalk.method({
  29079. selector: "visitIRSend:",
  29080. protocol: 'visiting',
  29081. fn: function (anIRSend){
  29082. var self=this;
  29083. return smalltalk.withContext(function($ctx1) {
  29084. var $2,$1;
  29085. $2=self._shouldInlineSend_(anIRSend);
  29086. if(smalltalk.assert($2)){
  29087. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  29088. } else {
  29089. $1=($ctx1.supercall = true, globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]));
  29090. $ctx1.supercall = false;
  29091. };
  29092. return $1;
  29093. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)})},
  29094. args: ["anIRSend"],
  29095. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  29096. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"],
  29097. referencedClasses: []
  29098. }),
  29099. globals.IRInliner);
  29100. smalltalk.addClass('IRInliningJSTranslator', globals.IRJSTranslator, [], 'Compiler-Inlining');
  29101. globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  29102. smalltalk.addMethod(
  29103. smalltalk.method({
  29104. selector: "visitIRInlinedAssignment:",
  29105. protocol: 'visiting',
  29106. fn: function (anIRInlinedAssignment){
  29107. var self=this;
  29108. return smalltalk.withContext(function($ctx1) {
  29109. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  29110. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)})},
  29111. args: ["anIRInlinedAssignment"],
  29112. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  29113. messageSends: ["visit:", "last", "instructions"],
  29114. referencedClasses: []
  29115. }),
  29116. globals.IRInliningJSTranslator);
  29117. smalltalk.addMethod(
  29118. smalltalk.method({
  29119. selector: "visitIRInlinedClosure:",
  29120. protocol: 'visiting',
  29121. fn: function (anIRInlinedClosure){
  29122. var self=this;
  29123. return smalltalk.withContext(function($ctx1) {
  29124. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  29125. return smalltalk.withContext(function($ctx2) {
  29126. return _st(_st(each)._name())._asVariableName();
  29127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
  29128. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  29129. return smalltalk.withContext(function($ctx2) {
  29130. return self._visit_(each);
  29131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29132. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)})},
  29133. args: ["anIRInlinedClosure"],
  29134. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  29135. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"],
  29136. referencedClasses: []
  29137. }),
  29138. globals.IRInliningJSTranslator);
  29139. smalltalk.addMethod(
  29140. smalltalk.method({
  29141. selector: "visitIRInlinedIfFalse:",
  29142. protocol: 'visiting',
  29143. fn: function (anIRInlinedIfFalse){
  29144. var self=this;
  29145. return smalltalk.withContext(function($ctx1) {
  29146. var $1,$2,$4,$3;
  29147. $1=self._stream();
  29148. $ctx1.sendIdx["stream"]=1;
  29149. _st($1)._nextPutIf_with_((function(){
  29150. return smalltalk.withContext(function($ctx2) {
  29151. $2=self._stream();
  29152. $ctx2.sendIdx["stream"]=2;
  29153. _st($2)._nextPutAll_("! smalltalk.assert(");
  29154. $ctx2.sendIdx["nextPutAll:"]=1;
  29155. $4=_st(anIRInlinedIfFalse)._instructions();
  29156. $ctx2.sendIdx["instructions"]=1;
  29157. $3=_st($4)._first();
  29158. self._visit_($3);
  29159. $ctx2.sendIdx["visit:"]=1;
  29160. return _st(self._stream())._nextPutAll_(")");
  29161. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  29162. return smalltalk.withContext(function($ctx2) {
  29163. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  29164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  29165. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)})},
  29166. args: ["anIRInlinedIfFalse"],
  29167. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  29168. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  29169. referencedClasses: []
  29170. }),
  29171. globals.IRInliningJSTranslator);
  29172. smalltalk.addMethod(
  29173. smalltalk.method({
  29174. selector: "visitIRInlinedIfNilIfNotNil:",
  29175. protocol: 'visiting',
  29176. fn: function (anIRInlinedIfNilIfNotNil){
  29177. var self=this;
  29178. return smalltalk.withContext(function($ctx1) {
  29179. var $1,$2,$3,$5,$4,$7,$6;
  29180. $1=self._stream();
  29181. $ctx1.sendIdx["stream"]=1;
  29182. _st($1)._nextPutIfElse_with_with_((function(){
  29183. return smalltalk.withContext(function($ctx2) {
  29184. $2=self._stream();
  29185. $ctx2.sendIdx["stream"]=2;
  29186. $3=_st("(".__comma(_st(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  29187. $ctx2.sendIdx[","]=1;
  29188. _st($2)._nextPutAll_($3);
  29189. $ctx2.sendIdx["nextPutAll:"]=1;
  29190. $5=_st(anIRInlinedIfNilIfNotNil)._instructions();
  29191. $ctx2.sendIdx["instructions"]=1;
  29192. $4=_st($5)._first();
  29193. self._visit_($4);
  29194. $ctx2.sendIdx["visit:"]=1;
  29195. return _st(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  29196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  29197. return smalltalk.withContext(function($ctx2) {
  29198. $7=_st(anIRInlinedIfNilIfNotNil)._instructions();
  29199. $ctx2.sendIdx["instructions"]=2;
  29200. $6=_st($7)._second();
  29201. return self._visit_($6);
  29202. $ctx2.sendIdx["visit:"]=2;
  29203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  29204. return smalltalk.withContext(function($ctx2) {
  29205. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  29206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  29207. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)})},
  29208. args: ["anIRInlinedIfNilIfNotNil"],
  29209. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || $receiver.isNil' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  29210. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"],
  29211. referencedClasses: []
  29212. }),
  29213. globals.IRInliningJSTranslator);
  29214. smalltalk.addMethod(
  29215. smalltalk.method({
  29216. selector: "visitIRInlinedIfTrue:",
  29217. protocol: 'visiting',
  29218. fn: function (anIRInlinedIfTrue){
  29219. var self=this;
  29220. return smalltalk.withContext(function($ctx1) {
  29221. var $1,$2,$4,$3;
  29222. $1=self._stream();
  29223. $ctx1.sendIdx["stream"]=1;
  29224. _st($1)._nextPutIf_with_((function(){
  29225. return smalltalk.withContext(function($ctx2) {
  29226. $2=self._stream();
  29227. $ctx2.sendIdx["stream"]=2;
  29228. _st($2)._nextPutAll_("smalltalk.assert(");
  29229. $ctx2.sendIdx["nextPutAll:"]=1;
  29230. $4=_st(anIRInlinedIfTrue)._instructions();
  29231. $ctx2.sendIdx["instructions"]=1;
  29232. $3=_st($4)._first();
  29233. self._visit_($3);
  29234. $ctx2.sendIdx["visit:"]=1;
  29235. return _st(self._stream())._nextPutAll_(")");
  29236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  29237. return smalltalk.withContext(function($ctx2) {
  29238. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  29239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  29240. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)})},
  29241. args: ["anIRInlinedIfTrue"],
  29242. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  29243. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
  29244. referencedClasses: []
  29245. }),
  29246. globals.IRInliningJSTranslator);
  29247. smalltalk.addMethod(
  29248. smalltalk.method({
  29249. selector: "visitIRInlinedIfTrueIfFalse:",
  29250. protocol: 'visiting',
  29251. fn: function (anIRInlinedIfTrueIfFalse){
  29252. var self=this;
  29253. return smalltalk.withContext(function($ctx1) {
  29254. var $1,$2,$4,$3,$6,$5;
  29255. $1=self._stream();
  29256. $ctx1.sendIdx["stream"]=1;
  29257. _st($1)._nextPutIfElse_with_with_((function(){
  29258. return smalltalk.withContext(function($ctx2) {
  29259. $2=self._stream();
  29260. $ctx2.sendIdx["stream"]=2;
  29261. _st($2)._nextPutAll_("smalltalk.assert(");
  29262. $ctx2.sendIdx["nextPutAll:"]=1;
  29263. $4=_st(anIRInlinedIfTrueIfFalse)._instructions();
  29264. $ctx2.sendIdx["instructions"]=1;
  29265. $3=_st($4)._first();
  29266. self._visit_($3);
  29267. $ctx2.sendIdx["visit:"]=1;
  29268. return _st(self._stream())._nextPutAll_(")");
  29269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
  29270. return smalltalk.withContext(function($ctx2) {
  29271. $6=_st(anIRInlinedIfTrueIfFalse)._instructions();
  29272. $ctx2.sendIdx["instructions"]=2;
  29273. $5=_st($6)._second();
  29274. return self._visit_($5);
  29275. $ctx2.sendIdx["visit:"]=2;
  29276. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
  29277. return smalltalk.withContext(function($ctx2) {
  29278. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  29279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  29280. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)})},
  29281. args: ["anIRInlinedIfTrueIfFalse"],
  29282. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  29283. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
  29284. referencedClasses: []
  29285. }),
  29286. globals.IRInliningJSTranslator);
  29287. smalltalk.addMethod(
  29288. smalltalk.method({
  29289. selector: "visitIRInlinedNonLocalReturn:",
  29290. protocol: 'visiting',
  29291. fn: function (anIRInlinedReturn){
  29292. var self=this;
  29293. return smalltalk.withContext(function($ctx1) {
  29294. var $1;
  29295. $1=self._stream();
  29296. $ctx1.sendIdx["stream"]=1;
  29297. _st($1)._nextPutStatementWith_((function(){
  29298. return smalltalk.withContext(function($ctx2) {
  29299. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  29300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  29301. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  29302. }));
  29303. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
  29304. args: ["anIRInlinedReturn"],
  29305. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  29306. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"],
  29307. referencedClasses: []
  29308. }),
  29309. globals.IRInliningJSTranslator);
  29310. smalltalk.addMethod(
  29311. smalltalk.method({
  29312. selector: "visitIRInlinedReturn:",
  29313. protocol: 'visiting',
  29314. fn: function (anIRInlinedReturn){
  29315. var self=this;
  29316. return smalltalk.withContext(function($ctx1) {
  29317. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  29318. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
  29319. args: ["anIRInlinedReturn"],
  29320. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  29321. messageSends: ["visit:", "last", "instructions"],
  29322. referencedClasses: []
  29323. }),
  29324. globals.IRInliningJSTranslator);
  29325. smalltalk.addMethod(
  29326. smalltalk.method({
  29327. selector: "visitIRInlinedSequence:",
  29328. protocol: 'visiting',
  29329. fn: function (anIRInlinedSequence){
  29330. var self=this;
  29331. return smalltalk.withContext(function($ctx1) {
  29332. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  29333. return smalltalk.withContext(function($ctx2) {
  29334. return _st(self._stream())._nextPutStatementWith_((function(){
  29335. return smalltalk.withContext(function($ctx3) {
  29336. return self._visit_(each);
  29337. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  29338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29339. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)})},
  29340. args: ["anIRInlinedSequence"],
  29341. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  29342. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"],
  29343. referencedClasses: []
  29344. }),
  29345. globals.IRInliningJSTranslator);
  29346. smalltalk.addClass('IRSendInliner', globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  29347. globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  29348. smalltalk.addMethod(
  29349. smalltalk.method({
  29350. selector: "ifFalse:",
  29351. protocol: 'inlining',
  29352. fn: function (anIRInstruction){
  29353. var self=this;
  29354. function $IRInlinedIfFalse(){return globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  29355. return smalltalk.withContext(function($ctx1) {
  29356. var $1;
  29357. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  29358. return $1;
  29359. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  29360. args: ["anIRInstruction"],
  29361. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  29362. messageSends: ["inlinedSend:with:", "new"],
  29363. referencedClasses: ["IRInlinedIfFalse"]
  29364. }),
  29365. globals.IRSendInliner);
  29366. smalltalk.addMethod(
  29367. smalltalk.method({
  29368. selector: "ifFalse:ifTrue:",
  29369. protocol: 'inlining',
  29370. fn: function (anIRInstruction,anotherIRInstruction){
  29371. var self=this;
  29372. return smalltalk.withContext(function($ctx1) {
  29373. var $1;
  29374. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  29375. return $1;
  29376. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  29377. args: ["anIRInstruction", "anotherIRInstruction"],
  29378. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  29379. messageSends: ["perform:withArguments:"],
  29380. referencedClasses: []
  29381. }),
  29382. globals.IRSendInliner);
  29383. smalltalk.addMethod(
  29384. smalltalk.method({
  29385. selector: "ifNil:",
  29386. protocol: 'inlining',
  29387. fn: function (anIRInstruction){
  29388. var self=this;
  29389. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  29390. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  29391. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  29392. return smalltalk.withContext(function($ctx1) {
  29393. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  29394. $2=_st($IRInlinedIfNilIfNotNil())._new();
  29395. $ctx1.sendIdx["new"]=1;
  29396. $4=_st($IRClosure())._new();
  29397. $ctx1.sendIdx["new"]=2;
  29398. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  29399. $5=$4;
  29400. $7=_st($IRBlockSequence())._new();
  29401. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  29402. $8=_st($7)._yourself();
  29403. $ctx1.sendIdx["yourself"]=1;
  29404. $6=$8;
  29405. _st($5)._add_($6);
  29406. $ctx1.sendIdx["add:"]=1;
  29407. $9=_st($4)._yourself();
  29408. $3=$9;
  29409. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  29410. return $1;
  29411. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  29412. args: ["anIRInstruction"],
  29413. source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  29414. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  29415. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  29416. }),
  29417. globals.IRSendInliner);
  29418. smalltalk.addMethod(
  29419. smalltalk.method({
  29420. selector: "ifNil:ifNotNil:",
  29421. protocol: 'inlining',
  29422. fn: function (anIRInstruction,anotherIRInstruction){
  29423. var self=this;
  29424. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  29425. return smalltalk.withContext(function($ctx1) {
  29426. var $1;
  29427. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  29428. return $1;
  29429. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  29430. args: ["anIRInstruction", "anotherIRInstruction"],
  29431. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  29432. messageSends: ["inlinedSend:with:with:", "new"],
  29433. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  29434. }),
  29435. globals.IRSendInliner);
  29436. smalltalk.addMethod(
  29437. smalltalk.method({
  29438. selector: "ifNotNil:",
  29439. protocol: 'inlining',
  29440. fn: function (anIRInstruction){
  29441. var self=this;
  29442. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  29443. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  29444. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  29445. return smalltalk.withContext(function($ctx1) {
  29446. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  29447. $2=_st($IRInlinedIfNilIfNotNil())._new();
  29448. $ctx1.sendIdx["new"]=1;
  29449. $4=_st($IRClosure())._new();
  29450. $ctx1.sendIdx["new"]=2;
  29451. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  29452. $5=$4;
  29453. $7=_st($IRBlockSequence())._new();
  29454. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  29455. $8=_st($7)._yourself();
  29456. $ctx1.sendIdx["yourself"]=1;
  29457. $6=$8;
  29458. _st($5)._add_($6);
  29459. $ctx1.sendIdx["add:"]=1;
  29460. $9=_st($4)._yourself();
  29461. $3=$9;
  29462. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  29463. return $1;
  29464. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  29465. args: ["anIRInstruction"],
  29466. source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
  29467. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
  29468. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
  29469. }),
  29470. globals.IRSendInliner);
  29471. smalltalk.addMethod(
  29472. smalltalk.method({
  29473. selector: "ifNotNil:ifNil:",
  29474. protocol: 'inlining',
  29475. fn: function (anIRInstruction,anotherIRInstruction){
  29476. var self=this;
  29477. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  29478. return smalltalk.withContext(function($ctx1) {
  29479. var $1;
  29480. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  29481. return $1;
  29482. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  29483. args: ["anIRInstruction", "anotherIRInstruction"],
  29484. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  29485. messageSends: ["inlinedSend:with:with:", "new"],
  29486. referencedClasses: ["IRInlinedIfNilIfNotNil"]
  29487. }),
  29488. globals.IRSendInliner);
  29489. smalltalk.addMethod(
  29490. smalltalk.method({
  29491. selector: "ifTrue:",
  29492. protocol: 'inlining',
  29493. fn: function (anIRInstruction){
  29494. var self=this;
  29495. function $IRInlinedIfTrue(){return globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  29496. return smalltalk.withContext(function($ctx1) {
  29497. var $1;
  29498. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  29499. return $1;
  29500. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
  29501. args: ["anIRInstruction"],
  29502. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  29503. messageSends: ["inlinedSend:with:", "new"],
  29504. referencedClasses: ["IRInlinedIfTrue"]
  29505. }),
  29506. globals.IRSendInliner);
  29507. smalltalk.addMethod(
  29508. smalltalk.method({
  29509. selector: "ifTrue:ifFalse:",
  29510. protocol: 'inlining',
  29511. fn: function (anIRInstruction,anotherIRInstruction){
  29512. var self=this;
  29513. function $IRInlinedIfTrueIfFalse(){return globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  29514. return smalltalk.withContext(function($ctx1) {
  29515. var $1;
  29516. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  29517. return $1;
  29518. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
  29519. args: ["anIRInstruction", "anotherIRInstruction"],
  29520. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  29521. messageSends: ["inlinedSend:with:with:", "new"],
  29522. referencedClasses: ["IRInlinedIfTrueIfFalse"]
  29523. }),
  29524. globals.IRSendInliner);
  29525. smalltalk.addMethod(
  29526. smalltalk.method({
  29527. selector: "inlineClosure:",
  29528. protocol: 'inlining',
  29529. fn: function (anIRClosure){
  29530. var self=this;
  29531. var inlinedClosure,sequence,statements;
  29532. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  29533. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  29534. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  29535. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  29536. return smalltalk.withContext(function($ctx1) {
  29537. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
  29538. inlinedClosure=self._inlinedClosure();
  29539. $1=inlinedClosure;
  29540. $2=$1;
  29541. $3=_st(anIRClosure)._scope();
  29542. $ctx1.sendIdx["scope"]=1;
  29543. _st($2)._scope_($3);
  29544. $ctx1.sendIdx["scope:"]=1;
  29545. $4=_st($1)._parent_(_st(anIRClosure)._parent());
  29546. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  29547. return smalltalk.withContext(function($ctx2) {
  29548. return _st(inlinedClosure)._add_(each);
  29549. $ctx2.sendIdx["add:"]=1;
  29550. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29551. $ctx1.sendIdx["do:"]=1;
  29552. sequence=self._inlinedSequence();
  29553. _st(_st(anIRClosure)._arguments())._do_((function(each){
  29554. return smalltalk.withContext(function($ctx2) {
  29555. $5=inlinedClosure;
  29556. $7=_st($IRTempDeclaration())._new();
  29557. $ctx2.sendIdx["new"]=1;
  29558. _st($7)._name_(each);
  29559. $ctx2.sendIdx["name:"]=1;
  29560. $8=_st($7)._yourself();
  29561. $ctx2.sendIdx["yourself"]=1;
  29562. $6=$8;
  29563. _st($5)._add_($6);
  29564. $ctx2.sendIdx["add:"]=2;
  29565. $9=sequence;
  29566. $11=_st($IRAssignment())._new();
  29567. $ctx2.sendIdx["new"]=2;
  29568. $12=$11;
  29569. $14=_st($IRVariable())._new();
  29570. $ctx2.sendIdx["new"]=3;
  29571. $16=_st($AliasVar())._new();
  29572. $ctx2.sendIdx["new"]=4;
  29573. $17=$16;
  29574. $18=_st(inlinedClosure)._scope();
  29575. $ctx2.sendIdx["scope"]=2;
  29576. _st($17)._scope_($18);
  29577. $ctx2.sendIdx["scope:"]=2;
  29578. _st($16)._name_(each);
  29579. $ctx2.sendIdx["name:"]=2;
  29580. $19=_st($16)._yourself();
  29581. $ctx2.sendIdx["yourself"]=2;
  29582. $15=$19;
  29583. $13=_st($14)._variable_($15);
  29584. $ctx2.sendIdx["variable:"]=1;
  29585. _st($12)._add_($13);
  29586. $ctx2.sendIdx["add:"]=4;
  29587. $20=$11;
  29588. $22=_st($IRVariable())._new();
  29589. $ctx2.sendIdx["new"]=5;
  29590. $24=_st($AliasVar())._new();
  29591. _st($24)._scope_(_st(inlinedClosure)._scope());
  29592. _st($24)._name_("$receiver");
  29593. $25=_st($24)._yourself();
  29594. $ctx2.sendIdx["yourself"]=3;
  29595. $23=$25;
  29596. $21=_st($22)._variable_($23);
  29597. _st($20)._add_($21);
  29598. $ctx2.sendIdx["add:"]=5;
  29599. $26=_st($11)._yourself();
  29600. $10=$26;
  29601. return _st($9)._add_($10);
  29602. $ctx2.sendIdx["add:"]=3;
  29603. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29604. $ctx1.sendIdx["do:"]=2;
  29605. _st(inlinedClosure)._add_(sequence);
  29606. $ctx1.sendIdx["add:"]=6;
  29607. $28=_st(anIRClosure)._instructions();
  29608. $ctx1.sendIdx["instructions"]=2;
  29609. $27=_st($28)._last();
  29610. $ctx1.sendIdx["last"]=1;
  29611. statements=_st($27)._instructions();
  29612. $ctx1.sendIdx["instructions"]=1;
  29613. _st(statements)._ifNotEmpty_((function(){
  29614. return smalltalk.withContext(function($ctx2) {
  29615. _st(_st(statements)._allButLast())._do_((function(each){
  29616. return smalltalk.withContext(function($ctx3) {
  29617. return _st(sequence)._add_(each);
  29618. $ctx3.sendIdx["add:"]=7;
  29619. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
  29620. $31=_st(statements)._last();
  29621. $ctx2.sendIdx["last"]=2;
  29622. $30=_st($31)._isReturn();
  29623. $29=_st($30)._and_((function(){
  29624. return smalltalk.withContext(function($ctx3) {
  29625. $32=_st(statements)._last();
  29626. $ctx3.sendIdx["last"]=3;
  29627. return _st($32)._isBlockReturn();
  29628. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  29629. if(smalltalk.assert($29)){
  29630. $33=sequence;
  29631. $36=_st(statements)._last();
  29632. $ctx2.sendIdx["last"]=4;
  29633. $35=_st($36)._instructions();
  29634. $34=_st($35)._first();
  29635. return _st($33)._add_($34);
  29636. $ctx2.sendIdx["add:"]=8;
  29637. } else {
  29638. return _st(sequence)._add_(_st(statements)._last());
  29639. };
  29640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  29641. $37=inlinedClosure;
  29642. return $37;
  29643. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)})},
  29644. args: ["anIRClosure"],
  29645. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  29646. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"],
  29647. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"]
  29648. }),
  29649. globals.IRSendInliner);
  29650. smalltalk.addMethod(
  29651. smalltalk.method({
  29652. selector: "inlineSend:",
  29653. protocol: 'inlining',
  29654. fn: function (anIRSend){
  29655. var self=this;
  29656. return smalltalk.withContext(function($ctx1) {
  29657. var $3,$2,$1;
  29658. self._send_(anIRSend);
  29659. $3=self._send();
  29660. $ctx1.sendIdx["send"]=1;
  29661. $2=_st($3)._selector();
  29662. $1=self._perform_withArguments_($2,_st(_st(self._send())._instructions())._allButFirst());
  29663. return $1;
  29664. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)})},
  29665. args: ["anIRSend"],
  29666. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  29667. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  29668. referencedClasses: []
  29669. }),
  29670. globals.IRSendInliner);
  29671. smalltalk.addMethod(
  29672. smalltalk.method({
  29673. selector: "inlinedClosure",
  29674. protocol: 'factory',
  29675. fn: function (){
  29676. var self=this;
  29677. function $IRInlinedClosure(){return globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  29678. return smalltalk.withContext(function($ctx1) {
  29679. var $1;
  29680. $1=_st($IRInlinedClosure())._new();
  29681. return $1;
  29682. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)})},
  29683. args: [],
  29684. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  29685. messageSends: ["new"],
  29686. referencedClasses: ["IRInlinedClosure"]
  29687. }),
  29688. globals.IRSendInliner);
  29689. smalltalk.addMethod(
  29690. smalltalk.method({
  29691. selector: "inlinedSend:with:",
  29692. protocol: 'inlining',
  29693. fn: function (inlinedSend,anIRInstruction){
  29694. var self=this;
  29695. var inlinedClosure;
  29696. return smalltalk.withContext(function($ctx1) {
  29697. var $1,$2,$5,$4,$3,$6,$7;
  29698. $1=_st(anIRInstruction)._isClosure();
  29699. if(! smalltalk.assert($1)){
  29700. self._inliningError_("Message argument should be a block");
  29701. $ctx1.sendIdx["inliningError:"]=1;
  29702. };
  29703. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  29704. if(! smalltalk.assert($2)){
  29705. self._inliningError_("Inlined block should have zero argument");
  29706. };
  29707. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  29708. $5=self._send();
  29709. $ctx1.sendIdx["send"]=1;
  29710. $4=_st($5)._instructions();
  29711. $3=_st($4)._first();
  29712. _st(inlinedSend)._add_($3);
  29713. $ctx1.sendIdx["add:"]=1;
  29714. $6=_st(inlinedSend)._add_(inlinedClosure);
  29715. _st(self._send())._replaceWith_(inlinedSend);
  29716. $7=_st(_st(inlinedSend)._method())._internalVariables();
  29717. $ctx1.sendIdx["internalVariables"]=1;
  29718. _st($7)._addAll_(_st(inlinedSend)._internalVariables());
  29719. return inlinedSend;
  29720. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)})},
  29721. args: ["inlinedSend", "anIRInstruction"],
  29722. source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  29723. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"],
  29724. referencedClasses: []
  29725. }),
  29726. globals.IRSendInliner);
  29727. smalltalk.addMethod(
  29728. smalltalk.method({
  29729. selector: "inlinedSend:with:with:",
  29730. protocol: 'inlining',
  29731. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  29732. var self=this;
  29733. var inlinedClosure1,inlinedClosure2;
  29734. return smalltalk.withContext(function($ctx1) {
  29735. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  29736. $1=_st(anIRInstruction)._isClosure();
  29737. $ctx1.sendIdx["isClosure"]=1;
  29738. if(! smalltalk.assert($1)){
  29739. self._inliningError_("Message argument should be a block");
  29740. $ctx1.sendIdx["inliningError:"]=1;
  29741. };
  29742. $2=_st(anotherIRInstruction)._isClosure();
  29743. if(! smalltalk.assert($2)){
  29744. self._inliningError_("Message argument should be a block");
  29745. };
  29746. $3=self._translator();
  29747. $ctx1.sendIdx["translator"]=1;
  29748. $4=self._inlineClosure_(anIRInstruction);
  29749. $ctx1.sendIdx["inlineClosure:"]=1;
  29750. inlinedClosure1=_st($3)._visit_($4);
  29751. $ctx1.sendIdx["visit:"]=1;
  29752. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  29753. $7=self._send();
  29754. $ctx1.sendIdx["send"]=1;
  29755. $6=_st($7)._instructions();
  29756. $5=_st($6)._first();
  29757. _st(inlinedSend)._add_($5);
  29758. $ctx1.sendIdx["add:"]=1;
  29759. _st(inlinedSend)._add_(inlinedClosure1);
  29760. $ctx1.sendIdx["add:"]=2;
  29761. $8=_st(inlinedSend)._add_(inlinedClosure2);
  29762. _st(self._send())._replaceWith_(inlinedSend);
  29763. $9=_st(_st(inlinedSend)._method())._internalVariables();
  29764. $ctx1.sendIdx["internalVariables"]=1;
  29765. _st($9)._addAll_(_st(inlinedSend)._internalVariables());
  29766. return inlinedSend;
  29767. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)})},
  29768. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  29769. source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  29770. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"],
  29771. referencedClasses: []
  29772. }),
  29773. globals.IRSendInliner);
  29774. smalltalk.addMethod(
  29775. smalltalk.method({
  29776. selector: "inlinedSequence",
  29777. protocol: 'factory',
  29778. fn: function (){
  29779. var self=this;
  29780. function $IRInlinedSequence(){return globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  29781. return smalltalk.withContext(function($ctx1) {
  29782. var $1;
  29783. $1=_st($IRInlinedSequence())._new();
  29784. return $1;
  29785. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)})},
  29786. args: [],
  29787. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  29788. messageSends: ["new"],
  29789. referencedClasses: ["IRInlinedSequence"]
  29790. }),
  29791. globals.IRSendInliner);
  29792. smalltalk.addMethod(
  29793. smalltalk.method({
  29794. selector: "inliningError:",
  29795. protocol: 'error handling',
  29796. fn: function (aString){
  29797. var self=this;
  29798. function $InliningError(){return globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  29799. return smalltalk.withContext(function($ctx1) {
  29800. _st($InliningError())._signal_(aString);
  29801. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)})},
  29802. args: ["aString"],
  29803. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  29804. messageSends: ["signal:"],
  29805. referencedClasses: ["InliningError"]
  29806. }),
  29807. globals.IRSendInliner);
  29808. smalltalk.addMethod(
  29809. smalltalk.method({
  29810. selector: "send",
  29811. protocol: 'accessing',
  29812. fn: function (){
  29813. var self=this;
  29814. var $1;
  29815. $1=self["@send"];
  29816. return $1;
  29817. },
  29818. args: [],
  29819. source: "send\x0a\x09^ send",
  29820. messageSends: [],
  29821. referencedClasses: []
  29822. }),
  29823. globals.IRSendInliner);
  29824. smalltalk.addMethod(
  29825. smalltalk.method({
  29826. selector: "send:",
  29827. protocol: 'accessing',
  29828. fn: function (anIRSend){
  29829. var self=this;
  29830. self["@send"]=anIRSend;
  29831. return self},
  29832. args: ["anIRSend"],
  29833. source: "send: anIRSend\x0a\x09send := anIRSend",
  29834. messageSends: [],
  29835. referencedClasses: []
  29836. }),
  29837. globals.IRSendInliner);
  29838. smalltalk.addMethod(
  29839. smalltalk.method({
  29840. selector: "translator",
  29841. protocol: 'accessing',
  29842. fn: function (){
  29843. var self=this;
  29844. var $1;
  29845. $1=self["@translator"];
  29846. return $1;
  29847. },
  29848. args: [],
  29849. source: "translator\x0a\x09^ translator",
  29850. messageSends: [],
  29851. referencedClasses: []
  29852. }),
  29853. globals.IRSendInliner);
  29854. smalltalk.addMethod(
  29855. smalltalk.method({
  29856. selector: "translator:",
  29857. protocol: 'accessing',
  29858. fn: function (anASTTranslator){
  29859. var self=this;
  29860. self["@translator"]=anASTTranslator;
  29861. return self},
  29862. args: ["anASTTranslator"],
  29863. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  29864. messageSends: [],
  29865. referencedClasses: []
  29866. }),
  29867. globals.IRSendInliner);
  29868. smalltalk.addMethod(
  29869. smalltalk.method({
  29870. selector: "inlinedSelectors",
  29871. protocol: 'accessing',
  29872. fn: function (){
  29873. var self=this;
  29874. var $1;
  29875. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  29876. return $1;
  29877. },
  29878. args: [],
  29879. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  29880. messageSends: [],
  29881. referencedClasses: []
  29882. }),
  29883. globals.IRSendInliner.klass);
  29884. smalltalk.addMethod(
  29885. smalltalk.method({
  29886. selector: "shouldInline:",
  29887. protocol: 'accessing',
  29888. fn: function (anIRInstruction){
  29889. var self=this;
  29890. return smalltalk.withContext(function($ctx1) {
  29891. var $1,$2;
  29892. var $early={};
  29893. try {
  29894. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  29895. if(! smalltalk.assert($1)){
  29896. return false;
  29897. };
  29898. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  29899. return smalltalk.withContext(function($ctx2) {
  29900. $2=_st(each)._isClosure();
  29901. if(! smalltalk.assert($2)){
  29902. throw $early=[false];
  29903. };
  29904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  29905. return true;
  29906. }
  29907. catch(e) {if(e===$early)return e[0]; throw e}
  29908. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)})},
  29909. args: ["anIRInstruction"],
  29910. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
  29911. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"],
  29912. referencedClasses: []
  29913. }),
  29914. globals.IRSendInliner.klass);
  29915. smalltalk.addClass('IRAssignmentInliner', globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  29916. globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  29917. smalltalk.addMethod(
  29918. smalltalk.method({
  29919. selector: "assignment",
  29920. protocol: 'accessing',
  29921. fn: function (){
  29922. var self=this;
  29923. var $1;
  29924. $1=self["@assignment"];
  29925. return $1;
  29926. },
  29927. args: [],
  29928. source: "assignment\x0a\x09^ assignment",
  29929. messageSends: [],
  29930. referencedClasses: []
  29931. }),
  29932. globals.IRAssignmentInliner);
  29933. smalltalk.addMethod(
  29934. smalltalk.method({
  29935. selector: "assignment:",
  29936. protocol: 'accessing',
  29937. fn: function (aNode){
  29938. var self=this;
  29939. self["@assignment"]=aNode;
  29940. return self},
  29941. args: ["aNode"],
  29942. source: "assignment: aNode\x0a\x09assignment := aNode",
  29943. messageSends: [],
  29944. referencedClasses: []
  29945. }),
  29946. globals.IRAssignmentInliner);
  29947. smalltalk.addMethod(
  29948. smalltalk.method({
  29949. selector: "inlineAssignment:",
  29950. protocol: 'inlining',
  29951. fn: function (anIRAssignment){
  29952. var self=this;
  29953. var inlinedAssignment;
  29954. function $IRInlinedAssignment(){return globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  29955. return smalltalk.withContext(function($ctx1) {
  29956. var $1,$2;
  29957. self._assignment_(anIRAssignment);
  29958. inlinedAssignment=_st($IRInlinedAssignment())._new();
  29959. $1=_st(anIRAssignment)._instructions();
  29960. $ctx1.sendIdx["instructions"]=1;
  29961. _st($1)._do_((function(each){
  29962. return smalltalk.withContext(function($ctx2) {
  29963. return _st(inlinedAssignment)._add_(each);
  29964. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  29965. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  29966. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  29967. $2=inlinedAssignment;
  29968. return $2;
  29969. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)})},
  29970. args: ["anIRAssignment"],
  29971. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  29972. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  29973. referencedClasses: ["IRInlinedAssignment"]
  29974. }),
  29975. globals.IRAssignmentInliner);
  29976. smalltalk.addMethod(
  29977. smalltalk.method({
  29978. selector: "inlineClosure:",
  29979. protocol: 'inlining',
  29980. fn: function (anIRClosure){
  29981. var self=this;
  29982. var inlinedClosure,statements;
  29983. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  29984. return smalltalk.withContext(function($ctx1) {
  29985. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  29986. inlinedClosure=($ctx1.supercall = true, globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  29987. $ctx1.supercall = false;
  29988. $2=_st(inlinedClosure)._instructions();
  29989. $ctx1.sendIdx["instructions"]=2;
  29990. $1=_st($2)._last();
  29991. $ctx1.sendIdx["last"]=1;
  29992. statements=_st($1)._instructions();
  29993. $ctx1.sendIdx["instructions"]=1;
  29994. _st(statements)._ifNotEmpty_((function(){
  29995. return smalltalk.withContext(function($ctx2) {
  29996. $4=_st(statements)._last();
  29997. $ctx2.sendIdx["last"]=2;
  29998. $3=_st($4)._canBeAssigned();
  29999. if(smalltalk.assert($3)){
  30000. $5=_st(statements)._last();
  30001. $ctx2.sendIdx["last"]=3;
  30002. $7=_st($IRAssignment())._new();
  30003. _st($7)._add_(_st(_st(self._assignment())._instructions())._first());
  30004. $ctx2.sendIdx["add:"]=1;
  30005. _st($7)._add_(_st(_st(statements)._last())._copy());
  30006. $8=_st($7)._yourself();
  30007. $6=$8;
  30008. return _st($5)._replaceWith_($6);
  30009. };
  30010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30011. $9=inlinedClosure;
  30012. return $9;
  30013. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)})},
  30014. args: ["anIRClosure"],
  30015. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  30016. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"],
  30017. referencedClasses: ["IRAssignment"]
  30018. }),
  30019. globals.IRAssignmentInliner);
  30020. smalltalk.addClass('IRReturnInliner', globals.IRSendInliner, [], 'Compiler-Inlining');
  30021. globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  30022. smalltalk.addMethod(
  30023. smalltalk.method({
  30024. selector: "inlineClosure:",
  30025. protocol: 'inlining',
  30026. fn: function (anIRClosure){
  30027. var self=this;
  30028. var closure,statements;
  30029. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  30030. return smalltalk.withContext(function($ctx1) {
  30031. var $1,$3,$2,$4,$5,$6,$7;
  30032. closure=($ctx1.supercall = true, globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  30033. $ctx1.supercall = false;
  30034. $1=_st(_st(closure)._instructions())._last();
  30035. $ctx1.sendIdx["last"]=1;
  30036. statements=_st($1)._instructions();
  30037. $ctx1.sendIdx["instructions"]=1;
  30038. _st(statements)._ifNotEmpty_((function(){
  30039. return smalltalk.withContext(function($ctx2) {
  30040. $3=_st(statements)._last();
  30041. $ctx2.sendIdx["last"]=2;
  30042. $2=_st($3)._isReturn();
  30043. if(! smalltalk.assert($2)){
  30044. $4=_st(statements)._last();
  30045. $ctx2.sendIdx["last"]=3;
  30046. $5=_st($IRReturn())._new();
  30047. _st($5)._add_(_st(_st(statements)._last())._copy());
  30048. $6=_st($5)._yourself();
  30049. return _st($4)._replaceWith_($6);
  30050. };
  30051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30052. $7=closure;
  30053. return $7;
  30054. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)})},
  30055. args: ["anIRClosure"],
  30056. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  30057. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"],
  30058. referencedClasses: ["IRReturn"]
  30059. }),
  30060. globals.IRReturnInliner);
  30061. smalltalk.addMethod(
  30062. smalltalk.method({
  30063. selector: "inlineReturn:",
  30064. protocol: 'inlining',
  30065. fn: function (anIRReturn){
  30066. var self=this;
  30067. var return_;
  30068. return smalltalk.withContext(function($ctx1) {
  30069. var $1,$2;
  30070. return_=self._inlinedReturn();
  30071. $1=_st(anIRReturn)._instructions();
  30072. $ctx1.sendIdx["instructions"]=1;
  30073. _st($1)._do_((function(each){
  30074. return smalltalk.withContext(function($ctx2) {
  30075. return _st(return_)._add_(each);
  30076. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  30077. _st(anIRReturn)._replaceWith_(return_);
  30078. self._inlineSend_(_st(_st(return_)._instructions())._last());
  30079. $2=return_;
  30080. return $2;
  30081. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)})},
  30082. args: ["anIRReturn"],
  30083. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  30084. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
  30085. referencedClasses: []
  30086. }),
  30087. globals.IRReturnInliner);
  30088. smalltalk.addMethod(
  30089. smalltalk.method({
  30090. selector: "inlinedReturn",
  30091. protocol: 'factory',
  30092. fn: function (){
  30093. var self=this;
  30094. function $IRInlinedReturn(){return globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  30095. return smalltalk.withContext(function($ctx1) {
  30096. var $1;
  30097. $1=_st($IRInlinedReturn())._new();
  30098. return $1;
  30099. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)})},
  30100. args: [],
  30101. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  30102. messageSends: ["new"],
  30103. referencedClasses: ["IRInlinedReturn"]
  30104. }),
  30105. globals.IRReturnInliner);
  30106. smalltalk.addClass('InliningCodeGenerator', globals.CodeGenerator, [], 'Compiler-Inlining');
  30107. globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  30108. smalltalk.addMethod(
  30109. smalltalk.method({
  30110. selector: "compileNode:",
  30111. protocol: 'compiling',
  30112. fn: function (aNode){
  30113. var self=this;
  30114. var ir,stream;
  30115. return smalltalk.withContext(function($ctx1) {
  30116. var $2,$3,$1;
  30117. _st(self._semanticAnalyzer())._visit_(aNode);
  30118. $ctx1.sendIdx["visit:"]=1;
  30119. ir=_st(self._translator())._visit_(aNode);
  30120. $ctx1.sendIdx["visit:"]=2;
  30121. _st(self._inliner())._visit_(ir);
  30122. $ctx1.sendIdx["visit:"]=3;
  30123. $2=self._irTranslator();
  30124. _st($2)._currentClass_(self._currentClass());
  30125. _st($2)._visit_(ir);
  30126. $3=_st($2)._contents();
  30127. $1=$3;
  30128. return $1;
  30129. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)})},
  30130. args: ["aNode"],
  30131. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  30132. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"],
  30133. referencedClasses: []
  30134. }),
  30135. globals.InliningCodeGenerator);
  30136. smalltalk.addMethod(
  30137. smalltalk.method({
  30138. selector: "inliner",
  30139. protocol: 'compiling',
  30140. fn: function (){
  30141. var self=this;
  30142. function $IRInliner(){return globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  30143. return smalltalk.withContext(function($ctx1) {
  30144. var $1;
  30145. $1=_st($IRInliner())._new();
  30146. return $1;
  30147. }, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)})},
  30148. args: [],
  30149. source: "inliner\x0a\x09^ IRInliner new",
  30150. messageSends: ["new"],
  30151. referencedClasses: ["IRInliner"]
  30152. }),
  30153. globals.InliningCodeGenerator);
  30154. smalltalk.addMethod(
  30155. smalltalk.method({
  30156. selector: "irTranslator",
  30157. protocol: 'compiling',
  30158. fn: function (){
  30159. var self=this;
  30160. function $IRInliningJSTranslator(){return globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  30161. return smalltalk.withContext(function($ctx1) {
  30162. var $1;
  30163. $1=_st($IRInliningJSTranslator())._new();
  30164. return $1;
  30165. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)})},
  30166. args: [],
  30167. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  30168. messageSends: ["new"],
  30169. referencedClasses: ["IRInliningJSTranslator"]
  30170. }),
  30171. globals.InliningCodeGenerator);
  30172. });
  30173. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  30174. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  30175. smalltalk.addPackage('Compiler-Semantic');
  30176. smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30177. smalltalk.addClass('LexicalScope', globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  30178. globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
  30179. smalltalk.addMethod(
  30180. smalltalk.method({
  30181. selector: "addArg:",
  30182. protocol: 'adding',
  30183. fn: function (aString){
  30184. var self=this;
  30185. function $ArgVar(){return globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  30186. return smalltalk.withContext(function($ctx1) {
  30187. var $1;
  30188. $1=self._args();
  30189. $ctx1.sendIdx["args"]=1;
  30190. _st($1)._at_put_(aString,_st($ArgVar())._on_(aString));
  30191. _st(_st(self._args())._at_(aString))._scope_(self);
  30192. return self}, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},globals.LexicalScope)})},
  30193. args: ["aString"],
  30194. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  30195. messageSends: ["at:put:", "args", "on:", "scope:", "at:"],
  30196. referencedClasses: ["ArgVar"]
  30197. }),
  30198. globals.LexicalScope);
  30199. smalltalk.addMethod(
  30200. smalltalk.method({
  30201. selector: "addTemp:",
  30202. protocol: 'adding',
  30203. fn: function (aString){
  30204. var self=this;
  30205. function $TempVar(){return globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  30206. return smalltalk.withContext(function($ctx1) {
  30207. var $1;
  30208. $1=self._temps();
  30209. $ctx1.sendIdx["temps"]=1;
  30210. _st($1)._at_put_(aString,_st($TempVar())._on_(aString));
  30211. _st(_st(self._temps())._at_(aString))._scope_(self);
  30212. return self}, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},globals.LexicalScope)})},
  30213. args: ["aString"],
  30214. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  30215. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"],
  30216. referencedClasses: ["TempVar"]
  30217. }),
  30218. globals.LexicalScope);
  30219. smalltalk.addMethod(
  30220. smalltalk.method({
  30221. selector: "alias",
  30222. protocol: 'accessing',
  30223. fn: function (){
  30224. var self=this;
  30225. return smalltalk.withContext(function($ctx1) {
  30226. var $1;
  30227. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  30228. return $1;
  30229. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.LexicalScope)})},
  30230. args: [],
  30231. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  30232. messageSends: [",", "asString", "scopeLevel"],
  30233. referencedClasses: []
  30234. }),
  30235. globals.LexicalScope);
  30236. smalltalk.addMethod(
  30237. smalltalk.method({
  30238. selector: "allVariableNames",
  30239. protocol: 'accessing',
  30240. fn: function (){
  30241. var self=this;
  30242. return smalltalk.withContext(function($ctx1) {
  30243. var $2,$1;
  30244. $2=_st(self._args())._keys();
  30245. $ctx1.sendIdx["keys"]=1;
  30246. $1=_st($2).__comma(_st(self._temps())._keys());
  30247. return $1;
  30248. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.LexicalScope)})},
  30249. args: [],
  30250. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  30251. messageSends: [",", "keys", "args", "temps"],
  30252. referencedClasses: []
  30253. }),
  30254. globals.LexicalScope);
  30255. smalltalk.addMethod(
  30256. smalltalk.method({
  30257. selector: "args",
  30258. protocol: 'accessing',
  30259. fn: function (){
  30260. var self=this;
  30261. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30262. return smalltalk.withContext(function($ctx1) {
  30263. var $2,$1,$receiver;
  30264. $2=self["@args"];
  30265. if(($receiver = $2) == null || $receiver.isNil){
  30266. self["@args"]=_st($Dictionary())._new();
  30267. $1=self["@args"];
  30268. } else {
  30269. $1=$2;
  30270. };
  30271. return $1;
  30272. }, function($ctx1) {$ctx1.fill(self,"args",{},globals.LexicalScope)})},
  30273. args: [],
  30274. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  30275. messageSends: ["ifNil:", "new"],
  30276. referencedClasses: ["Dictionary"]
  30277. }),
  30278. globals.LexicalScope);
  30279. smalltalk.addMethod(
  30280. smalltalk.method({
  30281. selector: "bindingFor:",
  30282. protocol: 'accessing',
  30283. fn: function (aStringOrNode){
  30284. var self=this;
  30285. return smalltalk.withContext(function($ctx1) {
  30286. var $2,$3,$4,$5,$1;
  30287. $2=self._pseudoVars();
  30288. $3=_st(aStringOrNode)._value();
  30289. $ctx1.sendIdx["value"]=1;
  30290. $1=_st($2)._at_ifAbsent_($3,(function(){
  30291. return smalltalk.withContext(function($ctx2) {
  30292. $4=self._args();
  30293. $5=_st(aStringOrNode)._value();
  30294. $ctx2.sendIdx["value"]=2;
  30295. return _st($4)._at_ifAbsent_($5,(function(){
  30296. return smalltalk.withContext(function($ctx3) {
  30297. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  30298. return nil;
  30299. }));
  30300. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  30301. $ctx2.sendIdx["at:ifAbsent:"]=2;
  30302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30303. $ctx1.sendIdx["at:ifAbsent:"]=1;
  30304. return $1;
  30305. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},globals.LexicalScope)})},
  30306. args: ["aStringOrNode"],
  30307. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  30308. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"],
  30309. referencedClasses: []
  30310. }),
  30311. globals.LexicalScope);
  30312. smalltalk.addMethod(
  30313. smalltalk.method({
  30314. selector: "blockIndex",
  30315. protocol: 'accessing',
  30316. fn: function (){
  30317. var self=this;
  30318. return smalltalk.withContext(function($ctx1) {
  30319. var $2,$1,$receiver;
  30320. $2=self["@blockIndex"];
  30321. if(($receiver = $2) == null || $receiver.isNil){
  30322. $1=(0);
  30323. } else {
  30324. $1=$2;
  30325. };
  30326. return $1;
  30327. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},globals.LexicalScope)})},
  30328. args: [],
  30329. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  30330. messageSends: ["ifNil:"],
  30331. referencedClasses: []
  30332. }),
  30333. globals.LexicalScope);
  30334. smalltalk.addMethod(
  30335. smalltalk.method({
  30336. selector: "blockIndex:",
  30337. protocol: 'accessing',
  30338. fn: function (anInteger){
  30339. var self=this;
  30340. self["@blockIndex"]=anInteger;
  30341. return self},
  30342. args: ["anInteger"],
  30343. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  30344. messageSends: [],
  30345. referencedClasses: []
  30346. }),
  30347. globals.LexicalScope);
  30348. smalltalk.addMethod(
  30349. smalltalk.method({
  30350. selector: "canInlineNonLocalReturns",
  30351. protocol: 'testing',
  30352. fn: function (){
  30353. var self=this;
  30354. return smalltalk.withContext(function($ctx1) {
  30355. var $1;
  30356. $1=_st(self._isInlined())._and_((function(){
  30357. return smalltalk.withContext(function($ctx2) {
  30358. return _st(self._outerScope())._canInlineNonLocalReturns();
  30359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30360. return $1;
  30361. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},globals.LexicalScope)})},
  30362. args: [],
  30363. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  30364. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"],
  30365. referencedClasses: []
  30366. }),
  30367. globals.LexicalScope);
  30368. smalltalk.addMethod(
  30369. smalltalk.method({
  30370. selector: "instruction",
  30371. protocol: 'accessing',
  30372. fn: function (){
  30373. var self=this;
  30374. var $1;
  30375. $1=self["@instruction"];
  30376. return $1;
  30377. },
  30378. args: [],
  30379. source: "instruction\x0a\x09^ instruction",
  30380. messageSends: [],
  30381. referencedClasses: []
  30382. }),
  30383. globals.LexicalScope);
  30384. smalltalk.addMethod(
  30385. smalltalk.method({
  30386. selector: "instruction:",
  30387. protocol: 'accessing',
  30388. fn: function (anIRInstruction){
  30389. var self=this;
  30390. self["@instruction"]=anIRInstruction;
  30391. return self},
  30392. args: ["anIRInstruction"],
  30393. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  30394. messageSends: [],
  30395. referencedClasses: []
  30396. }),
  30397. globals.LexicalScope);
  30398. smalltalk.addMethod(
  30399. smalltalk.method({
  30400. selector: "isBlockScope",
  30401. protocol: 'testing',
  30402. fn: function (){
  30403. var self=this;
  30404. return smalltalk.withContext(function($ctx1) {
  30405. var $1;
  30406. $1=_st(self._isMethodScope())._not();
  30407. return $1;
  30408. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},globals.LexicalScope)})},
  30409. args: [],
  30410. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  30411. messageSends: ["not", "isMethodScope"],
  30412. referencedClasses: []
  30413. }),
  30414. globals.LexicalScope);
  30415. smalltalk.addMethod(
  30416. smalltalk.method({
  30417. selector: "isInlined",
  30418. protocol: 'testing',
  30419. fn: function (){
  30420. var self=this;
  30421. return smalltalk.withContext(function($ctx1) {
  30422. var $3,$2,$1;
  30423. $3=self._instruction();
  30424. $ctx1.sendIdx["instruction"]=1;
  30425. $2=_st($3)._notNil();
  30426. $1=_st($2)._and_((function(){
  30427. return smalltalk.withContext(function($ctx2) {
  30428. return _st(self._instruction())._isInlined();
  30429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  30430. return $1;
  30431. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},globals.LexicalScope)})},
  30432. args: [],
  30433. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  30434. messageSends: ["and:", "notNil", "instruction", "isInlined"],
  30435. referencedClasses: []
  30436. }),
  30437. globals.LexicalScope);
  30438. smalltalk.addMethod(
  30439. smalltalk.method({
  30440. selector: "isMethodScope",
  30441. protocol: 'testing',
  30442. fn: function (){
  30443. var self=this;
  30444. return false;
  30445. },
  30446. args: [],
  30447. source: "isMethodScope\x0a\x09^ false",
  30448. messageSends: [],
  30449. referencedClasses: []
  30450. }),
  30451. globals.LexicalScope);
  30452. smalltalk.addMethod(
  30453. smalltalk.method({
  30454. selector: "lookupVariable:",
  30455. protocol: 'accessing',
  30456. fn: function (aNode){
  30457. var self=this;
  30458. var lookup;
  30459. return smalltalk.withContext(function($ctx1) {
  30460. var $1,$2,$3,$receiver;
  30461. lookup=self._bindingFor_(aNode);
  30462. $1=lookup;
  30463. if(($receiver = $1) == null || $receiver.isNil){
  30464. $2=self._outerScope();
  30465. $ctx1.sendIdx["outerScope"]=1;
  30466. if(($receiver = $2) == null || $receiver.isNil){
  30467. lookup=$2;
  30468. } else {
  30469. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  30470. };
  30471. lookup;
  30472. } else {
  30473. $1;
  30474. };
  30475. $3=lookup;
  30476. return $3;
  30477. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},globals.LexicalScope)})},
  30478. args: ["aNode"],
  30479. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  30480. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"],
  30481. referencedClasses: []
  30482. }),
  30483. globals.LexicalScope);
  30484. smalltalk.addMethod(
  30485. smalltalk.method({
  30486. selector: "methodScope",
  30487. protocol: 'accessing',
  30488. fn: function (){
  30489. var self=this;
  30490. return smalltalk.withContext(function($ctx1) {
  30491. var $2,$1,$receiver;
  30492. $2=self._outerScope();
  30493. $ctx1.sendIdx["outerScope"]=1;
  30494. if(($receiver = $2) == null || $receiver.isNil){
  30495. $1=$2;
  30496. } else {
  30497. $1=_st(self._outerScope())._methodScope();
  30498. };
  30499. return $1;
  30500. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},globals.LexicalScope)})},
  30501. args: [],
  30502. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  30503. messageSends: ["ifNotNil:", "outerScope", "methodScope"],
  30504. referencedClasses: []
  30505. }),
  30506. globals.LexicalScope);
  30507. smalltalk.addMethod(
  30508. smalltalk.method({
  30509. selector: "node",
  30510. protocol: 'accessing',
  30511. fn: function (){
  30512. var self=this;
  30513. var $1;
  30514. $1=self["@node"];
  30515. return $1;
  30516. },
  30517. args: [],
  30518. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  30519. messageSends: [],
  30520. referencedClasses: []
  30521. }),
  30522. globals.LexicalScope);
  30523. smalltalk.addMethod(
  30524. smalltalk.method({
  30525. selector: "node:",
  30526. protocol: 'accessing',
  30527. fn: function (aNode){
  30528. var self=this;
  30529. self["@node"]=aNode;
  30530. return self},
  30531. args: ["aNode"],
  30532. source: "node: aNode\x0a\x09node := aNode",
  30533. messageSends: [],
  30534. referencedClasses: []
  30535. }),
  30536. globals.LexicalScope);
  30537. smalltalk.addMethod(
  30538. smalltalk.method({
  30539. selector: "outerScope",
  30540. protocol: 'accessing',
  30541. fn: function (){
  30542. var self=this;
  30543. var $1;
  30544. $1=self["@outerScope"];
  30545. return $1;
  30546. },
  30547. args: [],
  30548. source: "outerScope\x0a\x09^ outerScope",
  30549. messageSends: [],
  30550. referencedClasses: []
  30551. }),
  30552. globals.LexicalScope);
  30553. smalltalk.addMethod(
  30554. smalltalk.method({
  30555. selector: "outerScope:",
  30556. protocol: 'accessing',
  30557. fn: function (aLexicalScope){
  30558. var self=this;
  30559. self["@outerScope"]=aLexicalScope;
  30560. return self},
  30561. args: ["aLexicalScope"],
  30562. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  30563. messageSends: [],
  30564. referencedClasses: []
  30565. }),
  30566. globals.LexicalScope);
  30567. smalltalk.addMethod(
  30568. smalltalk.method({
  30569. selector: "pseudoVars",
  30570. protocol: 'accessing',
  30571. fn: function (){
  30572. var self=this;
  30573. return smalltalk.withContext(function($ctx1) {
  30574. var $1;
  30575. $1=_st(self._methodScope())._pseudoVars();
  30576. return $1;
  30577. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.LexicalScope)})},
  30578. args: [],
  30579. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  30580. messageSends: ["pseudoVars", "methodScope"],
  30581. referencedClasses: []
  30582. }),
  30583. globals.LexicalScope);
  30584. smalltalk.addMethod(
  30585. smalltalk.method({
  30586. selector: "scopeLevel",
  30587. protocol: 'accessing',
  30588. fn: function (){
  30589. var self=this;
  30590. return smalltalk.withContext(function($ctx1) {
  30591. var $1,$2,$4,$3,$5,$receiver;
  30592. $1=self._outerScope();
  30593. $ctx1.sendIdx["outerScope"]=1;
  30594. if(($receiver = $1) == null || $receiver.isNil){
  30595. return (1);
  30596. } else {
  30597. $1;
  30598. };
  30599. $2=self._isInlined();
  30600. if(smalltalk.assert($2)){
  30601. $4=self._outerScope();
  30602. $ctx1.sendIdx["outerScope"]=2;
  30603. $3=_st($4)._scopeLevel();
  30604. $ctx1.sendIdx["scopeLevel"]=1;
  30605. return $3;
  30606. };
  30607. $5=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  30608. return $5;
  30609. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},globals.LexicalScope)})},
  30610. args: [],
  30611. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  30612. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"],
  30613. referencedClasses: []
  30614. }),
  30615. globals.LexicalScope);
  30616. smalltalk.addMethod(
  30617. smalltalk.method({
  30618. selector: "temps",
  30619. protocol: 'accessing',
  30620. fn: function (){
  30621. var self=this;
  30622. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30623. return smalltalk.withContext(function($ctx1) {
  30624. var $2,$1,$receiver;
  30625. $2=self["@temps"];
  30626. if(($receiver = $2) == null || $receiver.isNil){
  30627. self["@temps"]=_st($Dictionary())._new();
  30628. $1=self["@temps"];
  30629. } else {
  30630. $1=$2;
  30631. };
  30632. return $1;
  30633. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.LexicalScope)})},
  30634. args: [],
  30635. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  30636. messageSends: ["ifNil:", "new"],
  30637. referencedClasses: ["Dictionary"]
  30638. }),
  30639. globals.LexicalScope);
  30640. smalltalk.addClass('MethodLexicalScope', globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  30641. globals.MethodLexicalScope.comment="I represent a method scope.";
  30642. smalltalk.addMethod(
  30643. smalltalk.method({
  30644. selector: "addIVar:",
  30645. protocol: 'adding',
  30646. fn: function (aString){
  30647. var self=this;
  30648. function $InstanceVar(){return globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  30649. return smalltalk.withContext(function($ctx1) {
  30650. var $1;
  30651. $1=self._iVars();
  30652. $ctx1.sendIdx["iVars"]=1;
  30653. _st($1)._at_put_(aString,_st($InstanceVar())._on_(aString));
  30654. _st(_st(self._iVars())._at_(aString))._scope_(self);
  30655. return self}, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},globals.MethodLexicalScope)})},
  30656. args: ["aString"],
  30657. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  30658. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"],
  30659. referencedClasses: ["InstanceVar"]
  30660. }),
  30661. globals.MethodLexicalScope);
  30662. smalltalk.addMethod(
  30663. smalltalk.method({
  30664. selector: "addNonLocalReturn:",
  30665. protocol: 'adding',
  30666. fn: function (aScope){
  30667. var self=this;
  30668. return smalltalk.withContext(function($ctx1) {
  30669. _st(self._nonLocalReturns())._add_(aScope);
  30670. return self}, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
  30671. args: ["aScope"],
  30672. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  30673. messageSends: ["add:", "nonLocalReturns"],
  30674. referencedClasses: []
  30675. }),
  30676. globals.MethodLexicalScope);
  30677. smalltalk.addMethod(
  30678. smalltalk.method({
  30679. selector: "allVariableNames",
  30680. protocol: 'accessing',
  30681. fn: function (){
  30682. var self=this;
  30683. return smalltalk.withContext(function($ctx1) {
  30684. var $2,$1;
  30685. $2=($ctx1.supercall = true, globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), []));
  30686. $ctx1.supercall = false;
  30687. $1=_st($2).__comma(_st(self._iVars())._keys());
  30688. return $1;
  30689. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.MethodLexicalScope)})},
  30690. args: [],
  30691. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  30692. messageSends: [",", "allVariableNames", "keys", "iVars"],
  30693. referencedClasses: []
  30694. }),
  30695. globals.MethodLexicalScope);
  30696. smalltalk.addMethod(
  30697. smalltalk.method({
  30698. selector: "bindingFor:",
  30699. protocol: 'accessing',
  30700. fn: function (aNode){
  30701. var self=this;
  30702. return smalltalk.withContext(function($ctx1) {
  30703. var $2,$1,$receiver;
  30704. $2=($ctx1.supercall = true, globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]));
  30705. $ctx1.supercall = false;
  30706. if(($receiver = $2) == null || $receiver.isNil){
  30707. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  30708. return nil;
  30709. }));
  30710. } else {
  30711. $1=$2;
  30712. };
  30713. return $1;
  30714. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},globals.MethodLexicalScope)})},
  30715. args: ["aNode"],
  30716. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  30717. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"],
  30718. referencedClasses: []
  30719. }),
  30720. globals.MethodLexicalScope);
  30721. smalltalk.addMethod(
  30722. smalltalk.method({
  30723. selector: "canInlineNonLocalReturns",
  30724. protocol: 'testing',
  30725. fn: function (){
  30726. var self=this;
  30727. return true;
  30728. },
  30729. args: [],
  30730. source: "canInlineNonLocalReturns\x0a\x09^ true",
  30731. messageSends: [],
  30732. referencedClasses: []
  30733. }),
  30734. globals.MethodLexicalScope);
  30735. smalltalk.addMethod(
  30736. smalltalk.method({
  30737. selector: "hasLocalReturn",
  30738. protocol: 'testing',
  30739. fn: function (){
  30740. var self=this;
  30741. return smalltalk.withContext(function($ctx1) {
  30742. var $1;
  30743. $1=self._localReturn();
  30744. return $1;
  30745. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},globals.MethodLexicalScope)})},
  30746. args: [],
  30747. source: "hasLocalReturn\x0a\x09^ self localReturn",
  30748. messageSends: ["localReturn"],
  30749. referencedClasses: []
  30750. }),
  30751. globals.MethodLexicalScope);
  30752. smalltalk.addMethod(
  30753. smalltalk.method({
  30754. selector: "hasNonLocalReturn",
  30755. protocol: 'testing',
  30756. fn: function (){
  30757. var self=this;
  30758. return smalltalk.withContext(function($ctx1) {
  30759. var $1;
  30760. $1=_st(self._nonLocalReturns())._notEmpty();
  30761. return $1;
  30762. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},globals.MethodLexicalScope)})},
  30763. args: [],
  30764. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  30765. messageSends: ["notEmpty", "nonLocalReturns"],
  30766. referencedClasses: []
  30767. }),
  30768. globals.MethodLexicalScope);
  30769. smalltalk.addMethod(
  30770. smalltalk.method({
  30771. selector: "iVars",
  30772. protocol: 'accessing',
  30773. fn: function (){
  30774. var self=this;
  30775. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30776. return smalltalk.withContext(function($ctx1) {
  30777. var $2,$1,$receiver;
  30778. $2=self["@iVars"];
  30779. if(($receiver = $2) == null || $receiver.isNil){
  30780. self["@iVars"]=_st($Dictionary())._new();
  30781. $1=self["@iVars"];
  30782. } else {
  30783. $1=$2;
  30784. };
  30785. return $1;
  30786. }, function($ctx1) {$ctx1.fill(self,"iVars",{},globals.MethodLexicalScope)})},
  30787. args: [],
  30788. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  30789. messageSends: ["ifNil:", "new"],
  30790. referencedClasses: ["Dictionary"]
  30791. }),
  30792. globals.MethodLexicalScope);
  30793. smalltalk.addMethod(
  30794. smalltalk.method({
  30795. selector: "isMethodScope",
  30796. protocol: 'testing',
  30797. fn: function (){
  30798. var self=this;
  30799. return true;
  30800. },
  30801. args: [],
  30802. source: "isMethodScope\x0a\x09^ true",
  30803. messageSends: [],
  30804. referencedClasses: []
  30805. }),
  30806. globals.MethodLexicalScope);
  30807. smalltalk.addMethod(
  30808. smalltalk.method({
  30809. selector: "localReturn",
  30810. protocol: 'accessing',
  30811. fn: function (){
  30812. var self=this;
  30813. return smalltalk.withContext(function($ctx1) {
  30814. var $2,$1,$receiver;
  30815. $2=self["@localReturn"];
  30816. if(($receiver = $2) == null || $receiver.isNil){
  30817. $1=false;
  30818. } else {
  30819. $1=$2;
  30820. };
  30821. return $1;
  30822. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},globals.MethodLexicalScope)})},
  30823. args: [],
  30824. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  30825. messageSends: ["ifNil:"],
  30826. referencedClasses: []
  30827. }),
  30828. globals.MethodLexicalScope);
  30829. smalltalk.addMethod(
  30830. smalltalk.method({
  30831. selector: "localReturn:",
  30832. protocol: 'accessing',
  30833. fn: function (aBoolean){
  30834. var self=this;
  30835. self["@localReturn"]=aBoolean;
  30836. return self},
  30837. args: ["aBoolean"],
  30838. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  30839. messageSends: [],
  30840. referencedClasses: []
  30841. }),
  30842. globals.MethodLexicalScope);
  30843. smalltalk.addMethod(
  30844. smalltalk.method({
  30845. selector: "methodScope",
  30846. protocol: 'accessing',
  30847. fn: function (){
  30848. var self=this;
  30849. return self;
  30850. },
  30851. args: [],
  30852. source: "methodScope\x0a\x09^ self",
  30853. messageSends: [],
  30854. referencedClasses: []
  30855. }),
  30856. globals.MethodLexicalScope);
  30857. smalltalk.addMethod(
  30858. smalltalk.method({
  30859. selector: "nonLocalReturns",
  30860. protocol: 'accessing',
  30861. fn: function (){
  30862. var self=this;
  30863. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  30864. return smalltalk.withContext(function($ctx1) {
  30865. var $2,$1,$receiver;
  30866. $2=self["@nonLocalReturns"];
  30867. if(($receiver = $2) == null || $receiver.isNil){
  30868. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  30869. $1=self["@nonLocalReturns"];
  30870. } else {
  30871. $1=$2;
  30872. };
  30873. return $1;
  30874. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},globals.MethodLexicalScope)})},
  30875. args: [],
  30876. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  30877. messageSends: ["ifNil:", "new"],
  30878. referencedClasses: ["OrderedCollection"]
  30879. }),
  30880. globals.MethodLexicalScope);
  30881. smalltalk.addMethod(
  30882. smalltalk.method({
  30883. selector: "pseudoVars",
  30884. protocol: 'accessing',
  30885. fn: function (){
  30886. var self=this;
  30887. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  30888. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30889. function $PseudoVar(){return globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  30890. return smalltalk.withContext(function($ctx1) {
  30891. var $1,$2,$3,$4,$receiver;
  30892. $1=self["@pseudoVars"];
  30893. if(($receiver = $1) == null || $receiver.isNil){
  30894. self["@pseudoVars"]=_st($Dictionary())._new();
  30895. self["@pseudoVars"];
  30896. _st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
  30897. return smalltalk.withContext(function($ctx2) {
  30898. $2=_st($PseudoVar())._on_(each);
  30899. _st($2)._scope_(self._methodScope());
  30900. $3=_st($2)._yourself();
  30901. return _st(self["@pseudoVars"])._at_put_(each,$3);
  30902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  30903. } else {
  30904. $1;
  30905. };
  30906. $4=self["@pseudoVars"];
  30907. return $4;
  30908. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.MethodLexicalScope)})},
  30909. args: [],
  30910. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  30911. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"],
  30912. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"]
  30913. }),
  30914. globals.MethodLexicalScope);
  30915. smalltalk.addMethod(
  30916. smalltalk.method({
  30917. selector: "removeNonLocalReturn:",
  30918. protocol: 'adding',
  30919. fn: function (aScope){
  30920. var self=this;
  30921. return smalltalk.withContext(function($ctx1) {
  30922. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  30923. }));
  30924. return self}, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)})},
  30925. args: ["aScope"],
  30926. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  30927. messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
  30928. referencedClasses: []
  30929. }),
  30930. globals.MethodLexicalScope);
  30931. smalltalk.addMethod(
  30932. smalltalk.method({
  30933. selector: "unknownVariables",
  30934. protocol: 'accessing',
  30935. fn: function (){
  30936. var self=this;
  30937. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  30938. return smalltalk.withContext(function($ctx1) {
  30939. var $2,$1,$receiver;
  30940. $2=self["@unknownVariables"];
  30941. if(($receiver = $2) == null || $receiver.isNil){
  30942. self["@unknownVariables"]=_st($OrderedCollection())._new();
  30943. $1=self["@unknownVariables"];
  30944. } else {
  30945. $1=$2;
  30946. };
  30947. return $1;
  30948. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},globals.MethodLexicalScope)})},
  30949. args: [],
  30950. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  30951. messageSends: ["ifNil:", "new"],
  30952. referencedClasses: ["OrderedCollection"]
  30953. }),
  30954. globals.MethodLexicalScope);
  30955. smalltalk.addClass('ScopeVar', globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  30956. globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
  30957. smalltalk.addMethod(
  30958. smalltalk.method({
  30959. selector: "alias",
  30960. protocol: 'accessing',
  30961. fn: function (){
  30962. var self=this;
  30963. return smalltalk.withContext(function($ctx1) {
  30964. var $1;
  30965. $1=_st(self._name())._asVariableName();
  30966. return $1;
  30967. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ScopeVar)})},
  30968. args: [],
  30969. source: "alias\x0a\x09^ self name asVariableName",
  30970. messageSends: ["asVariableName", "name"],
  30971. referencedClasses: []
  30972. }),
  30973. globals.ScopeVar);
  30974. smalltalk.addMethod(
  30975. smalltalk.method({
  30976. selector: "isArgVar",
  30977. protocol: 'testing',
  30978. fn: function (){
  30979. var self=this;
  30980. return false;
  30981. },
  30982. args: [],
  30983. source: "isArgVar\x0a\x09^ false",
  30984. messageSends: [],
  30985. referencedClasses: []
  30986. }),
  30987. globals.ScopeVar);
  30988. smalltalk.addMethod(
  30989. smalltalk.method({
  30990. selector: "isClassRefVar",
  30991. protocol: 'testing',
  30992. fn: function (){
  30993. var self=this;
  30994. return false;
  30995. },
  30996. args: [],
  30997. source: "isClassRefVar\x0a\x09^ false",
  30998. messageSends: [],
  30999. referencedClasses: []
  31000. }),
  31001. globals.ScopeVar);
  31002. smalltalk.addMethod(
  31003. smalltalk.method({
  31004. selector: "isImmutable",
  31005. protocol: 'testing',
  31006. fn: function (){
  31007. var self=this;
  31008. return false;
  31009. },
  31010. args: [],
  31011. source: "isImmutable\x0a\x09^ false",
  31012. messageSends: [],
  31013. referencedClasses: []
  31014. }),
  31015. globals.ScopeVar);
  31016. smalltalk.addMethod(
  31017. smalltalk.method({
  31018. selector: "isInstanceVar",
  31019. protocol: 'testing',
  31020. fn: function (){
  31021. var self=this;
  31022. return false;
  31023. },
  31024. args: [],
  31025. source: "isInstanceVar\x0a\x09^ false",
  31026. messageSends: [],
  31027. referencedClasses: []
  31028. }),
  31029. globals.ScopeVar);
  31030. smalltalk.addMethod(
  31031. smalltalk.method({
  31032. selector: "isPseudoVar",
  31033. protocol: 'testing',
  31034. fn: function (){
  31035. var self=this;
  31036. return false;
  31037. },
  31038. args: [],
  31039. source: "isPseudoVar\x0a\x09^ false",
  31040. messageSends: [],
  31041. referencedClasses: []
  31042. }),
  31043. globals.ScopeVar);
  31044. smalltalk.addMethod(
  31045. smalltalk.method({
  31046. selector: "isTempVar",
  31047. protocol: 'testing',
  31048. fn: function (){
  31049. var self=this;
  31050. return false;
  31051. },
  31052. args: [],
  31053. source: "isTempVar\x0a\x09^ false",
  31054. messageSends: [],
  31055. referencedClasses: []
  31056. }),
  31057. globals.ScopeVar);
  31058. smalltalk.addMethod(
  31059. smalltalk.method({
  31060. selector: "isUnknownVar",
  31061. protocol: 'testing',
  31062. fn: function (){
  31063. var self=this;
  31064. return false;
  31065. },
  31066. args: [],
  31067. source: "isUnknownVar\x0a\x09^ false",
  31068. messageSends: [],
  31069. referencedClasses: []
  31070. }),
  31071. globals.ScopeVar);
  31072. smalltalk.addMethod(
  31073. smalltalk.method({
  31074. selector: "name",
  31075. protocol: 'accessing',
  31076. fn: function (){
  31077. var self=this;
  31078. var $1;
  31079. $1=self["@name"];
  31080. return $1;
  31081. },
  31082. args: [],
  31083. source: "name\x0a\x09^ name",
  31084. messageSends: [],
  31085. referencedClasses: []
  31086. }),
  31087. globals.ScopeVar);
  31088. smalltalk.addMethod(
  31089. smalltalk.method({
  31090. selector: "name:",
  31091. protocol: 'accessing',
  31092. fn: function (aString){
  31093. var self=this;
  31094. self["@name"]=aString;
  31095. return self},
  31096. args: ["aString"],
  31097. source: "name: aString\x0a\x09name := aString",
  31098. messageSends: [],
  31099. referencedClasses: []
  31100. }),
  31101. globals.ScopeVar);
  31102. smalltalk.addMethod(
  31103. smalltalk.method({
  31104. selector: "scope",
  31105. protocol: 'accessing',
  31106. fn: function (){
  31107. var self=this;
  31108. var $1;
  31109. $1=self["@scope"];
  31110. return $1;
  31111. },
  31112. args: [],
  31113. source: "scope\x0a\x09^ scope",
  31114. messageSends: [],
  31115. referencedClasses: []
  31116. }),
  31117. globals.ScopeVar);
  31118. smalltalk.addMethod(
  31119. smalltalk.method({
  31120. selector: "scope:",
  31121. protocol: 'accessing',
  31122. fn: function (aScope){
  31123. var self=this;
  31124. self["@scope"]=aScope;
  31125. return self},
  31126. args: ["aScope"],
  31127. source: "scope: aScope\x0a\x09scope := aScope",
  31128. messageSends: [],
  31129. referencedClasses: []
  31130. }),
  31131. globals.ScopeVar);
  31132. smalltalk.addMethod(
  31133. smalltalk.method({
  31134. selector: "validateAssignment",
  31135. protocol: 'testing',
  31136. fn: function (){
  31137. var self=this;
  31138. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  31139. return smalltalk.withContext(function($ctx1) {
  31140. var $1,$2,$3;
  31141. $1=_st(self._isArgVar())._or_((function(){
  31142. return smalltalk.withContext(function($ctx2) {
  31143. return self._isPseudoVar();
  31144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31145. if(smalltalk.assert($1)){
  31146. $2=_st($InvalidAssignmentError())._new();
  31147. _st($2)._variableName_(self._name());
  31148. $3=_st($2)._signal();
  31149. $3;
  31150. };
  31151. return self}, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},globals.ScopeVar)})},
  31152. args: [],
  31153. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  31154. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"],
  31155. referencedClasses: ["InvalidAssignmentError"]
  31156. }),
  31157. globals.ScopeVar);
  31158. smalltalk.addMethod(
  31159. smalltalk.method({
  31160. selector: "on:",
  31161. protocol: 'instance creation',
  31162. fn: function (aString){
  31163. var self=this;
  31164. return smalltalk.withContext(function($ctx1) {
  31165. var $2,$3,$1;
  31166. $2=self._new();
  31167. _st($2)._name_(aString);
  31168. $3=_st($2)._yourself();
  31169. $1=$3;
  31170. return $1;
  31171. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},globals.ScopeVar.klass)})},
  31172. args: ["aString"],
  31173. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  31174. messageSends: ["name:", "new", "yourself"],
  31175. referencedClasses: []
  31176. }),
  31177. globals.ScopeVar.klass);
  31178. smalltalk.addClass('AliasVar', globals.ScopeVar, ['node'], 'Compiler-Semantic');
  31179. globals.AliasVar.comment="I am an internally defined variable by the compiler";
  31180. smalltalk.addMethod(
  31181. smalltalk.method({
  31182. selector: "node",
  31183. protocol: 'accessing',
  31184. fn: function (){
  31185. var self=this;
  31186. var $1;
  31187. $1=self["@node"];
  31188. return $1;
  31189. },
  31190. args: [],
  31191. source: "node\x0a\x09^ node",
  31192. messageSends: [],
  31193. referencedClasses: []
  31194. }),
  31195. globals.AliasVar);
  31196. smalltalk.addMethod(
  31197. smalltalk.method({
  31198. selector: "node:",
  31199. protocol: 'accessing',
  31200. fn: function (aNode){
  31201. var self=this;
  31202. self["@node"]=aNode;
  31203. return self},
  31204. args: ["aNode"],
  31205. source: "node: aNode\x0a\x09node := aNode",
  31206. messageSends: [],
  31207. referencedClasses: []
  31208. }),
  31209. globals.AliasVar);
  31210. smalltalk.addClass('ArgVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31211. globals.ArgVar.comment="I am an argument of a method or block.";
  31212. smalltalk.addMethod(
  31213. smalltalk.method({
  31214. selector: "isArgVar",
  31215. protocol: 'testing',
  31216. fn: function (){
  31217. var self=this;
  31218. return true;
  31219. },
  31220. args: [],
  31221. source: "isArgVar\x0a\x09^ true",
  31222. messageSends: [],
  31223. referencedClasses: []
  31224. }),
  31225. globals.ArgVar);
  31226. smalltalk.addMethod(
  31227. smalltalk.method({
  31228. selector: "isImmutable",
  31229. protocol: 'testing',
  31230. fn: function (){
  31231. var self=this;
  31232. return true;
  31233. },
  31234. args: [],
  31235. source: "isImmutable\x0a\x09^ true",
  31236. messageSends: [],
  31237. referencedClasses: []
  31238. }),
  31239. globals.ArgVar);
  31240. smalltalk.addClass('ClassRefVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31241. globals.ClassRefVar.comment="I am an class reference variable";
  31242. smalltalk.addMethod(
  31243. smalltalk.method({
  31244. selector: "alias",
  31245. protocol: 'accessing',
  31246. fn: function (){
  31247. var self=this;
  31248. return smalltalk.withContext(function($ctx1) {
  31249. var $1;
  31250. $1=_st("$".__comma(self._name())).__comma("()");
  31251. $ctx1.sendIdx[","]=1;
  31252. return $1;
  31253. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ClassRefVar)})},
  31254. args: [],
  31255. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
  31256. messageSends: [",", "name"],
  31257. referencedClasses: []
  31258. }),
  31259. globals.ClassRefVar);
  31260. smalltalk.addMethod(
  31261. smalltalk.method({
  31262. selector: "isClassRefVar",
  31263. protocol: 'testing',
  31264. fn: function (){
  31265. var self=this;
  31266. return true;
  31267. },
  31268. args: [],
  31269. source: "isClassRefVar\x0a\x09^ true",
  31270. messageSends: [],
  31271. referencedClasses: []
  31272. }),
  31273. globals.ClassRefVar);
  31274. smalltalk.addMethod(
  31275. smalltalk.method({
  31276. selector: "isImmutable",
  31277. protocol: 'testing',
  31278. fn: function (){
  31279. var self=this;
  31280. return true;
  31281. },
  31282. args: [],
  31283. source: "isImmutable\x0a\x09^ true",
  31284. messageSends: [],
  31285. referencedClasses: []
  31286. }),
  31287. globals.ClassRefVar);
  31288. smalltalk.addClass('InstanceVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31289. globals.InstanceVar.comment="I am an instance variable of a method or block.";
  31290. smalltalk.addMethod(
  31291. smalltalk.method({
  31292. selector: "alias",
  31293. protocol: 'testing',
  31294. fn: function (){
  31295. var self=this;
  31296. return smalltalk.withContext(function($ctx1) {
  31297. var $1;
  31298. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  31299. $ctx1.sendIdx[","]=1;
  31300. return $1;
  31301. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.InstanceVar)})},
  31302. args: [],
  31303. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  31304. messageSends: [",", "name"],
  31305. referencedClasses: []
  31306. }),
  31307. globals.InstanceVar);
  31308. smalltalk.addMethod(
  31309. smalltalk.method({
  31310. selector: "isInstanceVar",
  31311. protocol: 'testing',
  31312. fn: function (){
  31313. var self=this;
  31314. return true;
  31315. },
  31316. args: [],
  31317. source: "isInstanceVar\x0a\x09^ true",
  31318. messageSends: [],
  31319. referencedClasses: []
  31320. }),
  31321. globals.InstanceVar);
  31322. smalltalk.addClass('PseudoVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31323. globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  31324. smalltalk.addMethod(
  31325. smalltalk.method({
  31326. selector: "alias",
  31327. protocol: 'accessing',
  31328. fn: function (){
  31329. var self=this;
  31330. return smalltalk.withContext(function($ctx1) {
  31331. var $1;
  31332. $1=self._name();
  31333. return $1;
  31334. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.PseudoVar)})},
  31335. args: [],
  31336. source: "alias\x0a\x09^ self name",
  31337. messageSends: ["name"],
  31338. referencedClasses: []
  31339. }),
  31340. globals.PseudoVar);
  31341. smalltalk.addMethod(
  31342. smalltalk.method({
  31343. selector: "isImmutable",
  31344. protocol: 'testing',
  31345. fn: function (){
  31346. var self=this;
  31347. return true;
  31348. },
  31349. args: [],
  31350. source: "isImmutable\x0a\x09^ true",
  31351. messageSends: [],
  31352. referencedClasses: []
  31353. }),
  31354. globals.PseudoVar);
  31355. smalltalk.addMethod(
  31356. smalltalk.method({
  31357. selector: "isPseudoVar",
  31358. protocol: 'testing',
  31359. fn: function (){
  31360. var self=this;
  31361. return true;
  31362. },
  31363. args: [],
  31364. source: "isPseudoVar\x0a\x09^ true",
  31365. messageSends: [],
  31366. referencedClasses: []
  31367. }),
  31368. globals.PseudoVar);
  31369. smalltalk.addClass('TempVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31370. globals.TempVar.comment="I am an temporary variable of a method or block.";
  31371. smalltalk.addMethod(
  31372. smalltalk.method({
  31373. selector: "isTempVar",
  31374. protocol: 'testing',
  31375. fn: function (){
  31376. var self=this;
  31377. return true;
  31378. },
  31379. args: [],
  31380. source: "isTempVar\x0a\x09^ true",
  31381. messageSends: [],
  31382. referencedClasses: []
  31383. }),
  31384. globals.TempVar);
  31385. smalltalk.addClass('UnknownVar', globals.ScopeVar, [], 'Compiler-Semantic');
  31386. globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  31387. smalltalk.addMethod(
  31388. smalltalk.method({
  31389. selector: "isUnknownVar",
  31390. protocol: 'testing',
  31391. fn: function (){
  31392. var self=this;
  31393. return true;
  31394. },
  31395. args: [],
  31396. source: "isUnknownVar\x0a\x09^ true",
  31397. messageSends: [],
  31398. referencedClasses: []
  31399. }),
  31400. globals.UnknownVar);
  31401. smalltalk.addClass('SemanticAnalyzer', globals.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  31402. globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  31403. smalltalk.addMethod(
  31404. smalltalk.method({
  31405. selector: "classReferences",
  31406. protocol: 'accessing',
  31407. fn: function (){
  31408. var self=this;
  31409. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  31410. return smalltalk.withContext(function($ctx1) {
  31411. var $2,$1,$receiver;
  31412. $2=self["@classReferences"];
  31413. if(($receiver = $2) == null || $receiver.isNil){
  31414. self["@classReferences"]=_st($Set())._new();
  31415. $1=self["@classReferences"];
  31416. } else {
  31417. $1=$2;
  31418. };
  31419. return $1;
  31420. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},globals.SemanticAnalyzer)})},
  31421. args: [],
  31422. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  31423. messageSends: ["ifNil:", "new"],
  31424. referencedClasses: ["Set"]
  31425. }),
  31426. globals.SemanticAnalyzer);
  31427. smalltalk.addMethod(
  31428. smalltalk.method({
  31429. selector: "errorShadowingVariable:",
  31430. protocol: 'error handling',
  31431. fn: function (aString){
  31432. var self=this;
  31433. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  31434. return smalltalk.withContext(function($ctx1) {
  31435. var $1,$2;
  31436. $1=_st($ShadowingVariableError())._new();
  31437. _st($1)._variableName_(aString);
  31438. $2=_st($1)._signal();
  31439. return self}, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},globals.SemanticAnalyzer)})},
  31440. args: ["aString"],
  31441. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  31442. messageSends: ["variableName:", "new", "signal"],
  31443. referencedClasses: ["ShadowingVariableError"]
  31444. }),
  31445. globals.SemanticAnalyzer);
  31446. smalltalk.addMethod(
  31447. smalltalk.method({
  31448. selector: "errorUnknownVariable:",
  31449. protocol: 'error handling',
  31450. fn: function (aNode){
  31451. var self=this;
  31452. var identifier;
  31453. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31454. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  31455. return smalltalk.withContext(function($ctx1) {
  31456. var $1,$2,$3,$4,$5;
  31457. identifier=_st(aNode)._value();
  31458. $ctx1.sendIdx["value"]=1;
  31459. $1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  31460. return smalltalk.withContext(function($ctx2) {
  31461. return self._isVariableGloballyUndefined_(identifier);
  31462. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31463. if(smalltalk.assert($1)){
  31464. $2=_st($UnknownVariableError())._new();
  31465. $3=$2;
  31466. $4=_st(aNode)._value();
  31467. $ctx1.sendIdx["value"]=2;
  31468. _st($3)._variableName_($4);
  31469. $5=_st($2)._signal();
  31470. $5;
  31471. } else {
  31472. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  31473. };
  31474. return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},globals.SemanticAnalyzer)})},
  31475. args: ["aNode"],
  31476. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  31477. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
  31478. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  31479. }),
  31480. globals.SemanticAnalyzer);
  31481. smalltalk.addMethod(
  31482. smalltalk.method({
  31483. selector: "isVariableGloballyUndefined:",
  31484. protocol: 'testing',
  31485. fn: function (aString){
  31486. var self=this;
  31487. return smalltalk.withContext(function($ctx1) {
  31488. return eval('typeof ' + aString + ' == "undefined"');
  31489. return self}, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},globals.SemanticAnalyzer)})},
  31490. args: ["aString"],
  31491. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  31492. messageSends: [],
  31493. referencedClasses: []
  31494. }),
  31495. globals.SemanticAnalyzer);
  31496. smalltalk.addMethod(
  31497. smalltalk.method({
  31498. selector: "messageSends",
  31499. protocol: 'accessing',
  31500. fn: function (){
  31501. var self=this;
  31502. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  31503. return smalltalk.withContext(function($ctx1) {
  31504. var $2,$1,$receiver;
  31505. $2=self["@messageSends"];
  31506. if(($receiver = $2) == null || $receiver.isNil){
  31507. self["@messageSends"]=_st($Dictionary())._new();
  31508. $1=self["@messageSends"];
  31509. } else {
  31510. $1=$2;
  31511. };
  31512. return $1;
  31513. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.SemanticAnalyzer)})},
  31514. args: [],
  31515. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  31516. messageSends: ["ifNil:", "new"],
  31517. referencedClasses: ["Dictionary"]
  31518. }),
  31519. globals.SemanticAnalyzer);
  31520. smalltalk.addMethod(
  31521. smalltalk.method({
  31522. selector: "newBlockScope",
  31523. protocol: 'factory',
  31524. fn: function (){
  31525. var self=this;
  31526. function $LexicalScope(){return globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  31527. return smalltalk.withContext(function($ctx1) {
  31528. var $1;
  31529. $1=self._newScopeOfClass_($LexicalScope());
  31530. return $1;
  31531. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},globals.SemanticAnalyzer)})},
  31532. args: [],
  31533. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  31534. messageSends: ["newScopeOfClass:"],
  31535. referencedClasses: ["LexicalScope"]
  31536. }),
  31537. globals.SemanticAnalyzer);
  31538. smalltalk.addMethod(
  31539. smalltalk.method({
  31540. selector: "newMethodScope",
  31541. protocol: 'factory',
  31542. fn: function (){
  31543. var self=this;
  31544. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  31545. return smalltalk.withContext(function($ctx1) {
  31546. var $1;
  31547. $1=self._newScopeOfClass_($MethodLexicalScope());
  31548. return $1;
  31549. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},globals.SemanticAnalyzer)})},
  31550. args: [],
  31551. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  31552. messageSends: ["newScopeOfClass:"],
  31553. referencedClasses: ["MethodLexicalScope"]
  31554. }),
  31555. globals.SemanticAnalyzer);
  31556. smalltalk.addMethod(
  31557. smalltalk.method({
  31558. selector: "newScopeOfClass:",
  31559. protocol: 'factory',
  31560. fn: function (aLexicalScopeClass){
  31561. var self=this;
  31562. return smalltalk.withContext(function($ctx1) {
  31563. var $2,$3,$1;
  31564. $2=_st(aLexicalScopeClass)._new();
  31565. _st($2)._outerScope_(self["@currentScope"]);
  31566. $3=_st($2)._yourself();
  31567. $1=$3;
  31568. return $1;
  31569. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},globals.SemanticAnalyzer)})},
  31570. args: ["aLexicalScopeClass"],
  31571. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  31572. messageSends: ["outerScope:", "new", "yourself"],
  31573. referencedClasses: []
  31574. }),
  31575. globals.SemanticAnalyzer);
  31576. smalltalk.addMethod(
  31577. smalltalk.method({
  31578. selector: "nextBlockIndex",
  31579. protocol: 'private',
  31580. fn: function (){
  31581. var self=this;
  31582. return smalltalk.withContext(function($ctx1) {
  31583. var $1,$2,$receiver;
  31584. $1=self["@blockIndex"];
  31585. if(($receiver = $1) == null || $receiver.isNil){
  31586. self["@blockIndex"]=(0);
  31587. self["@blockIndex"];
  31588. } else {
  31589. $1;
  31590. };
  31591. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  31592. $2=self["@blockIndex"];
  31593. return $2;
  31594. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},globals.SemanticAnalyzer)})},
  31595. args: [],
  31596. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  31597. messageSends: ["ifNil:", "+"],
  31598. referencedClasses: []
  31599. }),
  31600. globals.SemanticAnalyzer);
  31601. smalltalk.addMethod(
  31602. smalltalk.method({
  31603. selector: "popScope",
  31604. protocol: 'scope',
  31605. fn: function (){
  31606. var self=this;
  31607. return smalltalk.withContext(function($ctx1) {
  31608. var $1,$receiver;
  31609. $1=self["@currentScope"];
  31610. if(($receiver = $1) == null || $receiver.isNil){
  31611. $1;
  31612. } else {
  31613. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  31614. self["@currentScope"];
  31615. };
  31616. return self}, function($ctx1) {$ctx1.fill(self,"popScope",{},globals.SemanticAnalyzer)})},
  31617. args: [],
  31618. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  31619. messageSends: ["ifNotNil:", "outerScope"],
  31620. referencedClasses: []
  31621. }),
  31622. globals.SemanticAnalyzer);
  31623. smalltalk.addMethod(
  31624. smalltalk.method({
  31625. selector: "pushScope:",
  31626. protocol: 'scope',
  31627. fn: function (aScope){
  31628. var self=this;
  31629. return smalltalk.withContext(function($ctx1) {
  31630. _st(aScope)._outerScope_(self["@currentScope"]);
  31631. self["@currentScope"]=aScope;
  31632. return self}, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},globals.SemanticAnalyzer)})},
  31633. args: ["aScope"],
  31634. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  31635. messageSends: ["outerScope:"],
  31636. referencedClasses: []
  31637. }),
  31638. globals.SemanticAnalyzer);
  31639. smalltalk.addMethod(
  31640. smalltalk.method({
  31641. selector: "superSends",
  31642. protocol: 'accessing',
  31643. fn: function (){
  31644. var self=this;
  31645. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  31646. return smalltalk.withContext(function($ctx1) {
  31647. var $2,$1,$receiver;
  31648. $2=self["@superSends"];
  31649. if(($receiver = $2) == null || $receiver.isNil){
  31650. self["@superSends"]=_st($Dictionary())._new();
  31651. $1=self["@superSends"];
  31652. } else {
  31653. $1=$2;
  31654. };
  31655. return $1;
  31656. }, function($ctx1) {$ctx1.fill(self,"superSends",{},globals.SemanticAnalyzer)})},
  31657. args: [],
  31658. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  31659. messageSends: ["ifNil:", "new"],
  31660. referencedClasses: ["Dictionary"]
  31661. }),
  31662. globals.SemanticAnalyzer);
  31663. smalltalk.addMethod(
  31664. smalltalk.method({
  31665. selector: "theClass",
  31666. protocol: 'accessing',
  31667. fn: function (){
  31668. var self=this;
  31669. var $1;
  31670. $1=self["@theClass"];
  31671. return $1;
  31672. },
  31673. args: [],
  31674. source: "theClass\x0a\x09^ theClass",
  31675. messageSends: [],
  31676. referencedClasses: []
  31677. }),
  31678. globals.SemanticAnalyzer);
  31679. smalltalk.addMethod(
  31680. smalltalk.method({
  31681. selector: "theClass:",
  31682. protocol: 'accessing',
  31683. fn: function (aClass){
  31684. var self=this;
  31685. self["@theClass"]=aClass;
  31686. return self},
  31687. args: ["aClass"],
  31688. source: "theClass: aClass\x0a\x09theClass := aClass",
  31689. messageSends: [],
  31690. referencedClasses: []
  31691. }),
  31692. globals.SemanticAnalyzer);
  31693. smalltalk.addMethod(
  31694. smalltalk.method({
  31695. selector: "validateVariableScope:",
  31696. protocol: 'scope',
  31697. fn: function (aString){
  31698. var self=this;
  31699. return smalltalk.withContext(function($ctx1) {
  31700. var $1,$receiver;
  31701. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  31702. if(($receiver = $1) == null || $receiver.isNil){
  31703. $1;
  31704. } else {
  31705. self._errorShadowingVariable_(aString);
  31706. };
  31707. return self}, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},globals.SemanticAnalyzer)})},
  31708. args: ["aString"],
  31709. source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
  31710. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"],
  31711. referencedClasses: []
  31712. }),
  31713. globals.SemanticAnalyzer);
  31714. smalltalk.addMethod(
  31715. smalltalk.method({
  31716. selector: "visitAssignmentNode:",
  31717. protocol: 'visiting',
  31718. fn: function (aNode){
  31719. var self=this;
  31720. return smalltalk.withContext(function($ctx1) {
  31721. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]));
  31722. $ctx1.supercall = false;
  31723. _st(_st(aNode)._left())._beAssigned();
  31724. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31725. args: ["aNode"],
  31726. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  31727. messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
  31728. referencedClasses: []
  31729. }),
  31730. globals.SemanticAnalyzer);
  31731. smalltalk.addMethod(
  31732. smalltalk.method({
  31733. selector: "visitBlockNode:",
  31734. protocol: 'visiting',
  31735. fn: function (aNode){
  31736. var self=this;
  31737. return smalltalk.withContext(function($ctx1) {
  31738. self._pushScope_(self._newBlockScope());
  31739. _st(aNode)._scope_(self["@currentScope"]);
  31740. _st(self["@currentScope"])._node_(aNode);
  31741. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  31742. _st(_st(aNode)._parameters())._do_((function(each){
  31743. return smalltalk.withContext(function($ctx2) {
  31744. self._validateVariableScope_(each);
  31745. return _st(self["@currentScope"])._addArg_(each);
  31746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  31747. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]));
  31748. $ctx1.supercall = false;
  31749. self._popScope();
  31750. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31751. args: ["aNode"],
  31752. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  31753. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"],
  31754. referencedClasses: []
  31755. }),
  31756. globals.SemanticAnalyzer);
  31757. smalltalk.addMethod(
  31758. smalltalk.method({
  31759. selector: "visitCascadeNode:",
  31760. protocol: 'visiting',
  31761. fn: function (aNode){
  31762. var self=this;
  31763. return smalltalk.withContext(function($ctx1) {
  31764. var $3,$2,$1;
  31765. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]));
  31766. $ctx1.supercall = false;
  31767. $3=_st(aNode)._nodes();
  31768. $ctx1.sendIdx["nodes"]=1;
  31769. $2=_st($3)._first();
  31770. $1=_st($2)._superSend();
  31771. if(smalltalk.assert($1)){
  31772. _st(_st(aNode)._nodes())._do_((function(each){
  31773. return smalltalk.withContext(function($ctx2) {
  31774. return _st(each)._superSend_(true);
  31775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  31776. };
  31777. return self}, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31778. args: ["aNode"],
  31779. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  31780. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"],
  31781. referencedClasses: []
  31782. }),
  31783. globals.SemanticAnalyzer);
  31784. smalltalk.addMethod(
  31785. smalltalk.method({
  31786. selector: "visitMethodNode:",
  31787. protocol: 'visiting',
  31788. fn: function (aNode){
  31789. var self=this;
  31790. return smalltalk.withContext(function($ctx1) {
  31791. var $1;
  31792. self._pushScope_(self._newMethodScope());
  31793. _st(aNode)._scope_(self["@currentScope"]);
  31794. _st(self["@currentScope"])._node_(aNode);
  31795. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  31796. return smalltalk.withContext(function($ctx2) {
  31797. return _st(self["@currentScope"])._addIVar_(each);
  31798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  31799. $ctx1.sendIdx["do:"]=1;
  31800. _st(_st(aNode)._arguments())._do_((function(each){
  31801. return smalltalk.withContext(function($ctx2) {
  31802. self._validateVariableScope_(each);
  31803. return _st(self["@currentScope"])._addArg_(each);
  31804. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  31805. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]));
  31806. $ctx1.supercall = false;
  31807. _st(aNode)._classReferences_(self._classReferences());
  31808. _st(aNode)._sendIndexes_(self._messageSends());
  31809. $1=_st(aNode)._superSends_(_st(self._superSends())._keys());
  31810. self._popScope();
  31811. return self}, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31812. args: ["aNode"],
  31813. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  31814. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"],
  31815. referencedClasses: []
  31816. }),
  31817. globals.SemanticAnalyzer);
  31818. smalltalk.addMethod(
  31819. smalltalk.method({
  31820. selector: "visitReturnNode:",
  31821. protocol: 'visiting',
  31822. fn: function (aNode){
  31823. var self=this;
  31824. return smalltalk.withContext(function($ctx1) {
  31825. var $1;
  31826. _st(aNode)._scope_(self["@currentScope"]);
  31827. $1=_st(self["@currentScope"])._isMethodScope();
  31828. if(smalltalk.assert($1)){
  31829. _st(self["@currentScope"])._localReturn_(true);
  31830. } else {
  31831. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  31832. };
  31833. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]));
  31834. $ctx1.supercall = false;
  31835. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31836. args: ["aNode"],
  31837. source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
  31838. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
  31839. referencedClasses: []
  31840. }),
  31841. globals.SemanticAnalyzer);
  31842. smalltalk.addMethod(
  31843. smalltalk.method({
  31844. selector: "visitSendNode:",
  31845. protocol: 'visiting',
  31846. fn: function (aNode){
  31847. var self=this;
  31848. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  31849. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  31850. return smalltalk.withContext(function($ctx1) {
  31851. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  31852. $3=_st(aNode)._receiver();
  31853. $ctx1.sendIdx["receiver"]=1;
  31854. $2=_st($3)._value();
  31855. $1=_st($2).__eq("super");
  31856. if(smalltalk.assert($1)){
  31857. _st(aNode)._superSend_(true);
  31858. $4=_st(aNode)._receiver();
  31859. $ctx1.sendIdx["receiver"]=2;
  31860. _st($4)._value_("self");
  31861. $5=self._superSends();
  31862. $ctx1.sendIdx["superSends"]=1;
  31863. $6=_st(aNode)._selector();
  31864. $ctx1.sendIdx["selector"]=1;
  31865. _st($5)._at_ifAbsentPut_($6,(function(){
  31866. return smalltalk.withContext(function($ctx2) {
  31867. return _st($Set())._new();
  31868. $ctx2.sendIdx["new"]=1;
  31869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  31870. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  31871. $8=self._superSends();
  31872. $9=_st(aNode)._selector();
  31873. $ctx1.sendIdx["selector"]=2;
  31874. $7=_st($8)._at_($9);
  31875. $ctx1.sendIdx["at:"]=1;
  31876. _st($7)._add_(aNode);
  31877. $ctx1.sendIdx["add:"]=1;
  31878. } else {
  31879. $11=_st($IRSendInliner())._inlinedSelectors();
  31880. $12=_st(aNode)._selector();
  31881. $ctx1.sendIdx["selector"]=3;
  31882. $10=_st($11)._includes_($12);
  31883. if(smalltalk.assert($10)){
  31884. _st(aNode)._shouldBeInlined_(true);
  31885. $13=_st(aNode)._receiver();
  31886. if(($receiver = $13) == null || $receiver.isNil){
  31887. $13;
  31888. } else {
  31889. var receiver;
  31890. receiver=$receiver;
  31891. _st(receiver)._shouldBeAliased_(true);
  31892. };
  31893. };
  31894. };
  31895. $14=self._messageSends();
  31896. $ctx1.sendIdx["messageSends"]=1;
  31897. $15=_st(aNode)._selector();
  31898. $ctx1.sendIdx["selector"]=4;
  31899. _st($14)._at_ifAbsentPut_($15,(function(){
  31900. return smalltalk.withContext(function($ctx2) {
  31901. return _st($Set())._new();
  31902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  31903. $17=self._messageSends();
  31904. $ctx1.sendIdx["messageSends"]=2;
  31905. $18=_st(aNode)._selector();
  31906. $ctx1.sendIdx["selector"]=5;
  31907. $16=_st($17)._at_($18);
  31908. $ctx1.sendIdx["at:"]=2;
  31909. _st($16)._add_(aNode);
  31910. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  31911. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  31912. $ctx1.supercall = false;
  31913. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31914. args: ["aNode"],
  31915. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  31916. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"],
  31917. referencedClasses: ["Set", "IRSendInliner"]
  31918. }),
  31919. globals.SemanticAnalyzer);
  31920. smalltalk.addMethod(
  31921. smalltalk.method({
  31922. selector: "visitSequenceNode:",
  31923. protocol: 'visiting',
  31924. fn: function (aNode){
  31925. var self=this;
  31926. return smalltalk.withContext(function($ctx1) {
  31927. _st(_st(aNode)._temps())._do_((function(each){
  31928. return smalltalk.withContext(function($ctx2) {
  31929. self._validateVariableScope_(each);
  31930. return _st(self["@currentScope"])._addTemp_(each);
  31931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  31932. ($ctx1.supercall = true, globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]));
  31933. $ctx1.supercall = false;
  31934. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.SemanticAnalyzer)})},
  31935. args: ["aNode"],
  31936. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  31937. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"],
  31938. referencedClasses: []
  31939. }),
  31940. globals.SemanticAnalyzer);
  31941. smalltalk.addMethod(
  31942. smalltalk.method({
  31943. selector: "visitVariableNode:",
  31944. protocol: 'visiting',
  31945. fn: function (aNode){
  31946. var self=this;
  31947. var binding;
  31948. function $ClassRefVar(){return globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  31949. function $UnknownVar(){return globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  31950. return smalltalk.withContext(function($ctx1) {
  31951. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  31952. binding=_st(self["@currentScope"])._lookupVariable_(aNode);
  31953. $1=binding;
  31954. if(($receiver = $1) == null || $receiver.isNil){
  31955. $3=_st(aNode)._value();
  31956. $ctx1.sendIdx["value"]=1;
  31957. $2=_st($3)._isCapitalized();
  31958. if(smalltalk.assert($2)){
  31959. $4=_st($ClassRefVar())._new();
  31960. $ctx1.sendIdx["new"]=1;
  31961. $5=$4;
  31962. $6=_st(aNode)._value();
  31963. $ctx1.sendIdx["value"]=2;
  31964. _st($5)._name_($6);
  31965. $ctx1.sendIdx["name:"]=1;
  31966. $7=_st($4)._yourself();
  31967. $ctx1.sendIdx["yourself"]=1;
  31968. binding=$7;
  31969. binding;
  31970. $8=self._classReferences();
  31971. $9=_st(aNode)._value();
  31972. $ctx1.sendIdx["value"]=3;
  31973. _st($8)._add_($9);
  31974. } else {
  31975. self._errorUnknownVariable_(aNode);
  31976. $10=_st($UnknownVar())._new();
  31977. _st($10)._name_(_st(aNode)._value());
  31978. $11=_st($10)._yourself();
  31979. binding=$11;
  31980. binding;
  31981. };
  31982. } else {
  31983. $1;
  31984. };
  31985. _st(aNode)._binding_(binding);
  31986. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},globals.SemanticAnalyzer)})},
  31987. args: ["aNode"],
  31988. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  31989. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"],
  31990. referencedClasses: ["ClassRefVar", "UnknownVar"]
  31991. }),
  31992. globals.SemanticAnalyzer);
  31993. smalltalk.addMethod(
  31994. smalltalk.method({
  31995. selector: "on:",
  31996. protocol: 'instance creation',
  31997. fn: function (aClass){
  31998. var self=this;
  31999. return smalltalk.withContext(function($ctx1) {
  32000. var $2,$3,$1;
  32001. $2=self._new();
  32002. _st($2)._theClass_(aClass);
  32003. $3=_st($2)._yourself();
  32004. $1=$3;
  32005. return $1;
  32006. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},globals.SemanticAnalyzer.klass)})},
  32007. args: ["aClass"],
  32008. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32009. messageSends: ["theClass:", "new", "yourself"],
  32010. referencedClasses: []
  32011. }),
  32012. globals.SemanticAnalyzer.klass);
  32013. });
  32014. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Kernel-Exceptions", "amber_core/Compiler-AST"], function($boot){
  32015. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  32016. smalltalk.addPackage('Compiler-Interpreter');
  32017. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  32018. smalltalk.addClass('AIBlockClosure', globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  32019. globals.AIBlockClosure.comment="I am a special `BlockClosure` subclass used by an interpreter to interpret a block node.\x0a\x0aWhile I am polymorphic with `BlockClosure`, some methods such as `#new` will raise interpretation errors. Unlike a `BlockClosure`, my instance are not JavaScript functions.\x0a\x0aEvaluating an instance will result in interpreting the `node` instance variable (instance of `BlockNode`).";
  32020. smalltalk.addMethod(
  32021. smalltalk.method({
  32022. selector: "applyTo:arguments:",
  32023. protocol: 'evaluating',
  32024. fn: function (anObject,aCollection){
  32025. var self=this;
  32026. return smalltalk.withContext(function($ctx1) {
  32027. self._interpreterError();
  32028. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.AIBlockClosure)})},
  32029. args: ["anObject", "aCollection"],
  32030. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  32031. messageSends: ["interpreterError"],
  32032. referencedClasses: []
  32033. }),
  32034. globals.AIBlockClosure);
  32035. smalltalk.addMethod(
  32036. smalltalk.method({
  32037. selector: "compiledSource",
  32038. protocol: 'accessing',
  32039. fn: function (){
  32040. var self=this;
  32041. return "[ AST Block closure ]";
  32042. },
  32043. args: [],
  32044. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  32045. messageSends: [],
  32046. referencedClasses: []
  32047. }),
  32048. globals.AIBlockClosure);
  32049. smalltalk.addMethod(
  32050. smalltalk.method({
  32051. selector: "currySelf",
  32052. protocol: 'converting',
  32053. fn: function (){
  32054. var self=this;
  32055. return smalltalk.withContext(function($ctx1) {
  32056. self._interpreterError();
  32057. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.AIBlockClosure)})},
  32058. args: [],
  32059. source: "currySelf\x0a\x09self interpreterError",
  32060. messageSends: ["interpreterError"],
  32061. referencedClasses: []
  32062. }),
  32063. globals.AIBlockClosure);
  32064. smalltalk.addMethod(
  32065. smalltalk.method({
  32066. selector: "initializeWithContext:node:",
  32067. protocol: 'initialization',
  32068. fn: function (aContext,aNode){
  32069. var self=this;
  32070. self["@node"]=aNode;
  32071. self["@outerContext"]=aContext;
  32072. return self},
  32073. args: ["aContext", "aNode"],
  32074. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  32075. messageSends: [],
  32076. referencedClasses: []
  32077. }),
  32078. globals.AIBlockClosure);
  32079. smalltalk.addMethod(
  32080. smalltalk.method({
  32081. selector: "interpreterError",
  32082. protocol: 'error handling',
  32083. fn: function (){
  32084. var self=this;
  32085. function $ASTInterpreterError(){return globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  32086. return smalltalk.withContext(function($ctx1) {
  32087. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  32088. return self}, function($ctx1) {$ctx1.fill(self,"interpreterError",{},globals.AIBlockClosure)})},
  32089. args: [],
  32090. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  32091. messageSends: ["signal:"],
  32092. referencedClasses: ["ASTInterpreterError"]
  32093. }),
  32094. globals.AIBlockClosure);
  32095. smalltalk.addMethod(
  32096. smalltalk.method({
  32097. selector: "numArgs",
  32098. protocol: 'accessing',
  32099. fn: function (){
  32100. var self=this;
  32101. return smalltalk.withContext(function($ctx1) {
  32102. var $1;
  32103. $1=_st(_st(self["@node"])._temps())._size();
  32104. return $1;
  32105. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.AIBlockClosure)})},
  32106. args: [],
  32107. source: "numArgs\x0a\x09^ node temps size",
  32108. messageSends: ["size", "temps"],
  32109. referencedClasses: []
  32110. }),
  32111. globals.AIBlockClosure);
  32112. smalltalk.addMethod(
  32113. smalltalk.method({
  32114. selector: "value",
  32115. protocol: 'evaluating',
  32116. fn: function (){
  32117. var self=this;
  32118. return smalltalk.withContext(function($ctx1) {
  32119. var $1;
  32120. $1=self._valueWithPossibleArguments_([]);
  32121. return $1;
  32122. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AIBlockClosure)})},
  32123. args: [],
  32124. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  32125. messageSends: ["valueWithPossibleArguments:"],
  32126. referencedClasses: []
  32127. }),
  32128. globals.AIBlockClosure);
  32129. smalltalk.addMethod(
  32130. smalltalk.method({
  32131. selector: "value:",
  32132. protocol: 'evaluating',
  32133. fn: function (anArgument){
  32134. var self=this;
  32135. return smalltalk.withContext(function($ctx1) {
  32136. var $1;
  32137. $1=self._valueWithPossibleArguments_([anArgument]);
  32138. return $1;
  32139. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},globals.AIBlockClosure)})},
  32140. args: ["anArgument"],
  32141. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  32142. messageSends: ["valueWithPossibleArguments:"],
  32143. referencedClasses: []
  32144. }),
  32145. globals.AIBlockClosure);
  32146. smalltalk.addMethod(
  32147. smalltalk.method({
  32148. selector: "value:value:",
  32149. protocol: 'evaluating',
  32150. fn: function (firstArgument,secondArgument){
  32151. var self=this;
  32152. return smalltalk.withContext(function($ctx1) {
  32153. var $1;
  32154. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  32155. return $1;
  32156. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.AIBlockClosure)})},
  32157. args: ["firstArgument", "secondArgument"],
  32158. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  32159. messageSends: ["valueWithPossibleArguments:"],
  32160. referencedClasses: []
  32161. }),
  32162. globals.AIBlockClosure);
  32163. smalltalk.addMethod(
  32164. smalltalk.method({
  32165. selector: "value:value:value:",
  32166. protocol: 'evaluating',
  32167. fn: function (firstArgument,secondArgument,thirdArgument){
  32168. var self=this;
  32169. return smalltalk.withContext(function($ctx1) {
  32170. var $1;
  32171. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  32172. return $1;
  32173. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.AIBlockClosure)})},
  32174. args: ["firstArgument", "secondArgument", "thirdArgument"],
  32175. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  32176. messageSends: ["valueWithPossibleArguments:"],
  32177. referencedClasses: []
  32178. }),
  32179. globals.AIBlockClosure);
  32180. smalltalk.addMethod(
  32181. smalltalk.method({
  32182. selector: "valueWithPossibleArguments:",
  32183. protocol: 'evaluating',
  32184. fn: function (aCollection){
  32185. var self=this;
  32186. var context,sequenceNode;
  32187. return smalltalk.withContext(function($ctx1) {
  32188. var $1,$2,$3,$4,$5,$6;
  32189. context=_st(self["@outerContext"])._newInnerContext();
  32190. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  32191. _st($1)._parent_(nil);
  32192. $2=_st($1)._yourself();
  32193. sequenceNode=$2;
  32194. _st(_st(sequenceNode)._temps())._do_((function(each){
  32195. return smalltalk.withContext(function($ctx2) {
  32196. return _st(context)._defineLocal_(each);
  32197. $ctx2.sendIdx["defineLocal:"]=1;
  32198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  32199. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  32200. return smalltalk.withContext(function($ctx2) {
  32201. _st(context)._defineLocal_(each);
  32202. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  32203. return nil;
  32204. })));
  32205. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)})}));
  32206. $3=_st(context)._interpreter();
  32207. $ctx1.sendIdx["interpreter"]=1;
  32208. _st($3)._node_(_st(sequenceNode)._nextChild());
  32209. $4=_st($3)._proceed();
  32210. $5=_st(self["@outerContext"])._interpreter();
  32211. $ctx1.sendIdx["interpreter"]=2;
  32212. _st($5)._setNonLocalReturnFromContext_(context);
  32213. $6=_st(_st(context)._interpreter())._pop();
  32214. return $6;
  32215. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)})},
  32216. args: ["aCollection"],
  32217. source: "valueWithPossibleArguments: aCollection\x0a\x09| context sequenceNode |\x0a\x09context := outerContext newInnerContext.\x0a\x0a\x09\x22Interpret a copy of the sequence node to avoid creating a new AIBlockClosure\x22\x0a\x09sequenceNode := node nodes first copy\x0a\x09\x09parent: nil;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals in the context\x22\x0a\x09sequenceNode temps do: [ :each |\x0a\x09\x09context defineLocal: each ].\x0a\x09\x09\x0a\x09\x22Populate the arguments into the context locals\x22\x09\x0a\x09node parameters withIndexDo: [ :each :index |\x0a\x09\x09context defineLocal: each.\x0a\x09\x09context localAt: each put: (aCollection at: index ifAbsent: [ nil ]) ].\x0a\x0a\x09\x22Interpret the first node of the BlockSequenceNode\x22\x0a\x09context interpreter\x0a\x09\x09node: sequenceNode nextChild;\x0a\x09\x09proceed.\x0a\x09\x09\x0a\x09outerContext interpreter\x0a\x09\x09setNonLocalReturnFromContext: context.\x0a\x09\x09\x0a\x09^ context interpreter pop",
  32218. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"],
  32219. referencedClasses: []
  32220. }),
  32221. globals.AIBlockClosure);
  32222. smalltalk.addMethod(
  32223. smalltalk.method({
  32224. selector: "forContext:node:",
  32225. protocol: 'instance creation',
  32226. fn: function (aContext,aNode){
  32227. var self=this;
  32228. return smalltalk.withContext(function($ctx1) {
  32229. var $2,$3,$1;
  32230. $2=self._new();
  32231. _st($2)._initializeWithContext_node_(aContext,aNode);
  32232. $3=_st($2)._yourself();
  32233. $1=$3;
  32234. return $1;
  32235. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},globals.AIBlockClosure.klass)})},
  32236. args: ["aContext", "aNode"],
  32237. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  32238. messageSends: ["initializeWithContext:node:", "new", "yourself"],
  32239. referencedClasses: []
  32240. }),
  32241. globals.AIBlockClosure.klass);
  32242. smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  32243. globals.AIContext.comment="I am like a `MethodContext`, used by the `ASTInterpreter`.\x0aUnlike a `MethodContext`, my instances are not read-only.\x0a\x0aWhen debugging, my instances are created by copying the current `MethodContext` (thisContext)";
  32244. smalltalk.addMethod(
  32245. smalltalk.method({
  32246. selector: "arguments",
  32247. protocol: 'interpreting',
  32248. fn: function (){
  32249. var self=this;
  32250. return smalltalk.withContext(function($ctx1) {
  32251. var $1;
  32252. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  32253. return smalltalk.withContext(function($ctx2) {
  32254. return self._localAt_ifAbsent_(each,(function(){
  32255. return smalltalk.withContext(function($ctx3) {
  32256. return self._error_("Argument not in context");
  32257. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  32258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  32259. return $1;
  32260. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.AIContext)})},
  32261. args: [],
  32262. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  32263. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"],
  32264. referencedClasses: []
  32265. }),
  32266. globals.AIContext);
  32267. smalltalk.addMethod(
  32268. smalltalk.method({
  32269. selector: "ast",
  32270. protocol: 'interpreting',
  32271. fn: function (){
  32272. var self=this;
  32273. return smalltalk.withContext(function($ctx1) {
  32274. var $1,$3,$2,$4,$5,$receiver;
  32275. $1=self._isBlockContext();
  32276. if(smalltalk.assert($1)){
  32277. $3=self._outerContext();
  32278. if(($receiver = $3) == null || $receiver.isNil){
  32279. $2=$3;
  32280. } else {
  32281. var context;
  32282. context=$receiver;
  32283. $2=_st(context)._ast();
  32284. };
  32285. return $2;
  32286. };
  32287. $4=self["@ast"];
  32288. if(($receiver = $4) == null || $receiver.isNil){
  32289. self._initializeAST();
  32290. } else {
  32291. $4;
  32292. };
  32293. $5=self["@ast"];
  32294. return $5;
  32295. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.AIContext)})},
  32296. args: [],
  32297. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  32298. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"],
  32299. referencedClasses: []
  32300. }),
  32301. globals.AIContext);
  32302. smalltalk.addMethod(
  32303. smalltalk.method({
  32304. selector: "basicLocalAt:",
  32305. protocol: 'private',
  32306. fn: function (aString){
  32307. var self=this;
  32308. return smalltalk.withContext(function($ctx1) {
  32309. var $1;
  32310. $1=_st(self._locals())._at_(aString);
  32311. return $1;
  32312. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},globals.AIContext)})},
  32313. args: ["aString"],
  32314. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  32315. messageSends: ["at:", "locals"],
  32316. referencedClasses: []
  32317. }),
  32318. globals.AIContext);
  32319. smalltalk.addMethod(
  32320. smalltalk.method({
  32321. selector: "basicLocalAt:put:",
  32322. protocol: 'private',
  32323. fn: function (aString,anObject){
  32324. var self=this;
  32325. return smalltalk.withContext(function($ctx1) {
  32326. _st(self._locals())._at_put_(aString,anObject);
  32327. return self}, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},globals.AIContext)})},
  32328. args: ["aString", "anObject"],
  32329. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  32330. messageSends: ["at:put:", "locals"],
  32331. referencedClasses: []
  32332. }),
  32333. globals.AIContext);
  32334. smalltalk.addMethod(
  32335. smalltalk.method({
  32336. selector: "basicReceiver",
  32337. protocol: 'interpreting',
  32338. fn: function (){
  32339. var self=this;
  32340. return smalltalk.withContext(function($ctx1) {
  32341. var $1;
  32342. $1=self._localAt_("self");
  32343. return $1;
  32344. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.AIContext)})},
  32345. args: [],
  32346. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  32347. messageSends: ["localAt:"],
  32348. referencedClasses: []
  32349. }),
  32350. globals.AIContext);
  32351. smalltalk.addMethod(
  32352. smalltalk.method({
  32353. selector: "defineLocal:",
  32354. protocol: 'accessing',
  32355. fn: function (aString){
  32356. var self=this;
  32357. return smalltalk.withContext(function($ctx1) {
  32358. _st(self._locals())._at_put_(aString,nil);
  32359. return self}, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},globals.AIContext)})},
  32360. args: ["aString"],
  32361. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  32362. messageSends: ["at:put:", "locals"],
  32363. referencedClasses: []
  32364. }),
  32365. globals.AIContext);
  32366. smalltalk.addMethod(
  32367. smalltalk.method({
  32368. selector: "evaluate:on:",
  32369. protocol: 'evaluating',
  32370. fn: function (aString,anEvaluator){
  32371. var self=this;
  32372. return smalltalk.withContext(function($ctx1) {
  32373. var $1;
  32374. $1=_st(anEvaluator)._evaluate_context_(aString,self);
  32375. return $1;
  32376. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.AIContext)})},
  32377. args: ["aString", "anEvaluator"],
  32378. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  32379. messageSends: ["evaluate:context:"],
  32380. referencedClasses: []
  32381. }),
  32382. globals.AIContext);
  32383. smalltalk.addMethod(
  32384. smalltalk.method({
  32385. selector: "evaluateNode:",
  32386. protocol: 'evaluating',
  32387. fn: function (aNode){
  32388. var self=this;
  32389. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  32390. return smalltalk.withContext(function($ctx1) {
  32391. var $2,$3,$1;
  32392. $2=_st($ASTInterpreter())._new();
  32393. _st($2)._context_(self);
  32394. _st($2)._node_(_st(aNode)._nextChild());
  32395. _st($2)._proceed();
  32396. $3=_st($2)._result();
  32397. $1=$3;
  32398. return $1;
  32399. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},globals.AIContext)})},
  32400. args: ["aNode"],
  32401. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  32402. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"],
  32403. referencedClasses: ["ASTInterpreter"]
  32404. }),
  32405. globals.AIContext);
  32406. smalltalk.addMethod(
  32407. smalltalk.method({
  32408. selector: "evaluatedSelector",
  32409. protocol: 'accessing',
  32410. fn: function (){
  32411. var self=this;
  32412. var $1;
  32413. $1=self["@evaluatedSelector"];
  32414. return $1;
  32415. },
  32416. args: [],
  32417. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  32418. messageSends: [],
  32419. referencedClasses: []
  32420. }),
  32421. globals.AIContext);
  32422. smalltalk.addMethod(
  32423. smalltalk.method({
  32424. selector: "evaluatedSelector:",
  32425. protocol: 'accessing',
  32426. fn: function (aString){
  32427. var self=this;
  32428. self["@evaluatedSelector"]=aString;
  32429. return self},
  32430. args: ["aString"],
  32431. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  32432. messageSends: [],
  32433. referencedClasses: []
  32434. }),
  32435. globals.AIContext);
  32436. smalltalk.addMethod(
  32437. smalltalk.method({
  32438. selector: "index",
  32439. protocol: 'accessing',
  32440. fn: function (){
  32441. var self=this;
  32442. return smalltalk.withContext(function($ctx1) {
  32443. var $2,$1,$receiver;
  32444. $2=self["@index"];
  32445. if(($receiver = $2) == null || $receiver.isNil){
  32446. $1=(0);
  32447. } else {
  32448. $1=$2;
  32449. };
  32450. return $1;
  32451. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.AIContext)})},
  32452. args: [],
  32453. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  32454. messageSends: ["ifNil:"],
  32455. referencedClasses: []
  32456. }),
  32457. globals.AIContext);
  32458. smalltalk.addMethod(
  32459. smalltalk.method({
  32460. selector: "index:",
  32461. protocol: 'accessing',
  32462. fn: function (anInteger){
  32463. var self=this;
  32464. self["@index"]=anInteger;
  32465. return self},
  32466. args: ["anInteger"],
  32467. source: "index: anInteger\x0a\x09index := anInteger",
  32468. messageSends: [],
  32469. referencedClasses: []
  32470. }),
  32471. globals.AIContext);
  32472. smalltalk.addMethod(
  32473. smalltalk.method({
  32474. selector: "initializeAST",
  32475. protocol: 'initialization',
  32476. fn: function (){
  32477. var self=this;
  32478. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  32479. return smalltalk.withContext(function($ctx1) {
  32480. var $1;
  32481. $1=self._method();
  32482. $ctx1.sendIdx["method"]=1;
  32483. self["@ast"]=_st($1)._ast();
  32484. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  32485. return self}, function($ctx1) {$ctx1.fill(self,"initializeAST",{},globals.AIContext)})},
  32486. args: [],
  32487. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  32488. messageSends: ["ast", "method", "visit:", "on:", "methodClass"],
  32489. referencedClasses: ["SemanticAnalyzer"]
  32490. }),
  32491. globals.AIContext);
  32492. smalltalk.addMethod(
  32493. smalltalk.method({
  32494. selector: "initializeFromMethodContext:",
  32495. protocol: 'initialization',
  32496. fn: function (aMethodContext){
  32497. var self=this;
  32498. return smalltalk.withContext(function($ctx1) {
  32499. var $1,$2,$3,$4,$receiver;
  32500. self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
  32501. self._index_(_st(aMethodContext)._index());
  32502. self._sendIndexes_(_st(aMethodContext)._sendIndexes());
  32503. self._receiver_(_st(aMethodContext)._receiver());
  32504. self._supercall_(_st(aMethodContext)._supercall());
  32505. $1=self._selector_(_st(aMethodContext)._selector());
  32506. $2=_st(aMethodContext)._outerContext();
  32507. $ctx1.sendIdx["outerContext"]=1;
  32508. if(($receiver = $2) == null || $receiver.isNil){
  32509. $2;
  32510. } else {
  32511. var outer;
  32512. outer=$receiver;
  32513. $3=_st(outer)._methodContext();
  32514. if(($receiver = $3) == null || $receiver.isNil){
  32515. $3;
  32516. } else {
  32517. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  32518. };
  32519. $4=_st(aMethodContext)._locals();
  32520. $ctx1.sendIdx["locals"]=1;
  32521. _st($4)._keysAndValuesDo_((function(key,value){
  32522. return smalltalk.withContext(function($ctx2) {
  32523. return _st(self._locals())._at_put_(key,value);
  32524. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  32525. };
  32526. return self}, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)})},
  32527. args: ["aMethodContext"],
  32528. source: "initializeFromMethodContext: aMethodContext\x0a\x0a\x09self\x0a\x09\x09evaluatedSelector: aMethodContext evaluatedSelector;\x0a\x09\x09index: aMethodContext index;\x0a\x09\x09sendIndexes: aMethodContext sendIndexes;\x0a\x09\x09receiver: aMethodContext receiver;\x0a\x09\x09supercall: aMethodContext supercall;\x0a\x09\x09selector: aMethodContext selector.\x0a\x09\x09\x0a\x09aMethodContext outerContext ifNotNil: [ :outer |\x0a\x09\x09\x22If the method context is nil, the block was defined in JS, so ignore it\x22\x0a\x09\x09outer methodContext ifNotNil: [\x0a\x09\x09\x09self outerContext: (self class fromMethodContext: aMethodContext outerContext) ].\x0a\x09\x09\x09aMethodContext locals keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09\x09self locals at: key put: value ] ]",
  32529. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"],
  32530. referencedClasses: []
  32531. }),
  32532. globals.AIContext);
  32533. smalltalk.addMethod(
  32534. smalltalk.method({
  32535. selector: "initializeInterpreter",
  32536. protocol: 'initialization',
  32537. fn: function (){
  32538. var self=this;
  32539. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  32540. return smalltalk.withContext(function($ctx1) {
  32541. var $1,$2,$3,$receiver;
  32542. $1=_st($ASTInterpreter())._new();
  32543. _st($1)._context_(self);
  32544. $2=_st($1)._yourself();
  32545. self["@interpreter"]=$2;
  32546. $3=self._innerContext();
  32547. if(($receiver = $3) == null || $receiver.isNil){
  32548. $3;
  32549. } else {
  32550. self._setupInterpreter_(self["@interpreter"]);
  32551. };
  32552. return self}, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},globals.AIContext)})},
  32553. args: [],
  32554. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  32555. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"],
  32556. referencedClasses: ["ASTInterpreter"]
  32557. }),
  32558. globals.AIContext);
  32559. smalltalk.addMethod(
  32560. smalltalk.method({
  32561. selector: "initializeLocals",
  32562. protocol: 'initialization',
  32563. fn: function (){
  32564. var self=this;
  32565. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  32566. return smalltalk.withContext(function($ctx1) {
  32567. self["@locals"]=_st($Dictionary())._new();
  32568. _st(self["@locals"])._at_put_("thisContext",self);
  32569. return self}, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},globals.AIContext)})},
  32570. args: [],
  32571. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  32572. messageSends: ["new", "at:put:"],
  32573. referencedClasses: ["Dictionary"]
  32574. }),
  32575. globals.AIContext);
  32576. smalltalk.addMethod(
  32577. smalltalk.method({
  32578. selector: "innerContext",
  32579. protocol: 'accessing',
  32580. fn: function (){
  32581. var self=this;
  32582. var $1;
  32583. $1=self["@innerContext"];
  32584. return $1;
  32585. },
  32586. args: [],
  32587. source: "innerContext\x0a\x09^ innerContext",
  32588. messageSends: [],
  32589. referencedClasses: []
  32590. }),
  32591. globals.AIContext);
  32592. smalltalk.addMethod(
  32593. smalltalk.method({
  32594. selector: "innerContext:",
  32595. protocol: 'accessing',
  32596. fn: function (anAIContext){
  32597. var self=this;
  32598. self["@innerContext"]=anAIContext;
  32599. return self},
  32600. args: ["anAIContext"],
  32601. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  32602. messageSends: [],
  32603. referencedClasses: []
  32604. }),
  32605. globals.AIContext);
  32606. smalltalk.addMethod(
  32607. smalltalk.method({
  32608. selector: "interpreter",
  32609. protocol: 'interpreting',
  32610. fn: function (){
  32611. var self=this;
  32612. return smalltalk.withContext(function($ctx1) {
  32613. var $1,$2,$receiver;
  32614. $1=self["@interpreter"];
  32615. if(($receiver = $1) == null || $receiver.isNil){
  32616. self._initializeInterpreter();
  32617. } else {
  32618. $1;
  32619. };
  32620. $2=self["@interpreter"];
  32621. return $2;
  32622. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.AIContext)})},
  32623. args: [],
  32624. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  32625. messageSends: ["ifNil:", "initializeInterpreter"],
  32626. referencedClasses: []
  32627. }),
  32628. globals.AIContext);
  32629. smalltalk.addMethod(
  32630. smalltalk.method({
  32631. selector: "interpreter:",
  32632. protocol: 'interpreting',
  32633. fn: function (anInterpreter){
  32634. var self=this;
  32635. self["@interpreter"]=anInterpreter;
  32636. return self},
  32637. args: ["anInterpreter"],
  32638. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  32639. messageSends: [],
  32640. referencedClasses: []
  32641. }),
  32642. globals.AIContext);
  32643. smalltalk.addMethod(
  32644. smalltalk.method({
  32645. selector: "isTopContext",
  32646. protocol: 'testing',
  32647. fn: function (){
  32648. var self=this;
  32649. return smalltalk.withContext(function($ctx1) {
  32650. var $1;
  32651. $1=_st(self._innerContext())._isNil();
  32652. return $1;
  32653. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},globals.AIContext)})},
  32654. args: [],
  32655. source: "isTopContext\x0a\x09^ self innerContext isNil",
  32656. messageSends: ["isNil", "innerContext"],
  32657. referencedClasses: []
  32658. }),
  32659. globals.AIContext);
  32660. smalltalk.addMethod(
  32661. smalltalk.method({
  32662. selector: "localAt:",
  32663. protocol: 'accessing',
  32664. fn: function (aString){
  32665. var self=this;
  32666. var context;
  32667. return smalltalk.withContext(function($ctx1) {
  32668. var $1;
  32669. context=self._lookupContextForLocal_(aString);
  32670. $1=_st(context)._basicLocalAt_(aString);
  32671. return $1;
  32672. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},globals.AIContext)})},
  32673. args: ["aString"],
  32674. source: "localAt: aString\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09^ context basicLocalAt: aString",
  32675. messageSends: ["lookupContextForLocal:", "basicLocalAt:"],
  32676. referencedClasses: []
  32677. }),
  32678. globals.AIContext);
  32679. smalltalk.addMethod(
  32680. smalltalk.method({
  32681. selector: "localAt:ifAbsent:",
  32682. protocol: 'accessing',
  32683. fn: function (aString,aBlock){
  32684. var self=this;
  32685. var context;
  32686. return smalltalk.withContext(function($ctx1) {
  32687. var $1,$2;
  32688. var $early={};
  32689. try {
  32690. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  32691. return smalltalk.withContext(function($ctx2) {
  32692. $1=_st(aBlock)._value();
  32693. throw $early=[$1];
  32694. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  32695. $2=_st(context)._basicLocalAt_(aString);
  32696. return $2;
  32697. }
  32698. catch(e) {if(e===$early)return e[0]; throw e}
  32699. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},globals.AIContext)})},
  32700. args: ["aString", "aBlock"],
  32701. source: "localAt: aString ifAbsent: aBlock\x0a\x09\x22Lookup the local value up to the method context\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self \x09\x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ ^ aBlock value ].\x0a\x09\x0a\x09^ context basicLocalAt: aString",
  32702. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"],
  32703. referencedClasses: []
  32704. }),
  32705. globals.AIContext);
  32706. smalltalk.addMethod(
  32707. smalltalk.method({
  32708. selector: "localAt:put:",
  32709. protocol: 'accessing',
  32710. fn: function (aString,anObject){
  32711. var self=this;
  32712. var context;
  32713. return smalltalk.withContext(function($ctx1) {
  32714. context=self._lookupContextForLocal_(aString);
  32715. _st(context)._basicLocalAt_put_(aString,anObject);
  32716. return self}, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},globals.AIContext)})},
  32717. args: ["aString", "anObject"],
  32718. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  32719. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"],
  32720. referencedClasses: []
  32721. }),
  32722. globals.AIContext);
  32723. smalltalk.addMethod(
  32724. smalltalk.method({
  32725. selector: "locals",
  32726. protocol: 'accessing',
  32727. fn: function (){
  32728. var self=this;
  32729. return smalltalk.withContext(function($ctx1) {
  32730. var $1,$2,$receiver;
  32731. $1=self["@locals"];
  32732. if(($receiver = $1) == null || $receiver.isNil){
  32733. self._initializeLocals();
  32734. } else {
  32735. $1;
  32736. };
  32737. $2=self["@locals"];
  32738. return $2;
  32739. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.AIContext)})},
  32740. args: [],
  32741. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  32742. messageSends: ["ifNil:", "initializeLocals"],
  32743. referencedClasses: []
  32744. }),
  32745. globals.AIContext);
  32746. smalltalk.addMethod(
  32747. smalltalk.method({
  32748. selector: "lookupContextForLocal:",
  32749. protocol: 'private',
  32750. fn: function (aString){
  32751. var self=this;
  32752. return smalltalk.withContext(function($ctx1) {
  32753. var $1;
  32754. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  32755. return smalltalk.withContext(function($ctx2) {
  32756. return self._variableNotFound();
  32757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  32758. return $1;
  32759. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},globals.AIContext)})},
  32760. args: ["aString"],
  32761. source: "lookupContextForLocal: aString\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self \x0a\x09\x09lookupContextForLocal: aString \x0a\x09\x09ifNone: [ self variableNotFound ]",
  32762. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"],
  32763. referencedClasses: []
  32764. }),
  32765. globals.AIContext);
  32766. smalltalk.addMethod(
  32767. smalltalk.method({
  32768. selector: "lookupContextForLocal:ifNone:",
  32769. protocol: 'private',
  32770. fn: function (aString,aBlock){
  32771. var self=this;
  32772. return smalltalk.withContext(function($ctx1) {
  32773. var $2,$1;
  32774. $1=_st(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  32775. return self;
  32776. }),(function(){
  32777. return smalltalk.withContext(function($ctx2) {
  32778. $2=self._outerContext();
  32779. return _st($2)._ifNil_ifNotNil_(aBlock,(function(context){
  32780. return smalltalk.withContext(function($ctx3) {
  32781. return _st(context)._lookupContextForLocal_(aString);
  32782. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)})}));
  32783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  32784. return $1;
  32785. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},globals.AIContext)})},
  32786. args: ["aString", "aBlock"],
  32787. source: "lookupContextForLocal: aString ifNone: aBlock\x0a\x09\x22Lookup the context defining the local named `aString` \x0a\x09up to the method context\x22\x0a\x0a\x09^ self locals \x0a\x09\x09at: aString\x0a\x09\x09ifPresent: [ self ]\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09self outerContext \x0a\x09\x09\x09\x09ifNil: aBlock\x0a\x09\x09\x09\x09ifNotNil: [ :context | \x0a\x09\x09\x09\x09\x09context lookupContextForLocal: aString ] ]",
  32788. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"],
  32789. referencedClasses: []
  32790. }),
  32791. globals.AIContext);
  32792. smalltalk.addMethod(
  32793. smalltalk.method({
  32794. selector: "newInnerContext",
  32795. protocol: 'factory',
  32796. fn: function (){
  32797. var self=this;
  32798. return smalltalk.withContext(function($ctx1) {
  32799. var $2,$3,$1;
  32800. $2=_st(self._class())._new();
  32801. _st($2)._outerContext_(self);
  32802. $3=_st($2)._yourself();
  32803. $1=$3;
  32804. return $1;
  32805. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},globals.AIContext)})},
  32806. args: [],
  32807. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  32808. messageSends: ["outerContext:", "new", "class", "yourself"],
  32809. referencedClasses: []
  32810. }),
  32811. globals.AIContext);
  32812. smalltalk.addMethod(
  32813. smalltalk.method({
  32814. selector: "outerContext",
  32815. protocol: 'accessing',
  32816. fn: function (){
  32817. var self=this;
  32818. var $1;
  32819. $1=self["@outerContext"];
  32820. return $1;
  32821. },
  32822. args: [],
  32823. source: "outerContext\x0a\x09^ outerContext",
  32824. messageSends: [],
  32825. referencedClasses: []
  32826. }),
  32827. globals.AIContext);
  32828. smalltalk.addMethod(
  32829. smalltalk.method({
  32830. selector: "outerContext:",
  32831. protocol: 'accessing',
  32832. fn: function (anAIContext){
  32833. var self=this;
  32834. return smalltalk.withContext(function($ctx1) {
  32835. var $1,$receiver;
  32836. self["@outerContext"]=anAIContext;
  32837. $1=self["@outerContext"];
  32838. if(($receiver = $1) == null || $receiver.isNil){
  32839. $1;
  32840. } else {
  32841. var context;
  32842. context=$receiver;
  32843. _st(context)._innerContext_(self);
  32844. };
  32845. return self}, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},globals.AIContext)})},
  32846. args: ["anAIContext"],
  32847. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  32848. messageSends: ["ifNotNil:", "innerContext:"],
  32849. referencedClasses: []
  32850. }),
  32851. globals.AIContext);
  32852. smalltalk.addMethod(
  32853. smalltalk.method({
  32854. selector: "receiver:",
  32855. protocol: 'interpreting',
  32856. fn: function (anObject){
  32857. var self=this;
  32858. return smalltalk.withContext(function($ctx1) {
  32859. _st(self._locals())._at_put_("self",anObject);
  32860. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.AIContext)})},
  32861. args: ["anObject"],
  32862. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  32863. messageSends: ["at:put:", "locals"],
  32864. referencedClasses: []
  32865. }),
  32866. globals.AIContext);
  32867. smalltalk.addMethod(
  32868. smalltalk.method({
  32869. selector: "selector",
  32870. protocol: 'accessing',
  32871. fn: function (){
  32872. var self=this;
  32873. var $1;
  32874. $1=self["@selector"];
  32875. return $1;
  32876. },
  32877. args: [],
  32878. source: "selector\x0a\x09^ selector",
  32879. messageSends: [],
  32880. referencedClasses: []
  32881. }),
  32882. globals.AIContext);
  32883. smalltalk.addMethod(
  32884. smalltalk.method({
  32885. selector: "selector:",
  32886. protocol: 'accessing',
  32887. fn: function (aString){
  32888. var self=this;
  32889. self["@selector"]=aString;
  32890. return self},
  32891. args: ["aString"],
  32892. source: "selector: aString\x0a\x09selector := aString",
  32893. messageSends: [],
  32894. referencedClasses: []
  32895. }),
  32896. globals.AIContext);
  32897. smalltalk.addMethod(
  32898. smalltalk.method({
  32899. selector: "sendIndexAt:",
  32900. protocol: 'accessing',
  32901. fn: function (aString){
  32902. var self=this;
  32903. return smalltalk.withContext(function($ctx1) {
  32904. var $1;
  32905. $1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  32906. return (0);
  32907. }));
  32908. return $1;
  32909. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},globals.AIContext)})},
  32910. args: ["aString"],
  32911. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  32912. messageSends: ["at:ifAbsent:", "sendIndexes"],
  32913. referencedClasses: []
  32914. }),
  32915. globals.AIContext);
  32916. smalltalk.addMethod(
  32917. smalltalk.method({
  32918. selector: "sendIndexes",
  32919. protocol: 'accessing',
  32920. fn: function (){
  32921. var self=this;
  32922. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  32923. return smalltalk.withContext(function($ctx1) {
  32924. var $2,$1,$receiver;
  32925. $2=self["@sendIndexes"];
  32926. if(($receiver = $2) == null || $receiver.isNil){
  32927. $1=_st($Dictionary())._new();
  32928. } else {
  32929. $1=$2;
  32930. };
  32931. return $1;
  32932. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.AIContext)})},
  32933. args: [],
  32934. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  32935. messageSends: ["ifNil:", "new"],
  32936. referencedClasses: ["Dictionary"]
  32937. }),
  32938. globals.AIContext);
  32939. smalltalk.addMethod(
  32940. smalltalk.method({
  32941. selector: "sendIndexes:",
  32942. protocol: 'accessing',
  32943. fn: function (aDictionary){
  32944. var self=this;
  32945. self["@sendIndexes"]=aDictionary;
  32946. return self},
  32947. args: ["aDictionary"],
  32948. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  32949. messageSends: [],
  32950. referencedClasses: []
  32951. }),
  32952. globals.AIContext);
  32953. smalltalk.addMethod(
  32954. smalltalk.method({
  32955. selector: "setupInterpreter:",
  32956. protocol: 'interpreting',
  32957. fn: function (anInterpreter){
  32958. var self=this;
  32959. var currentNode;
  32960. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  32961. return smalltalk.withContext(function($ctx1) {
  32962. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  32963. $1=_st($ASTPCNodeVisitor())._new();
  32964. _st($1)._selector_(self._evaluatedSelector());
  32965. _st($1)._context_(self);
  32966. $2=$1;
  32967. $3=self._ast();
  32968. $ctx1.sendIdx["ast"]=1;
  32969. _st($2)._visit_($3);
  32970. $4=_st($1)._currentNode();
  32971. currentNode=$4;
  32972. $5=_st(self._ast())._sequenceNode();
  32973. if(($receiver = $5) == null || $receiver.isNil){
  32974. $5;
  32975. } else {
  32976. var sequence;
  32977. sequence=$receiver;
  32978. _st(_st(sequence)._temps())._do_((function(each){
  32979. return smalltalk.withContext(function($ctx2) {
  32980. return self._defineLocal_(each);
  32981. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  32982. $ctx1.sendIdx["do:"]=1;
  32983. };
  32984. _st(anInterpreter)._node_(currentNode);
  32985. $8=self._innerContext();
  32986. $ctx1.sendIdx["innerContext"]=1;
  32987. $7=_st($8)._arguments();
  32988. $6=_st($7)._reversed();
  32989. _st($6)._do_((function(each){
  32990. return smalltalk.withContext(function($ctx2) {
  32991. return _st(anInterpreter)._push_(each);
  32992. $ctx2.sendIdx["push:"]=1;
  32993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  32994. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  32995. return self}, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},globals.AIContext)})},
  32996. args: ["anInterpreter"],
  32997. source: "setupInterpreter: anInterpreter\x0a\x09| currentNode |\x0a\x09\x0a\x09\x22Retrieve the current node\x22\x0a\x09currentNode := ASTPCNodeVisitor new\x0a\x09\x09\x09selector: self evaluatedSelector;\x0a\x09\x09\x09context: self;\x0a\x09\x09\x09visit: self ast;\x0a\x09\x09\x09currentNode.\x0a\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09self ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09self defineLocal: each ] ].\x0a\x09\x0a\x09anInterpreter node: currentNode.\x0a\x0a\x09\x22Push the send args and receiver to the interpreter stack\x22\x09\x0a\x09self innerContext arguments reversed do: [ :each | \x0a\x09\x09anInterpreter push: each ].\x0a\x09\x09\x0a\x09anInterpreter push: (self innerContext receiver)",
  32998. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"],
  32999. referencedClasses: ["ASTPCNodeVisitor"]
  33000. }),
  33001. globals.AIContext);
  33002. smalltalk.addMethod(
  33003. smalltalk.method({
  33004. selector: "supercall",
  33005. protocol: 'interpreting',
  33006. fn: function (){
  33007. var self=this;
  33008. return smalltalk.withContext(function($ctx1) {
  33009. var $2,$1,$receiver;
  33010. $2=self["@supercall"];
  33011. if(($receiver = $2) == null || $receiver.isNil){
  33012. $1=false;
  33013. } else {
  33014. $1=$2;
  33015. };
  33016. return $1;
  33017. }, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.AIContext)})},
  33018. args: [],
  33019. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  33020. messageSends: ["ifNil:"],
  33021. referencedClasses: []
  33022. }),
  33023. globals.AIContext);
  33024. smalltalk.addMethod(
  33025. smalltalk.method({
  33026. selector: "supercall:",
  33027. protocol: 'interpreting',
  33028. fn: function (aBoolean){
  33029. var self=this;
  33030. self["@supercall"]=aBoolean;
  33031. return self},
  33032. args: ["aBoolean"],
  33033. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  33034. messageSends: [],
  33035. referencedClasses: []
  33036. }),
  33037. globals.AIContext);
  33038. smalltalk.addMethod(
  33039. smalltalk.method({
  33040. selector: "variableNotFound",
  33041. protocol: 'error handling',
  33042. fn: function (){
  33043. var self=this;
  33044. return smalltalk.withContext(function($ctx1) {
  33045. self._error_("Variable missing");
  33046. return self}, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},globals.AIContext)})},
  33047. args: [],
  33048. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  33049. messageSends: ["error:"],
  33050. referencedClasses: []
  33051. }),
  33052. globals.AIContext);
  33053. smalltalk.addMethod(
  33054. smalltalk.method({
  33055. selector: "fromMethodContext:",
  33056. protocol: 'instance creation',
  33057. fn: function (aMethodContext){
  33058. var self=this;
  33059. return smalltalk.withContext(function($ctx1) {
  33060. var $2,$3,$1;
  33061. $2=self._new();
  33062. _st($2)._initializeFromMethodContext_(aMethodContext);
  33063. $3=_st($2)._yourself();
  33064. $1=$3;
  33065. return $1;
  33066. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext.klass)})},
  33067. args: ["aMethodContext"],
  33068. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  33069. messageSends: ["initializeFromMethodContext:", "new", "yourself"],
  33070. referencedClasses: []
  33071. }),
  33072. globals.AIContext.klass);
  33073. smalltalk.addClass('AISemanticAnalyzer', globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  33074. globals.AISemanticAnalyzer.comment="I perform the same semantic analysis than `SemanticAnalyzer`, with the difference that provided an `AIContext` context, variables are bound with the context variables.";
  33075. smalltalk.addMethod(
  33076. smalltalk.method({
  33077. selector: "context",
  33078. protocol: 'accessing',
  33079. fn: function (){
  33080. var self=this;
  33081. var $1;
  33082. $1=self["@context"];
  33083. return $1;
  33084. },
  33085. args: [],
  33086. source: "context\x0a\x09^ context",
  33087. messageSends: [],
  33088. referencedClasses: []
  33089. }),
  33090. globals.AISemanticAnalyzer);
  33091. smalltalk.addMethod(
  33092. smalltalk.method({
  33093. selector: "context:",
  33094. protocol: 'accessing',
  33095. fn: function (anAIContext){
  33096. var self=this;
  33097. self["@context"]=anAIContext;
  33098. return self},
  33099. args: ["anAIContext"],
  33100. source: "context: anAIContext\x0a\x09context := anAIContext",
  33101. messageSends: [],
  33102. referencedClasses: []
  33103. }),
  33104. globals.AISemanticAnalyzer);
  33105. smalltalk.addMethod(
  33106. smalltalk.method({
  33107. selector: "visitVariableNode:",
  33108. protocol: 'visiting',
  33109. fn: function (aNode){
  33110. var self=this;
  33111. function $ASTContextVar(){return globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  33112. return smalltalk.withContext(function($ctx1) {
  33113. var $1;
  33114. var $early={};
  33115. try {
  33116. _st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
  33117. return smalltalk.withContext(function($ctx2) {
  33118. $1=($ctx2.supercall = true, globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]));
  33119. $ctx2.supercall = false;
  33120. throw $early=[$1];
  33121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  33122. _st(aNode)._binding_(_st($ASTContextVar())._new());
  33123. return self}
  33124. catch(e) {if(e===$early)return e[0]; throw e}
  33125. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.AISemanticAnalyzer)})},
  33126. args: ["aNode"],
  33127. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  33128. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"],
  33129. referencedClasses: ["ASTContextVar"]
  33130. }),
  33131. globals.AISemanticAnalyzer);
  33132. smalltalk.addClass('ASTContextVar', globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  33133. globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  33134. smalltalk.addMethod(
  33135. smalltalk.method({
  33136. selector: "context",
  33137. protocol: 'accessing',
  33138. fn: function (){
  33139. var self=this;
  33140. var $1;
  33141. $1=self["@context"];
  33142. return $1;
  33143. },
  33144. args: [],
  33145. source: "context\x0a\x09^ context",
  33146. messageSends: [],
  33147. referencedClasses: []
  33148. }),
  33149. globals.ASTContextVar);
  33150. smalltalk.addMethod(
  33151. smalltalk.method({
  33152. selector: "context:",
  33153. protocol: 'accessing',
  33154. fn: function (anObject){
  33155. var self=this;
  33156. self["@context"]=anObject;
  33157. return self},
  33158. args: ["anObject"],
  33159. source: "context: anObject\x0a\x09context := anObject",
  33160. messageSends: [],
  33161. referencedClasses: []
  33162. }),
  33163. globals.ASTContextVar);
  33164. smalltalk.addClass('ASTDebugger', globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  33165. globals.ASTDebugger.comment="I am a stepping debugger interface for Amber code.\x0aI internally use an instance of `ASTInterpreter` to actually step through node and interpret them.\x0a\x0aMy instances are created from an `AIContext` with `ASTDebugger class >> context:`.\x0aThey hold an `AIContext` instance internally, recursive copy of the `MethodContext`.\x0a\x0a## API\x0a\x0aUse the methods of the `'stepping'` protocol to do stepping.";
  33166. smalltalk.addMethod(
  33167. smalltalk.method({
  33168. selector: "atEnd",
  33169. protocol: 'testing',
  33170. fn: function (){
  33171. var self=this;
  33172. return smalltalk.withContext(function($ctx1) {
  33173. var $1,$2,$receiver;
  33174. $1=self._context();
  33175. $ctx1.sendIdx["context"]=1;
  33176. if(($receiver = $1) == null || $receiver.isNil){
  33177. return true;
  33178. } else {
  33179. $1;
  33180. };
  33181. $2=_st(_st(self._interpreter())._atEnd())._and_((function(){
  33182. return smalltalk.withContext(function($ctx2) {
  33183. return _st(self._context())._isTopContext();
  33184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  33185. return $2;
  33186. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTDebugger)})},
  33187. args: [],
  33188. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  33189. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"],
  33190. referencedClasses: []
  33191. }),
  33192. globals.ASTDebugger);
  33193. smalltalk.addMethod(
  33194. smalltalk.method({
  33195. selector: "context",
  33196. protocol: 'accessing',
  33197. fn: function (){
  33198. var self=this;
  33199. var $1;
  33200. $1=self["@context"];
  33201. return $1;
  33202. },
  33203. args: [],
  33204. source: "context\x0a\x09^ context",
  33205. messageSends: [],
  33206. referencedClasses: []
  33207. }),
  33208. globals.ASTDebugger);
  33209. smalltalk.addMethod(
  33210. smalltalk.method({
  33211. selector: "context:",
  33212. protocol: 'accessing',
  33213. fn: function (aContext){
  33214. var self=this;
  33215. self["@context"]=aContext;
  33216. return self},
  33217. args: ["aContext"],
  33218. source: "context: aContext\x0a\x09context := aContext",
  33219. messageSends: [],
  33220. referencedClasses: []
  33221. }),
  33222. globals.ASTDebugger);
  33223. smalltalk.addMethod(
  33224. smalltalk.method({
  33225. selector: "flushInnerContexts",
  33226. protocol: 'actions',
  33227. fn: function (){
  33228. var self=this;
  33229. return smalltalk.withContext(function($ctx1) {
  33230. var $1,$receiver;
  33231. $1=self._context();
  33232. if(($receiver = $1) == null || $receiver.isNil){
  33233. $1;
  33234. } else {
  33235. var cxt;
  33236. cxt=$receiver;
  33237. _st(cxt)._innerContext_(nil);
  33238. };
  33239. return self}, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},globals.ASTDebugger)})},
  33240. args: [],
  33241. source: "flushInnerContexts\x0a\x09\x22When stepping, the inner contexts are not relevent anymore,\x0a\x09and can be flushed\x22\x0a\x09\x0a\x09self context ifNotNil: [ :cxt | \x0a\x09\x09cxt innerContext: nil ]",
  33242. messageSends: ["ifNotNil:", "context", "innerContext:"],
  33243. referencedClasses: []
  33244. }),
  33245. globals.ASTDebugger);
  33246. smalltalk.addMethod(
  33247. smalltalk.method({
  33248. selector: "interpreter",
  33249. protocol: 'accessing',
  33250. fn: function (){
  33251. var self=this;
  33252. return smalltalk.withContext(function($ctx1) {
  33253. var $2,$1,$receiver;
  33254. $2=self._context();
  33255. if(($receiver = $2) == null || $receiver.isNil){
  33256. $1=$2;
  33257. } else {
  33258. var ctx;
  33259. ctx=$receiver;
  33260. $1=_st(ctx)._interpreter();
  33261. };
  33262. return $1;
  33263. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.ASTDebugger)})},
  33264. args: [],
  33265. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  33266. messageSends: ["ifNotNil:", "context", "interpreter"],
  33267. referencedClasses: []
  33268. }),
  33269. globals.ASTDebugger);
  33270. smalltalk.addMethod(
  33271. smalltalk.method({
  33272. selector: "method",
  33273. protocol: 'accessing',
  33274. fn: function (){
  33275. var self=this;
  33276. return smalltalk.withContext(function($ctx1) {
  33277. var $1;
  33278. $1=_st(self._context())._method();
  33279. return $1;
  33280. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.ASTDebugger)})},
  33281. args: [],
  33282. source: "method\x0a\x09^ self context method",
  33283. messageSends: ["method", "context"],
  33284. referencedClasses: []
  33285. }),
  33286. globals.ASTDebugger);
  33287. smalltalk.addMethod(
  33288. smalltalk.method({
  33289. selector: "node",
  33290. protocol: 'accessing',
  33291. fn: function (){
  33292. var self=this;
  33293. return smalltalk.withContext(function($ctx1) {
  33294. var $2,$1,$receiver;
  33295. $2=self._interpreter();
  33296. $ctx1.sendIdx["interpreter"]=1;
  33297. if(($receiver = $2) == null || $receiver.isNil){
  33298. $1=$2;
  33299. } else {
  33300. $1=_st(self._interpreter())._node();
  33301. };
  33302. return $1;
  33303. }, function($ctx1) {$ctx1.fill(self,"node",{},globals.ASTDebugger)})},
  33304. args: [],
  33305. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  33306. messageSends: ["ifNotNil:", "interpreter", "node"],
  33307. referencedClasses: []
  33308. }),
  33309. globals.ASTDebugger);
  33310. smalltalk.addMethod(
  33311. smalltalk.method({
  33312. selector: "onStep",
  33313. protocol: 'private',
  33314. fn: function (){
  33315. var self=this;
  33316. return smalltalk.withContext(function($ctx1) {
  33317. var $1,$3,$2,$4,$6,$5,$receiver;
  33318. $1=self._interpreter();
  33319. $ctx1.sendIdx["interpreter"]=1;
  33320. self["@result"]=_st($1)._result();
  33321. $3=self._interpreter();
  33322. $ctx1.sendIdx["interpreter"]=2;
  33323. $2=_st($3)._atEnd();
  33324. $ctx1.sendIdx["atEnd"]=1;
  33325. if(smalltalk.assert($2)){
  33326. $4=_st(self._context())._outerContext();
  33327. if(($receiver = $4) == null || $receiver.isNil){
  33328. $4;
  33329. } else {
  33330. var outerContext;
  33331. outerContext=$receiver;
  33332. self._context_(outerContext);
  33333. };
  33334. $6=self._interpreter();
  33335. $ctx1.sendIdx["interpreter"]=3;
  33336. $5=_st($6)._atEnd();
  33337. if(! smalltalk.assert($5)){
  33338. _st(self._interpreter())._skip();
  33339. };
  33340. };
  33341. self._flushInnerContexts();
  33342. return self}, function($ctx1) {$ctx1.fill(self,"onStep",{},globals.ASTDebugger)})},
  33343. args: [],
  33344. source: "onStep\x0a\x09\x22After each step, check if the interpreter is at the end,\x0a\x09and if it is move to its outer context if any, skipping its \x0a\x09current node (which was just evaluated by the current \x0a\x09interpreter).\x0a\x09\x0a\x09After each step we also flush inner contexts.\x22\x0a\x09\x0a\x09result := self interpreter result.\x0a\x09\x0a\x09self interpreter atEnd ifTrue: [\x0a\x09\x09self context outerContext ifNotNil: [ :outerContext | \x0a\x09\x09\x09self context: outerContext ].\x0a\x09\x09self interpreter atEnd ifFalse: [ self interpreter skip ] ].\x0a\x09\x09\x0a\x09self flushInnerContexts",
  33345. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"],
  33346. referencedClasses: []
  33347. }),
  33348. globals.ASTDebugger);
  33349. smalltalk.addMethod(
  33350. smalltalk.method({
  33351. selector: "proceed",
  33352. protocol: 'stepping',
  33353. fn: function (){
  33354. var self=this;
  33355. return smalltalk.withContext(function($ctx1) {
  33356. _st((function(){
  33357. return smalltalk.withContext(function($ctx2) {
  33358. return self._atEnd();
  33359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  33360. return smalltalk.withContext(function($ctx2) {
  33361. return self._stepOver();
  33362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  33363. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTDebugger)})},
  33364. args: [],
  33365. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  33366. messageSends: ["whileFalse:", "atEnd", "stepOver"],
  33367. referencedClasses: []
  33368. }),
  33369. globals.ASTDebugger);
  33370. smalltalk.addMethod(
  33371. smalltalk.method({
  33372. selector: "restart",
  33373. protocol: 'stepping',
  33374. fn: function (){
  33375. var self=this;
  33376. return smalltalk.withContext(function($ctx1) {
  33377. _st(self._interpreter())._restart();
  33378. self._flushInnerContexts();
  33379. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTDebugger)})},
  33380. args: [],
  33381. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  33382. messageSends: ["restart", "interpreter", "flushInnerContexts"],
  33383. referencedClasses: []
  33384. }),
  33385. globals.ASTDebugger);
  33386. smalltalk.addMethod(
  33387. smalltalk.method({
  33388. selector: "result",
  33389. protocol: 'accessing',
  33390. fn: function (){
  33391. var self=this;
  33392. var $1;
  33393. $1=self["@result"];
  33394. return $1;
  33395. },
  33396. args: [],
  33397. source: "result\x0a\x09^ result",
  33398. messageSends: [],
  33399. referencedClasses: []
  33400. }),
  33401. globals.ASTDebugger);
  33402. smalltalk.addMethod(
  33403. smalltalk.method({
  33404. selector: "stepInto",
  33405. protocol: 'stepping',
  33406. fn: function (){
  33407. var self=this;
  33408. return smalltalk.withContext(function($ctx1) {
  33409. self._shouldBeImplemented();
  33410. return self}, function($ctx1) {$ctx1.fill(self,"stepInto",{},globals.ASTDebugger)})},
  33411. args: [],
  33412. source: "stepInto\x0a\x09self shouldBeImplemented",
  33413. messageSends: ["shouldBeImplemented"],
  33414. referencedClasses: []
  33415. }),
  33416. globals.ASTDebugger);
  33417. smalltalk.addMethod(
  33418. smalltalk.method({
  33419. selector: "stepOver",
  33420. protocol: 'stepping',
  33421. fn: function (){
  33422. var self=this;
  33423. return smalltalk.withContext(function($ctx1) {
  33424. var $1,$2;
  33425. $1=_st(self._context())._isTopContext();
  33426. if(smalltalk.assert($1)){
  33427. _st(self._interpreter())._stepOver();
  33428. } else {
  33429. $2=self._interpreter();
  33430. $ctx1.sendIdx["interpreter"]=1;
  33431. _st($2)._skip();
  33432. };
  33433. self._onStep();
  33434. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTDebugger)})},
  33435. args: [],
  33436. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  33437. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"],
  33438. referencedClasses: []
  33439. }),
  33440. globals.ASTDebugger);
  33441. smalltalk.addMethod(
  33442. smalltalk.method({
  33443. selector: "context:",
  33444. protocol: 'instance creation',
  33445. fn: function (aContext){
  33446. var self=this;
  33447. return smalltalk.withContext(function($ctx1) {
  33448. var $2,$3,$1;
  33449. $2=self._new();
  33450. _st($2)._context_(aContext);
  33451. $3=_st($2)._yourself();
  33452. $1=$3;
  33453. return $1;
  33454. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},globals.ASTDebugger.klass)})},
  33455. args: ["aContext"],
  33456. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  33457. messageSends: ["context:", "new", "yourself"],
  33458. referencedClasses: []
  33459. }),
  33460. globals.ASTDebugger.klass);
  33461. smalltalk.addClass('ASTInterpreter', globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  33462. globals.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
  33463. smalltalk.addMethod(
  33464. smalltalk.method({
  33465. selector: "assign:to:",
  33466. protocol: 'private',
  33467. fn: function (aNode,anObject){
  33468. var self=this;
  33469. return smalltalk.withContext(function($ctx1) {
  33470. var $1,$3,$2,$4;
  33471. $1=_st(_st(aNode)._binding())._isInstanceVar();
  33472. if(smalltalk.assert($1)){
  33473. $3=self._context();
  33474. $ctx1.sendIdx["context"]=1;
  33475. $2=_st($3)._receiver();
  33476. $4=_st(aNode)._value();
  33477. $ctx1.sendIdx["value"]=1;
  33478. _st($2)._instVarAt_put_($4,anObject);
  33479. } else {
  33480. _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  33481. };
  33482. return self}, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},globals.ASTInterpreter)})},
  33483. args: ["aNode", "anObject"],
  33484. source: "assign: aNode to: anObject\x0a\x09aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value put: anObject ]\x0a\x09\x09ifFalse: [ self context localAt: aNode value put: anObject ]",
  33485. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"],
  33486. referencedClasses: []
  33487. }),
  33488. globals.ASTInterpreter);
  33489. smalltalk.addMethod(
  33490. smalltalk.method({
  33491. selector: "atEnd",
  33492. protocol: 'testing',
  33493. fn: function (){
  33494. var self=this;
  33495. return smalltalk.withContext(function($ctx1) {
  33496. var $1,$2;
  33497. $1=self["@forceAtEnd"];
  33498. if(smalltalk.assert($1)){
  33499. return true;
  33500. };
  33501. $2=_st(self._hasReturned())._or_((function(){
  33502. return smalltalk.withContext(function($ctx2) {
  33503. return _st(self._node())._isNil();
  33504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  33505. return $2;
  33506. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTInterpreter)})},
  33507. args: [],
  33508. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  33509. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"],
  33510. referencedClasses: []
  33511. }),
  33512. globals.ASTInterpreter);
  33513. smalltalk.addMethod(
  33514. smalltalk.method({
  33515. selector: "context",
  33516. protocol: 'accessing',
  33517. fn: function (){
  33518. var self=this;
  33519. var $1;
  33520. $1=self["@context"];
  33521. return $1;
  33522. },
  33523. args: [],
  33524. source: "context\x0a\x09^ context",
  33525. messageSends: [],
  33526. referencedClasses: []
  33527. }),
  33528. globals.ASTInterpreter);
  33529. smalltalk.addMethod(
  33530. smalltalk.method({
  33531. selector: "context:",
  33532. protocol: 'accessing',
  33533. fn: function (aContext){
  33534. var self=this;
  33535. self["@context"]=aContext;
  33536. return self},
  33537. args: ["aContext"],
  33538. source: "context: aContext\x0a\x09context := aContext",
  33539. messageSends: [],
  33540. referencedClasses: []
  33541. }),
  33542. globals.ASTInterpreter);
  33543. smalltalk.addMethod(
  33544. smalltalk.method({
  33545. selector: "eval:",
  33546. protocol: 'private',
  33547. fn: function (aString){
  33548. var self=this;
  33549. var source,function_;
  33550. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  33551. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  33552. return smalltalk.withContext(function($ctx1) {
  33553. var $3,$2,$1,$4,$5;
  33554. source=_st($String())._streamContents_((function(str){
  33555. return smalltalk.withContext(function($ctx2) {
  33556. _st(str)._nextPutAll_("(function(");
  33557. $ctx2.sendIdx["nextPutAll:"]=1;
  33558. $3=self._context();
  33559. $ctx2.sendIdx["context"]=1;
  33560. $2=_st($3)._locals();
  33561. $ctx2.sendIdx["locals"]=1;
  33562. $1=_st($2)._keys();
  33563. _st($1)._do_separatedBy_((function(each){
  33564. return smalltalk.withContext(function($ctx3) {
  33565. return _st(str)._nextPutAll_(each);
  33566. $ctx3.sendIdx["nextPutAll:"]=2;
  33567. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  33568. return smalltalk.withContext(function($ctx3) {
  33569. return _st(str)._nextPutAll_(",");
  33570. $ctx3.sendIdx["nextPutAll:"]=3;
  33571. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  33572. _st(str)._nextPutAll_("){ return (function() {");
  33573. $ctx2.sendIdx["nextPutAll:"]=4;
  33574. _st(str)._nextPutAll_(aString);
  33575. $ctx2.sendIdx["nextPutAll:"]=5;
  33576. $4=_st(str)._nextPutAll_("})() })");
  33577. return $4;
  33578. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  33579. function_=_st(_st($Compiler())._new())._eval_(source);
  33580. $5=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  33581. return $5;
  33582. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},globals.ASTInterpreter)})},
  33583. args: ["aString"],
  33584. source: "eval: aString\x0a\x09\x22Evaluate aString as JS source inside an JS function.\x0a\x09aString is not sandboxed.\x22\x0a\x09\x0a\x09| source function |\x0a\x09\x0a\x09source := String streamContents: [ :str |\x0a\x09\x09str nextPutAll: '(function('.\x0a\x09\x09self context locals keys\x0a\x09\x09\x09do: [ :each | str nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ str nextPutAll: ',' ].\x0a\x09\x09str\x0a\x09\x09\x09nextPutAll: '){ return (function() {';\x0a\x09\x09\x09nextPutAll: aString;\x0a\x09\x09\x09nextPutAll: '})() })' ].\x0a\x09\x09\x09\x0a\x09function := Compiler new eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  33585. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"],
  33586. referencedClasses: ["String", "Compiler"]
  33587. }),
  33588. globals.ASTInterpreter);
  33589. smalltalk.addMethod(
  33590. smalltalk.method({
  33591. selector: "hasReturned",
  33592. protocol: 'testing',
  33593. fn: function (){
  33594. var self=this;
  33595. return smalltalk.withContext(function($ctx1) {
  33596. var $2,$1,$receiver;
  33597. $2=self["@returned"];
  33598. if(($receiver = $2) == null || $receiver.isNil){
  33599. $1=false;
  33600. } else {
  33601. $1=$2;
  33602. };
  33603. return $1;
  33604. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},globals.ASTInterpreter)})},
  33605. args: [],
  33606. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  33607. messageSends: ["ifNil:"],
  33608. referencedClasses: []
  33609. }),
  33610. globals.ASTInterpreter);
  33611. smalltalk.addMethod(
  33612. smalltalk.method({
  33613. selector: "initialize",
  33614. protocol: 'initialization',
  33615. fn: function (){
  33616. var self=this;
  33617. return smalltalk.withContext(function($ctx1) {
  33618. ($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []));
  33619. $ctx1.supercall = false;
  33620. self["@forceAtEnd"]=false;
  33621. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ASTInterpreter)})},
  33622. args: [],
  33623. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  33624. messageSends: ["initialize"],
  33625. referencedClasses: []
  33626. }),
  33627. globals.ASTInterpreter);
  33628. smalltalk.addMethod(
  33629. smalltalk.method({
  33630. selector: "interpret",
  33631. protocol: 'interpreting',
  33632. fn: function (){
  33633. var self=this;
  33634. return smalltalk.withContext(function($ctx1) {
  33635. self._visit_(self._node());
  33636. return self}, function($ctx1) {$ctx1.fill(self,"interpret",{},globals.ASTInterpreter)})},
  33637. args: [],
  33638. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  33639. messageSends: ["visit:", "node"],
  33640. referencedClasses: []
  33641. }),
  33642. globals.ASTInterpreter);
  33643. smalltalk.addMethod(
  33644. smalltalk.method({
  33645. selector: "interpret:",
  33646. protocol: 'interpreting',
  33647. fn: function (aNode){
  33648. var self=this;
  33649. return smalltalk.withContext(function($ctx1) {
  33650. self._node_(aNode);
  33651. self._interpret();
  33652. return self}, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},globals.ASTInterpreter)})},
  33653. args: ["aNode"],
  33654. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  33655. messageSends: ["node:", "interpret"],
  33656. referencedClasses: []
  33657. }),
  33658. globals.ASTInterpreter);
  33659. smalltalk.addMethod(
  33660. smalltalk.method({
  33661. selector: "messageFromSendNode:arguments:",
  33662. protocol: 'private',
  33663. fn: function (aSendNode,aCollection){
  33664. var self=this;
  33665. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  33666. return smalltalk.withContext(function($ctx1) {
  33667. var $2,$3,$1;
  33668. $2=_st($Message())._new();
  33669. _st($2)._selector_(_st(aSendNode)._selector());
  33670. _st($2)._arguments_(aCollection);
  33671. $3=_st($2)._yourself();
  33672. $1=$3;
  33673. return $1;
  33674. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},globals.ASTInterpreter)})},
  33675. args: ["aSendNode", "aCollection"],
  33676. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  33677. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"],
  33678. referencedClasses: ["Message"]
  33679. }),
  33680. globals.ASTInterpreter);
  33681. smalltalk.addMethod(
  33682. smalltalk.method({
  33683. selector: "messageNotUnderstood:receiver:",
  33684. protocol: 'private',
  33685. fn: function (aMessage,anObject){
  33686. var self=this;
  33687. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  33688. return smalltalk.withContext(function($ctx1) {
  33689. var $1,$2;
  33690. $1=_st($MessageNotUnderstood())._new();
  33691. _st($1)._meesage_(aMessage);
  33692. _st($1)._receiver_(anObject);
  33693. $2=_st($1)._signal();
  33694. return self}, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},globals.ASTInterpreter)})},
  33695. args: ["aMessage", "anObject"],
  33696. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  33697. messageSends: ["meesage:", "new", "receiver:", "signal"],
  33698. referencedClasses: ["MessageNotUnderstood"]
  33699. }),
  33700. globals.ASTInterpreter);
  33701. smalltalk.addMethod(
  33702. smalltalk.method({
  33703. selector: "next",
  33704. protocol: 'interpreting',
  33705. fn: function (){
  33706. var self=this;
  33707. return smalltalk.withContext(function($ctx1) {
  33708. self._node_(_st(self._node())._nextNode());
  33709. return self}, function($ctx1) {$ctx1.fill(self,"next",{},globals.ASTInterpreter)})},
  33710. args: [],
  33711. source: "next\x0a\x09self node: self node nextNode",
  33712. messageSends: ["node:", "nextNode", "node"],
  33713. referencedClasses: []
  33714. }),
  33715. globals.ASTInterpreter);
  33716. smalltalk.addMethod(
  33717. smalltalk.method({
  33718. selector: "node",
  33719. protocol: 'accessing',
  33720. fn: function (){
  33721. var self=this;
  33722. var $1;
  33723. $1=self["@node"];
  33724. return $1;
  33725. },
  33726. args: [],
  33727. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  33728. messageSends: [],
  33729. referencedClasses: []
  33730. }),
  33731. globals.ASTInterpreter);
  33732. smalltalk.addMethod(
  33733. smalltalk.method({
  33734. selector: "node:",
  33735. protocol: 'accessing',
  33736. fn: function (aNode){
  33737. var self=this;
  33738. self["@node"]=aNode;
  33739. return self},
  33740. args: ["aNode"],
  33741. source: "node: aNode\x0a\x09node := aNode",
  33742. messageSends: [],
  33743. referencedClasses: []
  33744. }),
  33745. globals.ASTInterpreter);
  33746. smalltalk.addMethod(
  33747. smalltalk.method({
  33748. selector: "peek",
  33749. protocol: 'stack',
  33750. fn: function (){
  33751. var self=this;
  33752. return smalltalk.withContext(function($ctx1) {
  33753. var $1,$2;
  33754. var $early={};
  33755. try {
  33756. $1=self._stack();
  33757. $ctx1.sendIdx["stack"]=1;
  33758. _st($1)._ifEmpty_((function(){
  33759. throw $early=[nil];
  33760. }));
  33761. $2=_st(self._stack())._last();
  33762. return $2;
  33763. }
  33764. catch(e) {if(e===$early)return e[0]; throw e}
  33765. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.ASTInterpreter)})},
  33766. args: [],
  33767. source: "peek\x0a\x09\x22Peek the top object of the context stack\x22\x0a\x09\x0a\x09self stack ifEmpty: [ ^ nil ].\x0a\x09\x0a\x09^ self stack last",
  33768. messageSends: ["ifEmpty:", "stack", "last"],
  33769. referencedClasses: []
  33770. }),
  33771. globals.ASTInterpreter);
  33772. smalltalk.addMethod(
  33773. smalltalk.method({
  33774. selector: "pop",
  33775. protocol: 'stack',
  33776. fn: function (){
  33777. var self=this;
  33778. var peekedValue;
  33779. return smalltalk.withContext(function($ctx1) {
  33780. var $1;
  33781. peekedValue=self._peek();
  33782. _st(self._stack())._removeLast();
  33783. $1=peekedValue;
  33784. return $1;
  33785. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},globals.ASTInterpreter)})},
  33786. args: [],
  33787. source: "pop\x0a\x09\x22Pop an object from the context stack\x22\x0a\x09\x0a\x09| peekedValue |\x0a\x09\x0a\x09peekedValue := self peek.\x0a\x09self stack removeLast.\x0a\x09^ peekedValue",
  33788. messageSends: ["peek", "removeLast", "stack"],
  33789. referencedClasses: []
  33790. }),
  33791. globals.ASTInterpreter);
  33792. smalltalk.addMethod(
  33793. smalltalk.method({
  33794. selector: "proceed",
  33795. protocol: 'interpreting',
  33796. fn: function (){
  33797. var self=this;
  33798. return smalltalk.withContext(function($ctx1) {
  33799. _st((function(){
  33800. return smalltalk.withContext(function($ctx2) {
  33801. return self._atEnd();
  33802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  33803. return smalltalk.withContext(function($ctx2) {
  33804. return self._step();
  33805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  33806. return self}, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTInterpreter)})},
  33807. args: [],
  33808. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  33809. messageSends: ["whileFalse:", "atEnd", "step"],
  33810. referencedClasses: []
  33811. }),
  33812. globals.ASTInterpreter);
  33813. smalltalk.addMethod(
  33814. smalltalk.method({
  33815. selector: "push:",
  33816. protocol: 'stack',
  33817. fn: function (anObject){
  33818. var self=this;
  33819. return smalltalk.withContext(function($ctx1) {
  33820. var $1;
  33821. $1=_st(self._stack())._add_(anObject);
  33822. return $1;
  33823. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},globals.ASTInterpreter)})},
  33824. args: ["anObject"],
  33825. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  33826. messageSends: ["add:", "stack"],
  33827. referencedClasses: []
  33828. }),
  33829. globals.ASTInterpreter);
  33830. smalltalk.addMethod(
  33831. smalltalk.method({
  33832. selector: "restart",
  33833. protocol: 'interpreting',
  33834. fn: function (){
  33835. var self=this;
  33836. return smalltalk.withContext(function($ctx1) {
  33837. self._node_(_st(_st(self._context())._ast())._nextChild());
  33838. return self}, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTInterpreter)})},
  33839. args: [],
  33840. source: "restart\x0a\x09self node: self context ast nextChild",
  33841. messageSends: ["node:", "nextChild", "ast", "context"],
  33842. referencedClasses: []
  33843. }),
  33844. globals.ASTInterpreter);
  33845. smalltalk.addMethod(
  33846. smalltalk.method({
  33847. selector: "result",
  33848. protocol: 'accessing',
  33849. fn: function (){
  33850. var self=this;
  33851. return smalltalk.withContext(function($ctx1) {
  33852. var $2,$1;
  33853. $2=self._hasReturned();
  33854. if(smalltalk.assert($2)){
  33855. $1=self._returnValue();
  33856. } else {
  33857. $1=_st(self._context())._receiver();
  33858. };
  33859. return $1;
  33860. }, function($ctx1) {$ctx1.fill(self,"result",{},globals.ASTInterpreter)})},
  33861. args: [],
  33862. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  33863. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"],
  33864. referencedClasses: []
  33865. }),
  33866. globals.ASTInterpreter);
  33867. smalltalk.addMethod(
  33868. smalltalk.method({
  33869. selector: "returnValue",
  33870. protocol: 'accessing',
  33871. fn: function (){
  33872. var self=this;
  33873. var $1;
  33874. $1=self["@returnValue"];
  33875. return $1;
  33876. },
  33877. args: [],
  33878. source: "returnValue\x0a\x09^ returnValue",
  33879. messageSends: [],
  33880. referencedClasses: []
  33881. }),
  33882. globals.ASTInterpreter);
  33883. smalltalk.addMethod(
  33884. smalltalk.method({
  33885. selector: "returnValue:",
  33886. protocol: 'accessing',
  33887. fn: function (anObject){
  33888. var self=this;
  33889. self["@returnValue"]=anObject;
  33890. return self},
  33891. args: ["anObject"],
  33892. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  33893. messageSends: [],
  33894. referencedClasses: []
  33895. }),
  33896. globals.ASTInterpreter);
  33897. smalltalk.addMethod(
  33898. smalltalk.method({
  33899. selector: "sendMessage:to:superSend:",
  33900. protocol: 'private',
  33901. fn: function (aMessage,anObject,aBoolean){
  33902. var self=this;
  33903. var method;
  33904. return smalltalk.withContext(function($ctx1) {
  33905. var $1,$3,$2,$4,$5,$6,$receiver;
  33906. var $early={};
  33907. try {
  33908. if(! smalltalk.assert(aBoolean)){
  33909. $1=_st(aMessage)._sendTo_(anObject);
  33910. return $1;
  33911. };
  33912. $3=_st(anObject)._class();
  33913. $ctx1.sendIdx["class"]=1;
  33914. $2=_st($3)._superclass();
  33915. $ctx1.sendIdx["superclass"]=1;
  33916. if(($receiver = $2) == null || $receiver.isNil){
  33917. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  33918. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  33919. return $4;
  33920. } else {
  33921. $2;
  33922. };
  33923. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  33924. return smalltalk.withContext(function($ctx2) {
  33925. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  33926. throw $early=[$5];
  33927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  33928. $6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  33929. return $6;
  33930. }
  33931. catch(e) {if(e===$early)return e[0]; throw e}
  33932. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},globals.ASTInterpreter)})},
  33933. args: ["aMessage", "anObject", "aBoolean"],
  33934. source: "sendMessage: aMessage to: anObject superSend: aBoolean\x0a\x09| method |\x0a\x09\x0a\x09aBoolean ifFalse: [ ^ aMessage sendTo: anObject ].\x0a\x09anObject class superclass ifNil: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x0a\x09method := anObject class superclass methodDictionary\x0a\x09\x09at: aMessage selector\x0a\x09\x09ifAbsent: [ ^ self messageNotUnderstood: aMessage receiver: anObject ].\x0a\x09\x09\x0a\x09^ method sendTo: anObject arguments: aMessage arguments",
  33935. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"],
  33936. referencedClasses: []
  33937. }),
  33938. globals.ASTInterpreter);
  33939. smalltalk.addMethod(
  33940. smalltalk.method({
  33941. selector: "setNonLocalReturnFromContext:",
  33942. protocol: 'interpreting',
  33943. fn: function (aContext){
  33944. var self=this;
  33945. return smalltalk.withContext(function($ctx1) {
  33946. var $2,$1;
  33947. $2=_st(aContext)._interpreter();
  33948. $ctx1.sendIdx["interpreter"]=1;
  33949. $1=_st($2)._hasReturned();
  33950. if(smalltalk.assert($1)){
  33951. self["@returned"]=true;
  33952. self["@returned"];
  33953. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  33954. };
  33955. return self}, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},globals.ASTInterpreter)})},
  33956. args: ["aContext"],
  33957. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  33958. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"],
  33959. referencedClasses: []
  33960. }),
  33961. globals.ASTInterpreter);
  33962. smalltalk.addMethod(
  33963. smalltalk.method({
  33964. selector: "skip",
  33965. protocol: 'interpreting',
  33966. fn: function (){
  33967. var self=this;
  33968. return smalltalk.withContext(function($ctx1) {
  33969. self._next();
  33970. return self}, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTInterpreter)})},
  33971. args: [],
  33972. source: "skip\x0a\x09self next",
  33973. messageSends: ["next"],
  33974. referencedClasses: []
  33975. }),
  33976. globals.ASTInterpreter);
  33977. smalltalk.addMethod(
  33978. smalltalk.method({
  33979. selector: "stack",
  33980. protocol: 'accessing',
  33981. fn: function (){
  33982. var self=this;
  33983. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  33984. return smalltalk.withContext(function($ctx1) {
  33985. var $2,$1,$receiver;
  33986. $2=self["@stack"];
  33987. if(($receiver = $2) == null || $receiver.isNil){
  33988. self["@stack"]=_st($OrderedCollection())._new();
  33989. $1=self["@stack"];
  33990. } else {
  33991. $1=$2;
  33992. };
  33993. return $1;
  33994. }, function($ctx1) {$ctx1.fill(self,"stack",{},globals.ASTInterpreter)})},
  33995. args: [],
  33996. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  33997. messageSends: ["ifNil:", "new"],
  33998. referencedClasses: ["OrderedCollection"]
  33999. }),
  34000. globals.ASTInterpreter);
  34001. smalltalk.addMethod(
  34002. smalltalk.method({
  34003. selector: "step",
  34004. protocol: 'interpreting',
  34005. fn: function (){
  34006. var self=this;
  34007. return smalltalk.withContext(function($ctx1) {
  34008. var $1;
  34009. self._interpret();
  34010. $1=self._next();
  34011. return self}, function($ctx1) {$ctx1.fill(self,"step",{},globals.ASTInterpreter)})},
  34012. args: [],
  34013. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  34014. messageSends: ["interpret", "next"],
  34015. referencedClasses: []
  34016. }),
  34017. globals.ASTInterpreter);
  34018. smalltalk.addMethod(
  34019. smalltalk.method({
  34020. selector: "stepOver",
  34021. protocol: 'interpreting',
  34022. fn: function (){
  34023. var self=this;
  34024. return smalltalk.withContext(function($ctx1) {
  34025. var $2,$1;
  34026. self._step();
  34027. $ctx1.sendIdx["step"]=1;
  34028. _st((function(){
  34029. return smalltalk.withContext(function($ctx2) {
  34030. $2=self._node();
  34031. $ctx2.sendIdx["node"]=1;
  34032. $1=_st($2)._isNil();
  34033. return _st($1)._or_((function(){
  34034. return smalltalk.withContext(function($ctx3) {
  34035. return _st(self._node())._isSteppingNode();
  34036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  34037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  34038. return smalltalk.withContext(function($ctx2) {
  34039. return self._step();
  34040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  34041. return self}, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTInterpreter)})},
  34042. args: [],
  34043. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  34044. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"],
  34045. referencedClasses: []
  34046. }),
  34047. globals.ASTInterpreter);
  34048. smalltalk.addMethod(
  34049. smalltalk.method({
  34050. selector: "visit:",
  34051. protocol: 'visiting',
  34052. fn: function (aNode){
  34053. var self=this;
  34054. return smalltalk.withContext(function($ctx1) {
  34055. var $1;
  34056. $1=self._hasReturned();
  34057. if(! smalltalk.assert($1)){
  34058. ($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]));
  34059. $ctx1.supercall = false;
  34060. };
  34061. return self}, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)})},
  34062. args: ["aNode"],
  34063. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  34064. messageSends: ["ifFalse:", "hasReturned", "visit:"],
  34065. referencedClasses: []
  34066. }),
  34067. globals.ASTInterpreter);
  34068. smalltalk.addMethod(
  34069. smalltalk.method({
  34070. selector: "visitAssignmentNode:",
  34071. protocol: 'visiting',
  34072. fn: function (aNode){
  34073. var self=this;
  34074. var poppedValue;
  34075. return smalltalk.withContext(function($ctx1) {
  34076. poppedValue=self._pop();
  34077. $ctx1.sendIdx["pop"]=1;
  34078. self._pop();
  34079. self._push_(poppedValue);
  34080. self._assign_to_(_st(aNode)._left(),poppedValue);
  34081. return self}, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},globals.ASTInterpreter)})},
  34082. args: ["aNode"],
  34083. source: "visitAssignmentNode: aNode\x0a\x09| poppedValue |\x0a\x09\x0a\x09poppedValue := self pop.\x0a\x09\x0a\x09\x22Pop the left side of the assignment.\x0a\x09It already has been visited, and we don't need its value.\x22\x0a\x09self pop.\x0a\x09\x0a\x09self push: poppedValue.\x0a\x09self assign: aNode left to: poppedValue",
  34084. messageSends: ["pop", "push:", "assign:to:", "left"],
  34085. referencedClasses: []
  34086. }),
  34087. globals.ASTInterpreter);
  34088. smalltalk.addMethod(
  34089. smalltalk.method({
  34090. selector: "visitBlockNode:",
  34091. protocol: 'visiting',
  34092. fn: function (aNode){
  34093. var self=this;
  34094. var block;
  34095. function $AIBlockClosure(){return globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  34096. return smalltalk.withContext(function($ctx1) {
  34097. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  34098. self._push_(block);
  34099. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},globals.ASTInterpreter)})},
  34100. args: ["aNode"],
  34101. source: "visitBlockNode: aNode\x0a\x09\x22Do not evaluate the block node.\x0a\x09Instead, put all instructions into a block that we push to the stack for later evaluation\x22\x0a\x09\x0a\x09| block |\x0a\x09\x0a\x09block := AIBlockClosure forContext: self context node: aNode.\x0a\x09\x0a\x09self push: block",
  34102. messageSends: ["forContext:node:", "context", "push:"],
  34103. referencedClasses: ["AIBlockClosure"]
  34104. }),
  34105. globals.ASTInterpreter);
  34106. smalltalk.addMethod(
  34107. smalltalk.method({
  34108. selector: "visitBlockSequenceNode:",
  34109. protocol: 'visiting',
  34110. fn: function (aNode){
  34111. var self=this;
  34112. return smalltalk.withContext(function($ctx1) {
  34113. ($ctx1.supercall = true, globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]));
  34114. $ctx1.supercall = false;
  34115. self["@forceAtEnd"]=true;
  34116. return self}, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34117. args: ["aNode"],
  34118. source: "visitBlockSequenceNode: aNode\x0a\x09\x22If the receiver is actually visiting a BlockSequenceNode,\x0a\x09it means the the context is a block context. Evaluation should \x0a\x09stop right after evaluating the block sequence and the outer\x0a\x09context's interpreter should take over. \x0a\x09Therefore we force #atEnd.\x22\x0a\x09\x0a\x09super visitBlockSequenceNode: aNode.\x0a\x09forceAtEnd := true",
  34119. messageSends: ["visitBlockSequenceNode:"],
  34120. referencedClasses: []
  34121. }),
  34122. globals.ASTInterpreter);
  34123. smalltalk.addMethod(
  34124. smalltalk.method({
  34125. selector: "visitDynamicArrayNode:",
  34126. protocol: 'visiting',
  34127. fn: function (aNode){
  34128. var self=this;
  34129. var array;
  34130. return smalltalk.withContext(function($ctx1) {
  34131. array=[];
  34132. _st(_st(aNode)._nodes())._do_((function(each){
  34133. return smalltalk.withContext(function($ctx2) {
  34134. return _st(array)._addFirst_(self._pop());
  34135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34136. self._push_(array);
  34137. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.ASTInterpreter)})},
  34138. args: ["aNode"],
  34139. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  34140. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"],
  34141. referencedClasses: []
  34142. }),
  34143. globals.ASTInterpreter);
  34144. smalltalk.addMethod(
  34145. smalltalk.method({
  34146. selector: "visitDynamicDictionaryNode:",
  34147. protocol: 'visiting',
  34148. fn: function (aNode){
  34149. var self=this;
  34150. var keyValueList;
  34151. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  34152. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  34153. return smalltalk.withContext(function($ctx1) {
  34154. keyValueList=_st($OrderedCollection())._new();
  34155. _st(_st(aNode)._nodes())._do_((function(each){
  34156. return smalltalk.withContext(function($ctx2) {
  34157. return _st(keyValueList)._add_(self._pop());
  34158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34159. self._push_(_st($HashedCollection())._newFromPairs_(_st(keyValueList)._reversed()));
  34160. return self}, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},globals.ASTInterpreter)})},
  34161. args: ["aNode"],
  34162. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  34163. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"],
  34164. referencedClasses: ["OrderedCollection", "HashedCollection"]
  34165. }),
  34166. globals.ASTInterpreter);
  34167. smalltalk.addMethod(
  34168. smalltalk.method({
  34169. selector: "visitJSStatementNode:",
  34170. protocol: 'visiting',
  34171. fn: function (aNode){
  34172. var self=this;
  34173. return smalltalk.withContext(function($ctx1) {
  34174. self["@returned"]=true;
  34175. self._returnValue_(self._eval_(_st(aNode)._source()));
  34176. return self}, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34177. args: ["aNode"],
  34178. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  34179. messageSends: ["returnValue:", "eval:", "source"],
  34180. referencedClasses: []
  34181. }),
  34182. globals.ASTInterpreter);
  34183. smalltalk.addMethod(
  34184. smalltalk.method({
  34185. selector: "visitNode:",
  34186. protocol: 'visiting',
  34187. fn: function (aNode){
  34188. var self=this;
  34189. return self},
  34190. args: ["aNode"],
  34191. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  34192. messageSends: [],
  34193. referencedClasses: []
  34194. }),
  34195. globals.ASTInterpreter);
  34196. smalltalk.addMethod(
  34197. smalltalk.method({
  34198. selector: "visitReturnNode:",
  34199. protocol: 'visiting',
  34200. fn: function (aNode){
  34201. var self=this;
  34202. return smalltalk.withContext(function($ctx1) {
  34203. self["@returned"]=true;
  34204. self._returnValue_(self._pop());
  34205. return self}, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34206. args: ["aNode"],
  34207. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  34208. messageSends: ["returnValue:", "pop"],
  34209. referencedClasses: []
  34210. }),
  34211. globals.ASTInterpreter);
  34212. smalltalk.addMethod(
  34213. smalltalk.method({
  34214. selector: "visitSendNode:",
  34215. protocol: 'visiting',
  34216. fn: function (aNode){
  34217. var self=this;
  34218. var receiver,args,message,result;
  34219. return smalltalk.withContext(function($ctx1) {
  34220. var $1;
  34221. args=_st(_st(aNode)._arguments())._collect_((function(each){
  34222. return smalltalk.withContext(function($ctx2) {
  34223. return self._pop();
  34224. $ctx2.sendIdx["pop"]=1;
  34225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34226. receiver=self._pop();
  34227. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  34228. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  34229. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  34230. return smalltalk.withContext(function($ctx2) {
  34231. return _st(_st(aNode)._isLastChild())._not();
  34232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  34233. if(smalltalk.assert($1)){
  34234. self._push_(receiver);
  34235. $ctx1.sendIdx["push:"]=1;
  34236. } else {
  34237. self._push_(result);
  34238. };
  34239. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},globals.ASTInterpreter)})},
  34240. args: ["aNode"],
  34241. source: "visitSendNode: aNode\x0a\x09| receiver args message result |\x0a\x09\x0a\x09args := aNode arguments collect: [ :each | self pop ].\x0a\x09receiver := self pop.\x0a\x09\x0a\x09message := self\x0a\x09\x09messageFromSendNode: aNode\x0a\x09\x09arguments: args reversed.\x0a\x09\x0a\x09result := self sendMessage: message to: receiver superSend: aNode superSend.\x0a\x09\x0a\x09\x22For cascade sends, push the reciever if the send is not the last one\x22\x0a\x09(aNode isCascadeSendNode and: [ aNode isLastChild not ])\x0a\x09\x09ifTrue: [ self push: receiver ]\x0a\x09\x09ifFalse: [ self push: result ]",
  34242. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"],
  34243. referencedClasses: []
  34244. }),
  34245. globals.ASTInterpreter);
  34246. smalltalk.addMethod(
  34247. smalltalk.method({
  34248. selector: "visitSequenceNode:",
  34249. protocol: 'visiting',
  34250. fn: function (aNode){
  34251. var self=this;
  34252. return smalltalk.withContext(function($ctx1) {
  34253. _st(_st(aNode)._temps())._do_((function(each){
  34254. return smalltalk.withContext(function($ctx2) {
  34255. return _st(self._context())._defineLocal_(each);
  34256. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  34257. return self}, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34258. args: ["aNode"],
  34259. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  34260. messageSends: ["do:", "temps", "defineLocal:", "context"],
  34261. referencedClasses: []
  34262. }),
  34263. globals.ASTInterpreter);
  34264. smalltalk.addMethod(
  34265. smalltalk.method({
  34266. selector: "visitValueNode:",
  34267. protocol: 'visiting',
  34268. fn: function (aNode){
  34269. var self=this;
  34270. return smalltalk.withContext(function($ctx1) {
  34271. self._push_(_st(aNode)._value());
  34272. return self}, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34273. args: ["aNode"],
  34274. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  34275. messageSends: ["push:", "value"],
  34276. referencedClasses: []
  34277. }),
  34278. globals.ASTInterpreter);
  34279. smalltalk.addMethod(
  34280. smalltalk.method({
  34281. selector: "visitVariableNode:",
  34282. protocol: 'visiting',
  34283. fn: function (aNode){
  34284. var self=this;
  34285. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  34286. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34287. return smalltalk.withContext(function($ctx1) {
  34288. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  34289. $2=_st(aNode)._binding();
  34290. $ctx1.sendIdx["binding"]=1;
  34291. $1=_st($2)._isUnknownVar();
  34292. if(smalltalk.assert($1)){
  34293. $5=_st($PlatformInterface())._globals();
  34294. $ctx1.sendIdx["globals"]=1;
  34295. $6=_st(aNode)._value();
  34296. $ctx1.sendIdx["value"]=1;
  34297. $4=_st($5)._at_ifAbsent_($6,(function(){
  34298. return smalltalk.withContext(function($ctx2) {
  34299. return self._error_("Unknown variable");
  34300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  34301. $ctx1.sendIdx["at:ifAbsent:"]=1;
  34302. $3=self._push_($4);
  34303. $ctx1.sendIdx["push:"]=1;
  34304. return $3;
  34305. };
  34306. $8=_st(_st(aNode)._binding())._isInstanceVar();
  34307. if(smalltalk.assert($8)){
  34308. $10=self._context();
  34309. $ctx1.sendIdx["context"]=1;
  34310. $9=_st($10)._receiver();
  34311. $11=_st(aNode)._value();
  34312. $ctx1.sendIdx["value"]=2;
  34313. $7=_st($9)._instVarAt_($11);
  34314. } else {
  34315. $12=self._context();
  34316. $13=_st(aNode)._value();
  34317. $ctx1.sendIdx["value"]=3;
  34318. $7=_st($12)._localAt_ifAbsent_($13,(function(){
  34319. return smalltalk.withContext(function($ctx2) {
  34320. $15=_st(aNode)._value();
  34321. $ctx2.sendIdx["value"]=4;
  34322. $14=_st($15)._isCapitalized();
  34323. if(smalltalk.assert($14)){
  34324. $16=_st($Smalltalk())._globals();
  34325. $ctx2.sendIdx["globals"]=2;
  34326. $17=_st(aNode)._value();
  34327. $ctx2.sendIdx["value"]=5;
  34328. return _st($16)._at_ifAbsent_($17,(function(){
  34329. return smalltalk.withContext(function($ctx3) {
  34330. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  34331. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)})}));
  34332. };
  34333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  34334. };
  34335. self._push_($7);
  34336. return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.ASTInterpreter)})},
  34337. args: ["aNode"],
  34338. source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])",
  34339. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"],
  34340. referencedClasses: ["PlatformInterface", "Smalltalk"]
  34341. }),
  34342. globals.ASTInterpreter);
  34343. smalltalk.addClass('ASTInterpreterError', globals.Error, [], 'Compiler-Interpreter');
  34344. globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  34345. smalltalk.addClass('ASTPCNodeVisitor', globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  34346. globals.ASTPCNodeVisitor.comment="I visit an AST until I get to the current node for the `context` and answer it.\x0a\x0a## API\x0a\x0aMy instances must be filled with a context object using `#context:`.\x0a\x0aAfter visiting the AST the current node is answered by `#currentNode`";
  34347. smalltalk.addMethod(
  34348. smalltalk.method({
  34349. selector: "context",
  34350. protocol: 'accessing',
  34351. fn: function (){
  34352. var self=this;
  34353. var $1;
  34354. $1=self["@context"];
  34355. return $1;
  34356. },
  34357. args: [],
  34358. source: "context\x0a\x09^ context",
  34359. messageSends: [],
  34360. referencedClasses: []
  34361. }),
  34362. globals.ASTPCNodeVisitor);
  34363. smalltalk.addMethod(
  34364. smalltalk.method({
  34365. selector: "context:",
  34366. protocol: 'accessing',
  34367. fn: function (aContext){
  34368. var self=this;
  34369. self["@context"]=aContext;
  34370. return self},
  34371. args: ["aContext"],
  34372. source: "context: aContext\x0a\x09context := aContext",
  34373. messageSends: [],
  34374. referencedClasses: []
  34375. }),
  34376. globals.ASTPCNodeVisitor);
  34377. smalltalk.addMethod(
  34378. smalltalk.method({
  34379. selector: "currentNode",
  34380. protocol: 'accessing',
  34381. fn: function (){
  34382. var self=this;
  34383. var $1;
  34384. $1=self["@currentNode"];
  34385. return $1;
  34386. },
  34387. args: [],
  34388. source: "currentNode\x0a\x09^ currentNode",
  34389. messageSends: [],
  34390. referencedClasses: []
  34391. }),
  34392. globals.ASTPCNodeVisitor);
  34393. smalltalk.addMethod(
  34394. smalltalk.method({
  34395. selector: "increaseIndex",
  34396. protocol: 'accessing',
  34397. fn: function (){
  34398. var self=this;
  34399. return smalltalk.withContext(function($ctx1) {
  34400. self["@index"]=_st(self._index()).__plus((1));
  34401. return self}, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},globals.ASTPCNodeVisitor)})},
  34402. args: [],
  34403. source: "increaseIndex\x0a\x09index := self index + 1",
  34404. messageSends: ["+", "index"],
  34405. referencedClasses: []
  34406. }),
  34407. globals.ASTPCNodeVisitor);
  34408. smalltalk.addMethod(
  34409. smalltalk.method({
  34410. selector: "index",
  34411. protocol: 'accessing',
  34412. fn: function (){
  34413. var self=this;
  34414. return smalltalk.withContext(function($ctx1) {
  34415. var $2,$1,$receiver;
  34416. $2=self["@index"];
  34417. if(($receiver = $2) == null || $receiver.isNil){
  34418. self["@index"]=(0);
  34419. $1=self["@index"];
  34420. } else {
  34421. $1=$2;
  34422. };
  34423. return $1;
  34424. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.ASTPCNodeVisitor)})},
  34425. args: [],
  34426. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  34427. messageSends: ["ifNil:"],
  34428. referencedClasses: []
  34429. }),
  34430. globals.ASTPCNodeVisitor);
  34431. smalltalk.addMethod(
  34432. smalltalk.method({
  34433. selector: "selector",
  34434. protocol: 'accessing',
  34435. fn: function (){
  34436. var self=this;
  34437. var $1;
  34438. $1=self["@selector"];
  34439. return $1;
  34440. },
  34441. args: [],
  34442. source: "selector\x0a\x09^ selector",
  34443. messageSends: [],
  34444. referencedClasses: []
  34445. }),
  34446. globals.ASTPCNodeVisitor);
  34447. smalltalk.addMethod(
  34448. smalltalk.method({
  34449. selector: "selector:",
  34450. protocol: 'accessing',
  34451. fn: function (aString){
  34452. var self=this;
  34453. self["@selector"]=aString;
  34454. return self},
  34455. args: ["aString"],
  34456. source: "selector: aString\x0a\x09selector := aString",
  34457. messageSends: [],
  34458. referencedClasses: []
  34459. }),
  34460. globals.ASTPCNodeVisitor);
  34461. smalltalk.addMethod(
  34462. smalltalk.method({
  34463. selector: "visitJSStatementNode:",
  34464. protocol: 'visiting',
  34465. fn: function (aNode){
  34466. var self=this;
  34467. self["@currentNode"]=aNode;
  34468. return self},
  34469. args: ["aNode"],
  34470. source: "visitJSStatementNode: aNode\x0a\x09\x22If a JSStatementNode is encountered, it always is the current node.\x0a\x09Stop visiting the AST there\x22\x0a\x09\x0a\x09currentNode := aNode",
  34471. messageSends: [],
  34472. referencedClasses: []
  34473. }),
  34474. globals.ASTPCNodeVisitor);
  34475. smalltalk.addMethod(
  34476. smalltalk.method({
  34477. selector: "visitSendNode:",
  34478. protocol: 'visiting',
  34479. fn: function (aNode){
  34480. var self=this;
  34481. var sendIndex;
  34482. return smalltalk.withContext(function($ctx1) {
  34483. var $1,$2,$4,$3,$5;
  34484. $1=self._context();
  34485. $2=self._selector();
  34486. $ctx1.sendIdx["selector"]=1;
  34487. sendIndex=_st($1)._sendIndexAt_($2);
  34488. ($ctx1.supercall = true, globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  34489. $ctx1.supercall = false;
  34490. $4=self._selector();
  34491. $ctx1.sendIdx["selector"]=2;
  34492. $3=_st($4).__eq(_st(aNode)._selector());
  34493. $ctx1.sendIdx["="]=1;
  34494. if(smalltalk.assert($3)){
  34495. $5=_st(self._index()).__eq(sendIndex);
  34496. if(smalltalk.assert($5)){
  34497. self["@currentNode"]=aNode;
  34498. self["@currentNode"];
  34499. };
  34500. self._increaseIndex();
  34501. };
  34502. return self}, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},globals.ASTPCNodeVisitor)})},
  34503. args: ["aNode"],
  34504. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  34505. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"],
  34506. referencedClasses: []
  34507. }),
  34508. globals.ASTPCNodeVisitor);
  34509. smalltalk.addMethod(
  34510. smalltalk.method({
  34511. selector: "isSteppingNode",
  34512. protocol: '*Compiler-Interpreter',
  34513. fn: function (){
  34514. var self=this;
  34515. return true;
  34516. },
  34517. args: [],
  34518. source: "isSteppingNode\x0a\x09^ true",
  34519. messageSends: [],
  34520. referencedClasses: []
  34521. }),
  34522. globals.AssignmentNode);
  34523. smalltalk.addMethod(
  34524. smalltalk.method({
  34525. selector: "isSteppingNode",
  34526. protocol: '*Compiler-Interpreter',
  34527. fn: function (){
  34528. var self=this;
  34529. return true;
  34530. },
  34531. args: [],
  34532. source: "isSteppingNode\x0a\x09^ true",
  34533. messageSends: [],
  34534. referencedClasses: []
  34535. }),
  34536. globals.BlockNode);
  34537. smalltalk.addMethod(
  34538. smalltalk.method({
  34539. selector: "isSteppingNode",
  34540. protocol: '*Compiler-Interpreter',
  34541. fn: function (){
  34542. var self=this;
  34543. return true;
  34544. },
  34545. args: [],
  34546. source: "isSteppingNode\x0a\x09^ true",
  34547. messageSends: [],
  34548. referencedClasses: []
  34549. }),
  34550. globals.DynamicArrayNode);
  34551. smalltalk.addMethod(
  34552. smalltalk.method({
  34553. selector: "isSteppingNode",
  34554. protocol: '*Compiler-Interpreter',
  34555. fn: function (){
  34556. var self=this;
  34557. return true;
  34558. },
  34559. args: [],
  34560. source: "isSteppingNode\x0a\x09^ true",
  34561. messageSends: [],
  34562. referencedClasses: []
  34563. }),
  34564. globals.DynamicDictionaryNode);
  34565. smalltalk.addMethod(
  34566. smalltalk.method({
  34567. selector: "isSteppingNode",
  34568. protocol: '*Compiler-Interpreter',
  34569. fn: function (){
  34570. var self=this;
  34571. return true;
  34572. },
  34573. args: [],
  34574. source: "isSteppingNode\x0a\x09^ true",
  34575. messageSends: [],
  34576. referencedClasses: []
  34577. }),
  34578. globals.JSStatementNode);
  34579. smalltalk.addMethod(
  34580. smalltalk.method({
  34581. selector: "isSteppingNode",
  34582. protocol: '*Compiler-Interpreter',
  34583. fn: function (){
  34584. var self=this;
  34585. return false;
  34586. },
  34587. args: [],
  34588. source: "isSteppingNode\x0a\x09^ false",
  34589. messageSends: [],
  34590. referencedClasses: []
  34591. }),
  34592. globals.Node);
  34593. smalltalk.addMethod(
  34594. smalltalk.method({
  34595. selector: "isSteppingNode",
  34596. protocol: '*Compiler-Interpreter',
  34597. fn: function (){
  34598. var self=this;
  34599. return true;
  34600. },
  34601. args: [],
  34602. source: "isSteppingNode\x0a\x09^ true",
  34603. messageSends: [],
  34604. referencedClasses: []
  34605. }),
  34606. globals.SendNode);
  34607. });
  34608. define("amber/parser", ["./boot"], function(boot) {
  34609. var globals = boot.globals, nil = boot.nil;
  34610. globals.SmalltalkParser = (function() {
  34611. /*
  34612. * Generated by PEG.js 0.8.0.
  34613. *
  34614. * http://pegjs.majda.cz/
  34615. */
  34616. function peg$subclass(child, parent) {
  34617. function ctor() { this.constructor = child; }
  34618. ctor.prototype = parent.prototype;
  34619. child.prototype = new ctor();
  34620. }
  34621. function SyntaxError(message, expected, found, offset, line, column) {
  34622. this.message = message;
  34623. this.expected = expected;
  34624. this.found = found;
  34625. this.offset = offset;
  34626. this.line = line;
  34627. this.column = column;
  34628. this.name = "SyntaxError";
  34629. }
  34630. peg$subclass(SyntaxError, Error);
  34631. function parse(input) {
  34632. var options = arguments.length > 1 ? arguments[1] : {},
  34633. peg$FAILED = {},
  34634. peg$startRuleFunctions = { start: peg$parsestart },
  34635. peg$startRuleFunction = peg$parsestart,
  34636. peg$c0 = [],
  34637. peg$c1 = peg$FAILED,
  34638. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  34639. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  34640. peg$c4 = /^["]/,
  34641. peg$c5 = { type: "class", value: "[\"]", description: "[\"]" },
  34642. peg$c6 = /^[^"]/,
  34643. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  34644. peg$c8 = /^[a-zA-Z]/,
  34645. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  34646. peg$c10 = /^[a-zA-Z0-9]/,
  34647. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  34648. peg$c12 = function(first, others) {return first + others.join("");},
  34649. peg$c13 = /^[:]/,
  34650. peg$c14 = { type: "class", value: "[:]", description: "[:]" },
  34651. peg$c15 = function(first, last) {return first + last;},
  34652. peg$c16 = /^[a-zA-Z0-9:]/,
  34653. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  34654. peg$c18 = /^[A-Z]/,
  34655. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  34656. peg$c20 = /^[']/,
  34657. peg$c21 = { type: "class", value: "[']", description: "[']" },
  34658. peg$c22 = "''",
  34659. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  34660. peg$c24 = function() {return "'";},
  34661. peg$c25 = /^[^']/,
  34662. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  34663. peg$c27 = function(val) {
  34664. return globals.ValueNode._new()
  34665. ._position_((line()).__at(column()))
  34666. ._source_(text())
  34667. ._value_(val.join("").replace(/\"/ig, '"'));
  34668. },
  34669. peg$c28 = "$",
  34670. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  34671. peg$c30 = { type: "any", description: "any character" },
  34672. peg$c31 = function(char) {
  34673. return globals.ValueNode._new()
  34674. ._position_((line()).__at(column()))
  34675. ._source_(text())
  34676. ._value_(char);
  34677. },
  34678. peg$c32 = "#",
  34679. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  34680. peg$c34 = function(rest) {return rest;},
  34681. peg$c35 = function(node) {return node._value();},
  34682. peg$c36 = function(val) {
  34683. return globals.ValueNode._new()
  34684. ._position_((line()).__at(column()))
  34685. ._source_(text())
  34686. ._value_(val);
  34687. },
  34688. peg$c37 = function(n) {
  34689. return globals.ValueNode._new()
  34690. ._position_((line()).__at(column()))
  34691. ._source_(text())
  34692. ._value_(n);
  34693. },
  34694. peg$c38 = "e",
  34695. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  34696. peg$c40 = function(n) {return parseFloat(n.join(""));},
  34697. peg$c41 = null,
  34698. peg$c42 = /^[\-]/,
  34699. peg$c43 = { type: "class", value: "[\\-]", description: "[\\-]" },
  34700. peg$c44 = "16r",
  34701. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  34702. peg$c46 = /^[0-9a-fA-F]/,
  34703. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  34704. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  34705. peg$c49 = /^[0-9]/,
  34706. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  34707. peg$c51 = ".",
  34708. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  34709. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  34710. peg$c54 = function(neg, digits) {return (parseInt((neg || '') +digits.join(""), 10));},
  34711. peg$c55 = "#(",
  34712. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  34713. peg$c57 = "(",
  34714. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  34715. peg$c59 = function(lit) {return lit._value();},
  34716. peg$c60 = ")",
  34717. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  34718. peg$c62 = function(lits) {
  34719. return globals.ValueNode._new()
  34720. ._position_((line()).__at(column()))
  34721. ._source_(text())
  34722. ._value_(lits);
  34723. },
  34724. peg$c63 = "{",
  34725. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  34726. peg$c65 = "}",
  34727. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  34728. peg$c67 = function(expressions) {
  34729. return globals.DynamicArrayNode._new()
  34730. ._position_((line()).__at(column()))
  34731. ._source_(text())
  34732. ._nodes_(expressions || []);
  34733. },
  34734. peg$c68 = "#{",
  34735. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  34736. peg$c70 = function(expressions) {
  34737. return globals.DynamicDictionaryNode._new()
  34738. ._position_((line()).__at(column()))
  34739. ._source_(text())
  34740. ._nodes_(expressions || []);
  34741. },
  34742. peg$c71 = "true",
  34743. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  34744. peg$c73 = function() {return true;},
  34745. peg$c74 = "false",
  34746. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  34747. peg$c76 = function() {return false;},
  34748. peg$c77 = "nil",
  34749. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  34750. peg$c79 = function() {return nil;},
  34751. peg$c80 = function(val) {
  34752. return globals.ValueNode._new()
  34753. ._position_((line()).__at(column()))
  34754. ._source_(text())
  34755. ._value_(val);
  34756. },
  34757. peg$c81 = function(identifier) {
  34758. return globals.VariableNode._new()
  34759. ._position_((line()).__at(column()))
  34760. ._source_(text())
  34761. ._value_(identifier);
  34762. },
  34763. peg$c82 = function(key, arg) {return {key:key, arg: arg};},
  34764. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  34765. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  34766. peg$c85 = function(bin) {return bin.join("");},
  34767. peg$c86 = function(pairs) {
  34768. var keywords = [];
  34769. var params = [];
  34770. var i = 0;
  34771. for(i = 0; i < pairs.length; i++){
  34772. keywords.push(pairs[i].key);
  34773. }
  34774. for(i = 0; i < pairs.length; i++){
  34775. params.push(pairs[i].arg);
  34776. }
  34777. return [keywords.join(""), params];
  34778. },
  34779. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  34780. peg$c88 = function(selector) {return [selector, []];},
  34781. peg$c89 = function(expression) {return expression;},
  34782. peg$c90 = function(first, others) { return [first].concat(others); },
  34783. peg$c91 = ":=",
  34784. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  34785. peg$c93 = function(variable, expression) {
  34786. return globals.AssignmentNode._new()
  34787. ._position_((line()).__at(column()))
  34788. ._source_(text())
  34789. ._left_(variable)
  34790. ._right_(expression);
  34791. },
  34792. peg$c94 = "^",
  34793. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  34794. peg$c96 = function(expression) {
  34795. return globals.ReturnNode._new()
  34796. ._position_((line()).__at(column()))
  34797. ._source_(text())
  34798. ._nodes_([expression]);
  34799. },
  34800. peg$c97 = "|",
  34801. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  34802. peg$c99 = function(variable) {return variable;},
  34803. peg$c100 = function(vars) {return vars;},
  34804. peg$c101 = ":",
  34805. peg$c102 = { type: "literal", value: ":", description: "\":\"" },
  34806. peg$c103 = function(param) {return param;},
  34807. peg$c104 = function(params) {return params;},
  34808. peg$c105 = /^[.]/,
  34809. peg$c106 = { type: "class", value: "[.]", description: "[.]" },
  34810. peg$c107 = function(ret) {return [ret];},
  34811. peg$c108 = function(exps, ret) {
  34812. var expressions = exps;
  34813. expressions.push(ret);
  34814. return expressions;
  34815. },
  34816. peg$c109 = function(expressions) {
  34817. return expressions || [];
  34818. },
  34819. peg$c110 = function(temps, statements) {
  34820. return globals.SequenceNode._new()
  34821. ._position_((line()).__at(column()))
  34822. ._source_(text())
  34823. ._temps_(temps || [])
  34824. ._nodes_(statements || []);
  34825. },
  34826. peg$c111 = "[",
  34827. peg$c112 = { type: "literal", value: "[", description: "\"[\"" },
  34828. peg$c113 = "]",
  34829. peg$c114 = { type: "literal", value: "]", description: "\"]\"" },
  34830. peg$c115 = function(params, sequence) {
  34831. return globals.BlockNode._new()
  34832. ._position_((line()).__at(column()))
  34833. ._source_(text())
  34834. ._parameters_(params || [])
  34835. ._nodes_([sequence._asBlockSequenceNode()]);
  34836. },
  34837. peg$c116 = void 0,
  34838. peg$c117 = function(selector) {
  34839. return globals.SendNode._new()
  34840. ._position_((line()).__at(column()))
  34841. ._source_(text())
  34842. ._selector_(selector);
  34843. },
  34844. peg$c118 = function(message, tail) {
  34845. if(tail) {
  34846. return tail._valueForReceiver_(message);
  34847. }
  34848. else {
  34849. return message;
  34850. }
  34851. },
  34852. peg$c119 = function(receiver, tail) {
  34853. if(tail) {
  34854. return tail._valueForReceiver_(receiver);
  34855. }
  34856. else {
  34857. return receiver;
  34858. }
  34859. },
  34860. peg$c120 = function(selector, arg) {
  34861. return globals.SendNode._new()
  34862. ._position_((line()).__at(column()))
  34863. ._source_(text())
  34864. ._selector_(selector)
  34865. ._arguments_([arg]);
  34866. },
  34867. peg$c121 = function(message, tail) {
  34868. if(tail) {
  34869. return tail._valueForReceiver_(message);
  34870. }
  34871. else {
  34872. return message;
  34873. }
  34874. },
  34875. peg$c122 = function(pair) {return pair;},
  34876. peg$c123 = function(pairs) {
  34877. var selector = [];
  34878. var args = [];
  34879. for(var i = 0; i < pairs.length; i++) {
  34880. selector.push(pairs[i].key);
  34881. args.push(pairs[i].arg);
  34882. }
  34883. return globals.SendNode._new()
  34884. ._position_((line()).__at(column()))
  34885. ._source_(text())
  34886. ._selector_(selector.join(""))
  34887. ._arguments_(args);
  34888. },
  34889. peg$c124 = function(receiver, tail) {
  34890. return tail._valueForReceiver_(receiver);
  34891. },
  34892. peg$c125 = ";",
  34893. peg$c126 = { type: "literal", value: ";", description: "\";\"" },
  34894. peg$c127 = function(mess) {return mess;},
  34895. peg$c128 = function(send, messages) {
  34896. var cascade = [];
  34897. cascade.push(send);
  34898. for(var i = 0; i < messages.length; i++) {
  34899. cascade.push(messages[i]);
  34900. }
  34901. return globals.CascadeNode._new()
  34902. ._position_((line()).__at(column()))
  34903. ._source_(text())
  34904. ._receiver_(send._receiver())
  34905. ._nodes_(cascade);
  34906. },
  34907. peg$c129 = "<",
  34908. peg$c130 = { type: "literal", value: "<", description: "\"<\"" },
  34909. peg$c131 = ">>",
  34910. peg$c132 = { type: "literal", value: ">>", description: "\">>\"" },
  34911. peg$c133 = function() {return ">";},
  34912. peg$c134 = /^[^>]/,
  34913. peg$c135 = { type: "class", value: "[^>]", description: "[^>]" },
  34914. peg$c136 = ">",
  34915. peg$c137 = { type: "literal", value: ">", description: "\">\"" },
  34916. peg$c138 = function(val) {
  34917. return globals.JSStatementNode._new()
  34918. ._position_((line()).__at(column()))
  34919. ._source_(val.join(""))
  34920. },
  34921. peg$c139 = function(pattern, sequence) {
  34922. return globals.MethodNode._new()
  34923. ._position_((line()).__at(column()))
  34924. ._source_(text())
  34925. ._selector_(pattern[0])
  34926. ._arguments_(pattern[1])
  34927. ._nodes_([sequence]);
  34928. },
  34929. peg$c140 = function(send) { return send._selector() === "->" },
  34930. peg$c141 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  34931. peg$c142 = function(first, others) { return first.concat.apply(first, others); },
  34932. peg$currPos = 0,
  34933. peg$reportedPos = 0,
  34934. peg$cachedPos = 0,
  34935. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  34936. peg$maxFailPos = 0,
  34937. peg$maxFailExpected = [],
  34938. peg$silentFails = 0,
  34939. peg$cache = {},
  34940. peg$result;
  34941. if ("startRule" in options) {
  34942. if (!(options.startRule in peg$startRuleFunctions)) {
  34943. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  34944. }
  34945. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  34946. }
  34947. function text() {
  34948. return input.substring(peg$reportedPos, peg$currPos);
  34949. }
  34950. function offset() {
  34951. return peg$reportedPos;
  34952. }
  34953. function line() {
  34954. return peg$computePosDetails(peg$reportedPos).line;
  34955. }
  34956. function column() {
  34957. return peg$computePosDetails(peg$reportedPos).column;
  34958. }
  34959. function expected(description) {
  34960. throw peg$buildException(
  34961. null,
  34962. [{ type: "other", description: description }],
  34963. peg$reportedPos
  34964. );
  34965. }
  34966. function error(message) {
  34967. throw peg$buildException(message, null, peg$reportedPos);
  34968. }
  34969. function peg$computePosDetails(pos) {
  34970. function advance(details, startPos, endPos) {
  34971. var p, ch;
  34972. for (p = startPos; p < endPos; p++) {
  34973. ch = input.charAt(p);
  34974. if (ch === "\n") {
  34975. if (!details.seenCR) { details.line++; }
  34976. details.column = 1;
  34977. details.seenCR = false;
  34978. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  34979. details.line++;
  34980. details.column = 1;
  34981. details.seenCR = true;
  34982. } else {
  34983. details.column++;
  34984. details.seenCR = false;
  34985. }
  34986. }
  34987. }
  34988. if (peg$cachedPos !== pos) {
  34989. if (peg$cachedPos > pos) {
  34990. peg$cachedPos = 0;
  34991. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  34992. }
  34993. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  34994. peg$cachedPos = pos;
  34995. }
  34996. return peg$cachedPosDetails;
  34997. }
  34998. function peg$fail(expected) {
  34999. if (peg$currPos < peg$maxFailPos) { return; }
  35000. if (peg$currPos > peg$maxFailPos) {
  35001. peg$maxFailPos = peg$currPos;
  35002. peg$maxFailExpected = [];
  35003. }
  35004. peg$maxFailExpected.push(expected);
  35005. }
  35006. function peg$buildException(message, expected, pos) {
  35007. function cleanupExpected(expected) {
  35008. var i = 1;
  35009. expected.sort(function(a, b) {
  35010. if (a.description < b.description) {
  35011. return -1;
  35012. } else if (a.description > b.description) {
  35013. return 1;
  35014. } else {
  35015. return 0;
  35016. }
  35017. });
  35018. while (i < expected.length) {
  35019. if (expected[i - 1] === expected[i]) {
  35020. expected.splice(i, 1);
  35021. } else {
  35022. i++;
  35023. }
  35024. }
  35025. }
  35026. function buildMessage(expected, found) {
  35027. function stringEscape(s) {
  35028. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  35029. return s
  35030. .replace(/\\/g, '\\\\')
  35031. .replace(/"/g, '\\"')
  35032. .replace(/\x08/g, '\\b')
  35033. .replace(/\t/g, '\\t')
  35034. .replace(/\n/g, '\\n')
  35035. .replace(/\f/g, '\\f')
  35036. .replace(/\r/g, '\\r')
  35037. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  35038. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  35039. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  35040. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  35041. }
  35042. var expectedDescs = new Array(expected.length),
  35043. expectedDesc, foundDesc, i;
  35044. for (i = 0; i < expected.length; i++) {
  35045. expectedDescs[i] = expected[i].description;
  35046. }
  35047. expectedDesc = expected.length > 1
  35048. ? expectedDescs.slice(0, -1).join(", ")
  35049. + " or "
  35050. + expectedDescs[expected.length - 1]
  35051. : expectedDescs[0];
  35052. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  35053. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  35054. }
  35055. var posDetails = peg$computePosDetails(pos),
  35056. found = pos < input.length ? input.charAt(pos) : null;
  35057. if (expected !== null) {
  35058. cleanupExpected(expected);
  35059. }
  35060. return new SyntaxError(
  35061. message !== null ? message : buildMessage(expected, found),
  35062. expected,
  35063. found,
  35064. pos,
  35065. posDetails.line,
  35066. posDetails.column
  35067. );
  35068. }
  35069. function peg$parsestart() {
  35070. var s0;
  35071. var key = peg$currPos * 60 + 0,
  35072. cached = peg$cache[key];
  35073. if (cached) {
  35074. peg$currPos = cached.nextPos;
  35075. return cached.result;
  35076. }
  35077. s0 = peg$parsemethod();
  35078. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35079. return s0;
  35080. }
  35081. function peg$parseseparator() {
  35082. var s0, s1;
  35083. var key = peg$currPos * 60 + 1,
  35084. cached = peg$cache[key];
  35085. if (cached) {
  35086. peg$currPos = cached.nextPos;
  35087. return cached.result;
  35088. }
  35089. s0 = [];
  35090. if (peg$c2.test(input.charAt(peg$currPos))) {
  35091. s1 = input.charAt(peg$currPos);
  35092. peg$currPos++;
  35093. } else {
  35094. s1 = peg$FAILED;
  35095. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  35096. }
  35097. if (s1 !== peg$FAILED) {
  35098. while (s1 !== peg$FAILED) {
  35099. s0.push(s1);
  35100. if (peg$c2.test(input.charAt(peg$currPos))) {
  35101. s1 = input.charAt(peg$currPos);
  35102. peg$currPos++;
  35103. } else {
  35104. s1 = peg$FAILED;
  35105. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  35106. }
  35107. }
  35108. } else {
  35109. s0 = peg$c1;
  35110. }
  35111. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35112. return s0;
  35113. }
  35114. function peg$parsecomments() {
  35115. var s0, s1, s2, s3, s4;
  35116. var key = peg$currPos * 60 + 2,
  35117. cached = peg$cache[key];
  35118. if (cached) {
  35119. peg$currPos = cached.nextPos;
  35120. return cached.result;
  35121. }
  35122. s0 = [];
  35123. s1 = peg$currPos;
  35124. if (peg$c4.test(input.charAt(peg$currPos))) {
  35125. s2 = input.charAt(peg$currPos);
  35126. peg$currPos++;
  35127. } else {
  35128. s2 = peg$FAILED;
  35129. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  35130. }
  35131. if (s2 !== peg$FAILED) {
  35132. s3 = [];
  35133. if (peg$c6.test(input.charAt(peg$currPos))) {
  35134. s4 = input.charAt(peg$currPos);
  35135. peg$currPos++;
  35136. } else {
  35137. s4 = peg$FAILED;
  35138. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  35139. }
  35140. while (s4 !== peg$FAILED) {
  35141. s3.push(s4);
  35142. if (peg$c6.test(input.charAt(peg$currPos))) {
  35143. s4 = input.charAt(peg$currPos);
  35144. peg$currPos++;
  35145. } else {
  35146. s4 = peg$FAILED;
  35147. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  35148. }
  35149. }
  35150. if (s3 !== peg$FAILED) {
  35151. if (peg$c4.test(input.charAt(peg$currPos))) {
  35152. s4 = input.charAt(peg$currPos);
  35153. peg$currPos++;
  35154. } else {
  35155. s4 = peg$FAILED;
  35156. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  35157. }
  35158. if (s4 !== peg$FAILED) {
  35159. s2 = [s2, s3, s4];
  35160. s1 = s2;
  35161. } else {
  35162. peg$currPos = s1;
  35163. s1 = peg$c1;
  35164. }
  35165. } else {
  35166. peg$currPos = s1;
  35167. s1 = peg$c1;
  35168. }
  35169. } else {
  35170. peg$currPos = s1;
  35171. s1 = peg$c1;
  35172. }
  35173. if (s1 !== peg$FAILED) {
  35174. while (s1 !== peg$FAILED) {
  35175. s0.push(s1);
  35176. s1 = peg$currPos;
  35177. if (peg$c4.test(input.charAt(peg$currPos))) {
  35178. s2 = input.charAt(peg$currPos);
  35179. peg$currPos++;
  35180. } else {
  35181. s2 = peg$FAILED;
  35182. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  35183. }
  35184. if (s2 !== peg$FAILED) {
  35185. s3 = [];
  35186. if (peg$c6.test(input.charAt(peg$currPos))) {
  35187. s4 = input.charAt(peg$currPos);
  35188. peg$currPos++;
  35189. } else {
  35190. s4 = peg$FAILED;
  35191. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  35192. }
  35193. while (s4 !== peg$FAILED) {
  35194. s3.push(s4);
  35195. if (peg$c6.test(input.charAt(peg$currPos))) {
  35196. s4 = input.charAt(peg$currPos);
  35197. peg$currPos++;
  35198. } else {
  35199. s4 = peg$FAILED;
  35200. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  35201. }
  35202. }
  35203. if (s3 !== peg$FAILED) {
  35204. if (peg$c4.test(input.charAt(peg$currPos))) {
  35205. s4 = input.charAt(peg$currPos);
  35206. peg$currPos++;
  35207. } else {
  35208. s4 = peg$FAILED;
  35209. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  35210. }
  35211. if (s4 !== peg$FAILED) {
  35212. s2 = [s2, s3, s4];
  35213. s1 = s2;
  35214. } else {
  35215. peg$currPos = s1;
  35216. s1 = peg$c1;
  35217. }
  35218. } else {
  35219. peg$currPos = s1;
  35220. s1 = peg$c1;
  35221. }
  35222. } else {
  35223. peg$currPos = s1;
  35224. s1 = peg$c1;
  35225. }
  35226. }
  35227. } else {
  35228. s0 = peg$c1;
  35229. }
  35230. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35231. return s0;
  35232. }
  35233. function peg$parsews() {
  35234. var s0, s1;
  35235. var key = peg$currPos * 60 + 3,
  35236. cached = peg$cache[key];
  35237. if (cached) {
  35238. peg$currPos = cached.nextPos;
  35239. return cached.result;
  35240. }
  35241. s0 = [];
  35242. s1 = peg$parseseparator();
  35243. if (s1 === peg$FAILED) {
  35244. s1 = peg$parsecomments();
  35245. }
  35246. while (s1 !== peg$FAILED) {
  35247. s0.push(s1);
  35248. s1 = peg$parseseparator();
  35249. if (s1 === peg$FAILED) {
  35250. s1 = peg$parsecomments();
  35251. }
  35252. }
  35253. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35254. return s0;
  35255. }
  35256. function peg$parseidentifier() {
  35257. var s0, s1, s2, s3;
  35258. var key = peg$currPos * 60 + 4,
  35259. cached = peg$cache[key];
  35260. if (cached) {
  35261. peg$currPos = cached.nextPos;
  35262. return cached.result;
  35263. }
  35264. s0 = peg$currPos;
  35265. if (peg$c8.test(input.charAt(peg$currPos))) {
  35266. s1 = input.charAt(peg$currPos);
  35267. peg$currPos++;
  35268. } else {
  35269. s1 = peg$FAILED;
  35270. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  35271. }
  35272. if (s1 !== peg$FAILED) {
  35273. s2 = [];
  35274. if (peg$c10.test(input.charAt(peg$currPos))) {
  35275. s3 = input.charAt(peg$currPos);
  35276. peg$currPos++;
  35277. } else {
  35278. s3 = peg$FAILED;
  35279. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  35280. }
  35281. while (s3 !== peg$FAILED) {
  35282. s2.push(s3);
  35283. if (peg$c10.test(input.charAt(peg$currPos))) {
  35284. s3 = input.charAt(peg$currPos);
  35285. peg$currPos++;
  35286. } else {
  35287. s3 = peg$FAILED;
  35288. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  35289. }
  35290. }
  35291. if (s2 !== peg$FAILED) {
  35292. peg$reportedPos = s0;
  35293. s1 = peg$c12(s1, s2);
  35294. s0 = s1;
  35295. } else {
  35296. peg$currPos = s0;
  35297. s0 = peg$c1;
  35298. }
  35299. } else {
  35300. peg$currPos = s0;
  35301. s0 = peg$c1;
  35302. }
  35303. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35304. return s0;
  35305. }
  35306. function peg$parsekeyword() {
  35307. var s0, s1, s2;
  35308. var key = peg$currPos * 60 + 5,
  35309. cached = peg$cache[key];
  35310. if (cached) {
  35311. peg$currPos = cached.nextPos;
  35312. return cached.result;
  35313. }
  35314. s0 = peg$currPos;
  35315. s1 = peg$parseidentifier();
  35316. if (s1 !== peg$FAILED) {
  35317. if (peg$c13.test(input.charAt(peg$currPos))) {
  35318. s2 = input.charAt(peg$currPos);
  35319. peg$currPos++;
  35320. } else {
  35321. s2 = peg$FAILED;
  35322. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  35323. }
  35324. if (s2 !== peg$FAILED) {
  35325. peg$reportedPos = s0;
  35326. s1 = peg$c15(s1, s2);
  35327. s0 = s1;
  35328. } else {
  35329. peg$currPos = s0;
  35330. s0 = peg$c1;
  35331. }
  35332. } else {
  35333. peg$currPos = s0;
  35334. s0 = peg$c1;
  35335. }
  35336. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35337. return s0;
  35338. }
  35339. function peg$parseselector() {
  35340. var s0, s1, s2, s3;
  35341. var key = peg$currPos * 60 + 6,
  35342. cached = peg$cache[key];
  35343. if (cached) {
  35344. peg$currPos = cached.nextPos;
  35345. return cached.result;
  35346. }
  35347. s0 = peg$currPos;
  35348. if (peg$c8.test(input.charAt(peg$currPos))) {
  35349. s1 = input.charAt(peg$currPos);
  35350. peg$currPos++;
  35351. } else {
  35352. s1 = peg$FAILED;
  35353. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  35354. }
  35355. if (s1 !== peg$FAILED) {
  35356. s2 = [];
  35357. if (peg$c16.test(input.charAt(peg$currPos))) {
  35358. s3 = input.charAt(peg$currPos);
  35359. peg$currPos++;
  35360. } else {
  35361. s3 = peg$FAILED;
  35362. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  35363. }
  35364. while (s3 !== peg$FAILED) {
  35365. s2.push(s3);
  35366. if (peg$c16.test(input.charAt(peg$currPos))) {
  35367. s3 = input.charAt(peg$currPos);
  35368. peg$currPos++;
  35369. } else {
  35370. s3 = peg$FAILED;
  35371. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  35372. }
  35373. }
  35374. if (s2 !== peg$FAILED) {
  35375. peg$reportedPos = s0;
  35376. s1 = peg$c12(s1, s2);
  35377. s0 = s1;
  35378. } else {
  35379. peg$currPos = s0;
  35380. s0 = peg$c1;
  35381. }
  35382. } else {
  35383. peg$currPos = s0;
  35384. s0 = peg$c1;
  35385. }
  35386. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35387. return s0;
  35388. }
  35389. function peg$parseclassName() {
  35390. var s0, s1, s2, s3;
  35391. var key = peg$currPos * 60 + 7,
  35392. cached = peg$cache[key];
  35393. if (cached) {
  35394. peg$currPos = cached.nextPos;
  35395. return cached.result;
  35396. }
  35397. s0 = peg$currPos;
  35398. if (peg$c18.test(input.charAt(peg$currPos))) {
  35399. s1 = input.charAt(peg$currPos);
  35400. peg$currPos++;
  35401. } else {
  35402. s1 = peg$FAILED;
  35403. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  35404. }
  35405. if (s1 !== peg$FAILED) {
  35406. s2 = [];
  35407. if (peg$c10.test(input.charAt(peg$currPos))) {
  35408. s3 = input.charAt(peg$currPos);
  35409. peg$currPos++;
  35410. } else {
  35411. s3 = peg$FAILED;
  35412. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  35413. }
  35414. while (s3 !== peg$FAILED) {
  35415. s2.push(s3);
  35416. if (peg$c10.test(input.charAt(peg$currPos))) {
  35417. s3 = input.charAt(peg$currPos);
  35418. peg$currPos++;
  35419. } else {
  35420. s3 = peg$FAILED;
  35421. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  35422. }
  35423. }
  35424. if (s2 !== peg$FAILED) {
  35425. peg$reportedPos = s0;
  35426. s1 = peg$c12(s1, s2);
  35427. s0 = s1;
  35428. } else {
  35429. peg$currPos = s0;
  35430. s0 = peg$c1;
  35431. }
  35432. } else {
  35433. peg$currPos = s0;
  35434. s0 = peg$c1;
  35435. }
  35436. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35437. return s0;
  35438. }
  35439. function peg$parsestring() {
  35440. var s0, s1, s2, s3, s4;
  35441. var key = peg$currPos * 60 + 8,
  35442. cached = peg$cache[key];
  35443. if (cached) {
  35444. peg$currPos = cached.nextPos;
  35445. return cached.result;
  35446. }
  35447. s0 = peg$currPos;
  35448. if (peg$c20.test(input.charAt(peg$currPos))) {
  35449. s1 = input.charAt(peg$currPos);
  35450. peg$currPos++;
  35451. } else {
  35452. s1 = peg$FAILED;
  35453. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  35454. }
  35455. if (s1 !== peg$FAILED) {
  35456. s2 = [];
  35457. s3 = peg$currPos;
  35458. if (input.substr(peg$currPos, 2) === peg$c22) {
  35459. s4 = peg$c22;
  35460. peg$currPos += 2;
  35461. } else {
  35462. s4 = peg$FAILED;
  35463. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  35464. }
  35465. if (s4 !== peg$FAILED) {
  35466. peg$reportedPos = s3;
  35467. s4 = peg$c24();
  35468. }
  35469. s3 = s4;
  35470. if (s3 === peg$FAILED) {
  35471. if (peg$c25.test(input.charAt(peg$currPos))) {
  35472. s3 = input.charAt(peg$currPos);
  35473. peg$currPos++;
  35474. } else {
  35475. s3 = peg$FAILED;
  35476. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  35477. }
  35478. }
  35479. while (s3 !== peg$FAILED) {
  35480. s2.push(s3);
  35481. s3 = peg$currPos;
  35482. if (input.substr(peg$currPos, 2) === peg$c22) {
  35483. s4 = peg$c22;
  35484. peg$currPos += 2;
  35485. } else {
  35486. s4 = peg$FAILED;
  35487. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  35488. }
  35489. if (s4 !== peg$FAILED) {
  35490. peg$reportedPos = s3;
  35491. s4 = peg$c24();
  35492. }
  35493. s3 = s4;
  35494. if (s3 === peg$FAILED) {
  35495. if (peg$c25.test(input.charAt(peg$currPos))) {
  35496. s3 = input.charAt(peg$currPos);
  35497. peg$currPos++;
  35498. } else {
  35499. s3 = peg$FAILED;
  35500. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  35501. }
  35502. }
  35503. }
  35504. if (s2 !== peg$FAILED) {
  35505. if (peg$c20.test(input.charAt(peg$currPos))) {
  35506. s3 = input.charAt(peg$currPos);
  35507. peg$currPos++;
  35508. } else {
  35509. s3 = peg$FAILED;
  35510. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  35511. }
  35512. if (s3 !== peg$FAILED) {
  35513. peg$reportedPos = s0;
  35514. s1 = peg$c27(s2);
  35515. s0 = s1;
  35516. } else {
  35517. peg$currPos = s0;
  35518. s0 = peg$c1;
  35519. }
  35520. } else {
  35521. peg$currPos = s0;
  35522. s0 = peg$c1;
  35523. }
  35524. } else {
  35525. peg$currPos = s0;
  35526. s0 = peg$c1;
  35527. }
  35528. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35529. return s0;
  35530. }
  35531. function peg$parsecharacter() {
  35532. var s0, s1, s2;
  35533. var key = peg$currPos * 60 + 9,
  35534. cached = peg$cache[key];
  35535. if (cached) {
  35536. peg$currPos = cached.nextPos;
  35537. return cached.result;
  35538. }
  35539. s0 = peg$currPos;
  35540. if (input.charCodeAt(peg$currPos) === 36) {
  35541. s1 = peg$c28;
  35542. peg$currPos++;
  35543. } else {
  35544. s1 = peg$FAILED;
  35545. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  35546. }
  35547. if (s1 !== peg$FAILED) {
  35548. if (input.length > peg$currPos) {
  35549. s2 = input.charAt(peg$currPos);
  35550. peg$currPos++;
  35551. } else {
  35552. s2 = peg$FAILED;
  35553. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  35554. }
  35555. if (s2 !== peg$FAILED) {
  35556. peg$reportedPos = s0;
  35557. s1 = peg$c31(s2);
  35558. s0 = s1;
  35559. } else {
  35560. peg$currPos = s0;
  35561. s0 = peg$c1;
  35562. }
  35563. } else {
  35564. peg$currPos = s0;
  35565. s0 = peg$c1;
  35566. }
  35567. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35568. return s0;
  35569. }
  35570. function peg$parsesymbol() {
  35571. var s0, s1, s2;
  35572. var key = peg$currPos * 60 + 10,
  35573. cached = peg$cache[key];
  35574. if (cached) {
  35575. peg$currPos = cached.nextPos;
  35576. return cached.result;
  35577. }
  35578. s0 = peg$currPos;
  35579. if (input.charCodeAt(peg$currPos) === 35) {
  35580. s1 = peg$c32;
  35581. peg$currPos++;
  35582. } else {
  35583. s1 = peg$FAILED;
  35584. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  35585. }
  35586. if (s1 !== peg$FAILED) {
  35587. s2 = peg$parsebareSymbol();
  35588. if (s2 !== peg$FAILED) {
  35589. peg$reportedPos = s0;
  35590. s1 = peg$c34(s2);
  35591. s0 = s1;
  35592. } else {
  35593. peg$currPos = s0;
  35594. s0 = peg$c1;
  35595. }
  35596. } else {
  35597. peg$currPos = s0;
  35598. s0 = peg$c1;
  35599. }
  35600. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35601. return s0;
  35602. }
  35603. function peg$parsebareSymbol() {
  35604. var s0, s1, s2;
  35605. var key = peg$currPos * 60 + 11,
  35606. cached = peg$cache[key];
  35607. if (cached) {
  35608. peg$currPos = cached.nextPos;
  35609. return cached.result;
  35610. }
  35611. s0 = peg$currPos;
  35612. s1 = peg$parseselector();
  35613. if (s1 === peg$FAILED) {
  35614. s1 = peg$parsebinarySelector();
  35615. if (s1 === peg$FAILED) {
  35616. s1 = peg$currPos;
  35617. s2 = peg$parsestring();
  35618. if (s2 !== peg$FAILED) {
  35619. peg$reportedPos = s1;
  35620. s2 = peg$c35(s2);
  35621. }
  35622. s1 = s2;
  35623. }
  35624. }
  35625. if (s1 !== peg$FAILED) {
  35626. peg$reportedPos = s0;
  35627. s1 = peg$c36(s1);
  35628. }
  35629. s0 = s1;
  35630. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35631. return s0;
  35632. }
  35633. function peg$parsenumber() {
  35634. var s0, s1;
  35635. var key = peg$currPos * 60 + 12,
  35636. cached = peg$cache[key];
  35637. if (cached) {
  35638. peg$currPos = cached.nextPos;
  35639. return cached.result;
  35640. }
  35641. s0 = peg$currPos;
  35642. s1 = peg$parsenumberExp();
  35643. if (s1 === peg$FAILED) {
  35644. s1 = peg$parsehex();
  35645. if (s1 === peg$FAILED) {
  35646. s1 = peg$parsefloat();
  35647. if (s1 === peg$FAILED) {
  35648. s1 = peg$parseinteger();
  35649. }
  35650. }
  35651. }
  35652. if (s1 !== peg$FAILED) {
  35653. peg$reportedPos = s0;
  35654. s1 = peg$c37(s1);
  35655. }
  35656. s0 = s1;
  35657. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35658. return s0;
  35659. }
  35660. function peg$parsenumberExp() {
  35661. var s0, s1, s2, s3, s4;
  35662. var key = peg$currPos * 60 + 13,
  35663. cached = peg$cache[key];
  35664. if (cached) {
  35665. peg$currPos = cached.nextPos;
  35666. return cached.result;
  35667. }
  35668. s0 = peg$currPos;
  35669. s1 = peg$currPos;
  35670. s2 = peg$parsefloat();
  35671. if (s2 === peg$FAILED) {
  35672. s2 = peg$parseinteger();
  35673. }
  35674. if (s2 !== peg$FAILED) {
  35675. if (input.charCodeAt(peg$currPos) === 101) {
  35676. s3 = peg$c38;
  35677. peg$currPos++;
  35678. } else {
  35679. s3 = peg$FAILED;
  35680. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  35681. }
  35682. if (s3 !== peg$FAILED) {
  35683. s4 = peg$parseinteger();
  35684. if (s4 !== peg$FAILED) {
  35685. s2 = [s2, s3, s4];
  35686. s1 = s2;
  35687. } else {
  35688. peg$currPos = s1;
  35689. s1 = peg$c1;
  35690. }
  35691. } else {
  35692. peg$currPos = s1;
  35693. s1 = peg$c1;
  35694. }
  35695. } else {
  35696. peg$currPos = s1;
  35697. s1 = peg$c1;
  35698. }
  35699. if (s1 !== peg$FAILED) {
  35700. peg$reportedPos = s0;
  35701. s1 = peg$c40(s1);
  35702. }
  35703. s0 = s1;
  35704. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35705. return s0;
  35706. }
  35707. function peg$parsehex() {
  35708. var s0, s1, s2, s3, s4;
  35709. var key = peg$currPos * 60 + 14,
  35710. cached = peg$cache[key];
  35711. if (cached) {
  35712. peg$currPos = cached.nextPos;
  35713. return cached.result;
  35714. }
  35715. s0 = peg$currPos;
  35716. if (peg$c42.test(input.charAt(peg$currPos))) {
  35717. s1 = input.charAt(peg$currPos);
  35718. peg$currPos++;
  35719. } else {
  35720. s1 = peg$FAILED;
  35721. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  35722. }
  35723. if (s1 === peg$FAILED) {
  35724. s1 = peg$c41;
  35725. }
  35726. if (s1 !== peg$FAILED) {
  35727. if (input.substr(peg$currPos, 3) === peg$c44) {
  35728. s2 = peg$c44;
  35729. peg$currPos += 3;
  35730. } else {
  35731. s2 = peg$FAILED;
  35732. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  35733. }
  35734. if (s2 !== peg$FAILED) {
  35735. s3 = [];
  35736. if (peg$c46.test(input.charAt(peg$currPos))) {
  35737. s4 = input.charAt(peg$currPos);
  35738. peg$currPos++;
  35739. } else {
  35740. s4 = peg$FAILED;
  35741. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  35742. }
  35743. if (s4 !== peg$FAILED) {
  35744. while (s4 !== peg$FAILED) {
  35745. s3.push(s4);
  35746. if (peg$c46.test(input.charAt(peg$currPos))) {
  35747. s4 = input.charAt(peg$currPos);
  35748. peg$currPos++;
  35749. } else {
  35750. s4 = peg$FAILED;
  35751. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  35752. }
  35753. }
  35754. } else {
  35755. s3 = peg$c1;
  35756. }
  35757. if (s3 !== peg$FAILED) {
  35758. peg$reportedPos = s0;
  35759. s1 = peg$c48(s1, s3);
  35760. s0 = s1;
  35761. } else {
  35762. peg$currPos = s0;
  35763. s0 = peg$c1;
  35764. }
  35765. } else {
  35766. peg$currPos = s0;
  35767. s0 = peg$c1;
  35768. }
  35769. } else {
  35770. peg$currPos = s0;
  35771. s0 = peg$c1;
  35772. }
  35773. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35774. return s0;
  35775. }
  35776. function peg$parsefloat() {
  35777. var s0, s1, s2, s3, s4, s5;
  35778. var key = peg$currPos * 60 + 15,
  35779. cached = peg$cache[key];
  35780. if (cached) {
  35781. peg$currPos = cached.nextPos;
  35782. return cached.result;
  35783. }
  35784. s0 = peg$currPos;
  35785. if (peg$c42.test(input.charAt(peg$currPos))) {
  35786. s1 = input.charAt(peg$currPos);
  35787. peg$currPos++;
  35788. } else {
  35789. s1 = peg$FAILED;
  35790. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  35791. }
  35792. if (s1 === peg$FAILED) {
  35793. s1 = peg$c41;
  35794. }
  35795. if (s1 !== peg$FAILED) {
  35796. s2 = [];
  35797. if (peg$c49.test(input.charAt(peg$currPos))) {
  35798. s3 = input.charAt(peg$currPos);
  35799. peg$currPos++;
  35800. } else {
  35801. s3 = peg$FAILED;
  35802. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35803. }
  35804. if (s3 !== peg$FAILED) {
  35805. while (s3 !== peg$FAILED) {
  35806. s2.push(s3);
  35807. if (peg$c49.test(input.charAt(peg$currPos))) {
  35808. s3 = input.charAt(peg$currPos);
  35809. peg$currPos++;
  35810. } else {
  35811. s3 = peg$FAILED;
  35812. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35813. }
  35814. }
  35815. } else {
  35816. s2 = peg$c1;
  35817. }
  35818. if (s2 !== peg$FAILED) {
  35819. if (input.charCodeAt(peg$currPos) === 46) {
  35820. s3 = peg$c51;
  35821. peg$currPos++;
  35822. } else {
  35823. s3 = peg$FAILED;
  35824. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  35825. }
  35826. if (s3 !== peg$FAILED) {
  35827. s4 = [];
  35828. if (peg$c49.test(input.charAt(peg$currPos))) {
  35829. s5 = input.charAt(peg$currPos);
  35830. peg$currPos++;
  35831. } else {
  35832. s5 = peg$FAILED;
  35833. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35834. }
  35835. if (s5 !== peg$FAILED) {
  35836. while (s5 !== peg$FAILED) {
  35837. s4.push(s5);
  35838. if (peg$c49.test(input.charAt(peg$currPos))) {
  35839. s5 = input.charAt(peg$currPos);
  35840. peg$currPos++;
  35841. } else {
  35842. s5 = peg$FAILED;
  35843. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35844. }
  35845. }
  35846. } else {
  35847. s4 = peg$c1;
  35848. }
  35849. if (s4 !== peg$FAILED) {
  35850. peg$reportedPos = s0;
  35851. s1 = peg$c53(s1, s2, s4);
  35852. s0 = s1;
  35853. } else {
  35854. peg$currPos = s0;
  35855. s0 = peg$c1;
  35856. }
  35857. } else {
  35858. peg$currPos = s0;
  35859. s0 = peg$c1;
  35860. }
  35861. } else {
  35862. peg$currPos = s0;
  35863. s0 = peg$c1;
  35864. }
  35865. } else {
  35866. peg$currPos = s0;
  35867. s0 = peg$c1;
  35868. }
  35869. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35870. return s0;
  35871. }
  35872. function peg$parseinteger() {
  35873. var s0, s1, s2, s3;
  35874. var key = peg$currPos * 60 + 16,
  35875. cached = peg$cache[key];
  35876. if (cached) {
  35877. peg$currPos = cached.nextPos;
  35878. return cached.result;
  35879. }
  35880. s0 = peg$currPos;
  35881. if (peg$c42.test(input.charAt(peg$currPos))) {
  35882. s1 = input.charAt(peg$currPos);
  35883. peg$currPos++;
  35884. } else {
  35885. s1 = peg$FAILED;
  35886. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  35887. }
  35888. if (s1 === peg$FAILED) {
  35889. s1 = peg$c41;
  35890. }
  35891. if (s1 !== peg$FAILED) {
  35892. s2 = [];
  35893. if (peg$c49.test(input.charAt(peg$currPos))) {
  35894. s3 = input.charAt(peg$currPos);
  35895. peg$currPos++;
  35896. } else {
  35897. s3 = peg$FAILED;
  35898. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35899. }
  35900. if (s3 !== peg$FAILED) {
  35901. while (s3 !== peg$FAILED) {
  35902. s2.push(s3);
  35903. if (peg$c49.test(input.charAt(peg$currPos))) {
  35904. s3 = input.charAt(peg$currPos);
  35905. peg$currPos++;
  35906. } else {
  35907. s3 = peg$FAILED;
  35908. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  35909. }
  35910. }
  35911. } else {
  35912. s2 = peg$c1;
  35913. }
  35914. if (s2 !== peg$FAILED) {
  35915. peg$reportedPos = s0;
  35916. s1 = peg$c54(s1, s2);
  35917. s0 = s1;
  35918. } else {
  35919. peg$currPos = s0;
  35920. s0 = peg$c1;
  35921. }
  35922. } else {
  35923. peg$currPos = s0;
  35924. s0 = peg$c1;
  35925. }
  35926. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35927. return s0;
  35928. }
  35929. function peg$parseliteralArray() {
  35930. var s0, s1, s2;
  35931. var key = peg$currPos * 60 + 17,
  35932. cached = peg$cache[key];
  35933. if (cached) {
  35934. peg$currPos = cached.nextPos;
  35935. return cached.result;
  35936. }
  35937. s0 = peg$currPos;
  35938. if (input.substr(peg$currPos, 2) === peg$c55) {
  35939. s1 = peg$c55;
  35940. peg$currPos += 2;
  35941. } else {
  35942. s1 = peg$FAILED;
  35943. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  35944. }
  35945. if (s1 !== peg$FAILED) {
  35946. s2 = peg$parseliteralArrayRest();
  35947. if (s2 !== peg$FAILED) {
  35948. peg$reportedPos = s0;
  35949. s1 = peg$c34(s2);
  35950. s0 = s1;
  35951. } else {
  35952. peg$currPos = s0;
  35953. s0 = peg$c1;
  35954. }
  35955. } else {
  35956. peg$currPos = s0;
  35957. s0 = peg$c1;
  35958. }
  35959. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35960. return s0;
  35961. }
  35962. function peg$parsebareLiteralArray() {
  35963. var s0, s1, s2;
  35964. var key = peg$currPos * 60 + 18,
  35965. cached = peg$cache[key];
  35966. if (cached) {
  35967. peg$currPos = cached.nextPos;
  35968. return cached.result;
  35969. }
  35970. s0 = peg$currPos;
  35971. if (input.charCodeAt(peg$currPos) === 40) {
  35972. s1 = peg$c57;
  35973. peg$currPos++;
  35974. } else {
  35975. s1 = peg$FAILED;
  35976. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  35977. }
  35978. if (s1 !== peg$FAILED) {
  35979. s2 = peg$parseliteralArrayRest();
  35980. if (s2 !== peg$FAILED) {
  35981. peg$reportedPos = s0;
  35982. s1 = peg$c34(s2);
  35983. s0 = s1;
  35984. } else {
  35985. peg$currPos = s0;
  35986. s0 = peg$c1;
  35987. }
  35988. } else {
  35989. peg$currPos = s0;
  35990. s0 = peg$c1;
  35991. }
  35992. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  35993. return s0;
  35994. }
  35995. function peg$parseliteralArrayRest() {
  35996. var s0, s1, s2, s3, s4, s5;
  35997. var key = peg$currPos * 60 + 19,
  35998. cached = peg$cache[key];
  35999. if (cached) {
  36000. peg$currPos = cached.nextPos;
  36001. return cached.result;
  36002. }
  36003. s0 = peg$currPos;
  36004. s1 = peg$parsews();
  36005. if (s1 !== peg$FAILED) {
  36006. s2 = [];
  36007. s3 = peg$currPos;
  36008. s4 = peg$parseparseTimeLiteral();
  36009. if (s4 === peg$FAILED) {
  36010. s4 = peg$parsebareLiteralArray();
  36011. if (s4 === peg$FAILED) {
  36012. s4 = peg$parsebareSymbol();
  36013. }
  36014. }
  36015. if (s4 !== peg$FAILED) {
  36016. s5 = peg$parsews();
  36017. if (s5 !== peg$FAILED) {
  36018. peg$reportedPos = s3;
  36019. s4 = peg$c59(s4);
  36020. s3 = s4;
  36021. } else {
  36022. peg$currPos = s3;
  36023. s3 = peg$c1;
  36024. }
  36025. } else {
  36026. peg$currPos = s3;
  36027. s3 = peg$c1;
  36028. }
  36029. while (s3 !== peg$FAILED) {
  36030. s2.push(s3);
  36031. s3 = peg$currPos;
  36032. s4 = peg$parseparseTimeLiteral();
  36033. if (s4 === peg$FAILED) {
  36034. s4 = peg$parsebareLiteralArray();
  36035. if (s4 === peg$FAILED) {
  36036. s4 = peg$parsebareSymbol();
  36037. }
  36038. }
  36039. if (s4 !== peg$FAILED) {
  36040. s5 = peg$parsews();
  36041. if (s5 !== peg$FAILED) {
  36042. peg$reportedPos = s3;
  36043. s4 = peg$c59(s4);
  36044. s3 = s4;
  36045. } else {
  36046. peg$currPos = s3;
  36047. s3 = peg$c1;
  36048. }
  36049. } else {
  36050. peg$currPos = s3;
  36051. s3 = peg$c1;
  36052. }
  36053. }
  36054. if (s2 !== peg$FAILED) {
  36055. s3 = peg$parsews();
  36056. if (s3 !== peg$FAILED) {
  36057. if (input.charCodeAt(peg$currPos) === 41) {
  36058. s4 = peg$c60;
  36059. peg$currPos++;
  36060. } else {
  36061. s4 = peg$FAILED;
  36062. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  36063. }
  36064. if (s4 !== peg$FAILED) {
  36065. peg$reportedPos = s0;
  36066. s1 = peg$c62(s2);
  36067. s0 = s1;
  36068. } else {
  36069. peg$currPos = s0;
  36070. s0 = peg$c1;
  36071. }
  36072. } else {
  36073. peg$currPos = s0;
  36074. s0 = peg$c1;
  36075. }
  36076. } else {
  36077. peg$currPos = s0;
  36078. s0 = peg$c1;
  36079. }
  36080. } else {
  36081. peg$currPos = s0;
  36082. s0 = peg$c1;
  36083. }
  36084. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36085. return s0;
  36086. }
  36087. function peg$parsedynamicArray() {
  36088. var s0, s1, s2, s3, s4, s5, s6;
  36089. var key = peg$currPos * 60 + 20,
  36090. cached = peg$cache[key];
  36091. if (cached) {
  36092. peg$currPos = cached.nextPos;
  36093. return cached.result;
  36094. }
  36095. s0 = peg$currPos;
  36096. if (input.charCodeAt(peg$currPos) === 123) {
  36097. s1 = peg$c63;
  36098. peg$currPos++;
  36099. } else {
  36100. s1 = peg$FAILED;
  36101. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  36102. }
  36103. if (s1 !== peg$FAILED) {
  36104. s2 = peg$parsews();
  36105. if (s2 !== peg$FAILED) {
  36106. s3 = peg$parseexpressions();
  36107. if (s3 === peg$FAILED) {
  36108. s3 = peg$c41;
  36109. }
  36110. if (s3 !== peg$FAILED) {
  36111. s4 = peg$parsews();
  36112. if (s4 !== peg$FAILED) {
  36113. if (input.charCodeAt(peg$currPos) === 46) {
  36114. s5 = peg$c51;
  36115. peg$currPos++;
  36116. } else {
  36117. s5 = peg$FAILED;
  36118. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  36119. }
  36120. if (s5 === peg$FAILED) {
  36121. s5 = peg$c41;
  36122. }
  36123. if (s5 !== peg$FAILED) {
  36124. if (input.charCodeAt(peg$currPos) === 125) {
  36125. s6 = peg$c65;
  36126. peg$currPos++;
  36127. } else {
  36128. s6 = peg$FAILED;
  36129. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  36130. }
  36131. if (s6 !== peg$FAILED) {
  36132. peg$reportedPos = s0;
  36133. s1 = peg$c67(s3);
  36134. s0 = s1;
  36135. } else {
  36136. peg$currPos = s0;
  36137. s0 = peg$c1;
  36138. }
  36139. } else {
  36140. peg$currPos = s0;
  36141. s0 = peg$c1;
  36142. }
  36143. } else {
  36144. peg$currPos = s0;
  36145. s0 = peg$c1;
  36146. }
  36147. } else {
  36148. peg$currPos = s0;
  36149. s0 = peg$c1;
  36150. }
  36151. } else {
  36152. peg$currPos = s0;
  36153. s0 = peg$c1;
  36154. }
  36155. } else {
  36156. peg$currPos = s0;
  36157. s0 = peg$c1;
  36158. }
  36159. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36160. return s0;
  36161. }
  36162. function peg$parsedynamicDictionary() {
  36163. var s0, s1, s2, s3, s4, s5;
  36164. var key = peg$currPos * 60 + 21,
  36165. cached = peg$cache[key];
  36166. if (cached) {
  36167. peg$currPos = cached.nextPos;
  36168. return cached.result;
  36169. }
  36170. s0 = peg$currPos;
  36171. if (input.substr(peg$currPos, 2) === peg$c68) {
  36172. s1 = peg$c68;
  36173. peg$currPos += 2;
  36174. } else {
  36175. s1 = peg$FAILED;
  36176. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  36177. }
  36178. if (s1 !== peg$FAILED) {
  36179. s2 = peg$parsews();
  36180. if (s2 !== peg$FAILED) {
  36181. s3 = peg$parseassociations();
  36182. if (s3 === peg$FAILED) {
  36183. s3 = peg$c41;
  36184. }
  36185. if (s3 !== peg$FAILED) {
  36186. s4 = peg$parsews();
  36187. if (s4 !== peg$FAILED) {
  36188. if (input.charCodeAt(peg$currPos) === 125) {
  36189. s5 = peg$c65;
  36190. peg$currPos++;
  36191. } else {
  36192. s5 = peg$FAILED;
  36193. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  36194. }
  36195. if (s5 !== peg$FAILED) {
  36196. peg$reportedPos = s0;
  36197. s1 = peg$c70(s3);
  36198. s0 = s1;
  36199. } else {
  36200. peg$currPos = s0;
  36201. s0 = peg$c1;
  36202. }
  36203. } else {
  36204. peg$currPos = s0;
  36205. s0 = peg$c1;
  36206. }
  36207. } else {
  36208. peg$currPos = s0;
  36209. s0 = peg$c1;
  36210. }
  36211. } else {
  36212. peg$currPos = s0;
  36213. s0 = peg$c1;
  36214. }
  36215. } else {
  36216. peg$currPos = s0;
  36217. s0 = peg$c1;
  36218. }
  36219. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36220. return s0;
  36221. }
  36222. function peg$parsepseudoVariable() {
  36223. var s0, s1, s2;
  36224. var key = peg$currPos * 60 + 22,
  36225. cached = peg$cache[key];
  36226. if (cached) {
  36227. peg$currPos = cached.nextPos;
  36228. return cached.result;
  36229. }
  36230. s0 = peg$currPos;
  36231. s1 = peg$currPos;
  36232. if (input.substr(peg$currPos, 4) === peg$c71) {
  36233. s2 = peg$c71;
  36234. peg$currPos += 4;
  36235. } else {
  36236. s2 = peg$FAILED;
  36237. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  36238. }
  36239. if (s2 !== peg$FAILED) {
  36240. peg$reportedPos = s1;
  36241. s2 = peg$c73();
  36242. }
  36243. s1 = s2;
  36244. if (s1 === peg$FAILED) {
  36245. s1 = peg$currPos;
  36246. if (input.substr(peg$currPos, 5) === peg$c74) {
  36247. s2 = peg$c74;
  36248. peg$currPos += 5;
  36249. } else {
  36250. s2 = peg$FAILED;
  36251. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  36252. }
  36253. if (s2 !== peg$FAILED) {
  36254. peg$reportedPos = s1;
  36255. s2 = peg$c76();
  36256. }
  36257. s1 = s2;
  36258. if (s1 === peg$FAILED) {
  36259. s1 = peg$currPos;
  36260. if (input.substr(peg$currPos, 3) === peg$c77) {
  36261. s2 = peg$c77;
  36262. peg$currPos += 3;
  36263. } else {
  36264. s2 = peg$FAILED;
  36265. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  36266. }
  36267. if (s2 !== peg$FAILED) {
  36268. peg$reportedPos = s1;
  36269. s2 = peg$c79();
  36270. }
  36271. s1 = s2;
  36272. }
  36273. }
  36274. if (s1 !== peg$FAILED) {
  36275. peg$reportedPos = s0;
  36276. s1 = peg$c80(s1);
  36277. }
  36278. s0 = s1;
  36279. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36280. return s0;
  36281. }
  36282. function peg$parseparseTimeLiteral() {
  36283. var s0;
  36284. var key = peg$currPos * 60 + 23,
  36285. cached = peg$cache[key];
  36286. if (cached) {
  36287. peg$currPos = cached.nextPos;
  36288. return cached.result;
  36289. }
  36290. s0 = peg$parsepseudoVariable();
  36291. if (s0 === peg$FAILED) {
  36292. s0 = peg$parsenumber();
  36293. if (s0 === peg$FAILED) {
  36294. s0 = peg$parseliteralArray();
  36295. if (s0 === peg$FAILED) {
  36296. s0 = peg$parsestring();
  36297. if (s0 === peg$FAILED) {
  36298. s0 = peg$parsesymbol();
  36299. if (s0 === peg$FAILED) {
  36300. s0 = peg$parsecharacter();
  36301. }
  36302. }
  36303. }
  36304. }
  36305. }
  36306. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36307. return s0;
  36308. }
  36309. function peg$parseruntimeLiteral() {
  36310. var s0;
  36311. var key = peg$currPos * 60 + 24,
  36312. cached = peg$cache[key];
  36313. if (cached) {
  36314. peg$currPos = cached.nextPos;
  36315. return cached.result;
  36316. }
  36317. s0 = peg$parsedynamicDictionary();
  36318. if (s0 === peg$FAILED) {
  36319. s0 = peg$parsedynamicArray();
  36320. if (s0 === peg$FAILED) {
  36321. s0 = peg$parseblock();
  36322. }
  36323. }
  36324. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36325. return s0;
  36326. }
  36327. function peg$parseliteral() {
  36328. var s0;
  36329. var key = peg$currPos * 60 + 25,
  36330. cached = peg$cache[key];
  36331. if (cached) {
  36332. peg$currPos = cached.nextPos;
  36333. return cached.result;
  36334. }
  36335. s0 = peg$parseruntimeLiteral();
  36336. if (s0 === peg$FAILED) {
  36337. s0 = peg$parseparseTimeLiteral();
  36338. }
  36339. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36340. return s0;
  36341. }
  36342. function peg$parsevariable() {
  36343. var s0, s1;
  36344. var key = peg$currPos * 60 + 26,
  36345. cached = peg$cache[key];
  36346. if (cached) {
  36347. peg$currPos = cached.nextPos;
  36348. return cached.result;
  36349. }
  36350. s0 = peg$currPos;
  36351. s1 = peg$parseidentifier();
  36352. if (s1 !== peg$FAILED) {
  36353. peg$reportedPos = s0;
  36354. s1 = peg$c81(s1);
  36355. }
  36356. s0 = s1;
  36357. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36358. return s0;
  36359. }
  36360. function peg$parsekeywordPair() {
  36361. var s0, s1, s2, s3, s4;
  36362. var key = peg$currPos * 60 + 27,
  36363. cached = peg$cache[key];
  36364. if (cached) {
  36365. peg$currPos = cached.nextPos;
  36366. return cached.result;
  36367. }
  36368. s0 = peg$currPos;
  36369. s1 = peg$parsekeyword();
  36370. if (s1 !== peg$FAILED) {
  36371. s2 = peg$parsews();
  36372. if (s2 !== peg$FAILED) {
  36373. s3 = peg$parsebinarySend();
  36374. if (s3 !== peg$FAILED) {
  36375. s4 = peg$parsews();
  36376. if (s4 !== peg$FAILED) {
  36377. peg$reportedPos = s0;
  36378. s1 = peg$c82(s1, s3);
  36379. s0 = s1;
  36380. } else {
  36381. peg$currPos = s0;
  36382. s0 = peg$c1;
  36383. }
  36384. } else {
  36385. peg$currPos = s0;
  36386. s0 = peg$c1;
  36387. }
  36388. } else {
  36389. peg$currPos = s0;
  36390. s0 = peg$c1;
  36391. }
  36392. } else {
  36393. peg$currPos = s0;
  36394. s0 = peg$c1;
  36395. }
  36396. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36397. return s0;
  36398. }
  36399. function peg$parsebinarySelector() {
  36400. var s0, s1, s2;
  36401. var key = peg$currPos * 60 + 28,
  36402. cached = peg$cache[key];
  36403. if (cached) {
  36404. peg$currPos = cached.nextPos;
  36405. return cached.result;
  36406. }
  36407. s0 = peg$currPos;
  36408. s1 = [];
  36409. if (peg$c83.test(input.charAt(peg$currPos))) {
  36410. s2 = input.charAt(peg$currPos);
  36411. peg$currPos++;
  36412. } else {
  36413. s2 = peg$FAILED;
  36414. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  36415. }
  36416. if (s2 !== peg$FAILED) {
  36417. while (s2 !== peg$FAILED) {
  36418. s1.push(s2);
  36419. if (peg$c83.test(input.charAt(peg$currPos))) {
  36420. s2 = input.charAt(peg$currPos);
  36421. peg$currPos++;
  36422. } else {
  36423. s2 = peg$FAILED;
  36424. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  36425. }
  36426. }
  36427. } else {
  36428. s1 = peg$c1;
  36429. }
  36430. if (s1 !== peg$FAILED) {
  36431. peg$reportedPos = s0;
  36432. s1 = peg$c85(s1);
  36433. }
  36434. s0 = s1;
  36435. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36436. return s0;
  36437. }
  36438. function peg$parsekeywordPattern() {
  36439. var s0, s1, s2, s3, s4, s5, s6;
  36440. var key = peg$currPos * 60 + 29,
  36441. cached = peg$cache[key];
  36442. if (cached) {
  36443. peg$currPos = cached.nextPos;
  36444. return cached.result;
  36445. }
  36446. s0 = peg$currPos;
  36447. s1 = [];
  36448. s2 = peg$currPos;
  36449. s3 = peg$parsews();
  36450. if (s3 !== peg$FAILED) {
  36451. s4 = peg$parsekeyword();
  36452. if (s4 !== peg$FAILED) {
  36453. s5 = peg$parsews();
  36454. if (s5 !== peg$FAILED) {
  36455. s6 = peg$parseidentifier();
  36456. if (s6 !== peg$FAILED) {
  36457. peg$reportedPos = s2;
  36458. s3 = peg$c82(s4, s6);
  36459. s2 = s3;
  36460. } else {
  36461. peg$currPos = s2;
  36462. s2 = peg$c1;
  36463. }
  36464. } else {
  36465. peg$currPos = s2;
  36466. s2 = peg$c1;
  36467. }
  36468. } else {
  36469. peg$currPos = s2;
  36470. s2 = peg$c1;
  36471. }
  36472. } else {
  36473. peg$currPos = s2;
  36474. s2 = peg$c1;
  36475. }
  36476. if (s2 !== peg$FAILED) {
  36477. while (s2 !== peg$FAILED) {
  36478. s1.push(s2);
  36479. s2 = peg$currPos;
  36480. s3 = peg$parsews();
  36481. if (s3 !== peg$FAILED) {
  36482. s4 = peg$parsekeyword();
  36483. if (s4 !== peg$FAILED) {
  36484. s5 = peg$parsews();
  36485. if (s5 !== peg$FAILED) {
  36486. s6 = peg$parseidentifier();
  36487. if (s6 !== peg$FAILED) {
  36488. peg$reportedPos = s2;
  36489. s3 = peg$c82(s4, s6);
  36490. s2 = s3;
  36491. } else {
  36492. peg$currPos = s2;
  36493. s2 = peg$c1;
  36494. }
  36495. } else {
  36496. peg$currPos = s2;
  36497. s2 = peg$c1;
  36498. }
  36499. } else {
  36500. peg$currPos = s2;
  36501. s2 = peg$c1;
  36502. }
  36503. } else {
  36504. peg$currPos = s2;
  36505. s2 = peg$c1;
  36506. }
  36507. }
  36508. } else {
  36509. s1 = peg$c1;
  36510. }
  36511. if (s1 !== peg$FAILED) {
  36512. peg$reportedPos = s0;
  36513. s1 = peg$c86(s1);
  36514. }
  36515. s0 = s1;
  36516. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36517. return s0;
  36518. }
  36519. function peg$parsebinaryPattern() {
  36520. var s0, s1, s2, s3, s4;
  36521. var key = peg$currPos * 60 + 30,
  36522. cached = peg$cache[key];
  36523. if (cached) {
  36524. peg$currPos = cached.nextPos;
  36525. return cached.result;
  36526. }
  36527. s0 = peg$currPos;
  36528. s1 = peg$parsews();
  36529. if (s1 !== peg$FAILED) {
  36530. s2 = peg$parsebinarySelector();
  36531. if (s2 !== peg$FAILED) {
  36532. s3 = peg$parsews();
  36533. if (s3 !== peg$FAILED) {
  36534. s4 = peg$parseidentifier();
  36535. if (s4 !== peg$FAILED) {
  36536. peg$reportedPos = s0;
  36537. s1 = peg$c87(s2, s4);
  36538. s0 = s1;
  36539. } else {
  36540. peg$currPos = s0;
  36541. s0 = peg$c1;
  36542. }
  36543. } else {
  36544. peg$currPos = s0;
  36545. s0 = peg$c1;
  36546. }
  36547. } else {
  36548. peg$currPos = s0;
  36549. s0 = peg$c1;
  36550. }
  36551. } else {
  36552. peg$currPos = s0;
  36553. s0 = peg$c1;
  36554. }
  36555. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36556. return s0;
  36557. }
  36558. function peg$parseunaryPattern() {
  36559. var s0, s1, s2;
  36560. var key = peg$currPos * 60 + 31,
  36561. cached = peg$cache[key];
  36562. if (cached) {
  36563. peg$currPos = cached.nextPos;
  36564. return cached.result;
  36565. }
  36566. s0 = peg$currPos;
  36567. s1 = peg$parsews();
  36568. if (s1 !== peg$FAILED) {
  36569. s2 = peg$parseidentifier();
  36570. if (s2 !== peg$FAILED) {
  36571. peg$reportedPos = s0;
  36572. s1 = peg$c88(s2);
  36573. s0 = s1;
  36574. } else {
  36575. peg$currPos = s0;
  36576. s0 = peg$c1;
  36577. }
  36578. } else {
  36579. peg$currPos = s0;
  36580. s0 = peg$c1;
  36581. }
  36582. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36583. return s0;
  36584. }
  36585. function peg$parseexpression() {
  36586. var s0;
  36587. var key = peg$currPos * 60 + 32,
  36588. cached = peg$cache[key];
  36589. if (cached) {
  36590. peg$currPos = cached.nextPos;
  36591. return cached.result;
  36592. }
  36593. s0 = peg$parseassignment();
  36594. if (s0 === peg$FAILED) {
  36595. s0 = peg$parsecascade();
  36596. if (s0 === peg$FAILED) {
  36597. s0 = peg$parsekeywordSend();
  36598. if (s0 === peg$FAILED) {
  36599. s0 = peg$parsebinarySend();
  36600. }
  36601. }
  36602. }
  36603. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36604. return s0;
  36605. }
  36606. function peg$parseexpressionList() {
  36607. var s0, s1, s2, s3, s4;
  36608. var key = peg$currPos * 60 + 33,
  36609. cached = peg$cache[key];
  36610. if (cached) {
  36611. peg$currPos = cached.nextPos;
  36612. return cached.result;
  36613. }
  36614. s0 = peg$currPos;
  36615. s1 = peg$parsews();
  36616. if (s1 !== peg$FAILED) {
  36617. if (input.charCodeAt(peg$currPos) === 46) {
  36618. s2 = peg$c51;
  36619. peg$currPos++;
  36620. } else {
  36621. s2 = peg$FAILED;
  36622. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  36623. }
  36624. if (s2 !== peg$FAILED) {
  36625. s3 = peg$parsews();
  36626. if (s3 !== peg$FAILED) {
  36627. s4 = peg$parseexpression();
  36628. if (s4 !== peg$FAILED) {
  36629. peg$reportedPos = s0;
  36630. s1 = peg$c89(s4);
  36631. s0 = s1;
  36632. } else {
  36633. peg$currPos = s0;
  36634. s0 = peg$c1;
  36635. }
  36636. } else {
  36637. peg$currPos = s0;
  36638. s0 = peg$c1;
  36639. }
  36640. } else {
  36641. peg$currPos = s0;
  36642. s0 = peg$c1;
  36643. }
  36644. } else {
  36645. peg$currPos = s0;
  36646. s0 = peg$c1;
  36647. }
  36648. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36649. return s0;
  36650. }
  36651. function peg$parseexpressions() {
  36652. var s0, s1, s2, s3;
  36653. var key = peg$currPos * 60 + 34,
  36654. cached = peg$cache[key];
  36655. if (cached) {
  36656. peg$currPos = cached.nextPos;
  36657. return cached.result;
  36658. }
  36659. s0 = peg$currPos;
  36660. s1 = peg$parseexpression();
  36661. if (s1 !== peg$FAILED) {
  36662. s2 = [];
  36663. s3 = peg$parseexpressionList();
  36664. while (s3 !== peg$FAILED) {
  36665. s2.push(s3);
  36666. s3 = peg$parseexpressionList();
  36667. }
  36668. if (s2 !== peg$FAILED) {
  36669. peg$reportedPos = s0;
  36670. s1 = peg$c90(s1, s2);
  36671. s0 = s1;
  36672. } else {
  36673. peg$currPos = s0;
  36674. s0 = peg$c1;
  36675. }
  36676. } else {
  36677. peg$currPos = s0;
  36678. s0 = peg$c1;
  36679. }
  36680. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36681. return s0;
  36682. }
  36683. function peg$parseassignment() {
  36684. var s0, s1, s2, s3, s4, s5;
  36685. var key = peg$currPos * 60 + 35,
  36686. cached = peg$cache[key];
  36687. if (cached) {
  36688. peg$currPos = cached.nextPos;
  36689. return cached.result;
  36690. }
  36691. s0 = peg$currPos;
  36692. s1 = peg$parsevariable();
  36693. if (s1 !== peg$FAILED) {
  36694. s2 = peg$parsews();
  36695. if (s2 !== peg$FAILED) {
  36696. if (input.substr(peg$currPos, 2) === peg$c91) {
  36697. s3 = peg$c91;
  36698. peg$currPos += 2;
  36699. } else {
  36700. s3 = peg$FAILED;
  36701. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  36702. }
  36703. if (s3 !== peg$FAILED) {
  36704. s4 = peg$parsews();
  36705. if (s4 !== peg$FAILED) {
  36706. s5 = peg$parseexpression();
  36707. if (s5 !== peg$FAILED) {
  36708. peg$reportedPos = s0;
  36709. s1 = peg$c93(s1, s5);
  36710. s0 = s1;
  36711. } else {
  36712. peg$currPos = s0;
  36713. s0 = peg$c1;
  36714. }
  36715. } else {
  36716. peg$currPos = s0;
  36717. s0 = peg$c1;
  36718. }
  36719. } else {
  36720. peg$currPos = s0;
  36721. s0 = peg$c1;
  36722. }
  36723. } else {
  36724. peg$currPos = s0;
  36725. s0 = peg$c1;
  36726. }
  36727. } else {
  36728. peg$currPos = s0;
  36729. s0 = peg$c1;
  36730. }
  36731. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36732. return s0;
  36733. }
  36734. function peg$parseret() {
  36735. var s0, s1, s2, s3, s4, s5;
  36736. var key = peg$currPos * 60 + 36,
  36737. cached = peg$cache[key];
  36738. if (cached) {
  36739. peg$currPos = cached.nextPos;
  36740. return cached.result;
  36741. }
  36742. s0 = peg$currPos;
  36743. if (input.charCodeAt(peg$currPos) === 94) {
  36744. s1 = peg$c94;
  36745. peg$currPos++;
  36746. } else {
  36747. s1 = peg$FAILED;
  36748. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  36749. }
  36750. if (s1 !== peg$FAILED) {
  36751. s2 = peg$parsews();
  36752. if (s2 !== peg$FAILED) {
  36753. s3 = peg$parseexpression();
  36754. if (s3 !== peg$FAILED) {
  36755. s4 = peg$parsews();
  36756. if (s4 !== peg$FAILED) {
  36757. if (input.charCodeAt(peg$currPos) === 46) {
  36758. s5 = peg$c51;
  36759. peg$currPos++;
  36760. } else {
  36761. s5 = peg$FAILED;
  36762. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  36763. }
  36764. if (s5 === peg$FAILED) {
  36765. s5 = peg$c41;
  36766. }
  36767. if (s5 !== peg$FAILED) {
  36768. peg$reportedPos = s0;
  36769. s1 = peg$c96(s3);
  36770. s0 = s1;
  36771. } else {
  36772. peg$currPos = s0;
  36773. s0 = peg$c1;
  36774. }
  36775. } else {
  36776. peg$currPos = s0;
  36777. s0 = peg$c1;
  36778. }
  36779. } else {
  36780. peg$currPos = s0;
  36781. s0 = peg$c1;
  36782. }
  36783. } else {
  36784. peg$currPos = s0;
  36785. s0 = peg$c1;
  36786. }
  36787. } else {
  36788. peg$currPos = s0;
  36789. s0 = peg$c1;
  36790. }
  36791. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36792. return s0;
  36793. }
  36794. function peg$parsetemps() {
  36795. var s0, s1, s2, s3, s4, s5, s6;
  36796. var key = peg$currPos * 60 + 37,
  36797. cached = peg$cache[key];
  36798. if (cached) {
  36799. peg$currPos = cached.nextPos;
  36800. return cached.result;
  36801. }
  36802. s0 = peg$currPos;
  36803. if (input.charCodeAt(peg$currPos) === 124) {
  36804. s1 = peg$c97;
  36805. peg$currPos++;
  36806. } else {
  36807. s1 = peg$FAILED;
  36808. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  36809. }
  36810. if (s1 !== peg$FAILED) {
  36811. s2 = [];
  36812. s3 = peg$currPos;
  36813. s4 = peg$parsews();
  36814. if (s4 !== peg$FAILED) {
  36815. s5 = peg$parseidentifier();
  36816. if (s5 !== peg$FAILED) {
  36817. s6 = peg$parsews();
  36818. if (s6 !== peg$FAILED) {
  36819. peg$reportedPos = s3;
  36820. s4 = peg$c99(s5);
  36821. s3 = s4;
  36822. } else {
  36823. peg$currPos = s3;
  36824. s3 = peg$c1;
  36825. }
  36826. } else {
  36827. peg$currPos = s3;
  36828. s3 = peg$c1;
  36829. }
  36830. } else {
  36831. peg$currPos = s3;
  36832. s3 = peg$c1;
  36833. }
  36834. while (s3 !== peg$FAILED) {
  36835. s2.push(s3);
  36836. s3 = peg$currPos;
  36837. s4 = peg$parsews();
  36838. if (s4 !== peg$FAILED) {
  36839. s5 = peg$parseidentifier();
  36840. if (s5 !== peg$FAILED) {
  36841. s6 = peg$parsews();
  36842. if (s6 !== peg$FAILED) {
  36843. peg$reportedPos = s3;
  36844. s4 = peg$c99(s5);
  36845. s3 = s4;
  36846. } else {
  36847. peg$currPos = s3;
  36848. s3 = peg$c1;
  36849. }
  36850. } else {
  36851. peg$currPos = s3;
  36852. s3 = peg$c1;
  36853. }
  36854. } else {
  36855. peg$currPos = s3;
  36856. s3 = peg$c1;
  36857. }
  36858. }
  36859. if (s2 !== peg$FAILED) {
  36860. if (input.charCodeAt(peg$currPos) === 124) {
  36861. s3 = peg$c97;
  36862. peg$currPos++;
  36863. } else {
  36864. s3 = peg$FAILED;
  36865. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  36866. }
  36867. if (s3 !== peg$FAILED) {
  36868. peg$reportedPos = s0;
  36869. s1 = peg$c100(s2);
  36870. s0 = s1;
  36871. } else {
  36872. peg$currPos = s0;
  36873. s0 = peg$c1;
  36874. }
  36875. } else {
  36876. peg$currPos = s0;
  36877. s0 = peg$c1;
  36878. }
  36879. } else {
  36880. peg$currPos = s0;
  36881. s0 = peg$c1;
  36882. }
  36883. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36884. return s0;
  36885. }
  36886. function peg$parseblockParamList() {
  36887. var s0, s1, s2, s3, s4, s5, s6;
  36888. var key = peg$currPos * 60 + 38,
  36889. cached = peg$cache[key];
  36890. if (cached) {
  36891. peg$currPos = cached.nextPos;
  36892. return cached.result;
  36893. }
  36894. s0 = peg$currPos;
  36895. s1 = [];
  36896. s2 = peg$currPos;
  36897. s3 = peg$parsews();
  36898. if (s3 !== peg$FAILED) {
  36899. if (input.charCodeAt(peg$currPos) === 58) {
  36900. s4 = peg$c101;
  36901. peg$currPos++;
  36902. } else {
  36903. s4 = peg$FAILED;
  36904. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  36905. }
  36906. if (s4 !== peg$FAILED) {
  36907. s5 = peg$parsews();
  36908. if (s5 !== peg$FAILED) {
  36909. s6 = peg$parseidentifier();
  36910. if (s6 !== peg$FAILED) {
  36911. peg$reportedPos = s2;
  36912. s3 = peg$c103(s6);
  36913. s2 = s3;
  36914. } else {
  36915. peg$currPos = s2;
  36916. s2 = peg$c1;
  36917. }
  36918. } else {
  36919. peg$currPos = s2;
  36920. s2 = peg$c1;
  36921. }
  36922. } else {
  36923. peg$currPos = s2;
  36924. s2 = peg$c1;
  36925. }
  36926. } else {
  36927. peg$currPos = s2;
  36928. s2 = peg$c1;
  36929. }
  36930. if (s2 !== peg$FAILED) {
  36931. while (s2 !== peg$FAILED) {
  36932. s1.push(s2);
  36933. s2 = peg$currPos;
  36934. s3 = peg$parsews();
  36935. if (s3 !== peg$FAILED) {
  36936. if (input.charCodeAt(peg$currPos) === 58) {
  36937. s4 = peg$c101;
  36938. peg$currPos++;
  36939. } else {
  36940. s4 = peg$FAILED;
  36941. if (peg$silentFails === 0) { peg$fail(peg$c102); }
  36942. }
  36943. if (s4 !== peg$FAILED) {
  36944. s5 = peg$parsews();
  36945. if (s5 !== peg$FAILED) {
  36946. s6 = peg$parseidentifier();
  36947. if (s6 !== peg$FAILED) {
  36948. peg$reportedPos = s2;
  36949. s3 = peg$c103(s6);
  36950. s2 = s3;
  36951. } else {
  36952. peg$currPos = s2;
  36953. s2 = peg$c1;
  36954. }
  36955. } else {
  36956. peg$currPos = s2;
  36957. s2 = peg$c1;
  36958. }
  36959. } else {
  36960. peg$currPos = s2;
  36961. s2 = peg$c1;
  36962. }
  36963. } else {
  36964. peg$currPos = s2;
  36965. s2 = peg$c1;
  36966. }
  36967. }
  36968. } else {
  36969. s1 = peg$c1;
  36970. }
  36971. if (s1 !== peg$FAILED) {
  36972. s2 = peg$parsews();
  36973. if (s2 !== peg$FAILED) {
  36974. if (input.charCodeAt(peg$currPos) === 124) {
  36975. s3 = peg$c97;
  36976. peg$currPos++;
  36977. } else {
  36978. s3 = peg$FAILED;
  36979. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  36980. }
  36981. if (s3 !== peg$FAILED) {
  36982. peg$reportedPos = s0;
  36983. s1 = peg$c104(s1);
  36984. s0 = s1;
  36985. } else {
  36986. peg$currPos = s0;
  36987. s0 = peg$c1;
  36988. }
  36989. } else {
  36990. peg$currPos = s0;
  36991. s0 = peg$c1;
  36992. }
  36993. } else {
  36994. peg$currPos = s0;
  36995. s0 = peg$c1;
  36996. }
  36997. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  36998. return s0;
  36999. }
  37000. function peg$parsesubexpression() {
  37001. var s0, s1, s2, s3, s4, s5;
  37002. var key = peg$currPos * 60 + 39,
  37003. cached = peg$cache[key];
  37004. if (cached) {
  37005. peg$currPos = cached.nextPos;
  37006. return cached.result;
  37007. }
  37008. s0 = peg$currPos;
  37009. if (input.charCodeAt(peg$currPos) === 40) {
  37010. s1 = peg$c57;
  37011. peg$currPos++;
  37012. } else {
  37013. s1 = peg$FAILED;
  37014. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  37015. }
  37016. if (s1 !== peg$FAILED) {
  37017. s2 = peg$parsews();
  37018. if (s2 !== peg$FAILED) {
  37019. s3 = peg$parseexpression();
  37020. if (s3 !== peg$FAILED) {
  37021. s4 = peg$parsews();
  37022. if (s4 !== peg$FAILED) {
  37023. if (input.charCodeAt(peg$currPos) === 41) {
  37024. s5 = peg$c60;
  37025. peg$currPos++;
  37026. } else {
  37027. s5 = peg$FAILED;
  37028. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  37029. }
  37030. if (s5 !== peg$FAILED) {
  37031. peg$reportedPos = s0;
  37032. s1 = peg$c89(s3);
  37033. s0 = s1;
  37034. } else {
  37035. peg$currPos = s0;
  37036. s0 = peg$c1;
  37037. }
  37038. } else {
  37039. peg$currPos = s0;
  37040. s0 = peg$c1;
  37041. }
  37042. } else {
  37043. peg$currPos = s0;
  37044. s0 = peg$c1;
  37045. }
  37046. } else {
  37047. peg$currPos = s0;
  37048. s0 = peg$c1;
  37049. }
  37050. } else {
  37051. peg$currPos = s0;
  37052. s0 = peg$c1;
  37053. }
  37054. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37055. return s0;
  37056. }
  37057. function peg$parsestatements() {
  37058. var s0, s1, s2, s3, s4, s5, s6, s7;
  37059. var key = peg$currPos * 60 + 40,
  37060. cached = peg$cache[key];
  37061. if (cached) {
  37062. peg$currPos = cached.nextPos;
  37063. return cached.result;
  37064. }
  37065. s0 = peg$currPos;
  37066. s1 = peg$parseret();
  37067. if (s1 !== peg$FAILED) {
  37068. s2 = [];
  37069. if (peg$c105.test(input.charAt(peg$currPos))) {
  37070. s3 = input.charAt(peg$currPos);
  37071. peg$currPos++;
  37072. } else {
  37073. s3 = peg$FAILED;
  37074. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37075. }
  37076. while (s3 !== peg$FAILED) {
  37077. s2.push(s3);
  37078. if (peg$c105.test(input.charAt(peg$currPos))) {
  37079. s3 = input.charAt(peg$currPos);
  37080. peg$currPos++;
  37081. } else {
  37082. s3 = peg$FAILED;
  37083. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37084. }
  37085. }
  37086. if (s2 !== peg$FAILED) {
  37087. peg$reportedPos = s0;
  37088. s1 = peg$c107(s1);
  37089. s0 = s1;
  37090. } else {
  37091. peg$currPos = s0;
  37092. s0 = peg$c1;
  37093. }
  37094. } else {
  37095. peg$currPos = s0;
  37096. s0 = peg$c1;
  37097. }
  37098. if (s0 === peg$FAILED) {
  37099. s0 = peg$currPos;
  37100. s1 = peg$parseexpressions();
  37101. if (s1 !== peg$FAILED) {
  37102. s2 = peg$parsews();
  37103. if (s2 !== peg$FAILED) {
  37104. s3 = [];
  37105. if (peg$c105.test(input.charAt(peg$currPos))) {
  37106. s4 = input.charAt(peg$currPos);
  37107. peg$currPos++;
  37108. } else {
  37109. s4 = peg$FAILED;
  37110. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37111. }
  37112. if (s4 !== peg$FAILED) {
  37113. while (s4 !== peg$FAILED) {
  37114. s3.push(s4);
  37115. if (peg$c105.test(input.charAt(peg$currPos))) {
  37116. s4 = input.charAt(peg$currPos);
  37117. peg$currPos++;
  37118. } else {
  37119. s4 = peg$FAILED;
  37120. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37121. }
  37122. }
  37123. } else {
  37124. s3 = peg$c1;
  37125. }
  37126. if (s3 !== peg$FAILED) {
  37127. s4 = peg$parsews();
  37128. if (s4 !== peg$FAILED) {
  37129. s5 = peg$parseret();
  37130. if (s5 !== peg$FAILED) {
  37131. s6 = [];
  37132. if (peg$c105.test(input.charAt(peg$currPos))) {
  37133. s7 = input.charAt(peg$currPos);
  37134. peg$currPos++;
  37135. } else {
  37136. s7 = peg$FAILED;
  37137. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37138. }
  37139. while (s7 !== peg$FAILED) {
  37140. s6.push(s7);
  37141. if (peg$c105.test(input.charAt(peg$currPos))) {
  37142. s7 = input.charAt(peg$currPos);
  37143. peg$currPos++;
  37144. } else {
  37145. s7 = peg$FAILED;
  37146. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37147. }
  37148. }
  37149. if (s6 !== peg$FAILED) {
  37150. peg$reportedPos = s0;
  37151. s1 = peg$c108(s1, s5);
  37152. s0 = s1;
  37153. } else {
  37154. peg$currPos = s0;
  37155. s0 = peg$c1;
  37156. }
  37157. } else {
  37158. peg$currPos = s0;
  37159. s0 = peg$c1;
  37160. }
  37161. } else {
  37162. peg$currPos = s0;
  37163. s0 = peg$c1;
  37164. }
  37165. } else {
  37166. peg$currPos = s0;
  37167. s0 = peg$c1;
  37168. }
  37169. } else {
  37170. peg$currPos = s0;
  37171. s0 = peg$c1;
  37172. }
  37173. } else {
  37174. peg$currPos = s0;
  37175. s0 = peg$c1;
  37176. }
  37177. if (s0 === peg$FAILED) {
  37178. s0 = peg$currPos;
  37179. s1 = peg$parseexpressions();
  37180. if (s1 === peg$FAILED) {
  37181. s1 = peg$c41;
  37182. }
  37183. if (s1 !== peg$FAILED) {
  37184. s2 = [];
  37185. if (peg$c105.test(input.charAt(peg$currPos))) {
  37186. s3 = input.charAt(peg$currPos);
  37187. peg$currPos++;
  37188. } else {
  37189. s3 = peg$FAILED;
  37190. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37191. }
  37192. while (s3 !== peg$FAILED) {
  37193. s2.push(s3);
  37194. if (peg$c105.test(input.charAt(peg$currPos))) {
  37195. s3 = input.charAt(peg$currPos);
  37196. peg$currPos++;
  37197. } else {
  37198. s3 = peg$FAILED;
  37199. if (peg$silentFails === 0) { peg$fail(peg$c106); }
  37200. }
  37201. }
  37202. if (s2 !== peg$FAILED) {
  37203. peg$reportedPos = s0;
  37204. s1 = peg$c109(s1);
  37205. s0 = s1;
  37206. } else {
  37207. peg$currPos = s0;
  37208. s0 = peg$c1;
  37209. }
  37210. } else {
  37211. peg$currPos = s0;
  37212. s0 = peg$c1;
  37213. }
  37214. }
  37215. }
  37216. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37217. return s0;
  37218. }
  37219. function peg$parsesequence() {
  37220. var s0;
  37221. var key = peg$currPos * 60 + 41,
  37222. cached = peg$cache[key];
  37223. if (cached) {
  37224. peg$currPos = cached.nextPos;
  37225. return cached.result;
  37226. }
  37227. s0 = peg$parsejsStatement();
  37228. if (s0 === peg$FAILED) {
  37229. s0 = peg$parsestSequence();
  37230. }
  37231. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37232. return s0;
  37233. }
  37234. function peg$parsestSequence() {
  37235. var s0, s1, s2, s3, s4;
  37236. var key = peg$currPos * 60 + 42,
  37237. cached = peg$cache[key];
  37238. if (cached) {
  37239. peg$currPos = cached.nextPos;
  37240. return cached.result;
  37241. }
  37242. s0 = peg$currPos;
  37243. s1 = peg$parsetemps();
  37244. if (s1 === peg$FAILED) {
  37245. s1 = peg$c41;
  37246. }
  37247. if (s1 !== peg$FAILED) {
  37248. s2 = peg$parsews();
  37249. if (s2 !== peg$FAILED) {
  37250. s3 = peg$parsestatements();
  37251. if (s3 === peg$FAILED) {
  37252. s3 = peg$c41;
  37253. }
  37254. if (s3 !== peg$FAILED) {
  37255. s4 = peg$parsews();
  37256. if (s4 !== peg$FAILED) {
  37257. peg$reportedPos = s0;
  37258. s1 = peg$c110(s1, s3);
  37259. s0 = s1;
  37260. } else {
  37261. peg$currPos = s0;
  37262. s0 = peg$c1;
  37263. }
  37264. } else {
  37265. peg$currPos = s0;
  37266. s0 = peg$c1;
  37267. }
  37268. } else {
  37269. peg$currPos = s0;
  37270. s0 = peg$c1;
  37271. }
  37272. } else {
  37273. peg$currPos = s0;
  37274. s0 = peg$c1;
  37275. }
  37276. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37277. return s0;
  37278. }
  37279. function peg$parseblock() {
  37280. var s0, s1, s2, s3, s4, s5, s6, s7;
  37281. var key = peg$currPos * 60 + 43,
  37282. cached = peg$cache[key];
  37283. if (cached) {
  37284. peg$currPos = cached.nextPos;
  37285. return cached.result;
  37286. }
  37287. s0 = peg$currPos;
  37288. if (input.charCodeAt(peg$currPos) === 91) {
  37289. s1 = peg$c111;
  37290. peg$currPos++;
  37291. } else {
  37292. s1 = peg$FAILED;
  37293. if (peg$silentFails === 0) { peg$fail(peg$c112); }
  37294. }
  37295. if (s1 !== peg$FAILED) {
  37296. s2 = peg$parsews();
  37297. if (s2 !== peg$FAILED) {
  37298. s3 = peg$parseblockParamList();
  37299. if (s3 === peg$FAILED) {
  37300. s3 = peg$c41;
  37301. }
  37302. if (s3 !== peg$FAILED) {
  37303. s4 = peg$parsews();
  37304. if (s4 !== peg$FAILED) {
  37305. s5 = peg$parsesequence();
  37306. if (s5 === peg$FAILED) {
  37307. s5 = peg$c41;
  37308. }
  37309. if (s5 !== peg$FAILED) {
  37310. s6 = peg$parsews();
  37311. if (s6 !== peg$FAILED) {
  37312. if (input.charCodeAt(peg$currPos) === 93) {
  37313. s7 = peg$c113;
  37314. peg$currPos++;
  37315. } else {
  37316. s7 = peg$FAILED;
  37317. if (peg$silentFails === 0) { peg$fail(peg$c114); }
  37318. }
  37319. if (s7 !== peg$FAILED) {
  37320. peg$reportedPos = s0;
  37321. s1 = peg$c115(s3, s5);
  37322. s0 = s1;
  37323. } else {
  37324. peg$currPos = s0;
  37325. s0 = peg$c1;
  37326. }
  37327. } else {
  37328. peg$currPos = s0;
  37329. s0 = peg$c1;
  37330. }
  37331. } else {
  37332. peg$currPos = s0;
  37333. s0 = peg$c1;
  37334. }
  37335. } else {
  37336. peg$currPos = s0;
  37337. s0 = peg$c1;
  37338. }
  37339. } else {
  37340. peg$currPos = s0;
  37341. s0 = peg$c1;
  37342. }
  37343. } else {
  37344. peg$currPos = s0;
  37345. s0 = peg$c1;
  37346. }
  37347. } else {
  37348. peg$currPos = s0;
  37349. s0 = peg$c1;
  37350. }
  37351. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37352. return s0;
  37353. }
  37354. function peg$parseoperand() {
  37355. var s0;
  37356. var key = peg$currPos * 60 + 44,
  37357. cached = peg$cache[key];
  37358. if (cached) {
  37359. peg$currPos = cached.nextPos;
  37360. return cached.result;
  37361. }
  37362. s0 = peg$parseliteral();
  37363. if (s0 === peg$FAILED) {
  37364. s0 = peg$parsevariable();
  37365. if (s0 === peg$FAILED) {
  37366. s0 = peg$parsesubexpression();
  37367. }
  37368. }
  37369. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37370. return s0;
  37371. }
  37372. function peg$parseunaryMessage() {
  37373. var s0, s1, s2, s3, s4;
  37374. var key = peg$currPos * 60 + 45,
  37375. cached = peg$cache[key];
  37376. if (cached) {
  37377. peg$currPos = cached.nextPos;
  37378. return cached.result;
  37379. }
  37380. s0 = peg$currPos;
  37381. s1 = peg$parsews();
  37382. if (s1 !== peg$FAILED) {
  37383. s2 = peg$parseidentifier();
  37384. if (s2 !== peg$FAILED) {
  37385. s3 = peg$currPos;
  37386. peg$silentFails++;
  37387. if (peg$c13.test(input.charAt(peg$currPos))) {
  37388. s4 = input.charAt(peg$currPos);
  37389. peg$currPos++;
  37390. } else {
  37391. s4 = peg$FAILED;
  37392. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  37393. }
  37394. peg$silentFails--;
  37395. if (s4 === peg$FAILED) {
  37396. s3 = peg$c116;
  37397. } else {
  37398. peg$currPos = s3;
  37399. s3 = peg$c1;
  37400. }
  37401. if (s3 !== peg$FAILED) {
  37402. peg$reportedPos = s0;
  37403. s1 = peg$c117(s2);
  37404. s0 = s1;
  37405. } else {
  37406. peg$currPos = s0;
  37407. s0 = peg$c1;
  37408. }
  37409. } else {
  37410. peg$currPos = s0;
  37411. s0 = peg$c1;
  37412. }
  37413. } else {
  37414. peg$currPos = s0;
  37415. s0 = peg$c1;
  37416. }
  37417. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37418. return s0;
  37419. }
  37420. function peg$parseunaryTail() {
  37421. var s0, s1, s2, s3, s4;
  37422. var key = peg$currPos * 60 + 46,
  37423. cached = peg$cache[key];
  37424. if (cached) {
  37425. peg$currPos = cached.nextPos;
  37426. return cached.result;
  37427. }
  37428. s0 = peg$currPos;
  37429. s1 = peg$parseunaryMessage();
  37430. if (s1 !== peg$FAILED) {
  37431. s2 = peg$parsews();
  37432. if (s2 !== peg$FAILED) {
  37433. s3 = peg$parseunaryTail();
  37434. if (s3 === peg$FAILED) {
  37435. s3 = peg$c41;
  37436. }
  37437. if (s3 !== peg$FAILED) {
  37438. s4 = peg$parsews();
  37439. if (s4 !== peg$FAILED) {
  37440. peg$reportedPos = s0;
  37441. s1 = peg$c118(s1, s3);
  37442. s0 = s1;
  37443. } else {
  37444. peg$currPos = s0;
  37445. s0 = peg$c1;
  37446. }
  37447. } else {
  37448. peg$currPos = s0;
  37449. s0 = peg$c1;
  37450. }
  37451. } else {
  37452. peg$currPos = s0;
  37453. s0 = peg$c1;
  37454. }
  37455. } else {
  37456. peg$currPos = s0;
  37457. s0 = peg$c1;
  37458. }
  37459. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37460. return s0;
  37461. }
  37462. function peg$parseunarySend() {
  37463. var s0, s1, s2, s3;
  37464. var key = peg$currPos * 60 + 47,
  37465. cached = peg$cache[key];
  37466. if (cached) {
  37467. peg$currPos = cached.nextPos;
  37468. return cached.result;
  37469. }
  37470. s0 = peg$currPos;
  37471. s1 = peg$parseoperand();
  37472. if (s1 !== peg$FAILED) {
  37473. s2 = peg$parsews();
  37474. if (s2 !== peg$FAILED) {
  37475. s3 = peg$parseunaryTail();
  37476. if (s3 === peg$FAILED) {
  37477. s3 = peg$c41;
  37478. }
  37479. if (s3 !== peg$FAILED) {
  37480. peg$reportedPos = s0;
  37481. s1 = peg$c119(s1, s3);
  37482. s0 = s1;
  37483. } else {
  37484. peg$currPos = s0;
  37485. s0 = peg$c1;
  37486. }
  37487. } else {
  37488. peg$currPos = s0;
  37489. s0 = peg$c1;
  37490. }
  37491. } else {
  37492. peg$currPos = s0;
  37493. s0 = peg$c1;
  37494. }
  37495. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37496. return s0;
  37497. }
  37498. function peg$parsebinaryMessage() {
  37499. var s0, s1, s2, s3, s4;
  37500. var key = peg$currPos * 60 + 48,
  37501. cached = peg$cache[key];
  37502. if (cached) {
  37503. peg$currPos = cached.nextPos;
  37504. return cached.result;
  37505. }
  37506. s0 = peg$currPos;
  37507. s1 = peg$parsews();
  37508. if (s1 !== peg$FAILED) {
  37509. s2 = peg$parsebinarySelector();
  37510. if (s2 !== peg$FAILED) {
  37511. s3 = peg$parsews();
  37512. if (s3 !== peg$FAILED) {
  37513. s4 = peg$parseunarySend();
  37514. if (s4 === peg$FAILED) {
  37515. s4 = peg$parseoperand();
  37516. }
  37517. if (s4 !== peg$FAILED) {
  37518. peg$reportedPos = s0;
  37519. s1 = peg$c120(s2, s4);
  37520. s0 = s1;
  37521. } else {
  37522. peg$currPos = s0;
  37523. s0 = peg$c1;
  37524. }
  37525. } else {
  37526. peg$currPos = s0;
  37527. s0 = peg$c1;
  37528. }
  37529. } else {
  37530. peg$currPos = s0;
  37531. s0 = peg$c1;
  37532. }
  37533. } else {
  37534. peg$currPos = s0;
  37535. s0 = peg$c1;
  37536. }
  37537. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37538. return s0;
  37539. }
  37540. function peg$parsebinaryTail() {
  37541. var s0, s1, s2;
  37542. var key = peg$currPos * 60 + 49,
  37543. cached = peg$cache[key];
  37544. if (cached) {
  37545. peg$currPos = cached.nextPos;
  37546. return cached.result;
  37547. }
  37548. s0 = peg$currPos;
  37549. s1 = peg$parsebinaryMessage();
  37550. if (s1 !== peg$FAILED) {
  37551. s2 = peg$parsebinaryTail();
  37552. if (s2 === peg$FAILED) {
  37553. s2 = peg$c41;
  37554. }
  37555. if (s2 !== peg$FAILED) {
  37556. peg$reportedPos = s0;
  37557. s1 = peg$c121(s1, s2);
  37558. s0 = s1;
  37559. } else {
  37560. peg$currPos = s0;
  37561. s0 = peg$c1;
  37562. }
  37563. } else {
  37564. peg$currPos = s0;
  37565. s0 = peg$c1;
  37566. }
  37567. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37568. return s0;
  37569. }
  37570. function peg$parsebinarySend() {
  37571. var s0, s1, s2;
  37572. var key = peg$currPos * 60 + 50,
  37573. cached = peg$cache[key];
  37574. if (cached) {
  37575. peg$currPos = cached.nextPos;
  37576. return cached.result;
  37577. }
  37578. s0 = peg$currPos;
  37579. s1 = peg$parseunarySend();
  37580. if (s1 !== peg$FAILED) {
  37581. s2 = peg$parsebinaryTail();
  37582. if (s2 === peg$FAILED) {
  37583. s2 = peg$c41;
  37584. }
  37585. if (s2 !== peg$FAILED) {
  37586. peg$reportedPos = s0;
  37587. s1 = peg$c119(s1, s2);
  37588. s0 = s1;
  37589. } else {
  37590. peg$currPos = s0;
  37591. s0 = peg$c1;
  37592. }
  37593. } else {
  37594. peg$currPos = s0;
  37595. s0 = peg$c1;
  37596. }
  37597. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37598. return s0;
  37599. }
  37600. function peg$parsekeywordMessage() {
  37601. var s0, s1, s2, s3, s4, s5;
  37602. var key = peg$currPos * 60 + 51,
  37603. cached = peg$cache[key];
  37604. if (cached) {
  37605. peg$currPos = cached.nextPos;
  37606. return cached.result;
  37607. }
  37608. s0 = peg$currPos;
  37609. s1 = peg$parsews();
  37610. if (s1 !== peg$FAILED) {
  37611. s2 = [];
  37612. s3 = peg$currPos;
  37613. s4 = peg$parsekeywordPair();
  37614. if (s4 !== peg$FAILED) {
  37615. s5 = peg$parsews();
  37616. if (s5 !== peg$FAILED) {
  37617. peg$reportedPos = s3;
  37618. s4 = peg$c122(s4);
  37619. s3 = s4;
  37620. } else {
  37621. peg$currPos = s3;
  37622. s3 = peg$c1;
  37623. }
  37624. } else {
  37625. peg$currPos = s3;
  37626. s3 = peg$c1;
  37627. }
  37628. if (s3 !== peg$FAILED) {
  37629. while (s3 !== peg$FAILED) {
  37630. s2.push(s3);
  37631. s3 = peg$currPos;
  37632. s4 = peg$parsekeywordPair();
  37633. if (s4 !== peg$FAILED) {
  37634. s5 = peg$parsews();
  37635. if (s5 !== peg$FAILED) {
  37636. peg$reportedPos = s3;
  37637. s4 = peg$c122(s4);
  37638. s3 = s4;
  37639. } else {
  37640. peg$currPos = s3;
  37641. s3 = peg$c1;
  37642. }
  37643. } else {
  37644. peg$currPos = s3;
  37645. s3 = peg$c1;
  37646. }
  37647. }
  37648. } else {
  37649. s2 = peg$c1;
  37650. }
  37651. if (s2 !== peg$FAILED) {
  37652. peg$reportedPos = s0;
  37653. s1 = peg$c123(s2);
  37654. s0 = s1;
  37655. } else {
  37656. peg$currPos = s0;
  37657. s0 = peg$c1;
  37658. }
  37659. } else {
  37660. peg$currPos = s0;
  37661. s0 = peg$c1;
  37662. }
  37663. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37664. return s0;
  37665. }
  37666. function peg$parsekeywordSend() {
  37667. var s0, s1, s2;
  37668. var key = peg$currPos * 60 + 52,
  37669. cached = peg$cache[key];
  37670. if (cached) {
  37671. peg$currPos = cached.nextPos;
  37672. return cached.result;
  37673. }
  37674. s0 = peg$currPos;
  37675. s1 = peg$parsebinarySend();
  37676. if (s1 !== peg$FAILED) {
  37677. s2 = peg$parsekeywordMessage();
  37678. if (s2 !== peg$FAILED) {
  37679. peg$reportedPos = s0;
  37680. s1 = peg$c124(s1, s2);
  37681. s0 = s1;
  37682. } else {
  37683. peg$currPos = s0;
  37684. s0 = peg$c1;
  37685. }
  37686. } else {
  37687. peg$currPos = s0;
  37688. s0 = peg$c1;
  37689. }
  37690. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37691. return s0;
  37692. }
  37693. function peg$parsemessage() {
  37694. var s0;
  37695. var key = peg$currPos * 60 + 53,
  37696. cached = peg$cache[key];
  37697. if (cached) {
  37698. peg$currPos = cached.nextPos;
  37699. return cached.result;
  37700. }
  37701. s0 = peg$parsebinaryMessage();
  37702. if (s0 === peg$FAILED) {
  37703. s0 = peg$parseunaryMessage();
  37704. if (s0 === peg$FAILED) {
  37705. s0 = peg$parsekeywordMessage();
  37706. }
  37707. }
  37708. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37709. return s0;
  37710. }
  37711. function peg$parsecascade() {
  37712. var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
  37713. var key = peg$currPos * 60 + 54,
  37714. cached = peg$cache[key];
  37715. if (cached) {
  37716. peg$currPos = cached.nextPos;
  37717. return cached.result;
  37718. }
  37719. s0 = peg$currPos;
  37720. s1 = peg$parsews();
  37721. if (s1 !== peg$FAILED) {
  37722. s2 = peg$parsekeywordSend();
  37723. if (s2 === peg$FAILED) {
  37724. s2 = peg$parsebinarySend();
  37725. }
  37726. if (s2 !== peg$FAILED) {
  37727. s3 = [];
  37728. s4 = peg$currPos;
  37729. s5 = peg$parsews();
  37730. if (s5 !== peg$FAILED) {
  37731. if (input.charCodeAt(peg$currPos) === 59) {
  37732. s6 = peg$c125;
  37733. peg$currPos++;
  37734. } else {
  37735. s6 = peg$FAILED;
  37736. if (peg$silentFails === 0) { peg$fail(peg$c126); }
  37737. }
  37738. if (s6 !== peg$FAILED) {
  37739. s7 = peg$parsews();
  37740. if (s7 !== peg$FAILED) {
  37741. s8 = peg$parsemessage();
  37742. if (s8 !== peg$FAILED) {
  37743. s9 = peg$parsews();
  37744. if (s9 !== peg$FAILED) {
  37745. peg$reportedPos = s4;
  37746. s5 = peg$c127(s8);
  37747. s4 = s5;
  37748. } else {
  37749. peg$currPos = s4;
  37750. s4 = peg$c1;
  37751. }
  37752. } else {
  37753. peg$currPos = s4;
  37754. s4 = peg$c1;
  37755. }
  37756. } else {
  37757. peg$currPos = s4;
  37758. s4 = peg$c1;
  37759. }
  37760. } else {
  37761. peg$currPos = s4;
  37762. s4 = peg$c1;
  37763. }
  37764. } else {
  37765. peg$currPos = s4;
  37766. s4 = peg$c1;
  37767. }
  37768. if (s4 !== peg$FAILED) {
  37769. while (s4 !== peg$FAILED) {
  37770. s3.push(s4);
  37771. s4 = peg$currPos;
  37772. s5 = peg$parsews();
  37773. if (s5 !== peg$FAILED) {
  37774. if (input.charCodeAt(peg$currPos) === 59) {
  37775. s6 = peg$c125;
  37776. peg$currPos++;
  37777. } else {
  37778. s6 = peg$FAILED;
  37779. if (peg$silentFails === 0) { peg$fail(peg$c126); }
  37780. }
  37781. if (s6 !== peg$FAILED) {
  37782. s7 = peg$parsews();
  37783. if (s7 !== peg$FAILED) {
  37784. s8 = peg$parsemessage();
  37785. if (s8 !== peg$FAILED) {
  37786. s9 = peg$parsews();
  37787. if (s9 !== peg$FAILED) {
  37788. peg$reportedPos = s4;
  37789. s5 = peg$c127(s8);
  37790. s4 = s5;
  37791. } else {
  37792. peg$currPos = s4;
  37793. s4 = peg$c1;
  37794. }
  37795. } else {
  37796. peg$currPos = s4;
  37797. s4 = peg$c1;
  37798. }
  37799. } else {
  37800. peg$currPos = s4;
  37801. s4 = peg$c1;
  37802. }
  37803. } else {
  37804. peg$currPos = s4;
  37805. s4 = peg$c1;
  37806. }
  37807. } else {
  37808. peg$currPos = s4;
  37809. s4 = peg$c1;
  37810. }
  37811. }
  37812. } else {
  37813. s3 = peg$c1;
  37814. }
  37815. if (s3 !== peg$FAILED) {
  37816. peg$reportedPos = s0;
  37817. s1 = peg$c128(s2, s3);
  37818. s0 = s1;
  37819. } else {
  37820. peg$currPos = s0;
  37821. s0 = peg$c1;
  37822. }
  37823. } else {
  37824. peg$currPos = s0;
  37825. s0 = peg$c1;
  37826. }
  37827. } else {
  37828. peg$currPos = s0;
  37829. s0 = peg$c1;
  37830. }
  37831. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37832. return s0;
  37833. }
  37834. function peg$parsejsStatement() {
  37835. var s0, s1, s2, s3, s4;
  37836. var key = peg$currPos * 60 + 55,
  37837. cached = peg$cache[key];
  37838. if (cached) {
  37839. peg$currPos = cached.nextPos;
  37840. return cached.result;
  37841. }
  37842. s0 = peg$currPos;
  37843. if (input.charCodeAt(peg$currPos) === 60) {
  37844. s1 = peg$c129;
  37845. peg$currPos++;
  37846. } else {
  37847. s1 = peg$FAILED;
  37848. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  37849. }
  37850. if (s1 !== peg$FAILED) {
  37851. s2 = [];
  37852. s3 = peg$currPos;
  37853. if (input.substr(peg$currPos, 2) === peg$c131) {
  37854. s4 = peg$c131;
  37855. peg$currPos += 2;
  37856. } else {
  37857. s4 = peg$FAILED;
  37858. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  37859. }
  37860. if (s4 !== peg$FAILED) {
  37861. peg$reportedPos = s3;
  37862. s4 = peg$c133();
  37863. }
  37864. s3 = s4;
  37865. if (s3 === peg$FAILED) {
  37866. if (peg$c134.test(input.charAt(peg$currPos))) {
  37867. s3 = input.charAt(peg$currPos);
  37868. peg$currPos++;
  37869. } else {
  37870. s3 = peg$FAILED;
  37871. if (peg$silentFails === 0) { peg$fail(peg$c135); }
  37872. }
  37873. }
  37874. while (s3 !== peg$FAILED) {
  37875. s2.push(s3);
  37876. s3 = peg$currPos;
  37877. if (input.substr(peg$currPos, 2) === peg$c131) {
  37878. s4 = peg$c131;
  37879. peg$currPos += 2;
  37880. } else {
  37881. s4 = peg$FAILED;
  37882. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  37883. }
  37884. if (s4 !== peg$FAILED) {
  37885. peg$reportedPos = s3;
  37886. s4 = peg$c133();
  37887. }
  37888. s3 = s4;
  37889. if (s3 === peg$FAILED) {
  37890. if (peg$c134.test(input.charAt(peg$currPos))) {
  37891. s3 = input.charAt(peg$currPos);
  37892. peg$currPos++;
  37893. } else {
  37894. s3 = peg$FAILED;
  37895. if (peg$silentFails === 0) { peg$fail(peg$c135); }
  37896. }
  37897. }
  37898. }
  37899. if (s2 !== peg$FAILED) {
  37900. if (input.charCodeAt(peg$currPos) === 62) {
  37901. s3 = peg$c136;
  37902. peg$currPos++;
  37903. } else {
  37904. s3 = peg$FAILED;
  37905. if (peg$silentFails === 0) { peg$fail(peg$c137); }
  37906. }
  37907. if (s3 !== peg$FAILED) {
  37908. peg$reportedPos = s0;
  37909. s1 = peg$c138(s2);
  37910. s0 = s1;
  37911. } else {
  37912. peg$currPos = s0;
  37913. s0 = peg$c1;
  37914. }
  37915. } else {
  37916. peg$currPos = s0;
  37917. s0 = peg$c1;
  37918. }
  37919. } else {
  37920. peg$currPos = s0;
  37921. s0 = peg$c1;
  37922. }
  37923. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37924. return s0;
  37925. }
  37926. function peg$parsemethod() {
  37927. var s0, s1, s2, s3, s4, s5;
  37928. var key = peg$currPos * 60 + 56,
  37929. cached = peg$cache[key];
  37930. if (cached) {
  37931. peg$currPos = cached.nextPos;
  37932. return cached.result;
  37933. }
  37934. s0 = peg$currPos;
  37935. s1 = peg$parsews();
  37936. if (s1 !== peg$FAILED) {
  37937. s2 = peg$parsekeywordPattern();
  37938. if (s2 === peg$FAILED) {
  37939. s2 = peg$parsebinaryPattern();
  37940. if (s2 === peg$FAILED) {
  37941. s2 = peg$parseunaryPattern();
  37942. }
  37943. }
  37944. if (s2 !== peg$FAILED) {
  37945. s3 = peg$parsews();
  37946. if (s3 !== peg$FAILED) {
  37947. s4 = peg$parsesequence();
  37948. if (s4 === peg$FAILED) {
  37949. s4 = peg$c41;
  37950. }
  37951. if (s4 !== peg$FAILED) {
  37952. s5 = peg$parsews();
  37953. if (s5 !== peg$FAILED) {
  37954. peg$reportedPos = s0;
  37955. s1 = peg$c139(s2, s4);
  37956. s0 = s1;
  37957. } else {
  37958. peg$currPos = s0;
  37959. s0 = peg$c1;
  37960. }
  37961. } else {
  37962. peg$currPos = s0;
  37963. s0 = peg$c1;
  37964. }
  37965. } else {
  37966. peg$currPos = s0;
  37967. s0 = peg$c1;
  37968. }
  37969. } else {
  37970. peg$currPos = s0;
  37971. s0 = peg$c1;
  37972. }
  37973. } else {
  37974. peg$currPos = s0;
  37975. s0 = peg$c1;
  37976. }
  37977. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  37978. return s0;
  37979. }
  37980. function peg$parseassociationSend() {
  37981. var s0, s1, s2;
  37982. var key = peg$currPos * 60 + 57,
  37983. cached = peg$cache[key];
  37984. if (cached) {
  37985. peg$currPos = cached.nextPos;
  37986. return cached.result;
  37987. }
  37988. s0 = peg$currPos;
  37989. s1 = peg$parsebinarySend();
  37990. if (s1 !== peg$FAILED) {
  37991. peg$reportedPos = peg$currPos;
  37992. s2 = peg$c140(s1);
  37993. if (s2) {
  37994. s2 = peg$c116;
  37995. } else {
  37996. s2 = peg$c1;
  37997. }
  37998. if (s2 !== peg$FAILED) {
  37999. peg$reportedPos = s0;
  38000. s1 = peg$c141(s1);
  38001. s0 = s1;
  38002. } else {
  38003. peg$currPos = s0;
  38004. s0 = peg$c1;
  38005. }
  38006. } else {
  38007. peg$currPos = s0;
  38008. s0 = peg$c1;
  38009. }
  38010. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  38011. return s0;
  38012. }
  38013. function peg$parseassociationList() {
  38014. var s0, s1, s2, s3, s4;
  38015. var key = peg$currPos * 60 + 58,
  38016. cached = peg$cache[key];
  38017. if (cached) {
  38018. peg$currPos = cached.nextPos;
  38019. return cached.result;
  38020. }
  38021. s0 = peg$currPos;
  38022. s1 = peg$parsews();
  38023. if (s1 !== peg$FAILED) {
  38024. if (input.charCodeAt(peg$currPos) === 46) {
  38025. s2 = peg$c51;
  38026. peg$currPos++;
  38027. } else {
  38028. s2 = peg$FAILED;
  38029. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  38030. }
  38031. if (s2 !== peg$FAILED) {
  38032. s3 = peg$parsews();
  38033. if (s3 !== peg$FAILED) {
  38034. s4 = peg$parseassociationSend();
  38035. if (s4 !== peg$FAILED) {
  38036. peg$reportedPos = s0;
  38037. s1 = peg$c89(s4);
  38038. s0 = s1;
  38039. } else {
  38040. peg$currPos = s0;
  38041. s0 = peg$c1;
  38042. }
  38043. } else {
  38044. peg$currPos = s0;
  38045. s0 = peg$c1;
  38046. }
  38047. } else {
  38048. peg$currPos = s0;
  38049. s0 = peg$c1;
  38050. }
  38051. } else {
  38052. peg$currPos = s0;
  38053. s0 = peg$c1;
  38054. }
  38055. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  38056. return s0;
  38057. }
  38058. function peg$parseassociations() {
  38059. var s0, s1, s2, s3;
  38060. var key = peg$currPos * 60 + 59,
  38061. cached = peg$cache[key];
  38062. if (cached) {
  38063. peg$currPos = cached.nextPos;
  38064. return cached.result;
  38065. }
  38066. s0 = peg$currPos;
  38067. s1 = peg$parseassociationSend();
  38068. if (s1 !== peg$FAILED) {
  38069. s2 = [];
  38070. s3 = peg$parseassociationList();
  38071. while (s3 !== peg$FAILED) {
  38072. s2.push(s3);
  38073. s3 = peg$parseassociationList();
  38074. }
  38075. if (s2 !== peg$FAILED) {
  38076. peg$reportedPos = s0;
  38077. s1 = peg$c142(s1, s2);
  38078. s0 = s1;
  38079. } else {
  38080. peg$currPos = s0;
  38081. s0 = peg$c1;
  38082. }
  38083. } else {
  38084. peg$currPos = s0;
  38085. s0 = peg$c1;
  38086. }
  38087. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  38088. return s0;
  38089. }
  38090. peg$result = peg$startRuleFunction();
  38091. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  38092. return peg$result;
  38093. } else {
  38094. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  38095. peg$fail({ type: "end", description: "end of input" });
  38096. }
  38097. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  38098. }
  38099. }
  38100. return {
  38101. SyntaxError: SyntaxError,
  38102. parse: parse
  38103. };
  38104. })();
  38105. });
  38106. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Classes", "amber_core/Kernel-Infrastructure"], function($boot){
  38107. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  38108. smalltalk.addPackage('SUnit');
  38109. smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38110. smalltalk.addClass('ResultAnnouncement', globals.Object, ['result'], 'SUnit');
  38111. globals.ResultAnnouncement.comment="I get signaled when a `TestCase` has been run.\x0a\x0aMy instances hold the result (instance of `TestResult`) of the test run.";
  38112. smalltalk.addMethod(
  38113. smalltalk.method({
  38114. selector: "result",
  38115. protocol: 'accessing',
  38116. fn: function (){
  38117. var self=this;
  38118. var $1;
  38119. $1=self["@result"];
  38120. return $1;
  38121. },
  38122. args: [],
  38123. source: "result\x0a\x09^ result",
  38124. messageSends: [],
  38125. referencedClasses: []
  38126. }),
  38127. globals.ResultAnnouncement);
  38128. smalltalk.addMethod(
  38129. smalltalk.method({
  38130. selector: "result:",
  38131. protocol: 'accessing',
  38132. fn: function (aTestResult){
  38133. var self=this;
  38134. self["@result"]=aTestResult;
  38135. return self},
  38136. args: ["aTestResult"],
  38137. source: "result: aTestResult\x0a\x09result := aTestResult",
  38138. messageSends: [],
  38139. referencedClasses: []
  38140. }),
  38141. globals.ResultAnnouncement);
  38142. smalltalk.addClass('TestCase', globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  38143. globals.TestCase.comment="I am an implementation of the command pattern to run a test.\x0a\x0a## API\x0a\x0aMy instances are created with the class method `#selector:`,\x0apassing the symbol that names the method to be executed when the test case runs.\x0a\x0aWhen you discover a new fixture, subclass `TestCase` and create a `#test...` method for the first test.\x0aAs that method develops and more `#test...` methods are added, you will find yourself refactoring temps\x0ainto instance variables for the objects in the fixture and overriding `#setUp` to initialize these variables.\x0aAs required, override `#tearDown` to nil references, release objects and deallocate.";
  38144. smalltalk.addMethod(
  38145. smalltalk.method({
  38146. selector: "assert:",
  38147. protocol: 'testing',
  38148. fn: function (aBoolean){
  38149. var self=this;
  38150. return smalltalk.withContext(function($ctx1) {
  38151. self._assert_description_(aBoolean,"Assertion failed");
  38152. return self}, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},globals.TestCase)})},
  38153. args: ["aBoolean"],
  38154. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  38155. messageSends: ["assert:description:"],
  38156. referencedClasses: []
  38157. }),
  38158. globals.TestCase);
  38159. smalltalk.addMethod(
  38160. smalltalk.method({
  38161. selector: "assert:description:",
  38162. protocol: 'testing',
  38163. fn: function (aBoolean,aString){
  38164. var self=this;
  38165. return smalltalk.withContext(function($ctx1) {
  38166. if(! smalltalk.assert(aBoolean)){
  38167. self._signalFailure_(aString);
  38168. };
  38169. return self}, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},globals.TestCase)})},
  38170. args: ["aBoolean", "aString"],
  38171. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  38172. messageSends: ["ifFalse:", "signalFailure:"],
  38173. referencedClasses: []
  38174. }),
  38175. globals.TestCase);
  38176. smalltalk.addMethod(
  38177. smalltalk.method({
  38178. selector: "assert:equals:",
  38179. protocol: 'testing',
  38180. fn: function (actual,expected){
  38181. var self=this;
  38182. return smalltalk.withContext(function($ctx1) {
  38183. var $2,$6,$5,$4,$3,$1;
  38184. $2=_st(actual).__eq(expected);
  38185. $6=_st(expected)._printString();
  38186. $ctx1.sendIdx["printString"]=1;
  38187. $5="Expected: ".__comma($6);
  38188. $4=_st($5).__comma(" but was: ");
  38189. $ctx1.sendIdx[","]=2;
  38190. $3=_st($4).__comma(_st(actual)._printString());
  38191. $ctx1.sendIdx[","]=1;
  38192. $1=self._assert_description_($2,$3);
  38193. return $1;
  38194. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},globals.TestCase)})},
  38195. args: ["actual", "expected"],
  38196. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  38197. messageSends: ["assert:description:", "=", ",", "printString"],
  38198. referencedClasses: []
  38199. }),
  38200. globals.TestCase);
  38201. smalltalk.addMethod(
  38202. smalltalk.method({
  38203. selector: "async:",
  38204. protocol: 'async',
  38205. fn: function (aBlock){
  38206. var self=this;
  38207. var c;
  38208. return smalltalk.withContext(function($ctx1) {
  38209. var $2,$1;
  38210. self._errorIfNotAsync_("#async");
  38211. c=self["@context"];
  38212. $1=(function(){
  38213. return smalltalk.withContext(function($ctx2) {
  38214. $2=self._isAsync();
  38215. if(smalltalk.assert($2)){
  38216. return _st(c)._execute_(aBlock);
  38217. };
  38218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  38219. return $1;
  38220. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},globals.TestCase)})},
  38221. args: ["aBlock"],
  38222. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  38223. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"],
  38224. referencedClasses: []
  38225. }),
  38226. globals.TestCase);
  38227. smalltalk.addMethod(
  38228. smalltalk.method({
  38229. selector: "context:",
  38230. protocol: 'accessing',
  38231. fn: function (aRunningTestContext){
  38232. var self=this;
  38233. self["@context"]=aRunningTestContext;
  38234. return self},
  38235. args: ["aRunningTestContext"],
  38236. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  38237. messageSends: [],
  38238. referencedClasses: []
  38239. }),
  38240. globals.TestCase);
  38241. smalltalk.addMethod(
  38242. smalltalk.method({
  38243. selector: "deny:",
  38244. protocol: 'testing',
  38245. fn: function (aBoolean){
  38246. var self=this;
  38247. return smalltalk.withContext(function($ctx1) {
  38248. self._assert_(_st(aBoolean)._not());
  38249. return self}, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},globals.TestCase)})},
  38250. args: ["aBoolean"],
  38251. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  38252. messageSends: ["assert:", "not"],
  38253. referencedClasses: []
  38254. }),
  38255. globals.TestCase);
  38256. smalltalk.addMethod(
  38257. smalltalk.method({
  38258. selector: "errorIfNotAsync:",
  38259. protocol: 'error handling',
  38260. fn: function (aString){
  38261. var self=this;
  38262. return smalltalk.withContext(function($ctx1) {
  38263. var $1;
  38264. $1=self._isAsync();
  38265. if(! smalltalk.assert($1)){
  38266. self._error_(_st(aString).__comma(" used without prior #timeout:"));
  38267. };
  38268. return self}, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},globals.TestCase)})},
  38269. args: ["aString"],
  38270. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  38271. messageSends: ["ifFalse:", "isAsync", "error:", ","],
  38272. referencedClasses: []
  38273. }),
  38274. globals.TestCase);
  38275. smalltalk.addMethod(
  38276. smalltalk.method({
  38277. selector: "finished",
  38278. protocol: 'async',
  38279. fn: function (){
  38280. var self=this;
  38281. return smalltalk.withContext(function($ctx1) {
  38282. self._errorIfNotAsync_("#finished");
  38283. self["@asyncTimeout"]=nil;
  38284. return self}, function($ctx1) {$ctx1.fill(self,"finished",{},globals.TestCase)})},
  38285. args: [],
  38286. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  38287. messageSends: ["errorIfNotAsync:"],
  38288. referencedClasses: []
  38289. }),
  38290. globals.TestCase);
  38291. smalltalk.addMethod(
  38292. smalltalk.method({
  38293. selector: "isAsync",
  38294. protocol: 'testing',
  38295. fn: function (){
  38296. var self=this;
  38297. return smalltalk.withContext(function($ctx1) {
  38298. var $1;
  38299. $1=_st(self["@asyncTimeout"])._notNil();
  38300. return $1;
  38301. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},globals.TestCase)})},
  38302. args: [],
  38303. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  38304. messageSends: ["notNil"],
  38305. referencedClasses: []
  38306. }),
  38307. globals.TestCase);
  38308. smalltalk.addMethod(
  38309. smalltalk.method({
  38310. selector: "performTest",
  38311. protocol: 'running',
  38312. fn: function (){
  38313. var self=this;
  38314. return smalltalk.withContext(function($ctx1) {
  38315. self["@asyncTimeout"]=nil;
  38316. self._perform_(self._selector());
  38317. return self}, function($ctx1) {$ctx1.fill(self,"performTest",{},globals.TestCase)})},
  38318. args: [],
  38319. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  38320. messageSends: ["perform:", "selector"],
  38321. referencedClasses: []
  38322. }),
  38323. globals.TestCase);
  38324. smalltalk.addMethod(
  38325. smalltalk.method({
  38326. selector: "runCase",
  38327. protocol: 'running',
  38328. fn: function (){
  38329. var self=this;
  38330. function $TestContext(){return globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  38331. return smalltalk.withContext(function($ctx1) {
  38332. _st(_st($TestContext())._testCase_(self))._start();
  38333. return self}, function($ctx1) {$ctx1.fill(self,"runCase",{},globals.TestCase)})},
  38334. args: [],
  38335. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  38336. messageSends: ["start", "testCase:"],
  38337. referencedClasses: ["TestContext"]
  38338. }),
  38339. globals.TestCase);
  38340. smalltalk.addMethod(
  38341. smalltalk.method({
  38342. selector: "selector",
  38343. protocol: 'accessing',
  38344. fn: function (){
  38345. var self=this;
  38346. var $1;
  38347. $1=self["@testSelector"];
  38348. return $1;
  38349. },
  38350. args: [],
  38351. source: "selector\x0a\x09^ testSelector",
  38352. messageSends: [],
  38353. referencedClasses: []
  38354. }),
  38355. globals.TestCase);
  38356. smalltalk.addMethod(
  38357. smalltalk.method({
  38358. selector: "setTestSelector:",
  38359. protocol: 'accessing',
  38360. fn: function (aSelector){
  38361. var self=this;
  38362. self["@testSelector"]=aSelector;
  38363. return self},
  38364. args: ["aSelector"],
  38365. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  38366. messageSends: [],
  38367. referencedClasses: []
  38368. }),
  38369. globals.TestCase);
  38370. smalltalk.addMethod(
  38371. smalltalk.method({
  38372. selector: "setUp",
  38373. protocol: 'running',
  38374. fn: function (){
  38375. var self=this;
  38376. return self},
  38377. args: [],
  38378. source: "setUp",
  38379. messageSends: [],
  38380. referencedClasses: []
  38381. }),
  38382. globals.TestCase);
  38383. smalltalk.addMethod(
  38384. smalltalk.method({
  38385. selector: "should:",
  38386. protocol: 'testing',
  38387. fn: function (aBlock){
  38388. var self=this;
  38389. return smalltalk.withContext(function($ctx1) {
  38390. self._assert_(_st(aBlock)._value());
  38391. return self}, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},globals.TestCase)})},
  38392. args: ["aBlock"],
  38393. source: "should: aBlock\x0a\x09self assert: aBlock value",
  38394. messageSends: ["assert:", "value"],
  38395. referencedClasses: []
  38396. }),
  38397. globals.TestCase);
  38398. smalltalk.addMethod(
  38399. smalltalk.method({
  38400. selector: "should:raise:",
  38401. protocol: 'testing',
  38402. fn: function (aBlock,anExceptionClass){
  38403. var self=this;
  38404. return smalltalk.withContext(function($ctx1) {
  38405. self._assert_(_st((function(){
  38406. return smalltalk.withContext(function($ctx2) {
  38407. _st(aBlock)._value();
  38408. return false;
  38409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_(anExceptionClass,(function(ex){
  38410. return true;
  38411. })));
  38412. return self}, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)})},
  38413. args: ["aBlock", "anExceptionClass"],
  38414. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  38415. messageSends: ["assert:", "on:do:", "value"],
  38416. referencedClasses: []
  38417. }),
  38418. globals.TestCase);
  38419. smalltalk.addMethod(
  38420. smalltalk.method({
  38421. selector: "shouldnt:raise:",
  38422. protocol: 'testing',
  38423. fn: function (aBlock,anExceptionClass){
  38424. var self=this;
  38425. return smalltalk.withContext(function($ctx1) {
  38426. self._assert_(_st((function(){
  38427. return smalltalk.withContext(function($ctx2) {
  38428. _st(aBlock)._value();
  38429. return true;
  38430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_(anExceptionClass,(function(ex){
  38431. return false;
  38432. })));
  38433. return self}, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)})},
  38434. args: ["aBlock", "anExceptionClass"],
  38435. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  38436. messageSends: ["assert:", "on:do:", "value"],
  38437. referencedClasses: []
  38438. }),
  38439. globals.TestCase);
  38440. smalltalk.addMethod(
  38441. smalltalk.method({
  38442. selector: "signalFailure:",
  38443. protocol: 'private',
  38444. fn: function (aString){
  38445. var self=this;
  38446. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  38447. return smalltalk.withContext(function($ctx1) {
  38448. var $1,$2;
  38449. $1=_st($TestFailure())._new();
  38450. _st($1)._messageText_(aString);
  38451. $2=_st($1)._signal();
  38452. return self}, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},globals.TestCase)})},
  38453. args: ["aString"],
  38454. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  38455. messageSends: ["messageText:", "new", "signal"],
  38456. referencedClasses: ["TestFailure"]
  38457. }),
  38458. globals.TestCase);
  38459. smalltalk.addMethod(
  38460. smalltalk.method({
  38461. selector: "tearDown",
  38462. protocol: 'running',
  38463. fn: function (){
  38464. var self=this;
  38465. return self},
  38466. args: [],
  38467. source: "tearDown",
  38468. messageSends: [],
  38469. referencedClasses: []
  38470. }),
  38471. globals.TestCase);
  38472. smalltalk.addMethod(
  38473. smalltalk.method({
  38474. selector: "timeout:",
  38475. protocol: 'async',
  38476. fn: function (aNumber){
  38477. var self=this;
  38478. return smalltalk.withContext(function($ctx1) {
  38479. var $1,$receiver;
  38480. $1=self["@asyncTimeout"];
  38481. if(($receiver = $1) == null || $receiver.isNil){
  38482. $1;
  38483. } else {
  38484. _st(self["@asyncTimeout"])._clearTimeout();
  38485. };
  38486. self["@asyncTimeout"]=(0);
  38487. self["@asyncTimeout"]=_st(self._async_((function(){
  38488. return smalltalk.withContext(function($ctx2) {
  38489. return self._assert_description_(false,"SUnit grace time exhausted");
  38490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})))._valueWithTimeout_(aNumber);
  38491. return self}, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},globals.TestCase)})},
  38492. args: ["aNumber"],
  38493. source: "timeout: aNumber\x0a\x09\x22Set a grace time timeout in milliseconds to run the test asynchronously\x22\x0a\x09\x0a\x09asyncTimeout ifNotNil: [ asyncTimeout clearTimeout ].\x0a\x09\x0a\x09\x22to allow #async: message send without throwing an error\x22\x0a\x09asyncTimeout := 0.\x0a\x09\x0a\x09asyncTimeout := (self async: [\x0a\x09\x09self assert: false description: 'SUnit grace time exhausted' ])\x0a\x09\x09\x09valueWithTimeout: aNumber",
  38494. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"],
  38495. referencedClasses: []
  38496. }),
  38497. globals.TestCase);
  38498. smalltalk.addMethod(
  38499. smalltalk.method({
  38500. selector: "allTestSelectors",
  38501. protocol: 'accessing',
  38502. fn: function (){
  38503. var self=this;
  38504. var selectors;
  38505. return smalltalk.withContext(function($ctx1) {
  38506. var $1,$2;
  38507. selectors=self._testSelectors();
  38508. $1=self._shouldInheritSelectors();
  38509. if(smalltalk.assert($1)){
  38510. _st(selectors)._addAll_(_st(self._superclass())._allTestSelectors());
  38511. };
  38512. $2=selectors;
  38513. return $2;
  38514. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},globals.TestCase.klass)})},
  38515. args: [],
  38516. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  38517. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"],
  38518. referencedClasses: []
  38519. }),
  38520. globals.TestCase.klass);
  38521. smalltalk.addMethod(
  38522. smalltalk.method({
  38523. selector: "buildSuite",
  38524. protocol: 'accessing',
  38525. fn: function (){
  38526. var self=this;
  38527. return smalltalk.withContext(function($ctx1) {
  38528. var $1;
  38529. $1=_st(self._allTestSelectors())._collect_((function(each){
  38530. return smalltalk.withContext(function($ctx2) {
  38531. return self._selector_(each);
  38532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  38533. return $1;
  38534. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},globals.TestCase.klass)})},
  38535. args: [],
  38536. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  38537. messageSends: ["collect:", "allTestSelectors", "selector:"],
  38538. referencedClasses: []
  38539. }),
  38540. globals.TestCase.klass);
  38541. smalltalk.addMethod(
  38542. smalltalk.method({
  38543. selector: "heliosClass",
  38544. protocol: 'helios',
  38545. fn: function (){
  38546. var self=this;
  38547. return "test";
  38548. },
  38549. args: [],
  38550. source: "heliosClass\x0a\x09^ 'test'",
  38551. messageSends: [],
  38552. referencedClasses: []
  38553. }),
  38554. globals.TestCase.klass);
  38555. smalltalk.addMethod(
  38556. smalltalk.method({
  38557. selector: "isAbstract",
  38558. protocol: 'testing',
  38559. fn: function (){
  38560. var self=this;
  38561. return smalltalk.withContext(function($ctx1) {
  38562. var $1;
  38563. $1=_st(self._name()).__eq("TestCase");
  38564. return $1;
  38565. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.TestCase.klass)})},
  38566. args: [],
  38567. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  38568. messageSends: ["=", "name"],
  38569. referencedClasses: []
  38570. }),
  38571. globals.TestCase.klass);
  38572. smalltalk.addMethod(
  38573. smalltalk.method({
  38574. selector: "lookupHierarchyRoot",
  38575. protocol: 'accessing',
  38576. fn: function (){
  38577. var self=this;
  38578. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  38579. return $TestCase();
  38580. },
  38581. args: [],
  38582. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  38583. messageSends: [],
  38584. referencedClasses: ["TestCase"]
  38585. }),
  38586. globals.TestCase.klass);
  38587. smalltalk.addMethod(
  38588. smalltalk.method({
  38589. selector: "selector:",
  38590. protocol: 'accessing',
  38591. fn: function (aSelector){
  38592. var self=this;
  38593. return smalltalk.withContext(function($ctx1) {
  38594. var $2,$3,$1;
  38595. $2=self._new();
  38596. _st($2)._setTestSelector_(aSelector);
  38597. $3=_st($2)._yourself();
  38598. $1=$3;
  38599. return $1;
  38600. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},globals.TestCase.klass)})},
  38601. args: ["aSelector"],
  38602. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  38603. messageSends: ["setTestSelector:", "new", "yourself"],
  38604. referencedClasses: []
  38605. }),
  38606. globals.TestCase.klass);
  38607. smalltalk.addMethod(
  38608. smalltalk.method({
  38609. selector: "shouldInheritSelectors",
  38610. protocol: 'testing',
  38611. fn: function (){
  38612. var self=this;
  38613. return smalltalk.withContext(function($ctx1) {
  38614. var $1;
  38615. $1=self.__tild_eq(self._lookupHierarchyRoot());
  38616. return $1;
  38617. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},globals.TestCase.klass)})},
  38618. args: [],
  38619. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  38620. messageSends: ["~=", "lookupHierarchyRoot"],
  38621. referencedClasses: []
  38622. }),
  38623. globals.TestCase.klass);
  38624. smalltalk.addMethod(
  38625. smalltalk.method({
  38626. selector: "testSelectors",
  38627. protocol: 'accessing',
  38628. fn: function (){
  38629. var self=this;
  38630. return smalltalk.withContext(function($ctx1) {
  38631. var $1;
  38632. $1=_st(_st(self._methodDictionary())._keys())._select_((function(each){
  38633. return smalltalk.withContext(function($ctx2) {
  38634. return _st(each)._match_("^test");
  38635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  38636. return $1;
  38637. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},globals.TestCase.klass)})},
  38638. args: [],
  38639. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  38640. messageSends: ["select:", "keys", "methodDictionary", "match:"],
  38641. referencedClasses: []
  38642. }),
  38643. globals.TestCase.klass);
  38644. smalltalk.addClass('TestContext', globals.Object, ['testCase'], 'SUnit');
  38645. globals.TestContext.comment="I govern running a particular test case.\x0a\x0aMy main added value is `#execute:` method which runs a block as a part of test case (restores context, nilling it afterwards, cleaning/calling `#tearDown` as appropriate for sync/async scenario).";
  38646. smalltalk.addMethod(
  38647. smalltalk.method({
  38648. selector: "execute:",
  38649. protocol: 'running',
  38650. fn: function (aBlock){
  38651. var self=this;
  38652. var failed;
  38653. return smalltalk.withContext(function($ctx1) {
  38654. var $1,$2;
  38655. _st(self["@testCase"])._context_(self);
  38656. $ctx1.sendIdx["context:"]=1;
  38657. _st((function(){
  38658. return smalltalk.withContext(function($ctx2) {
  38659. failed=true;
  38660. failed;
  38661. _st(aBlock)._value();
  38662. failed=false;
  38663. return failed;
  38664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  38665. return smalltalk.withContext(function($ctx2) {
  38666. _st(self["@testCase"])._context_(nil);
  38667. $1=_st(failed)._and_((function(){
  38668. return smalltalk.withContext(function($ctx3) {
  38669. return _st(self["@testCase"])._isAsync();
  38670. $ctx3.sendIdx["isAsync"]=1;
  38671. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  38672. if(smalltalk.assert($1)){
  38673. _st(self["@testCase"])._finished();
  38674. };
  38675. $2=_st(self["@testCase"])._isAsync();
  38676. if(! smalltalk.assert($2)){
  38677. return _st(self["@testCase"])._tearDown();
  38678. };
  38679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  38680. return self}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},globals.TestContext)})},
  38681. args: ["aBlock"],
  38682. source: "execute: aBlock\x0a\x09| failed |\x0a\x09\x0a\x09testCase context: self.\x0a\x09[\x0a\x09\x09failed := true.\x0a\x09\x09aBlock value.\x0a\x09\x09failed := false\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase context: nil.\x0a\x09\x09\x09\x0a\x09\x09\x09(failed and: [ testCase isAsync ]) ifTrue: [\x0a\x09\x09\x09\x09testCase finished ].\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09testCase tearDown ] ]",
  38683. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"],
  38684. referencedClasses: []
  38685. }),
  38686. globals.TestContext);
  38687. smalltalk.addMethod(
  38688. smalltalk.method({
  38689. selector: "start",
  38690. protocol: 'running',
  38691. fn: function (){
  38692. var self=this;
  38693. return smalltalk.withContext(function($ctx1) {
  38694. self._execute_((function(){
  38695. return smalltalk.withContext(function($ctx2) {
  38696. _st(self["@testCase"])._setUp();
  38697. return _st(self["@testCase"])._performTest();
  38698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  38699. return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.TestContext)})},
  38700. args: [],
  38701. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  38702. messageSends: ["execute:", "setUp", "performTest"],
  38703. referencedClasses: []
  38704. }),
  38705. globals.TestContext);
  38706. smalltalk.addMethod(
  38707. smalltalk.method({
  38708. selector: "testCase:",
  38709. protocol: 'accessing',
  38710. fn: function (aTestCase){
  38711. var self=this;
  38712. self["@testCase"]=aTestCase;
  38713. return self},
  38714. args: ["aTestCase"],
  38715. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  38716. messageSends: [],
  38717. referencedClasses: []
  38718. }),
  38719. globals.TestContext);
  38720. smalltalk.addMethod(
  38721. smalltalk.method({
  38722. selector: "testCase:",
  38723. protocol: 'instance creation',
  38724. fn: function (aTestCase){
  38725. var self=this;
  38726. return smalltalk.withContext(function($ctx1) {
  38727. var $2,$3,$1;
  38728. $2=self._new();
  38729. _st($2)._testCase_(aTestCase);
  38730. $3=_st($2)._yourself();
  38731. $1=$3;
  38732. return $1;
  38733. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},globals.TestContext.klass)})},
  38734. args: ["aTestCase"],
  38735. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  38736. messageSends: ["testCase:", "new", "yourself"],
  38737. referencedClasses: []
  38738. }),
  38739. globals.TestContext.klass);
  38740. smalltalk.addClass('ReportingTestContext', globals.TestContext, ['finished', 'result'], 'SUnit');
  38741. globals.ReportingTestContext.comment="I add `TestResult` reporting to `TestContext`.\x0a\x0aErrors are caught and save into a `TestResult`,\x0aWhen test case is finished (which can be later for async tests), a callback block is executed; this is used by a `TestSuiteRunner`.";
  38742. smalltalk.addMethod(
  38743. smalltalk.method({
  38744. selector: "execute:",
  38745. protocol: 'running',
  38746. fn: function (aBlock){
  38747. var self=this;
  38748. return smalltalk.withContext(function($ctx1) {
  38749. var $1;
  38750. _st((function(){
  38751. return smalltalk.withContext(function($ctx2) {
  38752. return self._withErrorReporting_((function(){
  38753. return smalltalk.withContext(function($ctx3) {
  38754. return ($ctx3.supercall = true, globals.ReportingTestContext.superclass.fn.prototype._execute_.apply(_st(self), [aBlock]));
  38755. $ctx3.supercall = false;
  38756. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  38757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  38758. return smalltalk.withContext(function($ctx2) {
  38759. $1=_st(self["@testCase"])._isAsync();
  38760. if(! smalltalk.assert($1)){
  38761. _st(self["@result"])._increaseRuns();
  38762. return _st(self["@finished"])._value();
  38763. };
  38764. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  38765. return self}, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},globals.ReportingTestContext)})},
  38766. args: ["aBlock"],
  38767. source: "execute: aBlock\x0a\x09[\x0a\x09\x09self withErrorReporting: [ super execute: aBlock ]\x0a\x09]\x0a\x09\x09ensure: [\x0a\x09\x09\x09testCase isAsync ifFalse: [\x0a\x09\x09\x09\x09result increaseRuns. finished value ] ]",
  38768. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"],
  38769. referencedClasses: []
  38770. }),
  38771. globals.ReportingTestContext);
  38772. smalltalk.addMethod(
  38773. smalltalk.method({
  38774. selector: "finished:",
  38775. protocol: 'accessing',
  38776. fn: function (aBlock){
  38777. var self=this;
  38778. self["@finished"]=aBlock;
  38779. return self},
  38780. args: ["aBlock"],
  38781. source: "finished: aBlock\x0a\x09finished := aBlock",
  38782. messageSends: [],
  38783. referencedClasses: []
  38784. }),
  38785. globals.ReportingTestContext);
  38786. smalltalk.addMethod(
  38787. smalltalk.method({
  38788. selector: "result:",
  38789. protocol: 'accessing',
  38790. fn: function (aTestResult){
  38791. var self=this;
  38792. self["@result"]=aTestResult;
  38793. return self},
  38794. args: ["aTestResult"],
  38795. source: "result: aTestResult\x0a\x09result := aTestResult",
  38796. messageSends: [],
  38797. referencedClasses: []
  38798. }),
  38799. globals.ReportingTestContext);
  38800. smalltalk.addMethod(
  38801. smalltalk.method({
  38802. selector: "withErrorReporting:",
  38803. protocol: 'private',
  38804. fn: function (aBlock){
  38805. var self=this;
  38806. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  38807. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  38808. return smalltalk.withContext(function($ctx1) {
  38809. _st((function(){
  38810. return smalltalk.withContext(function($ctx2) {
  38811. return _st(aBlock)._on_do_($TestFailure(),(function(ex){
  38812. return smalltalk.withContext(function($ctx3) {
  38813. return _st(self["@result"])._addFailure_(self["@testCase"]);
  38814. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)})}));
  38815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  38816. return smalltalk.withContext(function($ctx2) {
  38817. return _st(self["@result"])._addError_(self["@testCase"]);
  38818. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)})}));
  38819. $ctx1.sendIdx["on:do:"]=1;
  38820. return self}, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},globals.ReportingTestContext)})},
  38821. args: ["aBlock"],
  38822. source: "withErrorReporting: aBlock\x0a\x09[ aBlock\x0a\x09\x09on: TestFailure\x0a\x09\x09do: [ :ex | result addFailure: testCase ]\x0a\x09]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :ex | result addError: testCase ]",
  38823. messageSends: ["on:do:", "addFailure:", "addError:"],
  38824. referencedClasses: ["TestFailure", "Error"]
  38825. }),
  38826. globals.ReportingTestContext);
  38827. smalltalk.addMethod(
  38828. smalltalk.method({
  38829. selector: "testCase:result:finished:",
  38830. protocol: 'instance creation',
  38831. fn: function (aTestCase,aTestResult,aBlock){
  38832. var self=this;
  38833. return smalltalk.withContext(function($ctx1) {
  38834. var $2,$3,$1;
  38835. $2=($ctx1.supercall = true, globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply(_st(self), [aTestCase]));
  38836. $ctx1.supercall = false;
  38837. _st($2)._result_(aTestResult);
  38838. _st($2)._finished_(aBlock);
  38839. $3=_st($2)._yourself();
  38840. $1=$3;
  38841. return $1;
  38842. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},globals.ReportingTestContext.klass)})},
  38843. args: ["aTestCase", "aTestResult", "aBlock"],
  38844. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  38845. messageSends: ["result:", "testCase:", "finished:", "yourself"],
  38846. referencedClasses: []
  38847. }),
  38848. globals.ReportingTestContext.klass);
  38849. smalltalk.addClass('TestFailure', globals.Error, [], 'SUnit');
  38850. globals.TestFailure.comment="I am raised when the boolean parameter of an #`assert:` or `#deny:` call is the opposite of what the assertion claims.\x0a\x0aThe test framework distinguishes between failures and errors.\x0aA failure is an event whose possibiity is explicitly anticipated and checked for in an assertion,\x0awhereas an error is an unanticipated problem like a division by 0 or an index out of bounds.";
  38851. smalltalk.addClass('TestResult', globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  38852. globals.TestResult.comment="I implement the collecting parameter pattern for running a bunch of tests.\x0a\x0aMy instances hold tests that have run, sorted into the result categories of passed, failures and errors.\x0a\x0a`TestResult` is an interesting object to subclass or substitute. `#runCase:` is the external protocol you need to reproduce";
  38853. smalltalk.addMethod(
  38854. smalltalk.method({
  38855. selector: "addError:",
  38856. protocol: 'accessing',
  38857. fn: function (anError){
  38858. var self=this;
  38859. return smalltalk.withContext(function($ctx1) {
  38860. _st(self._errors())._add_(anError);
  38861. return self}, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},globals.TestResult)})},
  38862. args: ["anError"],
  38863. source: "addError: anError\x0a\x09self errors add: anError",
  38864. messageSends: ["add:", "errors"],
  38865. referencedClasses: []
  38866. }),
  38867. globals.TestResult);
  38868. smalltalk.addMethod(
  38869. smalltalk.method({
  38870. selector: "addFailure:",
  38871. protocol: 'accessing',
  38872. fn: function (aFailure){
  38873. var self=this;
  38874. return smalltalk.withContext(function($ctx1) {
  38875. _st(self._failures())._add_(aFailure);
  38876. return self}, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},globals.TestResult)})},
  38877. args: ["aFailure"],
  38878. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  38879. messageSends: ["add:", "failures"],
  38880. referencedClasses: []
  38881. }),
  38882. globals.TestResult);
  38883. smalltalk.addMethod(
  38884. smalltalk.method({
  38885. selector: "errors",
  38886. protocol: 'accessing',
  38887. fn: function (){
  38888. var self=this;
  38889. var $1;
  38890. $1=self["@errors"];
  38891. return $1;
  38892. },
  38893. args: [],
  38894. source: "errors\x0a\x09^ errors",
  38895. messageSends: [],
  38896. referencedClasses: []
  38897. }),
  38898. globals.TestResult);
  38899. smalltalk.addMethod(
  38900. smalltalk.method({
  38901. selector: "failures",
  38902. protocol: 'accessing',
  38903. fn: function (){
  38904. var self=this;
  38905. var $1;
  38906. $1=self["@failures"];
  38907. return $1;
  38908. },
  38909. args: [],
  38910. source: "failures\x0a\x09^ failures",
  38911. messageSends: [],
  38912. referencedClasses: []
  38913. }),
  38914. globals.TestResult);
  38915. smalltalk.addMethod(
  38916. smalltalk.method({
  38917. selector: "increaseRuns",
  38918. protocol: 'accessing',
  38919. fn: function (){
  38920. var self=this;
  38921. return smalltalk.withContext(function($ctx1) {
  38922. self["@runs"]=_st(self["@runs"]).__plus((1));
  38923. return self}, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},globals.TestResult)})},
  38924. args: [],
  38925. source: "increaseRuns\x0a\x09runs := runs + 1",
  38926. messageSends: ["+"],
  38927. referencedClasses: []
  38928. }),
  38929. globals.TestResult);
  38930. smalltalk.addMethod(
  38931. smalltalk.method({
  38932. selector: "initialize",
  38933. protocol: 'initialization',
  38934. fn: function (){
  38935. var self=this;
  38936. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  38937. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  38938. return smalltalk.withContext(function($ctx1) {
  38939. ($ctx1.supercall = true, globals.TestResult.superclass.fn.prototype._initialize.apply(_st(self), []));
  38940. $ctx1.supercall = false;
  38941. self["@timestamp"]=_st($Date())._now();
  38942. self["@runs"]=(0);
  38943. self["@errors"]=_st($Array())._new();
  38944. $ctx1.sendIdx["new"]=1;
  38945. self["@failures"]=_st($Array())._new();
  38946. self["@total"]=(0);
  38947. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestResult)})},
  38948. args: [],
  38949. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  38950. messageSends: ["initialize", "now", "new"],
  38951. referencedClasses: ["Date", "Array"]
  38952. }),
  38953. globals.TestResult);
  38954. smalltalk.addMethod(
  38955. smalltalk.method({
  38956. selector: "nextRunDo:",
  38957. protocol: 'running',
  38958. fn: function (aBlock){
  38959. var self=this;
  38960. return smalltalk.withContext(function($ctx1) {
  38961. var $3,$2,$1;
  38962. $3=self._runs();
  38963. $ctx1.sendIdx["runs"]=1;
  38964. $2=_st($3).__eq_eq(self._total());
  38965. if(! smalltalk.assert($2)){
  38966. $1=_st(aBlock)._value_(_st(self._runs()).__plus((1)));
  38967. };
  38968. return $1;
  38969. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},globals.TestResult)})},
  38970. args: ["aBlock"],
  38971. source: "nextRunDo: aBlock\x0a\x09\x22Runs aBlock with index of next run or does nothing if no more runs\x22\x0a\x09^ self runs == self total\x0a\x09\x09ifFalse: [ aBlock value: self runs + 1 ]",
  38972. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"],
  38973. referencedClasses: []
  38974. }),
  38975. globals.TestResult);
  38976. smalltalk.addMethod(
  38977. smalltalk.method({
  38978. selector: "runCase:",
  38979. protocol: 'running',
  38980. fn: function (aTestCase){
  38981. var self=this;
  38982. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  38983. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  38984. return smalltalk.withContext(function($ctx1) {
  38985. _st((function(){
  38986. return smalltalk.withContext(function($ctx2) {
  38987. return _st((function(){
  38988. return smalltalk.withContext(function($ctx3) {
  38989. self._increaseRuns();
  38990. return _st(aTestCase)._runCase();
  38991. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($TestFailure(),(function(ex){
  38992. return smalltalk.withContext(function($ctx3) {
  38993. return self._addFailure_(aTestCase);
  38994. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  38995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  38996. return smalltalk.withContext(function($ctx2) {
  38997. return self._addError_(aTestCase);
  38998. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)})}));
  38999. $ctx1.sendIdx["on:do:"]=1;
  39000. return self}, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},globals.TestResult)})},
  39001. args: ["aTestCase"],
  39002. source: "runCase: aTestCase\x0a\x09[ [ self increaseRuns.\x0a\x09\x09aTestCase runCase ]\x0a\x09on: TestFailure do: [ :ex | self addFailure: aTestCase ]]\x0a\x09on: Error do: [ :ex | self addError: aTestCase ]",
  39003. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"],
  39004. referencedClasses: ["TestFailure", "Error"]
  39005. }),
  39006. globals.TestResult);
  39007. smalltalk.addMethod(
  39008. smalltalk.method({
  39009. selector: "runs",
  39010. protocol: 'accessing',
  39011. fn: function (){
  39012. var self=this;
  39013. var $1;
  39014. $1=self["@runs"];
  39015. return $1;
  39016. },
  39017. args: [],
  39018. source: "runs\x0a\x09^ runs",
  39019. messageSends: [],
  39020. referencedClasses: []
  39021. }),
  39022. globals.TestResult);
  39023. smalltalk.addMethod(
  39024. smalltalk.method({
  39025. selector: "status",
  39026. protocol: 'accessing',
  39027. fn: function (){
  39028. var self=this;
  39029. return smalltalk.withContext(function($ctx1) {
  39030. var $2,$3,$1;
  39031. $2=_st(self._errors())._isEmpty();
  39032. $ctx1.sendIdx["isEmpty"]=1;
  39033. if(smalltalk.assert($2)){
  39034. $3=_st(self._failures())._isEmpty();
  39035. if(smalltalk.assert($3)){
  39036. $1="success";
  39037. } else {
  39038. $1="failure";
  39039. };
  39040. } else {
  39041. $1="error";
  39042. };
  39043. return $1;
  39044. }, function($ctx1) {$ctx1.fill(self,"status",{},globals.TestResult)})},
  39045. args: [],
  39046. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  39047. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"],
  39048. referencedClasses: []
  39049. }),
  39050. globals.TestResult);
  39051. smalltalk.addMethod(
  39052. smalltalk.method({
  39053. selector: "timestamp",
  39054. protocol: 'accessing',
  39055. fn: function (){
  39056. var self=this;
  39057. var $1;
  39058. $1=self["@timestamp"];
  39059. return $1;
  39060. },
  39061. args: [],
  39062. source: "timestamp\x0a\x09^ timestamp",
  39063. messageSends: [],
  39064. referencedClasses: []
  39065. }),
  39066. globals.TestResult);
  39067. smalltalk.addMethod(
  39068. smalltalk.method({
  39069. selector: "total",
  39070. protocol: 'accessing',
  39071. fn: function (){
  39072. var self=this;
  39073. var $1;
  39074. $1=self["@total"];
  39075. return $1;
  39076. },
  39077. args: [],
  39078. source: "total\x0a\x09^ total",
  39079. messageSends: [],
  39080. referencedClasses: []
  39081. }),
  39082. globals.TestResult);
  39083. smalltalk.addMethod(
  39084. smalltalk.method({
  39085. selector: "total:",
  39086. protocol: 'accessing',
  39087. fn: function (aNumber){
  39088. var self=this;
  39089. self["@total"]=aNumber;
  39090. return self},
  39091. args: ["aNumber"],
  39092. source: "total: aNumber\x0a\x09total := aNumber",
  39093. messageSends: [],
  39094. referencedClasses: []
  39095. }),
  39096. globals.TestResult);
  39097. smalltalk.addClass('TestSuiteRunner', globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  39098. globals.TestSuiteRunner.comment="I am responsible for running a collection (`suite`) of tests.\x0a\x0a## API\x0a\x0aInstances should be created using the class-side `#on:` method, taking a collection of tests to run as parameter.\x0aTo run the test suite, use `#run`.";
  39099. smalltalk.addMethod(
  39100. smalltalk.method({
  39101. selector: "announcer",
  39102. protocol: 'accessing',
  39103. fn: function (){
  39104. var self=this;
  39105. var $1;
  39106. $1=self["@announcer"];
  39107. return $1;
  39108. },
  39109. args: [],
  39110. source: "announcer\x0a\x09^ announcer",
  39111. messageSends: [],
  39112. referencedClasses: []
  39113. }),
  39114. globals.TestSuiteRunner);
  39115. smalltalk.addMethod(
  39116. smalltalk.method({
  39117. selector: "contextOf:",
  39118. protocol: 'private',
  39119. fn: function (anInteger){
  39120. var self=this;
  39121. function $ReportingTestContext(){return globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  39122. return smalltalk.withContext(function($ctx1) {
  39123. var $1;
  39124. $1=_st($ReportingTestContext())._testCase_result_finished_(_st(self["@suite"])._at_(anInteger),self["@result"],(function(){
  39125. return smalltalk.withContext(function($ctx2) {
  39126. return self._resume();
  39127. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  39128. return $1;
  39129. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},globals.TestSuiteRunner)})},
  39130. args: ["anInteger"],
  39131. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  39132. messageSends: ["testCase:result:finished:", "at:", "resume"],
  39133. referencedClasses: ["ReportingTestContext"]
  39134. }),
  39135. globals.TestSuiteRunner);
  39136. smalltalk.addMethod(
  39137. smalltalk.method({
  39138. selector: "initialize",
  39139. protocol: 'initialization',
  39140. fn: function (){
  39141. var self=this;
  39142. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  39143. function $TestResult(){return globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  39144. return smalltalk.withContext(function($ctx1) {
  39145. var $1;
  39146. ($ctx1.supercall = true, globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply(_st(self), []));
  39147. $ctx1.supercall = false;
  39148. self["@announcer"]=_st($Announcer())._new();
  39149. $ctx1.sendIdx["new"]=1;
  39150. self["@result"]=_st($TestResult())._new();
  39151. self["@runNextTest"]=(function(){
  39152. var runs;
  39153. return smalltalk.withContext(function($ctx2) {
  39154. runs=_st(self["@result"])._runs();
  39155. runs;
  39156. $1=_st(runs).__lt(_st(self["@result"])._total());
  39157. if(smalltalk.assert($1)){
  39158. return _st(self._contextOf_(_st(runs).__plus((1))))._start();
  39159. };
  39160. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)})});
  39161. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestSuiteRunner)})},
  39162. args: [],
  39163. source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a\x09result := TestResult new.\x0a\x09runNextTest := [ | runs | runs := result runs. runs < result total ifTrue: [ (self contextOf: runs + 1) start ] ].",
  39164. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"],
  39165. referencedClasses: ["Announcer", "TestResult"]
  39166. }),
  39167. globals.TestSuiteRunner);
  39168. smalltalk.addMethod(
  39169. smalltalk.method({
  39170. selector: "result",
  39171. protocol: 'accessing',
  39172. fn: function (){
  39173. var self=this;
  39174. var $1;
  39175. $1=self["@result"];
  39176. return $1;
  39177. },
  39178. args: [],
  39179. source: "result\x0a\x09^ result",
  39180. messageSends: [],
  39181. referencedClasses: []
  39182. }),
  39183. globals.TestSuiteRunner);
  39184. smalltalk.addMethod(
  39185. smalltalk.method({
  39186. selector: "resume",
  39187. protocol: 'actions',
  39188. fn: function (){
  39189. var self=this;
  39190. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  39191. return smalltalk.withContext(function($ctx1) {
  39192. _st(self["@runNextTest"])._fork();
  39193. _st(self["@announcer"])._announce_(_st(_st($ResultAnnouncement())._new())._result_(self["@result"]));
  39194. return self}, function($ctx1) {$ctx1.fill(self,"resume",{},globals.TestSuiteRunner)})},
  39195. args: [],
  39196. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  39197. messageSends: ["fork", "announce:", "result:", "new"],
  39198. referencedClasses: ["ResultAnnouncement"]
  39199. }),
  39200. globals.TestSuiteRunner);
  39201. smalltalk.addMethod(
  39202. smalltalk.method({
  39203. selector: "run",
  39204. protocol: 'actions',
  39205. fn: function (){
  39206. var self=this;
  39207. return smalltalk.withContext(function($ctx1) {
  39208. _st(self["@result"])._total_(_st(self["@suite"])._size());
  39209. self._resume();
  39210. return self}, function($ctx1) {$ctx1.fill(self,"run",{},globals.TestSuiteRunner)})},
  39211. args: [],
  39212. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  39213. messageSends: ["total:", "size", "resume"],
  39214. referencedClasses: []
  39215. }),
  39216. globals.TestSuiteRunner);
  39217. smalltalk.addMethod(
  39218. smalltalk.method({
  39219. selector: "suite:",
  39220. protocol: 'accessing',
  39221. fn: function (aCollection){
  39222. var self=this;
  39223. self["@suite"]=aCollection;
  39224. return self},
  39225. args: ["aCollection"],
  39226. source: "suite: aCollection\x0a\x09suite := aCollection",
  39227. messageSends: [],
  39228. referencedClasses: []
  39229. }),
  39230. globals.TestSuiteRunner);
  39231. smalltalk.addMethod(
  39232. smalltalk.method({
  39233. selector: "new",
  39234. protocol: 'instance creation',
  39235. fn: function (){
  39236. var self=this;
  39237. return smalltalk.withContext(function($ctx1) {
  39238. self._shouldNotImplement();
  39239. return self}, function($ctx1) {$ctx1.fill(self,"new",{},globals.TestSuiteRunner.klass)})},
  39240. args: [],
  39241. source: "new\x0a\x09self shouldNotImplement",
  39242. messageSends: ["shouldNotImplement"],
  39243. referencedClasses: []
  39244. }),
  39245. globals.TestSuiteRunner.klass);
  39246. smalltalk.addMethod(
  39247. smalltalk.method({
  39248. selector: "on:",
  39249. protocol: 'instance creation',
  39250. fn: function (aCollection){
  39251. var self=this;
  39252. return smalltalk.withContext(function($ctx1) {
  39253. var $2,$1;
  39254. $2=($ctx1.supercall = true, globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply(_st(self), []));
  39255. $ctx1.supercall = false;
  39256. $1=_st($2)._suite_(aCollection);
  39257. return $1;
  39258. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.TestSuiteRunner.klass)})},
  39259. args: ["aCollection"],
  39260. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  39261. messageSends: ["suite:", "new"],
  39262. referencedClasses: []
  39263. }),
  39264. globals.TestSuiteRunner.klass);
  39265. smalltalk.addMethod(
  39266. smalltalk.method({
  39267. selector: "isTestClass",
  39268. protocol: '*SUnit',
  39269. fn: function (){
  39270. var self=this;
  39271. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  39272. return smalltalk.withContext(function($ctx1) {
  39273. var $1;
  39274. $1=_st(self._includesBehavior_($TestCase()))._and_((function(){
  39275. return smalltalk.withContext(function($ctx2) {
  39276. return _st(self._isAbstract())._not();
  39277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  39278. return $1;
  39279. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},globals.Behavior)})},
  39280. args: [],
  39281. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  39282. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"],
  39283. referencedClasses: ["TestCase"]
  39284. }),
  39285. globals.Behavior);
  39286. smalltalk.addMethod(
  39287. smalltalk.method({
  39288. selector: "isTestPackage",
  39289. protocol: '*SUnit',
  39290. fn: function (){
  39291. var self=this;
  39292. return smalltalk.withContext(function($ctx1) {
  39293. var $1;
  39294. $1=_st(self._classes())._anySatisfy_((function(each){
  39295. return smalltalk.withContext(function($ctx2) {
  39296. return _st(each)._isTestClass();
  39297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39298. return $1;
  39299. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},globals.Package)})},
  39300. args: [],
  39301. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  39302. messageSends: ["anySatisfy:", "classes", "isTestClass"],
  39303. referencedClasses: []
  39304. }),
  39305. globals.Package);
  39306. });
  39307. define("amber_core/Kernel-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){
  39308. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  39309. smalltalk.addPackage('Kernel-ImportExport');
  39310. smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39311. smalltalk.addClass('AbstractExporter', globals.Object, [], 'Kernel-ImportExport');
  39312. globals.AbstractExporter.comment="I am an abstract exporter for Amber source code.\x0a\x0a## API\x0a\x0aUse `#exportPackage:on:` to export a given package on a Stream.";
  39313. smalltalk.addMethod(
  39314. smalltalk.method({
  39315. selector: "chunkEscape:",
  39316. protocol: 'convenience',
  39317. fn: function (aString){
  39318. var self=this;
  39319. return smalltalk.withContext(function($ctx1) {
  39320. var $1;
  39321. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  39322. return $1;
  39323. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},globals.AbstractExporter)})},
  39324. args: ["aString"],
  39325. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  39326. messageSends: ["trimBoth", "replace:with:"],
  39327. referencedClasses: []
  39328. }),
  39329. globals.AbstractExporter);
  39330. smalltalk.addMethod(
  39331. smalltalk.method({
  39332. selector: "classNameFor:",
  39333. protocol: 'convenience',
  39334. fn: function (aClass){
  39335. var self=this;
  39336. return smalltalk.withContext(function($ctx1) {
  39337. var $2,$3,$4,$1;
  39338. $2=_st(aClass)._isMetaclass();
  39339. if(smalltalk.assert($2)){
  39340. $3=_st(_st(aClass)._instanceClass())._name();
  39341. $ctx1.sendIdx["name"]=1;
  39342. $1=_st($3).__comma(" class");
  39343. } else {
  39344. $4=_st(aClass)._isNil();
  39345. if(smalltalk.assert($4)){
  39346. $1="nil";
  39347. } else {
  39348. $1=_st(aClass)._name();
  39349. };
  39350. };
  39351. return $1;
  39352. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractExporter)})},
  39353. args: ["aClass"],
  39354. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  39355. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"],
  39356. referencedClasses: []
  39357. }),
  39358. globals.AbstractExporter);
  39359. smalltalk.addMethod(
  39360. smalltalk.method({
  39361. selector: "exportPackage:on:",
  39362. protocol: 'output',
  39363. fn: function (aPackage,aStream){
  39364. var self=this;
  39365. return smalltalk.withContext(function($ctx1) {
  39366. self._subclassResponsibility();
  39367. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.AbstractExporter)})},
  39368. args: ["aPackage", "aStream"],
  39369. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  39370. messageSends: ["subclassResponsibility"],
  39371. referencedClasses: []
  39372. }),
  39373. globals.AbstractExporter);
  39374. smalltalk.addMethod(
  39375. smalltalk.method({
  39376. selector: "extensionMethodsOfPackage:",
  39377. protocol: 'accessing',
  39378. fn: function (aPackage){
  39379. var self=this;
  39380. var result;
  39381. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  39382. return smalltalk.withContext(function($ctx1) {
  39383. var $1;
  39384. result=_st($OrderedCollection())._new();
  39385. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  39386. return smalltalk.withContext(function($ctx2) {
  39387. return _st(result)._addAll_(_st(each)._methods());
  39388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39389. $1=result;
  39390. return $1;
  39391. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},globals.AbstractExporter)})},
  39392. args: ["aPackage"],
  39393. source: "extensionMethodsOfPackage: aPackage\x0a\x09| result |\x0a\x09\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09(self extensionProtocolsOfPackage: aPackage) do: [ :each |\x0a\x09\x09result addAll: each methods ].\x0a\x09\x09\x0a\x09^ result",
  39394. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"],
  39395. referencedClasses: ["OrderedCollection"]
  39396. }),
  39397. globals.AbstractExporter);
  39398. smalltalk.addMethod(
  39399. smalltalk.method({
  39400. selector: "extensionProtocolsOfPackage:",
  39401. protocol: 'accessing',
  39402. fn: function (aPackage){
  39403. var self=this;
  39404. var extensionName,result;
  39405. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  39406. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  39407. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  39408. return smalltalk.withContext(function($ctx1) {
  39409. var $1,$2,$3,$4;
  39410. $1=_st(aPackage)._name();
  39411. $ctx1.sendIdx["name"]=1;
  39412. extensionName="*".__comma($1);
  39413. result=_st($OrderedCollection())._new();
  39414. _st(_st(_st(_st($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  39415. return smalltalk.withContext(function($ctx2) {
  39416. $2=_st(a)._name();
  39417. $ctx2.sendIdx["name"]=2;
  39418. return _st($2).__lt(_st(b)._name());
  39419. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(each){
  39420. return smalltalk.withContext(function($ctx2) {
  39421. return _st([each,_st(each)._class()])._do_((function(behavior){
  39422. return smalltalk.withContext(function($ctx3) {
  39423. $3=_st(_st(behavior)._protocols())._includes_(extensionName);
  39424. if(smalltalk.assert($3)){
  39425. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  39426. };
  39427. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)})}));
  39428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  39429. $ctx1.sendIdx["do:"]=1;
  39430. $4=result;
  39431. return $4;
  39432. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},globals.AbstractExporter)})},
  39433. args: ["aPackage"],
  39434. source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore topological sorting (dependency resolution) does not matter here.\x0a\x09Not sorting topologically improves the speed by a number of magnitude.\x0a\x09\x0a\x09Not to shuffle diffs, classes are sorted by their name.\x22\x0a\x09\x0a\x09(Smalltalk classes asArray sorted: [ :a :b | a name < b name ]) do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
  39435. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
  39436. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
  39437. }),
  39438. globals.AbstractExporter);
  39439. smalltalk.addClass('ChunkExporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  39440. globals.ChunkExporter.comment="I am an exporter dedicated to outputting Amber source code in the classic Smalltalk chunk format.\x0a\x0aI do not output any compiled code.";
  39441. smalltalk.addMethod(
  39442. smalltalk.method({
  39443. selector: "exportCategoryEpilogueOf:on:",
  39444. protocol: 'output',
  39445. fn: function (aCategory,aStream){
  39446. var self=this;
  39447. return smalltalk.withContext(function($ctx1) {
  39448. var $1;
  39449. _st(aStream)._nextPutAll_(" !");
  39450. _st(aStream)._lf();
  39451. $ctx1.sendIdx["lf"]=1;
  39452. $1=_st(aStream)._lf();
  39453. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
  39454. args: ["aCategory", "aStream"],
  39455. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  39456. messageSends: ["nextPutAll:", "lf"],
  39457. referencedClasses: []
  39458. }),
  39459. globals.ChunkExporter);
  39460. smalltalk.addMethod(
  39461. smalltalk.method({
  39462. selector: "exportCategoryPrologueOf:on:",
  39463. protocol: 'output',
  39464. fn: function (aCategory,aStream){
  39465. var self=this;
  39466. return smalltalk.withContext(function($ctx1) {
  39467. var $1,$3,$2;
  39468. $1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
  39469. $ctx1.sendIdx[","]=1;
  39470. _st(aStream)._nextPutAll_($1);
  39471. $ctx1.sendIdx["nextPutAll:"]=1;
  39472. $3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
  39473. $ctx1.sendIdx[","]=2;
  39474. $2=_st(aStream)._nextPutAll_($3);
  39475. return self}, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)})},
  39476. args: ["aCategory", "aStream"],
  39477. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  39478. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  39479. referencedClasses: []
  39480. }),
  39481. globals.ChunkExporter);
  39482. smalltalk.addMethod(
  39483. smalltalk.method({
  39484. selector: "exportDefinitionOf:on:",
  39485. protocol: 'output',
  39486. fn: function (aClass,aStream){
  39487. var self=this;
  39488. return smalltalk.withContext(function($ctx1) {
  39489. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  39490. $1=self._classNameFor_(_st(aClass)._superclass());
  39491. $ctx1.sendIdx["classNameFor:"]=1;
  39492. _st(aStream)._nextPutAll_($1);
  39493. $ctx1.sendIdx["nextPutAll:"]=1;
  39494. $3=self._classNameFor_(aClass);
  39495. $ctx1.sendIdx["classNameFor:"]=2;
  39496. $2=" subclass: #".__comma($3);
  39497. $ctx1.sendIdx[","]=1;
  39498. _st(aStream)._nextPutAll_($2);
  39499. $ctx1.sendIdx["nextPutAll:"]=2;
  39500. _st(aStream)._lf();
  39501. $ctx1.sendIdx["lf"]=1;
  39502. _st(aStream)._tab();
  39503. $ctx1.sendIdx["tab"]=1;
  39504. $4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
  39505. $ctx1.sendIdx["nextPutAll:"]=3;
  39506. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  39507. return smalltalk.withContext(function($ctx2) {
  39508. return _st(aStream)._nextPutAll_(each);
  39509. $ctx2.sendIdx["nextPutAll:"]=4;
  39510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  39511. return smalltalk.withContext(function($ctx2) {
  39512. return _st(aStream)._nextPutAll_(" ");
  39513. $ctx2.sendIdx["nextPutAll:"]=5;
  39514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  39515. _st(aStream)._nextPutAll_("'");
  39516. $ctx1.sendIdx["nextPutAll:"]=6;
  39517. _st(aStream)._lf();
  39518. $ctx1.sendIdx["lf"]=2;
  39519. _st(aStream)._tab();
  39520. $6="package: '".__comma(_st(aClass)._category());
  39521. $ctx1.sendIdx[","]=3;
  39522. $5=_st($6).__comma("'!");
  39523. $ctx1.sendIdx[","]=2;
  39524. _st(aStream)._nextPutAll_($5);
  39525. $ctx1.sendIdx["nextPutAll:"]=7;
  39526. $7=_st(aStream)._lf();
  39527. $ctx1.sendIdx["lf"]=3;
  39528. $9=_st(aClass)._comment();
  39529. $ctx1.sendIdx["comment"]=1;
  39530. $8=_st($9)._notEmpty();
  39531. if(smalltalk.assert($8)){
  39532. $11="!".__comma(self._classNameFor_(aClass));
  39533. $ctx1.sendIdx[","]=5;
  39534. $10=_st($11).__comma(" commentStamp!");
  39535. $ctx1.sendIdx[","]=4;
  39536. _st(aStream)._nextPutAll_($10);
  39537. $ctx1.sendIdx["nextPutAll:"]=8;
  39538. _st(aStream)._lf();
  39539. $ctx1.sendIdx["lf"]=4;
  39540. _st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  39541. $12=_st(aStream)._lf();
  39542. $ctx1.sendIdx["lf"]=5;
  39543. $12;
  39544. };
  39545. _st(aStream)._lf();
  39546. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
  39547. args: ["aClass", "aStream"],
  39548. source: "exportDefinitionOf: aClass on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: (self classNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a\x09\x09tab; nextPutAll: 'instanceVariableNames: '''.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: ''''; lf;\x0a\x09\x09tab; nextPutAll: 'package: ''', aClass category, '''!'; lf.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  39549. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"],
  39550. referencedClasses: []
  39551. }),
  39552. globals.ChunkExporter);
  39553. smalltalk.addMethod(
  39554. smalltalk.method({
  39555. selector: "exportMetaDefinitionOf:on:",
  39556. protocol: 'output',
  39557. fn: function (aClass,aStream){
  39558. var self=this;
  39559. return smalltalk.withContext(function($ctx1) {
  39560. var $3,$2,$1,$5,$4,$6,$7;
  39561. $3=_st(aClass)._class();
  39562. $ctx1.sendIdx["class"]=1;
  39563. $2=_st($3)._instanceVariableNames();
  39564. $ctx1.sendIdx["instanceVariableNames"]=1;
  39565. $1=_st($2)._isEmpty();
  39566. if(! smalltalk.assert($1)){
  39567. $5=_st(aClass)._class();
  39568. $ctx1.sendIdx["class"]=2;
  39569. $4=self._classNameFor_($5);
  39570. _st(aStream)._nextPutAll_($4);
  39571. $ctx1.sendIdx["nextPutAll:"]=1;
  39572. $6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
  39573. $ctx1.sendIdx["nextPutAll:"]=2;
  39574. $6;
  39575. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  39576. return smalltalk.withContext(function($ctx2) {
  39577. return _st(aStream)._nextPutAll_(each);
  39578. $ctx2.sendIdx["nextPutAll:"]=3;
  39579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  39580. return smalltalk.withContext(function($ctx2) {
  39581. return _st(aStream)._nextPutAll_(" ");
  39582. $ctx2.sendIdx["nextPutAll:"]=4;
  39583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  39584. _st(aStream)._nextPutAll_("'!");
  39585. _st(aStream)._lf();
  39586. $ctx1.sendIdx["lf"]=1;
  39587. $7=_st(aStream)._lf();
  39588. $7;
  39589. };
  39590. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)})},
  39591. args: ["aClass", "aStream"],
  39592. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  39593. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"],
  39594. referencedClasses: []
  39595. }),
  39596. globals.ChunkExporter);
  39597. smalltalk.addMethod(
  39598. smalltalk.method({
  39599. selector: "exportMethod:on:",
  39600. protocol: 'output',
  39601. fn: function (aMethod,aStream){
  39602. var self=this;
  39603. return smalltalk.withContext(function($ctx1) {
  39604. var $1;
  39605. _st(aStream)._lf();
  39606. $ctx1.sendIdx["lf"]=1;
  39607. _st(aStream)._lf();
  39608. $ctx1.sendIdx["lf"]=2;
  39609. _st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  39610. $ctx1.sendIdx["nextPutAll:"]=1;
  39611. _st(aStream)._lf();
  39612. $1=_st(aStream)._nextPutAll_("!");
  39613. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.ChunkExporter)})},
  39614. args: ["aMethod", "aStream"],
  39615. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  39616. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
  39617. referencedClasses: []
  39618. }),
  39619. globals.ChunkExporter);
  39620. smalltalk.addMethod(
  39621. smalltalk.method({
  39622. selector: "exportPackage:on:",
  39623. protocol: 'output',
  39624. fn: function (aPackage,aStream){
  39625. var self=this;
  39626. return smalltalk.withContext(function($ctx1) {
  39627. var $1;
  39628. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  39629. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  39630. return smalltalk.withContext(function($ctx2) {
  39631. self._exportDefinitionOf_on_(each,aStream);
  39632. $1=self._ownMethodProtocolsOfClass_(each);
  39633. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  39634. self._exportProtocols_on_($1,aStream);
  39635. $ctx2.sendIdx["exportProtocols:on:"]=1;
  39636. self._exportMetaDefinitionOf_on_(each,aStream);
  39637. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  39638. $ctx2.sendIdx["exportProtocols:on:"]=2;
  39639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39640. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  39641. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
  39642. args: ["aPackage", "aStream"],
  39643. source: "exportPackage: aPackage on: aStream\x0a\x0a\x09self exportPackageDefinitionOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each)\x0a\x09\x09\x09on: aStream.\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09\x0a\x09\x09self \x0a\x09\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: each class)\x0a\x09\x09\x09on: aStream ].\x0a\x09\x09\x09\x0a\x09self \x0a\x09\x09exportProtocols: (self extensionProtocolsOfPackage: aPackage)\x0a\x09\x09on: aStream",
  39644. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"],
  39645. referencedClasses: []
  39646. }),
  39647. globals.ChunkExporter);
  39648. smalltalk.addMethod(
  39649. smalltalk.method({
  39650. selector: "exportPackageDefinitionOf:on:",
  39651. protocol: 'output',
  39652. fn: function (aPackage,aStream){
  39653. var self=this;
  39654. return smalltalk.withContext(function($ctx1) {
  39655. var $1,$2;
  39656. $1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
  39657. $ctx1.sendIdx[","]=1;
  39658. _st(aStream)._nextPutAll_($1);
  39659. $2=_st(aStream)._lf();
  39660. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)})},
  39661. args: ["aPackage", "aStream"],
  39662. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  39663. messageSends: ["nextPutAll:", ",", "name", "lf"],
  39664. referencedClasses: []
  39665. }),
  39666. globals.ChunkExporter);
  39667. smalltalk.addMethod(
  39668. smalltalk.method({
  39669. selector: "exportProtocol:on:",
  39670. protocol: 'output',
  39671. fn: function (aProtocol,aStream){
  39672. var self=this;
  39673. return smalltalk.withContext(function($ctx1) {
  39674. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  39675. _st(_st(aProtocol)._methods())._do_((function(method){
  39676. return smalltalk.withContext(function($ctx2) {
  39677. return self._exportMethod_on_(method,aStream);
  39678. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)})}));
  39679. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  39680. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  39681. args: ["aProtocol", "aStream"],
  39682. source: "exportProtocol: aProtocol on: aStream\x0a\x09self exportProtocolPrologueOf: aProtocol on: aStream.\x0a\x09aProtocol methods do: [ :method | \x0a\x09\x09self exportMethod: method on: aStream ].\x0a\x09self exportProtocolEpilogueOf: aProtocol on: aStream",
  39683. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"],
  39684. referencedClasses: []
  39685. }),
  39686. globals.ChunkExporter);
  39687. smalltalk.addMethod(
  39688. smalltalk.method({
  39689. selector: "exportProtocolEpilogueOf:on:",
  39690. protocol: 'output',
  39691. fn: function (aProtocol,aStream){
  39692. var self=this;
  39693. return smalltalk.withContext(function($ctx1) {
  39694. var $1;
  39695. _st(aStream)._nextPutAll_(" !");
  39696. _st(aStream)._lf();
  39697. $ctx1.sendIdx["lf"]=1;
  39698. $1=_st(aStream)._lf();
  39699. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  39700. args: ["aProtocol", "aStream"],
  39701. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  39702. messageSends: ["nextPutAll:", "lf"],
  39703. referencedClasses: []
  39704. }),
  39705. globals.ChunkExporter);
  39706. smalltalk.addMethod(
  39707. smalltalk.method({
  39708. selector: "exportProtocolPrologueOf:on:",
  39709. protocol: 'output',
  39710. fn: function (aProtocol,aStream){
  39711. var self=this;
  39712. return smalltalk.withContext(function($ctx1) {
  39713. var $1,$3,$2;
  39714. $1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
  39715. $ctx1.sendIdx[","]=1;
  39716. _st(aStream)._nextPutAll_($1);
  39717. $ctx1.sendIdx["nextPutAll:"]=1;
  39718. $3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
  39719. $ctx1.sendIdx[","]=2;
  39720. $2=_st(aStream)._nextPutAll_($3);
  39721. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)})},
  39722. args: ["aProtocol", "aStream"],
  39723. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  39724. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"],
  39725. referencedClasses: []
  39726. }),
  39727. globals.ChunkExporter);
  39728. smalltalk.addMethod(
  39729. smalltalk.method({
  39730. selector: "exportProtocols:on:",
  39731. protocol: 'output',
  39732. fn: function (aCollection,aStream){
  39733. var self=this;
  39734. return smalltalk.withContext(function($ctx1) {
  39735. _st(aCollection)._do_((function(each){
  39736. return smalltalk.withContext(function($ctx2) {
  39737. return self._exportProtocol_on_(each,aStream);
  39738. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39739. return self}, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},globals.ChunkExporter)})},
  39740. args: ["aCollection", "aStream"],
  39741. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  39742. messageSends: ["do:", "exportProtocol:on:"],
  39743. referencedClasses: []
  39744. }),
  39745. globals.ChunkExporter);
  39746. smalltalk.addMethod(
  39747. smalltalk.method({
  39748. selector: "extensionCategoriesOfPackage:",
  39749. protocol: 'accessing',
  39750. fn: function (aPackage){
  39751. var self=this;
  39752. var name,map,result;
  39753. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  39754. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  39755. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  39756. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  39757. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  39758. return smalltalk.withContext(function($ctx1) {
  39759. var $1,$2;
  39760. name=_st(aPackage)._name();
  39761. result=_st($OrderedCollection())._new();
  39762. $ctx1.sendIdx["new"]=1;
  39763. _st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
  39764. return smalltalk.withContext(function($ctx2) {
  39765. return _st([each,_st(each)._class()])._do_((function(aClass){
  39766. return smalltalk.withContext(function($ctx3) {
  39767. map=_st($Dictionary())._new();
  39768. map;
  39769. _st(aClass)._protocolsDo_((function(category,methods){
  39770. return smalltalk.withContext(function($ctx4) {
  39771. $1=_st(category).__eq("*".__comma(name));
  39772. if(smalltalk.assert($1)){
  39773. return _st(map)._at_put_(category,methods);
  39774. };
  39775. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)})}));
  39776. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  39777. return smalltalk.withContext(function($ctx4) {
  39778. return _st(a).__lt_eq(b);
  39779. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)})})))._collect_((function(category){
  39780. return smalltalk.withContext(function($ctx4) {
  39781. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  39782. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)})})));
  39783. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)})}));
  39784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39785. $ctx1.sendIdx["do:"]=1;
  39786. $2=result;
  39787. return $2;
  39788. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},globals.ChunkExporter)})},
  39789. args: ["aPackage"],
  39790. source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
  39791. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  39792. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
  39793. }),
  39794. globals.ChunkExporter);
  39795. smalltalk.addMethod(
  39796. smalltalk.method({
  39797. selector: "ownCategoriesOfClass:",
  39798. protocol: 'accessing',
  39799. fn: function (aClass){
  39800. var self=this;
  39801. var map;
  39802. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  39803. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  39804. return smalltalk.withContext(function($ctx1) {
  39805. var $1,$2;
  39806. map=_st($Dictionary())._new();
  39807. _st(aClass)._protocolsDo_((function(each,methods){
  39808. return smalltalk.withContext(function($ctx2) {
  39809. $1=_st(each)._match_("^\x5c*");
  39810. if(! smalltalk.assert($1)){
  39811. return _st(map)._at_put_(each,methods);
  39812. };
  39813. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)})}));
  39814. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  39815. return smalltalk.withContext(function($ctx2) {
  39816. return _st(a).__lt_eq(b);
  39817. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})})))._collect_((function(each){
  39818. return smalltalk.withContext(function($ctx2) {
  39819. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  39820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  39821. return $2;
  39822. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},globals.ChunkExporter)})},
  39823. args: ["aClass"],
  39824. source: "ownCategoriesOfClass: aClass\x0a\x09\x22Answer the protocols of aClass that are not package extensions\x22\x0a\x09\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [ :each :methods |\x0a\x09\x09(each match: '^\x5c*') ifFalse: [ map at: each put: methods ] ].\x0a\x09^ (map keys sorted: [ :a :b | a <= b ]) collect: [ :each |\x0a\x09\x09MethodCategory name: each theClass: aClass methods: (map at: each) ]",
  39825. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
  39826. referencedClasses: ["Dictionary", "MethodCategory"]
  39827. }),
  39828. globals.ChunkExporter);
  39829. smalltalk.addMethod(
  39830. smalltalk.method({
  39831. selector: "ownCategoriesOfMetaClass:",
  39832. protocol: 'accessing',
  39833. fn: function (aClass){
  39834. var self=this;
  39835. return smalltalk.withContext(function($ctx1) {
  39836. var $1;
  39837. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  39838. return $1;
  39839. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},globals.ChunkExporter)})},
  39840. args: ["aClass"],
  39841. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  39842. messageSends: ["ownCategoriesOfClass:", "class"],
  39843. referencedClasses: []
  39844. }),
  39845. globals.ChunkExporter);
  39846. smalltalk.addMethod(
  39847. smalltalk.method({
  39848. selector: "ownMethodProtocolsOfClass:",
  39849. protocol: 'accessing',
  39850. fn: function (aClass){
  39851. var self=this;
  39852. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  39853. return smalltalk.withContext(function($ctx1) {
  39854. var $1;
  39855. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  39856. return smalltalk.withContext(function($ctx2) {
  39857. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  39858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  39859. return $1;
  39860. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},globals.ChunkExporter)})},
  39861. args: ["aClass"],
  39862. source: "ownMethodProtocolsOfClass: aClass\x0a\x09\x22Answer a collection of ExportMethodProtocol object of aClass that are not package extensions\x22\x0a\x09\x0a\x09^ aClass ownProtocols collect: [ :each |\x0a\x09\x09ExportMethodProtocol name: each theClass: aClass ]",
  39863. messageSends: ["collect:", "ownProtocols", "name:theClass:"],
  39864. referencedClasses: ["ExportMethodProtocol"]
  39865. }),
  39866. globals.ChunkExporter);
  39867. smalltalk.addClass('Exporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  39868. globals.Exporter.comment="I am responsible for outputting Amber code into a JavaScript string.\x0a\x0aThe generated output is enough to reconstruct the exported data, including Smalltalk source code and other metadata.\x0a\x0a## Use case\x0a\x0aI am typically used to save code outside of the Amber runtime (committing to disk, etc.).";
  39869. smalltalk.addMethod(
  39870. smalltalk.method({
  39871. selector: "exportDefinitionOf:on:",
  39872. protocol: 'output',
  39873. fn: function (aClass,aStream){
  39874. var self=this;
  39875. return smalltalk.withContext(function($ctx1) {
  39876. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  39877. _st(aStream)._lf();
  39878. $ctx1.sendIdx["lf"]=1;
  39879. _st(aStream)._nextPutAll_("smalltalk.addClass(");
  39880. $ctx1.sendIdx["nextPutAll:"]=1;
  39881. $2="'".__comma(self._classNameFor_(aClass));
  39882. $ctx1.sendIdx[","]=2;
  39883. $1=_st($2).__comma("', ");
  39884. $ctx1.sendIdx[","]=1;
  39885. _st(aStream)._nextPutAll_($1);
  39886. $ctx1.sendIdx["nextPutAll:"]=2;
  39887. $3=self._jsClassNameFor_(_st(aClass)._superclass());
  39888. $ctx1.sendIdx["jsClassNameFor:"]=1;
  39889. _st(aStream)._nextPutAll_($3);
  39890. $ctx1.sendIdx["nextPutAll:"]=3;
  39891. $4=_st(aStream)._nextPutAll_(", [");
  39892. $ctx1.sendIdx["nextPutAll:"]=4;
  39893. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  39894. return smalltalk.withContext(function($ctx2) {
  39895. $6="'".__comma(each);
  39896. $ctx2.sendIdx[","]=4;
  39897. $5=_st($6).__comma("'");
  39898. $ctx2.sendIdx[","]=3;
  39899. return _st(aStream)._nextPutAll_($5);
  39900. $ctx2.sendIdx["nextPutAll:"]=5;
  39901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  39902. return smalltalk.withContext(function($ctx2) {
  39903. return _st(aStream)._nextPutAll_(", ");
  39904. $ctx2.sendIdx["nextPutAll:"]=6;
  39905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  39906. _st(aStream)._nextPutAll_("], '");
  39907. $ctx1.sendIdx["nextPutAll:"]=7;
  39908. _st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  39909. $ctx1.sendIdx["nextPutAll:"]=8;
  39910. $7=_st(aStream)._nextPutAll_(");");
  39911. $ctx1.sendIdx["nextPutAll:"]=9;
  39912. $9=_st(aClass)._comment();
  39913. $ctx1.sendIdx["comment"]=1;
  39914. $8=_st($9)._notEmpty();
  39915. if(smalltalk.assert($8)){
  39916. _st(aStream)._lf();
  39917. $ctx1.sendIdx["lf"]=2;
  39918. _st(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  39919. $ctx1.sendIdx["nextPutAll:"]=10;
  39920. _st(aStream)._nextPutAll_(".comment=");
  39921. $ctx1.sendIdx["nextPutAll:"]=11;
  39922. _st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  39923. $ctx1.sendIdx["nextPutAll:"]=12;
  39924. $10=_st(aStream)._nextPutAll_(";");
  39925. $10;
  39926. };
  39927. _st(aStream)._lf();
  39928. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
  39929. args: ["aClass", "aStream"],
  39930. source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.addClass(';\x0a\x09\x09nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass superclass);\x0a\x09\x09nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ', ' ].\x0a\x09aStream\x0a\x09\x09nextPutAll: '], ''';\x0a\x09\x09nextPutAll: aClass category, '''';\x0a\x09\x09nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09\x09lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09nextPutAll: ';' ].\x0a\x09aStream lf",
  39931. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"],
  39932. referencedClasses: []
  39933. }),
  39934. globals.Exporter);
  39935. smalltalk.addMethod(
  39936. smalltalk.method({
  39937. selector: "exportMetaDefinitionOf:on:",
  39938. protocol: 'output',
  39939. fn: function (aClass,aStream){
  39940. var self=this;
  39941. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  39942. return smalltalk.withContext(function($ctx1) {
  39943. var $3,$2,$1,$5,$4,$6,$8,$7;
  39944. _st(aStream)._lf();
  39945. $ctx1.sendIdx["lf"]=1;
  39946. $3=_st(aClass)._class();
  39947. $ctx1.sendIdx["class"]=1;
  39948. $2=_st($3)._instanceVariableNames();
  39949. $ctx1.sendIdx["instanceVariableNames"]=1;
  39950. $1=_st($2)._isEmpty();
  39951. if(! smalltalk.assert($1)){
  39952. $5=_st(aClass)._class();
  39953. $ctx1.sendIdx["class"]=2;
  39954. $4=self._jsClassNameFor_($5);
  39955. _st(aStream)._nextPutAll_($4);
  39956. $ctx1.sendIdx["nextPutAll:"]=1;
  39957. $6=_st(aStream)._nextPutAll_(".iVarNames = [");
  39958. $ctx1.sendIdx["nextPutAll:"]=2;
  39959. $6;
  39960. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  39961. return smalltalk.withContext(function($ctx2) {
  39962. $8="'".__comma(each);
  39963. $ctx2.sendIdx[","]=2;
  39964. $7=_st($8).__comma("'");
  39965. $ctx2.sendIdx[","]=1;
  39966. return _st(aStream)._nextPutAll_($7);
  39967. $ctx2.sendIdx["nextPutAll:"]=3;
  39968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}),(function(){
  39969. return smalltalk.withContext(function($ctx2) {
  39970. return _st(aStream)._nextPutAll_(",");
  39971. $ctx2.sendIdx["nextPutAll:"]=4;
  39972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  39973. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  39974. };
  39975. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)})},
  39976. args: ["aClass", "aStream"],
  39977. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  39978. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","],
  39979. referencedClasses: ["String"]
  39980. }),
  39981. globals.Exporter);
  39982. smalltalk.addMethod(
  39983. smalltalk.method({
  39984. selector: "exportMethod:on:",
  39985. protocol: 'output',
  39986. fn: function (aMethod,aStream){
  39987. var self=this;
  39988. return smalltalk.withContext(function($ctx1) {
  39989. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17,$18;
  39990. _st(aStream)._nextPutAll_("smalltalk.addMethod(");
  39991. $ctx1.sendIdx["nextPutAll:"]=1;
  39992. _st(aStream)._lf();
  39993. $ctx1.sendIdx["lf"]=1;
  39994. _st(aStream)._nextPutAll_("smalltalk.method({");
  39995. $ctx1.sendIdx["nextPutAll:"]=2;
  39996. _st(aStream)._lf();
  39997. $ctx1.sendIdx["lf"]=2;
  39998. $3=_st(_st(aMethod)._selector())._asJavascript();
  39999. $ctx1.sendIdx["asJavascript"]=1;
  40000. $2="selector: ".__comma($3);
  40001. $ctx1.sendIdx[","]=2;
  40002. $1=_st($2).__comma(",");
  40003. $ctx1.sendIdx[","]=1;
  40004. _st(aStream)._nextPutAll_($1);
  40005. $ctx1.sendIdx["nextPutAll:"]=3;
  40006. _st(aStream)._lf();
  40007. $ctx1.sendIdx["lf"]=3;
  40008. $5="protocol: '".__comma(_st(aMethod)._protocol());
  40009. $ctx1.sendIdx[","]=4;
  40010. $4=_st($5).__comma("',");
  40011. $ctx1.sendIdx[","]=3;
  40012. _st(aStream)._nextPutAll_($4);
  40013. $ctx1.sendIdx["nextPutAll:"]=4;
  40014. _st(aStream)._lf();
  40015. $ctx1.sendIdx["lf"]=4;
  40016. $7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
  40017. $ctx1.sendIdx[","]=6;
  40018. $6=_st($7).__comma(",");
  40019. $ctx1.sendIdx[","]=5;
  40020. _st(aStream)._nextPutAll_($6);
  40021. $ctx1.sendIdx["nextPutAll:"]=5;
  40022. _st(aStream)._lf();
  40023. $ctx1.sendIdx["lf"]=5;
  40024. $10=_st(_st(aMethod)._arguments())._asJavascript();
  40025. $ctx1.sendIdx["asJavascript"]=2;
  40026. $9="args: ".__comma($10);
  40027. $ctx1.sendIdx[","]=8;
  40028. $8=_st($9).__comma(",");
  40029. $ctx1.sendIdx[","]=7;
  40030. _st(aStream)._nextPutAll_($8);
  40031. $ctx1.sendIdx["nextPutAll:"]=6;
  40032. _st(aStream)._lf();
  40033. $ctx1.sendIdx["lf"]=6;
  40034. $13=_st(_st(aMethod)._source())._asJavascript();
  40035. $ctx1.sendIdx["asJavascript"]=3;
  40036. $12="source: ".__comma($13);
  40037. $ctx1.sendIdx[","]=10;
  40038. $11=_st($12).__comma(",");
  40039. $ctx1.sendIdx[","]=9;
  40040. _st(aStream)._nextPutAll_($11);
  40041. $ctx1.sendIdx["nextPutAll:"]=7;
  40042. _st(aStream)._lf();
  40043. $ctx1.sendIdx["lf"]=7;
  40044. $16=_st(_st(aMethod)._messageSends())._asJavascript();
  40045. $ctx1.sendIdx["asJavascript"]=4;
  40046. $15="messageSends: ".__comma($16);
  40047. $ctx1.sendIdx[","]=12;
  40048. $14=_st($15).__comma(",");
  40049. $ctx1.sendIdx[","]=11;
  40050. _st(aStream)._nextPutAll_($14);
  40051. $ctx1.sendIdx["nextPutAll:"]=8;
  40052. _st(aStream)._lf();
  40053. $ctx1.sendIdx["lf"]=8;
  40054. $17=_st(aStream)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  40055. $ctx1.sendIdx["nextPutAll:"]=9;
  40056. _st(aStream)._lf();
  40057. $ctx1.sendIdx["lf"]=9;
  40058. _st(aStream)._nextPutAll_("}),");
  40059. $ctx1.sendIdx["nextPutAll:"]=10;
  40060. _st(aStream)._lf();
  40061. $ctx1.sendIdx["lf"]=10;
  40062. _st(aStream)._nextPutAll_(self._jsClassNameFor_(_st(aMethod)._methodClass()));
  40063. $ctx1.sendIdx["nextPutAll:"]=11;
  40064. _st(aStream)._nextPutAll_(");");
  40065. _st(aStream)._lf();
  40066. $ctx1.sendIdx["lf"]=11;
  40067. $18=_st(aStream)._lf();
  40068. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.Exporter)})},
  40069. args: ["aMethod", "aStream"],
  40070. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09\x22nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x22\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'protocol: ''', aMethod protocol, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  40071. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "jsClassNameFor:", "methodClass"],
  40072. referencedClasses: []
  40073. }),
  40074. globals.Exporter);
  40075. smalltalk.addMethod(
  40076. smalltalk.method({
  40077. selector: "exportPackage:on:",
  40078. protocol: 'output',
  40079. fn: function (aPackage,aStream){
  40080. var self=this;
  40081. return smalltalk.withContext(function($ctx1) {
  40082. var $1,$2;
  40083. self._exportPackagePrologueOf_on_(aPackage,aStream);
  40084. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  40085. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  40086. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  40087. return smalltalk.withContext(function($ctx2) {
  40088. self._exportDefinitionOf_on_(each,aStream);
  40089. $2=_st(each)._ownMethods();
  40090. $ctx2.sendIdx["ownMethods"]=1;
  40091. _st($2)._do_((function(method){
  40092. return smalltalk.withContext(function($ctx3) {
  40093. return self._exportMethod_on_(method,aStream);
  40094. $ctx3.sendIdx["exportMethod:on:"]=1;
  40095. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)})}));
  40096. $ctx2.sendIdx["do:"]=2;
  40097. self._exportMetaDefinitionOf_on_(each,aStream);
  40098. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  40099. return smalltalk.withContext(function($ctx3) {
  40100. return self._exportMethod_on_(method,aStream);
  40101. $ctx3.sendIdx["exportMethod:on:"]=2;
  40102. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)})}));
  40103. $ctx2.sendIdx["do:"]=3;
  40104. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  40105. $ctx1.sendIdx["do:"]=1;
  40106. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  40107. return smalltalk.withContext(function($ctx2) {
  40108. return self._exportMethod_on_(each,aStream);
  40109. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  40110. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  40111. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  40112. args: ["aPackage", "aStream"],
  40113. source: "exportPackage: aPackage on: aStream\x0a\x09\x0a\x09self \x0a\x09\x09exportPackagePrologueOf: aPackage on: aStream;\x0a\x09\x09exportPackageDefinitionOf: aPackage on: aStream;\x0a\x09\x09exportPackageTransportOf: aPackage on: aStream.\x0a\x09\x0a\x09aPackage sortedClasses do: [ :each |\x0a\x09\x09self exportDefinitionOf: each on: aStream.\x0a\x09\x09each ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ].\x0a\x09\x09\x09\x0a\x09\x09self exportMetaDefinitionOf: each on: aStream.\x0a\x09\x09each class ownMethods do: [ :method |\x0a\x09\x09\x09self exportMethod: method on: aStream ] ].\x0a\x09\x09\x09\x0a\x09(self extensionMethodsOfPackage: aPackage) do: [ :each |\x0a\x09\x09self exportMethod: each on: aStream ].\x0a\x09\x09\x0a\x09self exportPackageEpilogueOf: aPackage on: aStream",
  40114. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"],
  40115. referencedClasses: []
  40116. }),
  40117. globals.Exporter);
  40118. smalltalk.addMethod(
  40119. smalltalk.method({
  40120. selector: "exportPackageDefinitionOf:on:",
  40121. protocol: 'output',
  40122. fn: function (aPackage,aStream){
  40123. var self=this;
  40124. return smalltalk.withContext(function($ctx1) {
  40125. var $1,$2;
  40126. _st(aStream)._nextPutAll_("smalltalk.addPackage(");
  40127. $ctx1.sendIdx["nextPutAll:"]=1;
  40128. $1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
  40129. $ctx1.sendIdx[","]=1;
  40130. _st(aStream)._nextPutAll_($1);
  40131. $2=_st(aStream)._lf();
  40132. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  40133. args: ["aPackage", "aStream"],
  40134. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  40135. messageSends: ["nextPutAll:", ",", "name", "lf"],
  40136. referencedClasses: []
  40137. }),
  40138. globals.Exporter);
  40139. smalltalk.addMethod(
  40140. smalltalk.method({
  40141. selector: "exportPackageEpilogueOf:on:",
  40142. protocol: 'output',
  40143. fn: function (aPackage,aStream){
  40144. var self=this;
  40145. return smalltalk.withContext(function($ctx1) {
  40146. var $1;
  40147. _st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  40148. $1=_st(aStream)._lf();
  40149. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  40150. args: ["aPackage", "aStream"],
  40151. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  40152. messageSends: ["nextPutAll:", "lf"],
  40153. referencedClasses: []
  40154. }),
  40155. globals.Exporter);
  40156. smalltalk.addMethod(
  40157. smalltalk.method({
  40158. selector: "exportPackagePrologueOf:on:",
  40159. protocol: 'output',
  40160. fn: function (aPackage,aStream){
  40161. var self=this;
  40162. return smalltalk.withContext(function($ctx1) {
  40163. var $1;
  40164. _st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
  40165. $1=_st(aStream)._lf();
  40166. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  40167. args: ["aPackage", "aStream"],
  40168. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  40169. messageSends: ["nextPutAll:", "lf"],
  40170. referencedClasses: []
  40171. }),
  40172. globals.Exporter);
  40173. smalltalk.addMethod(
  40174. smalltalk.method({
  40175. selector: "exportPackageTransportOf:on:",
  40176. protocol: 'output',
  40177. fn: function (aPackage,aStream){
  40178. var self=this;
  40179. return smalltalk.withContext(function($ctx1) {
  40180. var $1;
  40181. _st(aStream)._nextPutAll_("smalltalk.packages[");
  40182. $ctx1.sendIdx["nextPutAll:"]=1;
  40183. _st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  40184. $ctx1.sendIdx["nextPutAll:"]=2;
  40185. _st(aStream)._nextPutAll_("].transport = ");
  40186. $ctx1.sendIdx["nextPutAll:"]=3;
  40187. _st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  40188. $ctx1.sendIdx["nextPutAll:"]=4;
  40189. _st(aStream)._nextPutAll_(";");
  40190. $1=_st(aStream)._lf();
  40191. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)})},
  40192. args: ["aPackage", "aStream"],
  40193. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.packages[';\x0a\x09\x09nextPutAll: aPackage name asJavascript;\x0a\x09\x09nextPutAll: '].transport = ';\x0a\x09\x09nextPutAll: aPackage transport asJSONString;\x0a\x09\x09nextPutAll: ';';\x0a\x09\x09lf",
  40194. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"],
  40195. referencedClasses: []
  40196. }),
  40197. globals.Exporter);
  40198. smalltalk.addMethod(
  40199. smalltalk.method({
  40200. selector: "jsClassNameFor:",
  40201. protocol: 'convenience',
  40202. fn: function (aClass){
  40203. var self=this;
  40204. return smalltalk.withContext(function($ctx1) {
  40205. var $2,$1,$receiver;
  40206. $2=_st(aClass)._isMetaclass();
  40207. if(smalltalk.assert($2)){
  40208. $1=_st(self._jsClassNameFor_(_st(aClass)._instanceClass())).__comma(".klass");
  40209. $ctx1.sendIdx[","]=1;
  40210. } else {
  40211. if(($receiver = aClass) == null || $receiver.isNil){
  40212. $1="null";
  40213. } else {
  40214. $1="globals.".__comma(_st(aClass)._name());
  40215. };
  40216. };
  40217. return $1;
  40218. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},globals.Exporter)})},
  40219. args: ["aClass"],
  40220. source: "jsClassNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ (self jsClassNameFor: aClass instanceClass), '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass\x0a\x09\x09\x09\x09ifNil: [ 'null' ]\x0a\x09\x09\x09\x09ifNotNil: [ 'globals.', aClass name ] ]",
  40221. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"],
  40222. referencedClasses: []
  40223. }),
  40224. globals.Exporter);
  40225. smalltalk.addMethod(
  40226. smalltalk.method({
  40227. selector: "ownMethodsOfClass:",
  40228. protocol: 'accessing',
  40229. fn: function (aClass){
  40230. var self=this;
  40231. return smalltalk.withContext(function($ctx1) {
  40232. var $2,$1;
  40233. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  40234. return smalltalk.withContext(function($ctx2) {
  40235. $2=_st(a)._selector();
  40236. $ctx2.sendIdx["selector"]=1;
  40237. return _st($2).__lt_eq(_st(b)._selector());
  40238. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._reject_((function(each){
  40239. return smalltalk.withContext(function($ctx2) {
  40240. return _st(_st(each)._protocol())._match_("^\x5c*");
  40241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  40242. return $1;
  40243. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},globals.Exporter)})},
  40244. args: ["aClass"],
  40245. source: "ownMethodsOfClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ ((aClass methodDictionary values) sorted: [ :a :b | a selector <= b selector ])\x0a\x09\x09reject: [ :each | (each protocol match: '^\x5c*') ]",
  40246. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"],
  40247. referencedClasses: []
  40248. }),
  40249. globals.Exporter);
  40250. smalltalk.addMethod(
  40251. smalltalk.method({
  40252. selector: "ownMethodsOfMetaClass:",
  40253. protocol: 'accessing',
  40254. fn: function (aClass){
  40255. var self=this;
  40256. return smalltalk.withContext(function($ctx1) {
  40257. var $1;
  40258. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  40259. return $1;
  40260. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},globals.Exporter)})},
  40261. args: ["aClass"],
  40262. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  40263. messageSends: ["ownMethodsOfClass:", "class"],
  40264. referencedClasses: []
  40265. }),
  40266. globals.Exporter);
  40267. smalltalk.addClass('AmdExporter', globals.Exporter, ['namespace'], 'Kernel-ImportExport');
  40268. globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  40269. smalltalk.addMethod(
  40270. smalltalk.method({
  40271. selector: "amdNamesOfPackages:",
  40272. protocol: 'private',
  40273. fn: function (anArray){
  40274. var self=this;
  40275. return smalltalk.withContext(function($ctx1) {
  40276. var $2,$1;
  40277. $1=_st(_st(anArray)._select_((function(each){
  40278. return smalltalk.withContext(function($ctx2) {
  40279. $2=self._amdNamespaceOfPackage_(each);
  40280. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  40281. return _st($2)._notNil();
  40282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  40283. return smalltalk.withContext(function($ctx2) {
  40284. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  40285. $ctx2.sendIdx[","]=1;
  40286. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  40287. return $1;
  40288. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},globals.AmdExporter)})},
  40289. args: ["anArray"],
  40290. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  40291. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"],
  40292. referencedClasses: []
  40293. }),
  40294. globals.AmdExporter);
  40295. smalltalk.addMethod(
  40296. smalltalk.method({
  40297. selector: "amdNamespaceOfPackage:",
  40298. protocol: 'private',
  40299. fn: function (aPackage){
  40300. var self=this;
  40301. return smalltalk.withContext(function($ctx1) {
  40302. var $4,$3,$2,$1;
  40303. $4=_st(aPackage)._transport();
  40304. $ctx1.sendIdx["transport"]=1;
  40305. $3=_st($4)._type();
  40306. $2=_st($3).__eq("amd");
  40307. if(smalltalk.assert($2)){
  40308. $1=_st(_st(aPackage)._transport())._namespace();
  40309. } else {
  40310. $1=nil;
  40311. };
  40312. return $1;
  40313. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},globals.AmdExporter)})},
  40314. args: ["aPackage"],
  40315. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  40316. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"],
  40317. referencedClasses: []
  40318. }),
  40319. globals.AmdExporter);
  40320. smalltalk.addMethod(
  40321. smalltalk.method({
  40322. selector: "exportPackageEpilogueOf:on:",
  40323. protocol: 'output',
  40324. fn: function (aPackage,aStream){
  40325. var self=this;
  40326. return smalltalk.withContext(function($ctx1) {
  40327. var $1;
  40328. _st(aStream)._nextPutAll_("});");
  40329. $1=_st(aStream)._lf();
  40330. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
  40331. args: ["aPackage", "aStream"],
  40332. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  40333. messageSends: ["nextPutAll:", "lf"],
  40334. referencedClasses: []
  40335. }),
  40336. globals.AmdExporter);
  40337. smalltalk.addMethod(
  40338. smalltalk.method({
  40339. selector: "exportPackagePrologueOf:on:",
  40340. protocol: 'output',
  40341. fn: function (aPackage,aStream){
  40342. var self=this;
  40343. return smalltalk.withContext(function($ctx1) {
  40344. var $1;
  40345. _st(aStream)._nextPutAll_("define(\x22");
  40346. $ctx1.sendIdx["nextPutAll:"]=1;
  40347. _st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  40348. $ctx1.sendIdx["nextPutAll:"]=2;
  40349. _st(aStream)._nextPutAll_("/");
  40350. $ctx1.sendIdx["nextPutAll:"]=3;
  40351. _st(aStream)._nextPutAll_(_st(aPackage)._name());
  40352. $ctx1.sendIdx["nextPutAll:"]=4;
  40353. _st(aStream)._nextPutAll_("\x22, ");
  40354. $ctx1.sendIdx["nextPutAll:"]=5;
  40355. _st(aStream)._nextPutAll_(_st(["amber/boot"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  40356. $ctx1.sendIdx["nextPutAll:"]=6;
  40357. _st(aStream)._nextPutAll_(", function($boot){");
  40358. $ctx1.sendIdx["nextPutAll:"]=7;
  40359. _st(aStream)._lf();
  40360. $ctx1.sendIdx["lf"]=1;
  40361. _st(aStream)._nextPutAll_("var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;");
  40362. $1=_st(aStream)._lf();
  40363. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
  40364. args: ["aPackage", "aStream"],
  40365. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber/boot'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function($boot){';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;';\x0a\x09\x09lf",
  40366. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
  40367. referencedClasses: []
  40368. }),
  40369. globals.AmdExporter);
  40370. smalltalk.addClass('ChunkParser', globals.Object, ['stream', 'last'], 'Kernel-ImportExport');
  40371. globals.ChunkParser.comment="I am responsible for parsing aStream contents in the chunk format.\x0a\x0a## API\x0a\x0a ChunkParser new\x0a stream: aStream;\x0a nextChunk";
  40372. smalltalk.addMethod(
  40373. smalltalk.method({
  40374. selector: "last",
  40375. protocol: 'accessing',
  40376. fn: function (){
  40377. var self=this;
  40378. var $1;
  40379. $1=self["@last"];
  40380. return $1;
  40381. },
  40382. args: [],
  40383. source: "last\x0a\x09^ last",
  40384. messageSends: [],
  40385. referencedClasses: []
  40386. }),
  40387. globals.ChunkParser);
  40388. smalltalk.addMethod(
  40389. smalltalk.method({
  40390. selector: "nextChunk",
  40391. protocol: 'reading',
  40392. fn: function (){
  40393. var self=this;
  40394. var char,result,chunk;
  40395. return smalltalk.withContext(function($ctx1) {
  40396. var $1,$2,$3,$4;
  40397. var $early={};
  40398. try {
  40399. result=""._writeStream();
  40400. _st((function(){
  40401. return smalltalk.withContext(function($ctx2) {
  40402. char=_st(self["@stream"])._next();
  40403. $ctx2.sendIdx["next"]=1;
  40404. char;
  40405. return _st(char)._notNil();
  40406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  40407. return smalltalk.withContext(function($ctx2) {
  40408. $1=_st(char).__eq("!");
  40409. $ctx2.sendIdx["="]=1;
  40410. if(smalltalk.assert($1)){
  40411. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  40412. if(smalltalk.assert($2)){
  40413. _st(self["@stream"])._next();
  40414. } else {
  40415. self["@last"]=_st(_st(result)._contents())._trimBoth();
  40416. $3=self["@last"];
  40417. throw $early=[$3];
  40418. };
  40419. };
  40420. return _st(result)._nextPut_(char);
  40421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  40422. self["@last"]=nil;
  40423. $4=self["@last"];
  40424. return $4;
  40425. }
  40426. catch(e) {if(e===$early)return e[0]; throw e}
  40427. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},globals.ChunkParser)})},
  40428. args: [],
  40429. source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This method returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a\x09\x09[ char := stream next.\x0a\x09\x09char notNil ] whileTrue: [\x0a\x09\x09\x09\x09char = '!' ifTrue: [\x0a\x09\x09\x09\x09\x09\x09stream peek = '!'\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifTrue: [ stream next \x22skipping the escape double\x22 ]\x0a\x09\x09\x09\x09\x09\x09\x09\x09ifFalse: [ ^ last := result contents trimBoth \x22chunk end marker found\x22 ]].\x0a\x09\x09\x09\x09result nextPut: char ].\x0a\x09^ last := nil \x22a chunk needs to end with !\x22",
  40430. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"],
  40431. referencedClasses: []
  40432. }),
  40433. globals.ChunkParser);
  40434. smalltalk.addMethod(
  40435. smalltalk.method({
  40436. selector: "stream:",
  40437. protocol: 'accessing',
  40438. fn: function (aStream){
  40439. var self=this;
  40440. self["@stream"]=aStream;
  40441. return self},
  40442. args: ["aStream"],
  40443. source: "stream: aStream\x0a\x09stream := aStream",
  40444. messageSends: [],
  40445. referencedClasses: []
  40446. }),
  40447. globals.ChunkParser);
  40448. smalltalk.addMethod(
  40449. smalltalk.method({
  40450. selector: "on:",
  40451. protocol: 'instance creation',
  40452. fn: function (aStream){
  40453. var self=this;
  40454. return smalltalk.withContext(function($ctx1) {
  40455. var $1;
  40456. $1=_st(self._new())._stream_(aStream);
  40457. return $1;
  40458. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},globals.ChunkParser.klass)})},
  40459. args: ["aStream"],
  40460. source: "on: aStream\x0a\x09^ self new stream: aStream",
  40461. messageSends: ["stream:", "new"],
  40462. referencedClasses: []
  40463. }),
  40464. globals.ChunkParser.klass);
  40465. smalltalk.addClass('ExportMethodProtocol', globals.Object, ['name', 'theClass'], 'Kernel-ImportExport');
  40466. globals.ExportMethodProtocol.comment="I am an abstraction for a method protocol in a class / metaclass.\x0a\x0aI know of my class, name and methods.\x0aI am used when exporting a package.";
  40467. smalltalk.addMethod(
  40468. smalltalk.method({
  40469. selector: "methods",
  40470. protocol: 'accessing',
  40471. fn: function (){
  40472. var self=this;
  40473. return smalltalk.withContext(function($ctx1) {
  40474. var $2,$1;
  40475. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  40476. return smalltalk.withContext(function($ctx2) {
  40477. $2=_st(a)._selector();
  40478. $ctx2.sendIdx["selector"]=1;
  40479. return _st($2).__lt_eq(_st(b)._selector());
  40480. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  40481. return $1;
  40482. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.ExportMethodProtocol)})},
  40483. args: [],
  40484. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  40485. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"],
  40486. referencedClasses: []
  40487. }),
  40488. globals.ExportMethodProtocol);
  40489. smalltalk.addMethod(
  40490. smalltalk.method({
  40491. selector: "name",
  40492. protocol: 'accessing',
  40493. fn: function (){
  40494. var self=this;
  40495. var $1;
  40496. $1=self["@name"];
  40497. return $1;
  40498. },
  40499. args: [],
  40500. source: "name\x0a\x09^ name",
  40501. messageSends: [],
  40502. referencedClasses: []
  40503. }),
  40504. globals.ExportMethodProtocol);
  40505. smalltalk.addMethod(
  40506. smalltalk.method({
  40507. selector: "name:",
  40508. protocol: 'accessing',
  40509. fn: function (aString){
  40510. var self=this;
  40511. self["@name"]=aString;
  40512. return self},
  40513. args: ["aString"],
  40514. source: "name: aString\x0a\x09name := aString",
  40515. messageSends: [],
  40516. referencedClasses: []
  40517. }),
  40518. globals.ExportMethodProtocol);
  40519. smalltalk.addMethod(
  40520. smalltalk.method({
  40521. selector: "theClass",
  40522. protocol: 'accessing',
  40523. fn: function (){
  40524. var self=this;
  40525. var $1;
  40526. $1=self["@theClass"];
  40527. return $1;
  40528. },
  40529. args: [],
  40530. source: "theClass\x0a\x09^ theClass",
  40531. messageSends: [],
  40532. referencedClasses: []
  40533. }),
  40534. globals.ExportMethodProtocol);
  40535. smalltalk.addMethod(
  40536. smalltalk.method({
  40537. selector: "theClass:",
  40538. protocol: 'accessing',
  40539. fn: function (aClass){
  40540. var self=this;
  40541. self["@theClass"]=aClass;
  40542. return self},
  40543. args: ["aClass"],
  40544. source: "theClass: aClass\x0a\x09theClass := aClass",
  40545. messageSends: [],
  40546. referencedClasses: []
  40547. }),
  40548. globals.ExportMethodProtocol);
  40549. smalltalk.addMethod(
  40550. smalltalk.method({
  40551. selector: "name:theClass:",
  40552. protocol: 'instance creation',
  40553. fn: function (aString,aClass){
  40554. var self=this;
  40555. return smalltalk.withContext(function($ctx1) {
  40556. var $2,$3,$1;
  40557. $2=self._new();
  40558. _st($2)._name_(aString);
  40559. _st($2)._theClass_(aClass);
  40560. $3=_st($2)._yourself();
  40561. $1=$3;
  40562. return $1;
  40563. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},globals.ExportMethodProtocol.klass)})},
  40564. args: ["aString", "aClass"],
  40565. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  40566. messageSends: ["name:", "new", "theClass:", "yourself"],
  40567. referencedClasses: []
  40568. }),
  40569. globals.ExportMethodProtocol.klass);
  40570. smalltalk.addClass('Importer', globals.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
  40571. globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  40572. smalltalk.addMethod(
  40573. smalltalk.method({
  40574. selector: "import:",
  40575. protocol: 'fileIn',
  40576. fn: function (aStream){
  40577. var self=this;
  40578. var chunk,result,parser,lastEmpty;
  40579. function $ChunkParser(){return globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  40580. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  40581. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  40582. return smalltalk.withContext(function($ctx1) {
  40583. var $1,$2;
  40584. parser=_st($ChunkParser())._on_(aStream);
  40585. lastEmpty=false;
  40586. self["@lastSection"]="n/a, not started";
  40587. self["@lastChunk"]=nil;
  40588. _st((function(){
  40589. return smalltalk.withContext(function($ctx2) {
  40590. _st((function(){
  40591. return smalltalk.withContext(function($ctx3) {
  40592. chunk=_st(parser)._nextChunk();
  40593. chunk;
  40594. return _st(chunk)._isNil();
  40595. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._whileFalse_((function(){
  40596. return smalltalk.withContext(function($ctx3) {
  40597. $1=_st(chunk)._isEmpty();
  40598. if(smalltalk.assert($1)){
  40599. lastEmpty=true;
  40600. return lastEmpty;
  40601. } else {
  40602. self["@lastSection"]=chunk;
  40603. self["@lastSection"];
  40604. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  40605. result;
  40606. $2=lastEmpty;
  40607. if(smalltalk.assert($2)){
  40608. lastEmpty=false;
  40609. lastEmpty;
  40610. return _st(result)._scanFrom_(parser);
  40611. };
  40612. };
  40613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  40614. self["@lastSection"]="n/a, finished";
  40615. return self["@lastSection"];
  40616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(e){
  40617. return smalltalk.withContext(function($ctx2) {
  40618. self["@lastChunk"]=_st(parser)._last();
  40619. self["@lastChunk"];
  40620. return _st(e)._signal();
  40621. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)})}));
  40622. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},globals.Importer)})},
  40623. args: ["aStream"],
  40624. source: "import: aStream\x0a\x09| chunk result parser lastEmpty |\x0a\x09parser := ChunkParser on: aStream.\x0a\x09lastEmpty := false.\x0a\x09lastSection := 'n/a, not started'.\x0a\x09lastChunk := nil.\x0a\x09[\x0a\x09[ chunk := parser nextChunk.\x0a\x09chunk isNil ] whileFalse: [\x0a\x09\x09chunk isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09lastSection := chunk.\x0a\x09\x09\x09\x09result := Compiler new evaluateExpression: chunk.\x0a\x09\x09\x09\x09lastEmpty\x0a\x09\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09lastEmpty := false.\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09result scanFrom: parser ]] ].\x0a\x09lastSection := 'n/a, finished'\x0a\x09] on: Error do: [:e | lastChunk := parser last. e signal ].",
  40625. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"],
  40626. referencedClasses: ["ChunkParser", "Compiler", "Error"]
  40627. }),
  40628. globals.Importer);
  40629. smalltalk.addMethod(
  40630. smalltalk.method({
  40631. selector: "lastChunk",
  40632. protocol: 'accessing',
  40633. fn: function (){
  40634. var self=this;
  40635. var $1;
  40636. $1=self["@lastChunk"];
  40637. return $1;
  40638. },
  40639. args: [],
  40640. source: "lastChunk\x0a\x09^ lastChunk",
  40641. messageSends: [],
  40642. referencedClasses: []
  40643. }),
  40644. globals.Importer);
  40645. smalltalk.addMethod(
  40646. smalltalk.method({
  40647. selector: "lastSection",
  40648. protocol: 'accessing',
  40649. fn: function (){
  40650. var self=this;
  40651. var $1;
  40652. $1=self["@lastSection"];
  40653. return $1;
  40654. },
  40655. args: [],
  40656. source: "lastSection\x0a\x09^ lastSection",
  40657. messageSends: [],
  40658. referencedClasses: []
  40659. }),
  40660. globals.Importer);
  40661. smalltalk.addClass('PackageHandler', globals.InterfacingObject, [], 'Kernel-ImportExport');
  40662. globals.PackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  40663. smalltalk.addMethod(
  40664. smalltalk.method({
  40665. selector: "ajaxPutAt:data:onSuccess:onError:",
  40666. protocol: 'private',
  40667. fn: function (aURL,aString,aBlock,anotherBlock){
  40668. var self=this;
  40669. return smalltalk.withContext(function($ctx1) {
  40670. self._ajax_(globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock]));
  40671. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  40672. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  40673. source: "ajaxPutAt: aURL data: aString onSuccess: aBlock onError: anotherBlock\x0a\x09self\x0a\x09\x09ajax: #{\x0a\x09\x09\x09'url' -> aURL.\x0a\x09\x09\x09'type' -> 'PUT'.\x0a\x09\x09\x09'data' -> aString.\x0a\x09\x09\x09'contentType' -> 'text/plain;charset=UTF-8'.\x0a\x09\x09\x09'success' -> aBlock.\x0a\x09\x09\x09'error' -> anotherBlock\x0a\x09\x09}",
  40674. messageSends: ["ajax:"],
  40675. referencedClasses: []
  40676. }),
  40677. globals.PackageHandler);
  40678. smalltalk.addMethod(
  40679. smalltalk.method({
  40680. selector: "chunkContentsFor:",
  40681. protocol: 'accessing',
  40682. fn: function (aPackage){
  40683. var self=this;
  40684. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  40685. return smalltalk.withContext(function($ctx1) {
  40686. var $1;
  40687. $1=_st($String())._streamContents_((function(str){
  40688. return smalltalk.withContext(function($ctx2) {
  40689. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  40690. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  40691. return $1;
  40692. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  40693. args: ["aPackage"],
  40694. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  40695. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"],
  40696. referencedClasses: ["String"]
  40697. }),
  40698. globals.PackageHandler);
  40699. smalltalk.addMethod(
  40700. smalltalk.method({
  40701. selector: "chunkExporter",
  40702. protocol: 'factory',
  40703. fn: function (){
  40704. var self=this;
  40705. return smalltalk.withContext(function($ctx1) {
  40706. var $1;
  40707. $1=_st(self._chunkExporterClass())._new();
  40708. return $1;
  40709. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},globals.PackageHandler)})},
  40710. args: [],
  40711. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  40712. messageSends: ["new", "chunkExporterClass"],
  40713. referencedClasses: []
  40714. }),
  40715. globals.PackageHandler);
  40716. smalltalk.addMethod(
  40717. smalltalk.method({
  40718. selector: "chunkExporterClass",
  40719. protocol: 'accessing',
  40720. fn: function (){
  40721. var self=this;
  40722. function $ChunkExporter(){return globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  40723. return $ChunkExporter();
  40724. },
  40725. args: [],
  40726. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  40727. messageSends: [],
  40728. referencedClasses: ["ChunkExporter"]
  40729. }),
  40730. globals.PackageHandler);
  40731. smalltalk.addMethod(
  40732. smalltalk.method({
  40733. selector: "commit:",
  40734. protocol: 'committing',
  40735. fn: function (aPackage){
  40736. var self=this;
  40737. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  40738. return smalltalk.withContext(function($ctx1) {
  40739. var $1,$2,$3,$4;
  40740. self._commit_onSuccess_onError_(aPackage,(function(){
  40741. }),(function(error){
  40742. return smalltalk.withContext(function($ctx2) {
  40743. $1=_st($PackageCommitError())._new();
  40744. $2=$1;
  40745. $3=_st("Commiting failed with reason: \x22".__comma(_st(error)._responseText())).__comma("\x22");
  40746. $ctx2.sendIdx[","]=1;
  40747. _st($2)._messageText_($3);
  40748. $4=_st($1)._signal();
  40749. return $4;
  40750. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  40751. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},globals.PackageHandler)})},
  40752. args: ["aPackage"],
  40753. source: "commit: aPackage\x0a\x09self \x0a\x09\x09commit: aPackage\x0a\x09\x09onSuccess: []\x0a\x09\x09onError: [ :error |\x0a\x09\x09\x09PackageCommitError new\x0a\x09\x09\x09\x09messageText: 'Commiting failed with reason: \x22' , (error responseText) , '\x22';\x0a\x09\x09\x09\x09signal ]",
  40754. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"],
  40755. referencedClasses: ["PackageCommitError"]
  40756. }),
  40757. globals.PackageHandler);
  40758. smalltalk.addMethod(
  40759. smalltalk.method({
  40760. selector: "commit:onSuccess:onError:",
  40761. protocol: 'committing',
  40762. fn: function (aPackage,aBlock,anotherBlock){
  40763. var self=this;
  40764. return smalltalk.withContext(function($ctx1) {
  40765. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  40766. return smalltalk.withContext(function($ctx2) {
  40767. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  40768. return smalltalk.withContext(function($ctx3) {
  40769. _st(aPackage)._beClean();
  40770. return _st(aBlock)._value();
  40771. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),anotherBlock);
  40772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),anotherBlock);
  40773. return self}, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  40774. args: ["aPackage", "aBlock", "anotherBlock"],
  40775. source: "commit: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09commitJsFileFor: aPackage \x0a\x09\x09onSuccess: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09commitStFileFor: aPackage \x0a\x09\x09\x09\x09onSuccess: [ aPackage beClean. aBlock value ]\x0a\x09\x09\x09\x09onError: anotherBlock ] \x0a\x09\x09onError: anotherBlock",
  40776. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"],
  40777. referencedClasses: []
  40778. }),
  40779. globals.PackageHandler);
  40780. smalltalk.addMethod(
  40781. smalltalk.method({
  40782. selector: "commitJsFileFor:onSuccess:onError:",
  40783. protocol: 'committing',
  40784. fn: function (aPackage,aBlock,anotherBlock){
  40785. var self=this;
  40786. return smalltalk.withContext(function($ctx1) {
  40787. var $2,$1;
  40788. $2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  40789. $ctx1.sendIdx[","]=2;
  40790. $1=_st($2).__comma(".js");
  40791. $ctx1.sendIdx[","]=1;
  40792. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  40793. return self}, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  40794. args: ["aPackage", "aBlock", "anotherBlock"],
  40795. source: "commitJsFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathJsFor: aPackage), '/', aPackage name, '.js'\x0a\x09\x09data: (self contentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  40796. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"],
  40797. referencedClasses: []
  40798. }),
  40799. globals.PackageHandler);
  40800. smalltalk.addMethod(
  40801. smalltalk.method({
  40802. selector: "commitPathJsFor:",
  40803. protocol: 'accessing',
  40804. fn: function (aPackage){
  40805. var self=this;
  40806. return smalltalk.withContext(function($ctx1) {
  40807. self._subclassResponsibility();
  40808. return self}, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  40809. args: ["aPackage"],
  40810. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  40811. messageSends: ["subclassResponsibility"],
  40812. referencedClasses: []
  40813. }),
  40814. globals.PackageHandler);
  40815. smalltalk.addMethod(
  40816. smalltalk.method({
  40817. selector: "commitPathStFor:",
  40818. protocol: 'accessing',
  40819. fn: function (aPackage){
  40820. var self=this;
  40821. return smalltalk.withContext(function($ctx1) {
  40822. self._subclassResponsibility();
  40823. return self}, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},globals.PackageHandler)})},
  40824. args: ["aPackage"],
  40825. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  40826. messageSends: ["subclassResponsibility"],
  40827. referencedClasses: []
  40828. }),
  40829. globals.PackageHandler);
  40830. smalltalk.addMethod(
  40831. smalltalk.method({
  40832. selector: "commitStFileFor:onSuccess:onError:",
  40833. protocol: 'committing',
  40834. fn: function (aPackage,aBlock,anotherBlock){
  40835. var self=this;
  40836. return smalltalk.withContext(function($ctx1) {
  40837. var $2,$1;
  40838. $2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  40839. $ctx1.sendIdx[","]=2;
  40840. $1=_st($2).__comma(".st");
  40841. $ctx1.sendIdx[","]=1;
  40842. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  40843. return self}, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)})},
  40844. args: ["aPackage", "aBlock", "anotherBlock"],
  40845. source: "commitStFileFor: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09self \x0a\x09\x09ajaxPutAt: (self commitPathStFor: aPackage), '/', aPackage name, '.st'\x0a\x09\x09data: (self chunkContentsFor: aPackage)\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  40846. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"],
  40847. referencedClasses: []
  40848. }),
  40849. globals.PackageHandler);
  40850. smalltalk.addMethod(
  40851. smalltalk.method({
  40852. selector: "contentsFor:",
  40853. protocol: 'accessing',
  40854. fn: function (aPackage){
  40855. var self=this;
  40856. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  40857. return smalltalk.withContext(function($ctx1) {
  40858. var $1;
  40859. $1=_st($String())._streamContents_((function(str){
  40860. return smalltalk.withContext(function($ctx2) {
  40861. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  40862. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)})}));
  40863. return $1;
  40864. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},globals.PackageHandler)})},
  40865. args: ["aPackage"],
  40866. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  40867. messageSends: ["streamContents:", "exportPackage:on:", "exporter"],
  40868. referencedClasses: ["String"]
  40869. }),
  40870. globals.PackageHandler);
  40871. smalltalk.addMethod(
  40872. smalltalk.method({
  40873. selector: "exporter",
  40874. protocol: 'factory',
  40875. fn: function (){
  40876. var self=this;
  40877. return smalltalk.withContext(function($ctx1) {
  40878. var $1;
  40879. $1=_st(self._exporterClass())._new();
  40880. return $1;
  40881. }, function($ctx1) {$ctx1.fill(self,"exporter",{},globals.PackageHandler)})},
  40882. args: [],
  40883. source: "exporter\x0a\x09^ self exporterClass new",
  40884. messageSends: ["new", "exporterClass"],
  40885. referencedClasses: []
  40886. }),
  40887. globals.PackageHandler);
  40888. smalltalk.addMethod(
  40889. smalltalk.method({
  40890. selector: "exporterClass",
  40891. protocol: 'accessing',
  40892. fn: function (){
  40893. var self=this;
  40894. function $Exporter(){return globals.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  40895. return $Exporter();
  40896. },
  40897. args: [],
  40898. source: "exporterClass\x0a\x09^ Exporter",
  40899. messageSends: [],
  40900. referencedClasses: ["Exporter"]
  40901. }),
  40902. globals.PackageHandler);
  40903. smalltalk.addMethod(
  40904. smalltalk.method({
  40905. selector: "load:",
  40906. protocol: 'loading',
  40907. fn: function (aPackage){
  40908. var self=this;
  40909. return smalltalk.withContext(function($ctx1) {
  40910. self._subclassResponsibility();
  40911. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.PackageHandler)})},
  40912. args: ["aPackage"],
  40913. source: "load: aPackage\x0a\x09self subclassResponsibility",
  40914. messageSends: ["subclassResponsibility"],
  40915. referencedClasses: []
  40916. }),
  40917. globals.PackageHandler);
  40918. smalltalk.addMethod(
  40919. smalltalk.method({
  40920. selector: "onCommitError:",
  40921. protocol: 'error handling',
  40922. fn: function (anError){
  40923. var self=this;
  40924. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  40925. return smalltalk.withContext(function($ctx1) {
  40926. var $1,$2,$3,$4;
  40927. $1=_st($PackageCommitError())._new();
  40928. $2=$1;
  40929. $3=_st("Commiting failed with reason: \x22".__comma(_st(anError)._responseText())).__comma("\x22");
  40930. $ctx1.sendIdx[","]=1;
  40931. _st($2)._messageText_($3);
  40932. $4=_st($1)._signal();
  40933. return self}, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},globals.PackageHandler)})},
  40934. args: ["anError"],
  40935. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  40936. messageSends: ["messageText:", "new", ",", "responseText", "signal"],
  40937. referencedClasses: ["PackageCommitError"]
  40938. }),
  40939. globals.PackageHandler);
  40940. smalltalk.addClass('AmdPackageHandler', globals.PackageHandler, [], 'Kernel-ImportExport');
  40941. globals.AmdPackageHandler.comment="I am responsible for handling package loading and committing.\x0a\x0aI should not be used directly. Instead, use the corresponding `Package` methods.";
  40942. smalltalk.addMethod(
  40943. smalltalk.method({
  40944. selector: "commitPathJsFor:",
  40945. protocol: 'accessing',
  40946. fn: function (aPackage){
  40947. var self=this;
  40948. return smalltalk.withContext(function($ctx1) {
  40949. var $1;
  40950. $1=self._toUrl_(self._namespaceFor_(aPackage));
  40951. return $1;
  40952. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  40953. args: ["aPackage"],
  40954. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  40955. messageSends: ["toUrl:", "namespaceFor:"],
  40956. referencedClasses: []
  40957. }),
  40958. globals.AmdPackageHandler);
  40959. smalltalk.addMethod(
  40960. smalltalk.method({
  40961. selector: "commitPathStFor:",
  40962. protocol: 'accessing',
  40963. fn: function (aPackage){
  40964. var self=this;
  40965. var path,pathWithout;
  40966. return smalltalk.withContext(function($ctx1) {
  40967. var $1,$3,$2;
  40968. $1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
  40969. $ctx1.sendIdx[","]=1;
  40970. path=self._toUrl_($1);
  40971. pathWithout=self._commitPathJsFor_(aPackage);
  40972. $3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
  40973. if(smalltalk.assert($3)){
  40974. $2=pathWithout;
  40975. } else {
  40976. $2=path;
  40977. };
  40978. return $2;
  40979. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.AmdPackageHandler)})},
  40980. args: ["aPackage"],
  40981. source: "commitPathStFor: aPackage\x0a\x09\x22If _source is not mapped, .st will be committed to .js path.\x0a\x09It is recommended not to use _source as it can be deprecated.\x22\x0a\x09\x0a\x09| path pathWithout |\x0a\x09path := self toUrl: (self namespaceFor: aPackage), '/_source'.\x0a\x09pathWithout := self commitPathJsFor: aPackage.\x0a\x09^ path = (pathWithout, '/_source') ifTrue: [ pathWithout ] ifFalse: [ path ]",
  40982. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="],
  40983. referencedClasses: []
  40984. }),
  40985. globals.AmdPackageHandler);
  40986. smalltalk.addMethod(
  40987. smalltalk.method({
  40988. selector: "exporterClass",
  40989. protocol: 'accessing',
  40990. fn: function (){
  40991. var self=this;
  40992. function $AmdExporter(){return globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  40993. return $AmdExporter();
  40994. },
  40995. args: [],
  40996. source: "exporterClass\x0a\x09^ AmdExporter",
  40997. messageSends: [],
  40998. referencedClasses: ["AmdExporter"]
  40999. }),
  41000. globals.AmdPackageHandler);
  41001. smalltalk.addMethod(
  41002. smalltalk.method({
  41003. selector: "load:",
  41004. protocol: 'loading',
  41005. fn: function (aPackage){
  41006. var self=this;
  41007. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  41008. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  41009. return smalltalk.withContext(function($ctx1) {
  41010. var $1,$3,$2,$receiver;
  41011. $1=_st($Smalltalk())._amdRequire();
  41012. if(($receiver = $1) == null || $receiver.isNil){
  41013. self._error_("AMD loader not present");
  41014. } else {
  41015. var require;
  41016. require=$receiver;
  41017. $3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  41018. $ctx1.sendIdx[","]=1;
  41019. $2=_st($Array())._new_($3);
  41020. _st(require)._value_($2);
  41021. };
  41022. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  41023. args: ["aPackage"],
  41024. source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  41025. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
  41026. referencedClasses: ["Smalltalk", "Array"]
  41027. }),
  41028. globals.AmdPackageHandler);
  41029. smalltalk.addMethod(
  41030. smalltalk.method({
  41031. selector: "namespaceFor:",
  41032. protocol: 'committing',
  41033. fn: function (aPackage){
  41034. var self=this;
  41035. return smalltalk.withContext(function($ctx1) {
  41036. var $1;
  41037. $1=_st(_st(aPackage)._transport())._namespace();
  41038. return $1;
  41039. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},globals.AmdPackageHandler)})},
  41040. args: ["aPackage"],
  41041. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  41042. messageSends: ["namespace", "transport"],
  41043. referencedClasses: []
  41044. }),
  41045. globals.AmdPackageHandler);
  41046. smalltalk.addMethod(
  41047. smalltalk.method({
  41048. selector: "toUrl:",
  41049. protocol: 'private',
  41050. fn: function (aString){
  41051. var self=this;
  41052. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  41053. return smalltalk.withContext(function($ctx1) {
  41054. var $2,$1,$receiver;
  41055. $2=_st($Smalltalk())._amdRequire();
  41056. if(($receiver = $2) == null || $receiver.isNil){
  41057. $1=self._error_("AMD loader not present");
  41058. } else {
  41059. var require;
  41060. require=$receiver;
  41061. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  41062. };
  41063. return $1;
  41064. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},globals.AmdPackageHandler)})},
  41065. args: ["aString"],
  41066. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
  41067. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"],
  41068. referencedClasses: ["Smalltalk"]
  41069. }),
  41070. globals.AmdPackageHandler);
  41071. smalltalk.addMethod(
  41072. smalltalk.method({
  41073. selector: "defaultNamespace",
  41074. protocol: 'commit paths',
  41075. fn: function (){
  41076. var self=this;
  41077. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  41078. return smalltalk.withContext(function($ctx1) {
  41079. var $1;
  41080. $1=_st($Smalltalk())._defaultAmdNamespace();
  41081. return $1;
  41082. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageHandler.klass)})},
  41083. args: [],
  41084. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  41085. messageSends: ["defaultAmdNamespace"],
  41086. referencedClasses: ["Smalltalk"]
  41087. }),
  41088. globals.AmdPackageHandler.klass);
  41089. smalltalk.addMethod(
  41090. smalltalk.method({
  41091. selector: "defaultNamespace:",
  41092. protocol: 'commit paths',
  41093. fn: function (aString){
  41094. var self=this;
  41095. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  41096. return smalltalk.withContext(function($ctx1) {
  41097. _st($Smalltalk())._defaultAmdNamespace_(aString);
  41098. return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},globals.AmdPackageHandler.klass)})},
  41099. args: ["aString"],
  41100. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  41101. messageSends: ["defaultAmdNamespace:"],
  41102. referencedClasses: ["Smalltalk"]
  41103. }),
  41104. globals.AmdPackageHandler.klass);
  41105. smalltalk.addClass('PackageTransport', globals.Object, ['package'], 'Kernel-ImportExport');
  41106. globals.PackageTransport.comment="I represent the transport mechanism used to commit a package.\x0a\x0aMy concrete subclasses have a `#handler` to which committing is delegated.";
  41107. smalltalk.addMethod(
  41108. smalltalk.method({
  41109. selector: "asJSON",
  41110. protocol: 'converting',
  41111. fn: function (){
  41112. var self=this;
  41113. return smalltalk.withContext(function($ctx1) {
  41114. var $1;
  41115. $1=globals.HashedCollection._newFromPairs_(["type",self._type()]);
  41116. return $1;
  41117. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.PackageTransport)})},
  41118. args: [],
  41119. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  41120. messageSends: ["type"],
  41121. referencedClasses: []
  41122. }),
  41123. globals.PackageTransport);
  41124. smalltalk.addMethod(
  41125. smalltalk.method({
  41126. selector: "commit",
  41127. protocol: 'committing',
  41128. fn: function (){
  41129. var self=this;
  41130. return smalltalk.withContext(function($ctx1) {
  41131. _st(self._commitHandler())._commit_(self._package());
  41132. return self}, function($ctx1) {$ctx1.fill(self,"commit",{},globals.PackageTransport)})},
  41133. args: [],
  41134. source: "commit\x0a\x09self commitHandler commit: self package",
  41135. messageSends: ["commit:", "commitHandler", "package"],
  41136. referencedClasses: []
  41137. }),
  41138. globals.PackageTransport);
  41139. smalltalk.addMethod(
  41140. smalltalk.method({
  41141. selector: "commitHandler",
  41142. protocol: 'factory',
  41143. fn: function (){
  41144. var self=this;
  41145. return smalltalk.withContext(function($ctx1) {
  41146. var $1;
  41147. $1=_st(self._commitHandlerClass())._new();
  41148. return $1;
  41149. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},globals.PackageTransport)})},
  41150. args: [],
  41151. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  41152. messageSends: ["new", "commitHandlerClass"],
  41153. referencedClasses: []
  41154. }),
  41155. globals.PackageTransport);
  41156. smalltalk.addMethod(
  41157. smalltalk.method({
  41158. selector: "commitHandlerClass",
  41159. protocol: 'accessing',
  41160. fn: function (){
  41161. var self=this;
  41162. return smalltalk.withContext(function($ctx1) {
  41163. self._subclassResponsibility();
  41164. return self}, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},globals.PackageTransport)})},
  41165. args: [],
  41166. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  41167. messageSends: ["subclassResponsibility"],
  41168. referencedClasses: []
  41169. }),
  41170. globals.PackageTransport);
  41171. smalltalk.addMethod(
  41172. smalltalk.method({
  41173. selector: "commitOnSuccess:onError:",
  41174. protocol: 'committing',
  41175. fn: function (aBlock,anotherBlock){
  41176. var self=this;
  41177. return smalltalk.withContext(function($ctx1) {
  41178. _st(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  41179. return self}, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageTransport)})},
  41180. args: ["aBlock", "anotherBlock"],
  41181. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  41182. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"],
  41183. referencedClasses: []
  41184. }),
  41185. globals.PackageTransport);
  41186. smalltalk.addMethod(
  41187. smalltalk.method({
  41188. selector: "definition",
  41189. protocol: 'accessing',
  41190. fn: function (){
  41191. var self=this;
  41192. return "";
  41193. },
  41194. args: [],
  41195. source: "definition\x0a\x09^ ''",
  41196. messageSends: [],
  41197. referencedClasses: []
  41198. }),
  41199. globals.PackageTransport);
  41200. smalltalk.addMethod(
  41201. smalltalk.method({
  41202. selector: "load",
  41203. protocol: 'loading',
  41204. fn: function (){
  41205. var self=this;
  41206. return smalltalk.withContext(function($ctx1) {
  41207. _st(self._commitHandler())._load_(self._package());
  41208. return self}, function($ctx1) {$ctx1.fill(self,"load",{},globals.PackageTransport)})},
  41209. args: [],
  41210. source: "load\x0a\x09self commitHandler load: self package",
  41211. messageSends: ["load:", "commitHandler", "package"],
  41212. referencedClasses: []
  41213. }),
  41214. globals.PackageTransport);
  41215. smalltalk.addMethod(
  41216. smalltalk.method({
  41217. selector: "package",
  41218. protocol: 'accessing',
  41219. fn: function (){
  41220. var self=this;
  41221. var $1;
  41222. $1=self["@package"];
  41223. return $1;
  41224. },
  41225. args: [],
  41226. source: "package\x0a\x09^ package",
  41227. messageSends: [],
  41228. referencedClasses: []
  41229. }),
  41230. globals.PackageTransport);
  41231. smalltalk.addMethod(
  41232. smalltalk.method({
  41233. selector: "package:",
  41234. protocol: 'accessing',
  41235. fn: function (aPackage){
  41236. var self=this;
  41237. self["@package"]=aPackage;
  41238. return self},
  41239. args: ["aPackage"],
  41240. source: "package: aPackage\x0a\x09package := aPackage",
  41241. messageSends: [],
  41242. referencedClasses: []
  41243. }),
  41244. globals.PackageTransport);
  41245. smalltalk.addMethod(
  41246. smalltalk.method({
  41247. selector: "setupFromJson:",
  41248. protocol: 'initialization',
  41249. fn: function (anObject){
  41250. var self=this;
  41251. return self},
  41252. args: ["anObject"],
  41253. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  41254. messageSends: [],
  41255. referencedClasses: []
  41256. }),
  41257. globals.PackageTransport);
  41258. smalltalk.addMethod(
  41259. smalltalk.method({
  41260. selector: "type",
  41261. protocol: 'accessing',
  41262. fn: function (){
  41263. var self=this;
  41264. return smalltalk.withContext(function($ctx1) {
  41265. var $1;
  41266. $1=_st(self._class())._type();
  41267. return $1;
  41268. }, function($ctx1) {$ctx1.fill(self,"type",{},globals.PackageTransport)})},
  41269. args: [],
  41270. source: "type\x0a\x09^ self class type",
  41271. messageSends: ["type", "class"],
  41272. referencedClasses: []
  41273. }),
  41274. globals.PackageTransport);
  41275. globals.PackageTransport.klass.iVarNames = ['registry'];
  41276. smalltalk.addMethod(
  41277. smalltalk.method({
  41278. selector: "classRegisteredFor:",
  41279. protocol: 'accessing',
  41280. fn: function (aString){
  41281. var self=this;
  41282. return smalltalk.withContext(function($ctx1) {
  41283. var $1;
  41284. $1=_st(self["@registry"])._at_(aString);
  41285. return $1;
  41286. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},globals.PackageTransport.klass)})},
  41287. args: ["aString"],
  41288. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  41289. messageSends: ["at:"],
  41290. referencedClasses: []
  41291. }),
  41292. globals.PackageTransport.klass);
  41293. smalltalk.addMethod(
  41294. smalltalk.method({
  41295. selector: "defaultType",
  41296. protocol: 'accessing',
  41297. fn: function (){
  41298. var self=this;
  41299. function $AmdPackageTransport(){return globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  41300. return smalltalk.withContext(function($ctx1) {
  41301. var $1;
  41302. $1=_st($AmdPackageTransport())._type();
  41303. return $1;
  41304. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},globals.PackageTransport.klass)})},
  41305. args: [],
  41306. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  41307. messageSends: ["type"],
  41308. referencedClasses: ["AmdPackageTransport"]
  41309. }),
  41310. globals.PackageTransport.klass);
  41311. smalltalk.addMethod(
  41312. smalltalk.method({
  41313. selector: "for:",
  41314. protocol: 'instance creation',
  41315. fn: function (aString){
  41316. var self=this;
  41317. return smalltalk.withContext(function($ctx1) {
  41318. var $1;
  41319. $1=_st(self._classRegisteredFor_(aString))._new();
  41320. return $1;
  41321. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},globals.PackageTransport.klass)})},
  41322. args: ["aString"],
  41323. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  41324. messageSends: ["new", "classRegisteredFor:"],
  41325. referencedClasses: []
  41326. }),
  41327. globals.PackageTransport.klass);
  41328. smalltalk.addMethod(
  41329. smalltalk.method({
  41330. selector: "fromJson:",
  41331. protocol: 'instance creation',
  41332. fn: function (anObject){
  41333. var self=this;
  41334. return smalltalk.withContext(function($ctx1) {
  41335. var $1,$3,$4,$2,$receiver;
  41336. if(($receiver = anObject) == null || $receiver.isNil){
  41337. $1=self._for_(self._defaultType());
  41338. $ctx1.sendIdx["for:"]=1;
  41339. return $1;
  41340. } else {
  41341. anObject;
  41342. };
  41343. $3=self._for_(_st(anObject)._type());
  41344. _st($3)._setupFromJson_(anObject);
  41345. $4=_st($3)._yourself();
  41346. $2=$4;
  41347. return $2;
  41348. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},globals.PackageTransport.klass)})},
  41349. args: ["anObject"],
  41350. source: "fromJson: anObject\x0a\x09anObject ifNil: [ ^ self for: self defaultType ].\x0a\x09\x0a\x09^ (self for: anObject type)\x0a\x09\x09setupFromJson: anObject;\x0a\x09\x09yourself",
  41351. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"],
  41352. referencedClasses: []
  41353. }),
  41354. globals.PackageTransport.klass);
  41355. smalltalk.addMethod(
  41356. smalltalk.method({
  41357. selector: "initialize",
  41358. protocol: 'initialization',
  41359. fn: function (){
  41360. var self=this;
  41361. return smalltalk.withContext(function($ctx1) {
  41362. ($ctx1.supercall = true, globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  41363. $ctx1.supercall = false;
  41364. self["@registry"]=globals.HashedCollection._newFromPairs_([]);
  41365. self._register();
  41366. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageTransport.klass)})},
  41367. args: [],
  41368. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  41369. messageSends: ["initialize", "register"],
  41370. referencedClasses: []
  41371. }),
  41372. globals.PackageTransport.klass);
  41373. smalltalk.addMethod(
  41374. smalltalk.method({
  41375. selector: "register",
  41376. protocol: 'registration',
  41377. fn: function (){
  41378. var self=this;
  41379. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  41380. return smalltalk.withContext(function($ctx1) {
  41381. _st($PackageTransport())._register_(self);
  41382. return self}, function($ctx1) {$ctx1.fill(self,"register",{},globals.PackageTransport.klass)})},
  41383. args: [],
  41384. source: "register\x0a\x09PackageTransport register: self",
  41385. messageSends: ["register:"],
  41386. referencedClasses: ["PackageTransport"]
  41387. }),
  41388. globals.PackageTransport.klass);
  41389. smalltalk.addMethod(
  41390. smalltalk.method({
  41391. selector: "register:",
  41392. protocol: 'registration',
  41393. fn: function (aClass){
  41394. var self=this;
  41395. return smalltalk.withContext(function($ctx1) {
  41396. var $1,$receiver;
  41397. $1=_st(aClass)._type();
  41398. $ctx1.sendIdx["type"]=1;
  41399. if(($receiver = $1) == null || $receiver.isNil){
  41400. $1;
  41401. } else {
  41402. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  41403. };
  41404. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},globals.PackageTransport.klass)})},
  41405. args: ["aClass"],
  41406. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  41407. messageSends: ["ifNotNil:", "type", "at:put:"],
  41408. referencedClasses: []
  41409. }),
  41410. globals.PackageTransport.klass);
  41411. smalltalk.addMethod(
  41412. smalltalk.method({
  41413. selector: "type",
  41414. protocol: 'accessing',
  41415. fn: function (){
  41416. var self=this;
  41417. return nil;
  41418. },
  41419. args: [],
  41420. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  41421. messageSends: [],
  41422. referencedClasses: []
  41423. }),
  41424. globals.PackageTransport.klass);
  41425. smalltalk.addClass('AmdPackageTransport', globals.PackageTransport, ['namespace'], 'Kernel-ImportExport');
  41426. globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  41427. smalltalk.addMethod(
  41428. smalltalk.method({
  41429. selector: "asJSON",
  41430. protocol: 'converting',
  41431. fn: function (){
  41432. var self=this;
  41433. return smalltalk.withContext(function($ctx1) {
  41434. var $2,$3,$1;
  41435. $2=($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []));
  41436. $ctx1.supercall = false;
  41437. _st($2)._at_put_("amdNamespace",self._namespace());
  41438. $3=_st($2)._yourself();
  41439. $1=$3;
  41440. return $1;
  41441. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.AmdPackageTransport)})},
  41442. args: [],
  41443. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  41444. messageSends: ["at:put:", "asJSON", "namespace", "yourself"],
  41445. referencedClasses: []
  41446. }),
  41447. globals.AmdPackageTransport);
  41448. smalltalk.addMethod(
  41449. smalltalk.method({
  41450. selector: "commitHandlerClass",
  41451. protocol: 'accessing',
  41452. fn: function (){
  41453. var self=this;
  41454. function $AmdPackageHandler(){return globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  41455. return $AmdPackageHandler();
  41456. },
  41457. args: [],
  41458. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  41459. messageSends: [],
  41460. referencedClasses: ["AmdPackageHandler"]
  41461. }),
  41462. globals.AmdPackageTransport);
  41463. smalltalk.addMethod(
  41464. smalltalk.method({
  41465. selector: "defaultNamespace",
  41466. protocol: 'defaults',
  41467. fn: function (){
  41468. var self=this;
  41469. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  41470. return smalltalk.withContext(function($ctx1) {
  41471. var $1;
  41472. $1=_st($Smalltalk())._defaultAmdNamespace();
  41473. return $1;
  41474. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageTransport)})},
  41475. args: [],
  41476. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  41477. messageSends: ["defaultAmdNamespace"],
  41478. referencedClasses: ["Smalltalk"]
  41479. }),
  41480. globals.AmdPackageTransport);
  41481. smalltalk.addMethod(
  41482. smalltalk.method({
  41483. selector: "definition",
  41484. protocol: 'accessing',
  41485. fn: function (){
  41486. var self=this;
  41487. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  41488. return smalltalk.withContext(function($ctx1) {
  41489. var $3,$2,$1;
  41490. $1=_st($String())._streamContents_((function(stream){
  41491. return smalltalk.withContext(function($ctx2) {
  41492. _st(stream)._nextPutAll_(_st(self._class())._name());
  41493. $ctx2.sendIdx["nextPutAll:"]=1;
  41494. _st(stream)._nextPutAll_(" namespace: ");
  41495. $ctx2.sendIdx["nextPutAll:"]=2;
  41496. $3=_st("'".__comma(self._namespace())).__comma("'");
  41497. $ctx2.sendIdx[","]=1;
  41498. $2=_st(stream)._nextPutAll_($3);
  41499. return $2;
  41500. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  41501. return $1;
  41502. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.AmdPackageTransport)})},
  41503. args: [],
  41504. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: self class name;\x0a\x09\x09\x09nextPutAll: ' namespace: ';\x0a\x09\x09\x09nextPutAll: '''', self namespace, '''' ]",
  41505. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"],
  41506. referencedClasses: ["String"]
  41507. }),
  41508. globals.AmdPackageTransport);
  41509. smalltalk.addMethod(
  41510. smalltalk.method({
  41511. selector: "namespace",
  41512. protocol: 'accessing',
  41513. fn: function (){
  41514. var self=this;
  41515. return smalltalk.withContext(function($ctx1) {
  41516. var $2,$1,$receiver;
  41517. $2=self["@namespace"];
  41518. if(($receiver = $2) == null || $receiver.isNil){
  41519. $1=self._defaultNamespace();
  41520. } else {
  41521. $1=$2;
  41522. };
  41523. return $1;
  41524. }, function($ctx1) {$ctx1.fill(self,"namespace",{},globals.AmdPackageTransport)})},
  41525. args: [],
  41526. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  41527. messageSends: ["ifNil:", "defaultNamespace"],
  41528. referencedClasses: []
  41529. }),
  41530. globals.AmdPackageTransport);
  41531. smalltalk.addMethod(
  41532. smalltalk.method({
  41533. selector: "namespace:",
  41534. protocol: 'accessing',
  41535. fn: function (aString){
  41536. var self=this;
  41537. self["@namespace"]=aString;
  41538. return self},
  41539. args: ["aString"],
  41540. source: "namespace: aString\x0a\x09namespace := aString",
  41541. messageSends: [],
  41542. referencedClasses: []
  41543. }),
  41544. globals.AmdPackageTransport);
  41545. smalltalk.addMethod(
  41546. smalltalk.method({
  41547. selector: "printOn:",
  41548. protocol: 'printing',
  41549. fn: function (aStream){
  41550. var self=this;
  41551. return smalltalk.withContext(function($ctx1) {
  41552. var $1;
  41553. ($ctx1.supercall = true, globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  41554. $ctx1.supercall = false;
  41555. _st(aStream)._nextPutAll_(" (AMD Namespace: ");
  41556. $ctx1.sendIdx["nextPutAll:"]=1;
  41557. _st(aStream)._nextPutAll_(self._namespace());
  41558. $ctx1.sendIdx["nextPutAll:"]=2;
  41559. $1=_st(aStream)._nextPutAll_(")");
  41560. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AmdPackageTransport)})},
  41561. args: ["aStream"],
  41562. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  41563. messageSends: ["printOn:", "nextPutAll:", "namespace"],
  41564. referencedClasses: []
  41565. }),
  41566. globals.AmdPackageTransport);
  41567. smalltalk.addMethod(
  41568. smalltalk.method({
  41569. selector: "setPath:",
  41570. protocol: 'actions',
  41571. fn: function (aString){
  41572. var self=this;
  41573. return smalltalk.withContext(function($ctx1) {
  41574. _st(_st(require)._basicAt_("config"))._value_(globals.HashedCollection._newFromPairs_(["paths",globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  41575. return self}, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},globals.AmdPackageTransport)})},
  41576. args: ["aString"],
  41577. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09(require basicAt: 'config') value: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  41578. messageSends: ["value:", "basicAt:", "namespace"],
  41579. referencedClasses: []
  41580. }),
  41581. globals.AmdPackageTransport);
  41582. smalltalk.addMethod(
  41583. smalltalk.method({
  41584. selector: "setupFromJson:",
  41585. protocol: 'initialization',
  41586. fn: function (anObject){
  41587. var self=this;
  41588. return smalltalk.withContext(function($ctx1) {
  41589. self._namespace_(_st(anObject)._at_("amdNamespace"));
  41590. return self}, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},globals.AmdPackageTransport)})},
  41591. args: ["anObject"],
  41592. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  41593. messageSends: ["namespace:", "at:"],
  41594. referencedClasses: []
  41595. }),
  41596. globals.AmdPackageTransport);
  41597. smalltalk.addMethod(
  41598. smalltalk.method({
  41599. selector: "namespace:",
  41600. protocol: 'instance creation',
  41601. fn: function (aString){
  41602. var self=this;
  41603. return smalltalk.withContext(function($ctx1) {
  41604. var $2,$3,$1;
  41605. $2=self._new();
  41606. _st($2)._namespace_(aString);
  41607. $3=_st($2)._yourself();
  41608. $1=$3;
  41609. return $1;
  41610. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},globals.AmdPackageTransport.klass)})},
  41611. args: ["aString"],
  41612. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  41613. messageSends: ["namespace:", "new", "yourself"],
  41614. referencedClasses: []
  41615. }),
  41616. globals.AmdPackageTransport.klass);
  41617. smalltalk.addMethod(
  41618. smalltalk.method({
  41619. selector: "type",
  41620. protocol: 'accessing',
  41621. fn: function (){
  41622. var self=this;
  41623. return "amd";
  41624. },
  41625. args: [],
  41626. source: "type\x0a\x09^ 'amd'",
  41627. messageSends: [],
  41628. referencedClasses: []
  41629. }),
  41630. globals.AmdPackageTransport.klass);
  41631. smalltalk.addMethod(
  41632. smalltalk.method({
  41633. selector: "commit",
  41634. protocol: '*Kernel-ImportExport',
  41635. fn: function (){
  41636. var self=this;
  41637. return smalltalk.withContext(function($ctx1) {
  41638. var $1;
  41639. $1=_st(self._transport())._commit();
  41640. return $1;
  41641. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.Package)})},
  41642. args: [],
  41643. source: "commit\x0a\x09^ self transport commit",
  41644. messageSends: ["commit", "transport"],
  41645. referencedClasses: []
  41646. }),
  41647. globals.Package);
  41648. smalltalk.addMethod(
  41649. smalltalk.method({
  41650. selector: "load",
  41651. protocol: '*Kernel-ImportExport',
  41652. fn: function (){
  41653. var self=this;
  41654. return smalltalk.withContext(function($ctx1) {
  41655. var $1;
  41656. $1=_st(self._transport())._load();
  41657. return $1;
  41658. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.Package)})},
  41659. args: [],
  41660. source: "load\x0a\x09^ self transport load",
  41661. messageSends: ["load", "transport"],
  41662. referencedClasses: []
  41663. }),
  41664. globals.Package);
  41665. smalltalk.addMethod(
  41666. smalltalk.method({
  41667. selector: "loadFromNamespace:",
  41668. protocol: '*Kernel-ImportExport',
  41669. fn: function (aString){
  41670. var self=this;
  41671. return smalltalk.withContext(function($ctx1) {
  41672. var $2,$3,$1;
  41673. $2=self._transport();
  41674. _st($2)._namespace_(aString);
  41675. $3=_st($2)._load();
  41676. $1=$3;
  41677. return $1;
  41678. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},globals.Package)})},
  41679. args: ["aString"],
  41680. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  41681. messageSends: ["namespace:", "transport", "load"],
  41682. referencedClasses: []
  41683. }),
  41684. globals.Package);
  41685. smalltalk.addMethod(
  41686. smalltalk.method({
  41687. selector: "load:",
  41688. protocol: '*Kernel-ImportExport',
  41689. fn: function (aPackageName){
  41690. var self=this;
  41691. return smalltalk.withContext(function($ctx1) {
  41692. _st(self._named_(aPackageName))._load();
  41693. return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},globals.Package.klass)})},
  41694. args: ["aPackageName"],
  41695. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  41696. messageSends: ["load", "named:"],
  41697. referencedClasses: []
  41698. }),
  41699. globals.Package.klass);
  41700. smalltalk.addMethod(
  41701. smalltalk.method({
  41702. selector: "load:fromNamespace:",
  41703. protocol: '*Kernel-ImportExport',
  41704. fn: function (aPackageName,aString){
  41705. var self=this;
  41706. return smalltalk.withContext(function($ctx1) {
  41707. _st(self._named_(aPackageName))._loadFromNamespace_(aString);
  41708. return self}, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},globals.Package.klass)})},
  41709. args: ["aPackageName", "aString"],
  41710. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  41711. messageSends: ["loadFromNamespace:", "named:"],
  41712. referencedClasses: []
  41713. }),
  41714. globals.Package.klass);
  41715. });
  41716. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  41717. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  41718. smalltalk.addPackage('Kernel-Tests');
  41719. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  41720. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  41721. smalltalk.addMethod(
  41722. smalltalk.method({
  41723. selector: "testAddExtensionMethod",
  41724. protocol: 'tests',
  41725. fn: function (){
  41726. var self=this;
  41727. var method,dirty;
  41728. return smalltalk.withContext(function($ctx1) {
  41729. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  41730. $2=self._class();
  41731. $ctx1.sendIdx["class"]=1;
  41732. $1=_st($2)._package();
  41733. $ctx1.sendIdx["package"]=1;
  41734. dirty=_st($1)._isDirty();
  41735. $ctx1.sendIdx["isDirty"]=1;
  41736. $4=self._class();
  41737. $ctx1.sendIdx["class"]=2;
  41738. $3=_st($4)._package();
  41739. $ctx1.sendIdx["package"]=2;
  41740. _st($3)._beClean();
  41741. $5=self._class();
  41742. $ctx1.sendIdx["class"]=3;
  41743. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  41744. $8=self._class();
  41745. $ctx1.sendIdx["class"]=4;
  41746. $7=_st($8)._package();
  41747. $ctx1.sendIdx["package"]=3;
  41748. $6=_st($7)._isDirty();
  41749. self._deny_($6);
  41750. $9=self._class();
  41751. $ctx1.sendIdx["class"]=5;
  41752. _st($9)._removeCompiledMethod_(method);
  41753. $10=dirty;
  41754. if(smalltalk.assert($10)){
  41755. _st(_st(self._class())._package())._beDirty();
  41756. };
  41757. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  41758. args: [],
  41759. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  41760. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  41761. referencedClasses: []
  41762. }),
  41763. globals.AnnouncementSubscriptionTest);
  41764. smalltalk.addMethod(
  41765. smalltalk.method({
  41766. selector: "testHandlesAnnouncement",
  41767. protocol: 'tests',
  41768. fn: function (){
  41769. var self=this;
  41770. var subscription,announcementClass1,announcementClass2,classBuilder;
  41771. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  41772. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  41773. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  41774. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  41775. return smalltalk.withContext(function($ctx1) {
  41776. var $1,$2;
  41777. classBuilder=_st($ClassBuilder())._new();
  41778. $ctx1.sendIdx["new"]=1;
  41779. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  41780. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  41781. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  41782. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  41783. self._assert_equals_($1,true);
  41784. $ctx1.sendIdx["assert:equals:"]=1;
  41785. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  41786. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  41787. self._assert_equals_($2,true);
  41788. $ctx1.sendIdx["assert:equals:"]=2;
  41789. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  41790. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  41791. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  41792. args: [],
  41793. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  41794. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  41795. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  41796. }),
  41797. globals.AnnouncementSubscriptionTest);
  41798. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  41799. smalltalk.addMethod(
  41800. smalltalk.method({
  41801. selector: "testOnDo",
  41802. protocol: 'tests',
  41803. fn: function (){
  41804. var self=this;
  41805. var counter,announcer;
  41806. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  41807. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  41808. return smalltalk.withContext(function($ctx1) {
  41809. var $1,$2;
  41810. counter=(0);
  41811. announcer=_st($Announcer())._new();
  41812. $ctx1.sendIdx["new"]=1;
  41813. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  41814. return smalltalk.withContext(function($ctx2) {
  41815. counter=_st(counter).__plus((1));
  41816. return counter;
  41817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  41818. $1=announcer;
  41819. $2=_st($SystemAnnouncement())._new();
  41820. $ctx1.sendIdx["new"]=2;
  41821. _st($1)._announce_($2);
  41822. $ctx1.sendIdx["announce:"]=1;
  41823. self._assert_equals_(counter,(1));
  41824. $ctx1.sendIdx["assert:equals:"]=1;
  41825. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  41826. self._assert_equals_(counter,(2));
  41827. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  41828. args: [],
  41829. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  41830. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  41831. referencedClasses: ["Announcer", "SystemAnnouncement"]
  41832. }),
  41833. globals.AnnouncerTest);
  41834. smalltalk.addMethod(
  41835. smalltalk.method({
  41836. selector: "testOnDoFor",
  41837. protocol: 'tests',
  41838. fn: function (){
  41839. var self=this;
  41840. var counter,announcer;
  41841. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  41842. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  41843. return smalltalk.withContext(function($ctx1) {
  41844. var $1,$2,$3,$4;
  41845. counter=(0);
  41846. announcer=_st($Announcer())._new();
  41847. $ctx1.sendIdx["new"]=1;
  41848. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  41849. return smalltalk.withContext(function($ctx2) {
  41850. counter=_st(counter).__plus((1));
  41851. return counter;
  41852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  41853. $1=announcer;
  41854. $2=_st($SystemAnnouncement())._new();
  41855. $ctx1.sendIdx["new"]=2;
  41856. _st($1)._announce_($2);
  41857. $ctx1.sendIdx["announce:"]=1;
  41858. self._assert_equals_(counter,(1));
  41859. $ctx1.sendIdx["assert:equals:"]=1;
  41860. $3=announcer;
  41861. $4=_st($SystemAnnouncement())._new();
  41862. $ctx1.sendIdx["new"]=3;
  41863. _st($3)._announce_($4);
  41864. $ctx1.sendIdx["announce:"]=2;
  41865. self._assert_equals_(counter,(2));
  41866. $ctx1.sendIdx["assert:equals:"]=2;
  41867. _st(announcer)._unsubscribe_(self);
  41868. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  41869. self._assert_equals_(counter,(2));
  41870. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  41871. args: [],
  41872. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  41873. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  41874. referencedClasses: ["Announcer", "SystemAnnouncement"]
  41875. }),
  41876. globals.AnnouncerTest);
  41877. smalltalk.addMethod(
  41878. smalltalk.method({
  41879. selector: "testOnDoOnce",
  41880. protocol: 'tests',
  41881. fn: function (){
  41882. var self=this;
  41883. var counter,announcer;
  41884. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  41885. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  41886. return smalltalk.withContext(function($ctx1) {
  41887. var $1,$2;
  41888. counter=(0);
  41889. announcer=_st($Announcer())._new();
  41890. $ctx1.sendIdx["new"]=1;
  41891. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  41892. return smalltalk.withContext(function($ctx2) {
  41893. counter=_st(counter).__plus((1));
  41894. return counter;
  41895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  41896. $1=announcer;
  41897. $2=_st($SystemAnnouncement())._new();
  41898. $ctx1.sendIdx["new"]=2;
  41899. _st($1)._announce_($2);
  41900. $ctx1.sendIdx["announce:"]=1;
  41901. self._assert_equals_(counter,(1));
  41902. $ctx1.sendIdx["assert:equals:"]=1;
  41903. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  41904. self._assert_equals_(counter,(1));
  41905. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  41906. args: [],
  41907. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  41908. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  41909. referencedClasses: ["Announcer", "SystemAnnouncement"]
  41910. }),
  41911. globals.AnnouncerTest);
  41912. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  41913. smalltalk.addMethod(
  41914. smalltalk.method({
  41915. selector: "testCanClearInterval",
  41916. protocol: 'tests',
  41917. fn: function (){
  41918. var self=this;
  41919. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  41920. return smalltalk.withContext(function($ctx1) {
  41921. self._shouldnt_raise_((function(){
  41922. return smalltalk.withContext(function($ctx2) {
  41923. return _st(_st((function(){
  41924. return smalltalk.withContext(function($ctx3) {
  41925. return _st(_st($Error())._new())._signal();
  41926. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  41927. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  41928. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  41929. args: [],
  41930. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  41931. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  41932. referencedClasses: ["Error"]
  41933. }),
  41934. globals.BlockClosureTest);
  41935. smalltalk.addMethod(
  41936. smalltalk.method({
  41937. selector: "testCanClearTimeout",
  41938. protocol: 'tests',
  41939. fn: function (){
  41940. var self=this;
  41941. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  41942. return smalltalk.withContext(function($ctx1) {
  41943. self._shouldnt_raise_((function(){
  41944. return smalltalk.withContext(function($ctx2) {
  41945. return _st(_st((function(){
  41946. return smalltalk.withContext(function($ctx3) {
  41947. return _st(_st($Error())._new())._signal();
  41948. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  41949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  41950. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  41951. args: [],
  41952. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  41953. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  41954. referencedClasses: ["Error"]
  41955. }),
  41956. globals.BlockClosureTest);
  41957. smalltalk.addMethod(
  41958. smalltalk.method({
  41959. selector: "testCompiledSource",
  41960. protocol: 'tests',
  41961. fn: function (){
  41962. var self=this;
  41963. return smalltalk.withContext(function($ctx1) {
  41964. self._assert_(_st(_st((function(){
  41965. return smalltalk.withContext(function($ctx2) {
  41966. return (1).__plus((1));
  41967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  41968. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  41969. args: [],
  41970. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  41971. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  41972. referencedClasses: []
  41973. }),
  41974. globals.BlockClosureTest);
  41975. smalltalk.addMethod(
  41976. smalltalk.method({
  41977. selector: "testCurrySelf",
  41978. protocol: 'tests',
  41979. fn: function (){
  41980. var self=this;
  41981. var curriedMethod,array;
  41982. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  41983. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  41984. return smalltalk.withContext(function($ctx1) {
  41985. curriedMethod=_st(_st((function(selfarg,x){
  41986. return smalltalk.withContext(function($ctx2) {
  41987. return _st(selfarg)._at_(x);
  41988. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  41989. array=[(3), (1), (4)];
  41990. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  41991. _st((function(){
  41992. return smalltalk.withContext(function($ctx2) {
  41993. return self._assert_equals_(_st(array)._foo_((2)),(1));
  41994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  41995. return smalltalk.withContext(function($ctx2) {
  41996. return _st($Array())._removeCompiledMethod_(curriedMethod);
  41997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  41998. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  41999. args: [],
  42000. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  42001. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  42002. referencedClasses: ["ClassBuilder", "Array"]
  42003. }),
  42004. globals.BlockClosureTest);
  42005. smalltalk.addMethod(
  42006. smalltalk.method({
  42007. selector: "testEnsure",
  42008. protocol: 'tests',
  42009. fn: function (){
  42010. var self=this;
  42011. return smalltalk.withContext(function($ctx1) {
  42012. self._assert_equals_(_st((function(){
  42013. return (3);
  42014. }))._ensure_((function(){
  42015. return (4);
  42016. })),(3));
  42017. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  42018. args: [],
  42019. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  42020. messageSends: ["assert:equals:", "ensure:"],
  42021. referencedClasses: []
  42022. }),
  42023. globals.BlockClosureTest);
  42024. smalltalk.addMethod(
  42025. smalltalk.method({
  42026. selector: "testEnsureRaises",
  42027. protocol: 'tests',
  42028. fn: function (){
  42029. var self=this;
  42030. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  42031. return smalltalk.withContext(function($ctx1) {
  42032. self._should_raise_((function(){
  42033. return smalltalk.withContext(function($ctx2) {
  42034. return _st((function(){
  42035. return smalltalk.withContext(function($ctx3) {
  42036. return _st(_st($Error())._new())._signal();
  42037. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  42038. return true;
  42039. }));
  42040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  42041. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  42042. args: [],
  42043. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  42044. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  42045. referencedClasses: ["Error"]
  42046. }),
  42047. globals.BlockClosureTest);
  42048. smalltalk.addMethod(
  42049. smalltalk.method({
  42050. selector: "testExceptionSemantics",
  42051. protocol: 'tests',
  42052. fn: function (){
  42053. var self=this;
  42054. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  42055. return smalltalk.withContext(function($ctx1) {
  42056. self._timeout_((100));
  42057. _st(self._async_((function(){
  42058. return smalltalk.withContext(function($ctx2) {
  42059. return _st((function(){
  42060. return smalltalk.withContext(function($ctx3) {
  42061. self._assert_(true);
  42062. _st($Error())._signal();
  42063. self._deny_(true);
  42064. return self._finished();
  42065. $ctx3.sendIdx["finished"]=1;
  42066. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  42067. return smalltalk.withContext(function($ctx3) {
  42068. return self._finished();
  42069. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  42070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  42071. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  42072. args: [],
  42073. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  42074. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  42075. referencedClasses: ["Error"]
  42076. }),
  42077. globals.BlockClosureTest);
  42078. smalltalk.addMethod(
  42079. smalltalk.method({
  42080. selector: "testNewWithValues",
  42081. protocol: 'tests',
  42082. fn: function (){
  42083. var self=this;
  42084. return smalltalk.withContext(function($ctx1) {
  42085. function TestConstructor(arg1, arg2, arg3) {}
  42086. TestConstructor.prototype.name = 'theTestPrototype';
  42087. var wrappedConstructor = _st(TestConstructor);
  42088. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  42089. self._assert_(result instanceof TestConstructor);
  42090. self._assert_equals_(result.name, 'theTestPrototype');
  42091. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  42092. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  42093. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  42094. args: [],
  42095. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  42096. messageSends: [],
  42097. referencedClasses: []
  42098. }),
  42099. globals.BlockClosureTest);
  42100. smalltalk.addMethod(
  42101. smalltalk.method({
  42102. selector: "testNumArgs",
  42103. protocol: 'tests',
  42104. fn: function (){
  42105. var self=this;
  42106. return smalltalk.withContext(function($ctx1) {
  42107. var $1;
  42108. $1=_st((function(){
  42109. }))._numArgs();
  42110. $ctx1.sendIdx["numArgs"]=1;
  42111. self._assert_equals_($1,(0));
  42112. $ctx1.sendIdx["assert:equals:"]=1;
  42113. self._assert_equals_(_st((function(a,b){
  42114. }))._numArgs(),(2));
  42115. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  42116. args: [],
  42117. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  42118. messageSends: ["assert:equals:", "numArgs"],
  42119. referencedClasses: []
  42120. }),
  42121. globals.BlockClosureTest);
  42122. smalltalk.addMethod(
  42123. smalltalk.method({
  42124. selector: "testOnDo",
  42125. protocol: 'tests',
  42126. fn: function (){
  42127. var self=this;
  42128. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  42129. return smalltalk.withContext(function($ctx1) {
  42130. self._assert_(_st((function(){
  42131. return smalltalk.withContext(function($ctx2) {
  42132. return _st(_st($Error())._new())._signal();
  42133. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  42134. return true;
  42135. })));
  42136. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  42137. args: [],
  42138. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  42139. messageSends: ["assert:", "on:do:", "signal", "new"],
  42140. referencedClasses: ["Error"]
  42141. }),
  42142. globals.BlockClosureTest);
  42143. smalltalk.addMethod(
  42144. smalltalk.method({
  42145. selector: "testValue",
  42146. protocol: 'tests',
  42147. fn: function (){
  42148. var self=this;
  42149. return smalltalk.withContext(function($ctx1) {
  42150. var $1;
  42151. $1=_st((function(){
  42152. return smalltalk.withContext(function($ctx2) {
  42153. return (1).__plus((1));
  42154. $ctx2.sendIdx["+"]=1;
  42155. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  42156. $ctx1.sendIdx["value"]=1;
  42157. self._assert_equals_($1,(2));
  42158. $ctx1.sendIdx["assert:equals:"]=1;
  42159. self._assert_equals_(_st((function(x){
  42160. return smalltalk.withContext(function($ctx2) {
  42161. return _st(x).__plus((1));
  42162. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  42163. $ctx1.sendIdx["assert:equals:"]=2;
  42164. self._assert_equals_(_st((function(x,y){
  42165. return smalltalk.withContext(function($ctx2) {
  42166. return _st(x).__star(y);
  42167. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  42168. $ctx1.sendIdx["assert:equals:"]=3;
  42169. self._assert_equals_(_st((function(a,b,c){
  42170. return (1);
  42171. }))._value(),(1));
  42172. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  42173. args: [],
  42174. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  42175. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  42176. referencedClasses: []
  42177. }),
  42178. globals.BlockClosureTest);
  42179. smalltalk.addMethod(
  42180. smalltalk.method({
  42181. selector: "testValueWithPossibleArguments",
  42182. protocol: 'tests',
  42183. fn: function (){
  42184. var self=this;
  42185. return smalltalk.withContext(function($ctx1) {
  42186. var $1,$2;
  42187. $1=_st((function(){
  42188. return (1);
  42189. }))._valueWithPossibleArguments_([(3), (4)]);
  42190. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  42191. self._assert_equals_($1,(1));
  42192. $ctx1.sendIdx["assert:equals:"]=1;
  42193. $2=_st((function(a){
  42194. return smalltalk.withContext(function($ctx2) {
  42195. return _st(a).__plus((4));
  42196. $ctx2.sendIdx["+"]=1;
  42197. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  42198. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  42199. self._assert_equals_($2,(7));
  42200. $ctx1.sendIdx["assert:equals:"]=2;
  42201. self._assert_equals_(_st((function(a,b){
  42202. return smalltalk.withContext(function($ctx2) {
  42203. return _st(a).__plus(b);
  42204. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  42205. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  42206. args: [],
  42207. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  42208. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  42209. referencedClasses: []
  42210. }),
  42211. globals.BlockClosureTest);
  42212. smalltalk.addMethod(
  42213. smalltalk.method({
  42214. selector: "testWhileFalse",
  42215. protocol: 'tests',
  42216. fn: function (){
  42217. var self=this;
  42218. var i;
  42219. return smalltalk.withContext(function($ctx1) {
  42220. i=(0);
  42221. _st((function(){
  42222. return smalltalk.withContext(function($ctx2) {
  42223. return _st(i).__gt((5));
  42224. $ctx2.sendIdx[">"]=1;
  42225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  42226. return smalltalk.withContext(function($ctx2) {
  42227. i=_st(i).__plus((1));
  42228. $ctx2.sendIdx["+"]=1;
  42229. return i;
  42230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  42231. self._assert_equals_(i,(6));
  42232. $ctx1.sendIdx["assert:equals:"]=1;
  42233. i=(0);
  42234. _st((function(){
  42235. return smalltalk.withContext(function($ctx2) {
  42236. i=_st(i).__plus((1));
  42237. i;
  42238. return _st(i).__gt((5));
  42239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  42240. self._assert_equals_(i,(6));
  42241. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  42242. args: [],
  42243. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  42244. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  42245. referencedClasses: []
  42246. }),
  42247. globals.BlockClosureTest);
  42248. smalltalk.addMethod(
  42249. smalltalk.method({
  42250. selector: "testWhileTrue",
  42251. protocol: 'tests',
  42252. fn: function (){
  42253. var self=this;
  42254. var i;
  42255. return smalltalk.withContext(function($ctx1) {
  42256. i=(0);
  42257. _st((function(){
  42258. return smalltalk.withContext(function($ctx2) {
  42259. return _st(i).__lt((5));
  42260. $ctx2.sendIdx["<"]=1;
  42261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  42262. return smalltalk.withContext(function($ctx2) {
  42263. i=_st(i).__plus((1));
  42264. $ctx2.sendIdx["+"]=1;
  42265. return i;
  42266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  42267. self._assert_equals_(i,(5));
  42268. $ctx1.sendIdx["assert:equals:"]=1;
  42269. i=(0);
  42270. _st((function(){
  42271. return smalltalk.withContext(function($ctx2) {
  42272. i=_st(i).__plus((1));
  42273. i;
  42274. return _st(i).__lt((5));
  42275. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  42276. self._assert_equals_(i,(5));
  42277. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  42278. args: [],
  42279. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  42280. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  42281. referencedClasses: []
  42282. }),
  42283. globals.BlockClosureTest);
  42284. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  42285. smalltalk.addMethod(
  42286. smalltalk.method({
  42287. selector: "testEquality",
  42288. protocol: 'tests',
  42289. fn: function (){
  42290. var self=this;
  42291. return smalltalk.withContext(function($ctx1) {
  42292. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  42293. $1=(0).__eq(false);
  42294. $ctx1.sendIdx["="]=1;
  42295. self._deny_($1);
  42296. $ctx1.sendIdx["deny:"]=1;
  42297. $2=false.__eq((0));
  42298. $ctx1.sendIdx["="]=2;
  42299. self._deny_($2);
  42300. $ctx1.sendIdx["deny:"]=2;
  42301. $3="".__eq(false);
  42302. $ctx1.sendIdx["="]=3;
  42303. self._deny_($3);
  42304. $ctx1.sendIdx["deny:"]=3;
  42305. $4=false.__eq("");
  42306. $ctx1.sendIdx["="]=4;
  42307. self._deny_($4);
  42308. $ctx1.sendIdx["deny:"]=4;
  42309. $5=true.__eq(true);
  42310. $ctx1.sendIdx["="]=5;
  42311. self._assert_($5);
  42312. $ctx1.sendIdx["assert:"]=1;
  42313. $6=false.__eq(true);
  42314. $ctx1.sendIdx["="]=6;
  42315. self._deny_($6);
  42316. $ctx1.sendIdx["deny:"]=5;
  42317. $7=true.__eq(false);
  42318. $ctx1.sendIdx["="]=7;
  42319. self._deny_($7);
  42320. $8=false.__eq(false);
  42321. $ctx1.sendIdx["="]=8;
  42322. self._assert_($8);
  42323. $ctx1.sendIdx["assert:"]=2;
  42324. $10=true._yourself();
  42325. $ctx1.sendIdx["yourself"]=1;
  42326. $9=_st($10).__eq(true);
  42327. $ctx1.sendIdx["="]=9;
  42328. self._assert_($9);
  42329. $ctx1.sendIdx["assert:"]=3;
  42330. $12=true._yourself();
  42331. $ctx1.sendIdx["yourself"]=2;
  42332. $11=_st($12).__eq(true._yourself());
  42333. self._assert_($11);
  42334. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  42335. args: [],
  42336. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  42337. messageSends: ["deny:", "=", "assert:", "yourself"],
  42338. referencedClasses: []
  42339. }),
  42340. globals.BooleanTest);
  42341. smalltalk.addMethod(
  42342. smalltalk.method({
  42343. selector: "testIdentity",
  42344. protocol: 'tests',
  42345. fn: function (){
  42346. var self=this;
  42347. return smalltalk.withContext(function($ctx1) {
  42348. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  42349. $1=(0).__eq_eq(false);
  42350. $ctx1.sendIdx["=="]=1;
  42351. self._deny_($1);
  42352. $ctx1.sendIdx["deny:"]=1;
  42353. $2=false.__eq_eq((0));
  42354. $ctx1.sendIdx["=="]=2;
  42355. self._deny_($2);
  42356. $ctx1.sendIdx["deny:"]=2;
  42357. $3="".__eq_eq(false);
  42358. $ctx1.sendIdx["=="]=3;
  42359. self._deny_($3);
  42360. $ctx1.sendIdx["deny:"]=3;
  42361. $4=false.__eq_eq("");
  42362. $ctx1.sendIdx["=="]=4;
  42363. self._deny_($4);
  42364. $ctx1.sendIdx["deny:"]=4;
  42365. $5=true.__eq_eq(true);
  42366. $ctx1.sendIdx["=="]=5;
  42367. self._assert_($5);
  42368. $ctx1.sendIdx["assert:"]=1;
  42369. $6=false.__eq_eq(true);
  42370. $ctx1.sendIdx["=="]=6;
  42371. self._deny_($6);
  42372. $ctx1.sendIdx["deny:"]=5;
  42373. $7=true.__eq_eq(false);
  42374. $ctx1.sendIdx["=="]=7;
  42375. self._deny_($7);
  42376. $8=false.__eq_eq(false);
  42377. $ctx1.sendIdx["=="]=8;
  42378. self._assert_($8);
  42379. $ctx1.sendIdx["assert:"]=2;
  42380. $10=true._yourself();
  42381. $ctx1.sendIdx["yourself"]=1;
  42382. $9=_st($10).__eq_eq(true);
  42383. $ctx1.sendIdx["=="]=9;
  42384. self._assert_($9);
  42385. $ctx1.sendIdx["assert:"]=3;
  42386. $12=true._yourself();
  42387. $ctx1.sendIdx["yourself"]=2;
  42388. $11=_st($12).__eq_eq(true._yourself());
  42389. self._assert_($11);
  42390. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  42391. args: [],
  42392. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  42393. messageSends: ["deny:", "==", "assert:", "yourself"],
  42394. referencedClasses: []
  42395. }),
  42396. globals.BooleanTest);
  42397. smalltalk.addMethod(
  42398. smalltalk.method({
  42399. selector: "testIfTrueIfFalse",
  42400. protocol: 'tests',
  42401. fn: function (){
  42402. var self=this;
  42403. return smalltalk.withContext(function($ctx1) {
  42404. var $1,$2,$3,$4,$5,$6,$7,$8;
  42405. if(smalltalk.assert(true)){
  42406. $1="alternative block";
  42407. };
  42408. self._assert_equals_($1,"alternative block");
  42409. $ctx1.sendIdx["assert:equals:"]=1;
  42410. if(! smalltalk.assert(true)){
  42411. $2="alternative block";
  42412. };
  42413. self._assert_equals_($2,nil);
  42414. $ctx1.sendIdx["assert:equals:"]=2;
  42415. if(smalltalk.assert(false)){
  42416. $3="alternative block";
  42417. };
  42418. self._assert_equals_($3,nil);
  42419. $ctx1.sendIdx["assert:equals:"]=3;
  42420. if(! smalltalk.assert(false)){
  42421. $4="alternative block";
  42422. };
  42423. self._assert_equals_($4,"alternative block");
  42424. $ctx1.sendIdx["assert:equals:"]=4;
  42425. if(smalltalk.assert(false)){
  42426. $5="alternative block";
  42427. } else {
  42428. $5="alternative block2";
  42429. };
  42430. self._assert_equals_($5,"alternative block2");
  42431. $ctx1.sendIdx["assert:equals:"]=5;
  42432. if(smalltalk.assert(false)){
  42433. $6="alternative block2";
  42434. } else {
  42435. $6="alternative block";
  42436. };
  42437. self._assert_equals_($6,"alternative block");
  42438. $ctx1.sendIdx["assert:equals:"]=6;
  42439. if(smalltalk.assert(true)){
  42440. $7="alternative block";
  42441. } else {
  42442. $7="alternative block2";
  42443. };
  42444. self._assert_equals_($7,"alternative block");
  42445. $ctx1.sendIdx["assert:equals:"]=7;
  42446. if(smalltalk.assert(true)){
  42447. $8="alternative block2";
  42448. } else {
  42449. $8="alternative block";
  42450. };
  42451. self._assert_equals_($8,"alternative block2");
  42452. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  42453. args: [],
  42454. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  42455. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  42456. referencedClasses: []
  42457. }),
  42458. globals.BooleanTest);
  42459. smalltalk.addMethod(
  42460. smalltalk.method({
  42461. selector: "testIfTrueIfFalseWithBoxing",
  42462. protocol: 'tests',
  42463. fn: function (){
  42464. var self=this;
  42465. return smalltalk.withContext(function($ctx1) {
  42466. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  42467. $2=true._yourself();
  42468. $ctx1.sendIdx["yourself"]=1;
  42469. if(smalltalk.assert($2)){
  42470. $1="alternative block";
  42471. };
  42472. self._assert_equals_($1,"alternative block");
  42473. $ctx1.sendIdx["assert:equals:"]=1;
  42474. $4=true._yourself();
  42475. $ctx1.sendIdx["yourself"]=2;
  42476. if(! smalltalk.assert($4)){
  42477. $3="alternative block";
  42478. };
  42479. self._assert_equals_($3,nil);
  42480. $ctx1.sendIdx["assert:equals:"]=2;
  42481. $6=false._yourself();
  42482. $ctx1.sendIdx["yourself"]=3;
  42483. if(smalltalk.assert($6)){
  42484. $5="alternative block";
  42485. };
  42486. self._assert_equals_($5,nil);
  42487. $ctx1.sendIdx["assert:equals:"]=3;
  42488. $8=false._yourself();
  42489. $ctx1.sendIdx["yourself"]=4;
  42490. if(! smalltalk.assert($8)){
  42491. $7="alternative block";
  42492. };
  42493. self._assert_equals_($7,"alternative block");
  42494. $ctx1.sendIdx["assert:equals:"]=4;
  42495. $10=false._yourself();
  42496. $ctx1.sendIdx["yourself"]=5;
  42497. if(smalltalk.assert($10)){
  42498. $9="alternative block";
  42499. } else {
  42500. $9="alternative block2";
  42501. };
  42502. self._assert_equals_($9,"alternative block2");
  42503. $ctx1.sendIdx["assert:equals:"]=5;
  42504. $12=false._yourself();
  42505. $ctx1.sendIdx["yourself"]=6;
  42506. if(smalltalk.assert($12)){
  42507. $11="alternative block2";
  42508. } else {
  42509. $11="alternative block";
  42510. };
  42511. self._assert_equals_($11,"alternative block");
  42512. $ctx1.sendIdx["assert:equals:"]=6;
  42513. $14=true._yourself();
  42514. $ctx1.sendIdx["yourself"]=7;
  42515. if(smalltalk.assert($14)){
  42516. $13="alternative block";
  42517. } else {
  42518. $13="alternative block2";
  42519. };
  42520. self._assert_equals_($13,"alternative block");
  42521. $ctx1.sendIdx["assert:equals:"]=7;
  42522. $16=true._yourself();
  42523. if(smalltalk.assert($16)){
  42524. $15="alternative block2";
  42525. } else {
  42526. $15="alternative block";
  42527. };
  42528. self._assert_equals_($15,"alternative block2");
  42529. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  42530. args: [],
  42531. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  42532. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  42533. referencedClasses: []
  42534. }),
  42535. globals.BooleanTest);
  42536. smalltalk.addMethod(
  42537. smalltalk.method({
  42538. selector: "testLogic",
  42539. protocol: 'tests',
  42540. fn: function (){
  42541. var self=this;
  42542. return smalltalk.withContext(function($ctx1) {
  42543. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  42544. $1=true.__and(true);
  42545. $ctx1.sendIdx["&"]=1;
  42546. self._assert_($1);
  42547. $ctx1.sendIdx["assert:"]=1;
  42548. $2=true.__and(false);
  42549. $ctx1.sendIdx["&"]=2;
  42550. self._deny_($2);
  42551. $ctx1.sendIdx["deny:"]=1;
  42552. $3=false.__and(true);
  42553. $ctx1.sendIdx["&"]=3;
  42554. self._deny_($3);
  42555. $ctx1.sendIdx["deny:"]=2;
  42556. $5=false.__and(false);
  42557. $ctx1.sendIdx["&"]=4;
  42558. $4=self._deny_($5);
  42559. $ctx1.sendIdx["deny:"]=3;
  42560. $6=true.__or(true);
  42561. $ctx1.sendIdx["|"]=1;
  42562. self._assert_($6);
  42563. $ctx1.sendIdx["assert:"]=2;
  42564. $7=true.__or(false);
  42565. $ctx1.sendIdx["|"]=2;
  42566. self._assert_($7);
  42567. $ctx1.sendIdx["assert:"]=3;
  42568. $8=false.__or(true);
  42569. $ctx1.sendIdx["|"]=3;
  42570. self._assert_($8);
  42571. $ctx1.sendIdx["assert:"]=4;
  42572. $10=false.__or(false);
  42573. $ctx1.sendIdx["|"]=4;
  42574. $9=self._deny_($10);
  42575. $ctx1.sendIdx["deny:"]=4;
  42576. $12=(1).__gt((0));
  42577. $ctx1.sendIdx[">"]=1;
  42578. $11=true.__and($12);
  42579. $ctx1.sendIdx["&"]=5;
  42580. self._assert_($11);
  42581. $ctx1.sendIdx["assert:"]=5;
  42582. $14=(1).__gt((0));
  42583. $ctx1.sendIdx[">"]=2;
  42584. $13=_st($14).__and(false);
  42585. $ctx1.sendIdx["&"]=6;
  42586. self._deny_($13);
  42587. $ctx1.sendIdx["deny:"]=5;
  42588. $17=(1).__gt((0));
  42589. $ctx1.sendIdx[">"]=3;
  42590. $18=(1).__gt((2));
  42591. $ctx1.sendIdx[">"]=4;
  42592. $16=_st($17).__and($18);
  42593. $15=self._deny_($16);
  42594. $20=(1).__gt((0));
  42595. $ctx1.sendIdx[">"]=5;
  42596. $19=false.__or($20);
  42597. $ctx1.sendIdx["|"]=5;
  42598. self._assert_($19);
  42599. $ctx1.sendIdx["assert:"]=6;
  42600. $22=(1).__gt((0));
  42601. $ctx1.sendIdx[">"]=6;
  42602. $21=_st($22).__or(false);
  42603. $ctx1.sendIdx["|"]=6;
  42604. self._assert_($21);
  42605. $ctx1.sendIdx["assert:"]=7;
  42606. $25=(1).__gt((0));
  42607. $ctx1.sendIdx[">"]=7;
  42608. $24=_st($25).__or((1).__gt((2)));
  42609. $23=self._assert_($24);
  42610. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  42611. args: [],
  42612. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  42613. messageSends: ["assert:", "&", "deny:", "|", ">"],
  42614. referencedClasses: []
  42615. }),
  42616. globals.BooleanTest);
  42617. smalltalk.addMethod(
  42618. smalltalk.method({
  42619. selector: "testLogicKeywords",
  42620. protocol: 'tests',
  42621. fn: function (){
  42622. var self=this;
  42623. return smalltalk.withContext(function($ctx1) {
  42624. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  42625. $1=true._and_((function(){
  42626. return true;
  42627. }));
  42628. $ctx1.sendIdx["and:"]=1;
  42629. self._assert_($1);
  42630. $ctx1.sendIdx["assert:"]=1;
  42631. $2=true._and_((function(){
  42632. return false;
  42633. }));
  42634. $ctx1.sendIdx["and:"]=2;
  42635. self._deny_($2);
  42636. $ctx1.sendIdx["deny:"]=1;
  42637. $3=false._and_((function(){
  42638. return true;
  42639. }));
  42640. $ctx1.sendIdx["and:"]=3;
  42641. self._deny_($3);
  42642. $ctx1.sendIdx["deny:"]=2;
  42643. $5=false._and_((function(){
  42644. return false;
  42645. }));
  42646. $ctx1.sendIdx["and:"]=4;
  42647. $4=self._deny_($5);
  42648. $ctx1.sendIdx["deny:"]=3;
  42649. $6=true._or_((function(){
  42650. return true;
  42651. }));
  42652. $ctx1.sendIdx["or:"]=1;
  42653. self._assert_($6);
  42654. $ctx1.sendIdx["assert:"]=2;
  42655. $7=true._or_((function(){
  42656. return false;
  42657. }));
  42658. $ctx1.sendIdx["or:"]=2;
  42659. self._assert_($7);
  42660. $ctx1.sendIdx["assert:"]=3;
  42661. $8=false._or_((function(){
  42662. return true;
  42663. }));
  42664. $ctx1.sendIdx["or:"]=3;
  42665. self._assert_($8);
  42666. $ctx1.sendIdx["assert:"]=4;
  42667. $10=false._or_((function(){
  42668. return false;
  42669. }));
  42670. $ctx1.sendIdx["or:"]=4;
  42671. $9=self._deny_($10);
  42672. $ctx1.sendIdx["deny:"]=4;
  42673. $11=true._and_((function(){
  42674. return smalltalk.withContext(function($ctx2) {
  42675. return (1).__gt((0));
  42676. $ctx2.sendIdx[">"]=1;
  42677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  42678. $ctx1.sendIdx["and:"]=5;
  42679. self._assert_($11);
  42680. $ctx1.sendIdx["assert:"]=5;
  42681. $13=(1).__gt((0));
  42682. $ctx1.sendIdx[">"]=2;
  42683. $12=_st($13)._and_((function(){
  42684. return false;
  42685. }));
  42686. $ctx1.sendIdx["and:"]=6;
  42687. self._deny_($12);
  42688. $ctx1.sendIdx["deny:"]=5;
  42689. $16=(1).__gt((0));
  42690. $ctx1.sendIdx[">"]=3;
  42691. $15=_st($16)._and_((function(){
  42692. return smalltalk.withContext(function($ctx2) {
  42693. return (1).__gt((2));
  42694. $ctx2.sendIdx[">"]=4;
  42695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  42696. $14=self._deny_($15);
  42697. $17=false._or_((function(){
  42698. return smalltalk.withContext(function($ctx2) {
  42699. return (1).__gt((0));
  42700. $ctx2.sendIdx[">"]=5;
  42701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  42702. $ctx1.sendIdx["or:"]=5;
  42703. self._assert_($17);
  42704. $ctx1.sendIdx["assert:"]=6;
  42705. $19=(1).__gt((0));
  42706. $ctx1.sendIdx[">"]=6;
  42707. $18=_st($19)._or_((function(){
  42708. return false;
  42709. }));
  42710. $ctx1.sendIdx["or:"]=6;
  42711. self._assert_($18);
  42712. $ctx1.sendIdx["assert:"]=7;
  42713. $22=(1).__gt((0));
  42714. $ctx1.sendIdx[">"]=7;
  42715. $21=_st($22)._or_((function(){
  42716. return smalltalk.withContext(function($ctx2) {
  42717. return (1).__gt((2));
  42718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  42719. $20=self._assert_($21);
  42720. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  42721. args: [],
  42722. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  42723. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  42724. referencedClasses: []
  42725. }),
  42726. globals.BooleanTest);
  42727. smalltalk.addMethod(
  42728. smalltalk.method({
  42729. selector: "testNonBooleanError",
  42730. protocol: 'tests',
  42731. fn: function (){
  42732. var self=this;
  42733. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  42734. return smalltalk.withContext(function($ctx1) {
  42735. self._should_raise_((function(){
  42736. return smalltalk.withContext(function($ctx2) {
  42737. if(smalltalk.assert("")){
  42738. } else {
  42739. };
  42740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  42741. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  42742. args: [],
  42743. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  42744. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  42745. referencedClasses: ["NonBooleanReceiver"]
  42746. }),
  42747. globals.BooleanTest);
  42748. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  42749. smalltalk.addMethod(
  42750. smalltalk.method({
  42751. selector: "setUp",
  42752. protocol: 'running',
  42753. fn: function (){
  42754. var self=this;
  42755. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  42756. return smalltalk.withContext(function($ctx1) {
  42757. self["@builder"]=_st($ClassBuilder())._new();
  42758. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  42759. args: [],
  42760. source: "setUp\x0a\x09builder := ClassBuilder new",
  42761. messageSends: ["new"],
  42762. referencedClasses: ["ClassBuilder"]
  42763. }),
  42764. globals.ClassBuilderTest);
  42765. smalltalk.addMethod(
  42766. smalltalk.method({
  42767. selector: "tearDown",
  42768. protocol: 'running',
  42769. fn: function (){
  42770. var self=this;
  42771. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  42772. return smalltalk.withContext(function($ctx1) {
  42773. var $1,$receiver;
  42774. $1=self["@theClass"];
  42775. if(($receiver = $1) == null || $receiver.isNil){
  42776. $1;
  42777. } else {
  42778. _st($Smalltalk())._removeClass_(self["@theClass"]);
  42779. self["@theClass"]=nil;
  42780. self["@theClass"];
  42781. };
  42782. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  42783. args: [],
  42784. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  42785. messageSends: ["ifNotNil:", "removeClass:"],
  42786. referencedClasses: ["Smalltalk"]
  42787. }),
  42788. globals.ClassBuilderTest);
  42789. smalltalk.addMethod(
  42790. smalltalk.method({
  42791. selector: "testClassCopy",
  42792. protocol: 'tests',
  42793. fn: function (){
  42794. var self=this;
  42795. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  42796. return smalltalk.withContext(function($ctx1) {
  42797. var $2,$1,$4,$3,$6,$5,$8,$7;
  42798. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  42799. $2=_st(self["@theClass"])._superclass();
  42800. $ctx1.sendIdx["superclass"]=1;
  42801. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  42802. $ctx1.sendIdx["=="]=1;
  42803. self._assert_($1);
  42804. $ctx1.sendIdx["assert:"]=1;
  42805. $4=_st(self["@theClass"])._instanceVariableNames();
  42806. $ctx1.sendIdx["instanceVariableNames"]=1;
  42807. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  42808. $ctx1.sendIdx["=="]=2;
  42809. self._assert_($3);
  42810. $ctx1.sendIdx["assert:"]=2;
  42811. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  42812. $ctx1.sendIdx["assert:equals:"]=1;
  42813. $6=_st(self["@theClass"])._package();
  42814. $ctx1.sendIdx["package"]=1;
  42815. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  42816. self._assert_($5);
  42817. $8=_st(self["@theClass"])._methodDictionary();
  42818. $ctx1.sendIdx["methodDictionary"]=1;
  42819. $7=_st($8)._keys();
  42820. $ctx1.sendIdx["keys"]=1;
  42821. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  42822. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  42823. args: [],
  42824. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  42825. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  42826. referencedClasses: ["ObjectMock"]
  42827. }),
  42828. globals.ClassBuilderTest);
  42829. smalltalk.addMethod(
  42830. smalltalk.method({
  42831. selector: "testClassMigration",
  42832. protocol: 'tests',
  42833. fn: function (){
  42834. var self=this;
  42835. var instance,oldClass;
  42836. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  42837. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  42838. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  42839. return smalltalk.withContext(function($ctx1) {
  42840. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  42841. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  42842. $2=_st($Smalltalk())._globals();
  42843. $ctx1.sendIdx["globals"]=1;
  42844. $1=_st($2)._at_("ObjectMock2");
  42845. $ctx1.sendIdx["at:"]=1;
  42846. instance=_st($1)._new();
  42847. $4=_st($Smalltalk())._globals();
  42848. $ctx1.sendIdx["globals"]=2;
  42849. $3=_st($4)._at_("ObjectMock2");
  42850. $ctx1.sendIdx["at:"]=2;
  42851. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  42852. $5=_st(oldClass).__eq_eq($ObjectMock2());
  42853. $ctx1.sendIdx["=="]=1;
  42854. self._deny_($5);
  42855. $ctx1.sendIdx["deny:"]=1;
  42856. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  42857. $ctx1.sendIdx["=="]=2;
  42858. self._assert_($6);
  42859. $ctx1.sendIdx["assert:"]=1;
  42860. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  42861. $ctx1.sendIdx["assert:"]=2;
  42862. $7=_st($ObjectMock2())._selectors();
  42863. $ctx1.sendIdx["selectors"]=1;
  42864. self._assert_equals_($7,_st(oldClass)._selectors());
  42865. $ctx1.sendIdx["assert:equals:"]=1;
  42866. $8=_st($ObjectMock2())._comment();
  42867. $ctx1.sendIdx["comment"]=1;
  42868. self._assert_equals_($8,_st(oldClass)._comment());
  42869. $ctx1.sendIdx["assert:equals:"]=2;
  42870. $9=_st(_st($ObjectMock2())._package())._name();
  42871. $ctx1.sendIdx["name"]=1;
  42872. self._assert_equals_($9,"Kernel-Tests");
  42873. $11=_st(instance)._class();
  42874. $ctx1.sendIdx["class"]=1;
  42875. $10=_st($11).__eq_eq($ObjectMock2());
  42876. self._deny_($10);
  42877. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  42878. _st($Smalltalk())._removeClass_($ObjectMock2());
  42879. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  42880. args: [],
  42881. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  42882. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  42883. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  42884. }),
  42885. globals.ClassBuilderTest);
  42886. smalltalk.addMethod(
  42887. smalltalk.method({
  42888. selector: "testClassMigrationWithClassInstanceVariables",
  42889. protocol: 'tests',
  42890. fn: function (){
  42891. var self=this;
  42892. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  42893. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  42894. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  42895. return smalltalk.withContext(function($ctx1) {
  42896. var $1;
  42897. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  42898. $1=_st($ObjectMock2())._class();
  42899. $ctx1.sendIdx["class"]=1;
  42900. _st($1)._instanceVariableNames_("foo bar");
  42901. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  42902. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  42903. _st($Smalltalk())._removeClass_($ObjectMock2());
  42904. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  42905. args: [],
  42906. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  42907. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  42908. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  42909. }),
  42910. globals.ClassBuilderTest);
  42911. smalltalk.addMethod(
  42912. smalltalk.method({
  42913. selector: "testClassMigrationWithSubclasses",
  42914. protocol: 'tests',
  42915. fn: function (){
  42916. var self=this;
  42917. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  42918. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  42919. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  42920. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  42921. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  42922. return smalltalk.withContext(function($ctx1) {
  42923. var $2,$1,$4,$3;
  42924. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  42925. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  42926. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  42927. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  42928. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  42929. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  42930. $2=_st($ObjectMock())._subclasses();
  42931. $ctx1.sendIdx["subclasses"]=1;
  42932. $1=_st($2)._includes_($ObjectMock2());
  42933. $ctx1.sendIdx["includes:"]=1;
  42934. self._assert_($1);
  42935. $ctx1.sendIdx["assert:"]=1;
  42936. $4=_st($ObjectMock2())._subclasses();
  42937. $ctx1.sendIdx["subclasses"]=2;
  42938. $3=_st($4)._includes_($ObjectMock3());
  42939. $ctx1.sendIdx["includes:"]=2;
  42940. self._assert_($3);
  42941. $ctx1.sendIdx["assert:"]=2;
  42942. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  42943. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  42944. return smalltalk.withContext(function($ctx2) {
  42945. return _st($Smalltalk())._removeClass_(each);
  42946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  42947. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  42948. args: [],
  42949. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  42950. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  42951. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  42952. }),
  42953. globals.ClassBuilderTest);
  42954. smalltalk.addMethod(
  42955. smalltalk.method({
  42956. selector: "testInstanceVariableNames",
  42957. protocol: 'tests',
  42958. fn: function (){
  42959. var self=this;
  42960. return smalltalk.withContext(function($ctx1) {
  42961. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  42962. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  42963. args: [],
  42964. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  42965. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  42966. referencedClasses: []
  42967. }),
  42968. globals.ClassBuilderTest);
  42969. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  42970. smalltalk.addMethod(
  42971. smalltalk.method({
  42972. selector: "assertSameContents:as:",
  42973. protocol: 'convenience',
  42974. fn: function (aCollection,anotherCollection){
  42975. var self=this;
  42976. return smalltalk.withContext(function($ctx1) {
  42977. var $2,$1,$4,$3;
  42978. $2=_st(aCollection)._size();
  42979. $ctx1.sendIdx["size"]=1;
  42980. $1=_st($2).__eq(_st(anotherCollection)._size());
  42981. $ctx1.sendIdx["="]=1;
  42982. self._assert_($1);
  42983. $ctx1.sendIdx["assert:"]=1;
  42984. _st(aCollection)._do_((function(each){
  42985. return smalltalk.withContext(function($ctx2) {
  42986. $4=_st(aCollection)._occurrencesOf_(each);
  42987. $ctx2.sendIdx["occurrencesOf:"]=1;
  42988. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  42989. return self._assert_($3);
  42990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  42991. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  42992. args: ["aCollection", "anotherCollection"],
  42993. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  42994. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  42995. referencedClasses: []
  42996. }),
  42997. globals.CollectionTest);
  42998. smalltalk.addMethod(
  42999. smalltalk.method({
  43000. selector: "collection",
  43001. protocol: 'fixture',
  43002. fn: function (){
  43003. var self=this;
  43004. return smalltalk.withContext(function($ctx1) {
  43005. self._subclassResponsibility();
  43006. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  43007. args: [],
  43008. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  43009. messageSends: ["subclassResponsibility"],
  43010. referencedClasses: []
  43011. }),
  43012. globals.CollectionTest);
  43013. smalltalk.addMethod(
  43014. smalltalk.method({
  43015. selector: "collectionClass",
  43016. protocol: 'fixture',
  43017. fn: function (){
  43018. var self=this;
  43019. return smalltalk.withContext(function($ctx1) {
  43020. var $1;
  43021. $1=_st(self._class())._collectionClass();
  43022. return $1;
  43023. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  43024. args: [],
  43025. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  43026. messageSends: ["collectionClass", "class"],
  43027. referencedClasses: []
  43028. }),
  43029. globals.CollectionTest);
  43030. smalltalk.addMethod(
  43031. smalltalk.method({
  43032. selector: "collectionOfPrintStrings",
  43033. protocol: 'fixture',
  43034. fn: function (){
  43035. var self=this;
  43036. return smalltalk.withContext(function($ctx1) {
  43037. self._subclassResponsibility();
  43038. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  43039. args: [],
  43040. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  43041. messageSends: ["subclassResponsibility"],
  43042. referencedClasses: []
  43043. }),
  43044. globals.CollectionTest);
  43045. smalltalk.addMethod(
  43046. smalltalk.method({
  43047. selector: "collectionSize",
  43048. protocol: 'fixture',
  43049. fn: function (){
  43050. var self=this;
  43051. return smalltalk.withContext(function($ctx1) {
  43052. self._subclassResponsibility();
  43053. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  43054. args: [],
  43055. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  43056. messageSends: ["subclassResponsibility"],
  43057. referencedClasses: []
  43058. }),
  43059. globals.CollectionTest);
  43060. smalltalk.addMethod(
  43061. smalltalk.method({
  43062. selector: "collectionWithDuplicates",
  43063. protocol: 'fixture',
  43064. fn: function (){
  43065. var self=this;
  43066. return smalltalk.withContext(function($ctx1) {
  43067. self._subclassResponsibility();
  43068. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  43069. args: [],
  43070. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  43071. messageSends: ["subclassResponsibility"],
  43072. referencedClasses: []
  43073. }),
  43074. globals.CollectionTest);
  43075. smalltalk.addMethod(
  43076. smalltalk.method({
  43077. selector: "collectionWithNewValue",
  43078. protocol: 'fixture',
  43079. fn: function (){
  43080. var self=this;
  43081. return smalltalk.withContext(function($ctx1) {
  43082. self._subclassResponsibility();
  43083. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  43084. args: [],
  43085. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  43086. messageSends: ["subclassResponsibility"],
  43087. referencedClasses: []
  43088. }),
  43089. globals.CollectionTest);
  43090. smalltalk.addMethod(
  43091. smalltalk.method({
  43092. selector: "isCollectionReadOnly",
  43093. protocol: 'testing',
  43094. fn: function (){
  43095. var self=this;
  43096. return false;
  43097. },
  43098. args: [],
  43099. source: "isCollectionReadOnly\x0a\x09^ false",
  43100. messageSends: [],
  43101. referencedClasses: []
  43102. }),
  43103. globals.CollectionTest);
  43104. smalltalk.addMethod(
  43105. smalltalk.method({
  43106. selector: "sampleNewValue",
  43107. protocol: 'fixture',
  43108. fn: function (){
  43109. var self=this;
  43110. return "N";
  43111. },
  43112. args: [],
  43113. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  43114. messageSends: [],
  43115. referencedClasses: []
  43116. }),
  43117. globals.CollectionTest);
  43118. smalltalk.addMethod(
  43119. smalltalk.method({
  43120. selector: "sampleNewValueAsCollection",
  43121. protocol: 'fixture',
  43122. fn: function (){
  43123. var self=this;
  43124. return smalltalk.withContext(function($ctx1) {
  43125. var $1;
  43126. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  43127. return $1;
  43128. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  43129. args: [],
  43130. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  43131. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  43132. referencedClasses: []
  43133. }),
  43134. globals.CollectionTest);
  43135. smalltalk.addMethod(
  43136. smalltalk.method({
  43137. selector: "testAddAll",
  43138. protocol: 'tests',
  43139. fn: function (){
  43140. var self=this;
  43141. return smalltalk.withContext(function($ctx1) {
  43142. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  43143. $2=self._collection();
  43144. $ctx1.sendIdx["collection"]=1;
  43145. $3=$2;
  43146. $5=self._collectionClass();
  43147. $ctx1.sendIdx["collectionClass"]=1;
  43148. $4=_st($5)._new();
  43149. $ctx1.sendIdx["new"]=1;
  43150. _st($3)._addAll_($4);
  43151. $ctx1.sendIdx["addAll:"]=1;
  43152. $6=_st($2)._yourself();
  43153. $ctx1.sendIdx["yourself"]=1;
  43154. $1=$6;
  43155. $7=self._collection();
  43156. $ctx1.sendIdx["collection"]=2;
  43157. self._assert_equals_($1,$7);
  43158. $ctx1.sendIdx["assert:equals:"]=1;
  43159. $10=self._collectionClass();
  43160. $ctx1.sendIdx["collectionClass"]=2;
  43161. $9=_st($10)._new();
  43162. $ctx1.sendIdx["new"]=2;
  43163. $11=$9;
  43164. $12=self._collection();
  43165. $ctx1.sendIdx["collection"]=3;
  43166. _st($11)._addAll_($12);
  43167. $ctx1.sendIdx["addAll:"]=2;
  43168. $13=_st($9)._yourself();
  43169. $ctx1.sendIdx["yourself"]=2;
  43170. $8=$13;
  43171. $14=self._collection();
  43172. $ctx1.sendIdx["collection"]=4;
  43173. self._assert_equals_($8,$14);
  43174. $ctx1.sendIdx["assert:equals:"]=2;
  43175. $17=self._collectionClass();
  43176. $ctx1.sendIdx["collectionClass"]=3;
  43177. $16=_st($17)._new();
  43178. $ctx1.sendIdx["new"]=3;
  43179. $18=$16;
  43180. $20=self._collectionClass();
  43181. $ctx1.sendIdx["collectionClass"]=4;
  43182. $19=_st($20)._new();
  43183. $ctx1.sendIdx["new"]=4;
  43184. _st($18)._addAll_($19);
  43185. $ctx1.sendIdx["addAll:"]=3;
  43186. $21=_st($16)._yourself();
  43187. $ctx1.sendIdx["yourself"]=3;
  43188. $15=$21;
  43189. self._assert_equals_($15,_st(self._collectionClass())._new());
  43190. $ctx1.sendIdx["assert:equals:"]=3;
  43191. $23=self._collection();
  43192. $ctx1.sendIdx["collection"]=5;
  43193. $24=$23;
  43194. $25=self._sampleNewValueAsCollection();
  43195. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  43196. _st($24)._addAll_($25);
  43197. $ctx1.sendIdx["addAll:"]=4;
  43198. $26=_st($23)._yourself();
  43199. $ctx1.sendIdx["yourself"]=4;
  43200. $22=$26;
  43201. $27=self._collectionWithNewValue();
  43202. $ctx1.sendIdx["collectionWithNewValue"]=1;
  43203. self._assert_equals_($22,$27);
  43204. $28=self._sampleNewValueAsCollection();
  43205. _st($28)._addAll_(self._collection());
  43206. $29=_st($28)._yourself();
  43207. self._assertSameContents_as_($29,self._collectionWithNewValue());
  43208. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  43209. args: [],
  43210. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  43211. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  43212. referencedClasses: []
  43213. }),
  43214. globals.CollectionTest);
  43215. smalltalk.addMethod(
  43216. smalltalk.method({
  43217. selector: "testAllSatisfy",
  43218. protocol: 'tests',
  43219. fn: function (){
  43220. var self=this;
  43221. var collection,anyOne;
  43222. return smalltalk.withContext(function($ctx1) {
  43223. var $1;
  43224. collection=self._collection();
  43225. anyOne=_st(collection)._anyOne();
  43226. $1=_st(collection)._allSatisfy_((function(each){
  43227. return smalltalk.withContext(function($ctx2) {
  43228. return _st(collection)._includes_(each);
  43229. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  43230. $ctx1.sendIdx["allSatisfy:"]=1;
  43231. self._assert_($1);
  43232. self._deny_(_st(collection)._allSatisfy_((function(each){
  43233. return smalltalk.withContext(function($ctx2) {
  43234. return _st(each).__tild_eq(anyOne);
  43235. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  43236. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  43237. args: [],
  43238. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  43239. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  43240. referencedClasses: []
  43241. }),
  43242. globals.CollectionTest);
  43243. smalltalk.addMethod(
  43244. smalltalk.method({
  43245. selector: "testAnyOne",
  43246. protocol: 'tests',
  43247. fn: function (){
  43248. var self=this;
  43249. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  43250. return smalltalk.withContext(function($ctx1) {
  43251. var $2,$1;
  43252. self._should_raise_((function(){
  43253. return smalltalk.withContext(function($ctx2) {
  43254. return _st(_st(self._collectionClass())._new())._anyOne();
  43255. $ctx2.sendIdx["anyOne"]=1;
  43256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  43257. $2=self._collection();
  43258. $ctx1.sendIdx["collection"]=1;
  43259. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  43260. self._assert_($1);
  43261. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  43262. args: [],
  43263. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  43264. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  43265. referencedClasses: ["Error"]
  43266. }),
  43267. globals.CollectionTest);
  43268. smalltalk.addMethod(
  43269. smalltalk.method({
  43270. selector: "testAnySatisfy",
  43271. protocol: 'tests',
  43272. fn: function (){
  43273. var self=this;
  43274. var anyOne;
  43275. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  43276. return smalltalk.withContext(function($ctx1) {
  43277. var $1,$3,$2;
  43278. $1=self._collection();
  43279. $ctx1.sendIdx["collection"]=1;
  43280. anyOne=_st($1)._anyOne();
  43281. $3=self._collection();
  43282. $ctx1.sendIdx["collection"]=2;
  43283. $2=_st($3)._anySatisfy_((function(each){
  43284. return smalltalk.withContext(function($ctx2) {
  43285. return _st(each).__eq(anyOne);
  43286. $ctx2.sendIdx["="]=1;
  43287. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  43288. $ctx1.sendIdx["anySatisfy:"]=1;
  43289. self._assert_($2);
  43290. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  43291. return smalltalk.withContext(function($ctx2) {
  43292. return _st(each).__eq(_st($Object())._new());
  43293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  43294. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  43295. args: [],
  43296. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  43297. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  43298. referencedClasses: ["Object"]
  43299. }),
  43300. globals.CollectionTest);
  43301. smalltalk.addMethod(
  43302. smalltalk.method({
  43303. selector: "testAsArray",
  43304. protocol: 'tests',
  43305. fn: function (){
  43306. var self=this;
  43307. return smalltalk.withContext(function($ctx1) {
  43308. var $1;
  43309. $1=self._collection();
  43310. $ctx1.sendIdx["collection"]=1;
  43311. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  43312. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  43313. args: [],
  43314. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  43315. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  43316. referencedClasses: []
  43317. }),
  43318. globals.CollectionTest);
  43319. smalltalk.addMethod(
  43320. smalltalk.method({
  43321. selector: "testAsOrderedCollection",
  43322. protocol: 'tests',
  43323. fn: function (){
  43324. var self=this;
  43325. return smalltalk.withContext(function($ctx1) {
  43326. var $1;
  43327. $1=self._collection();
  43328. $ctx1.sendIdx["collection"]=1;
  43329. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  43330. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  43331. args: [],
  43332. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  43333. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  43334. referencedClasses: []
  43335. }),
  43336. globals.CollectionTest);
  43337. smalltalk.addMethod(
  43338. smalltalk.method({
  43339. selector: "testAsSet",
  43340. protocol: 'tests',
  43341. fn: function (){
  43342. var self=this;
  43343. var c,set;
  43344. return smalltalk.withContext(function($ctx1) {
  43345. c=self._collectionWithDuplicates();
  43346. set=_st(c)._asSet();
  43347. self._assert_equals_(_st(set)._size(),(5));
  43348. _st(c)._do_((function(each){
  43349. return smalltalk.withContext(function($ctx2) {
  43350. return self._assert_(_st(set)._includes_(each));
  43351. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  43352. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  43353. args: [],
  43354. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  43355. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  43356. referencedClasses: []
  43357. }),
  43358. globals.CollectionTest);
  43359. smalltalk.addMethod(
  43360. smalltalk.method({
  43361. selector: "testCollect",
  43362. protocol: 'tests',
  43363. fn: function (){
  43364. var self=this;
  43365. return smalltalk.withContext(function($ctx1) {
  43366. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  43367. $2=self._collection();
  43368. $ctx1.sendIdx["collection"]=1;
  43369. $1=_st($2)._collect_((function(each){
  43370. return each;
  43371. }));
  43372. $ctx1.sendIdx["collect:"]=1;
  43373. $3=self._collection();
  43374. $ctx1.sendIdx["collection"]=2;
  43375. self._assert_equals_($1,$3);
  43376. $ctx1.sendIdx["assert:equals:"]=1;
  43377. $5=self._collectionWithNewValue();
  43378. $ctx1.sendIdx["collectionWithNewValue"]=1;
  43379. $4=_st($5)._collect_((function(each){
  43380. return each;
  43381. }));
  43382. $ctx1.sendIdx["collect:"]=2;
  43383. self._assert_equals_($4,self._collectionWithNewValue());
  43384. $ctx1.sendIdx["assert:equals:"]=2;
  43385. $8=self._collectionClass();
  43386. $ctx1.sendIdx["collectionClass"]=1;
  43387. $7=_st($8)._new();
  43388. $ctx1.sendIdx["new"]=1;
  43389. $6=_st($7)._collect_((function(each){
  43390. return smalltalk.withContext(function($ctx2) {
  43391. return _st(each)._printString();
  43392. $ctx2.sendIdx["printString"]=1;
  43393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  43394. $ctx1.sendIdx["collect:"]=3;
  43395. self._assert_equals_($6,_st(self._collectionClass())._new());
  43396. $ctx1.sendIdx["assert:equals:"]=3;
  43397. $11=self._collection();
  43398. $ctx1.sendIdx["collection"]=3;
  43399. $10=_st($11)._collect_((function(){
  43400. return smalltalk.withContext(function($ctx2) {
  43401. return self._sampleNewValue();
  43402. $ctx2.sendIdx["sampleNewValue"]=1;
  43403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  43404. $ctx1.sendIdx["collect:"]=4;
  43405. $9=_st($10)._detect_((function(){
  43406. return true;
  43407. }));
  43408. self._assert_equals_($9,self._sampleNewValue());
  43409. $ctx1.sendIdx["assert:equals:"]=4;
  43410. self._assert_equals_(_st(self._collection())._collect_((function(each){
  43411. return smalltalk.withContext(function($ctx2) {
  43412. return _st(each)._printString();
  43413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  43414. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  43415. args: [],
  43416. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  43417. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  43418. referencedClasses: []
  43419. }),
  43420. globals.CollectionTest);
  43421. smalltalk.addMethod(
  43422. smalltalk.method({
  43423. selector: "testComma",
  43424. protocol: 'tests',
  43425. fn: function (){
  43426. var self=this;
  43427. return smalltalk.withContext(function($ctx1) {
  43428. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  43429. $2=self._collection();
  43430. $ctx1.sendIdx["collection"]=1;
  43431. $4=self._collectionClass();
  43432. $ctx1.sendIdx["collectionClass"]=1;
  43433. $3=_st($4)._new();
  43434. $ctx1.sendIdx["new"]=1;
  43435. $1=_st($2).__comma($3);
  43436. $ctx1.sendIdx[","]=1;
  43437. $5=self._collection();
  43438. $ctx1.sendIdx["collection"]=2;
  43439. self._assert_equals_($1,$5);
  43440. $ctx1.sendIdx["assert:equals:"]=1;
  43441. $8=self._collectionClass();
  43442. $ctx1.sendIdx["collectionClass"]=2;
  43443. $7=_st($8)._new();
  43444. $ctx1.sendIdx["new"]=2;
  43445. $9=self._collection();
  43446. $ctx1.sendIdx["collection"]=3;
  43447. $6=_st($7).__comma($9);
  43448. $ctx1.sendIdx[","]=2;
  43449. $10=self._collection();
  43450. $ctx1.sendIdx["collection"]=4;
  43451. self._assert_equals_($6,$10);
  43452. $ctx1.sendIdx["assert:equals:"]=2;
  43453. $13=self._collectionClass();
  43454. $ctx1.sendIdx["collectionClass"]=3;
  43455. $12=_st($13)._new();
  43456. $ctx1.sendIdx["new"]=3;
  43457. $15=self._collectionClass();
  43458. $ctx1.sendIdx["collectionClass"]=4;
  43459. $14=_st($15)._new();
  43460. $ctx1.sendIdx["new"]=4;
  43461. $11=_st($12).__comma($14);
  43462. $ctx1.sendIdx[","]=3;
  43463. self._assert_equals_($11,_st(self._collectionClass())._new());
  43464. $ctx1.sendIdx["assert:equals:"]=3;
  43465. $17=self._collection();
  43466. $ctx1.sendIdx["collection"]=5;
  43467. $18=self._sampleNewValueAsCollection();
  43468. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  43469. $16=_st($17).__comma($18);
  43470. $ctx1.sendIdx[","]=4;
  43471. $19=self._collectionWithNewValue();
  43472. $ctx1.sendIdx["collectionWithNewValue"]=1;
  43473. self._assert_equals_($16,$19);
  43474. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  43475. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  43476. args: [],
  43477. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  43478. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  43479. referencedClasses: []
  43480. }),
  43481. globals.CollectionTest);
  43482. smalltalk.addMethod(
  43483. smalltalk.method({
  43484. selector: "testDetect",
  43485. protocol: 'tests',
  43486. fn: function (){
  43487. var self=this;
  43488. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  43489. return smalltalk.withContext(function($ctx1) {
  43490. var $1,$2,$3,$4,$6,$5,$7;
  43491. self._shouldnt_raise_((function(){
  43492. return smalltalk.withContext(function($ctx2) {
  43493. $1=self._collection();
  43494. $ctx2.sendIdx["collection"]=1;
  43495. return _st($1)._detect_((function(){
  43496. return true;
  43497. }));
  43498. $ctx2.sendIdx["detect:"]=1;
  43499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  43500. self._should_raise_((function(){
  43501. return smalltalk.withContext(function($ctx2) {
  43502. $2=self._collection();
  43503. $ctx2.sendIdx["collection"]=2;
  43504. return _st($2)._detect_((function(){
  43505. return false;
  43506. }));
  43507. $ctx2.sendIdx["detect:"]=2;
  43508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  43509. $ctx1.sendIdx["should:raise:"]=1;
  43510. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  43511. return true;
  43512. }));
  43513. $ctx1.sendIdx["detect:"]=3;
  43514. $4=self._sampleNewValue();
  43515. $ctx1.sendIdx["sampleNewValue"]=1;
  43516. self._assert_equals_($3,$4);
  43517. $ctx1.sendIdx["assert:equals:"]=1;
  43518. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  43519. return smalltalk.withContext(function($ctx2) {
  43520. $6=self._sampleNewValue();
  43521. $ctx2.sendIdx["sampleNewValue"]=2;
  43522. return _st(each).__eq($6);
  43523. $ctx2.sendIdx["="]=1;
  43524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  43525. $ctx1.sendIdx["detect:"]=4;
  43526. $7=self._sampleNewValue();
  43527. $ctx1.sendIdx["sampleNewValue"]=3;
  43528. self._assert_equals_($5,$7);
  43529. self._should_raise_((function(){
  43530. return smalltalk.withContext(function($ctx2) {
  43531. return _st(self._collection())._detect_((function(each){
  43532. return smalltalk.withContext(function($ctx3) {
  43533. return _st(each).__eq(self._sampleNewValue());
  43534. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  43535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  43536. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  43537. args: [],
  43538. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  43539. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  43540. referencedClasses: ["Error"]
  43541. }),
  43542. globals.CollectionTest);
  43543. smalltalk.addMethod(
  43544. smalltalk.method({
  43545. selector: "testDetectIfNone",
  43546. protocol: 'tests',
  43547. fn: function (){
  43548. var self=this;
  43549. var sentinel;
  43550. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  43551. return smalltalk.withContext(function($ctx1) {
  43552. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  43553. sentinel=_st($Object())._new();
  43554. $3=self._collection();
  43555. $ctx1.sendIdx["collection"]=1;
  43556. $2=_st($3)._detect_ifNone_((function(){
  43557. return true;
  43558. }),(function(){
  43559. return sentinel;
  43560. }));
  43561. $ctx1.sendIdx["detect:ifNone:"]=1;
  43562. $1=_st($2).__tild_eq(sentinel);
  43563. self._assert_($1);
  43564. $5=self._collection();
  43565. $ctx1.sendIdx["collection"]=2;
  43566. $4=_st($5)._detect_ifNone_((function(){
  43567. return false;
  43568. }),(function(){
  43569. return sentinel;
  43570. }));
  43571. $ctx1.sendIdx["detect:ifNone:"]=2;
  43572. self._assert_equals_($4,sentinel);
  43573. $ctx1.sendIdx["assert:equals:"]=1;
  43574. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  43575. return true;
  43576. }),(function(){
  43577. return sentinel;
  43578. }));
  43579. $ctx1.sendIdx["detect:ifNone:"]=3;
  43580. $7=self._sampleNewValue();
  43581. $ctx1.sendIdx["sampleNewValue"]=1;
  43582. self._assert_equals_($6,$7);
  43583. $ctx1.sendIdx["assert:equals:"]=2;
  43584. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  43585. return smalltalk.withContext(function($ctx2) {
  43586. $9=self._sampleNewValue();
  43587. $ctx2.sendIdx["sampleNewValue"]=2;
  43588. return _st(each).__eq($9);
  43589. $ctx2.sendIdx["="]=1;
  43590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  43591. return sentinel;
  43592. }));
  43593. $ctx1.sendIdx["detect:ifNone:"]=4;
  43594. $10=self._sampleNewValue();
  43595. $ctx1.sendIdx["sampleNewValue"]=3;
  43596. self._assert_equals_($8,$10);
  43597. $ctx1.sendIdx["assert:equals:"]=3;
  43598. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  43599. return smalltalk.withContext(function($ctx2) {
  43600. return _st(each).__eq(self._sampleNewValue());
  43601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  43602. return sentinel;
  43603. })),sentinel);
  43604. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  43605. args: [],
  43606. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  43607. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  43608. referencedClasses: ["Object"]
  43609. }),
  43610. globals.CollectionTest);
  43611. smalltalk.addMethod(
  43612. smalltalk.method({
  43613. selector: "testDo",
  43614. protocol: 'tests',
  43615. fn: function (){
  43616. var self=this;
  43617. var newCollection;
  43618. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  43619. return smalltalk.withContext(function($ctx1) {
  43620. var $1,$2;
  43621. newCollection=_st($OrderedCollection())._new();
  43622. $ctx1.sendIdx["new"]=1;
  43623. $1=self._collection();
  43624. $ctx1.sendIdx["collection"]=1;
  43625. _st($1)._do_((function(each){
  43626. return smalltalk.withContext(function($ctx2) {
  43627. return _st(newCollection)._add_(each);
  43628. $ctx2.sendIdx["add:"]=1;
  43629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  43630. $ctx1.sendIdx["do:"]=1;
  43631. self._assertSameContents_as_(self._collection(),newCollection);
  43632. $ctx1.sendIdx["assertSameContents:as:"]=1;
  43633. newCollection=_st($OrderedCollection())._new();
  43634. $2=self._collectionWithDuplicates();
  43635. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  43636. _st($2)._do_((function(each){
  43637. return smalltalk.withContext(function($ctx2) {
  43638. return _st(newCollection)._add_(each);
  43639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  43640. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  43641. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  43642. args: [],
  43643. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  43644. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  43645. referencedClasses: ["OrderedCollection"]
  43646. }),
  43647. globals.CollectionTest);
  43648. smalltalk.addMethod(
  43649. smalltalk.method({
  43650. selector: "testIfEmptyFamily",
  43651. protocol: 'tests',
  43652. fn: function (){
  43653. var self=this;
  43654. return smalltalk.withContext(function($ctx1) {
  43655. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  43656. $3=self._collectionClass();
  43657. $ctx1.sendIdx["collectionClass"]=1;
  43658. $2=_st($3)._new();
  43659. $ctx1.sendIdx["new"]=1;
  43660. $1=_st($2)._ifEmpty_((function(){
  43661. return (42);
  43662. }));
  43663. $ctx1.sendIdx["ifEmpty:"]=1;
  43664. self._assert_equals_($1,(42));
  43665. $ctx1.sendIdx["assert:equals:"]=1;
  43666. $5=self._collection();
  43667. $ctx1.sendIdx["collection"]=1;
  43668. $4=_st($5)._ifEmpty_((function(){
  43669. return (42);
  43670. }));
  43671. $6=self._collection();
  43672. $ctx1.sendIdx["collection"]=2;
  43673. self._assert_equals_($4,$6);
  43674. $ctx1.sendIdx["assert:equals:"]=2;
  43675. $9=self._collectionClass();
  43676. $ctx1.sendIdx["collectionClass"]=2;
  43677. $8=_st($9)._new();
  43678. $ctx1.sendIdx["new"]=2;
  43679. $7=_st($8)._ifNotEmpty_((function(){
  43680. return (42);
  43681. }));
  43682. $ctx1.sendIdx["ifNotEmpty:"]=1;
  43683. $11=self._collectionClass();
  43684. $ctx1.sendIdx["collectionClass"]=3;
  43685. $10=_st($11)._new();
  43686. $ctx1.sendIdx["new"]=3;
  43687. self._assert_equals_($7,$10);
  43688. $ctx1.sendIdx["assert:equals:"]=3;
  43689. $13=self._collection();
  43690. $ctx1.sendIdx["collection"]=3;
  43691. $12=_st($13)._ifNotEmpty_((function(){
  43692. return (42);
  43693. }));
  43694. self._assert_equals_($12,(42));
  43695. $ctx1.sendIdx["assert:equals:"]=4;
  43696. $16=self._collectionClass();
  43697. $ctx1.sendIdx["collectionClass"]=4;
  43698. $15=_st($16)._new();
  43699. $ctx1.sendIdx["new"]=4;
  43700. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  43701. return (42);
  43702. }),(function(){
  43703. return (999);
  43704. }));
  43705. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  43706. self._assert_equals_($14,(42));
  43707. $ctx1.sendIdx["assert:equals:"]=5;
  43708. $18=self._collection();
  43709. $ctx1.sendIdx["collection"]=4;
  43710. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  43711. return (42);
  43712. }),(function(){
  43713. return (999);
  43714. }));
  43715. self._assert_equals_($17,(999));
  43716. $ctx1.sendIdx["assert:equals:"]=6;
  43717. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  43718. return (42);
  43719. }),(function(){
  43720. return (999);
  43721. }));
  43722. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  43723. self._assert_equals_($19,(999));
  43724. $ctx1.sendIdx["assert:equals:"]=7;
  43725. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  43726. return (42);
  43727. }),(function(){
  43728. return (999);
  43729. })),(42));
  43730. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  43731. args: [],
  43732. source: "testIfEmptyFamily\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ]) equals: self collectionClass new.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ]) equals: 42.\x0a\x09\x0a\x09self assert: (self collectionClass new ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ 999 ]) equals: 999.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42",
  43733. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  43734. referencedClasses: []
  43735. }),
  43736. globals.CollectionTest);
  43737. smalltalk.addMethod(
  43738. smalltalk.method({
  43739. selector: "testIsEmpty",
  43740. protocol: 'tests',
  43741. fn: function (){
  43742. var self=this;
  43743. return smalltalk.withContext(function($ctx1) {
  43744. var $1;
  43745. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  43746. $ctx1.sendIdx["isEmpty"]=1;
  43747. self._assert_($1);
  43748. self._deny_(_st(self._collection())._isEmpty());
  43749. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  43750. args: [],
  43751. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  43752. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  43753. referencedClasses: []
  43754. }),
  43755. globals.CollectionTest);
  43756. smalltalk.addMethod(
  43757. smalltalk.method({
  43758. selector: "testNoneSatisfy",
  43759. protocol: 'tests',
  43760. fn: function (){
  43761. var self=this;
  43762. var anyOne;
  43763. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  43764. return smalltalk.withContext(function($ctx1) {
  43765. var $1,$3,$2;
  43766. $1=self._collection();
  43767. $ctx1.sendIdx["collection"]=1;
  43768. anyOne=_st($1)._anyOne();
  43769. $3=self._collection();
  43770. $ctx1.sendIdx["collection"]=2;
  43771. $2=_st($3)._noneSatisfy_((function(each){
  43772. return smalltalk.withContext(function($ctx2) {
  43773. return _st(each).__eq(anyOne);
  43774. $ctx2.sendIdx["="]=1;
  43775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  43776. $ctx1.sendIdx["noneSatisfy:"]=1;
  43777. self._deny_($2);
  43778. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  43779. return smalltalk.withContext(function($ctx2) {
  43780. return _st(each).__eq(_st($Object())._new());
  43781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  43782. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  43783. args: [],
  43784. source: "testNoneSatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self deny: (self collection noneSatisfy: [ :each | each = anyOne ]).\x0a\x09self assert: (self collection noneSatisfy: [ :each | each = Object new ])",
  43785. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  43786. referencedClasses: ["Object"]
  43787. }),
  43788. globals.CollectionTest);
  43789. smalltalk.addMethod(
  43790. smalltalk.method({
  43791. selector: "testRemoveAll",
  43792. protocol: 'tests',
  43793. fn: function (){
  43794. var self=this;
  43795. return smalltalk.withContext(function($ctx1) {
  43796. var $1,$2;
  43797. $1=self._collection();
  43798. _st($1)._removeAll();
  43799. $2=_st($1)._yourself();
  43800. self._assert_equals_($2,_st(self._collectionClass())._new());
  43801. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  43802. args: [],
  43803. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  43804. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  43805. referencedClasses: []
  43806. }),
  43807. globals.CollectionTest);
  43808. smalltalk.addMethod(
  43809. smalltalk.method({
  43810. selector: "testSelect",
  43811. protocol: 'tests',
  43812. fn: function (){
  43813. var self=this;
  43814. return smalltalk.withContext(function($ctx1) {
  43815. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  43816. $2=self._collection();
  43817. $ctx1.sendIdx["collection"]=1;
  43818. $1=_st($2)._select_((function(){
  43819. return false;
  43820. }));
  43821. $ctx1.sendIdx["select:"]=1;
  43822. $4=self._collectionClass();
  43823. $ctx1.sendIdx["collectionClass"]=1;
  43824. $3=_st($4)._new();
  43825. $ctx1.sendIdx["new"]=1;
  43826. self._assert_equals_($1,$3);
  43827. $ctx1.sendIdx["assert:equals:"]=1;
  43828. $6=self._collection();
  43829. $ctx1.sendIdx["collection"]=2;
  43830. $5=_st($6)._select_((function(){
  43831. return true;
  43832. }));
  43833. $ctx1.sendIdx["select:"]=2;
  43834. $7=self._collection();
  43835. $ctx1.sendIdx["collection"]=3;
  43836. self._assert_equals_($5,$7);
  43837. $ctx1.sendIdx["assert:equals:"]=2;
  43838. $9=self._collectionWithNewValue();
  43839. $ctx1.sendIdx["collectionWithNewValue"]=1;
  43840. $8=_st($9)._select_((function(each){
  43841. return smalltalk.withContext(function($ctx2) {
  43842. $10=self._sampleNewValue();
  43843. $ctx2.sendIdx["sampleNewValue"]=1;
  43844. return _st(each).__eq($10);
  43845. $ctx2.sendIdx["="]=1;
  43846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  43847. $ctx1.sendIdx["select:"]=3;
  43848. self._assert_equals_($8,self._sampleNewValueAsCollection());
  43849. $ctx1.sendIdx["assert:equals:"]=3;
  43850. $12=self._collectionWithNewValue();
  43851. $ctx1.sendIdx["collectionWithNewValue"]=2;
  43852. $11=_st($12)._select_((function(each){
  43853. return smalltalk.withContext(function($ctx2) {
  43854. $13=self._sampleNewValue();
  43855. $ctx2.sendIdx["sampleNewValue"]=2;
  43856. return _st(each).__tild_eq($13);
  43857. $ctx2.sendIdx["~="]=1;
  43858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  43859. $ctx1.sendIdx["select:"]=4;
  43860. $14=self._collection();
  43861. $ctx1.sendIdx["collection"]=4;
  43862. self._assert_equals_($11,$14);
  43863. $ctx1.sendIdx["assert:equals:"]=4;
  43864. $16=self._collection();
  43865. $ctx1.sendIdx["collection"]=5;
  43866. $15=_st($16)._select_((function(each){
  43867. return smalltalk.withContext(function($ctx2) {
  43868. $17=self._sampleNewValue();
  43869. $ctx2.sendIdx["sampleNewValue"]=3;
  43870. return _st(each).__eq($17);
  43871. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  43872. $ctx1.sendIdx["select:"]=5;
  43873. self._assert_equals_($15,_st(self._collectionClass())._new());
  43874. $ctx1.sendIdx["assert:equals:"]=5;
  43875. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  43876. return smalltalk.withContext(function($ctx2) {
  43877. return _st(each).__tild_eq(self._sampleNewValue());
  43878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  43879. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  43880. args: [],
  43881. source: "testSelect\x0a\x09self assert: (self collection select: [ false ]) equals: self collectionClass new.\x0a\x09self assert: (self collection select: [ true ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each = self sampleNewValue ]) equals: self sampleNewValueAsCollection.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection.\x0a\x09self assert: (self collection select: [ :each | each = self sampleNewValue ]) equals: self collectionClass new.\x0a\x09self assert: (self collectionWithNewValue select: [ :each | each ~= self sampleNewValue ]) equals: self collection",
  43882. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  43883. referencedClasses: []
  43884. }),
  43885. globals.CollectionTest);
  43886. smalltalk.addMethod(
  43887. smalltalk.method({
  43888. selector: "testSize",
  43889. protocol: 'tests',
  43890. fn: function (){
  43891. var self=this;
  43892. return smalltalk.withContext(function($ctx1) {
  43893. var $1,$2;
  43894. $1=_st(_st(self._collectionClass())._new())._size();
  43895. $ctx1.sendIdx["size"]=1;
  43896. self._assert_equals_($1,(0));
  43897. $ctx1.sendIdx["assert:equals:"]=1;
  43898. $2=_st(self._sampleNewValueAsCollection())._size();
  43899. $ctx1.sendIdx["size"]=2;
  43900. self._assert_equals_($2,(1));
  43901. $ctx1.sendIdx["assert:equals:"]=2;
  43902. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  43903. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  43904. args: [],
  43905. source: "testSize\x0a\x09self assert: self collectionClass new size equals: 0.\x0a\x09self assert: self sampleNewValueAsCollection size equals: 1.\x0a\x09self assert: self collection size equals: self collectionSize",
  43906. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  43907. referencedClasses: []
  43908. }),
  43909. globals.CollectionTest);
  43910. smalltalk.addMethod(
  43911. smalltalk.method({
  43912. selector: "collectionClass",
  43913. protocol: 'fixture',
  43914. fn: function (){
  43915. var self=this;
  43916. return nil;
  43917. },
  43918. args: [],
  43919. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  43920. messageSends: [],
  43921. referencedClasses: []
  43922. }),
  43923. globals.CollectionTest.klass);
  43924. smalltalk.addMethod(
  43925. smalltalk.method({
  43926. selector: "isAbstract",
  43927. protocol: 'testing',
  43928. fn: function (){
  43929. var self=this;
  43930. return smalltalk.withContext(function($ctx1) {
  43931. var $1;
  43932. $1=_st(self._collectionClass())._isNil();
  43933. return $1;
  43934. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  43935. args: [],
  43936. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  43937. messageSends: ["isNil", "collectionClass"],
  43938. referencedClasses: []
  43939. }),
  43940. globals.CollectionTest.klass);
  43941. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  43942. smalltalk.addMethod(
  43943. smalltalk.method({
  43944. selector: "collectionWithNewValue",
  43945. protocol: 'fixture',
  43946. fn: function (){
  43947. var self=this;
  43948. return smalltalk.withContext(function($ctx1) {
  43949. self._subclassResponsibility();
  43950. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  43951. args: [],
  43952. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue at self sampleNewIndex\x22\x0a\x09\x0a\x09self subclassResponsibility",
  43953. messageSends: ["subclassResponsibility"],
  43954. referencedClasses: []
  43955. }),
  43956. globals.IndexableCollectionTest);
  43957. smalltalk.addMethod(
  43958. smalltalk.method({
  43959. selector: "sampleNewIndex",
  43960. protocol: 'fixture',
  43961. fn: function (){
  43962. var self=this;
  43963. return smalltalk.withContext(function($ctx1) {
  43964. self._subclassResponsibility();
  43965. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  43966. args: [],
  43967. source: "sampleNewIndex\x0a\x09\x22Answers a value that can be used as index in at:put: or at:ifAbsentPut:\x22\x0a\x09\x0a\x09self subclassResponsibility",
  43968. messageSends: ["subclassResponsibility"],
  43969. referencedClasses: []
  43970. }),
  43971. globals.IndexableCollectionTest);
  43972. smalltalk.addMethod(
  43973. smalltalk.method({
  43974. selector: "sampleNonIndexesDo:",
  43975. protocol: 'fixture',
  43976. fn: function (aBlock){
  43977. var self=this;
  43978. return smalltalk.withContext(function($ctx1) {
  43979. self._subclassResponsibility();
  43980. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  43981. args: ["aBlock"],
  43982. source: "sampleNonIndexesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing value that is known\x0a\x09not to be an index, as the first parameter\x22\x0a\x09\x0a\x09self subclassResponsibility",
  43983. messageSends: ["subclassResponsibility"],
  43984. referencedClasses: []
  43985. }),
  43986. globals.IndexableCollectionTest);
  43987. smalltalk.addMethod(
  43988. smalltalk.method({
  43989. selector: "samplesDo:",
  43990. protocol: 'fixture',
  43991. fn: function (aBlock){
  43992. var self=this;
  43993. return smalltalk.withContext(function($ctx1) {
  43994. self._subclassResponsibility();
  43995. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  43996. args: ["aBlock"],
  43997. source: "samplesDo: aBlock\x0a\x09\x22Executes block a few times,\x0a\x09each time passing known index and value stored\x0a\x09under that index as the parameters\x22\x0a\x09\x0a\x09self subclassResponsibility",
  43998. messageSends: ["subclassResponsibility"],
  43999. referencedClasses: []
  44000. }),
  44001. globals.IndexableCollectionTest);
  44002. smalltalk.addMethod(
  44003. smalltalk.method({
  44004. selector: "testAt",
  44005. protocol: 'tests',
  44006. fn: function (){
  44007. var self=this;
  44008. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  44009. return smalltalk.withContext(function($ctx1) {
  44010. var $1;
  44011. self._nonIndexesDo_((function(each){
  44012. return smalltalk.withContext(function($ctx2) {
  44013. return self._should_raise_((function(){
  44014. return smalltalk.withContext(function($ctx3) {
  44015. $1=self._collection();
  44016. $ctx3.sendIdx["collection"]=1;
  44017. return _st($1)._at_(each);
  44018. $ctx3.sendIdx["at:"]=1;
  44019. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  44020. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  44021. self._samplesDo_((function(index,value){
  44022. return smalltalk.withContext(function($ctx2) {
  44023. return self._assert_equals_(_st(self._collection())._at_(index),value);
  44024. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  44025. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  44026. args: [],
  44027. source: "testAt\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self should: [ self collection at: each ] raise: Error ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index) equals: value ]",
  44028. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  44029. referencedClasses: ["Error"]
  44030. }),
  44031. globals.IndexableCollectionTest);
  44032. smalltalk.addMethod(
  44033. smalltalk.method({
  44034. selector: "testAtIfAbsent",
  44035. protocol: 'tests',
  44036. fn: function (){
  44037. var self=this;
  44038. return smalltalk.withContext(function($ctx1) {
  44039. var $2,$1,$3;
  44040. self._nonIndexesDo_((function(each){
  44041. return smalltalk.withContext(function($ctx2) {
  44042. $2=self._collection();
  44043. $ctx2.sendIdx["collection"]=1;
  44044. $1=_st($2)._at_ifAbsent_(each,(function(){
  44045. return smalltalk.withContext(function($ctx3) {
  44046. return self._sampleNewValue();
  44047. $ctx3.sendIdx["sampleNewValue"]=1;
  44048. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  44049. $ctx2.sendIdx["at:ifAbsent:"]=1;
  44050. $3=self._sampleNewValue();
  44051. $ctx2.sendIdx["sampleNewValue"]=2;
  44052. return self._assert_equals_($1,$3);
  44053. $ctx2.sendIdx["assert:equals:"]=1;
  44054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  44055. self._samplesDo_((function(index,value){
  44056. return smalltalk.withContext(function($ctx2) {
  44057. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  44058. return smalltalk.withContext(function($ctx3) {
  44059. return self._sampleNewValue();
  44060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  44061. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  44062. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  44063. args: [],
  44064. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNewValue ]) equals: value ].",
  44065. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  44066. referencedClasses: []
  44067. }),
  44068. globals.IndexableCollectionTest);
  44069. smalltalk.addMethod(
  44070. smalltalk.method({
  44071. selector: "testAtIfAbsentPut",
  44072. protocol: 'tests',
  44073. fn: function (){
  44074. var self=this;
  44075. var newCollection;
  44076. return smalltalk.withContext(function($ctx1) {
  44077. var $1;
  44078. newCollection=self._collection();
  44079. $ctx1.sendIdx["collection"]=1;
  44080. self._samplesDo_((function(index,value){
  44081. return smalltalk.withContext(function($ctx2) {
  44082. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  44083. return smalltalk.withContext(function($ctx3) {
  44084. return self._sampleNewValue();
  44085. $ctx3.sendIdx["sampleNewValue"]=1;
  44086. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  44087. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  44088. return self._assert_equals_($1,value);
  44089. $ctx2.sendIdx["assert:equals:"]=1;
  44090. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  44091. self._assert_equals_(newCollection,self._collection());
  44092. $ctx1.sendIdx["assert:equals:"]=2;
  44093. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  44094. return smalltalk.withContext(function($ctx2) {
  44095. return self._sampleNewValue();
  44096. $ctx2.sendIdx["sampleNewValue"]=2;
  44097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  44098. $ctx1.sendIdx["assert:equals:"]=3;
  44099. self._assert_equals_(newCollection,self._collectionWithNewValue());
  44100. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  44101. args: [],
  44102. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  44103. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  44104. referencedClasses: []
  44105. }),
  44106. globals.IndexableCollectionTest);
  44107. smalltalk.addMethod(
  44108. smalltalk.method({
  44109. selector: "testAtIfPresent",
  44110. protocol: 'tests',
  44111. fn: function (){
  44112. var self=this;
  44113. var visited,sentinel;
  44114. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  44115. return smalltalk.withContext(function($ctx1) {
  44116. var $2,$1,$4,$3;
  44117. sentinel=_st($Object())._new();
  44118. self._nonIndexesDo_((function(each){
  44119. return smalltalk.withContext(function($ctx2) {
  44120. visited=nil;
  44121. visited;
  44122. $2=self._collection();
  44123. $ctx2.sendIdx["collection"]=1;
  44124. $1=_st($2)._at_ifPresent_(each,(function(value1){
  44125. visited=value1;
  44126. visited;
  44127. return sentinel;
  44128. }));
  44129. $ctx2.sendIdx["at:ifPresent:"]=1;
  44130. self._assert_equals_($1,nil);
  44131. $ctx2.sendIdx["assert:equals:"]=1;
  44132. return self._assert_(_st(visited)._isNil());
  44133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  44134. self._samplesDo_((function(index,value){
  44135. return smalltalk.withContext(function($ctx2) {
  44136. visited=nil;
  44137. visited;
  44138. $4=self._collection();
  44139. $ctx2.sendIdx["collection"]=2;
  44140. $3=_st($4)._at_ifPresent_(index,(function(value2){
  44141. visited=value2;
  44142. visited;
  44143. return sentinel;
  44144. }));
  44145. self._assert_equals_($3,sentinel);
  44146. $ctx2.sendIdx["assert:equals:"]=2;
  44147. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  44148. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  44149. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  44150. args: [],
  44151. source: "testAtIfPresent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ]) equals: nil.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  44152. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  44153. referencedClasses: ["Object"]
  44154. }),
  44155. globals.IndexableCollectionTest);
  44156. smalltalk.addMethod(
  44157. smalltalk.method({
  44158. selector: "testAtIfPresentIfAbsent",
  44159. protocol: 'tests',
  44160. fn: function (){
  44161. var self=this;
  44162. var visited,sentinel;
  44163. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  44164. return smalltalk.withContext(function($ctx1) {
  44165. var $2,$1,$3,$5,$4;
  44166. sentinel=_st($Object())._new();
  44167. self._nonIndexesDo_((function(each){
  44168. return smalltalk.withContext(function($ctx2) {
  44169. visited=nil;
  44170. visited;
  44171. $2=self._collection();
  44172. $ctx2.sendIdx["collection"]=1;
  44173. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  44174. visited=value1;
  44175. visited;
  44176. return sentinel;
  44177. }),(function(){
  44178. return smalltalk.withContext(function($ctx3) {
  44179. return self._sampleNewValue();
  44180. $ctx3.sendIdx["sampleNewValue"]=1;
  44181. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  44182. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  44183. $3=self._sampleNewValue();
  44184. $ctx2.sendIdx["sampleNewValue"]=2;
  44185. self._assert_equals_($1,$3);
  44186. $ctx2.sendIdx["assert:equals:"]=1;
  44187. return self._assert_(_st(visited)._isNil());
  44188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  44189. self._samplesDo_((function(index,value){
  44190. return smalltalk.withContext(function($ctx2) {
  44191. visited=nil;
  44192. visited;
  44193. $5=self._collection();
  44194. $ctx2.sendIdx["collection"]=2;
  44195. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  44196. visited=value2;
  44197. visited;
  44198. return sentinel;
  44199. }),(function(){
  44200. return smalltalk.withContext(function($ctx3) {
  44201. return self._sampleNewValue();
  44202. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  44203. self._assert_equals_($4,sentinel);
  44204. $ctx2.sendIdx["assert:equals:"]=2;
  44205. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  44206. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  44207. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  44208. args: [],
  44209. source: "testAtIfPresentIfAbsent\x0a\x09| visited sentinel |\x0a\x09sentinel := Object new.\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: each ifPresent: [ :value1 | visited := value1. sentinel ] ifAbsent: [ self sampleNewValue ] ) equals: self sampleNewValue.\x0a\x09\x09self assert: visited isNil ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09visited := nil.\x0a\x09\x09self assert: (self collection at: index ifPresent: [ :value2 | visited := value2. sentinel ] ifAbsent: [ self sampleNewValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  44210. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  44211. referencedClasses: ["Object"]
  44212. }),
  44213. globals.IndexableCollectionTest);
  44214. smalltalk.addMethod(
  44215. smalltalk.method({
  44216. selector: "testAtPut",
  44217. protocol: 'tests',
  44218. fn: function (){
  44219. var self=this;
  44220. var newCollection;
  44221. return smalltalk.withContext(function($ctx1) {
  44222. newCollection=self._collection();
  44223. $ctx1.sendIdx["collection"]=1;
  44224. self._samplesDo_((function(index,value){
  44225. return smalltalk.withContext(function($ctx2) {
  44226. return _st(newCollection)._at_put_(index,value);
  44227. $ctx2.sendIdx["at:put:"]=1;
  44228. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  44229. self._assert_equals_(newCollection,self._collection());
  44230. $ctx1.sendIdx["assert:equals:"]=1;
  44231. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  44232. self._assert_equals_(newCollection,self._collectionWithNewValue());
  44233. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  44234. args: [],
  44235. source: "testAtPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09newCollection at: index put: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09newCollection at: self sampleNewIndex put: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  44236. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  44237. referencedClasses: []
  44238. }),
  44239. globals.IndexableCollectionTest);
  44240. smalltalk.addMethod(
  44241. smalltalk.method({
  44242. selector: "testEquality",
  44243. protocol: 'tests',
  44244. fn: function (){
  44245. var self=this;
  44246. return smalltalk.withContext(function($ctx1) {
  44247. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  44248. $2=self._collectionClass();
  44249. $ctx1.sendIdx["collectionClass"]=1;
  44250. $1=_st($2)._new();
  44251. $ctx1.sendIdx["new"]=1;
  44252. $4=self._collectionClass();
  44253. $ctx1.sendIdx["collectionClass"]=2;
  44254. $3=_st($4)._new();
  44255. $ctx1.sendIdx["new"]=2;
  44256. self._assert_equals_($1,$3);
  44257. $ctx1.sendIdx["assert:equals:"]=1;
  44258. $5=self._collection();
  44259. $ctx1.sendIdx["collection"]=1;
  44260. $6=self._collection();
  44261. $ctx1.sendIdx["collection"]=2;
  44262. self._assert_equals_($5,$6);
  44263. $ctx1.sendIdx["assert:equals:"]=2;
  44264. $7=self._collectionWithNewValue();
  44265. $ctx1.sendIdx["collectionWithNewValue"]=1;
  44266. self._assert_equals_($7,self._collectionWithNewValue());
  44267. $10=self._collectionClass();
  44268. $ctx1.sendIdx["collectionClass"]=3;
  44269. $9=_st($10)._new();
  44270. $ctx1.sendIdx["new"]=3;
  44271. $11=self._collection();
  44272. $ctx1.sendIdx["collection"]=3;
  44273. $8=_st($9).__eq($11);
  44274. $ctx1.sendIdx["="]=1;
  44275. self._deny_($8);
  44276. $ctx1.sendIdx["deny:"]=1;
  44277. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  44278. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  44279. args: [],
  44280. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  44281. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  44282. referencedClasses: []
  44283. }),
  44284. globals.IndexableCollectionTest);
  44285. smalltalk.addMethod(
  44286. smalltalk.method({
  44287. selector: "testIndexOf",
  44288. protocol: 'tests',
  44289. fn: function (){
  44290. var self=this;
  44291. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  44292. return smalltalk.withContext(function($ctx1) {
  44293. var $1;
  44294. self._should_raise_((function(){
  44295. return smalltalk.withContext(function($ctx2) {
  44296. $1=self._collection();
  44297. $ctx2.sendIdx["collection"]=1;
  44298. return _st($1)._indexOf_(self._sampleNewValue());
  44299. $ctx2.sendIdx["indexOf:"]=1;
  44300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  44301. self._samplesDo_((function(index,value){
  44302. return smalltalk.withContext(function($ctx2) {
  44303. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  44304. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  44305. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  44306. args: [],
  44307. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNewValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  44308. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  44309. referencedClasses: ["Error"]
  44310. }),
  44311. globals.IndexableCollectionTest);
  44312. smalltalk.addMethod(
  44313. smalltalk.method({
  44314. selector: "testIndexOfWithNull",
  44315. protocol: 'tests',
  44316. fn: function (){
  44317. var self=this;
  44318. var jsNull;
  44319. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  44320. return smalltalk.withContext(function($ctx1) {
  44321. var $1,$2;
  44322. jsNull=_st($JSON())._parse_("null");
  44323. self._samplesDo_((function(index,value){
  44324. return smalltalk.withContext(function($ctx2) {
  44325. $1=self._collection();
  44326. _st($1)._at_put_(index,jsNull);
  44327. $2=_st($1)._indexOf_(jsNull);
  44328. return self._assert_equals_($2,index);
  44329. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  44330. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  44331. args: [],
  44332. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  44333. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  44334. referencedClasses: ["JSON"]
  44335. }),
  44336. globals.IndexableCollectionTest);
  44337. smalltalk.addMethod(
  44338. smalltalk.method({
  44339. selector: "testWithIndexDo",
  44340. protocol: 'tests',
  44341. fn: function (){
  44342. var self=this;
  44343. var collection;
  44344. return smalltalk.withContext(function($ctx1) {
  44345. collection=self._collection();
  44346. $ctx1.sendIdx["collection"]=1;
  44347. _st(self._collection())._withIndexDo_((function(each,index){
  44348. return smalltalk.withContext(function($ctx2) {
  44349. return self._assert_equals_(_st(collection)._at_(index),each);
  44350. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  44351. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  44352. args: [],
  44353. source: "testWithIndexDo\x0a\x09| collection |\x0a\x09collection := self collection.\x0a\x09\x0a\x09self collection withIndexDo: [ :each :index |\x0a\x09\x09self assert: (collection at: index) equals: each ]",
  44354. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  44355. referencedClasses: []
  44356. }),
  44357. globals.IndexableCollectionTest);
  44358. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  44359. smalltalk.addMethod(
  44360. smalltalk.method({
  44361. selector: "collectionKeys",
  44362. protocol: 'fixture',
  44363. fn: function (){
  44364. var self=this;
  44365. return smalltalk.withContext(function($ctx1) {
  44366. self._subclassResponsibility();
  44367. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  44368. args: [],
  44369. source: "collectionKeys\x0a\x09self subclassResponsibility",
  44370. messageSends: ["subclassResponsibility"],
  44371. referencedClasses: []
  44372. }),
  44373. globals.AssociativeCollectionTest);
  44374. smalltalk.addMethod(
  44375. smalltalk.method({
  44376. selector: "collectionValues",
  44377. protocol: 'fixture',
  44378. fn: function (){
  44379. var self=this;
  44380. return smalltalk.withContext(function($ctx1) {
  44381. self._subclassResponsibility();
  44382. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  44383. args: [],
  44384. source: "collectionValues\x0a\x09self subclassResponsibility",
  44385. messageSends: ["subclassResponsibility"],
  44386. referencedClasses: []
  44387. }),
  44388. globals.AssociativeCollectionTest);
  44389. smalltalk.addMethod(
  44390. smalltalk.method({
  44391. selector: "nonIndexesDo:",
  44392. protocol: 'fixture',
  44393. fn: function (aBlock){
  44394. var self=this;
  44395. return smalltalk.withContext(function($ctx1) {
  44396. _st(aBlock)._value_((5));
  44397. $ctx1.sendIdx["value:"]=1;
  44398. _st(aBlock)._value_("z");
  44399. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  44400. args: ["aBlock"],
  44401. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  44402. messageSends: ["value:"],
  44403. referencedClasses: []
  44404. }),
  44405. globals.AssociativeCollectionTest);
  44406. smalltalk.addMethod(
  44407. smalltalk.method({
  44408. selector: "sampleNewIndex",
  44409. protocol: 'fixture',
  44410. fn: function (){
  44411. var self=this;
  44412. return "new";
  44413. },
  44414. args: [],
  44415. source: "sampleNewIndex\x0a\x09^ 'new'",
  44416. messageSends: [],
  44417. referencedClasses: []
  44418. }),
  44419. globals.AssociativeCollectionTest);
  44420. smalltalk.addMethod(
  44421. smalltalk.method({
  44422. selector: "samplesDo:",
  44423. protocol: 'fixture',
  44424. fn: function (aBlock){
  44425. var self=this;
  44426. return smalltalk.withContext(function($ctx1) {
  44427. _st(aBlock)._value_value_("a",(2));
  44428. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  44429. args: ["aBlock"],
  44430. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  44431. messageSends: ["value:value:"],
  44432. referencedClasses: []
  44433. }),
  44434. globals.AssociativeCollectionTest);
  44435. smalltalk.addMethod(
  44436. smalltalk.method({
  44437. selector: "testAddAll",
  44438. protocol: 'tests',
  44439. fn: function (){
  44440. var self=this;
  44441. return smalltalk.withContext(function($ctx1) {
  44442. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  44443. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  44444. $ctx1.supercall = false;
  44445. $2=self._collection();
  44446. $ctx1.sendIdx["collection"]=1;
  44447. $3=$2;
  44448. $4=self._collection();
  44449. $ctx1.sendIdx["collection"]=2;
  44450. _st($3)._addAll_($4);
  44451. $ctx1.sendIdx["addAll:"]=1;
  44452. $5=_st($2)._yourself();
  44453. $ctx1.sendIdx["yourself"]=1;
  44454. $1=$5;
  44455. $6=self._collection();
  44456. $ctx1.sendIdx["collection"]=3;
  44457. self._assert_equals_($1,$6);
  44458. $ctx1.sendIdx["assert:equals:"]=1;
  44459. $8=self._collection();
  44460. $ctx1.sendIdx["collection"]=4;
  44461. $9=$8;
  44462. $10=self._collectionWithNewValue();
  44463. $ctx1.sendIdx["collectionWithNewValue"]=1;
  44464. _st($9)._addAll_($10);
  44465. $ctx1.sendIdx["addAll:"]=2;
  44466. $11=_st($8)._yourself();
  44467. $ctx1.sendIdx["yourself"]=2;
  44468. $7=$11;
  44469. $12=self._collectionWithNewValue();
  44470. $ctx1.sendIdx["collectionWithNewValue"]=2;
  44471. self._assert_equals_($7,$12);
  44472. $ctx1.sendIdx["assert:equals:"]=2;
  44473. $14=self._collectionWithNewValue();
  44474. $ctx1.sendIdx["collectionWithNewValue"]=3;
  44475. _st($14)._addAll_(self._collection());
  44476. $15=_st($14)._yourself();
  44477. $13=$15;
  44478. self._assert_equals_($13,self._collectionWithNewValue());
  44479. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  44480. args: [],
  44481. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  44482. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  44483. referencedClasses: []
  44484. }),
  44485. globals.AssociativeCollectionTest);
  44486. smalltalk.addMethod(
  44487. smalltalk.method({
  44488. selector: "testAsDictionary",
  44489. protocol: 'tests',
  44490. fn: function (){
  44491. var self=this;
  44492. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44493. return smalltalk.withContext(function($ctx1) {
  44494. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  44495. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  44496. args: [],
  44497. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  44498. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  44499. referencedClasses: ["Dictionary"]
  44500. }),
  44501. globals.AssociativeCollectionTest);
  44502. smalltalk.addMethod(
  44503. smalltalk.method({
  44504. selector: "testAsHashedCollection",
  44505. protocol: 'tests',
  44506. fn: function (){
  44507. var self=this;
  44508. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  44509. return smalltalk.withContext(function($ctx1) {
  44510. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  44511. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  44512. args: [],
  44513. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  44514. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  44515. referencedClasses: ["HashedCollection"]
  44516. }),
  44517. globals.AssociativeCollectionTest);
  44518. smalltalk.addMethod(
  44519. smalltalk.method({
  44520. selector: "testComma",
  44521. protocol: 'tests',
  44522. fn: function (){
  44523. var self=this;
  44524. return smalltalk.withContext(function($ctx1) {
  44525. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  44526. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  44527. $ctx1.supercall = false;
  44528. $2=self._collection();
  44529. $ctx1.sendIdx["collection"]=1;
  44530. $3=self._collection();
  44531. $ctx1.sendIdx["collection"]=2;
  44532. $1=_st($2).__comma($3);
  44533. $ctx1.sendIdx[","]=1;
  44534. $4=self._collection();
  44535. $ctx1.sendIdx["collection"]=3;
  44536. self._assert_equals_($1,$4);
  44537. $ctx1.sendIdx["assert:equals:"]=1;
  44538. $6=self._collection();
  44539. $ctx1.sendIdx["collection"]=4;
  44540. $7=self._collectionWithNewValue();
  44541. $ctx1.sendIdx["collectionWithNewValue"]=1;
  44542. $5=_st($6).__comma($7);
  44543. $ctx1.sendIdx[","]=2;
  44544. $8=self._collectionWithNewValue();
  44545. $ctx1.sendIdx["collectionWithNewValue"]=2;
  44546. self._assert_equals_($5,$8);
  44547. $ctx1.sendIdx["assert:equals:"]=2;
  44548. $10=self._collectionWithNewValue();
  44549. $ctx1.sendIdx["collectionWithNewValue"]=3;
  44550. $9=_st($10).__comma(self._collection());
  44551. self._assert_equals_($9,self._collectionWithNewValue());
  44552. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  44553. args: [],
  44554. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  44555. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  44556. referencedClasses: []
  44557. }),
  44558. globals.AssociativeCollectionTest);
  44559. smalltalk.addMethod(
  44560. smalltalk.method({
  44561. selector: "testFrom",
  44562. protocol: 'tests',
  44563. fn: function (){
  44564. var self=this;
  44565. var associations;
  44566. return smalltalk.withContext(function($ctx1) {
  44567. var $1;
  44568. $1="a".__minus_gt((1));
  44569. $ctx1.sendIdx["->"]=1;
  44570. associations=[$1,"b".__minus_gt((2))];
  44571. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  44572. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  44573. args: [],
  44574. source: "testFrom\x0a\x22Accept a collection of associations.\x22\x0a| associations |\x0aassociations := { 'a' -> 1. 'b' -> 2 }.\x0aself assertSameContents: ( self class collectionClass from: associations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  44575. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  44576. referencedClasses: []
  44577. }),
  44578. globals.AssociativeCollectionTest);
  44579. smalltalk.addMethod(
  44580. smalltalk.method({
  44581. selector: "testKeys",
  44582. protocol: 'tests',
  44583. fn: function (){
  44584. var self=this;
  44585. return smalltalk.withContext(function($ctx1) {
  44586. var $2,$1,$3,$4;
  44587. $2=_st(_st(self._collectionClass())._new())._keys();
  44588. $ctx1.sendIdx["keys"]=1;
  44589. $1=_st($2)._isEmpty();
  44590. self._assert_($1);
  44591. $3=_st(self._collection())._keys();
  44592. $ctx1.sendIdx["keys"]=2;
  44593. $4=self._collectionKeys();
  44594. $ctx1.sendIdx["collectionKeys"]=1;
  44595. self._assertSameContents_as_($3,$4);
  44596. $ctx1.sendIdx["assertSameContents:as:"]=1;
  44597. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  44598. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  44599. args: [],
  44600. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  44601. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  44602. referencedClasses: []
  44603. }),
  44604. globals.AssociativeCollectionTest);
  44605. smalltalk.addMethod(
  44606. smalltalk.method({
  44607. selector: "testNewFromPairs",
  44608. protocol: 'tests',
  44609. fn: function (){
  44610. var self=this;
  44611. var flattenedAssociations;
  44612. return smalltalk.withContext(function($ctx1) {
  44613. flattenedAssociations=["a",(1),"b",(2)];
  44614. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  44615. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  44616. args: [],
  44617. source: "testNewFromPairs\x0a\x22Accept an array in which all odd indexes are keys and evens are values.\x22\x0a| flattenedAssociations |\x0aflattenedAssociations := { 'a'. 1. 'b'. 2 }.\x0aself assertSameContents: ( self class collectionClass newFromPairs: flattenedAssociations ) as: #{ 'a' -> 1. 'b' -> 2 }.",
  44618. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  44619. referencedClasses: []
  44620. }),
  44621. globals.AssociativeCollectionTest);
  44622. smalltalk.addMethod(
  44623. smalltalk.method({
  44624. selector: "testPrintString",
  44625. protocol: 'tests',
  44626. fn: function (){
  44627. var self=this;
  44628. return smalltalk.withContext(function($ctx1) {
  44629. var $3,$2,$4,$1,$5;
  44630. $3=self._collectionClass();
  44631. $ctx1.sendIdx["collectionClass"]=1;
  44632. $2=_st($3)._new();
  44633. _st($2)._at_put_("firstname","James");
  44634. $ctx1.sendIdx["at:put:"]=1;
  44635. _st($2)._at_put_("lastname","Bond");
  44636. $4=_st($2)._printString();
  44637. $1=$4;
  44638. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  44639. $ctx1.sendIdx[","]=1;
  44640. self._assert_equals_($1,$5);
  44641. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  44642. args: [],
  44643. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  44644. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  44645. referencedClasses: []
  44646. }),
  44647. globals.AssociativeCollectionTest);
  44648. smalltalk.addMethod(
  44649. smalltalk.method({
  44650. selector: "testRemoveKey",
  44651. protocol: 'tests',
  44652. fn: function (){
  44653. var self=this;
  44654. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  44655. return smalltalk.withContext(function($ctx1) {
  44656. var $1,$2,$3,$5,$6,$4,$7,$8;
  44657. self._nonIndexesDo_((function(each){
  44658. var collection;
  44659. return smalltalk.withContext(function($ctx2) {
  44660. collection=self._collection();
  44661. $ctx2.sendIdx["collection"]=1;
  44662. collection;
  44663. self._should_raise_((function(){
  44664. return smalltalk.withContext(function($ctx3) {
  44665. return _st(collection)._removeKey_(each);
  44666. $ctx3.sendIdx["removeKey:"]=1;
  44667. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  44668. $1=collection;
  44669. $2=self._collection();
  44670. $ctx2.sendIdx["collection"]=2;
  44671. return self._assert_equals_($1,$2);
  44672. $ctx2.sendIdx["assert:equals:"]=1;
  44673. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  44674. self._samplesDo_((function(index,value){
  44675. var collection;
  44676. return smalltalk.withContext(function($ctx2) {
  44677. collection=self._collection();
  44678. $ctx2.sendIdx["collection"]=3;
  44679. collection;
  44680. $3=_st(collection)._removeKey_(index);
  44681. $ctx2.sendIdx["removeKey:"]=2;
  44682. self._assert_equals_($3,value);
  44683. $ctx2.sendIdx["assert:equals:"]=2;
  44684. $5=collection;
  44685. $6=self._collection();
  44686. $ctx2.sendIdx["collection"]=4;
  44687. $4=_st($5).__eq($6);
  44688. return self._deny_($4);
  44689. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  44690. $7=self._collectionWithNewValue();
  44691. _st($7)._removeKey_(self._sampleNewIndex());
  44692. $8=_st($7)._yourself();
  44693. self._assert_equals_($8,self._collection());
  44694. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  44695. args: [],
  44696. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  44697. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  44698. referencedClasses: ["Error"]
  44699. }),
  44700. globals.AssociativeCollectionTest);
  44701. smalltalk.addMethod(
  44702. smalltalk.method({
  44703. selector: "testRemoveKeyIfAbsent",
  44704. protocol: 'tests',
  44705. fn: function (){
  44706. var self=this;
  44707. return smalltalk.withContext(function($ctx1) {
  44708. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  44709. self._nonIndexesDo_((function(each){
  44710. var collection;
  44711. return smalltalk.withContext(function($ctx2) {
  44712. collection=self._collection();
  44713. $ctx2.sendIdx["collection"]=1;
  44714. collection;
  44715. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  44716. return smalltalk.withContext(function($ctx3) {
  44717. return self._sampleNewValue();
  44718. $ctx3.sendIdx["sampleNewValue"]=1;
  44719. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  44720. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  44721. $2=self._sampleNewValue();
  44722. $ctx2.sendIdx["sampleNewValue"]=2;
  44723. self._assert_equals_($1,$2);
  44724. $ctx2.sendIdx["assert:equals:"]=1;
  44725. $3=collection;
  44726. $4=self._collection();
  44727. $ctx2.sendIdx["collection"]=2;
  44728. return self._assert_equals_($3,$4);
  44729. $ctx2.sendIdx["assert:equals:"]=2;
  44730. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  44731. self._samplesDo_((function(index,value){
  44732. var collection;
  44733. return smalltalk.withContext(function($ctx2) {
  44734. collection=self._collection();
  44735. $ctx2.sendIdx["collection"]=3;
  44736. collection;
  44737. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  44738. return smalltalk.withContext(function($ctx3) {
  44739. return self._sampleNewValue();
  44740. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  44741. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  44742. self._assert_equals_($5,value);
  44743. $ctx2.sendIdx["assert:equals:"]=3;
  44744. $7=collection;
  44745. $8=self._collection();
  44746. $ctx2.sendIdx["collection"]=4;
  44747. $6=_st($7).__eq($8);
  44748. return self._deny_($6);
  44749. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  44750. $9=self._collectionWithNewValue();
  44751. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  44752. return smalltalk.withContext(function($ctx2) {
  44753. return self._assert_(false);
  44754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  44755. $10=_st($9)._yourself();
  44756. self._assert_equals_($10,self._collection());
  44757. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  44758. args: [],
  44759. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  44760. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  44761. referencedClasses: []
  44762. }),
  44763. globals.AssociativeCollectionTest);
  44764. smalltalk.addMethod(
  44765. smalltalk.method({
  44766. selector: "testValues",
  44767. protocol: 'tests',
  44768. fn: function (){
  44769. var self=this;
  44770. return smalltalk.withContext(function($ctx1) {
  44771. var $2,$1,$3,$4;
  44772. $2=_st(_st(self._collectionClass())._new())._values();
  44773. $ctx1.sendIdx["values"]=1;
  44774. $1=_st($2)._isEmpty();
  44775. self._assert_($1);
  44776. $3=_st(self._collection())._values();
  44777. $ctx1.sendIdx["values"]=2;
  44778. $4=self._collectionValues();
  44779. $ctx1.sendIdx["collectionValues"]=1;
  44780. self._assertSameContents_as_($3,$4);
  44781. $ctx1.sendIdx["assertSameContents:as:"]=1;
  44782. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  44783. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  44784. args: [],
  44785. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  44786. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  44787. referencedClasses: []
  44788. }),
  44789. globals.AssociativeCollectionTest);
  44790. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  44791. smalltalk.addMethod(
  44792. smalltalk.method({
  44793. selector: "collection",
  44794. protocol: 'fixture',
  44795. fn: function (){
  44796. var self=this;
  44797. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44798. return smalltalk.withContext(function($ctx1) {
  44799. var $2,$3,$1;
  44800. $2=_st($Dictionary())._new();
  44801. _st($2)._at_put_((1),(1));
  44802. $ctx1.sendIdx["at:put:"]=1;
  44803. _st($2)._at_put_("a",(2));
  44804. $ctx1.sendIdx["at:put:"]=2;
  44805. _st($2)._at_put_(true,(3));
  44806. $ctx1.sendIdx["at:put:"]=3;
  44807. _st($2)._at_put_((1).__at((3)),(-4));
  44808. $3=_st($2)._yourself();
  44809. $1=$3;
  44810. return $1;
  44811. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  44812. args: [],
  44813. source: "collection\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09yourself",
  44814. messageSends: ["at:put:", "new", "@", "yourself"],
  44815. referencedClasses: ["Dictionary"]
  44816. }),
  44817. globals.DictionaryTest);
  44818. smalltalk.addMethod(
  44819. smalltalk.method({
  44820. selector: "collectionKeys",
  44821. protocol: 'fixture',
  44822. fn: function (){
  44823. var self=this;
  44824. return smalltalk.withContext(function($ctx1) {
  44825. var $1;
  44826. $1=[(1),"a",true,(1).__at((3))];
  44827. return $1;
  44828. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  44829. args: [],
  44830. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  44831. messageSends: ["@"],
  44832. referencedClasses: []
  44833. }),
  44834. globals.DictionaryTest);
  44835. smalltalk.addMethod(
  44836. smalltalk.method({
  44837. selector: "collectionOfPrintStrings",
  44838. protocol: 'fixture',
  44839. fn: function (){
  44840. var self=this;
  44841. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44842. return smalltalk.withContext(function($ctx1) {
  44843. var $2,$3,$1;
  44844. $2=_st($Dictionary())._new();
  44845. _st($2)._at_put_((1),"1");
  44846. $ctx1.sendIdx["at:put:"]=1;
  44847. _st($2)._at_put_("a","2");
  44848. $ctx1.sendIdx["at:put:"]=2;
  44849. _st($2)._at_put_(true,"3");
  44850. $ctx1.sendIdx["at:put:"]=3;
  44851. _st($2)._at_put_((1).__at((3)),"-4");
  44852. $3=_st($2)._yourself();
  44853. $1=$3;
  44854. return $1;
  44855. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  44856. args: [],
  44857. source: "collectionOfPrintStrings\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: '1';\x0a\x09\x09at: 'a' put: '2';\x0a\x09\x09at: true put: '3';\x0a\x09\x09at: 1@3 put: '-4';\x0a\x09\x09yourself",
  44858. messageSends: ["at:put:", "new", "@", "yourself"],
  44859. referencedClasses: ["Dictionary"]
  44860. }),
  44861. globals.DictionaryTest);
  44862. smalltalk.addMethod(
  44863. smalltalk.method({
  44864. selector: "collectionSize",
  44865. protocol: 'fixture',
  44866. fn: function (){
  44867. var self=this;
  44868. return (4);
  44869. },
  44870. args: [],
  44871. source: "collectionSize\x0a\x09^ 4",
  44872. messageSends: [],
  44873. referencedClasses: []
  44874. }),
  44875. globals.DictionaryTest);
  44876. smalltalk.addMethod(
  44877. smalltalk.method({
  44878. selector: "collectionValues",
  44879. protocol: 'fixture',
  44880. fn: function (){
  44881. var self=this;
  44882. var $1;
  44883. $1=[(1),(2),(3),(-4)];
  44884. return $1;
  44885. },
  44886. args: [],
  44887. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  44888. messageSends: [],
  44889. referencedClasses: []
  44890. }),
  44891. globals.DictionaryTest);
  44892. smalltalk.addMethod(
  44893. smalltalk.method({
  44894. selector: "collectionWithDuplicates",
  44895. protocol: 'fixture',
  44896. fn: function (){
  44897. var self=this;
  44898. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44899. return smalltalk.withContext(function($ctx1) {
  44900. var $2,$3,$1;
  44901. $2=_st($Dictionary())._new();
  44902. _st($2)._at_put_((1),(1));
  44903. $ctx1.sendIdx["at:put:"]=1;
  44904. _st($2)._at_put_("a",(2));
  44905. $ctx1.sendIdx["at:put:"]=2;
  44906. _st($2)._at_put_(true,(3));
  44907. $ctx1.sendIdx["at:put:"]=3;
  44908. _st($2)._at_put_((4),(-4));
  44909. $ctx1.sendIdx["at:put:"]=4;
  44910. _st($2)._at_put_("b",(1));
  44911. $ctx1.sendIdx["at:put:"]=5;
  44912. _st($2)._at_put_((3),(3));
  44913. $ctx1.sendIdx["at:put:"]=6;
  44914. _st($2)._at_put_(false,(12));
  44915. $3=_st($2)._yourself();
  44916. $1=$3;
  44917. return $1;
  44918. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  44919. args: [],
  44920. source: "collectionWithDuplicates\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 4 put: -4;\x0a\x09\x09at: 'b' put: 1;\x0a\x09\x09at: 3 put: 3;\x0a\x09\x09at: false put: 12;\x0a\x09\x09yourself",
  44921. messageSends: ["at:put:", "new", "yourself"],
  44922. referencedClasses: ["Dictionary"]
  44923. }),
  44924. globals.DictionaryTest);
  44925. smalltalk.addMethod(
  44926. smalltalk.method({
  44927. selector: "collectionWithNewValue",
  44928. protocol: 'fixture',
  44929. fn: function (){
  44930. var self=this;
  44931. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44932. return smalltalk.withContext(function($ctx1) {
  44933. var $2,$3,$1;
  44934. $2=_st($Dictionary())._new();
  44935. _st($2)._at_put_((1),(1));
  44936. $ctx1.sendIdx["at:put:"]=1;
  44937. _st($2)._at_put_("a",(2));
  44938. $ctx1.sendIdx["at:put:"]=2;
  44939. _st($2)._at_put_(true,(3));
  44940. $ctx1.sendIdx["at:put:"]=3;
  44941. _st($2)._at_put_((1).__at((3)),(-4));
  44942. $ctx1.sendIdx["at:put:"]=4;
  44943. _st($2)._at_put_("new","N");
  44944. $3=_st($2)._yourself();
  44945. $1=$3;
  44946. return $1;
  44947. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  44948. args: [],
  44949. source: "collectionWithNewValue\x0a\x09^ Dictionary new\x0a\x09\x09at: 1 put: 1;\x0a\x09\x09at: 'a' put: 2;\x0a\x09\x09at: true put: 3;\x0a\x09\x09at: 1@3 put: -4;\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  44950. messageSends: ["at:put:", "new", "@", "yourself"],
  44951. referencedClasses: ["Dictionary"]
  44952. }),
  44953. globals.DictionaryTest);
  44954. smalltalk.addMethod(
  44955. smalltalk.method({
  44956. selector: "sampleNewValueAsCollection",
  44957. protocol: 'fixture',
  44958. fn: function (){
  44959. var self=this;
  44960. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44961. return smalltalk.withContext(function($ctx1) {
  44962. var $2,$3,$1;
  44963. $2=_st($Dictionary())._new();
  44964. _st($2)._at_put_("new","N");
  44965. $3=_st($2)._yourself();
  44966. $1=$3;
  44967. return $1;
  44968. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  44969. args: [],
  44970. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  44971. messageSends: ["at:put:", "new", "yourself"],
  44972. referencedClasses: ["Dictionary"]
  44973. }),
  44974. globals.DictionaryTest);
  44975. smalltalk.addMethod(
  44976. smalltalk.method({
  44977. selector: "samplesDo:",
  44978. protocol: 'fixture',
  44979. fn: function (aBlock){
  44980. var self=this;
  44981. return smalltalk.withContext(function($ctx1) {
  44982. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  44983. $ctx1.supercall = false;
  44984. _st(aBlock)._value_value_(true,(3));
  44985. $ctx1.sendIdx["value:value:"]=1;
  44986. _st(aBlock)._value_value_((1).__at((3)),(-4));
  44987. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  44988. args: ["aBlock"],
  44989. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  44990. messageSends: ["samplesDo:", "value:value:", "@"],
  44991. referencedClasses: []
  44992. }),
  44993. globals.DictionaryTest);
  44994. smalltalk.addMethod(
  44995. smalltalk.method({
  44996. selector: "testAccessing",
  44997. protocol: 'tests',
  44998. fn: function (){
  44999. var self=this;
  45000. var d;
  45001. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45002. return smalltalk.withContext(function($ctx1) {
  45003. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  45004. d=_st($Dictionary())._new();
  45005. _st(d)._at_put_("hello","world");
  45006. $ctx1.sendIdx["at:put:"]=1;
  45007. $1=_st(d)._at_("hello");
  45008. $ctx1.sendIdx["at:"]=1;
  45009. self._assert_equals_($1,"world");
  45010. $ctx1.sendIdx["assert:equals:"]=1;
  45011. $2=_st(d)._at_ifAbsent_("hello",(function(){
  45012. return nil;
  45013. }));
  45014. $ctx1.sendIdx["at:ifAbsent:"]=1;
  45015. self._assert_equals_($2,"world");
  45016. $ctx1.sendIdx["assert:equals:"]=2;
  45017. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  45018. return nil;
  45019. }))).__eq("world"));
  45020. $ctx1.sendIdx["deny:"]=1;
  45021. $3=_st(d)._includesKey_("hello");
  45022. $ctx1.sendIdx["includesKey:"]=1;
  45023. self._assert_($3);
  45024. $ctx1.sendIdx["assert:"]=1;
  45025. $4=_st(d)._includesKey_("foo");
  45026. $ctx1.sendIdx["includesKey:"]=2;
  45027. self._deny_($4);
  45028. $ctx1.sendIdx["deny:"]=2;
  45029. _st(d)._at_put_((1),(2));
  45030. $ctx1.sendIdx["at:put:"]=2;
  45031. $5=_st(d)._at_((1));
  45032. $ctx1.sendIdx["at:"]=2;
  45033. self._assert_equals_($5,(2));
  45034. $ctx1.sendIdx["assert:equals:"]=3;
  45035. $6=d;
  45036. $7=(1).__at((3));
  45037. $ctx1.sendIdx["@"]=1;
  45038. _st($6)._at_put_($7,(3));
  45039. $9=d;
  45040. $10=(1).__at((3));
  45041. $ctx1.sendIdx["@"]=2;
  45042. $8=_st($9)._at_($10);
  45043. self._assert_equals_($8,(3));
  45044. $12=d;
  45045. $13=(1).__at((3));
  45046. $ctx1.sendIdx["@"]=3;
  45047. $11=_st($12)._includesKey_($13);
  45048. $ctx1.sendIdx["includesKey:"]=3;
  45049. self._assert_($11);
  45050. self._deny_(_st(d)._includesKey_((3).__at((1))));
  45051. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  45052. args: [],
  45053. source: "testAccessing\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x0a\x09d at: 'hello' put: 'world'.\x0a\x09self assert: (d at: 'hello') equals: 'world'.\x0a\x09self assert: (d at: 'hello' ifAbsent: [ nil ]) equals: 'world'.\x0a\x09self deny: (d at: 'foo' ifAbsent: [ nil ]) = 'world'.\x0a\x0a\x09self assert: (d includesKey: 'hello').\x0a\x09self deny: (d includesKey: 'foo').\x0a\x0a\x09d at: 1 put: 2.\x0a\x09self assert: (d at: 1) equals: 2.\x0a\x0a\x09d at: 1@3 put: 3.\x0a\x09self assert: (d at: 1@3) equals: 3.\x0a\x0a\x09self assert: (d includesKey: 1@3).\x0a\x09self deny: (d includesKey: 3@1)",
  45054. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  45055. referencedClasses: ["Dictionary"]
  45056. }),
  45057. globals.DictionaryTest);
  45058. smalltalk.addMethod(
  45059. smalltalk.method({
  45060. selector: "testDynamicDictionaries",
  45061. protocol: 'tests',
  45062. fn: function (){
  45063. var self=this;
  45064. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45065. return smalltalk.withContext(function($ctx1) {
  45066. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  45067. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  45068. args: [],
  45069. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  45070. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  45071. referencedClasses: ["Dictionary"]
  45072. }),
  45073. globals.DictionaryTest);
  45074. smalltalk.addMethod(
  45075. smalltalk.method({
  45076. selector: "collectionClass",
  45077. protocol: 'fixture',
  45078. fn: function (){
  45079. var self=this;
  45080. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45081. return $Dictionary();
  45082. },
  45083. args: [],
  45084. source: "collectionClass\x0a\x09^ Dictionary",
  45085. messageSends: [],
  45086. referencedClasses: ["Dictionary"]
  45087. }),
  45088. globals.DictionaryTest.klass);
  45089. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  45090. smalltalk.addMethod(
  45091. smalltalk.method({
  45092. selector: "collection",
  45093. protocol: 'fixture',
  45094. fn: function (){
  45095. var self=this;
  45096. var $1;
  45097. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  45098. return $1;
  45099. },
  45100. args: [],
  45101. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  45102. messageSends: [],
  45103. referencedClasses: []
  45104. }),
  45105. globals.HashedCollectionTest);
  45106. smalltalk.addMethod(
  45107. smalltalk.method({
  45108. selector: "collectionKeys",
  45109. protocol: 'fixture',
  45110. fn: function (){
  45111. var self=this;
  45112. var $1;
  45113. $1=["b","a","c","d"];
  45114. return $1;
  45115. },
  45116. args: [],
  45117. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  45118. messageSends: [],
  45119. referencedClasses: []
  45120. }),
  45121. globals.HashedCollectionTest);
  45122. smalltalk.addMethod(
  45123. smalltalk.method({
  45124. selector: "collectionOfPrintStrings",
  45125. protocol: 'fixture',
  45126. fn: function (){
  45127. var self=this;
  45128. var $1;
  45129. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  45130. return $1;
  45131. },
  45132. args: [],
  45133. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  45134. messageSends: [],
  45135. referencedClasses: []
  45136. }),
  45137. globals.HashedCollectionTest);
  45138. smalltalk.addMethod(
  45139. smalltalk.method({
  45140. selector: "collectionSize",
  45141. protocol: 'fixture',
  45142. fn: function (){
  45143. var self=this;
  45144. return (4);
  45145. },
  45146. args: [],
  45147. source: "collectionSize\x0a\x09^ 4",
  45148. messageSends: [],
  45149. referencedClasses: []
  45150. }),
  45151. globals.HashedCollectionTest);
  45152. smalltalk.addMethod(
  45153. smalltalk.method({
  45154. selector: "collectionValues",
  45155. protocol: 'fixture',
  45156. fn: function (){
  45157. var self=this;
  45158. var $1;
  45159. $1=[(1),(2),(3),(-4)];
  45160. return $1;
  45161. },
  45162. args: [],
  45163. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  45164. messageSends: [],
  45165. referencedClasses: []
  45166. }),
  45167. globals.HashedCollectionTest);
  45168. smalltalk.addMethod(
  45169. smalltalk.method({
  45170. selector: "collectionWithDuplicates",
  45171. protocol: 'fixture',
  45172. fn: function (){
  45173. var self=this;
  45174. var $1;
  45175. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  45176. return $1;
  45177. },
  45178. args: [],
  45179. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  45180. messageSends: [],
  45181. referencedClasses: []
  45182. }),
  45183. globals.HashedCollectionTest);
  45184. smalltalk.addMethod(
  45185. smalltalk.method({
  45186. selector: "collectionWithNewValue",
  45187. protocol: 'fixture',
  45188. fn: function (){
  45189. var self=this;
  45190. var $1;
  45191. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  45192. return $1;
  45193. },
  45194. args: [],
  45195. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  45196. messageSends: [],
  45197. referencedClasses: []
  45198. }),
  45199. globals.HashedCollectionTest);
  45200. smalltalk.addMethod(
  45201. smalltalk.method({
  45202. selector: "sampleNewValueAsCollection",
  45203. protocol: 'fixture',
  45204. fn: function (){
  45205. var self=this;
  45206. var $1;
  45207. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  45208. return $1;
  45209. },
  45210. args: [],
  45211. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  45212. messageSends: [],
  45213. referencedClasses: []
  45214. }),
  45215. globals.HashedCollectionTest);
  45216. smalltalk.addMethod(
  45217. smalltalk.method({
  45218. selector: "testDynamicDictionaries",
  45219. protocol: 'tests',
  45220. fn: function (){
  45221. var self=this;
  45222. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  45223. return smalltalk.withContext(function($ctx1) {
  45224. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  45225. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  45226. args: [],
  45227. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  45228. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  45229. referencedClasses: ["HashedCollection"]
  45230. }),
  45231. globals.HashedCollectionTest);
  45232. smalltalk.addMethod(
  45233. smalltalk.method({
  45234. selector: "collectionClass",
  45235. protocol: 'fixture',
  45236. fn: function (){
  45237. var self=this;
  45238. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  45239. return $HashedCollection();
  45240. },
  45241. args: [],
  45242. source: "collectionClass\x0a\x09^ HashedCollection",
  45243. messageSends: [],
  45244. referencedClasses: ["HashedCollection"]
  45245. }),
  45246. globals.HashedCollectionTest.klass);
  45247. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  45248. smalltalk.addMethod(
  45249. smalltalk.method({
  45250. selector: "collectionFirst",
  45251. protocol: 'fixture',
  45252. fn: function (){
  45253. var self=this;
  45254. return smalltalk.withContext(function($ctx1) {
  45255. self._subclassResponsibility();
  45256. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  45257. args: [],
  45258. source: "collectionFirst\x0a\x09self subclassResponsibility",
  45259. messageSends: ["subclassResponsibility"],
  45260. referencedClasses: []
  45261. }),
  45262. globals.SequenceableCollectionTest);
  45263. smalltalk.addMethod(
  45264. smalltalk.method({
  45265. selector: "collectionFirstTwo",
  45266. protocol: 'fixture',
  45267. fn: function (){
  45268. var self=this;
  45269. return smalltalk.withContext(function($ctx1) {
  45270. self._subclassResponsibility();
  45271. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  45272. args: [],
  45273. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  45274. messageSends: ["subclassResponsibility"],
  45275. referencedClasses: []
  45276. }),
  45277. globals.SequenceableCollectionTest);
  45278. smalltalk.addMethod(
  45279. smalltalk.method({
  45280. selector: "collectionLast",
  45281. protocol: 'fixture',
  45282. fn: function (){
  45283. var self=this;
  45284. return smalltalk.withContext(function($ctx1) {
  45285. self._subclassResponsibility();
  45286. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  45287. args: [],
  45288. source: "collectionLast\x0a\x09self subclassResponsibility",
  45289. messageSends: ["subclassResponsibility"],
  45290. referencedClasses: []
  45291. }),
  45292. globals.SequenceableCollectionTest);
  45293. smalltalk.addMethod(
  45294. smalltalk.method({
  45295. selector: "collectionLastTwo",
  45296. protocol: 'fixture',
  45297. fn: function (){
  45298. var self=this;
  45299. return smalltalk.withContext(function($ctx1) {
  45300. self._subclassResponsibility();
  45301. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  45302. args: [],
  45303. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  45304. messageSends: ["subclassResponsibility"],
  45305. referencedClasses: []
  45306. }),
  45307. globals.SequenceableCollectionTest);
  45308. smalltalk.addMethod(
  45309. smalltalk.method({
  45310. selector: "nonIndexesDo:",
  45311. protocol: 'fixture',
  45312. fn: function (aBlock){
  45313. var self=this;
  45314. return smalltalk.withContext(function($ctx1) {
  45315. _st(aBlock)._value_((0));
  45316. $ctx1.sendIdx["value:"]=1;
  45317. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  45318. $ctx1.sendIdx["value:"]=2;
  45319. _st(aBlock)._value_("z");
  45320. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  45321. args: ["aBlock"],
  45322. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  45323. messageSends: ["value:", "+", "collectionSize"],
  45324. referencedClasses: []
  45325. }),
  45326. globals.SequenceableCollectionTest);
  45327. smalltalk.addMethod(
  45328. smalltalk.method({
  45329. selector: "samplesDo:",
  45330. protocol: 'fixture',
  45331. fn: function (aBlock){
  45332. var self=this;
  45333. return smalltalk.withContext(function($ctx1) {
  45334. _st(aBlock)._value_value_((1),self._collectionFirst());
  45335. $ctx1.sendIdx["value:value:"]=1;
  45336. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  45337. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  45338. args: ["aBlock"],
  45339. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  45340. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  45341. referencedClasses: []
  45342. }),
  45343. globals.SequenceableCollectionTest);
  45344. smalltalk.addMethod(
  45345. smalltalk.method({
  45346. selector: "testBeginsWith",
  45347. protocol: 'tests',
  45348. fn: function (){
  45349. var self=this;
  45350. return smalltalk.withContext(function($ctx1) {
  45351. var $2,$1,$4,$5,$3,$7,$6;
  45352. $2=self._collection();
  45353. $ctx1.sendIdx["collection"]=1;
  45354. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  45355. $ctx1.sendIdx["beginsWith:"]=1;
  45356. self._assert_($1);
  45357. $ctx1.sendIdx["assert:"]=1;
  45358. $4=self._collection();
  45359. $ctx1.sendIdx["collection"]=2;
  45360. $5=self._collection();
  45361. $ctx1.sendIdx["collection"]=3;
  45362. $3=_st($4)._beginsWith_($5);
  45363. $ctx1.sendIdx["beginsWith:"]=2;
  45364. self._assert_($3);
  45365. $ctx1.sendIdx["assert:"]=2;
  45366. $7=self._collection();
  45367. $ctx1.sendIdx["collection"]=4;
  45368. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  45369. $ctx1.sendIdx["beginsWith:"]=3;
  45370. self._assert_($6);
  45371. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  45372. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  45373. args: [],
  45374. source: "testBeginsWith\x0a\x09self assert: (self collection beginsWith: self collectionClass new).\x0a\x09self assert: (self collection beginsWith: self collection).\x0a\x09self assert: (self collection beginsWith: self collectionFirstTwo).\x0a\x09self deny: (self collection beginsWith: self collectionLastTwo)",
  45375. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  45376. referencedClasses: []
  45377. }),
  45378. globals.SequenceableCollectionTest);
  45379. smalltalk.addMethod(
  45380. smalltalk.method({
  45381. selector: "testEndsWith",
  45382. protocol: 'tests',
  45383. fn: function (){
  45384. var self=this;
  45385. return smalltalk.withContext(function($ctx1) {
  45386. var $2,$1,$4,$5,$3,$7,$6;
  45387. $2=self._collection();
  45388. $ctx1.sendIdx["collection"]=1;
  45389. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  45390. $ctx1.sendIdx["endsWith:"]=1;
  45391. self._assert_($1);
  45392. $ctx1.sendIdx["assert:"]=1;
  45393. $4=self._collection();
  45394. $ctx1.sendIdx["collection"]=2;
  45395. $5=self._collection();
  45396. $ctx1.sendIdx["collection"]=3;
  45397. $3=_st($4)._endsWith_($5);
  45398. $ctx1.sendIdx["endsWith:"]=2;
  45399. self._assert_($3);
  45400. $ctx1.sendIdx["assert:"]=2;
  45401. $7=self._collection();
  45402. $ctx1.sendIdx["collection"]=4;
  45403. $6=_st($7)._endsWith_(self._collectionLastTwo());
  45404. $ctx1.sendIdx["endsWith:"]=3;
  45405. self._assert_($6);
  45406. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  45407. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  45408. args: [],
  45409. source: "testEndsWith\x0a\x09self assert: (self collection endsWith: self collectionClass new).\x0a\x09self assert: (self collection endsWith: self collection).\x0a\x09self assert: (self collection endsWith: self collectionLastTwo).\x0a\x09self deny: (self collection endsWith: self collectionFirstTwo)",
  45410. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  45411. referencedClasses: []
  45412. }),
  45413. globals.SequenceableCollectionTest);
  45414. smalltalk.addMethod(
  45415. smalltalk.method({
  45416. selector: "testFirst",
  45417. protocol: 'tests',
  45418. fn: function (){
  45419. var self=this;
  45420. return smalltalk.withContext(function($ctx1) {
  45421. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  45422. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  45423. args: [],
  45424. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  45425. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  45426. referencedClasses: []
  45427. }),
  45428. globals.SequenceableCollectionTest);
  45429. smalltalk.addMethod(
  45430. smalltalk.method({
  45431. selector: "testFirstN",
  45432. protocol: 'tests',
  45433. fn: function (){
  45434. var self=this;
  45435. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  45436. return smalltalk.withContext(function($ctx1) {
  45437. var $2,$1,$4,$3,$6,$5,$7;
  45438. $2=self._collection();
  45439. $ctx1.sendIdx["collection"]=1;
  45440. $1=_st($2)._first_((2));
  45441. $ctx1.sendIdx["first:"]=1;
  45442. self._assert_equals_($1,self._collectionFirstTwo());
  45443. $ctx1.sendIdx["assert:equals:"]=1;
  45444. $4=self._collection();
  45445. $ctx1.sendIdx["collection"]=2;
  45446. $3=_st($4)._first_((0));
  45447. $ctx1.sendIdx["first:"]=2;
  45448. self._assert_equals_($3,_st(self._collectionClass())._new());
  45449. $ctx1.sendIdx["assert:equals:"]=2;
  45450. $6=self._collection();
  45451. $ctx1.sendIdx["collection"]=3;
  45452. $5=_st($6)._first_(self._collectionSize());
  45453. $ctx1.sendIdx["first:"]=3;
  45454. $7=self._collection();
  45455. $ctx1.sendIdx["collection"]=4;
  45456. self._assert_equals_($5,$7);
  45457. self._should_raise_((function(){
  45458. return smalltalk.withContext(function($ctx2) {
  45459. return _st(self._collection())._first_((33));
  45460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  45461. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  45462. args: [],
  45463. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  45464. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  45465. referencedClasses: ["Error"]
  45466. }),
  45467. globals.SequenceableCollectionTest);
  45468. smalltalk.addMethod(
  45469. smalltalk.method({
  45470. selector: "testFourth",
  45471. protocol: 'tests',
  45472. fn: function (){
  45473. var self=this;
  45474. return smalltalk.withContext(function($ctx1) {
  45475. var $2,$1;
  45476. $2=self._collection();
  45477. $ctx1.sendIdx["collection"]=1;
  45478. $1=_st($2)._fourth();
  45479. self._assert_equals_($1,_st(self._collection())._at_((4)));
  45480. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  45481. args: [],
  45482. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  45483. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  45484. referencedClasses: []
  45485. }),
  45486. globals.SequenceableCollectionTest);
  45487. smalltalk.addMethod(
  45488. smalltalk.method({
  45489. selector: "testIndexOfStartingAt",
  45490. protocol: 'tests',
  45491. fn: function (){
  45492. var self=this;
  45493. var jsNull;
  45494. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  45495. return smalltalk.withContext(function($ctx1) {
  45496. var $2,$1,$4,$3;
  45497. jsNull=_st($JSON())._parse_("null");
  45498. self._samplesDo_((function(index,value){
  45499. return smalltalk.withContext(function($ctx2) {
  45500. $2=self._collection();
  45501. $ctx2.sendIdx["collection"]=1;
  45502. $1=_st($2)._indexOf_startingAt_(value,(1));
  45503. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  45504. self._assert_equals_($1,index);
  45505. $ctx2.sendIdx["assert:equals:"]=1;
  45506. $4=self._collection();
  45507. $ctx2.sendIdx["collection"]=2;
  45508. $3=_st($4)._indexOf_startingAt_(value,index);
  45509. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  45510. self._assert_equals_($3,index);
  45511. $ctx2.sendIdx["assert:equals:"]=2;
  45512. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  45513. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  45514. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  45515. args: [],
  45516. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  45517. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  45518. referencedClasses: ["JSON"]
  45519. }),
  45520. globals.SequenceableCollectionTest);
  45521. smalltalk.addMethod(
  45522. smalltalk.method({
  45523. selector: "testIndexOfStartingAtWithNull",
  45524. protocol: 'tests',
  45525. fn: function (){
  45526. var self=this;
  45527. var jsNull;
  45528. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  45529. return smalltalk.withContext(function($ctx1) {
  45530. var $1,$2;
  45531. jsNull=_st($JSON())._parse_("null");
  45532. self._samplesDo_((function(index,value){
  45533. var collection;
  45534. return smalltalk.withContext(function($ctx2) {
  45535. collection=self._collection();
  45536. collection;
  45537. _st(collection)._at_put_(index,jsNull);
  45538. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  45539. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  45540. self._assert_equals_($1,index);
  45541. $ctx2.sendIdx["assert:equals:"]=1;
  45542. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  45543. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  45544. self._assert_equals_($2,index);
  45545. $ctx2.sendIdx["assert:equals:"]=2;
  45546. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  45547. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  45548. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  45549. args: [],
  45550. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  45551. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  45552. referencedClasses: ["JSON"]
  45553. }),
  45554. globals.SequenceableCollectionTest);
  45555. smalltalk.addMethod(
  45556. smalltalk.method({
  45557. selector: "testLast",
  45558. protocol: 'tests',
  45559. fn: function (){
  45560. var self=this;
  45561. return smalltalk.withContext(function($ctx1) {
  45562. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  45563. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  45564. args: [],
  45565. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  45566. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  45567. referencedClasses: []
  45568. }),
  45569. globals.SequenceableCollectionTest);
  45570. smalltalk.addMethod(
  45571. smalltalk.method({
  45572. selector: "testLastN",
  45573. protocol: 'tests',
  45574. fn: function (){
  45575. var self=this;
  45576. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  45577. return smalltalk.withContext(function($ctx1) {
  45578. var $2,$1,$4,$3,$6,$5,$7;
  45579. $2=self._collection();
  45580. $ctx1.sendIdx["collection"]=1;
  45581. $1=_st($2)._last_((2));
  45582. $ctx1.sendIdx["last:"]=1;
  45583. self._assert_equals_($1,self._collectionLastTwo());
  45584. $ctx1.sendIdx["assert:equals:"]=1;
  45585. $4=self._collection();
  45586. $ctx1.sendIdx["collection"]=2;
  45587. $3=_st($4)._last_((0));
  45588. $ctx1.sendIdx["last:"]=2;
  45589. self._assert_equals_($3,_st(self._collectionClass())._new());
  45590. $ctx1.sendIdx["assert:equals:"]=2;
  45591. $6=self._collection();
  45592. $ctx1.sendIdx["collection"]=3;
  45593. $5=_st($6)._last_(self._collectionSize());
  45594. $ctx1.sendIdx["last:"]=3;
  45595. $7=self._collection();
  45596. $ctx1.sendIdx["collection"]=4;
  45597. self._assert_equals_($5,$7);
  45598. self._should_raise_((function(){
  45599. return smalltalk.withContext(function($ctx2) {
  45600. return _st(self._collection())._last_((33));
  45601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  45602. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  45603. args: [],
  45604. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collectionSize)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  45605. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  45606. referencedClasses: ["Error"]
  45607. }),
  45608. globals.SequenceableCollectionTest);
  45609. smalltalk.addMethod(
  45610. smalltalk.method({
  45611. selector: "testSecond",
  45612. protocol: 'tests',
  45613. fn: function (){
  45614. var self=this;
  45615. return smalltalk.withContext(function($ctx1) {
  45616. var $2,$1;
  45617. $2=self._collection();
  45618. $ctx1.sendIdx["collection"]=1;
  45619. $1=_st($2)._second();
  45620. self._assert_equals_($1,_st(self._collection())._at_((2)));
  45621. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  45622. args: [],
  45623. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  45624. messageSends: ["assert:equals:", "second", "collection", "at:"],
  45625. referencedClasses: []
  45626. }),
  45627. globals.SequenceableCollectionTest);
  45628. smalltalk.addMethod(
  45629. smalltalk.method({
  45630. selector: "testThird",
  45631. protocol: 'tests',
  45632. fn: function (){
  45633. var self=this;
  45634. return smalltalk.withContext(function($ctx1) {
  45635. var $2,$1;
  45636. $2=self._collection();
  45637. $ctx1.sendIdx["collection"]=1;
  45638. $1=_st($2)._third();
  45639. self._assert_equals_($1,_st(self._collection())._at_((3)));
  45640. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  45641. args: [],
  45642. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  45643. messageSends: ["assert:equals:", "third", "collection", "at:"],
  45644. referencedClasses: []
  45645. }),
  45646. globals.SequenceableCollectionTest);
  45647. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  45648. smalltalk.addMethod(
  45649. smalltalk.method({
  45650. selector: "collection",
  45651. protocol: 'fixture',
  45652. fn: function (){
  45653. var self=this;
  45654. var $1;
  45655. $1=[(1), (2), (3), (-4)];
  45656. return $1;
  45657. },
  45658. args: [],
  45659. source: "collection\x0a\x09^ #(1 2 3 -4)",
  45660. messageSends: [],
  45661. referencedClasses: []
  45662. }),
  45663. globals.ArrayTest);
  45664. smalltalk.addMethod(
  45665. smalltalk.method({
  45666. selector: "collectionFirst",
  45667. protocol: 'fixture',
  45668. fn: function (){
  45669. var self=this;
  45670. return (1);
  45671. },
  45672. args: [],
  45673. source: "collectionFirst\x0a\x09^ 1",
  45674. messageSends: [],
  45675. referencedClasses: []
  45676. }),
  45677. globals.ArrayTest);
  45678. smalltalk.addMethod(
  45679. smalltalk.method({
  45680. selector: "collectionFirstTwo",
  45681. protocol: 'fixture',
  45682. fn: function (){
  45683. var self=this;
  45684. var $1;
  45685. $1=[(1), (2)];
  45686. return $1;
  45687. },
  45688. args: [],
  45689. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  45690. messageSends: [],
  45691. referencedClasses: []
  45692. }),
  45693. globals.ArrayTest);
  45694. smalltalk.addMethod(
  45695. smalltalk.method({
  45696. selector: "collectionLast",
  45697. protocol: 'fixture',
  45698. fn: function (){
  45699. var self=this;
  45700. return (-4);
  45701. },
  45702. args: [],
  45703. source: "collectionLast\x0a\x09^ -4",
  45704. messageSends: [],
  45705. referencedClasses: []
  45706. }),
  45707. globals.ArrayTest);
  45708. smalltalk.addMethod(
  45709. smalltalk.method({
  45710. selector: "collectionLastTwo",
  45711. protocol: 'fixture',
  45712. fn: function (){
  45713. var self=this;
  45714. var $1;
  45715. $1=[(3), (-4)];
  45716. return $1;
  45717. },
  45718. args: [],
  45719. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  45720. messageSends: [],
  45721. referencedClasses: []
  45722. }),
  45723. globals.ArrayTest);
  45724. smalltalk.addMethod(
  45725. smalltalk.method({
  45726. selector: "collectionOfPrintStrings",
  45727. protocol: 'fixture',
  45728. fn: function (){
  45729. var self=this;
  45730. var $1;
  45731. $1=["1", "2", "3", "-4"];
  45732. return $1;
  45733. },
  45734. args: [],
  45735. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  45736. messageSends: [],
  45737. referencedClasses: []
  45738. }),
  45739. globals.ArrayTest);
  45740. smalltalk.addMethod(
  45741. smalltalk.method({
  45742. selector: "collectionSize",
  45743. protocol: 'fixture',
  45744. fn: function (){
  45745. var self=this;
  45746. return (4);
  45747. },
  45748. args: [],
  45749. source: "collectionSize\x0a\x09^ 4",
  45750. messageSends: [],
  45751. referencedClasses: []
  45752. }),
  45753. globals.ArrayTest);
  45754. smalltalk.addMethod(
  45755. smalltalk.method({
  45756. selector: "collectionWithDuplicates",
  45757. protocol: 'fixture',
  45758. fn: function (){
  45759. var self=this;
  45760. var $1;
  45761. $1=["a", "b", "c", (1), (2), (1), "a"];
  45762. return $1;
  45763. },
  45764. args: [],
  45765. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  45766. messageSends: [],
  45767. referencedClasses: []
  45768. }),
  45769. globals.ArrayTest);
  45770. smalltalk.addMethod(
  45771. smalltalk.method({
  45772. selector: "collectionWithNewValue",
  45773. protocol: 'fixture',
  45774. fn: function (){
  45775. var self=this;
  45776. var $1;
  45777. $1=[(1), (2), (3), (-4), "N"];
  45778. return $1;
  45779. },
  45780. args: [],
  45781. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  45782. messageSends: [],
  45783. referencedClasses: []
  45784. }),
  45785. globals.ArrayTest);
  45786. smalltalk.addMethod(
  45787. smalltalk.method({
  45788. selector: "sampleNewIndex",
  45789. protocol: 'fixture',
  45790. fn: function (){
  45791. var self=this;
  45792. return (5);
  45793. },
  45794. args: [],
  45795. source: "sampleNewIndex\x0a\x09^ 5",
  45796. messageSends: [],
  45797. referencedClasses: []
  45798. }),
  45799. globals.ArrayTest);
  45800. smalltalk.addMethod(
  45801. smalltalk.method({
  45802. selector: "samplesDo:",
  45803. protocol: 'fixture',
  45804. fn: function (aBlock){
  45805. var self=this;
  45806. return smalltalk.withContext(function($ctx1) {
  45807. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  45808. $ctx1.supercall = false;
  45809. _st(aBlock)._value_value_((3),(3));
  45810. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  45811. args: ["aBlock"],
  45812. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  45813. messageSends: ["samplesDo:", "value:value:"],
  45814. referencedClasses: []
  45815. }),
  45816. globals.ArrayTest);
  45817. smalltalk.addMethod(
  45818. smalltalk.method({
  45819. selector: "testAdd",
  45820. protocol: 'tests',
  45821. fn: function (){
  45822. var self=this;
  45823. var array;
  45824. return smalltalk.withContext(function($ctx1) {
  45825. array=self._collection();
  45826. _st(array)._add_((6));
  45827. self._assert_equals_(_st(array)._last(),(6));
  45828. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  45829. args: [],
  45830. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  45831. messageSends: ["collection", "add:", "assert:equals:", "last"],
  45832. referencedClasses: []
  45833. }),
  45834. globals.ArrayTest);
  45835. smalltalk.addMethod(
  45836. smalltalk.method({
  45837. selector: "testAddFirst",
  45838. protocol: 'tests',
  45839. fn: function (){
  45840. var self=this;
  45841. return smalltalk.withContext(function($ctx1) {
  45842. var $1,$2;
  45843. $1=self._collection();
  45844. _st($1)._addFirst_((0));
  45845. $2=_st($1)._yourself();
  45846. self._assert_equals_(_st($2)._first(),(0));
  45847. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  45848. args: [],
  45849. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  45850. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  45851. referencedClasses: []
  45852. }),
  45853. globals.ArrayTest);
  45854. smalltalk.addMethod(
  45855. smalltalk.method({
  45856. selector: "testPrintString",
  45857. protocol: 'tests',
  45858. fn: function (){
  45859. var self=this;
  45860. var array;
  45861. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  45862. return smalltalk.withContext(function($ctx1) {
  45863. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  45864. array=_st($Array())._new();
  45865. $1=_st(array)._printString();
  45866. $ctx1.sendIdx["printString"]=1;
  45867. self._assert_equals_($1,"an Array ()");
  45868. $ctx1.sendIdx["assert:equals:"]=1;
  45869. $2=array;
  45870. _st($2)._add_((1));
  45871. $ctx1.sendIdx["add:"]=1;
  45872. $3=_st($2)._add_((3));
  45873. $ctx1.sendIdx["add:"]=2;
  45874. $4=_st(array)._printString();
  45875. $ctx1.sendIdx["printString"]=2;
  45876. self._assert_equals_($4,"an Array (1 3)");
  45877. $ctx1.sendIdx["assert:equals:"]=2;
  45878. _st(array)._add_("foo");
  45879. $5=_st(array)._printString();
  45880. $ctx1.sendIdx["printString"]=3;
  45881. self._assert_equals_($5,"an Array (1 3 'foo')");
  45882. $ctx1.sendIdx["assert:equals:"]=3;
  45883. $6=array;
  45884. _st($6)._remove_((1));
  45885. $ctx1.sendIdx["remove:"]=1;
  45886. $7=_st($6)._remove_((3));
  45887. $8=_st(array)._printString();
  45888. $ctx1.sendIdx["printString"]=4;
  45889. self._assert_equals_($8,"an Array ('foo')");
  45890. $ctx1.sendIdx["assert:equals:"]=4;
  45891. _st(array)._addLast_((3));
  45892. $ctx1.sendIdx["addLast:"]=1;
  45893. $9=_st(array)._printString();
  45894. $ctx1.sendIdx["printString"]=5;
  45895. self._assert_equals_($9,"an Array ('foo' 3)");
  45896. $ctx1.sendIdx["assert:equals:"]=5;
  45897. _st(array)._addLast_((3));
  45898. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  45899. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  45900. args: [],
  45901. source: "testPrintString\x0a\x09| array |\x0a\x09array := Array new.\x0a\x09self assert: array printString equals: 'an Array ()'.\x0a\x09array add: 1; add: 3.\x0a\x09self assert: array printString equals: 'an Array (1 3)'.\x0a\x09array add: 'foo'.\x0a\x09self assert: array printString equals: 'an Array (1 3 ''foo'')'.\x0a\x09array remove: 1; remove: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'')'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3)'.\x0a\x09array addLast: 3.\x0a\x09self assert: array printString equals: 'an Array (''foo'' 3 3)'.",
  45902. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  45903. referencedClasses: ["Array"]
  45904. }),
  45905. globals.ArrayTest);
  45906. smalltalk.addMethod(
  45907. smalltalk.method({
  45908. selector: "testRemove",
  45909. protocol: 'tests',
  45910. fn: function (){
  45911. var self=this;
  45912. var array;
  45913. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  45914. return smalltalk.withContext(function($ctx1) {
  45915. array=[(1), (2), (3), (4), (5)];
  45916. _st(array)._remove_((3));
  45917. $ctx1.sendIdx["remove:"]=1;
  45918. self._assert_equals_(array,[(1), (2), (4), (5)]);
  45919. self._should_raise_((function(){
  45920. return smalltalk.withContext(function($ctx2) {
  45921. return _st(array)._remove_((3));
  45922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  45923. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  45924. args: [],
  45925. source: "testRemove \x0a\x09| array |\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove: 3.\x0a\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [ array remove: 3 ] raise: Error",
  45926. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  45927. referencedClasses: ["Error"]
  45928. }),
  45929. globals.ArrayTest);
  45930. smalltalk.addMethod(
  45931. smalltalk.method({
  45932. selector: "testRemoveFromTo",
  45933. protocol: 'tests',
  45934. fn: function (){
  45935. var self=this;
  45936. return smalltalk.withContext(function($ctx1) {
  45937. var $1,$2;
  45938. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  45939. $ctx1.sendIdx["removeFrom:to:"]=1;
  45940. self._assert_equals_($1,[(4)]);
  45941. $ctx1.sendIdx["assert:equals:"]=1;
  45942. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  45943. $ctx1.sendIdx["removeFrom:to:"]=2;
  45944. self._assert_equals_($2,[(1), (4)]);
  45945. $ctx1.sendIdx["assert:equals:"]=2;
  45946. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  45947. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  45948. args: [],
  45949. source: "testRemoveFromTo\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeFrom: 1 to: 3) equals: #(4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 3) equals: #(1 4).\x0a\x09self assert: (#(1 2 3 4) removeFrom: 2 to: 4) equals: #(1)",
  45950. messageSends: ["assert:equals:", "removeFrom:to:"],
  45951. referencedClasses: []
  45952. }),
  45953. globals.ArrayTest);
  45954. smalltalk.addMethod(
  45955. smalltalk.method({
  45956. selector: "testRemoveIndex",
  45957. protocol: 'tests',
  45958. fn: function (){
  45959. var self=this;
  45960. return smalltalk.withContext(function($ctx1) {
  45961. var $1,$2;
  45962. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  45963. $ctx1.sendIdx["removeIndex:"]=1;
  45964. self._assert_equals_($1,[(1), (3), (4)]);
  45965. $ctx1.sendIdx["assert:equals:"]=1;
  45966. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  45967. $ctx1.sendIdx["removeIndex:"]=2;
  45968. self._assert_equals_($2,[(2), (3), (4)]);
  45969. $ctx1.sendIdx["assert:equals:"]=2;
  45970. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  45971. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  45972. args: [],
  45973. source: "testRemoveIndex\x0a\x09\x0a\x09self assert: (#(1 2 3 4) removeIndex: 2) equals: #(1 3 4).\x0a\x09self assert: (#(1 2 3 4) removeIndex: 1) equals: #(2 3 4).\x0a\x09self assert: (#('hello') removeIndex: 1) equals: #()",
  45974. messageSends: ["assert:equals:", "removeIndex:"],
  45975. referencedClasses: []
  45976. }),
  45977. globals.ArrayTest);
  45978. smalltalk.addMethod(
  45979. smalltalk.method({
  45980. selector: "testRemoveLast",
  45981. protocol: 'tests',
  45982. fn: function (){
  45983. var self=this;
  45984. var array;
  45985. return smalltalk.withContext(function($ctx1) {
  45986. array=[(1), (2)];
  45987. _st(array)._removeLast();
  45988. self._assert_equals_(_st(array)._last(),(1));
  45989. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  45990. args: [],
  45991. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  45992. messageSends: ["removeLast", "assert:equals:", "last"],
  45993. referencedClasses: []
  45994. }),
  45995. globals.ArrayTest);
  45996. smalltalk.addMethod(
  45997. smalltalk.method({
  45998. selector: "testReversed",
  45999. protocol: 'tests',
  46000. fn: function (){
  46001. var self=this;
  46002. var array;
  46003. return smalltalk.withContext(function($ctx1) {
  46004. array=[(5), (4), (3), (2), (1)];
  46005. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  46006. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  46007. args: [],
  46008. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  46009. messageSends: ["assert:equals:", "reversed"],
  46010. referencedClasses: []
  46011. }),
  46012. globals.ArrayTest);
  46013. smalltalk.addMethod(
  46014. smalltalk.method({
  46015. selector: "testSort",
  46016. protocol: 'tests',
  46017. fn: function (){
  46018. var self=this;
  46019. var array;
  46020. return smalltalk.withContext(function($ctx1) {
  46021. array=[(10), (1), (5)];
  46022. _st(array)._sort();
  46023. self._assert_equals_(array,[(1), (5), (10)]);
  46024. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  46025. args: [],
  46026. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  46027. messageSends: ["sort", "assert:equals:"],
  46028. referencedClasses: []
  46029. }),
  46030. globals.ArrayTest);
  46031. smalltalk.addMethod(
  46032. smalltalk.method({
  46033. selector: "collectionClass",
  46034. protocol: 'fixture',
  46035. fn: function (){
  46036. var self=this;
  46037. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  46038. return $Array();
  46039. },
  46040. args: [],
  46041. source: "collectionClass\x0a\x09^ Array",
  46042. messageSends: [],
  46043. referencedClasses: ["Array"]
  46044. }),
  46045. globals.ArrayTest.klass);
  46046. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  46047. smalltalk.addMethod(
  46048. smalltalk.method({
  46049. selector: "collection",
  46050. protocol: 'fixture',
  46051. fn: function (){
  46052. var self=this;
  46053. return "helLo";
  46054. },
  46055. args: [],
  46056. source: "collection\x0a\x09^ 'helLo'",
  46057. messageSends: [],
  46058. referencedClasses: []
  46059. }),
  46060. globals.StringTest);
  46061. smalltalk.addMethod(
  46062. smalltalk.method({
  46063. selector: "collectionFirst",
  46064. protocol: 'fixture',
  46065. fn: function (){
  46066. var self=this;
  46067. return "h";
  46068. },
  46069. args: [],
  46070. source: "collectionFirst\x0a\x09^ 'h'",
  46071. messageSends: [],
  46072. referencedClasses: []
  46073. }),
  46074. globals.StringTest);
  46075. smalltalk.addMethod(
  46076. smalltalk.method({
  46077. selector: "collectionFirstTwo",
  46078. protocol: 'fixture',
  46079. fn: function (){
  46080. var self=this;
  46081. return "he";
  46082. },
  46083. args: [],
  46084. source: "collectionFirstTwo\x0a\x09^ 'he'",
  46085. messageSends: [],
  46086. referencedClasses: []
  46087. }),
  46088. globals.StringTest);
  46089. smalltalk.addMethod(
  46090. smalltalk.method({
  46091. selector: "collectionLast",
  46092. protocol: 'fixture',
  46093. fn: function (){
  46094. var self=this;
  46095. return "o";
  46096. },
  46097. args: [],
  46098. source: "collectionLast\x0a\x09^ 'o'",
  46099. messageSends: [],
  46100. referencedClasses: []
  46101. }),
  46102. globals.StringTest);
  46103. smalltalk.addMethod(
  46104. smalltalk.method({
  46105. selector: "collectionLastTwo",
  46106. protocol: 'fixture',
  46107. fn: function (){
  46108. var self=this;
  46109. return "Lo";
  46110. },
  46111. args: [],
  46112. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  46113. messageSends: [],
  46114. referencedClasses: []
  46115. }),
  46116. globals.StringTest);
  46117. smalltalk.addMethod(
  46118. smalltalk.method({
  46119. selector: "collectionOfPrintStrings",
  46120. protocol: 'fixture',
  46121. fn: function (){
  46122. var self=this;
  46123. return "'h''e''l''L''o'";
  46124. },
  46125. args: [],
  46126. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  46127. messageSends: [],
  46128. referencedClasses: []
  46129. }),
  46130. globals.StringTest);
  46131. smalltalk.addMethod(
  46132. smalltalk.method({
  46133. selector: "collectionSize",
  46134. protocol: 'fixture',
  46135. fn: function (){
  46136. var self=this;
  46137. return (5);
  46138. },
  46139. args: [],
  46140. source: "collectionSize\x0a\x09^ 5",
  46141. messageSends: [],
  46142. referencedClasses: []
  46143. }),
  46144. globals.StringTest);
  46145. smalltalk.addMethod(
  46146. smalltalk.method({
  46147. selector: "collectionWithDuplicates",
  46148. protocol: 'fixture',
  46149. fn: function (){
  46150. var self=this;
  46151. return "abbaerte";
  46152. },
  46153. args: [],
  46154. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  46155. messageSends: [],
  46156. referencedClasses: []
  46157. }),
  46158. globals.StringTest);
  46159. smalltalk.addMethod(
  46160. smalltalk.method({
  46161. selector: "collectionWithNewValue",
  46162. protocol: 'fixture',
  46163. fn: function (){
  46164. var self=this;
  46165. return "helLoN";
  46166. },
  46167. args: [],
  46168. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  46169. messageSends: [],
  46170. referencedClasses: []
  46171. }),
  46172. globals.StringTest);
  46173. smalltalk.addMethod(
  46174. smalltalk.method({
  46175. selector: "sampleNewValueAsCollection",
  46176. protocol: 'fixture',
  46177. fn: function (){
  46178. var self=this;
  46179. return "N";
  46180. },
  46181. args: [],
  46182. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  46183. messageSends: [],
  46184. referencedClasses: []
  46185. }),
  46186. globals.StringTest);
  46187. smalltalk.addMethod(
  46188. smalltalk.method({
  46189. selector: "samplesDo:",
  46190. protocol: 'fixture',
  46191. fn: function (aBlock){
  46192. var self=this;
  46193. return smalltalk.withContext(function($ctx1) {
  46194. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  46195. $ctx1.supercall = false;
  46196. _st(aBlock)._value_value_((3),"l");
  46197. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  46198. args: ["aBlock"],
  46199. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  46200. messageSends: ["samplesDo:", "value:value:"],
  46201. referencedClasses: []
  46202. }),
  46203. globals.StringTest);
  46204. smalltalk.addMethod(
  46205. smalltalk.method({
  46206. selector: "testAddAll",
  46207. protocol: 'tests',
  46208. fn: function (){
  46209. var self=this;
  46210. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46211. return smalltalk.withContext(function($ctx1) {
  46212. var $1;
  46213. self._should_raise_((function(){
  46214. return smalltalk.withContext(function($ctx2) {
  46215. $1=self._collection();
  46216. $ctx2.sendIdx["collection"]=1;
  46217. return _st($1)._addAll_(self._collection());
  46218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46219. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  46220. args: [],
  46221. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  46222. messageSends: ["should:raise:", "addAll:", "collection"],
  46223. referencedClasses: ["Error"]
  46224. }),
  46225. globals.StringTest);
  46226. smalltalk.addMethod(
  46227. smalltalk.method({
  46228. selector: "testAddRemove",
  46229. protocol: 'tests',
  46230. fn: function (){
  46231. var self=this;
  46232. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46233. return smalltalk.withContext(function($ctx1) {
  46234. self._should_raise_((function(){
  46235. return smalltalk.withContext(function($ctx2) {
  46236. return "hello"._add_("a");
  46237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46238. $ctx1.sendIdx["should:raise:"]=1;
  46239. self._should_raise_((function(){
  46240. return smalltalk.withContext(function($ctx2) {
  46241. return "hello"._remove_("h");
  46242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  46243. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  46244. args: [],
  46245. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  46246. messageSends: ["should:raise:", "add:", "remove:"],
  46247. referencedClasses: ["Error"]
  46248. }),
  46249. globals.StringTest);
  46250. smalltalk.addMethod(
  46251. smalltalk.method({
  46252. selector: "testAsArray",
  46253. protocol: 'tests',
  46254. fn: function (){
  46255. var self=this;
  46256. return smalltalk.withContext(function($ctx1) {
  46257. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  46258. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  46259. args: [],
  46260. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  46261. messageSends: ["assert:equals:", "asArray"],
  46262. referencedClasses: []
  46263. }),
  46264. globals.StringTest);
  46265. smalltalk.addMethod(
  46266. smalltalk.method({
  46267. selector: "testAsLowerCase",
  46268. protocol: 'tests',
  46269. fn: function (){
  46270. var self=this;
  46271. return smalltalk.withContext(function($ctx1) {
  46272. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  46273. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  46274. args: [],
  46275. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  46276. messageSends: ["assert:equals:", "asLowercase"],
  46277. referencedClasses: []
  46278. }),
  46279. globals.StringTest);
  46280. smalltalk.addMethod(
  46281. smalltalk.method({
  46282. selector: "testAsNumber",
  46283. protocol: 'tests',
  46284. fn: function (){
  46285. var self=this;
  46286. return smalltalk.withContext(function($ctx1) {
  46287. var $1,$2;
  46288. $1="3"._asNumber();
  46289. $ctx1.sendIdx["asNumber"]=1;
  46290. self._assert_equals_($1,(3));
  46291. $ctx1.sendIdx["assert:equals:"]=1;
  46292. $2="-3"._asNumber();
  46293. $ctx1.sendIdx["asNumber"]=2;
  46294. self._assert_equals_($2,(-3));
  46295. $ctx1.sendIdx["assert:equals:"]=2;
  46296. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  46297. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  46298. args: [],
  46299. source: "testAsNumber\x0a\x09self assert: '3' asNumber equals: 3.\x0a\x09self assert: '-3' asNumber equals: -3.\x0a\x09self assert: '-1.5' asNumber equals: -1.5.",
  46300. messageSends: ["assert:equals:", "asNumber"],
  46301. referencedClasses: []
  46302. }),
  46303. globals.StringTest);
  46304. smalltalk.addMethod(
  46305. smalltalk.method({
  46306. selector: "testAsUpperCase",
  46307. protocol: 'tests',
  46308. fn: function (){
  46309. var self=this;
  46310. return smalltalk.withContext(function($ctx1) {
  46311. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  46312. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  46313. args: [],
  46314. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  46315. messageSends: ["assert:equals:", "asUppercase"],
  46316. referencedClasses: []
  46317. }),
  46318. globals.StringTest);
  46319. smalltalk.addMethod(
  46320. smalltalk.method({
  46321. selector: "testAsciiValue",
  46322. protocol: 'tests',
  46323. fn: function (){
  46324. var self=this;
  46325. var characterA,characterU;
  46326. return smalltalk.withContext(function($ctx1) {
  46327. var $1;
  46328. characterA="A";
  46329. characterU="U";
  46330. $1=_st(characterA)._asciiValue();
  46331. $ctx1.sendIdx["asciiValue"]=1;
  46332. self._assert_equals_($1,(65));
  46333. $ctx1.sendIdx["assert:equals:"]=1;
  46334. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  46335. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  46336. args: [],
  46337. source: "testAsciiValue\x0a | characterA characterU |\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
  46338. messageSends: ["assert:equals:", "asciiValue"],
  46339. referencedClasses: []
  46340. }),
  46341. globals.StringTest);
  46342. smalltalk.addMethod(
  46343. smalltalk.method({
  46344. selector: "testAtIfAbsentPut",
  46345. protocol: 'tests',
  46346. fn: function (){
  46347. var self=this;
  46348. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46349. return smalltalk.withContext(function($ctx1) {
  46350. self._should_raise_((function(){
  46351. return smalltalk.withContext(function($ctx2) {
  46352. return "hello"._at_ifAbsentPut_((6),(function(){
  46353. return "a";
  46354. }));
  46355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46356. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  46357. args: [],
  46358. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  46359. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  46360. referencedClasses: ["Error"]
  46361. }),
  46362. globals.StringTest);
  46363. smalltalk.addMethod(
  46364. smalltalk.method({
  46365. selector: "testAtPut",
  46366. protocol: 'tests',
  46367. fn: function (){
  46368. var self=this;
  46369. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46370. return smalltalk.withContext(function($ctx1) {
  46371. self._should_raise_((function(){
  46372. return smalltalk.withContext(function($ctx2) {
  46373. return "hello"._at_put_((1),"a");
  46374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46375. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  46376. args: [],
  46377. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  46378. messageSends: ["should:raise:", "at:put:"],
  46379. referencedClasses: ["Error"]
  46380. }),
  46381. globals.StringTest);
  46382. smalltalk.addMethod(
  46383. smalltalk.method({
  46384. selector: "testCapitalized",
  46385. protocol: 'tests',
  46386. fn: function (){
  46387. var self=this;
  46388. return smalltalk.withContext(function($ctx1) {
  46389. var $1,$2,$3;
  46390. $1="test"._capitalized();
  46391. $ctx1.sendIdx["capitalized"]=1;
  46392. self._assert_equals_($1,"Test");
  46393. $ctx1.sendIdx["assert:equals:"]=1;
  46394. $2="Test"._capitalized();
  46395. $ctx1.sendIdx["capitalized"]=2;
  46396. self._assert_equals_($2,"Test");
  46397. $ctx1.sendIdx["assert:equals:"]=2;
  46398. self._assert_equals_(""._capitalized(),"");
  46399. $ctx1.sendIdx["assert:equals:"]=3;
  46400. $3="Test"._isCapitalized();
  46401. $ctx1.sendIdx["isCapitalized"]=1;
  46402. self._assert_equals_($3,true);
  46403. $ctx1.sendIdx["assert:equals:"]=4;
  46404. self._assert_equals_("test"._isCapitalized(),false);
  46405. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  46406. args: [],
  46407. source: "testCapitalized\x0a\x09self assert: 'test' capitalized equals: 'Test'.\x0a\x09self assert: 'Test' capitalized equals: 'Test'.\x0a\x09self assert: '' capitalized equals: ''.\x0a\x09self assert: 'Test' isCapitalized equals: true.\x0a\x09self assert: 'test' isCapitalized equals: false.",
  46408. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  46409. referencedClasses: []
  46410. }),
  46411. globals.StringTest);
  46412. smalltalk.addMethod(
  46413. smalltalk.method({
  46414. selector: "testCharCodeAt",
  46415. protocol: 'tests',
  46416. fn: function (){
  46417. var self=this;
  46418. return smalltalk.withContext(function($ctx1) {
  46419. var $1,$2,$3,$4,$5;
  46420. $1="jackie"._charCodeAt_((1));
  46421. $ctx1.sendIdx["charCodeAt:"]=1;
  46422. self._assert_equals_($1,(106));
  46423. $ctx1.sendIdx["assert:equals:"]=1;
  46424. $2="jackie"._charCodeAt_((2));
  46425. $ctx1.sendIdx["charCodeAt:"]=2;
  46426. self._assert_equals_($2,(97));
  46427. $ctx1.sendIdx["assert:equals:"]=2;
  46428. $3="jackie"._charCodeAt_((3));
  46429. $ctx1.sendIdx["charCodeAt:"]=3;
  46430. self._assert_equals_($3,(99));
  46431. $ctx1.sendIdx["assert:equals:"]=3;
  46432. $4="jackie"._charCodeAt_((4));
  46433. $ctx1.sendIdx["charCodeAt:"]=4;
  46434. self._assert_equals_($4,(107));
  46435. $ctx1.sendIdx["assert:equals:"]=4;
  46436. $5="jackie"._charCodeAt_((5));
  46437. $ctx1.sendIdx["charCodeAt:"]=5;
  46438. self._assert_equals_($5,(105));
  46439. $ctx1.sendIdx["assert:equals:"]=5;
  46440. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  46441. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  46442. args: [],
  46443. source: "testCharCodeAt\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101",
  46444. messageSends: ["assert:equals:", "charCodeAt:"],
  46445. referencedClasses: []
  46446. }),
  46447. globals.StringTest);
  46448. smalltalk.addMethod(
  46449. smalltalk.method({
  46450. selector: "testCopyFromTo",
  46451. protocol: 'tests',
  46452. fn: function (){
  46453. var self=this;
  46454. return smalltalk.withContext(function($ctx1) {
  46455. var $1;
  46456. $1="jackie"._copyFrom_to_((1),(3));
  46457. $ctx1.sendIdx["copyFrom:to:"]=1;
  46458. self._assert_equals_($1,"jac");
  46459. $ctx1.sendIdx["assert:equals:"]=1;
  46460. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  46461. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  46462. args: [],
  46463. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  46464. messageSends: ["assert:equals:", "copyFrom:to:"],
  46465. referencedClasses: []
  46466. }),
  46467. globals.StringTest);
  46468. smalltalk.addMethod(
  46469. smalltalk.method({
  46470. selector: "testCopyWithoutAll",
  46471. protocol: 'tests',
  46472. fn: function (){
  46473. var self=this;
  46474. return smalltalk.withContext(function($ctx1) {
  46475. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  46476. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  46477. args: [],
  46478. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  46479. messageSends: ["assert:equals:", "copyWithoutAll:"],
  46480. referencedClasses: []
  46481. }),
  46482. globals.StringTest);
  46483. smalltalk.addMethod(
  46484. smalltalk.method({
  46485. selector: "testEquality",
  46486. protocol: 'tests',
  46487. fn: function (){
  46488. var self=this;
  46489. return smalltalk.withContext(function($ctx1) {
  46490. var $1,$2,$3;
  46491. self._assert_equals_("hello","hello");
  46492. $ctx1.sendIdx["assert:equals:"]=1;
  46493. $1="hello".__eq("world");
  46494. $ctx1.sendIdx["="]=1;
  46495. self._deny_($1);
  46496. $ctx1.sendIdx["deny:"]=1;
  46497. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  46498. })));
  46499. $ctx1.sendIdx["="]=2;
  46500. self._deny_($2);
  46501. $ctx1.sendIdx["deny:"]=2;
  46502. $3="hello"._yourself();
  46503. $ctx1.sendIdx["yourself"]=1;
  46504. self._assert_equals_("hello",$3);
  46505. $ctx1.sendIdx["assert:equals:"]=2;
  46506. self._assert_equals_("hello"._yourself(),"hello");
  46507. self._deny_("".__eq((0)));
  46508. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  46509. args: [],
  46510. source: "testEquality\x0a\x09self assert: 'hello' equals: 'hello'.\x0a\x09self deny: 'hello' = 'world'.\x0a\x09\x0a\x09\x22Test for issue 459\x22\x0a\x09self deny: 'hello' = (#() at: 1 ifAbsent: [ ]).\x0a\x0a\x09self assert: 'hello' equals: 'hello' yourself.\x0a\x09self assert: 'hello' yourself equals: 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' = 0",
  46511. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  46512. referencedClasses: []
  46513. }),
  46514. globals.StringTest);
  46515. smalltalk.addMethod(
  46516. smalltalk.method({
  46517. selector: "testIdentity",
  46518. protocol: 'tests',
  46519. fn: function (){
  46520. var self=this;
  46521. return smalltalk.withContext(function($ctx1) {
  46522. var $1,$2,$4,$3,$5;
  46523. $1="hello".__eq_eq("hello");
  46524. $ctx1.sendIdx["=="]=1;
  46525. self._assert_($1);
  46526. $ctx1.sendIdx["assert:"]=1;
  46527. $2="hello".__eq_eq("world");
  46528. $ctx1.sendIdx["=="]=2;
  46529. self._deny_($2);
  46530. $ctx1.sendIdx["deny:"]=1;
  46531. $4="hello"._yourself();
  46532. $ctx1.sendIdx["yourself"]=1;
  46533. $3="hello".__eq_eq($4);
  46534. $ctx1.sendIdx["=="]=3;
  46535. self._assert_($3);
  46536. $ctx1.sendIdx["assert:"]=2;
  46537. $5=_st("hello"._yourself()).__eq_eq("hello");
  46538. $ctx1.sendIdx["=="]=4;
  46539. self._assert_($5);
  46540. self._deny_("".__eq_eq((0)));
  46541. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  46542. args: [],
  46543. source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
  46544. messageSends: ["assert:", "==", "deny:", "yourself"],
  46545. referencedClasses: []
  46546. }),
  46547. globals.StringTest);
  46548. smalltalk.addMethod(
  46549. smalltalk.method({
  46550. selector: "testIdentityHash",
  46551. protocol: 'tests',
  46552. fn: function (){
  46553. var self=this;
  46554. return smalltalk.withContext(function($ctx1) {
  46555. var $1,$2,$4,$3;
  46556. $1="foo"._identityHash();
  46557. $ctx1.sendIdx["identityHash"]=1;
  46558. $2="foo"._identityHash();
  46559. $ctx1.sendIdx["identityHash"]=2;
  46560. self._assert_equals_($1,$2);
  46561. $4="foo"._identityHash();
  46562. $ctx1.sendIdx["identityHash"]=3;
  46563. $3=_st($4).__eq("bar"._identityHash());
  46564. self._deny_($3);
  46565. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  46566. args: [],
  46567. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  46568. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  46569. referencedClasses: []
  46570. }),
  46571. globals.StringTest);
  46572. smalltalk.addMethod(
  46573. smalltalk.method({
  46574. selector: "testIncludesSubString",
  46575. protocol: 'tests',
  46576. fn: function (){
  46577. var self=this;
  46578. return smalltalk.withContext(function($ctx1) {
  46579. var $1;
  46580. $1="amber"._includesSubString_("ber");
  46581. $ctx1.sendIdx["includesSubString:"]=1;
  46582. self._assert_($1);
  46583. self._deny_("amber"._includesSubString_("zork"));
  46584. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  46585. args: [],
  46586. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  46587. messageSends: ["assert:", "includesSubString:", "deny:"],
  46588. referencedClasses: []
  46589. }),
  46590. globals.StringTest);
  46591. smalltalk.addMethod(
  46592. smalltalk.method({
  46593. selector: "testIndexOfStartingAtWithNull",
  46594. protocol: 'tests',
  46595. fn: function (){
  46596. var self=this;
  46597. return self},
  46598. args: [],
  46599. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  46600. messageSends: [],
  46601. referencedClasses: []
  46602. }),
  46603. globals.StringTest);
  46604. smalltalk.addMethod(
  46605. smalltalk.method({
  46606. selector: "testIndexOfWithNull",
  46607. protocol: 'tests',
  46608. fn: function (){
  46609. var self=this;
  46610. return self},
  46611. args: [],
  46612. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  46613. messageSends: [],
  46614. referencedClasses: []
  46615. }),
  46616. globals.StringTest);
  46617. smalltalk.addMethod(
  46618. smalltalk.method({
  46619. selector: "testIsVowel",
  46620. protocol: 'tests',
  46621. fn: function (){
  46622. var self=this;
  46623. var vowel,consonant;
  46624. return smalltalk.withContext(function($ctx1) {
  46625. var $1;
  46626. vowel="u";
  46627. consonant="z";
  46628. $1=_st(vowel)._isVowel();
  46629. $ctx1.sendIdx["isVowel"]=1;
  46630. self._assert_equals_($1,true);
  46631. $ctx1.sendIdx["assert:equals:"]=1;
  46632. self._assert_equals_(_st(consonant)._isVowel(),false);
  46633. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  46634. args: [],
  46635. source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
  46636. messageSends: ["assert:equals:", "isVowel"],
  46637. referencedClasses: []
  46638. }),
  46639. globals.StringTest);
  46640. smalltalk.addMethod(
  46641. smalltalk.method({
  46642. selector: "testJoin",
  46643. protocol: 'tests',
  46644. fn: function (){
  46645. var self=this;
  46646. return smalltalk.withContext(function($ctx1) {
  46647. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  46648. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  46649. args: [],
  46650. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  46651. messageSends: ["assert:equals:", "join:"],
  46652. referencedClasses: []
  46653. }),
  46654. globals.StringTest);
  46655. smalltalk.addMethod(
  46656. smalltalk.method({
  46657. selector: "testRemoveAll",
  46658. protocol: 'tests',
  46659. fn: function (){
  46660. var self=this;
  46661. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46662. return smalltalk.withContext(function($ctx1) {
  46663. self._should_raise_((function(){
  46664. return smalltalk.withContext(function($ctx2) {
  46665. return _st(self._collection())._removeAll();
  46666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46667. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  46668. args: [],
  46669. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  46670. messageSends: ["should:raise:", "removeAll", "collection"],
  46671. referencedClasses: ["Error"]
  46672. }),
  46673. globals.StringTest);
  46674. smalltalk.addMethod(
  46675. smalltalk.method({
  46676. selector: "testReversed",
  46677. protocol: 'tests',
  46678. fn: function (){
  46679. var self=this;
  46680. return smalltalk.withContext(function($ctx1) {
  46681. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  46682. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  46683. args: [],
  46684. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  46685. messageSends: ["assert:equals:", "reversed"],
  46686. referencedClasses: []
  46687. }),
  46688. globals.StringTest);
  46689. smalltalk.addMethod(
  46690. smalltalk.method({
  46691. selector: "testStreamContents",
  46692. protocol: 'tests',
  46693. fn: function (){
  46694. var self=this;
  46695. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  46696. return smalltalk.withContext(function($ctx1) {
  46697. var $1;
  46698. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  46699. return smalltalk.withContext(function($ctx2) {
  46700. _st(aStream)._nextPutAll_("hello");
  46701. $ctx2.sendIdx["nextPutAll:"]=1;
  46702. _st(aStream)._space();
  46703. $1=_st(aStream)._nextPutAll_("world");
  46704. return $1;
  46705. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  46706. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  46707. args: [],
  46708. source: "testStreamContents\x0a\x09self\x0a\x09\x09assert: (String streamContents: [ :aStream |\x0a\x09\x09\x09aStream\x0a\x09\x09\x09\x09nextPutAll: 'hello'; space;\x0a\x09\x09\x09\x09nextPutAll: 'world' ])\x0a\x09\x09equals: 'hello world'",
  46709. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  46710. referencedClasses: ["String"]
  46711. }),
  46712. globals.StringTest);
  46713. smalltalk.addMethod(
  46714. smalltalk.method({
  46715. selector: "testSubStrings",
  46716. protocol: 'tests',
  46717. fn: function (){
  46718. var self=this;
  46719. return smalltalk.withContext(function($ctx1) {
  46720. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  46721. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  46722. args: [],
  46723. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  46724. messageSends: ["assert:equals:", "subStrings:"],
  46725. referencedClasses: []
  46726. }),
  46727. globals.StringTest);
  46728. smalltalk.addMethod(
  46729. smalltalk.method({
  46730. selector: "testTrim",
  46731. protocol: 'tests',
  46732. fn: function (){
  46733. var self=this;
  46734. return smalltalk.withContext(function($ctx1) {
  46735. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  46736. $ctx1.sendIdx["assert:equals:"]=1;
  46737. self._assert_equals_("jackie "._trimRight(),"jackie");
  46738. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  46739. args: [],
  46740. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  46741. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  46742. referencedClasses: []
  46743. }),
  46744. globals.StringTest);
  46745. smalltalk.addMethod(
  46746. smalltalk.method({
  46747. selector: "testValue",
  46748. protocol: 'tests',
  46749. fn: function (){
  46750. var self=this;
  46751. return smalltalk.withContext(function($ctx1) {
  46752. self._assert_equals_("asString"._value_((1)),"1");
  46753. $ctx1.sendIdx["assert:equals:"]=1;
  46754. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  46755. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  46756. args: [],
  46757. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  46758. messageSends: ["assert:equals:", "value:", "collect:"],
  46759. referencedClasses: []
  46760. }),
  46761. globals.StringTest);
  46762. smalltalk.addMethod(
  46763. smalltalk.method({
  46764. selector: "collectionClass",
  46765. protocol: 'fixture',
  46766. fn: function (){
  46767. var self=this;
  46768. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  46769. return $String();
  46770. },
  46771. args: [],
  46772. source: "collectionClass\x0a\x09^ String",
  46773. messageSends: [],
  46774. referencedClasses: ["String"]
  46775. }),
  46776. globals.StringTest.klass);
  46777. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  46778. smalltalk.addMethod(
  46779. smalltalk.method({
  46780. selector: "collection",
  46781. protocol: 'fixture',
  46782. fn: function (){
  46783. var self=this;
  46784. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  46785. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46786. return smalltalk.withContext(function($ctx1) {
  46787. var $2,$3,$1;
  46788. $2=_st($Set())._new();
  46789. _st($2)._add_($Smalltalk());
  46790. $ctx1.sendIdx["add:"]=1;
  46791. _st($2)._add_(nil);
  46792. $ctx1.sendIdx["add:"]=2;
  46793. _st($2)._add_((3).__at((3)));
  46794. $ctx1.sendIdx["add:"]=3;
  46795. _st($2)._add_(false);
  46796. $3=_st($2)._yourself();
  46797. $1=$3;
  46798. return $1;
  46799. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  46800. args: [],
  46801. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  46802. messageSends: ["add:", "new", "@", "yourself"],
  46803. referencedClasses: ["Set", "Smalltalk"]
  46804. }),
  46805. globals.SetTest);
  46806. smalltalk.addMethod(
  46807. smalltalk.method({
  46808. selector: "collectionOfPrintStrings",
  46809. protocol: 'fixture',
  46810. fn: function (){
  46811. var self=this;
  46812. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  46813. return smalltalk.withContext(function($ctx1) {
  46814. var $2,$3,$1;
  46815. $2=_st($Set())._new();
  46816. _st($2)._add_("a SmalltalkImage");
  46817. $ctx1.sendIdx["add:"]=1;
  46818. _st($2)._add_("nil");
  46819. $ctx1.sendIdx["add:"]=2;
  46820. _st($2)._add_("3@3");
  46821. $ctx1.sendIdx["add:"]=3;
  46822. _st($2)._add_("false");
  46823. $3=_st($2)._yourself();
  46824. $1=$3;
  46825. return $1;
  46826. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  46827. args: [],
  46828. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  46829. messageSends: ["add:", "new", "yourself"],
  46830. referencedClasses: ["Set"]
  46831. }),
  46832. globals.SetTest);
  46833. smalltalk.addMethod(
  46834. smalltalk.method({
  46835. selector: "collectionSize",
  46836. protocol: 'fixture',
  46837. fn: function (){
  46838. var self=this;
  46839. return (4);
  46840. },
  46841. args: [],
  46842. source: "collectionSize\x0a\x09^ 4",
  46843. messageSends: [],
  46844. referencedClasses: []
  46845. }),
  46846. globals.SetTest);
  46847. smalltalk.addMethod(
  46848. smalltalk.method({
  46849. selector: "collectionWithDuplicates",
  46850. protocol: 'fixture',
  46851. fn: function (){
  46852. var self=this;
  46853. return smalltalk.withContext(function($ctx1) {
  46854. var $2,$3,$1;
  46855. $2=self._collection();
  46856. _st($2)._add_((0));
  46857. $3=_st($2)._yourself();
  46858. $1=$3;
  46859. return $1;
  46860. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  46861. args: [],
  46862. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  46863. messageSends: ["add:", "collection", "yourself"],
  46864. referencedClasses: []
  46865. }),
  46866. globals.SetTest);
  46867. smalltalk.addMethod(
  46868. smalltalk.method({
  46869. selector: "collectionWithNewValue",
  46870. protocol: 'fixture',
  46871. fn: function (){
  46872. var self=this;
  46873. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  46874. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  46875. return smalltalk.withContext(function($ctx1) {
  46876. var $2,$3,$1;
  46877. $2=_st($Set())._new();
  46878. _st($2)._add_($Smalltalk());
  46879. $ctx1.sendIdx["add:"]=1;
  46880. _st($2)._add_(nil);
  46881. $ctx1.sendIdx["add:"]=2;
  46882. _st($2)._add_((3).__at((3)));
  46883. $ctx1.sendIdx["add:"]=3;
  46884. _st($2)._add_("N");
  46885. $ctx1.sendIdx["add:"]=4;
  46886. _st($2)._add_(false);
  46887. $3=_st($2)._yourself();
  46888. $1=$3;
  46889. return $1;
  46890. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  46891. args: [],
  46892. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  46893. messageSends: ["add:", "new", "@", "yourself"],
  46894. referencedClasses: ["Set", "Smalltalk"]
  46895. }),
  46896. globals.SetTest);
  46897. smalltalk.addMethod(
  46898. smalltalk.method({
  46899. selector: "testAddAll",
  46900. protocol: 'tests',
  46901. fn: function (){
  46902. var self=this;
  46903. return smalltalk.withContext(function($ctx1) {
  46904. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  46905. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  46906. $ctx1.supercall = false;
  46907. $2=self._collection();
  46908. $ctx1.sendIdx["collection"]=1;
  46909. $3=$2;
  46910. $4=self._collection();
  46911. $ctx1.sendIdx["collection"]=2;
  46912. _st($3)._addAll_($4);
  46913. $ctx1.sendIdx["addAll:"]=1;
  46914. $5=_st($2)._yourself();
  46915. $ctx1.sendIdx["yourself"]=1;
  46916. $1=$5;
  46917. $6=self._collection();
  46918. $ctx1.sendIdx["collection"]=3;
  46919. self._assert_equals_($1,$6);
  46920. $ctx1.sendIdx["assert:equals:"]=1;
  46921. $8=self._collection();
  46922. $ctx1.sendIdx["collection"]=4;
  46923. $9=$8;
  46924. $10=self._collectionWithNewValue();
  46925. $ctx1.sendIdx["collectionWithNewValue"]=1;
  46926. _st($9)._addAll_($10);
  46927. $ctx1.sendIdx["addAll:"]=2;
  46928. $11=_st($8)._yourself();
  46929. $ctx1.sendIdx["yourself"]=2;
  46930. $7=$11;
  46931. $12=self._collectionWithNewValue();
  46932. $ctx1.sendIdx["collectionWithNewValue"]=2;
  46933. self._assert_equals_($7,$12);
  46934. $ctx1.sendIdx["assert:equals:"]=2;
  46935. $14=self._collectionWithNewValue();
  46936. $ctx1.sendIdx["collectionWithNewValue"]=3;
  46937. _st($14)._addAll_(self._collection());
  46938. $15=_st($14)._yourself();
  46939. $13=$15;
  46940. self._assert_equals_($13,self._collectionWithNewValue());
  46941. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  46942. args: [],
  46943. source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
  46944. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  46945. referencedClasses: []
  46946. }),
  46947. globals.SetTest);
  46948. smalltalk.addMethod(
  46949. smalltalk.method({
  46950. selector: "testAddRemove",
  46951. protocol: 'tests',
  46952. fn: function (){
  46953. var self=this;
  46954. var set;
  46955. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  46956. return smalltalk.withContext(function($ctx1) {
  46957. var $1,$2;
  46958. set=_st($Set())._new();
  46959. self._assert_(_st(set)._isEmpty());
  46960. $ctx1.sendIdx["assert:"]=1;
  46961. _st(set)._add_((3));
  46962. $ctx1.sendIdx["add:"]=1;
  46963. $1=_st(set)._includes_((3));
  46964. $ctx1.sendIdx["includes:"]=1;
  46965. self._assert_($1);
  46966. $ctx1.sendIdx["assert:"]=2;
  46967. _st(set)._add_((5));
  46968. $2=_st(set)._includes_((5));
  46969. $ctx1.sendIdx["includes:"]=2;
  46970. self._assert_($2);
  46971. _st(set)._remove_((3));
  46972. self._deny_(_st(set)._includes_((3)));
  46973. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  46974. args: [],
  46975. source: "testAddRemove\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09\x0a\x09self assert: set isEmpty.\x0a\x0a\x09set add: 3.\x0a\x09self assert: (set includes: 3).\x0a\x0a\x09set add: 5.\x0a\x09self assert: (set includes: 5).\x0a\x0a\x09set remove: 3.\x0a\x09self deny: (set includes: 3)",
  46976. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  46977. referencedClasses: ["Set"]
  46978. }),
  46979. globals.SetTest);
  46980. smalltalk.addMethod(
  46981. smalltalk.method({
  46982. selector: "testAt",
  46983. protocol: 'tests',
  46984. fn: function (){
  46985. var self=this;
  46986. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  46987. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  46988. return smalltalk.withContext(function($ctx1) {
  46989. self._should_raise_((function(){
  46990. return smalltalk.withContext(function($ctx2) {
  46991. return _st(_st($Set())._new())._at_put_((1),(2));
  46992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  46993. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  46994. args: [],
  46995. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  46996. messageSends: ["should:raise:", "at:put:", "new"],
  46997. referencedClasses: ["Set", "Error"]
  46998. }),
  46999. globals.SetTest);
  47000. smalltalk.addMethod(
  47001. smalltalk.method({
  47002. selector: "testCollect",
  47003. protocol: 'tests',
  47004. fn: function (){
  47005. var self=this;
  47006. return smalltalk.withContext(function($ctx1) {
  47007. var $2,$1;
  47008. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  47009. $ctx1.supercall = false;
  47010. $2=[(5), (6), (8)]._asSet();
  47011. $ctx1.sendIdx["asSet"]=1;
  47012. $1=_st($2)._collect_((function(x){
  47013. return smalltalk.withContext(function($ctx2) {
  47014. return _st(x).__backslash_backslash((3));
  47015. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  47016. self._assert_equals_($1,[(0), (2)]._asSet());
  47017. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  47018. args: [],
  47019. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  47020. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  47021. referencedClasses: []
  47022. }),
  47023. globals.SetTest);
  47024. smalltalk.addMethod(
  47025. smalltalk.method({
  47026. selector: "testComma",
  47027. protocol: 'tests',
  47028. fn: function (){
  47029. var self=this;
  47030. return smalltalk.withContext(function($ctx1) {
  47031. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  47032. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  47033. $ctx1.supercall = false;
  47034. $2=self._collection();
  47035. $ctx1.sendIdx["collection"]=1;
  47036. $3=self._collection();
  47037. $ctx1.sendIdx["collection"]=2;
  47038. $1=_st($2).__comma($3);
  47039. $ctx1.sendIdx[","]=1;
  47040. $4=self._collection();
  47041. $ctx1.sendIdx["collection"]=3;
  47042. self._assert_equals_($1,$4);
  47043. $ctx1.sendIdx["assert:equals:"]=1;
  47044. $6=self._collection();
  47045. $ctx1.sendIdx["collection"]=4;
  47046. $7=self._collectionWithNewValue();
  47047. $ctx1.sendIdx["collectionWithNewValue"]=1;
  47048. $5=_st($6).__comma($7);
  47049. $ctx1.sendIdx[","]=2;
  47050. $8=self._collectionWithNewValue();
  47051. $ctx1.sendIdx["collectionWithNewValue"]=2;
  47052. self._assert_equals_($5,$8);
  47053. $ctx1.sendIdx["assert:equals:"]=2;
  47054. $10=self._collectionWithNewValue();
  47055. $ctx1.sendIdx["collectionWithNewValue"]=3;
  47056. $9=_st($10).__comma(self._collection());
  47057. self._assert_equals_($9,self._collectionWithNewValue());
  47058. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  47059. args: [],
  47060. source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
  47061. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  47062. referencedClasses: []
  47063. }),
  47064. globals.SetTest);
  47065. smalltalk.addMethod(
  47066. smalltalk.method({
  47067. selector: "testComparing",
  47068. protocol: 'tests',
  47069. fn: function (){
  47070. var self=this;
  47071. return smalltalk.withContext(function($ctx1) {
  47072. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  47073. $1=[(0), (2)]._asSet();
  47074. $ctx1.sendIdx["asSet"]=1;
  47075. $2=[(0), (2)]._asSet();
  47076. $ctx1.sendIdx["asSet"]=2;
  47077. self._assert_equals_($1,$2);
  47078. $ctx1.sendIdx["assert:equals:"]=1;
  47079. $3=[(2), (0)]._asSet();
  47080. $ctx1.sendIdx["asSet"]=3;
  47081. $4=[(0), (2)]._asSet();
  47082. $ctx1.sendIdx["asSet"]=4;
  47083. self._assert_equals_($3,$4);
  47084. $6=[(0), (2), (3)]._asSet();
  47085. $ctx1.sendIdx["asSet"]=5;
  47086. $7=[(0), (2)]._asSet();
  47087. $ctx1.sendIdx["asSet"]=6;
  47088. $5=_st($6).__eq($7);
  47089. $ctx1.sendIdx["="]=1;
  47090. self._deny_($5);
  47091. $ctx1.sendIdx["deny:"]=1;
  47092. $9=[(1), (2)]._asSet();
  47093. $ctx1.sendIdx["asSet"]=7;
  47094. $8=_st($9).__eq([(0), (2)]._asSet());
  47095. self._deny_($8);
  47096. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  47097. args: [],
  47098. source: "testComparing\x0a\x09self assert: #(0 2) asSet equals: #(0 2) asSet.\x0a\x09self assert: #(2 0) asSet equals: #(0 2) asSet.\x0a\x09self deny: #(0 2 3) asSet = #(0 2) asSet.\x0a\x09self deny: #(1 2) asSet = #(0 2) asSet",
  47099. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  47100. referencedClasses: []
  47101. }),
  47102. globals.SetTest);
  47103. smalltalk.addMethod(
  47104. smalltalk.method({
  47105. selector: "testPrintString",
  47106. protocol: 'tests',
  47107. fn: function (){
  47108. var self=this;
  47109. var set;
  47110. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  47111. return smalltalk.withContext(function($ctx1) {
  47112. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  47113. set=_st($Set())._new();
  47114. $1=_st(set)._printString();
  47115. $ctx1.sendIdx["printString"]=1;
  47116. self._assert_equals_($1,"a Set ()");
  47117. $ctx1.sendIdx["assert:equals:"]=1;
  47118. $2=set;
  47119. _st($2)._add_((1));
  47120. $ctx1.sendIdx["add:"]=1;
  47121. $3=_st($2)._add_((3));
  47122. $ctx1.sendIdx["add:"]=2;
  47123. $4=_st(set)._printString();
  47124. $ctx1.sendIdx["printString"]=2;
  47125. self._assert_equals_($4,"a Set (1 3)");
  47126. $ctx1.sendIdx["assert:equals:"]=2;
  47127. _st(set)._add_("foo");
  47128. $ctx1.sendIdx["add:"]=3;
  47129. $5=_st(set)._printString();
  47130. $ctx1.sendIdx["printString"]=3;
  47131. self._assert_equals_($5,"a Set (1 3 'foo')");
  47132. $ctx1.sendIdx["assert:equals:"]=3;
  47133. $6=set;
  47134. _st($6)._remove_((1));
  47135. $ctx1.sendIdx["remove:"]=1;
  47136. $7=_st($6)._remove_((3));
  47137. $8=_st(set)._printString();
  47138. $ctx1.sendIdx["printString"]=4;
  47139. self._assert_equals_($8,"a Set ('foo')");
  47140. $ctx1.sendIdx["assert:equals:"]=4;
  47141. _st(set)._add_((3));
  47142. $ctx1.sendIdx["add:"]=4;
  47143. $9=_st(set)._printString();
  47144. $ctx1.sendIdx["printString"]=5;
  47145. self._assert_equals_($9,"a Set (3 'foo')");
  47146. $ctx1.sendIdx["assert:equals:"]=5;
  47147. _st(set)._add_((3));
  47148. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  47149. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  47150. args: [],
  47151. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  47152. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  47153. referencedClasses: ["Set"]
  47154. }),
  47155. globals.SetTest);
  47156. smalltalk.addMethod(
  47157. smalltalk.method({
  47158. selector: "testUnboxedObjects",
  47159. protocol: 'tests',
  47160. fn: function (){
  47161. var self=this;
  47162. return smalltalk.withContext(function($ctx1) {
  47163. var $4,$3,$2,$1;
  47164. $4="foo"._yourself();
  47165. $ctx1.sendIdx["yourself"]=1;
  47166. $3=[$4,"foo"._yourself()];
  47167. $2=_st($3)._asSet();
  47168. $1=_st($2)._asArray();
  47169. self._assert_equals_($1,["foo"]);
  47170. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  47171. args: [],
  47172. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  47173. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  47174. referencedClasses: []
  47175. }),
  47176. globals.SetTest);
  47177. smalltalk.addMethod(
  47178. smalltalk.method({
  47179. selector: "testUnicity",
  47180. protocol: 'tests',
  47181. fn: function (){
  47182. var self=this;
  47183. var set;
  47184. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  47185. return smalltalk.withContext(function($ctx1) {
  47186. var $1;
  47187. set=_st($Set())._new();
  47188. _st(set)._add_((21));
  47189. $ctx1.sendIdx["add:"]=1;
  47190. _st(set)._add_("hello");
  47191. $ctx1.sendIdx["add:"]=2;
  47192. _st(set)._add_((21));
  47193. $ctx1.sendIdx["add:"]=3;
  47194. $1=_st(set)._size();
  47195. $ctx1.sendIdx["size"]=1;
  47196. self._assert_equals_($1,(2));
  47197. $ctx1.sendIdx["assert:equals:"]=1;
  47198. _st(set)._add_("hello");
  47199. self._assert_equals_(_st(set)._size(),(2));
  47200. $ctx1.sendIdx["assert:equals:"]=2;
  47201. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  47202. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  47203. args: [],
  47204. source: "testUnicity\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09set add: 21.\x0a\x09set add: 'hello'.\x0a\x0a\x09set add: 21.\x0a\x09self assert: set size equals: 2.\x0a\x09\x0a\x09set add: 'hello'.\x0a\x09self assert: set size equals: 2.\x0a\x0a\x09self assert: set asArray equals: #(21 'hello')",
  47205. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  47206. referencedClasses: ["Set"]
  47207. }),
  47208. globals.SetTest);
  47209. smalltalk.addMethod(
  47210. smalltalk.method({
  47211. selector: "collectionClass",
  47212. protocol: 'fixture',
  47213. fn: function (){
  47214. var self=this;
  47215. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  47216. return $Set();
  47217. },
  47218. args: [],
  47219. source: "collectionClass\x0a\x09^ Set",
  47220. messageSends: [],
  47221. referencedClasses: ["Set"]
  47222. }),
  47223. globals.SetTest.klass);
  47224. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  47225. smalltalk.addMethod(
  47226. smalltalk.method({
  47227. selector: "testShow",
  47228. protocol: 'tests',
  47229. fn: function (){
  47230. var self=this;
  47231. var originalTranscript;
  47232. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  47233. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  47234. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  47235. return smalltalk.withContext(function($ctx1) {
  47236. originalTranscript=_st($Transcript())._current();
  47237. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  47238. $ctx1.sendIdx["register:"]=1;
  47239. self._shouldnt_raise_((function(){
  47240. return smalltalk.withContext(function($ctx2) {
  47241. return _st($Transcript())._show_("Hello console!");
  47242. $ctx2.sendIdx["show:"]=1;
  47243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  47244. $ctx1.sendIdx["shouldnt:raise:"]=1;
  47245. self._shouldnt_raise_((function(){
  47246. return smalltalk.withContext(function($ctx2) {
  47247. return _st($Transcript())._show_(console);
  47248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  47249. _st($Transcript())._register_(originalTranscript);
  47250. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  47251. args: [],
  47252. source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
  47253. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  47254. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  47255. }),
  47256. globals.ConsoleTranscriptTest);
  47257. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  47258. smalltalk.addMethod(
  47259. smalltalk.method({
  47260. selector: "jsNull",
  47261. protocol: 'accessing',
  47262. fn: function (){
  47263. var self=this;
  47264. return smalltalk.withContext(function($ctx1) {
  47265. return null;
  47266. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  47267. args: [],
  47268. source: "jsNull\x0a\x09<return null>",
  47269. messageSends: [],
  47270. referencedClasses: []
  47271. }),
  47272. globals.JSObjectProxyTest);
  47273. smalltalk.addMethod(
  47274. smalltalk.method({
  47275. selector: "jsObject",
  47276. protocol: 'accessing',
  47277. fn: function (){
  47278. var self=this;
  47279. return smalltalk.withContext(function($ctx1) {
  47280. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  47281. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  47282. args: [],
  47283. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  47284. messageSends: [],
  47285. referencedClasses: []
  47286. }),
  47287. globals.JSObjectProxyTest);
  47288. smalltalk.addMethod(
  47289. smalltalk.method({
  47290. selector: "jsUndefined",
  47291. protocol: 'accessing',
  47292. fn: function (){
  47293. var self=this;
  47294. return smalltalk.withContext(function($ctx1) {
  47295. return;
  47296. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  47297. args: [],
  47298. source: "jsUndefined\x0a\x09<return>",
  47299. messageSends: [],
  47300. referencedClasses: []
  47301. }),
  47302. globals.JSObjectProxyTest);
  47303. smalltalk.addMethod(
  47304. smalltalk.method({
  47305. selector: "testAtIfAbsent",
  47306. protocol: 'tests',
  47307. fn: function (){
  47308. var self=this;
  47309. var testObject;
  47310. return smalltalk.withContext(function($ctx1) {
  47311. var $1,$2,$3;
  47312. testObject=self._jsObject();
  47313. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  47314. return "Property does not exist";
  47315. }));
  47316. $ctx1.sendIdx["at:ifAbsent:"]=1;
  47317. self._assert_equals_($1,"Property does not exist");
  47318. $ctx1.sendIdx["assert:equals:"]=1;
  47319. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  47320. return "Property does not exist";
  47321. }));
  47322. $ctx1.sendIdx["at:ifAbsent:"]=2;
  47323. self._assert_equals_($2,nil);
  47324. $ctx1.sendIdx["assert:equals:"]=2;
  47325. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  47326. return "Property does not exist";
  47327. }));
  47328. $ctx1.sendIdx["at:ifAbsent:"]=3;
  47329. self._assert_equals_($3,(1));
  47330. $ctx1.sendIdx["assert:equals:"]=3;
  47331. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  47332. return "Property does not exist";
  47333. })),nil);
  47334. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  47335. args: [],
  47336. source: "testAtIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifAbsent: [ 'Property does not exist' ]) equals: 'Property does not exist'.\x0a\x09self assert: (testObject at: 'e' ifAbsent: [ 'Property does not exist' ]) equals: nil.\x0a\x09self assert: (testObject at: 'a' ifAbsent: [ 'Property does not exist' ]) equals: 1.\x0a\x09self assert: (testObject at: 'f' ifAbsent: [ 'Property does not exist' ]) equals: nil.",
  47337. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  47338. referencedClasses: []
  47339. }),
  47340. globals.JSObjectProxyTest);
  47341. smalltalk.addMethod(
  47342. smalltalk.method({
  47343. selector: "testAtIfPresent",
  47344. protocol: 'tests',
  47345. fn: function (){
  47346. var self=this;
  47347. var testObject;
  47348. return smalltalk.withContext(function($ctx1) {
  47349. var $2,$1,$4,$3,$6,$5;
  47350. testObject=self._jsObject();
  47351. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  47352. return smalltalk.withContext(function($ctx2) {
  47353. $2=_st(x)._asString();
  47354. $ctx2.sendIdx["asString"]=1;
  47355. return "hello ".__comma($2);
  47356. $ctx2.sendIdx[","]=1;
  47357. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  47358. $ctx1.sendIdx["at:ifPresent:"]=1;
  47359. self._assert_equals_($1,nil);
  47360. $ctx1.sendIdx["assert:equals:"]=1;
  47361. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  47362. return smalltalk.withContext(function($ctx2) {
  47363. $4=_st(x)._asString();
  47364. $ctx2.sendIdx["asString"]=2;
  47365. return "hello ".__comma($4);
  47366. $ctx2.sendIdx[","]=2;
  47367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  47368. $ctx1.sendIdx["at:ifPresent:"]=2;
  47369. self._assert_equals_($3,"hello nil");
  47370. $ctx1.sendIdx["assert:equals:"]=2;
  47371. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  47372. return smalltalk.withContext(function($ctx2) {
  47373. $6=_st(x)._asString();
  47374. $ctx2.sendIdx["asString"]=3;
  47375. return "hello ".__comma($6);
  47376. $ctx2.sendIdx[","]=3;
  47377. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  47378. $ctx1.sendIdx["at:ifPresent:"]=3;
  47379. self._assert_equals_($5,"hello 1");
  47380. $ctx1.sendIdx["assert:equals:"]=3;
  47381. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  47382. return smalltalk.withContext(function($ctx2) {
  47383. return "hello ".__comma(_st(x)._asString());
  47384. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  47385. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  47386. args: [],
  47387. source: "testAtIfPresent\x0a\x09| testObject |\x0a\x09\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x | 'hello ',x asString ]) equals: nil.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x | 'hello ',x asString ]) equals: 'hello nil'.",
  47388. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  47389. referencedClasses: []
  47390. }),
  47391. globals.JSObjectProxyTest);
  47392. smalltalk.addMethod(
  47393. smalltalk.method({
  47394. selector: "testAtIfPresentIfAbsent",
  47395. protocol: 'tests',
  47396. fn: function (){
  47397. var self=this;
  47398. var testObject;
  47399. return smalltalk.withContext(function($ctx1) {
  47400. var $2,$1,$4,$3,$6,$5;
  47401. testObject=self._jsObject();
  47402. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  47403. return smalltalk.withContext(function($ctx2) {
  47404. $2=_st(x)._asString();
  47405. $ctx2.sendIdx["asString"]=1;
  47406. return "hello ".__comma($2);
  47407. $ctx2.sendIdx[","]=1;
  47408. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  47409. return "not present";
  47410. }));
  47411. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  47412. self._assert_equals_($1,"not present");
  47413. $ctx1.sendIdx["assert:equals:"]=1;
  47414. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  47415. return smalltalk.withContext(function($ctx2) {
  47416. $4=_st(x)._asString();
  47417. $ctx2.sendIdx["asString"]=2;
  47418. return "hello ".__comma($4);
  47419. $ctx2.sendIdx[","]=2;
  47420. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  47421. return "not present";
  47422. }));
  47423. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  47424. self._assert_equals_($3,"hello nil");
  47425. $ctx1.sendIdx["assert:equals:"]=2;
  47426. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  47427. return smalltalk.withContext(function($ctx2) {
  47428. $6=_st(x)._asString();
  47429. $ctx2.sendIdx["asString"]=3;
  47430. return "hello ".__comma($6);
  47431. $ctx2.sendIdx[","]=3;
  47432. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  47433. return "not present";
  47434. }));
  47435. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  47436. self._assert_equals_($5,"hello 1");
  47437. $ctx1.sendIdx["assert:equals:"]=3;
  47438. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  47439. return smalltalk.withContext(function($ctx2) {
  47440. return "hello ".__comma(_st(x)._asString());
  47441. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  47442. return "not present";
  47443. })),"hello nil");
  47444. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  47445. args: [],
  47446. source: "testAtIfPresentIfAbsent\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09self assert: (testObject at: 'abc' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'not present'.\x0a\x09self assert: (testObject at: 'e' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.\x0a\x09self assert: (testObject at: 'a' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello 1'.\x0a\x09self assert: (testObject at: 'f' ifPresent: [ :x|'hello ',x asString ] ifAbsent: [ 'not present' ]) equals: 'hello nil'.",
  47447. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  47448. referencedClasses: []
  47449. }),
  47450. globals.JSObjectProxyTest);
  47451. smalltalk.addMethod(
  47452. smalltalk.method({
  47453. selector: "testAtPut",
  47454. protocol: 'tests',
  47455. fn: function (){
  47456. var self=this;
  47457. var testObject;
  47458. return smalltalk.withContext(function($ctx1) {
  47459. var $2,$1;
  47460. testObject=self._jsObject();
  47461. $2=_st(testObject)._at_("abc");
  47462. $ctx1.sendIdx["at:"]=1;
  47463. $1=_st($2).__tild_eq("xyz");
  47464. self._assert_($1);
  47465. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  47466. $ctx1.sendIdx["assert:equals:"]=1;
  47467. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  47468. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  47469. args: [],
  47470. source: "testAtPut\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09\x0a\x09self assert: (testObject at: 'abc') ~= 'xyz'.\x0a\x09self assert: (testObject at: 'abc' put: 'xyz') equals: 'xyz'.\x0a\x09self assert: (testObject at: 'abc') equals: 'xyz'",
  47471. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  47472. referencedClasses: []
  47473. }),
  47474. globals.JSObjectProxyTest);
  47475. smalltalk.addMethod(
  47476. smalltalk.method({
  47477. selector: "testComparison",
  47478. protocol: 'tests',
  47479. fn: function (){
  47480. var self=this;
  47481. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  47482. return smalltalk.withContext(function($ctx1) {
  47483. var $1,$2;
  47484. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  47485. $1=_st(console).__eq(console);
  47486. $ctx1.sendIdx["="]=1;
  47487. self._assert_($1);
  47488. $2=_st(console).__eq(_st($Object())._new());
  47489. $ctx1.sendIdx["="]=2;
  47490. self._deny_($2);
  47491. $ctx1.sendIdx["deny:"]=1;
  47492. self._deny_(_st(console).__eq(self._jsObject()));
  47493. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  47494. args: [],
  47495. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  47496. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  47497. referencedClasses: ["Object"]
  47498. }),
  47499. globals.JSObjectProxyTest);
  47500. smalltalk.addMethod(
  47501. smalltalk.method({
  47502. selector: "testDNU",
  47503. protocol: 'tests',
  47504. fn: function (){
  47505. var self=this;
  47506. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  47507. return smalltalk.withContext(function($ctx1) {
  47508. self._should_raise_((function(){
  47509. return smalltalk.withContext(function($ctx2) {
  47510. return _st(self._jsObject())._foo();
  47511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  47512. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  47513. args: [],
  47514. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  47515. messageSends: ["should:raise:", "foo", "jsObject"],
  47516. referencedClasses: ["MessageNotUnderstood"]
  47517. }),
  47518. globals.JSObjectProxyTest);
  47519. smalltalk.addMethod(
  47520. smalltalk.method({
  47521. selector: "testMessageSend",
  47522. protocol: 'tests',
  47523. fn: function (){
  47524. var self=this;
  47525. return smalltalk.withContext(function($ctx1) {
  47526. var $2,$1,$4,$3;
  47527. $2=self._jsObject();
  47528. $ctx1.sendIdx["jsObject"]=1;
  47529. $1=_st($2)._a();
  47530. self._assert_equals_($1,(1));
  47531. $ctx1.sendIdx["assert:equals:"]=1;
  47532. $4=self._jsObject();
  47533. $ctx1.sendIdx["jsObject"]=2;
  47534. $3=_st($4)._b();
  47535. self._assert_equals_($3,(2));
  47536. $ctx1.sendIdx["assert:equals:"]=2;
  47537. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  47538. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  47539. args: [],
  47540. source: "testMessageSend\x0a\x0a\x09self assert: self jsObject a equals: 1.\x0a\x09self assert: self jsObject b equals: 2.\x0a\x09self assert: (self jsObject c: 3) equals: 3",
  47541. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  47542. referencedClasses: []
  47543. }),
  47544. globals.JSObjectProxyTest);
  47545. smalltalk.addMethod(
  47546. smalltalk.method({
  47547. selector: "testMethodWithArguments",
  47548. protocol: 'tests',
  47549. fn: function (){
  47550. var self=this;
  47551. return smalltalk.withContext(function($ctx1) {
  47552. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  47553. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  47554. args: [],
  47555. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  47556. messageSends: ["assert:equals:", "c:", "jsObject"],
  47557. referencedClasses: []
  47558. }),
  47559. globals.JSObjectProxyTest);
  47560. smalltalk.addMethod(
  47561. smalltalk.method({
  47562. selector: "testPrinting",
  47563. protocol: 'tests',
  47564. fn: function (){
  47565. var self=this;
  47566. return smalltalk.withContext(function($ctx1) {
  47567. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  47568. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  47569. args: [],
  47570. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  47571. messageSends: ["assert:equals:", "printString", "jsObject"],
  47572. referencedClasses: []
  47573. }),
  47574. globals.JSObjectProxyTest);
  47575. smalltalk.addMethod(
  47576. smalltalk.method({
  47577. selector: "testPropertyThatReturnsEmptyString",
  47578. protocol: 'tests',
  47579. fn: function (){
  47580. var self=this;
  47581. var object;
  47582. return smalltalk.withContext(function($ctx1) {
  47583. var $1;
  47584. object=self._jsObject();
  47585. $1=_st(object)._d();
  47586. $ctx1.sendIdx["d"]=1;
  47587. self._assert_equals_($1,"");
  47588. $ctx1.sendIdx["assert:equals:"]=1;
  47589. _st(object)._d_("hello");
  47590. self._assert_equals_(_st(object)._d(),"hello");
  47591. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  47592. args: [],
  47593. source: "testPropertyThatReturnsEmptyString\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self assert: object d equals: ''.\x0a\x0a\x09object d: 'hello'.\x0a\x09self assert: object d equals: 'hello'",
  47594. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  47595. referencedClasses: []
  47596. }),
  47597. globals.JSObjectProxyTest);
  47598. smalltalk.addMethod(
  47599. smalltalk.method({
  47600. selector: "testPropertyThatReturnsUndefined",
  47601. protocol: 'tests',
  47602. fn: function (){
  47603. var self=this;
  47604. var object;
  47605. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  47606. return smalltalk.withContext(function($ctx1) {
  47607. object=self._jsObject();
  47608. self._shouldnt_raise_((function(){
  47609. return smalltalk.withContext(function($ctx2) {
  47610. return _st(object)._e();
  47611. $ctx2.sendIdx["e"]=1;
  47612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  47613. self._assert_(_st(_st(object)._e())._isNil());
  47614. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  47615. args: [],
  47616. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  47617. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  47618. referencedClasses: ["MessageNotUnderstood"]
  47619. }),
  47620. globals.JSObjectProxyTest);
  47621. smalltalk.addMethod(
  47622. smalltalk.method({
  47623. selector: "testSetPropertyWithFalsyValue",
  47624. protocol: 'tests',
  47625. fn: function (){
  47626. var self=this;
  47627. var jsObject;
  47628. return smalltalk.withContext(function($ctx1) {
  47629. var $1,$2,$3,$4,$5;
  47630. jsObject=self._jsObject();
  47631. $1=_st(jsObject)._a();
  47632. $ctx1.sendIdx["a"]=1;
  47633. self._assert_equals_($1,(1));
  47634. $ctx1.sendIdx["assert:equals:"]=1;
  47635. _st(jsObject)._a_(self._jsNull());
  47636. $ctx1.sendIdx["a:"]=1;
  47637. $2=_st(jsObject)._a();
  47638. $ctx1.sendIdx["a"]=2;
  47639. self._assert_equals_($2,nil);
  47640. $ctx1.sendIdx["assert:equals:"]=2;
  47641. _st(jsObject)._a_((0));
  47642. $ctx1.sendIdx["a:"]=2;
  47643. $3=_st(jsObject)._a();
  47644. $ctx1.sendIdx["a"]=3;
  47645. self._assert_equals_($3,(0));
  47646. $ctx1.sendIdx["assert:equals:"]=3;
  47647. _st(jsObject)._a_(self._jsUndefined());
  47648. $ctx1.sendIdx["a:"]=3;
  47649. $4=_st(jsObject)._a();
  47650. $ctx1.sendIdx["a"]=4;
  47651. self._assert_equals_($4,nil);
  47652. $ctx1.sendIdx["assert:equals:"]=4;
  47653. _st(jsObject)._a_("");
  47654. $ctx1.sendIdx["a:"]=4;
  47655. $5=_st(jsObject)._a();
  47656. $ctx1.sendIdx["a"]=5;
  47657. self._assert_equals_($5,"");
  47658. $ctx1.sendIdx["assert:equals:"]=5;
  47659. _st(jsObject)._a_(false);
  47660. self._assert_equals_(_st(jsObject)._a(),false);
  47661. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  47662. args: [],
  47663. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  47664. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  47665. referencedClasses: []
  47666. }),
  47667. globals.JSObjectProxyTest);
  47668. smalltalk.addMethod(
  47669. smalltalk.method({
  47670. selector: "testValue",
  47671. protocol: 'tests',
  47672. fn: function (){
  47673. var self=this;
  47674. var testObject;
  47675. return smalltalk.withContext(function($ctx1) {
  47676. testObject=self._jsObject();
  47677. _st(testObject)._at_put_("value","aValue");
  47678. self._assert_equals_(_st(testObject)._value(),"aValue");
  47679. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  47680. args: [],
  47681. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  47682. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  47683. referencedClasses: []
  47684. }),
  47685. globals.JSObjectProxyTest);
  47686. smalltalk.addMethod(
  47687. smalltalk.method({
  47688. selector: "testYourself",
  47689. protocol: 'tests',
  47690. fn: function (){
  47691. var self=this;
  47692. var object;
  47693. return smalltalk.withContext(function($ctx1) {
  47694. var $1,$2;
  47695. $1=self._jsObject();
  47696. _st($1)._d_("test");
  47697. $2=_st($1)._yourself();
  47698. object=$2;
  47699. self._assert_equals_(_st(object)._d(),"test");
  47700. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  47701. args: [],
  47702. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  47703. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  47704. referencedClasses: []
  47705. }),
  47706. globals.JSObjectProxyTest);
  47707. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  47708. smalltalk.addMethod(
  47709. smalltalk.method({
  47710. selector: "testCatchingException",
  47711. protocol: 'tests',
  47712. fn: function (){
  47713. var self=this;
  47714. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  47715. return smalltalk.withContext(function($ctx1) {
  47716. _st((function(){
  47717. return smalltalk.withContext(function($ctx2) {
  47718. return self._throwException();
  47719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  47720. return smalltalk.withContext(function($ctx2) {
  47721. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  47722. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  47723. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  47724. args: [],
  47725. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  47726. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  47727. referencedClasses: ["Error"]
  47728. }),
  47729. globals.JavaScriptExceptionTest);
  47730. smalltalk.addMethod(
  47731. smalltalk.method({
  47732. selector: "testRaisingException",
  47733. protocol: 'tests',
  47734. fn: function (){
  47735. var self=this;
  47736. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  47737. return smalltalk.withContext(function($ctx1) {
  47738. self._should_raise_((function(){
  47739. return smalltalk.withContext(function($ctx2) {
  47740. return self._throwException();
  47741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  47742. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  47743. args: [],
  47744. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  47745. messageSends: ["should:raise:", "throwException"],
  47746. referencedClasses: ["JavaScriptException"]
  47747. }),
  47748. globals.JavaScriptExceptionTest);
  47749. smalltalk.addMethod(
  47750. smalltalk.method({
  47751. selector: "throwException",
  47752. protocol: 'helpers',
  47753. fn: function (){
  47754. var self=this;
  47755. return smalltalk.withContext(function($ctx1) {
  47756. throw 'test';
  47757. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  47758. args: [],
  47759. source: "throwException\x0a\x09<throw 'test'>",
  47760. messageSends: [],
  47761. referencedClasses: []
  47762. }),
  47763. globals.JavaScriptExceptionTest);
  47764. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  47765. smalltalk.addMethod(
  47766. smalltalk.method({
  47767. selector: "testValue",
  47768. protocol: 'tests',
  47769. fn: function (){
  47770. var self=this;
  47771. var messageSend;
  47772. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  47773. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  47774. return smalltalk.withContext(function($ctx1) {
  47775. var $1,$2;
  47776. $1=_st($MessageSend())._new();
  47777. $ctx1.sendIdx["new"]=1;
  47778. _st($1)._receiver_(_st($Object())._new());
  47779. _st($1)._selector_("asString");
  47780. $2=_st($1)._yourself();
  47781. messageSend=$2;
  47782. self._assert_equals_(_st(messageSend)._value(),"an Object");
  47783. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  47784. args: [],
  47785. source: "testValue\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: Object new;\x0a\x09\x09selector: #asString;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: messageSend value equals: 'an Object'",
  47786. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  47787. referencedClasses: ["MessageSend", "Object"]
  47788. }),
  47789. globals.MessageSendTest);
  47790. smalltalk.addMethod(
  47791. smalltalk.method({
  47792. selector: "testValueWithArguments",
  47793. protocol: 'tests',
  47794. fn: function (){
  47795. var self=this;
  47796. var messageSend;
  47797. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  47798. return smalltalk.withContext(function($ctx1) {
  47799. var $1,$2;
  47800. $1=_st($MessageSend())._new();
  47801. _st($1)._receiver_((2));
  47802. _st($1)._selector_("+");
  47803. $2=_st($1)._yourself();
  47804. messageSend=$2;
  47805. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  47806. $ctx1.sendIdx["assert:equals:"]=1;
  47807. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  47808. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  47809. args: [],
  47810. source: "testValueWithArguments\x0a\x09| messageSend |\x0a\x09\x0a\x09messageSend := MessageSend new\x0a\x09\x09receiver: 2;\x0a\x09\x09selector: '+';\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09self assert: (messageSend value: 3) equals: 5.\x0a\x09\x0a\x09self assert: (messageSend valueWithPossibleArguments: #(4)) equals: 6",
  47811. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  47812. referencedClasses: ["MessageSend"]
  47813. }),
  47814. globals.MessageSendTest);
  47815. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  47816. smalltalk.addMethod(
  47817. smalltalk.method({
  47818. selector: "codeGeneratorClass",
  47819. protocol: 'accessing',
  47820. fn: function (){
  47821. var self=this;
  47822. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  47823. return $CodeGenerator();
  47824. },
  47825. args: [],
  47826. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  47827. messageSends: [],
  47828. referencedClasses: ["CodeGenerator"]
  47829. }),
  47830. globals.MethodInheritanceTest);
  47831. smalltalk.addMethod(
  47832. smalltalk.method({
  47833. selector: "compiler",
  47834. protocol: 'factory',
  47835. fn: function (){
  47836. var self=this;
  47837. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  47838. return smalltalk.withContext(function($ctx1) {
  47839. var $2,$3,$1;
  47840. $2=_st($Compiler())._new();
  47841. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  47842. $3=_st($2)._yourself();
  47843. $1=$3;
  47844. return $1;
  47845. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  47846. args: [],
  47847. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  47848. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  47849. referencedClasses: ["Compiler"]
  47850. }),
  47851. globals.MethodInheritanceTest);
  47852. smalltalk.addMethod(
  47853. smalltalk.method({
  47854. selector: "deinstallBottom",
  47855. protocol: 'testing',
  47856. fn: function (){
  47857. var self=this;
  47858. return smalltalk.withContext(function($ctx1) {
  47859. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  47860. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  47861. args: [],
  47862. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  47863. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  47864. referencedClasses: []
  47865. }),
  47866. globals.MethodInheritanceTest);
  47867. smalltalk.addMethod(
  47868. smalltalk.method({
  47869. selector: "deinstallMiddle",
  47870. protocol: 'testing',
  47871. fn: function (){
  47872. var self=this;
  47873. return smalltalk.withContext(function($ctx1) {
  47874. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  47875. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  47876. args: [],
  47877. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  47878. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  47879. referencedClasses: []
  47880. }),
  47881. globals.MethodInheritanceTest);
  47882. smalltalk.addMethod(
  47883. smalltalk.method({
  47884. selector: "deinstallTop",
  47885. protocol: 'testing',
  47886. fn: function (){
  47887. var self=this;
  47888. return smalltalk.withContext(function($ctx1) {
  47889. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  47890. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  47891. args: [],
  47892. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  47893. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  47894. referencedClasses: []
  47895. }),
  47896. globals.MethodInheritanceTest);
  47897. smalltalk.addMethod(
  47898. smalltalk.method({
  47899. selector: "installBottom:",
  47900. protocol: 'testing',
  47901. fn: function (aString){
  47902. var self=this;
  47903. return smalltalk.withContext(function($ctx1) {
  47904. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  47905. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  47906. args: ["aString"],
  47907. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  47908. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  47909. referencedClasses: []
  47910. }),
  47911. globals.MethodInheritanceTest);
  47912. smalltalk.addMethod(
  47913. smalltalk.method({
  47914. selector: "installMiddle:",
  47915. protocol: 'testing',
  47916. fn: function (aString){
  47917. var self=this;
  47918. return smalltalk.withContext(function($ctx1) {
  47919. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  47920. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  47921. args: ["aString"],
  47922. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  47923. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  47924. referencedClasses: []
  47925. }),
  47926. globals.MethodInheritanceTest);
  47927. smalltalk.addMethod(
  47928. smalltalk.method({
  47929. selector: "installTop:",
  47930. protocol: 'testing',
  47931. fn: function (aString){
  47932. var self=this;
  47933. return smalltalk.withContext(function($ctx1) {
  47934. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  47935. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  47936. args: ["aString"],
  47937. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  47938. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  47939. referencedClasses: []
  47940. }),
  47941. globals.MethodInheritanceTest);
  47942. smalltalk.addMethod(
  47943. smalltalk.method({
  47944. selector: "setUp",
  47945. protocol: 'initialization',
  47946. fn: function (){
  47947. var self=this;
  47948. return smalltalk.withContext(function($ctx1) {
  47949. self["@receiverTop"]=_st(self._targetClassTop())._new();
  47950. $ctx1.sendIdx["new"]=1;
  47951. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  47952. $ctx1.sendIdx["new"]=2;
  47953. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  47954. self["@method"]=nil;
  47955. self["@performBlock"]=(function(){
  47956. return smalltalk.withContext(function($ctx2) {
  47957. return self._error_("performBlock not initialized");
  47958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  47959. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  47960. args: [],
  47961. source: "setUp\x0a\x09receiverTop := self targetClassTop new.\x0a\x09receiverMiddle := self targetClassMiddle new.\x0a\x09receiverBottom := self targetClassBottom new.\x0a\x09method := nil.\x0a\x09performBlock := [ self error: 'performBlock not initialized' ]",
  47962. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  47963. referencedClasses: []
  47964. }),
  47965. globals.MethodInheritanceTest);
  47966. smalltalk.addMethod(
  47967. smalltalk.method({
  47968. selector: "shouldMNU",
  47969. protocol: 'testing',
  47970. fn: function (){
  47971. var self=this;
  47972. return smalltalk.withContext(function($ctx1) {
  47973. self._shouldMNUTop();
  47974. self._shouldMNUMiddle();
  47975. self._shouldMNUBottom();
  47976. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  47977. args: [],
  47978. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  47979. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  47980. referencedClasses: []
  47981. }),
  47982. globals.MethodInheritanceTest);
  47983. smalltalk.addMethod(
  47984. smalltalk.method({
  47985. selector: "shouldMNUBottom",
  47986. protocol: 'testing',
  47987. fn: function (){
  47988. var self=this;
  47989. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  47990. return smalltalk.withContext(function($ctx1) {
  47991. self._should_raise_((function(){
  47992. return smalltalk.withContext(function($ctx2) {
  47993. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  47994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  47995. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  47996. args: [],
  47997. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  47998. messageSends: ["should:raise:", "value:"],
  47999. referencedClasses: ["MessageNotUnderstood"]
  48000. }),
  48001. globals.MethodInheritanceTest);
  48002. smalltalk.addMethod(
  48003. smalltalk.method({
  48004. selector: "shouldMNUMiddle",
  48005. protocol: 'testing',
  48006. fn: function (){
  48007. var self=this;
  48008. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  48009. return smalltalk.withContext(function($ctx1) {
  48010. self._should_raise_((function(){
  48011. return smalltalk.withContext(function($ctx2) {
  48012. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  48013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  48014. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  48015. args: [],
  48016. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  48017. messageSends: ["should:raise:", "value:"],
  48018. referencedClasses: ["MessageNotUnderstood"]
  48019. }),
  48020. globals.MethodInheritanceTest);
  48021. smalltalk.addMethod(
  48022. smalltalk.method({
  48023. selector: "shouldMNUTop",
  48024. protocol: 'testing',
  48025. fn: function (){
  48026. var self=this;
  48027. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  48028. return smalltalk.withContext(function($ctx1) {
  48029. self._should_raise_((function(){
  48030. return smalltalk.withContext(function($ctx2) {
  48031. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  48032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  48033. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  48034. args: [],
  48035. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  48036. messageSends: ["should:raise:", "value:"],
  48037. referencedClasses: ["MessageNotUnderstood"]
  48038. }),
  48039. globals.MethodInheritanceTest);
  48040. smalltalk.addMethod(
  48041. smalltalk.method({
  48042. selector: "shouldReturn:",
  48043. protocol: 'testing',
  48044. fn: function (anObject){
  48045. var self=this;
  48046. var result;
  48047. return smalltalk.withContext(function($ctx1) {
  48048. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  48049. $ctx1.sendIdx["value:"]=1;
  48050. self._assert_equals_(["top",anObject],["top",result]);
  48051. $ctx1.sendIdx["assert:equals:"]=1;
  48052. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  48053. $ctx1.sendIdx["value:"]=2;
  48054. self._assert_equals_(["middle",anObject],["middle",result]);
  48055. $ctx1.sendIdx["assert:equals:"]=2;
  48056. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  48057. self._assert_equals_(["bottom",anObject],["bottom",result]);
  48058. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  48059. args: ["anObject"],
  48060. source: "shouldReturn: anObject\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject } equals: { 'bottom'. result }",
  48061. messageSends: ["value:", "assert:equals:"],
  48062. referencedClasses: []
  48063. }),
  48064. globals.MethodInheritanceTest);
  48065. smalltalk.addMethod(
  48066. smalltalk.method({
  48067. selector: "shouldReturn:and:and:",
  48068. protocol: 'testing',
  48069. fn: function (anObject,anObject2,anObject3){
  48070. var self=this;
  48071. var result;
  48072. return smalltalk.withContext(function($ctx1) {
  48073. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  48074. $ctx1.sendIdx["value:"]=1;
  48075. self._assert_equals_(["top",anObject],["top",result]);
  48076. $ctx1.sendIdx["assert:equals:"]=1;
  48077. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  48078. $ctx1.sendIdx["value:"]=2;
  48079. self._assert_equals_(["middle",anObject2],["middle",result]);
  48080. $ctx1.sendIdx["assert:equals:"]=2;
  48081. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  48082. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  48083. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  48084. args: ["anObject", "anObject2", "anObject3"],
  48085. source: "shouldReturn: anObject and: anObject2 and: anObject3\x0a\x09| result |\x0a\x0a\x09result := performBlock value: receiverTop.\x0a\x09self assert: { 'top'. anObject } equals: { 'top'. result }.\x0a\x09result := performBlock value: receiverMiddle.\x0a\x09self assert: { 'middle'. anObject2 } equals: { 'middle'. result }.\x0a\x09result := performBlock value: receiverBottom.\x0a\x09self assert: { 'bottom'. anObject3 } equals: { 'bottom'. result }",
  48086. messageSends: ["value:", "assert:equals:"],
  48087. referencedClasses: []
  48088. }),
  48089. globals.MethodInheritanceTest);
  48090. smalltalk.addMethod(
  48091. smalltalk.method({
  48092. selector: "targetClassBottom",
  48093. protocol: 'accessing',
  48094. fn: function (){
  48095. var self=this;
  48096. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  48097. return $JavaScriptException();
  48098. },
  48099. args: [],
  48100. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  48101. messageSends: [],
  48102. referencedClasses: ["JavaScriptException"]
  48103. }),
  48104. globals.MethodInheritanceTest);
  48105. smalltalk.addMethod(
  48106. smalltalk.method({
  48107. selector: "targetClassMiddle",
  48108. protocol: 'accessing',
  48109. fn: function (){
  48110. var self=this;
  48111. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  48112. return $Error();
  48113. },
  48114. args: [],
  48115. source: "targetClassMiddle\x0a\x09^ Error",
  48116. messageSends: [],
  48117. referencedClasses: ["Error"]
  48118. }),
  48119. globals.MethodInheritanceTest);
  48120. smalltalk.addMethod(
  48121. smalltalk.method({
  48122. selector: "targetClassTop",
  48123. protocol: 'accessing',
  48124. fn: function (){
  48125. var self=this;
  48126. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  48127. return $Object();
  48128. },
  48129. args: [],
  48130. source: "targetClassTop\x0a\x09^ Object",
  48131. messageSends: [],
  48132. referencedClasses: ["Object"]
  48133. }),
  48134. globals.MethodInheritanceTest);
  48135. smalltalk.addMethod(
  48136. smalltalk.method({
  48137. selector: "tearDown",
  48138. protocol: 'initialization',
  48139. fn: function (){
  48140. var self=this;
  48141. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  48142. return smalltalk.withContext(function($ctx1) {
  48143. _st((function(){
  48144. return smalltalk.withContext(function($ctx2) {
  48145. return self._deinstallTop();
  48146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  48147. }));
  48148. $ctx1.sendIdx["on:do:"]=1;
  48149. _st((function(){
  48150. return smalltalk.withContext(function($ctx2) {
  48151. return self._deinstallMiddle();
  48152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  48153. }));
  48154. $ctx1.sendIdx["on:do:"]=2;
  48155. _st((function(){
  48156. return smalltalk.withContext(function($ctx2) {
  48157. return self._deinstallBottom();
  48158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  48159. }));
  48160. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  48161. args: [],
  48162. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  48163. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  48164. referencedClasses: ["Error"]
  48165. }),
  48166. globals.MethodInheritanceTest);
  48167. smalltalk.addMethod(
  48168. smalltalk.method({
  48169. selector: "testMNU11",
  48170. protocol: 'tests',
  48171. fn: function (){
  48172. var self=this;
  48173. return smalltalk.withContext(function($ctx1) {
  48174. self["@performBlock"]=(function(x){
  48175. return smalltalk.withContext(function($ctx2) {
  48176. return _st(x)._foo();
  48177. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  48178. self._shouldMNU();
  48179. $ctx1.sendIdx["shouldMNU"]=1;
  48180. self._installTop_("foo ^ false");
  48181. $ctx1.sendIdx["installTop:"]=1;
  48182. self._installTop_("foo ^ true");
  48183. self._deinstallTop();
  48184. self._shouldMNU();
  48185. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  48186. args: [],
  48187. source: "testMNU11\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self deinstallTop.\x0a\x09self shouldMNU",
  48188. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  48189. referencedClasses: []
  48190. }),
  48191. globals.MethodInheritanceTest);
  48192. smalltalk.addMethod(
  48193. smalltalk.method({
  48194. selector: "testMNU22",
  48195. protocol: 'tests',
  48196. fn: function (){
  48197. var self=this;
  48198. return smalltalk.withContext(function($ctx1) {
  48199. self["@performBlock"]=(function(x){
  48200. return smalltalk.withContext(function($ctx2) {
  48201. return _st(x)._foo();
  48202. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  48203. self._shouldMNU();
  48204. $ctx1.sendIdx["shouldMNU"]=1;
  48205. self._installMiddle_("foo ^ false");
  48206. $ctx1.sendIdx["installMiddle:"]=1;
  48207. self._installMiddle_("foo ^ true");
  48208. self._deinstallMiddle();
  48209. self._shouldMNU();
  48210. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  48211. args: [],
  48212. source: "testMNU22\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self shouldMNU.\x0a\x09self installMiddle: 'foo ^ false'.\x0a\x09self installMiddle: 'foo ^ true'.\x0a\x09self deinstallMiddle.\x0a\x09self shouldMNU",
  48213. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  48214. referencedClasses: []
  48215. }),
  48216. globals.MethodInheritanceTest);
  48217. smalltalk.addMethod(
  48218. smalltalk.method({
  48219. selector: "testReturns1",
  48220. protocol: 'tests',
  48221. fn: function (){
  48222. var self=this;
  48223. return smalltalk.withContext(function($ctx1) {
  48224. self["@performBlock"]=(function(x){
  48225. return smalltalk.withContext(function($ctx2) {
  48226. return _st(x)._foo();
  48227. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  48228. self._installTop_("foo ^ false");
  48229. $ctx1.sendIdx["installTop:"]=1;
  48230. self._shouldReturn_(false);
  48231. $ctx1.sendIdx["shouldReturn:"]=1;
  48232. self._installTop_("foo ^ true");
  48233. self._shouldReturn_(true);
  48234. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  48235. args: [],
  48236. source: "testReturns1\x0a\x09performBlock := [ :x | x foo ].\x0a\x09self installTop: 'foo ^ false'.\x0a\x09self shouldReturn: false.\x0a\x09self installTop: 'foo ^ true'.\x0a\x09self shouldReturn: true",
  48237. messageSends: ["foo", "installTop:", "shouldReturn:"],
  48238. referencedClasses: []
  48239. }),
  48240. globals.MethodInheritanceTest);
  48241. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  48242. smalltalk.addMethod(
  48243. smalltalk.method({
  48244. selector: "testAbs",
  48245. protocol: 'tests',
  48246. fn: function (){
  48247. var self=this;
  48248. return smalltalk.withContext(function($ctx1) {
  48249. var $1;
  48250. $1=(4)._abs();
  48251. $ctx1.sendIdx["abs"]=1;
  48252. self._assert_equals_($1,(4));
  48253. $ctx1.sendIdx["assert:equals:"]=1;
  48254. self._assert_equals_((-4)._abs(),(4));
  48255. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  48256. args: [],
  48257. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  48258. messageSends: ["assert:equals:", "abs"],
  48259. referencedClasses: []
  48260. }),
  48261. globals.NumberTest);
  48262. smalltalk.addMethod(
  48263. smalltalk.method({
  48264. selector: "testArithmetic",
  48265. protocol: 'tests',
  48266. fn: function (){
  48267. var self=this;
  48268. return smalltalk.withContext(function($ctx1) {
  48269. var $1,$2,$3,$5,$4;
  48270. $1=(1.5).__plus((1));
  48271. $ctx1.sendIdx["+"]=1;
  48272. self._assert_equals_($1,(2.5));
  48273. $ctx1.sendIdx["assert:equals:"]=1;
  48274. $2=(2).__minus((1));
  48275. $ctx1.sendIdx["-"]=1;
  48276. self._assert_equals_($2,(1));
  48277. $ctx1.sendIdx["assert:equals:"]=2;
  48278. self._assert_equals_((-2).__minus((1)),(-3));
  48279. $ctx1.sendIdx["assert:equals:"]=3;
  48280. self._assert_equals_((12).__slash((2)),(6));
  48281. $ctx1.sendIdx["assert:equals:"]=4;
  48282. $3=(3).__star((4));
  48283. $ctx1.sendIdx["*"]=1;
  48284. self._assert_equals_($3,(12));
  48285. $ctx1.sendIdx["assert:equals:"]=5;
  48286. self._assert_equals_((7).__slash_slash((2)),(3));
  48287. $ctx1.sendIdx["assert:equals:"]=6;
  48288. self._assert_equals_((7).__backslash_backslash((2)),(1));
  48289. $ctx1.sendIdx["assert:equals:"]=7;
  48290. $5=(1).__plus((2));
  48291. $ctx1.sendIdx["+"]=2;
  48292. $4=_st($5).__star((3));
  48293. $ctx1.sendIdx["*"]=2;
  48294. self._assert_equals_($4,(9));
  48295. $ctx1.sendIdx["assert:equals:"]=8;
  48296. self._assert_equals_((1).__plus((2).__star((3))),(7));
  48297. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  48298. args: [],
  48299. source: "testArithmetic\x0a\x09\x0a\x09\x22We rely on JS here, so we won't test complex behavior, just check if\x0a\x09message sends are corrects\x22\x0a\x0a\x09self assert: 1.5 + 1 equals: 2.5.\x0a\x09self assert: 2 - 1 equals: 1.\x0a\x09self assert: -2 - 1 equals: -3.\x0a\x09self assert: 12 / 2 equals: 6.\x0a\x09self assert: 3 * 4 equals: 12.\x0a\x09self assert: 7 // 2 equals: 3.\x0a\x09self assert: 7 \x5c\x5c 2 equals: 1.\x0a\x0a\x09\x22Simple parenthesis and execution order\x22\x0a\x09self assert: 1 + 2 * 3 equals: 9.\x0a\x09self assert: 1 + (2 * 3) equals: 7",
  48300. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  48301. referencedClasses: []
  48302. }),
  48303. globals.NumberTest);
  48304. smalltalk.addMethod(
  48305. smalltalk.method({
  48306. selector: "testAsNumber",
  48307. protocol: 'tests',
  48308. fn: function (){
  48309. var self=this;
  48310. return smalltalk.withContext(function($ctx1) {
  48311. self._assert_equals_((3)._asNumber(),(3));
  48312. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  48313. args: [],
  48314. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  48315. messageSends: ["assert:equals:", "asNumber"],
  48316. referencedClasses: []
  48317. }),
  48318. globals.NumberTest);
  48319. smalltalk.addMethod(
  48320. smalltalk.method({
  48321. selector: "testCeiling",
  48322. protocol: 'tests',
  48323. fn: function (){
  48324. var self=this;
  48325. return smalltalk.withContext(function($ctx1) {
  48326. var $1,$2;
  48327. $1=(1.2)._ceiling();
  48328. $ctx1.sendIdx["ceiling"]=1;
  48329. self._assert_equals_($1,(2));
  48330. $ctx1.sendIdx["assert:equals:"]=1;
  48331. $2=(-1.2)._ceiling();
  48332. $ctx1.sendIdx["ceiling"]=2;
  48333. self._assert_equals_($2,(-1));
  48334. $ctx1.sendIdx["assert:equals:"]=2;
  48335. self._assert_equals_((1)._ceiling(),(1));
  48336. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  48337. args: [],
  48338. source: "testCeiling\x0a\x09self assert: 1.2 ceiling equals: 2.\x0a\x09self assert: -1.2 ceiling equals: -1.\x0a\x09self assert: 1.0 ceiling equals: 1.",
  48339. messageSends: ["assert:equals:", "ceiling"],
  48340. referencedClasses: []
  48341. }),
  48342. globals.NumberTest);
  48343. smalltalk.addMethod(
  48344. smalltalk.method({
  48345. selector: "testComparison",
  48346. protocol: 'tests',
  48347. fn: function (){
  48348. var self=this;
  48349. return smalltalk.withContext(function($ctx1) {
  48350. var $1,$2,$3,$4;
  48351. $1=(3).__gt((2));
  48352. $ctx1.sendIdx[">"]=1;
  48353. self._assert_($1);
  48354. $ctx1.sendIdx["assert:"]=1;
  48355. $2=(2).__lt((3));
  48356. $ctx1.sendIdx["<"]=1;
  48357. self._assert_($2);
  48358. $ctx1.sendIdx["assert:"]=2;
  48359. self._deny_((3).__lt((2)));
  48360. $ctx1.sendIdx["deny:"]=1;
  48361. self._deny_((2).__gt((3)));
  48362. $3=(3).__gt_eq((3));
  48363. $ctx1.sendIdx[">="]=1;
  48364. self._assert_($3);
  48365. $ctx1.sendIdx["assert:"]=3;
  48366. self._assert_((3.1).__gt_eq((3)));
  48367. $ctx1.sendIdx["assert:"]=4;
  48368. $4=(3).__lt_eq((3));
  48369. $ctx1.sendIdx["<="]=1;
  48370. self._assert_($4);
  48371. $ctx1.sendIdx["assert:"]=5;
  48372. self._assert_((3).__lt_eq((3.1)));
  48373. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  48374. args: [],
  48375. source: "testComparison\x0a\x0a\x09self assert: 3 > 2.\x0a\x09self assert: 2 < 3.\x0a\x09\x0a\x09self deny: 3 < 2.\x0a\x09self deny: 2 > 3.\x0a\x0a\x09self assert: 3 >= 3.\x0a\x09self assert: 3.1 >= 3.\x0a\x09self assert: 3 <= 3.\x0a\x09self assert: 3 <= 3.1",
  48376. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  48377. referencedClasses: []
  48378. }),
  48379. globals.NumberTest);
  48380. smalltalk.addMethod(
  48381. smalltalk.method({
  48382. selector: "testCopying",
  48383. protocol: 'tests',
  48384. fn: function (){
  48385. var self=this;
  48386. return smalltalk.withContext(function($ctx1) {
  48387. var $1;
  48388. $1=_st((1)._copy()).__eq_eq((1));
  48389. $ctx1.sendIdx["=="]=1;
  48390. self._assert_($1);
  48391. $ctx1.sendIdx["assert:"]=1;
  48392. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  48393. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  48394. args: [],
  48395. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  48396. messageSends: ["assert:", "==", "copy", "deepCopy"],
  48397. referencedClasses: []
  48398. }),
  48399. globals.NumberTest);
  48400. smalltalk.addMethod(
  48401. smalltalk.method({
  48402. selector: "testEquality",
  48403. protocol: 'tests',
  48404. fn: function (){
  48405. var self=this;
  48406. return smalltalk.withContext(function($ctx1) {
  48407. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  48408. $1=(1).__eq((1));
  48409. $ctx1.sendIdx["="]=1;
  48410. self._assert_($1);
  48411. $ctx1.sendIdx["assert:"]=1;
  48412. $2=(0).__eq((0));
  48413. $ctx1.sendIdx["="]=2;
  48414. self._assert_($2);
  48415. $ctx1.sendIdx["assert:"]=2;
  48416. $3=(1).__eq((0));
  48417. $ctx1.sendIdx["="]=3;
  48418. self._deny_($3);
  48419. $ctx1.sendIdx["deny:"]=1;
  48420. $5=(1)._yourself();
  48421. $ctx1.sendIdx["yourself"]=1;
  48422. $4=_st($5).__eq((1));
  48423. $ctx1.sendIdx["="]=4;
  48424. self._assert_($4);
  48425. $ctx1.sendIdx["assert:"]=3;
  48426. $7=(1)._yourself();
  48427. $ctx1.sendIdx["yourself"]=2;
  48428. $6=(1).__eq($7);
  48429. $ctx1.sendIdx["="]=5;
  48430. self._assert_($6);
  48431. $ctx1.sendIdx["assert:"]=4;
  48432. $9=(1)._yourself();
  48433. $ctx1.sendIdx["yourself"]=3;
  48434. $8=_st($9).__eq((1)._yourself());
  48435. $ctx1.sendIdx["="]=6;
  48436. self._assert_($8);
  48437. $10=(0).__eq(false);
  48438. $ctx1.sendIdx["="]=7;
  48439. self._deny_($10);
  48440. $ctx1.sendIdx["deny:"]=2;
  48441. $11=false.__eq((0));
  48442. $ctx1.sendIdx["="]=8;
  48443. self._deny_($11);
  48444. $ctx1.sendIdx["deny:"]=3;
  48445. $12="".__eq((0));
  48446. $ctx1.sendIdx["="]=9;
  48447. self._deny_($12);
  48448. $ctx1.sendIdx["deny:"]=4;
  48449. self._deny_((0).__eq(""));
  48450. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  48451. args: [],
  48452. source: "testEquality\x0a\x09self assert: (1 = 1).\x0a\x09self assert: (0 = 0).\x0a\x09self deny: (1 = 0).\x0a\x0a\x09self assert: (1 yourself = 1).\x0a\x09self assert: (1 = 1 yourself).\x0a\x09self assert: (1 yourself = 1 yourself).\x0a\x09\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = 0.\x0a\x09self deny: 0 = ''",
  48453. messageSends: ["assert:", "=", "deny:", "yourself"],
  48454. referencedClasses: []
  48455. }),
  48456. globals.NumberTest);
  48457. smalltalk.addMethod(
  48458. smalltalk.method({
  48459. selector: "testFloor",
  48460. protocol: 'tests',
  48461. fn: function (){
  48462. var self=this;
  48463. return smalltalk.withContext(function($ctx1) {
  48464. var $1,$2;
  48465. $1=(1.2)._floor();
  48466. $ctx1.sendIdx["floor"]=1;
  48467. self._assert_equals_($1,(1));
  48468. $ctx1.sendIdx["assert:equals:"]=1;
  48469. $2=(-1.2)._floor();
  48470. $ctx1.sendIdx["floor"]=2;
  48471. self._assert_equals_($2,(-2));
  48472. $ctx1.sendIdx["assert:equals:"]=2;
  48473. self._assert_equals_((1)._floor(),(1));
  48474. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  48475. args: [],
  48476. source: "testFloor\x0a\x09self assert: 1.2 floor equals: 1.\x0a\x09self assert: -1.2 floor equals: -2.\x0a\x09self assert: 1.0 floor equals: 1.",
  48477. messageSends: ["assert:equals:", "floor"],
  48478. referencedClasses: []
  48479. }),
  48480. globals.NumberTest);
  48481. smalltalk.addMethod(
  48482. smalltalk.method({
  48483. selector: "testHexNumbers",
  48484. protocol: 'tests',
  48485. fn: function (){
  48486. var self=this;
  48487. return smalltalk.withContext(function($ctx1) {
  48488. var $1,$2,$3,$4,$5;
  48489. self._assert_equals_((9),(9));
  48490. $ctx1.sendIdx["assert:equals:"]=1;
  48491. $1=(10)._truncated();
  48492. $ctx1.sendIdx["truncated"]=1;
  48493. self._assert_equals_($1,(10));
  48494. $ctx1.sendIdx["assert:equals:"]=2;
  48495. $2=(11)._truncated();
  48496. $ctx1.sendIdx["truncated"]=2;
  48497. self._assert_equals_($2,(11));
  48498. $ctx1.sendIdx["assert:equals:"]=3;
  48499. $3=(12)._truncated();
  48500. $ctx1.sendIdx["truncated"]=3;
  48501. self._assert_equals_($3,(12));
  48502. $ctx1.sendIdx["assert:equals:"]=4;
  48503. $4=(13)._truncated();
  48504. $ctx1.sendIdx["truncated"]=4;
  48505. self._assert_equals_($4,(13));
  48506. $ctx1.sendIdx["assert:equals:"]=5;
  48507. $5=(14)._truncated();
  48508. $ctx1.sendIdx["truncated"]=5;
  48509. self._assert_equals_($5,(14));
  48510. $ctx1.sendIdx["assert:equals:"]=6;
  48511. self._assert_equals_((15)._truncated(),(15));
  48512. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  48513. args: [],
  48514. source: "testHexNumbers\x0a\x0a\x09self assert: 16r9 equals: 9.\x0a\x09self assert: 16rA truncated equals: 10.\x0a\x09self assert: 16rB truncated equals: 11.\x0a\x09self assert: 16rC truncated equals: 12.\x0a\x09self assert: 16rD truncated equals: 13.\x0a\x09self assert: 16rE truncated equals: 14.\x0a\x09self assert: 16rF truncated equals: 15",
  48515. messageSends: ["assert:equals:", "truncated"],
  48516. referencedClasses: []
  48517. }),
  48518. globals.NumberTest);
  48519. smalltalk.addMethod(
  48520. smalltalk.method({
  48521. selector: "testIdentity",
  48522. protocol: 'tests',
  48523. fn: function (){
  48524. var self=this;
  48525. return smalltalk.withContext(function($ctx1) {
  48526. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  48527. $1=(1).__eq_eq((1));
  48528. $ctx1.sendIdx["=="]=1;
  48529. self._assert_($1);
  48530. $ctx1.sendIdx["assert:"]=1;
  48531. $2=(0).__eq_eq((0));
  48532. $ctx1.sendIdx["=="]=2;
  48533. self._assert_($2);
  48534. $ctx1.sendIdx["assert:"]=2;
  48535. $3=(1).__eq_eq((0));
  48536. $ctx1.sendIdx["=="]=3;
  48537. self._deny_($3);
  48538. $ctx1.sendIdx["deny:"]=1;
  48539. $5=(1)._yourself();
  48540. $ctx1.sendIdx["yourself"]=1;
  48541. $4=_st($5).__eq_eq((1));
  48542. $ctx1.sendIdx["=="]=4;
  48543. self._assert_($4);
  48544. $ctx1.sendIdx["assert:"]=3;
  48545. $7=(1)._yourself();
  48546. $ctx1.sendIdx["yourself"]=2;
  48547. $6=(1).__eq_eq($7);
  48548. $ctx1.sendIdx["=="]=5;
  48549. self._assert_($6);
  48550. $ctx1.sendIdx["assert:"]=4;
  48551. $9=(1)._yourself();
  48552. $ctx1.sendIdx["yourself"]=3;
  48553. $8=_st($9).__eq_eq((1)._yourself());
  48554. $ctx1.sendIdx["=="]=6;
  48555. self._assert_($8);
  48556. self._deny_((1).__eq_eq((2)));
  48557. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  48558. args: [],
  48559. source: "testIdentity\x0a\x09self assert: 1 == 1.\x0a\x09self assert: 0 == 0.\x0a\x09self deny: 1 == 0.\x0a\x0a\x09self assert: 1 yourself == 1.\x0a\x09self assert: 1 == 1 yourself.\x0a\x09self assert: 1 yourself == 1 yourself.\x0a\x09\x0a\x09self deny: 1 == 2",
  48560. messageSends: ["assert:", "==", "deny:", "yourself"],
  48561. referencedClasses: []
  48562. }),
  48563. globals.NumberTest);
  48564. smalltalk.addMethod(
  48565. smalltalk.method({
  48566. selector: "testInvalidHexNumbers",
  48567. protocol: 'tests',
  48568. fn: function (){
  48569. var self=this;
  48570. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  48571. return smalltalk.withContext(function($ctx1) {
  48572. self._should_raise_((function(){
  48573. return smalltalk.withContext(function($ctx2) {
  48574. return (16)._rG();
  48575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  48576. $ctx1.sendIdx["should:raise:"]=1;
  48577. self._should_raise_((function(){
  48578. return smalltalk.withContext(function($ctx2) {
  48579. return (16)._rg();
  48580. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  48581. $ctx1.sendIdx["should:raise:"]=2;
  48582. self._should_raise_((function(){
  48583. return smalltalk.withContext(function($ctx2) {
  48584. return (16)._rH();
  48585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  48586. $ctx1.sendIdx["should:raise:"]=3;
  48587. self._should_raise_((function(){
  48588. return smalltalk.withContext(function($ctx2) {
  48589. return (16)._rh();
  48590. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  48591. $ctx1.sendIdx["should:raise:"]=4;
  48592. self._should_raise_((function(){
  48593. return smalltalk.withContext(function($ctx2) {
  48594. return (16)._rI();
  48595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  48596. $ctx1.sendIdx["should:raise:"]=5;
  48597. self._should_raise_((function(){
  48598. return smalltalk.withContext(function($ctx2) {
  48599. return (16)._ri();
  48600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  48601. $ctx1.sendIdx["should:raise:"]=6;
  48602. self._should_raise_((function(){
  48603. return smalltalk.withContext(function($ctx2) {
  48604. return (16)._rJ();
  48605. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  48606. $ctx1.sendIdx["should:raise:"]=7;
  48607. self._should_raise_((function(){
  48608. return smalltalk.withContext(function($ctx2) {
  48609. return (16)._rj();
  48610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  48611. $ctx1.sendIdx["should:raise:"]=8;
  48612. self._should_raise_((function(){
  48613. return smalltalk.withContext(function($ctx2) {
  48614. return (16)._rK();
  48615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  48616. $ctx1.sendIdx["should:raise:"]=9;
  48617. self._should_raise_((function(){
  48618. return smalltalk.withContext(function($ctx2) {
  48619. return (16)._rk();
  48620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  48621. $ctx1.sendIdx["should:raise:"]=10;
  48622. self._should_raise_((function(){
  48623. return smalltalk.withContext(function($ctx2) {
  48624. return (16)._rL();
  48625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  48626. $ctx1.sendIdx["should:raise:"]=11;
  48627. self._should_raise_((function(){
  48628. return smalltalk.withContext(function($ctx2) {
  48629. return (16)._rl();
  48630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  48631. $ctx1.sendIdx["should:raise:"]=12;
  48632. self._should_raise_((function(){
  48633. return smalltalk.withContext(function($ctx2) {
  48634. return (16)._rM();
  48635. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  48636. $ctx1.sendIdx["should:raise:"]=13;
  48637. self._should_raise_((function(){
  48638. return smalltalk.withContext(function($ctx2) {
  48639. return (16)._rm();
  48640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  48641. $ctx1.sendIdx["should:raise:"]=14;
  48642. self._should_raise_((function(){
  48643. return smalltalk.withContext(function($ctx2) {
  48644. return (16)._rN();
  48645. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  48646. $ctx1.sendIdx["should:raise:"]=15;
  48647. self._should_raise_((function(){
  48648. return smalltalk.withContext(function($ctx2) {
  48649. return (16)._rn();
  48650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  48651. $ctx1.sendIdx["should:raise:"]=16;
  48652. self._should_raise_((function(){
  48653. return smalltalk.withContext(function($ctx2) {
  48654. return (16)._rO();
  48655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  48656. $ctx1.sendIdx["should:raise:"]=17;
  48657. self._should_raise_((function(){
  48658. return smalltalk.withContext(function($ctx2) {
  48659. return (16)._ro();
  48660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  48661. $ctx1.sendIdx["should:raise:"]=18;
  48662. self._should_raise_((function(){
  48663. return smalltalk.withContext(function($ctx2) {
  48664. return (16)._rP();
  48665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  48666. $ctx1.sendIdx["should:raise:"]=19;
  48667. self._should_raise_((function(){
  48668. return smalltalk.withContext(function($ctx2) {
  48669. return (16)._rp();
  48670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  48671. $ctx1.sendIdx["should:raise:"]=20;
  48672. self._should_raise_((function(){
  48673. return smalltalk.withContext(function($ctx2) {
  48674. return (16)._rQ();
  48675. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  48676. $ctx1.sendIdx["should:raise:"]=21;
  48677. self._should_raise_((function(){
  48678. return smalltalk.withContext(function($ctx2) {
  48679. return (16)._rq();
  48680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  48681. $ctx1.sendIdx["should:raise:"]=22;
  48682. self._should_raise_((function(){
  48683. return smalltalk.withContext(function($ctx2) {
  48684. return (16)._rR();
  48685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  48686. $ctx1.sendIdx["should:raise:"]=23;
  48687. self._should_raise_((function(){
  48688. return smalltalk.withContext(function($ctx2) {
  48689. return (16)._rr();
  48690. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  48691. $ctx1.sendIdx["should:raise:"]=24;
  48692. self._should_raise_((function(){
  48693. return smalltalk.withContext(function($ctx2) {
  48694. return (16)._rS();
  48695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  48696. $ctx1.sendIdx["should:raise:"]=25;
  48697. self._should_raise_((function(){
  48698. return smalltalk.withContext(function($ctx2) {
  48699. return (16)._rs();
  48700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  48701. $ctx1.sendIdx["should:raise:"]=26;
  48702. self._should_raise_((function(){
  48703. return smalltalk.withContext(function($ctx2) {
  48704. return (16)._rT();
  48705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  48706. $ctx1.sendIdx["should:raise:"]=27;
  48707. self._should_raise_((function(){
  48708. return smalltalk.withContext(function($ctx2) {
  48709. return (16)._rt();
  48710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  48711. $ctx1.sendIdx["should:raise:"]=28;
  48712. self._should_raise_((function(){
  48713. return smalltalk.withContext(function($ctx2) {
  48714. return (16)._rU();
  48715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  48716. $ctx1.sendIdx["should:raise:"]=29;
  48717. self._should_raise_((function(){
  48718. return smalltalk.withContext(function($ctx2) {
  48719. return (16)._ru();
  48720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  48721. $ctx1.sendIdx["should:raise:"]=30;
  48722. self._should_raise_((function(){
  48723. return smalltalk.withContext(function($ctx2) {
  48724. return (16)._rV();
  48725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  48726. $ctx1.sendIdx["should:raise:"]=31;
  48727. self._should_raise_((function(){
  48728. return smalltalk.withContext(function($ctx2) {
  48729. return (16)._rv();
  48730. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  48731. $ctx1.sendIdx["should:raise:"]=32;
  48732. self._should_raise_((function(){
  48733. return smalltalk.withContext(function($ctx2) {
  48734. return (16)._rW();
  48735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  48736. $ctx1.sendIdx["should:raise:"]=33;
  48737. self._should_raise_((function(){
  48738. return smalltalk.withContext(function($ctx2) {
  48739. return (16)._rw();
  48740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  48741. $ctx1.sendIdx["should:raise:"]=34;
  48742. self._should_raise_((function(){
  48743. return smalltalk.withContext(function($ctx2) {
  48744. return (16)._rX();
  48745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  48746. $ctx1.sendIdx["should:raise:"]=35;
  48747. self._should_raise_((function(){
  48748. return smalltalk.withContext(function($ctx2) {
  48749. return (16)._rx();
  48750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  48751. $ctx1.sendIdx["should:raise:"]=36;
  48752. self._should_raise_((function(){
  48753. return smalltalk.withContext(function($ctx2) {
  48754. return (16)._rY();
  48755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  48756. $ctx1.sendIdx["should:raise:"]=37;
  48757. self._should_raise_((function(){
  48758. return smalltalk.withContext(function($ctx2) {
  48759. return (16)._ry();
  48760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  48761. $ctx1.sendIdx["should:raise:"]=38;
  48762. self._should_raise_((function(){
  48763. return smalltalk.withContext(function($ctx2) {
  48764. return (16)._rZ();
  48765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  48766. $ctx1.sendIdx["should:raise:"]=39;
  48767. self._should_raise_((function(){
  48768. return smalltalk.withContext(function($ctx2) {
  48769. return (16)._rz();
  48770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  48771. $ctx1.sendIdx["should:raise:"]=40;
  48772. self._should_raise_((function(){
  48773. return smalltalk.withContext(function($ctx2) {
  48774. return (11259375)._Z();
  48775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  48776. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  48777. args: [],
  48778. source: "testInvalidHexNumbers\x0a\x0a\x09self should: [ 16rG ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rg ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rH ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rh ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rI ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ri ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rJ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rj ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rK ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rk ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rL ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rl ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rM ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rm ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rN ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rn ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rO ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ro ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rP ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rp ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rQ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rq ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rR ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rr ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rS ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rs ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rT ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rt ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rU ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ru ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rV ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rv ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rW ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rw ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rX ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rx ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rY ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16ry ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rZ ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rz ] raise: MessageNotUnderstood.\x0a\x09self should: [ 16rABcdEfZ ] raise: MessageNotUnderstood.",
  48779. messageSends: ["should:raise:", "rG", "rg", "rH", "rh", "rI", "ri", "rJ", "rj", "rK", "rk", "rL", "rl", "rM", "rm", "rN", "rn", "rO", "ro", "rP", "rp", "rQ", "rq", "rR", "rr", "rS", "rs", "rT", "rt", "rU", "ru", "rV", "rv", "rW", "rw", "rX", "rx", "rY", "ry", "rZ", "rz", "Z"],
  48780. referencedClasses: ["MessageNotUnderstood"]
  48781. }),
  48782. globals.NumberTest);
  48783. smalltalk.addMethod(
  48784. smalltalk.method({
  48785. selector: "testLog",
  48786. protocol: 'tests',
  48787. fn: function (){
  48788. var self=this;
  48789. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  48790. return smalltalk.withContext(function($ctx1) {
  48791. self._assert_equals_((10000)._log(),(4));
  48792. $ctx1.sendIdx["assert:equals:"]=1;
  48793. self._assert_equals_((512)._log_((2)),(9));
  48794. $ctx1.sendIdx["assert:equals:"]=2;
  48795. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  48796. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  48797. args: [],
  48798. source: "testLog\x0a\x09self assert: 10000 log equals: 4.\x0a\x09self assert: (512 log: 2) equals: 9.\x0a\x09self assert: Number e ln equals: 1.",
  48799. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  48800. referencedClasses: ["Number"]
  48801. }),
  48802. globals.NumberTest);
  48803. smalltalk.addMethod(
  48804. smalltalk.method({
  48805. selector: "testMinMax",
  48806. protocol: 'tests',
  48807. fn: function (){
  48808. var self=this;
  48809. return smalltalk.withContext(function($ctx1) {
  48810. self._assert_equals_((2)._max_((5)),(5));
  48811. $ctx1.sendIdx["assert:equals:"]=1;
  48812. self._assert_equals_((2)._min_((5)),(2));
  48813. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  48814. args: [],
  48815. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  48816. messageSends: ["assert:equals:", "max:", "min:"],
  48817. referencedClasses: []
  48818. }),
  48819. globals.NumberTest);
  48820. smalltalk.addMethod(
  48821. smalltalk.method({
  48822. selector: "testNegated",
  48823. protocol: 'tests',
  48824. fn: function (){
  48825. var self=this;
  48826. return smalltalk.withContext(function($ctx1) {
  48827. var $1;
  48828. $1=(3)._negated();
  48829. $ctx1.sendIdx["negated"]=1;
  48830. self._assert_equals_($1,(-3));
  48831. $ctx1.sendIdx["assert:equals:"]=1;
  48832. self._assert_equals_((-3)._negated(),(3));
  48833. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  48834. args: [],
  48835. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  48836. messageSends: ["assert:equals:", "negated"],
  48837. referencedClasses: []
  48838. }),
  48839. globals.NumberTest);
  48840. smalltalk.addMethod(
  48841. smalltalk.method({
  48842. selector: "testPrintShowingDecimalPlaces",
  48843. protocol: 'tests',
  48844. fn: function (){
  48845. var self=this;
  48846. return smalltalk.withContext(function($ctx1) {
  48847. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  48848. $1=(23)._printShowingDecimalPlaces_((2));
  48849. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  48850. self._assert_equals_($1,"23.00");
  48851. $ctx1.sendIdx["assert:equals:"]=1;
  48852. $2=(23.5698)._printShowingDecimalPlaces_((2));
  48853. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  48854. self._assert_equals_($2,"23.57");
  48855. $ctx1.sendIdx["assert:equals:"]=2;
  48856. $4=(234.567)._negated();
  48857. $ctx1.sendIdx["negated"]=1;
  48858. $3=_st($4)._printShowingDecimalPlaces_((5));
  48859. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  48860. self._assert_equals_($3,"-234.56700");
  48861. $ctx1.sendIdx["assert:equals:"]=3;
  48862. $5=(23.4567)._printShowingDecimalPlaces_((0));
  48863. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  48864. self._assert_equals_($5,"23");
  48865. $ctx1.sendIdx["assert:equals:"]=4;
  48866. $6=(23.5567)._printShowingDecimalPlaces_((0));
  48867. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  48868. self._assert_equals_($6,"24");
  48869. $ctx1.sendIdx["assert:equals:"]=5;
  48870. $8=(23.4567)._negated();
  48871. $ctx1.sendIdx["negated"]=2;
  48872. $7=_st($8)._printShowingDecimalPlaces_((0));
  48873. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  48874. self._assert_equals_($7,"-23");
  48875. $ctx1.sendIdx["assert:equals:"]=6;
  48876. $10=(23.5567)._negated();
  48877. $ctx1.sendIdx["negated"]=3;
  48878. $9=_st($10)._printShowingDecimalPlaces_((0));
  48879. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  48880. self._assert_equals_($9,"-24");
  48881. $ctx1.sendIdx["assert:equals:"]=7;
  48882. $11=(100000000)._printShowingDecimalPlaces_((1));
  48883. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  48884. self._assert_equals_($11,"100000000.0");
  48885. $ctx1.sendIdx["assert:equals:"]=8;
  48886. $12=(0.98)._printShowingDecimalPlaces_((5));
  48887. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  48888. self._assert_equals_($12,"0.98000");
  48889. $ctx1.sendIdx["assert:equals:"]=9;
  48890. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  48891. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  48892. self._assert_equals_($13,"-0.98");
  48893. $ctx1.sendIdx["assert:equals:"]=10;
  48894. $14=(2.567)._printShowingDecimalPlaces_((2));
  48895. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  48896. self._assert_equals_($14,"2.57");
  48897. $ctx1.sendIdx["assert:equals:"]=11;
  48898. $15=(-2.567)._printShowingDecimalPlaces_((2));
  48899. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  48900. self._assert_equals_($15,"-2.57");
  48901. $ctx1.sendIdx["assert:equals:"]=12;
  48902. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  48903. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  48904. args: [],
  48905. source: "testPrintShowingDecimalPlaces\x0a\x09self assert: (23 printShowingDecimalPlaces: 2) equals: '23.00'.\x0a\x09self assert: (23.5698 printShowingDecimalPlaces: 2) equals: '23.57'.\x0a\x09self assert: (234.567 negated printShowingDecimalPlaces: 5) equals: '-234.56700'.\x0a\x09self assert: (23.4567 printShowingDecimalPlaces: 0) equals: '23'.\x0a\x09self assert: (23.5567 printShowingDecimalPlaces: 0) equals: '24'.\x0a\x09self assert: (23.4567 negated printShowingDecimalPlaces: 0) equals: '-23'.\x0a\x09self assert: (23.5567 negated printShowingDecimalPlaces: 0) equals: '-24'.\x0a\x09self assert: (100000000 printShowingDecimalPlaces: 1) equals: '100000000.0'.\x0a\x09self assert: (0.98 printShowingDecimalPlaces: 5) equals: '0.98000'.\x0a\x09self assert: (0.98 negated printShowingDecimalPlaces: 2) equals: '-0.98'.\x0a\x09self assert: (2.567 printShowingDecimalPlaces: 2) equals: '2.57'.\x0a\x09self assert: (-2.567 printShowingDecimalPlaces: 2) equals: '-2.57'.\x0a\x09self assert: (0 printShowingDecimalPlaces: 2) equals: '0.00'.",
  48906. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  48907. referencedClasses: []
  48908. }),
  48909. globals.NumberTest);
  48910. smalltalk.addMethod(
  48911. smalltalk.method({
  48912. selector: "testRaisedTo",
  48913. protocol: 'tests',
  48914. fn: function (){
  48915. var self=this;
  48916. return smalltalk.withContext(function($ctx1) {
  48917. var $1,$2,$3;
  48918. $1=(2)._raisedTo_((4));
  48919. $ctx1.sendIdx["raisedTo:"]=1;
  48920. self._assert_equals_($1,(16));
  48921. $ctx1.sendIdx["assert:equals:"]=1;
  48922. $2=(2)._raisedTo_((0));
  48923. $ctx1.sendIdx["raisedTo:"]=2;
  48924. self._assert_equals_($2,(1));
  48925. $ctx1.sendIdx["assert:equals:"]=2;
  48926. $3=(2)._raisedTo_((-3));
  48927. $ctx1.sendIdx["raisedTo:"]=3;
  48928. self._assert_equals_($3,(0.125));
  48929. $ctx1.sendIdx["assert:equals:"]=3;
  48930. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  48931. $ctx1.sendIdx["assert:equals:"]=4;
  48932. self._assert_equals_((2).__star_star((4)),(16));
  48933. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  48934. args: [],
  48935. source: "testRaisedTo\x0a\x09self assert: (2 raisedTo: 4) equals: 16.\x0a\x09self assert: (2 raisedTo: 0) equals: 1.\x0a\x09self assert: (2 raisedTo: -3) equals: 0.125.\x0a\x09self assert: (4 raisedTo: 0.5) equals: 2.\x0a\x09\x0a\x09self assert: 2 ** 4 equals: 16.",
  48936. messageSends: ["assert:equals:", "raisedTo:", "**"],
  48937. referencedClasses: []
  48938. }),
  48939. globals.NumberTest);
  48940. smalltalk.addMethod(
  48941. smalltalk.method({
  48942. selector: "testRounded",
  48943. protocol: 'tests',
  48944. fn: function (){
  48945. var self=this;
  48946. return smalltalk.withContext(function($ctx1) {
  48947. var $1,$2;
  48948. $1=(3)._rounded();
  48949. $ctx1.sendIdx["rounded"]=1;
  48950. self._assert_equals_($1,(3));
  48951. $ctx1.sendIdx["assert:equals:"]=1;
  48952. $2=(3.212)._rounded();
  48953. $ctx1.sendIdx["rounded"]=2;
  48954. self._assert_equals_($2,(3));
  48955. $ctx1.sendIdx["assert:equals:"]=2;
  48956. self._assert_equals_((3.51)._rounded(),(4));
  48957. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  48958. args: [],
  48959. source: "testRounded\x0a\x09\x0a\x09self assert: 3 rounded equals: 3.\x0a\x09self assert: 3.212 rounded equals: 3.\x0a\x09self assert: 3.51 rounded equals: 4",
  48960. messageSends: ["assert:equals:", "rounded"],
  48961. referencedClasses: []
  48962. }),
  48963. globals.NumberTest);
  48964. smalltalk.addMethod(
  48965. smalltalk.method({
  48966. selector: "testSign",
  48967. protocol: 'tests',
  48968. fn: function (){
  48969. var self=this;
  48970. return smalltalk.withContext(function($ctx1) {
  48971. var $1,$2;
  48972. $1=(5)._sign();
  48973. $ctx1.sendIdx["sign"]=1;
  48974. self._assert_equals_($1,(1));
  48975. $ctx1.sendIdx["assert:equals:"]=1;
  48976. $2=(0)._sign();
  48977. $ctx1.sendIdx["sign"]=2;
  48978. self._assert_equals_($2,(0));
  48979. $ctx1.sendIdx["assert:equals:"]=2;
  48980. self._assert_equals_((-1.4)._sign(),(-1));
  48981. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  48982. args: [],
  48983. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  48984. messageSends: ["assert:equals:", "sign"],
  48985. referencedClasses: []
  48986. }),
  48987. globals.NumberTest);
  48988. smalltalk.addMethod(
  48989. smalltalk.method({
  48990. selector: "testSqrt",
  48991. protocol: 'tests',
  48992. fn: function (){
  48993. var self=this;
  48994. return smalltalk.withContext(function($ctx1) {
  48995. var $1;
  48996. $1=(4)._sqrt();
  48997. $ctx1.sendIdx["sqrt"]=1;
  48998. self._assert_equals_($1,(2));
  48999. $ctx1.sendIdx["assert:equals:"]=1;
  49000. self._assert_equals_((16)._sqrt(),(4));
  49001. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  49002. args: [],
  49003. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  49004. messageSends: ["assert:equals:", "sqrt"],
  49005. referencedClasses: []
  49006. }),
  49007. globals.NumberTest);
  49008. smalltalk.addMethod(
  49009. smalltalk.method({
  49010. selector: "testSquared",
  49011. protocol: 'tests',
  49012. fn: function (){
  49013. var self=this;
  49014. return smalltalk.withContext(function($ctx1) {
  49015. self._assert_equals_((4)._squared(),(16));
  49016. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  49017. args: [],
  49018. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  49019. messageSends: ["assert:equals:", "squared"],
  49020. referencedClasses: []
  49021. }),
  49022. globals.NumberTest);
  49023. smalltalk.addMethod(
  49024. smalltalk.method({
  49025. selector: "testTimesRepeat",
  49026. protocol: 'tests',
  49027. fn: function (){
  49028. var self=this;
  49029. var i;
  49030. return smalltalk.withContext(function($ctx1) {
  49031. i=(0);
  49032. (0)._timesRepeat_((function(){
  49033. return smalltalk.withContext(function($ctx2) {
  49034. i=_st(i).__plus((1));
  49035. $ctx2.sendIdx["+"]=1;
  49036. return i;
  49037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  49038. $ctx1.sendIdx["timesRepeat:"]=1;
  49039. self._assert_equals_(i,(0));
  49040. $ctx1.sendIdx["assert:equals:"]=1;
  49041. (5)._timesRepeat_((function(){
  49042. return smalltalk.withContext(function($ctx2) {
  49043. i=_st(i).__plus((1));
  49044. return i;
  49045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  49046. self._assert_equals_(i,(5));
  49047. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  49048. args: [],
  49049. source: "testTimesRepeat\x0a\x09| i |\x0a\x0a\x09i := 0.\x0a\x090 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 0.\x0a\x0a\x095 timesRepeat: [ i := i + 1 ].\x0a\x09self assert: i equals: 5",
  49050. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  49051. referencedClasses: []
  49052. }),
  49053. globals.NumberTest);
  49054. smalltalk.addMethod(
  49055. smalltalk.method({
  49056. selector: "testTo",
  49057. protocol: 'tests',
  49058. fn: function (){
  49059. var self=this;
  49060. return smalltalk.withContext(function($ctx1) {
  49061. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  49062. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  49063. args: [],
  49064. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  49065. messageSends: ["assert:equals:", "to:"],
  49066. referencedClasses: []
  49067. }),
  49068. globals.NumberTest);
  49069. smalltalk.addMethod(
  49070. smalltalk.method({
  49071. selector: "testToBy",
  49072. protocol: 'tests',
  49073. fn: function (){
  49074. var self=this;
  49075. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  49076. return smalltalk.withContext(function($ctx1) {
  49077. var $1;
  49078. $1=(0)._to_by_((6),(2));
  49079. $ctx1.sendIdx["to:by:"]=1;
  49080. self._assert_equals_($1,[(0), (2), (4), (6)]);
  49081. self._should_raise_((function(){
  49082. return smalltalk.withContext(function($ctx2) {
  49083. return (1)._to_by_((4),(0));
  49084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  49085. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  49086. args: [],
  49087. source: "testToBy\x0a\x09self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).\x0a\x0a\x09self should: [ 1 to: 4 by: 0 ] raise: Error",
  49088. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  49089. referencedClasses: ["Error"]
  49090. }),
  49091. globals.NumberTest);
  49092. smalltalk.addMethod(
  49093. smalltalk.method({
  49094. selector: "testTrigonometry",
  49095. protocol: 'tests',
  49096. fn: function (){
  49097. var self=this;
  49098. return smalltalk.withContext(function($ctx1) {
  49099. self._assert_equals_((0)._cos(),(1));
  49100. $ctx1.sendIdx["assert:equals:"]=1;
  49101. self._assert_equals_((0)._sin(),(0));
  49102. $ctx1.sendIdx["assert:equals:"]=2;
  49103. self._assert_equals_((0)._tan(),(0));
  49104. $ctx1.sendIdx["assert:equals:"]=3;
  49105. self._assert_equals_((1)._arcCos(),(0));
  49106. $ctx1.sendIdx["assert:equals:"]=4;
  49107. self._assert_equals_((0)._arcSin(),(0));
  49108. $ctx1.sendIdx["assert:equals:"]=5;
  49109. self._assert_equals_((0)._arcTan(),(0));
  49110. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  49111. args: [],
  49112. source: "testTrigonometry\x0a\x09self assert: 0 cos equals: 1.\x0a\x09self assert: 0 sin equals: 0.\x0a\x09self assert: 0 tan equals: 0.\x0a\x09self assert: 1 arcCos equals: 0.\x0a\x09self assert: 0 arcSin equals: 0.\x0a\x09self assert: 0 arcTan equals: 0.",
  49113. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  49114. referencedClasses: []
  49115. }),
  49116. globals.NumberTest);
  49117. smalltalk.addMethod(
  49118. smalltalk.method({
  49119. selector: "testTruncated",
  49120. protocol: 'tests',
  49121. fn: function (){
  49122. var self=this;
  49123. return smalltalk.withContext(function($ctx1) {
  49124. var $1,$2;
  49125. $1=(3)._truncated();
  49126. $ctx1.sendIdx["truncated"]=1;
  49127. self._assert_equals_($1,(3));
  49128. $ctx1.sendIdx["assert:equals:"]=1;
  49129. $2=(3.212)._truncated();
  49130. $ctx1.sendIdx["truncated"]=2;
  49131. self._assert_equals_($2,(3));
  49132. $ctx1.sendIdx["assert:equals:"]=2;
  49133. self._assert_equals_((3.51)._truncated(),(3));
  49134. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  49135. args: [],
  49136. source: "testTruncated\x0a\x09\x0a\x09self assert: 3 truncated equals: 3.\x0a\x09self assert: 3.212 truncated equals: 3.\x0a\x09self assert: 3.51 truncated equals: 3",
  49137. messageSends: ["assert:equals:", "truncated"],
  49138. referencedClasses: []
  49139. }),
  49140. globals.NumberTest);
  49141. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  49142. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  49143. smalltalk.addMethod(
  49144. smalltalk.method({
  49145. selector: "foo",
  49146. protocol: 'not yet classified',
  49147. fn: function (){
  49148. var self=this;
  49149. var $1;
  49150. $1=self["@foo"];
  49151. return $1;
  49152. },
  49153. args: [],
  49154. source: "foo\x0a\x09^ foo",
  49155. messageSends: [],
  49156. referencedClasses: []
  49157. }),
  49158. globals.ObjectMock);
  49159. smalltalk.addMethod(
  49160. smalltalk.method({
  49161. selector: "foo:",
  49162. protocol: 'not yet classified',
  49163. fn: function (anObject){
  49164. var self=this;
  49165. self["@foo"]=anObject;
  49166. return self},
  49167. args: ["anObject"],
  49168. source: "foo: anObject\x0a\x09foo := anObject",
  49169. messageSends: [],
  49170. referencedClasses: []
  49171. }),
  49172. globals.ObjectMock);
  49173. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  49174. smalltalk.addMethod(
  49175. smalltalk.method({
  49176. selector: "notDefined",
  49177. protocol: 'tests',
  49178. fn: function (){
  49179. var self=this;
  49180. return smalltalk.withContext(function($ctx1) {
  49181. return void 0;;
  49182. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  49183. args: [],
  49184. source: "notDefined\x0a\x09<return void 0;>",
  49185. messageSends: [],
  49186. referencedClasses: []
  49187. }),
  49188. globals.ObjectTest);
  49189. smalltalk.addMethod(
  49190. smalltalk.method({
  49191. selector: "testBasicAccess",
  49192. protocol: 'tests',
  49193. fn: function (){
  49194. var self=this;
  49195. var o;
  49196. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49197. return smalltalk.withContext(function($ctx1) {
  49198. var $1;
  49199. o=_st($Object())._new();
  49200. _st(o)._basicAt_put_("a",(1));
  49201. $1=_st(o)._basicAt_("a");
  49202. $ctx1.sendIdx["basicAt:"]=1;
  49203. self._assert_equals_($1,(1));
  49204. $ctx1.sendIdx["assert:equals:"]=1;
  49205. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  49206. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  49207. args: [],
  49208. source: "testBasicAccess\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'a' put: 1.\x0a\x09self assert: (o basicAt: 'a') equals: 1.\x0a\x09self assert: (o basicAt: 'b') equals: nil",
  49209. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  49210. referencedClasses: ["Object"]
  49211. }),
  49212. globals.ObjectTest);
  49213. smalltalk.addMethod(
  49214. smalltalk.method({
  49215. selector: "testBasicPerform",
  49216. protocol: 'tests',
  49217. fn: function (){
  49218. var self=this;
  49219. var o;
  49220. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49221. return smalltalk.withContext(function($ctx1) {
  49222. o=_st($Object())._new();
  49223. _st(o)._basicAt_put_("func",(function(){
  49224. return "hello";
  49225. }));
  49226. $ctx1.sendIdx["basicAt:put:"]=1;
  49227. _st(o)._basicAt_put_("func2",(function(a){
  49228. return smalltalk.withContext(function($ctx2) {
  49229. return _st(a).__plus((1));
  49230. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  49231. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  49232. $ctx1.sendIdx["assert:equals:"]=1;
  49233. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  49234. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  49235. args: [],
  49236. source: "testBasicPerform\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09o basicAt: 'func' put: [ 'hello' ].\x0a\x09o basicAt: 'func2' put: [ :a | a + 1 ].\x0a\x0a\x09self assert: (o basicPerform: 'func') equals: 'hello'.\x0a\x09self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4",
  49237. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  49238. referencedClasses: ["Object"]
  49239. }),
  49240. globals.ObjectTest);
  49241. smalltalk.addMethod(
  49242. smalltalk.method({
  49243. selector: "testDNU",
  49244. protocol: 'tests',
  49245. fn: function (){
  49246. var self=this;
  49247. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49248. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  49249. return smalltalk.withContext(function($ctx1) {
  49250. self._should_raise_((function(){
  49251. return smalltalk.withContext(function($ctx2) {
  49252. return _st(_st($Object())._new())._foo();
  49253. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  49254. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  49255. args: [],
  49256. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  49257. messageSends: ["should:raise:", "foo", "new"],
  49258. referencedClasses: ["Object", "MessageNotUnderstood"]
  49259. }),
  49260. globals.ObjectTest);
  49261. smalltalk.addMethod(
  49262. smalltalk.method({
  49263. selector: "testEquality",
  49264. protocol: 'tests',
  49265. fn: function (){
  49266. var self=this;
  49267. var o;
  49268. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49269. return smalltalk.withContext(function($ctx1) {
  49270. var $1,$2,$4,$3;
  49271. o=_st($Object())._new();
  49272. $ctx1.sendIdx["new"]=1;
  49273. $1=_st(o).__eq(_st($Object())._new());
  49274. $ctx1.sendIdx["="]=1;
  49275. self._deny_($1);
  49276. $2=_st(o).__eq(o);
  49277. $ctx1.sendIdx["="]=2;
  49278. self._assert_($2);
  49279. $ctx1.sendIdx["assert:"]=1;
  49280. $4=_st(o)._yourself();
  49281. $ctx1.sendIdx["yourself"]=1;
  49282. $3=_st($4).__eq(o);
  49283. $ctx1.sendIdx["="]=3;
  49284. self._assert_($3);
  49285. $ctx1.sendIdx["assert:"]=2;
  49286. self._assert_(_st(o).__eq(_st(o)._yourself()));
  49287. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  49288. args: [],
  49289. source: "testEquality\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o = Object new.\x0a\x09self assert: (o = o).\x0a\x09self assert: (o yourself = o).\x0a\x09self assert: (o = o yourself)",
  49290. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  49291. referencedClasses: ["Object"]
  49292. }),
  49293. globals.ObjectTest);
  49294. smalltalk.addMethod(
  49295. smalltalk.method({
  49296. selector: "testHalt",
  49297. protocol: 'tests',
  49298. fn: function (){
  49299. var self=this;
  49300. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49301. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  49302. return smalltalk.withContext(function($ctx1) {
  49303. self._should_raise_((function(){
  49304. return smalltalk.withContext(function($ctx2) {
  49305. return _st(_st($Object())._new())._halt();
  49306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  49307. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  49308. args: [],
  49309. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  49310. messageSends: ["should:raise:", "halt", "new"],
  49311. referencedClasses: ["Object", "Error"]
  49312. }),
  49313. globals.ObjectTest);
  49314. smalltalk.addMethod(
  49315. smalltalk.method({
  49316. selector: "testIdentity",
  49317. protocol: 'tests',
  49318. fn: function (){
  49319. var self=this;
  49320. var o;
  49321. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49322. return smalltalk.withContext(function($ctx1) {
  49323. var $1,$2,$4,$3;
  49324. o=_st($Object())._new();
  49325. $ctx1.sendIdx["new"]=1;
  49326. $1=_st(o).__eq_eq(_st($Object())._new());
  49327. $ctx1.sendIdx["=="]=1;
  49328. self._deny_($1);
  49329. $2=_st(o).__eq_eq(o);
  49330. $ctx1.sendIdx["=="]=2;
  49331. self._assert_($2);
  49332. $ctx1.sendIdx["assert:"]=1;
  49333. $4=_st(o)._yourself();
  49334. $ctx1.sendIdx["yourself"]=1;
  49335. $3=_st($4).__eq_eq(o);
  49336. $ctx1.sendIdx["=="]=3;
  49337. self._assert_($3);
  49338. $ctx1.sendIdx["assert:"]=2;
  49339. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  49340. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  49341. args: [],
  49342. source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
  49343. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  49344. referencedClasses: ["Object"]
  49345. }),
  49346. globals.ObjectTest);
  49347. smalltalk.addMethod(
  49348. smalltalk.method({
  49349. selector: "testIfNil",
  49350. protocol: 'tests',
  49351. fn: function (){
  49352. var self=this;
  49353. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49354. return smalltalk.withContext(function($ctx1) {
  49355. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  49356. $2=_st($Object())._new();
  49357. $ctx1.sendIdx["new"]=1;
  49358. $1=_st($2)._isNil();
  49359. self._deny_($1);
  49360. $ctx1.sendIdx["deny:"]=1;
  49361. $5=_st($Object())._new();
  49362. $ctx1.sendIdx["new"]=2;
  49363. if(($receiver = $5) == null || $receiver.isNil){
  49364. $4=true;
  49365. } else {
  49366. $4=$5;
  49367. };
  49368. $3=_st($4).__eq(true);
  49369. self._deny_($3);
  49370. $7=_st($Object())._new();
  49371. $ctx1.sendIdx["new"]=3;
  49372. if(($receiver = $7) == null || $receiver.isNil){
  49373. $6=$7;
  49374. } else {
  49375. $6=true;
  49376. };
  49377. self._assert_equals_($6,true);
  49378. $ctx1.sendIdx["assert:equals:"]=1;
  49379. $9=_st($Object())._new();
  49380. $ctx1.sendIdx["new"]=4;
  49381. if(($receiver = $9) == null || $receiver.isNil){
  49382. $8=false;
  49383. } else {
  49384. $8=true;
  49385. };
  49386. self._assert_equals_($8,true);
  49387. $ctx1.sendIdx["assert:equals:"]=2;
  49388. $11=_st($Object())._new();
  49389. if(($receiver = $11) == null || $receiver.isNil){
  49390. $10=false;
  49391. } else {
  49392. $10=true;
  49393. };
  49394. self._assert_equals_($10,true);
  49395. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  49396. args: [],
  49397. source: "testIfNil\x0a\x09self deny: Object new isNil.\x0a\x09self deny: (Object new ifNil: [ true ]) = true.\x0a\x09self assert: (Object new ifNotNil: [ true ]) equals: true.\x0a\x0a\x09self assert: (Object new ifNil: [ false ] ifNotNil: [ true ]) equals: true.\x0a\x09self assert: (Object new ifNotNil: [ true ] ifNil: [ false ]) equals: true",
  49398. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  49399. referencedClasses: ["Object"]
  49400. }),
  49401. globals.ObjectTest);
  49402. smalltalk.addMethod(
  49403. smalltalk.method({
  49404. selector: "testInstVars",
  49405. protocol: 'tests',
  49406. fn: function (){
  49407. var self=this;
  49408. var o;
  49409. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49410. return smalltalk.withContext(function($ctx1) {
  49411. var $1,$2;
  49412. o=_st($ObjectMock())._new();
  49413. $1=_st(o)._instVarAt_("foo");
  49414. $ctx1.sendIdx["instVarAt:"]=1;
  49415. self._assert_equals_($1,nil);
  49416. $ctx1.sendIdx["assert:equals:"]=1;
  49417. _st(o)._instVarAt_put_("foo",(1));
  49418. $2=_st(o)._instVarAt_("foo");
  49419. $ctx1.sendIdx["instVarAt:"]=2;
  49420. self._assert_equals_($2,(1));
  49421. $ctx1.sendIdx["assert:equals:"]=2;
  49422. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  49423. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  49424. args: [],
  49425. source: "testInstVars\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: (o instVarAt: #foo) equals: nil.\x0a\x0a\x09o instVarAt: #foo put: 1.\x0a\x09self assert: (o instVarAt: #foo) equals: 1.\x0a\x09self assert: (o instVarAt: 'foo') equals: 1",
  49426. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  49427. referencedClasses: ["ObjectMock"]
  49428. }),
  49429. globals.ObjectTest);
  49430. smalltalk.addMethod(
  49431. smalltalk.method({
  49432. selector: "testNilUndefined",
  49433. protocol: 'tests',
  49434. fn: function (){
  49435. var self=this;
  49436. return smalltalk.withContext(function($ctx1) {
  49437. self._assert_equals_(self._notDefined(),nil);
  49438. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  49439. args: [],
  49440. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  49441. messageSends: ["assert:equals:", "notDefined"],
  49442. referencedClasses: []
  49443. }),
  49444. globals.ObjectTest);
  49445. smalltalk.addMethod(
  49446. smalltalk.method({
  49447. selector: "testYourself",
  49448. protocol: 'tests',
  49449. fn: function (){
  49450. var self=this;
  49451. var o;
  49452. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  49453. return smalltalk.withContext(function($ctx1) {
  49454. o=_st($ObjectMock())._new();
  49455. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  49456. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  49457. args: [],
  49458. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  49459. messageSends: ["new", "assert:", "==", "yourself"],
  49460. referencedClasses: ["ObjectMock"]
  49461. }),
  49462. globals.ObjectTest);
  49463. smalltalk.addMethod(
  49464. smalltalk.method({
  49465. selector: "testidentityHash",
  49466. protocol: 'tests',
  49467. fn: function (){
  49468. var self=this;
  49469. var o1,o2;
  49470. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  49471. return smalltalk.withContext(function($ctx1) {
  49472. var $2,$3,$1,$5,$4;
  49473. o1=_st($Object())._new();
  49474. $ctx1.sendIdx["new"]=1;
  49475. o2=_st($Object())._new();
  49476. $2=_st(o1)._identityHash();
  49477. $ctx1.sendIdx["identityHash"]=1;
  49478. $3=_st(o1)._identityHash();
  49479. $ctx1.sendIdx["identityHash"]=2;
  49480. $1=_st($2).__eq_eq($3);
  49481. $ctx1.sendIdx["=="]=1;
  49482. self._assert_($1);
  49483. $5=_st(o1)._identityHash();
  49484. $ctx1.sendIdx["identityHash"]=3;
  49485. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  49486. self._deny_($4);
  49487. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  49488. args: [],
  49489. source: "testidentityHash\x0a\x09| o1 o2 |\x0a\x09\x0a\x09o1 := Object new.\x0a\x09o2 := Object new.\x0a\x0a\x09self assert: o1 identityHash == o1 identityHash.\x0a\x09self deny: o1 identityHash == o2 identityHash",
  49490. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  49491. referencedClasses: ["Object"]
  49492. }),
  49493. globals.ObjectTest);
  49494. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  49495. smalltalk.addMethod(
  49496. smalltalk.method({
  49497. selector: "testAccessing",
  49498. protocol: 'tests',
  49499. fn: function (){
  49500. var self=this;
  49501. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  49502. return smalltalk.withContext(function($ctx1) {
  49503. var $2,$1,$3,$6,$5,$4;
  49504. $2=_st($Point())._x_y_((3),(4));
  49505. $ctx1.sendIdx["x:y:"]=1;
  49506. $1=_st($2)._x();
  49507. $ctx1.sendIdx["x"]=1;
  49508. self._assert_equals_($1,(3));
  49509. $ctx1.sendIdx["assert:equals:"]=1;
  49510. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  49511. $ctx1.sendIdx["y"]=1;
  49512. self._assert_equals_($3,(4));
  49513. $ctx1.sendIdx["assert:equals:"]=2;
  49514. $6=_st($Point())._new();
  49515. $ctx1.sendIdx["new"]=1;
  49516. $5=_st($6)._x_((3));
  49517. $4=_st($5)._x();
  49518. self._assert_equals_($4,(3));
  49519. $ctx1.sendIdx["assert:equals:"]=3;
  49520. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  49521. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  49522. args: [],
  49523. source: "testAccessing\x0a\x09self assert: (Point x: 3 y: 4) x equals: 3.\x0a\x09self assert: (Point x: 3 y: 4) y equals: 4.\x0a\x09self assert: (Point new x: 3) x equals: 3.\x0a\x09self assert: (Point new y: 4) y equals: 4",
  49524. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  49525. referencedClasses: ["Point"]
  49526. }),
  49527. globals.PointTest);
  49528. smalltalk.addMethod(
  49529. smalltalk.method({
  49530. selector: "testArithmetic",
  49531. protocol: 'tests',
  49532. fn: function (){
  49533. var self=this;
  49534. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  49535. return smalltalk.withContext(function($ctx1) {
  49536. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  49537. $2=(3).__at((4));
  49538. $ctx1.sendIdx["@"]=1;
  49539. $3=(3).__at((4));
  49540. $ctx1.sendIdx["@"]=2;
  49541. $1=_st($2).__star($3);
  49542. $4=_st($Point())._x_y_((9),(16));
  49543. $ctx1.sendIdx["x:y:"]=1;
  49544. self._assert_equals_($1,$4);
  49545. $ctx1.sendIdx["assert:equals:"]=1;
  49546. $6=(3).__at((4));
  49547. $ctx1.sendIdx["@"]=3;
  49548. $7=(3).__at((4));
  49549. $ctx1.sendIdx["@"]=4;
  49550. $5=_st($6).__plus($7);
  49551. $8=_st($Point())._x_y_((6),(8));
  49552. $ctx1.sendIdx["x:y:"]=2;
  49553. self._assert_equals_($5,$8);
  49554. $ctx1.sendIdx["assert:equals:"]=2;
  49555. $10=(3).__at((4));
  49556. $ctx1.sendIdx["@"]=5;
  49557. $11=(3).__at((4));
  49558. $ctx1.sendIdx["@"]=6;
  49559. $9=_st($10).__minus($11);
  49560. $12=_st($Point())._x_y_((0),(0));
  49561. $ctx1.sendIdx["x:y:"]=3;
  49562. self._assert_equals_($9,$12);
  49563. $ctx1.sendIdx["assert:equals:"]=3;
  49564. $14=(6).__at((8));
  49565. $ctx1.sendIdx["@"]=7;
  49566. $13=_st($14).__slash((3).__at((4)));
  49567. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  49568. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  49569. args: [],
  49570. source: "testArithmetic\x0a\x09self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).\x0a\x09self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).\x0a\x09self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).\x0a\x09self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)",
  49571. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  49572. referencedClasses: ["Point"]
  49573. }),
  49574. globals.PointTest);
  49575. smalltalk.addMethod(
  49576. smalltalk.method({
  49577. selector: "testAt",
  49578. protocol: 'tests',
  49579. fn: function (){
  49580. var self=this;
  49581. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  49582. return smalltalk.withContext(function($ctx1) {
  49583. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  49584. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  49585. args: [],
  49586. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  49587. messageSends: ["assert:equals:", "@", "x:y:"],
  49588. referencedClasses: ["Point"]
  49589. }),
  49590. globals.PointTest);
  49591. smalltalk.addMethod(
  49592. smalltalk.method({
  49593. selector: "testComparison",
  49594. protocol: 'tests',
  49595. fn: function (){
  49596. var self=this;
  49597. return smalltalk.withContext(function($ctx1) {
  49598. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  49599. $2=(3).__at((4));
  49600. $ctx1.sendIdx["@"]=1;
  49601. $3=(4).__at((5));
  49602. $ctx1.sendIdx["@"]=2;
  49603. $1=_st($2).__lt($3);
  49604. $ctx1.sendIdx["<"]=1;
  49605. self._assert_($1);
  49606. $ctx1.sendIdx["assert:"]=1;
  49607. $5=(3).__at((4));
  49608. $ctx1.sendIdx["@"]=3;
  49609. $6=(4).__at((4));
  49610. $ctx1.sendIdx["@"]=4;
  49611. $4=_st($5).__lt($6);
  49612. self._deny_($4);
  49613. $ctx1.sendIdx["deny:"]=1;
  49614. $8=(4).__at((5));
  49615. $ctx1.sendIdx["@"]=5;
  49616. $9=(4).__at((5));
  49617. $ctx1.sendIdx["@"]=6;
  49618. $7=_st($8).__lt_eq($9);
  49619. $ctx1.sendIdx["<="]=1;
  49620. self._assert_($7);
  49621. $ctx1.sendIdx["assert:"]=2;
  49622. $11=(4).__at((5));
  49623. $ctx1.sendIdx["@"]=7;
  49624. $12=(3).__at((5));
  49625. $ctx1.sendIdx["@"]=8;
  49626. $10=_st($11).__lt_eq($12);
  49627. self._deny_($10);
  49628. $ctx1.sendIdx["deny:"]=2;
  49629. $14=(5).__at((6));
  49630. $ctx1.sendIdx["@"]=9;
  49631. $15=(4).__at((5));
  49632. $ctx1.sendIdx["@"]=10;
  49633. $13=_st($14).__gt($15);
  49634. $ctx1.sendIdx[">"]=1;
  49635. self._assert_($13);
  49636. $ctx1.sendIdx["assert:"]=3;
  49637. $17=(5).__at((6));
  49638. $ctx1.sendIdx["@"]=11;
  49639. $18=(6).__at((6));
  49640. $ctx1.sendIdx["@"]=12;
  49641. $16=_st($17).__gt($18);
  49642. self._deny_($16);
  49643. $ctx1.sendIdx["deny:"]=3;
  49644. $20=(4).__at((5));
  49645. $ctx1.sendIdx["@"]=13;
  49646. $21=(4).__at((5));
  49647. $ctx1.sendIdx["@"]=14;
  49648. $19=_st($20).__gt_eq($21);
  49649. $ctx1.sendIdx[">="]=1;
  49650. self._assert_($19);
  49651. $23=(4).__at((5));
  49652. $ctx1.sendIdx["@"]=15;
  49653. $22=_st($23).__gt_eq((5).__at((5)));
  49654. self._deny_($22);
  49655. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  49656. args: [],
  49657. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  49658. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  49659. referencedClasses: []
  49660. }),
  49661. globals.PointTest);
  49662. smalltalk.addMethod(
  49663. smalltalk.method({
  49664. selector: "testEgality",
  49665. protocol: 'tests',
  49666. fn: function (){
  49667. var self=this;
  49668. return smalltalk.withContext(function($ctx1) {
  49669. var $2,$3,$1,$5,$4;
  49670. $2=(3).__at((4));
  49671. $ctx1.sendIdx["@"]=1;
  49672. $3=(3).__at((4));
  49673. $ctx1.sendIdx["@"]=2;
  49674. $1=_st($2).__eq($3);
  49675. $ctx1.sendIdx["="]=1;
  49676. self._assert_($1);
  49677. $5=(3).__at((5));
  49678. $ctx1.sendIdx["@"]=3;
  49679. $4=_st($5).__eq((3).__at((6)));
  49680. self._deny_($4);
  49681. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  49682. args: [],
  49683. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  49684. messageSends: ["assert:", "=", "@", "deny:"],
  49685. referencedClasses: []
  49686. }),
  49687. globals.PointTest);
  49688. smalltalk.addMethod(
  49689. smalltalk.method({
  49690. selector: "testNew",
  49691. protocol: 'tests',
  49692. fn: function (){
  49693. var self=this;
  49694. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  49695. return smalltalk.withContext(function($ctx1) {
  49696. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  49697. $3=_st($Point())._new();
  49698. $ctx1.sendIdx["new"]=1;
  49699. $2=_st($3)._x_((3));
  49700. $ctx1.sendIdx["x:"]=1;
  49701. $1=_st($2)._y();
  49702. $ctx1.sendIdx["y"]=1;
  49703. self._assert_equals_($1,nil);
  49704. $ctx1.sendIdx["assert:equals:"]=1;
  49705. $7=_st($Point())._new();
  49706. $ctx1.sendIdx["new"]=2;
  49707. $6=_st($7)._x_((3));
  49708. $5=_st($6)._x();
  49709. $ctx1.sendIdx["x"]=1;
  49710. $4=_st($5).__eq((0));
  49711. $ctx1.sendIdx["="]=1;
  49712. self._deny_($4);
  49713. $ctx1.sendIdx["deny:"]=1;
  49714. $10=_st($Point())._new();
  49715. $ctx1.sendIdx["new"]=3;
  49716. $9=_st($10)._y_((4));
  49717. $ctx1.sendIdx["y:"]=1;
  49718. $8=_st($9)._x();
  49719. self._assert_equals_($8,nil);
  49720. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  49721. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  49722. args: [],
  49723. source: "testNew\x0a\x0a\x09self assert: (Point new x: 3) y equals: nil.\x0a\x09self deny: (Point new x: 3) x = 0.\x0a\x09self assert: (Point new y: 4) x equals: nil.\x0a\x09self deny: (Point new y: 4) y = 0",
  49724. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  49725. referencedClasses: ["Point"]
  49726. }),
  49727. globals.PointTest);
  49728. smalltalk.addMethod(
  49729. smalltalk.method({
  49730. selector: "testTranslateBy",
  49731. protocol: 'tests',
  49732. fn: function (){
  49733. var self=this;
  49734. return smalltalk.withContext(function($ctx1) {
  49735. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  49736. $2=(3).__at((3));
  49737. $ctx1.sendIdx["@"]=1;
  49738. $3=(0).__at((1));
  49739. $ctx1.sendIdx["@"]=2;
  49740. $1=_st($2)._translateBy_($3);
  49741. $ctx1.sendIdx["translateBy:"]=1;
  49742. $4=(3).__at((4));
  49743. $ctx1.sendIdx["@"]=3;
  49744. self._assert_equals_($1,$4);
  49745. $ctx1.sendIdx["assert:equals:"]=1;
  49746. $6=(3).__at((3));
  49747. $ctx1.sendIdx["@"]=4;
  49748. $8=(1)._negated();
  49749. $ctx1.sendIdx["negated"]=1;
  49750. $7=(0).__at($8);
  49751. $ctx1.sendIdx["@"]=5;
  49752. $5=_st($6)._translateBy_($7);
  49753. $ctx1.sendIdx["translateBy:"]=2;
  49754. $9=(3).__at((2));
  49755. $ctx1.sendIdx["@"]=6;
  49756. self._assert_equals_($5,$9);
  49757. $ctx1.sendIdx["assert:equals:"]=2;
  49758. $11=(3).__at((3));
  49759. $ctx1.sendIdx["@"]=7;
  49760. $12=(2).__at((3));
  49761. $ctx1.sendIdx["@"]=8;
  49762. $10=_st($11)._translateBy_($12);
  49763. $ctx1.sendIdx["translateBy:"]=3;
  49764. $13=(5).__at((6));
  49765. $ctx1.sendIdx["@"]=9;
  49766. self._assert_equals_($10,$13);
  49767. $ctx1.sendIdx["assert:equals:"]=3;
  49768. $15=(3).__at((3));
  49769. $ctx1.sendIdx["@"]=10;
  49770. $16=_st((3)._negated()).__at((0));
  49771. $ctx1.sendIdx["@"]=11;
  49772. $14=_st($15)._translateBy_($16);
  49773. self._assert_equals_($14,(0).__at((3)));
  49774. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  49775. args: [],
  49776. source: "testTranslateBy\x0a\x09self assert: (3@3 translateBy: 0@1) equals: 3@4.\x0a\x09self assert: (3@3 translateBy: 0@1 negated) equals: 3@2.\x0a\x09self assert: (3@3 translateBy: 2@3) equals: 5@6.\x0a\x09self assert: (3@3 translateBy: 3 negated @0) equals: 0@3.",
  49777. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  49778. referencedClasses: []
  49779. }),
  49780. globals.PointTest);
  49781. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  49782. smalltalk.addMethod(
  49783. smalltalk.method({
  49784. selector: "testNextIfAbsent",
  49785. protocol: 'tests',
  49786. fn: function (){
  49787. var self=this;
  49788. var queue;
  49789. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  49790. return smalltalk.withContext(function($ctx1) {
  49791. var $2,$1;
  49792. queue=_st($Queue())._new();
  49793. _st(queue)._nextPut_("index1");
  49794. $2=_st(queue)._nextIfAbsent_("empty");
  49795. $ctx1.sendIdx["nextIfAbsent:"]=1;
  49796. $1=_st($2).__eq("index1");
  49797. $ctx1.sendIdx["="]=1;
  49798. self._assert_($1);
  49799. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  49800. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  49801. args: [],
  49802. source: "testNextIfAbsent\x0a\x09| queue |\x0a\x09queue := Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent: 'empty') = 'index1'.\x0a\x09self deny: (queue nextIfAbsent: 'empty') = 'index1'",
  49803. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  49804. referencedClasses: ["Queue"]
  49805. }),
  49806. globals.QueueTest);
  49807. smalltalk.addMethod(
  49808. smalltalk.method({
  49809. selector: "testQueueNext",
  49810. protocol: 'tests',
  49811. fn: function (){
  49812. var self=this;
  49813. var queue;
  49814. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  49815. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  49816. return smalltalk.withContext(function($ctx1) {
  49817. var $1,$2,$4,$3,$6,$5;
  49818. queue=_st($Queue())._new();
  49819. $1=queue;
  49820. _st($1)._nextPut_("index1");
  49821. $ctx1.sendIdx["nextPut:"]=1;
  49822. $2=_st($1)._nextPut_("index2");
  49823. $4=_st(queue)._next();
  49824. $ctx1.sendIdx["next"]=1;
  49825. $3=_st($4).__eq("index1");
  49826. $ctx1.sendIdx["="]=1;
  49827. self._assert_($3);
  49828. $6=_st(queue)._next();
  49829. $ctx1.sendIdx["next"]=2;
  49830. $5=_st($6).__eq("index");
  49831. self._deny_($5);
  49832. self._should_raise_((function(){
  49833. return smalltalk.withContext(function($ctx2) {
  49834. return _st(queue)._next();
  49835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  49836. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  49837. args: [],
  49838. source: "testQueueNext\x0a\x09| queue | \x0a\x09queue := Queue new.\x0a\x09queue \x0a\x09\x09nextPut: 'index1';\x0a\x09\x09nextPut: 'index2'.\x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should: [ queue next ] raise: Error",
  49839. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  49840. referencedClasses: ["Queue", "Error"]
  49841. }),
  49842. globals.QueueTest);
  49843. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  49844. smalltalk.addMethod(
  49845. smalltalk.method({
  49846. selector: "testAtRandomNumber",
  49847. protocol: 'tests',
  49848. fn: function (){
  49849. var self=this;
  49850. var val;
  49851. return smalltalk.withContext(function($ctx1) {
  49852. (100)._timesRepeat_((function(){
  49853. return smalltalk.withContext(function($ctx2) {
  49854. val=(10)._atRandom();
  49855. val;
  49856. self._assert_(_st(val).__gt((0)));
  49857. $ctx2.sendIdx["assert:"]=1;
  49858. return self._assert_(_st(val).__lt((11)));
  49859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  49860. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  49861. args: [],
  49862. source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
  49863. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  49864. referencedClasses: []
  49865. }),
  49866. globals.RandomTest);
  49867. smalltalk.addMethod(
  49868. smalltalk.method({
  49869. selector: "testAtRandomSequenceableCollection",
  49870. protocol: 'tests',
  49871. fn: function (){
  49872. var self=this;
  49873. var val;
  49874. return smalltalk.withContext(function($ctx1) {
  49875. var $3,$4,$2,$1;
  49876. (100)._timesRepeat_((function(){
  49877. return smalltalk.withContext(function($ctx2) {
  49878. val="abc"._atRandom();
  49879. val;
  49880. $3=_st(val).__eq("a");
  49881. $ctx2.sendIdx["="]=1;
  49882. $4=_st(val).__eq("b");
  49883. $ctx2.sendIdx["="]=2;
  49884. $2=_st($3).__or($4);
  49885. $1=_st($2).__or(_st(val).__eq("c"));
  49886. $ctx2.sendIdx["|"]=1;
  49887. return self._assert_($1);
  49888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  49889. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  49890. args: [],
  49891. source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
  49892. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  49893. referencedClasses: []
  49894. }),
  49895. globals.RandomTest);
  49896. smalltalk.addMethod(
  49897. smalltalk.method({
  49898. selector: "textNext",
  49899. protocol: 'tests',
  49900. fn: function (){
  49901. var self=this;
  49902. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  49903. return smalltalk.withContext(function($ctx1) {
  49904. var $1;
  49905. (10000)._timesRepeat_((function(){
  49906. var current,next;
  49907. return smalltalk.withContext(function($ctx2) {
  49908. next=_st(_st($Random())._new())._next();
  49909. next;
  49910. self._assert_(_st(next).__gt_eq((0)));
  49911. $ctx2.sendIdx["assert:"]=1;
  49912. self._assert_(_st(next).__lt((1)));
  49913. $1=_st(current).__eq(next);
  49914. $ctx2.sendIdx["="]=1;
  49915. self._deny_($1);
  49916. return _st(next).__eq(current);
  49917. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  49918. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  49919. args: [],
  49920. source: "textNext\x0a\x0a\x0910000 timesRepeat: [\x0a\x09\x09\x09| current next |\x0a\x09\x09\x09next := Random new next.\x0a\x09\x09\x09self assert: (next >= 0).\x0a\x09\x09\x09self assert: (next < 1).\x0a\x09\x09\x09self deny: current = next.\x0a\x09\x09\x09next = current ]",
  49921. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  49922. referencedClasses: ["Random"]
  49923. }),
  49924. globals.RandomTest);
  49925. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  49926. smalltalk.addMethod(
  49927. smalltalk.method({
  49928. selector: "collectionClass",
  49929. protocol: 'accessing',
  49930. fn: function (){
  49931. var self=this;
  49932. return smalltalk.withContext(function($ctx1) {
  49933. var $1;
  49934. $1=_st(self._class())._collectionClass();
  49935. return $1;
  49936. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  49937. args: [],
  49938. source: "collectionClass\x0a\x09^ self class collectionClass",
  49939. messageSends: ["collectionClass", "class"],
  49940. referencedClasses: []
  49941. }),
  49942. globals.StreamTest);
  49943. smalltalk.addMethod(
  49944. smalltalk.method({
  49945. selector: "newCollection",
  49946. protocol: 'accessing',
  49947. fn: function (){
  49948. var self=this;
  49949. return smalltalk.withContext(function($ctx1) {
  49950. var $1;
  49951. $1=_st(self._collectionClass())._new();
  49952. return $1;
  49953. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  49954. args: [],
  49955. source: "newCollection\x0a\x09^ self collectionClass new",
  49956. messageSends: ["new", "collectionClass"],
  49957. referencedClasses: []
  49958. }),
  49959. globals.StreamTest);
  49960. smalltalk.addMethod(
  49961. smalltalk.method({
  49962. selector: "newStream",
  49963. protocol: 'accessing',
  49964. fn: function (){
  49965. var self=this;
  49966. return smalltalk.withContext(function($ctx1) {
  49967. var $1;
  49968. $1=_st(_st(self._collectionClass())._new())._stream();
  49969. return $1;
  49970. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  49971. args: [],
  49972. source: "newStream\x0a\x09^ self collectionClass new stream",
  49973. messageSends: ["stream", "new", "collectionClass"],
  49974. referencedClasses: []
  49975. }),
  49976. globals.StreamTest);
  49977. smalltalk.addMethod(
  49978. smalltalk.method({
  49979. selector: "testAtStartAtEnd",
  49980. protocol: 'tests',
  49981. fn: function (){
  49982. var self=this;
  49983. var stream;
  49984. return smalltalk.withContext(function($ctx1) {
  49985. var $1,$2,$3,$4;
  49986. stream=self._newStream();
  49987. $1=_st(stream)._atStart();
  49988. $ctx1.sendIdx["atStart"]=1;
  49989. self._assert_($1);
  49990. $ctx1.sendIdx["assert:"]=1;
  49991. $2=_st(stream)._atEnd();
  49992. $ctx1.sendIdx["atEnd"]=1;
  49993. self._assert_($2);
  49994. $ctx1.sendIdx["assert:"]=2;
  49995. _st(stream)._nextPutAll_(self._newCollection());
  49996. $3=_st(stream)._atEnd();
  49997. $ctx1.sendIdx["atEnd"]=2;
  49998. self._assert_($3);
  49999. $4=_st(stream)._atStart();
  50000. $ctx1.sendIdx["atStart"]=2;
  50001. self._deny_($4);
  50002. $ctx1.sendIdx["deny:"]=1;
  50003. _st(stream)._position_((1));
  50004. self._deny_(_st(stream)._atEnd());
  50005. $ctx1.sendIdx["deny:"]=2;
  50006. self._deny_(_st(stream)._atStart());
  50007. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  50008. args: [],
  50009. source: "testAtStartAtEnd\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream atStart.\x0a\x09self assert: stream atEnd.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self assert: stream atEnd.\x0a\x09self deny: stream atStart.\x0a\x09\x0a\x09stream position: 1.\x0a\x09self deny: stream atEnd.\x0a\x09self deny: stream atStart",
  50010. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  50011. referencedClasses: []
  50012. }),
  50013. globals.StreamTest);
  50014. smalltalk.addMethod(
  50015. smalltalk.method({
  50016. selector: "testContents",
  50017. protocol: 'tests',
  50018. fn: function (){
  50019. var self=this;
  50020. var stream;
  50021. return smalltalk.withContext(function($ctx1) {
  50022. var $1,$2;
  50023. stream=self._newStream();
  50024. $1=stream;
  50025. $2=self._newCollection();
  50026. $ctx1.sendIdx["newCollection"]=1;
  50027. _st($1)._nextPutAll_($2);
  50028. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  50029. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  50030. args: [],
  50031. source: "testContents\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: self newCollection.\x0a\x09\x0a\x09self assert: stream contents equals: self newCollection",
  50032. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  50033. referencedClasses: []
  50034. }),
  50035. globals.StreamTest);
  50036. smalltalk.addMethod(
  50037. smalltalk.method({
  50038. selector: "testIsEmpty",
  50039. protocol: 'tests',
  50040. fn: function (){
  50041. var self=this;
  50042. var stream;
  50043. return smalltalk.withContext(function($ctx1) {
  50044. var $1;
  50045. stream=self._newStream();
  50046. $1=_st(stream)._isEmpty();
  50047. $ctx1.sendIdx["isEmpty"]=1;
  50048. self._assert_($1);
  50049. _st(stream)._nextPutAll_(self._newCollection());
  50050. self._deny_(_st(stream)._isEmpty());
  50051. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  50052. args: [],
  50053. source: "testIsEmpty\x0a\x09| stream |\x0a\x09\x0a\x09stream := self newStream.\x0a\x09self assert: stream isEmpty.\x0a\x09\x0a\x09stream nextPutAll: self newCollection.\x0a\x09self deny: stream isEmpty",
  50054. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  50055. referencedClasses: []
  50056. }),
  50057. globals.StreamTest);
  50058. smalltalk.addMethod(
  50059. smalltalk.method({
  50060. selector: "testPosition",
  50061. protocol: 'tests',
  50062. fn: function (){
  50063. var self=this;
  50064. var collection,stream;
  50065. return smalltalk.withContext(function($ctx1) {
  50066. var $1,$2,$3;
  50067. collection=self._newCollection();
  50068. stream=self._newStream();
  50069. _st(stream)._nextPutAll_(collection);
  50070. $1=_st(stream)._position();
  50071. $ctx1.sendIdx["position"]=1;
  50072. self._assert_equals_($1,_st(collection)._size());
  50073. $ctx1.sendIdx["assert:equals:"]=1;
  50074. _st(stream)._position_((0));
  50075. $2=_st(stream)._position();
  50076. $ctx1.sendIdx["position"]=2;
  50077. self._assert_equals_($2,(0));
  50078. $ctx1.sendIdx["assert:equals:"]=2;
  50079. _st(stream)._next();
  50080. $ctx1.sendIdx["next"]=1;
  50081. $3=_st(stream)._position();
  50082. $ctx1.sendIdx["position"]=3;
  50083. self._assert_equals_($3,(1));
  50084. $ctx1.sendIdx["assert:equals:"]=3;
  50085. _st(stream)._next();
  50086. self._assert_equals_(_st(stream)._position(),(2));
  50087. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  50088. args: [],
  50089. source: "testPosition\x0a\x09| collection stream |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream position equals: collection size.\x0a\x09\x0a\x09stream position: 0.\x0a\x09self assert: stream position equals: 0.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 1.\x0a\x09\x0a\x09stream next.\x0a\x09self assert: stream position equals: 2",
  50090. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  50091. referencedClasses: []
  50092. }),
  50093. globals.StreamTest);
  50094. smalltalk.addMethod(
  50095. smalltalk.method({
  50096. selector: "testReading",
  50097. protocol: 'tests',
  50098. fn: function (){
  50099. var self=this;
  50100. var stream,collection;
  50101. return smalltalk.withContext(function($ctx1) {
  50102. var $1,$2,$3;
  50103. collection=self._newCollection();
  50104. stream=self._newStream();
  50105. $1=stream;
  50106. _st($1)._nextPutAll_(collection);
  50107. $2=_st($1)._position_((0));
  50108. _st(collection)._do_((function(each){
  50109. return smalltalk.withContext(function($ctx2) {
  50110. $3=_st(stream)._next();
  50111. $ctx2.sendIdx["next"]=1;
  50112. return self._assert_equals_($3,each);
  50113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  50114. self._assert_(_st(_st(stream)._next())._isNil());
  50115. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  50116. args: [],
  50117. source: "testReading\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09stream \x0a\x09\x09nextPutAll: collection;\x0a\x09\x09position: 0.\x0a\x09\x0a\x09collection do: [ :each |\x0a\x09\x09self assert: stream next equals: each ].\x0a\x09\x09\x0a\x09self assert: stream next isNil",
  50118. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  50119. referencedClasses: []
  50120. }),
  50121. globals.StreamTest);
  50122. smalltalk.addMethod(
  50123. smalltalk.method({
  50124. selector: "testStreamContents",
  50125. protocol: 'tests',
  50126. fn: function (){
  50127. var self=this;
  50128. return self},
  50129. args: [],
  50130. source: "testStreamContents",
  50131. messageSends: [],
  50132. referencedClasses: []
  50133. }),
  50134. globals.StreamTest);
  50135. smalltalk.addMethod(
  50136. smalltalk.method({
  50137. selector: "testWrite",
  50138. protocol: 'tests',
  50139. fn: function (){
  50140. var self=this;
  50141. var stream,collection;
  50142. return smalltalk.withContext(function($ctx1) {
  50143. collection=self._newCollection();
  50144. stream=self._newStream();
  50145. _st(collection)._do_((function(each){
  50146. return smalltalk.withContext(function($ctx2) {
  50147. return _st(stream).__lt_lt(each);
  50148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  50149. self._assert_equals_(_st(stream)._contents(),collection);
  50150. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  50151. args: [],
  50152. source: "testWrite\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream << each ].\x0a\x09self assert: stream contents equals: collection",
  50153. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  50154. referencedClasses: []
  50155. }),
  50156. globals.StreamTest);
  50157. smalltalk.addMethod(
  50158. smalltalk.method({
  50159. selector: "testWriting",
  50160. protocol: 'tests',
  50161. fn: function (){
  50162. var self=this;
  50163. var stream,collection;
  50164. return smalltalk.withContext(function($ctx1) {
  50165. var $1;
  50166. collection=self._newCollection();
  50167. stream=self._newStream();
  50168. $ctx1.sendIdx["newStream"]=1;
  50169. _st(collection)._do_((function(each){
  50170. return smalltalk.withContext(function($ctx2) {
  50171. return _st(stream)._nextPut_(each);
  50172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  50173. $1=_st(stream)._contents();
  50174. $ctx1.sendIdx["contents"]=1;
  50175. self._assert_equals_($1,collection);
  50176. $ctx1.sendIdx["assert:equals:"]=1;
  50177. stream=self._newStream();
  50178. _st(stream)._nextPutAll_(collection);
  50179. self._assert_equals_(_st(stream)._contents(),collection);
  50180. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  50181. args: [],
  50182. source: "testWriting\x0a\x09| stream collection |\x0a\x09\x0a\x09collection := self newCollection.\x0a\x09stream := self newStream.\x0a\x09\x0a\x09collection do: [ :each | stream nextPut: each ].\x0a\x09self assert: stream contents equals: collection.\x0a\x09\x0a\x09stream := self newStream.\x0a\x09stream nextPutAll: collection.\x0a\x09self assert: stream contents equals: collection",
  50183. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  50184. referencedClasses: []
  50185. }),
  50186. globals.StreamTest);
  50187. smalltalk.addMethod(
  50188. smalltalk.method({
  50189. selector: "collectionClass",
  50190. protocol: 'accessing',
  50191. fn: function (){
  50192. var self=this;
  50193. return nil;
  50194. },
  50195. args: [],
  50196. source: "collectionClass\x0a\x09^ nil",
  50197. messageSends: [],
  50198. referencedClasses: []
  50199. }),
  50200. globals.StreamTest.klass);
  50201. smalltalk.addMethod(
  50202. smalltalk.method({
  50203. selector: "isAbstract",
  50204. protocol: 'testing',
  50205. fn: function (){
  50206. var self=this;
  50207. return smalltalk.withContext(function($ctx1) {
  50208. var $1;
  50209. $1=_st(self._collectionClass())._isNil();
  50210. return $1;
  50211. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  50212. args: [],
  50213. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  50214. messageSends: ["isNil", "collectionClass"],
  50215. referencedClasses: []
  50216. }),
  50217. globals.StreamTest.klass);
  50218. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  50219. smalltalk.addMethod(
  50220. smalltalk.method({
  50221. selector: "newCollection",
  50222. protocol: 'accessing',
  50223. fn: function (){
  50224. var self=this;
  50225. return smalltalk.withContext(function($ctx1) {
  50226. var $1;
  50227. $1=[true,(1),(3).__at((4)),"foo"];
  50228. return $1;
  50229. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  50230. args: [],
  50231. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  50232. messageSends: ["@"],
  50233. referencedClasses: []
  50234. }),
  50235. globals.ArrayStreamTest);
  50236. smalltalk.addMethod(
  50237. smalltalk.method({
  50238. selector: "collectionClass",
  50239. protocol: 'accessing',
  50240. fn: function (){
  50241. var self=this;
  50242. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  50243. return $Array();
  50244. },
  50245. args: [],
  50246. source: "collectionClass\x0a\x09^ Array",
  50247. messageSends: [],
  50248. referencedClasses: ["Array"]
  50249. }),
  50250. globals.ArrayStreamTest.klass);
  50251. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  50252. smalltalk.addMethod(
  50253. smalltalk.method({
  50254. selector: "newCollection",
  50255. protocol: 'accessing',
  50256. fn: function (){
  50257. var self=this;
  50258. return "hello world";
  50259. },
  50260. args: [],
  50261. source: "newCollection\x0a\x09^ 'hello world'",
  50262. messageSends: [],
  50263. referencedClasses: []
  50264. }),
  50265. globals.StringStreamTest);
  50266. smalltalk.addMethod(
  50267. smalltalk.method({
  50268. selector: "collectionClass",
  50269. protocol: 'accessing',
  50270. fn: function (){
  50271. var self=this;
  50272. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  50273. return $String();
  50274. },
  50275. args: [],
  50276. source: "collectionClass\x0a\x09^ String",
  50277. messageSends: [],
  50278. referencedClasses: ["String"]
  50279. }),
  50280. globals.StringStreamTest.klass);
  50281. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  50282. smalltalk.addMethod(
  50283. smalltalk.method({
  50284. selector: "testCopying",
  50285. protocol: 'tests',
  50286. fn: function (){
  50287. var self=this;
  50288. return smalltalk.withContext(function($ctx1) {
  50289. self._assert_equals_(nil._copy(),nil);
  50290. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  50291. args: [],
  50292. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  50293. messageSends: ["assert:equals:", "copy"],
  50294. referencedClasses: []
  50295. }),
  50296. globals.UndefinedTest);
  50297. smalltalk.addMethod(
  50298. smalltalk.method({
  50299. selector: "testDeepCopy",
  50300. protocol: 'tests',
  50301. fn: function (){
  50302. var self=this;
  50303. return smalltalk.withContext(function($ctx1) {
  50304. self._assert_(_st(nil._deepCopy()).__eq(nil));
  50305. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  50306. args: [],
  50307. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  50308. messageSends: ["assert:", "=", "deepCopy"],
  50309. referencedClasses: []
  50310. }),
  50311. globals.UndefinedTest);
  50312. smalltalk.addMethod(
  50313. smalltalk.method({
  50314. selector: "testIfNil",
  50315. protocol: 'tests',
  50316. fn: function (){
  50317. var self=this;
  50318. return smalltalk.withContext(function($ctx1) {
  50319. var $1,$3,$2,$4,$6,$5,$receiver;
  50320. if(($receiver = nil) == null || $receiver.isNil){
  50321. $1=true;
  50322. } else {
  50323. $1=nil;
  50324. };
  50325. self._assert_equals_($1,true);
  50326. $ctx1.sendIdx["assert:equals:"]=1;
  50327. if(($receiver = nil) == null || $receiver.isNil){
  50328. $3=nil;
  50329. } else {
  50330. $3=true;
  50331. };
  50332. $2=_st($3).__eq(true);
  50333. $ctx1.sendIdx["="]=1;
  50334. self._deny_($2);
  50335. $ctx1.sendIdx["deny:"]=1;
  50336. if(($receiver = nil) == null || $receiver.isNil){
  50337. $4=true;
  50338. } else {
  50339. $4=false;
  50340. };
  50341. self._assert_equals_($4,true);
  50342. if(($receiver = nil) == null || $receiver.isNil){
  50343. $6=false;
  50344. } else {
  50345. $6=true;
  50346. };
  50347. $5=_st($6).__eq(true);
  50348. self._deny_($5);
  50349. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  50350. args: [],
  50351. source: "testIfNil\x0a\x09self assert: (nil ifNil: [ true ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ]) = true.\x0a\x09self assert: (nil ifNil: [ true ] ifNotNil: [ false ]) equals: true.\x0a\x09self deny: (nil ifNotNil: [ true ] ifNil: [ false ]) = true",
  50352. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  50353. referencedClasses: []
  50354. }),
  50355. globals.UndefinedTest);
  50356. smalltalk.addMethod(
  50357. smalltalk.method({
  50358. selector: "testIsNil",
  50359. protocol: 'tests',
  50360. fn: function (){
  50361. var self=this;
  50362. return smalltalk.withContext(function($ctx1) {
  50363. self._assert_(nil._isNil());
  50364. self._deny_(nil._notNil());
  50365. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  50366. args: [],
  50367. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  50368. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  50369. referencedClasses: []
  50370. }),
  50371. globals.UndefinedTest);
  50372. });
  50373. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  50374. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  50375. smalltalk.addPackage('Compiler-Tests');
  50376. smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50377. smalltalk.addClass('ASTParsingTest', globals.TestCase, [], 'Compiler-Tests');
  50378. smalltalk.addMethod(
  50379. smalltalk.method({
  50380. selector: "analyze:forClass:",
  50381. protocol: 'convenience',
  50382. fn: function (aNode,aClass){
  50383. var self=this;
  50384. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  50385. return smalltalk.withContext(function($ctx1) {
  50386. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  50387. return aNode;
  50388. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTParsingTest)})},
  50389. args: ["aNode", "aClass"],
  50390. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  50391. messageSends: ["visit:", "on:"],
  50392. referencedClasses: ["SemanticAnalyzer"]
  50393. }),
  50394. globals.ASTParsingTest);
  50395. smalltalk.addMethod(
  50396. smalltalk.method({
  50397. selector: "parse:",
  50398. protocol: 'parsing',
  50399. fn: function (aString){
  50400. var self=this;
  50401. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  50402. return smalltalk.withContext(function($ctx1) {
  50403. var $1;
  50404. $1=_st($Smalltalk())._parse_(aString);
  50405. return $1;
  50406. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTParsingTest)})},
  50407. args: ["aString"],
  50408. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  50409. messageSends: ["parse:"],
  50410. referencedClasses: ["Smalltalk"]
  50411. }),
  50412. globals.ASTParsingTest);
  50413. smalltalk.addMethod(
  50414. smalltalk.method({
  50415. selector: "parse:forClass:",
  50416. protocol: 'parsing',
  50417. fn: function (aString,aClass){
  50418. var self=this;
  50419. return smalltalk.withContext(function($ctx1) {
  50420. var $1;
  50421. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  50422. return $1;
  50423. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTParsingTest)})},
  50424. args: ["aString", "aClass"],
  50425. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  50426. messageSends: ["analyze:forClass:", "parse:"],
  50427. referencedClasses: []
  50428. }),
  50429. globals.ASTParsingTest);
  50430. smalltalk.addClass('ASTPCNodeVisitorTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  50431. smalltalk.addMethod(
  50432. smalltalk.method({
  50433. selector: "astPCNodeVisitor",
  50434. protocol: 'factory',
  50435. fn: function (){
  50436. var self=this;
  50437. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  50438. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  50439. return smalltalk.withContext(function($ctx1) {
  50440. var $2,$3,$4,$5,$1;
  50441. $2=_st($ASTPCNodeVisitor())._new();
  50442. $ctx1.sendIdx["new"]=1;
  50443. $3=$2;
  50444. $4=_st(_st($AIContext())._new())._yourself();
  50445. $ctx1.sendIdx["yourself"]=1;
  50446. _st($3)._context_($4);
  50447. $5=_st($2)._yourself();
  50448. $1=$5;
  50449. return $1;
  50450. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},globals.ASTPCNodeVisitorTest)})},
  50451. args: [],
  50452. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  50453. messageSends: ["context:", "new", "yourself"],
  50454. referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
  50455. }),
  50456. globals.ASTPCNodeVisitorTest);
  50457. smalltalk.addMethod(
  50458. smalltalk.method({
  50459. selector: "astPCNodeVisitorForSelector:",
  50460. protocol: 'factory',
  50461. fn: function (aString){
  50462. var self=this;
  50463. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  50464. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  50465. return smalltalk.withContext(function($ctx1) {
  50466. var $2,$3,$4,$5,$1;
  50467. $2=_st($ASTPCNodeVisitor())._new();
  50468. $ctx1.sendIdx["new"]=1;
  50469. _st($2)._selector_(aString);
  50470. $3=$2;
  50471. $4=_st(_st($AIContext())._new())._yourself();
  50472. $ctx1.sendIdx["yourself"]=1;
  50473. _st($3)._context_($4);
  50474. $5=_st($2)._yourself();
  50475. $1=$5;
  50476. return $1;
  50477. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},globals.ASTPCNodeVisitorTest)})},
  50478. args: ["aString"],
  50479. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  50480. messageSends: ["selector:", "new", "context:", "yourself"],
  50481. referencedClasses: ["ASTPCNodeVisitor", "AIContext"]
  50482. }),
  50483. globals.ASTPCNodeVisitorTest);
  50484. smalltalk.addMethod(
  50485. smalltalk.method({
  50486. selector: "testJSStatementNode",
  50487. protocol: 'tests',
  50488. fn: function (){
  50489. var self=this;
  50490. var ast,visitor;
  50491. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50492. return smalltalk.withContext(function($ctx1) {
  50493. var $1,$2;
  50494. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  50495. $1=self._astPCNodeVisitor();
  50496. _st($1)._visit_(ast);
  50497. $2=_st($1)._currentNode();
  50498. self._assert_(_st($2)._isJSStatementNode());
  50499. return self}, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
  50500. args: [],
  50501. source: "testJSStatementNode\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <consolee.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  50502. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
  50503. referencedClasses: ["Object"]
  50504. }),
  50505. globals.ASTPCNodeVisitorTest);
  50506. smalltalk.addMethod(
  50507. smalltalk.method({
  50508. selector: "testMessageSend",
  50509. protocol: 'tests',
  50510. fn: function (){
  50511. var self=this;
  50512. var ast;
  50513. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50514. return smalltalk.withContext(function($ctx1) {
  50515. var $1,$2;
  50516. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  50517. $1=self._astPCNodeVisitorForSelector_("yourself");
  50518. _st($1)._visit_(ast);
  50519. $2=_st($1)._currentNode();
  50520. self._assert_equals_(_st($2)._selector(),"yourself");
  50521. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  50522. args: [],
  50523. source: "testMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo self asString yourself. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  50524. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  50525. referencedClasses: ["Object"]
  50526. }),
  50527. globals.ASTPCNodeVisitorTest);
  50528. smalltalk.addMethod(
  50529. smalltalk.method({
  50530. selector: "testMessageSendWithBlocks",
  50531. protocol: 'tests',
  50532. fn: function (){
  50533. var self=this;
  50534. var ast;
  50535. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50536. return smalltalk.withContext(function($ctx1) {
  50537. var $1,$2;
  50538. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  50539. $1=self._astPCNodeVisitorForSelector_("yourself");
  50540. _st($1)._visit_(ast);
  50541. $2=_st($1)._currentNode();
  50542. self._assert_equals_(_st($2)._selector(),"yourself");
  50543. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  50544. args: [],
  50545. source: "testMessageSendWithBlocks\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'",
  50546. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  50547. referencedClasses: ["Object"]
  50548. }),
  50549. globals.ASTPCNodeVisitorTest);
  50550. smalltalk.addMethod(
  50551. smalltalk.method({
  50552. selector: "testMessageSendWithInlining",
  50553. protocol: 'tests',
  50554. fn: function (){
  50555. var self=this;
  50556. var ast;
  50557. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50558. return smalltalk.withContext(function($ctx1) {
  50559. var $3,$4,$2,$1,$5,$6;
  50560. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  50561. $ctx1.sendIdx["parse:forClass:"]=1;
  50562. $3=self._astPCNodeVisitorForSelector_("yourself");
  50563. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  50564. _st($3)._visit_(ast);
  50565. $ctx1.sendIdx["visit:"]=1;
  50566. $4=_st($3)._currentNode();
  50567. $ctx1.sendIdx["currentNode"]=1;
  50568. $2=$4;
  50569. $1=_st($2)._selector();
  50570. $ctx1.sendIdx["selector"]=1;
  50571. self._assert_equals_($1,"yourself");
  50572. $ctx1.sendIdx["assert:equals:"]=1;
  50573. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  50574. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  50575. _st($5)._visit_(ast);
  50576. $6=_st($5)._currentNode();
  50577. self._assert_equals_(_st($6)._selector(),"asBoolean");
  50578. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  50579. args: [],
  50580. source: "testMessageSendWithInlining\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'yourself')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'yourself'.\x0a\x09\x09\x0a\x09ast := self parse: 'foo true ifTrue: [ self asString yourself ]. ^ self asBoolean' forClass: Object.\x0a\x09self assert: ((self astPCNodeVisitorForSelector: 'asBoolean')\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) selector equals: 'asBoolean'",
  50581. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"],
  50582. referencedClasses: ["Object"]
  50583. }),
  50584. globals.ASTPCNodeVisitorTest);
  50585. smalltalk.addMethod(
  50586. smalltalk.method({
  50587. selector: "testNoMessageSend",
  50588. protocol: 'tests',
  50589. fn: function (){
  50590. var self=this;
  50591. var ast;
  50592. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50593. return smalltalk.withContext(function($ctx1) {
  50594. var $1,$2;
  50595. ast=self._parse_forClass_("foo ^ self",$Object());
  50596. $1=self._astPCNodeVisitor();
  50597. _st($1)._visit_(ast);
  50598. $2=_st($1)._currentNode();
  50599. self._assert_(_st($2)._isNil());
  50600. return self}, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)})},
  50601. args: [],
  50602. source: "testNoMessageSend\x0a\x09| ast |\x0a\x09\x0a\x09ast := self parse: 'foo ^ self' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isNil",
  50603. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"],
  50604. referencedClasses: ["Object"]
  50605. }),
  50606. globals.ASTPCNodeVisitorTest);
  50607. smalltalk.addMethod(
  50608. smalltalk.method({
  50609. selector: "testPC",
  50610. protocol: 'tests',
  50611. fn: function (){
  50612. var self=this;
  50613. var ast,visitor;
  50614. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  50615. return smalltalk.withContext(function($ctx1) {
  50616. var $1,$2;
  50617. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  50618. $1=self._astPCNodeVisitor();
  50619. _st($1)._visit_(ast);
  50620. $2=_st($1)._currentNode();
  50621. self._assert_(_st($2)._isJSStatementNode());
  50622. return self}, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)})},
  50623. args: [],
  50624. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  50625. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"],
  50626. referencedClasses: ["Object"]
  50627. }),
  50628. globals.ASTPCNodeVisitorTest);
  50629. smalltalk.addClass('ASTPositionTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  50630. smalltalk.addMethod(
  50631. smalltalk.method({
  50632. selector: "testNodeAtPosition",
  50633. protocol: 'tests',
  50634. fn: function (){
  50635. var self=this;
  50636. var node;
  50637. return smalltalk.withContext(function($ctx1) {
  50638. var $3,$4,$2,$1,$7,$8,$6,$5;
  50639. node=self._parse_("yourself\x0a\x09^ self");
  50640. $ctx1.sendIdx["parse:"]=1;
  50641. $3=node;
  50642. $4=(2).__at((4));
  50643. $ctx1.sendIdx["@"]=1;
  50644. $2=_st($3)._navigationNodeAt_ifAbsent_($4,(function(){
  50645. return nil;
  50646. }));
  50647. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  50648. $1=_st($2)._source();
  50649. self._assert_equals_($1,"self");
  50650. $ctx1.sendIdx["assert:equals:"]=1;
  50651. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  50652. $ctx1.sendIdx["parse:"]=2;
  50653. $7=node;
  50654. $8=(2).__at((7));
  50655. $ctx1.sendIdx["@"]=2;
  50656. $6=_st($7)._navigationNodeAt_ifAbsent_($8,(function(){
  50657. return nil;
  50658. }));
  50659. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  50660. $5=_st($6)._selector();
  50661. $ctx1.sendIdx["selector"]=1;
  50662. self._assert_equals_($5,"ifTrue:");
  50663. $ctx1.sendIdx["assert:equals:"]=2;
  50664. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  50665. self._assert_equals_(_st(_st(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  50666. return nil;
  50667. })))._selector(),"foo");
  50668. return self}, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},globals.ASTPositionTest)})},
  50669. args: [],
  50670. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@4 ifAbsent: [ nil ]) source equals: 'self'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09true ifTrue: [ 1 ]'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@7 ifAbsent: [ nil ]) selector equals: 'ifTrue:'.\x0a\x09\x0a\x09node := self parse: 'foo\x0a\x09self foo; bar; baz'.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  50671. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"],
  50672. referencedClasses: []
  50673. }),
  50674. globals.ASTPositionTest);
  50675. smalltalk.addClass('CodeGeneratorTest', globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  50676. smalltalk.addMethod(
  50677. smalltalk.method({
  50678. selector: "codeGeneratorClass",
  50679. protocol: 'accessing',
  50680. fn: function (){
  50681. var self=this;
  50682. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  50683. return $CodeGenerator();
  50684. },
  50685. args: [],
  50686. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  50687. messageSends: [],
  50688. referencedClasses: ["CodeGenerator"]
  50689. }),
  50690. globals.CodeGeneratorTest);
  50691. smalltalk.addMethod(
  50692. smalltalk.method({
  50693. selector: "compiler",
  50694. protocol: 'factory',
  50695. fn: function (){
  50696. var self=this;
  50697. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  50698. return smalltalk.withContext(function($ctx1) {
  50699. var $2,$3,$1;
  50700. $2=_st($Compiler())._new();
  50701. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  50702. $3=_st($2)._yourself();
  50703. $1=$3;
  50704. return $1;
  50705. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.CodeGeneratorTest)})},
  50706. args: [],
  50707. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  50708. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  50709. referencedClasses: ["Compiler"]
  50710. }),
  50711. globals.CodeGeneratorTest);
  50712. smalltalk.addMethod(
  50713. smalltalk.method({
  50714. selector: "setUp",
  50715. protocol: 'initialization',
  50716. fn: function (){
  50717. var self=this;
  50718. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  50719. return smalltalk.withContext(function($ctx1) {
  50720. self["@receiver"]=_st($DoIt())._new();
  50721. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.CodeGeneratorTest)})},
  50722. args: [],
  50723. source: "setUp\x0a\x09receiver := DoIt new",
  50724. messageSends: ["new"],
  50725. referencedClasses: ["DoIt"]
  50726. }),
  50727. globals.CodeGeneratorTest);
  50728. smalltalk.addMethod(
  50729. smalltalk.method({
  50730. selector: "should:receiver:return:",
  50731. protocol: 'testing',
  50732. fn: function (aString,anObject,aResult){
  50733. var self=this;
  50734. var method,result;
  50735. return smalltalk.withContext(function($ctx1) {
  50736. var $1,$2;
  50737. self["@receiver"]=anObject;
  50738. $1=self._compiler();
  50739. $2=_st(anObject)._class();
  50740. $ctx1.sendIdx["class"]=1;
  50741. method=_st($1)._install_forClass_protocol_(aString,$2,"tests");
  50742. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  50743. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  50744. self._assert_equals_(aResult,result);
  50745. return self}, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},globals.CodeGeneratorTest)})},
  50746. args: ["aString", "anObject", "aResult"],
  50747. source: "should: aString receiver: anObject return: aResult\x0a\x09| method result |\x0a\x0a\x09receiver := anObject.\x0a\x09method := self compiler install: aString forClass: anObject class protocol: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09anObject class removeCompiledMethod: method.\x0a\x09self assert: aResult equals: result",
  50748. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"],
  50749. referencedClasses: []
  50750. }),
  50751. globals.CodeGeneratorTest);
  50752. smalltalk.addMethod(
  50753. smalltalk.method({
  50754. selector: "should:return:",
  50755. protocol: 'testing',
  50756. fn: function (aString,anObject){
  50757. var self=this;
  50758. return smalltalk.withContext(function($ctx1) {
  50759. var $1;
  50760. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  50761. return $1;
  50762. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.CodeGeneratorTest)})},
  50763. args: ["aString", "anObject"],
  50764. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  50765. messageSends: ["should:receiver:return:"],
  50766. referencedClasses: []
  50767. }),
  50768. globals.CodeGeneratorTest);
  50769. smalltalk.addMethod(
  50770. smalltalk.method({
  50771. selector: "tearDown",
  50772. protocol: 'initialization',
  50773. fn: function (){
  50774. var self=this;
  50775. return self},
  50776. args: [],
  50777. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  50778. messageSends: [],
  50779. referencedClasses: []
  50780. }),
  50781. globals.CodeGeneratorTest);
  50782. smalltalk.addMethod(
  50783. smalltalk.method({
  50784. selector: "testAssignment",
  50785. protocol: 'tests',
  50786. fn: function (){
  50787. var self=this;
  50788. return smalltalk.withContext(function($ctx1) {
  50789. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  50790. $ctx1.sendIdx["should:return:"]=1;
  50791. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  50792. $ctx1.sendIdx["should:return:"]=2;
  50793. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  50794. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{},globals.CodeGeneratorTest)})},
  50795. args: [],
  50796. source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1",
  50797. messageSends: ["should:return:"],
  50798. referencedClasses: []
  50799. }),
  50800. globals.CodeGeneratorTest);
  50801. smalltalk.addMethod(
  50802. smalltalk.method({
  50803. selector: "testBackslashSelectors",
  50804. protocol: 'tests',
  50805. fn: function (){
  50806. var self=this;
  50807. return smalltalk.withContext(function($ctx1) {
  50808. self._should_return_("\x5c arg ^ 4",(4));
  50809. $ctx1.sendIdx["should:return:"]=1;
  50810. self._should_return_("\x5c\x5c arg ^ 42",(42));
  50811. return self}, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},globals.CodeGeneratorTest)})},
  50812. args: [],
  50813. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  50814. messageSends: ["should:return:"],
  50815. referencedClasses: []
  50816. }),
  50817. globals.CodeGeneratorTest);
  50818. smalltalk.addMethod(
  50819. smalltalk.method({
  50820. selector: "testBlockReturn",
  50821. protocol: 'tests',
  50822. fn: function (){
  50823. var self=this;
  50824. return smalltalk.withContext(function($ctx1) {
  50825. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  50826. $ctx1.sendIdx["should:return:"]=1;
  50827. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  50828. $ctx1.sendIdx["should:return:"]=2;
  50829. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  50830. return self}, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},globals.CodeGeneratorTest)})},
  50831. args: [],
  50832. source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
  50833. messageSends: ["should:return:"],
  50834. referencedClasses: []
  50835. }),
  50836. globals.CodeGeneratorTest);
  50837. smalltalk.addMethod(
  50838. smalltalk.method({
  50839. selector: "testCascades",
  50840. protocol: 'tests',
  50841. fn: function (){
  50842. var self=this;
  50843. return smalltalk.withContext(function($ctx1) {
  50844. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  50845. return self}, function($ctx1) {$ctx1.fill(self,"testCascades",{},globals.CodeGeneratorTest)})},
  50846. args: [],
  50847. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  50848. messageSends: ["should:return:"],
  50849. referencedClasses: []
  50850. }),
  50851. globals.CodeGeneratorTest);
  50852. smalltalk.addMethod(
  50853. smalltalk.method({
  50854. selector: "testCascadesWithInlining",
  50855. protocol: 'tests',
  50856. fn: function (){
  50857. var self=this;
  50858. return smalltalk.withContext(function($ctx1) {
  50859. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  50860. $ctx1.sendIdx["should:return:"]=1;
  50861. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  50862. return self}, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},globals.CodeGeneratorTest)})},
  50863. args: [],
  50864. source: "testCascadesWithInlining\x0a\x09\x0a\x09self should: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]' return: 2",
  50865. messageSends: ["should:return:"],
  50866. referencedClasses: []
  50867. }),
  50868. globals.CodeGeneratorTest);
  50869. smalltalk.addMethod(
  50870. smalltalk.method({
  50871. selector: "testDynamicArrayElementsOrdered",
  50872. protocol: 'tests',
  50873. fn: function (){
  50874. var self=this;
  50875. return smalltalk.withContext(function($ctx1) {
  50876. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  50877. $ctx1.sendIdx["should:return:"]=1;
  50878. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  50879. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},globals.CodeGeneratorTest)})},
  50880. args: [],
  50881. source: "testDynamicArrayElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a' return: #(1 2).",
  50882. messageSends: ["should:return:"],
  50883. referencedClasses: []
  50884. }),
  50885. globals.CodeGeneratorTest);
  50886. smalltalk.addMethod(
  50887. smalltalk.method({
  50888. selector: "testDynamicDictionaryElementsOrdered",
  50889. protocol: 'tests',
  50890. fn: function (){
  50891. var self=this;
  50892. return smalltalk.withContext(function($ctx1) {
  50893. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 'foo'.\x0a\x09^ #{ x->1. 'bar'->(true ifTrue: [ 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  50894. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},globals.CodeGeneratorTest)})},
  50895. args: [],
  50896. source: "testDynamicDictionaryElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := ''foo''.\x0a\x09^ #{ x->1. ''bar''->(true ifTrue: [ 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  50897. messageSends: ["should:return:"],
  50898. referencedClasses: []
  50899. }),
  50900. globals.CodeGeneratorTest);
  50901. smalltalk.addMethod(
  50902. smalltalk.method({
  50903. selector: "testDynamicDictionaryWithMoreArrows",
  50904. protocol: 'tests',
  50905. fn: function (){
  50906. var self=this;
  50907. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  50908. return smalltalk.withContext(function($ctx1) {
  50909. var $2,$1;
  50910. $2=_st((1).__minus_gt((2))).__minus_gt((3));
  50911. $ctx1.sendIdx["->"]=1;
  50912. $1=_st($HashedCollection())._with_($2);
  50913. self._should_return_("foo ^ #{1->2->3}",$1);
  50914. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)})},
  50915. args: [],
  50916. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  50917. messageSends: ["should:return:", "with:", "->"],
  50918. referencedClasses: ["HashedCollection"]
  50919. }),
  50920. globals.CodeGeneratorTest);
  50921. smalltalk.addMethod(
  50922. smalltalk.method({
  50923. selector: "testGlobalVar",
  50924. protocol: 'tests',
  50925. fn: function (){
  50926. var self=this;
  50927. function $BlockClosure(){return globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  50928. return smalltalk.withContext(function($ctx1) {
  50929. self._should_return_("foo ^ eval class",$BlockClosure());
  50930. $ctx1.sendIdx["should:return:"]=1;
  50931. self._should_return_("foo ^ Math cos: 0",(1));
  50932. $ctx1.sendIdx["should:return:"]=2;
  50933. self._should_return_("foo ^ NonExistingVar",nil);
  50934. return self}, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},globals.CodeGeneratorTest)})},
  50935. args: [],
  50936. source: "testGlobalVar\x0a\x09self should: 'foo ^ eval class' return: BlockClosure.\x0a\x09self should: 'foo ^ Math cos: 0' return: 1.\x0a\x09self should: 'foo ^ NonExistingVar' return: nil",
  50937. messageSends: ["should:return:"],
  50938. referencedClasses: ["BlockClosure"]
  50939. }),
  50940. globals.CodeGeneratorTest);
  50941. smalltalk.addMethod(
  50942. smalltalk.method({
  50943. selector: "testInnerTemporalDependentElementsOrdered",
  50944. protocol: 'tests',
  50945. fn: function (){
  50946. var self=this;
  50947. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  50948. return smalltalk.withContext(function($ctx1) {
  50949. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  50950. $2="foo".__minus_gt($Array());
  50951. $ctx1.sendIdx["->"]=1;
  50952. $3="bar".__minus_gt((2));
  50953. $ctx1.sendIdx["->"]=2;
  50954. $1=[$2,$3];
  50955. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  50956. $ctx1.sendIdx["should:return:"]=1;
  50957. $5="foo".__minus_gt($Array());
  50958. $ctx1.sendIdx["->"]=3;
  50959. $6="bar".__minus_gt((2));
  50960. $ctx1.sendIdx["->"]=4;
  50961. $4=[$5,$6];
  50962. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  50963. $ctx1.sendIdx["should:return:"]=2;
  50964. $8="foo".__minus_gt((1));
  50965. $ctx1.sendIdx["->"]=5;
  50966. $9="bar".__minus_gt((2));
  50967. $ctx1.sendIdx["->"]=6;
  50968. $7=[$8,$9];
  50969. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  50970. $ctx1.sendIdx["should:return:"]=3;
  50971. $11="foo".__minus_gt((1));
  50972. $ctx1.sendIdx["->"]=7;
  50973. $10=[$11,"bar".__minus_gt((2))];
  50974. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  50975. $ctx1.sendIdx["should:return:"]=4;
  50976. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",globals.HashedCollection._newFromPairs_(["foo",(1),"bar",(2)]));
  50977. return self}, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},globals.CodeGeneratorTest)})},
  50978. args: [],
  50979. source: "testInnerTemporalDependentElementsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(x := 2)\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->Array. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: ''foo''->x with: ''bar''->(true ifTrue: [ x := 2 ])\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: {'foo'->1. 'bar'->2}.\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ #{ ''foo''->x. ''bar''->(true ifTrue: [ x := 2 ]) }\x0a' return: #{'foo'->1. 'bar'->2}.",
  50980. messageSends: ["should:return:", "->"],
  50981. referencedClasses: ["Array"]
  50982. }),
  50983. globals.CodeGeneratorTest);
  50984. smalltalk.addMethod(
  50985. smalltalk.method({
  50986. selector: "testJSStatement",
  50987. protocol: 'tests',
  50988. fn: function (){
  50989. var self=this;
  50990. return smalltalk.withContext(function($ctx1) {
  50991. self._should_return_("foo <return 2+3>",(5));
  50992. return self}, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},globals.CodeGeneratorTest)})},
  50993. args: [],
  50994. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  50995. messageSends: ["should:return:"],
  50996. referencedClasses: []
  50997. }),
  50998. globals.CodeGeneratorTest);
  50999. smalltalk.addMethod(
  51000. smalltalk.method({
  51001. selector: "testLexicalScope",
  51002. protocol: 'tests',
  51003. fn: function (){
  51004. var self=this;
  51005. return smalltalk.withContext(function($ctx1) {
  51006. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  51007. return self}, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},globals.CodeGeneratorTest)})},
  51008. args: [],
  51009. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  51010. messageSends: ["should:return:"],
  51011. referencedClasses: []
  51012. }),
  51013. globals.CodeGeneratorTest);
  51014. smalltalk.addMethod(
  51015. smalltalk.method({
  51016. selector: "testLiterals",
  51017. protocol: 'tests',
  51018. fn: function (){
  51019. var self=this;
  51020. return smalltalk.withContext(function($ctx1) {
  51021. self._should_return_("foo ^ 1",(1));
  51022. $ctx1.sendIdx["should:return:"]=1;
  51023. self._should_return_("foo ^ 'hello'","hello");
  51024. $ctx1.sendIdx["should:return:"]=2;
  51025. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  51026. $ctx1.sendIdx["should:return:"]=3;
  51027. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  51028. $ctx1.sendIdx["should:return:"]=4;
  51029. self._should_return_("foo ^ true",true);
  51030. $ctx1.sendIdx["should:return:"]=5;
  51031. self._should_return_("foo ^ false",false);
  51032. $ctx1.sendIdx["should:return:"]=6;
  51033. self._should_return_("foo ^ #{1->2. 3->4}",globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  51034. $ctx1.sendIdx["should:return:"]=7;
  51035. self._should_return_("foo ^ #hello","hello");
  51036. $ctx1.sendIdx["should:return:"]=8;
  51037. self._should_return_("foo ^ $h","h");
  51038. $ctx1.sendIdx["should:return:"]=9;
  51039. self._should_return_("foo ^ -123.456",(-123.456));
  51040. $ctx1.sendIdx["should:return:"]=10;
  51041. self._should_return_("foo ^ -2.5e4",(-25000));
  51042. return self}, function($ctx1) {$ctx1.fill(self,"testLiterals",{},globals.CodeGeneratorTest)})},
  51043. args: [],
  51044. source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ $h' return: 'h'.\x0a\x09self should: 'foo ^ -123.456' return: -123.456.\x0a\x09self should: 'foo ^ -2.5e4' return: -25000.",
  51045. messageSends: ["should:return:"],
  51046. referencedClasses: []
  51047. }),
  51048. globals.CodeGeneratorTest);
  51049. smalltalk.addMethod(
  51050. smalltalk.method({
  51051. selector: "testLocalReturn",
  51052. protocol: 'tests',
  51053. fn: function (){
  51054. var self=this;
  51055. return smalltalk.withContext(function($ctx1) {
  51056. self._should_return_("foo ^ 1",(1));
  51057. $ctx1.sendIdx["should:return:"]=1;
  51058. self._should_return_("foo ^ 1 + 1",(2));
  51059. $ctx1.sendIdx["should:return:"]=2;
  51060. self._should_return_("foo ",self["@receiver"]);
  51061. $ctx1.sendIdx["should:return:"]=3;
  51062. self._should_return_("foo self asString",self["@receiver"]);
  51063. $ctx1.sendIdx["should:return:"]=4;
  51064. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  51065. return self}, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},globals.CodeGeneratorTest)})},
  51066. args: [],
  51067. source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
  51068. messageSends: ["should:return:"],
  51069. referencedClasses: []
  51070. }),
  51071. globals.CodeGeneratorTest);
  51072. smalltalk.addMethod(
  51073. smalltalk.method({
  51074. selector: "testMessageSends",
  51075. protocol: 'tests',
  51076. fn: function (){
  51077. var self=this;
  51078. return smalltalk.withContext(function($ctx1) {
  51079. self._should_return_("foo ^ 1 asString","1");
  51080. $ctx1.sendIdx["should:return:"]=1;
  51081. self._should_return_("foo ^ 1 + 1",(2));
  51082. $ctx1.sendIdx["should:return:"]=2;
  51083. self._should_return_("foo ^ 1 + 2 * 3",(9));
  51084. $ctx1.sendIdx["should:return:"]=3;
  51085. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  51086. $ctx1.sendIdx["should:return:"]=4;
  51087. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  51088. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},globals.CodeGeneratorTest)})},
  51089. args: [],
  51090. source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
  51091. messageSends: ["should:return:"],
  51092. referencedClasses: []
  51093. }),
  51094. globals.CodeGeneratorTest);
  51095. smalltalk.addMethod(
  51096. smalltalk.method({
  51097. selector: "testMultipleSequences",
  51098. protocol: 'tests',
  51099. fn: function (){
  51100. var self=this;
  51101. return smalltalk.withContext(function($ctx1) {
  51102. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  51103. return self}, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},globals.CodeGeneratorTest)})},
  51104. args: [],
  51105. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  51106. messageSends: ["should:return:"],
  51107. referencedClasses: []
  51108. }),
  51109. globals.CodeGeneratorTest);
  51110. smalltalk.addMethod(
  51111. smalltalk.method({
  51112. selector: "testMutableLiterals",
  51113. protocol: 'tests',
  51114. fn: function (){
  51115. var self=this;
  51116. return smalltalk.withContext(function($ctx1) {
  51117. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  51118. return self}, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},globals.CodeGeneratorTest)})},
  51119. args: [],
  51120. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  51121. messageSends: ["should:return:"],
  51122. referencedClasses: []
  51123. }),
  51124. globals.CodeGeneratorTest);
  51125. smalltalk.addMethod(
  51126. smalltalk.method({
  51127. selector: "testNestedIfTrue",
  51128. protocol: 'tests',
  51129. fn: function (){
  51130. var self=this;
  51131. return smalltalk.withContext(function($ctx1) {
  51132. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  51133. $ctx1.sendIdx["should:return:"]=1;
  51134. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  51135. $ctx1.sendIdx["should:return:"]=2;
  51136. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  51137. $ctx1.sendIdx["should:return:"]=3;
  51138. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  51139. return self}, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},globals.CodeGeneratorTest)})},
  51140. args: [],
  51141. source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
  51142. messageSends: ["should:return:"],
  51143. referencedClasses: []
  51144. }),
  51145. globals.CodeGeneratorTest);
  51146. smalltalk.addMethod(
  51147. smalltalk.method({
  51148. selector: "testNestedSends",
  51149. protocol: 'tests',
  51150. fn: function (){
  51151. var self=this;
  51152. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  51153. return smalltalk.withContext(function($ctx1) {
  51154. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",_st(_st($Point())._x_y_((2).__at((3)),(4)))._asString());
  51155. return self}, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},globals.CodeGeneratorTest)})},
  51156. args: [],
  51157. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  51158. messageSends: ["should:return:", "asString", "x:y:", "@"],
  51159. referencedClasses: ["Point"]
  51160. }),
  51161. globals.CodeGeneratorTest);
  51162. smalltalk.addMethod(
  51163. smalltalk.method({
  51164. selector: "testNonLocalReturn",
  51165. protocol: 'tests',
  51166. fn: function (){
  51167. var self=this;
  51168. return smalltalk.withContext(function($ctx1) {
  51169. self._should_return_("foo [ ^ 1 ] value",(1));
  51170. $ctx1.sendIdx["should:return:"]=1;
  51171. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  51172. $ctx1.sendIdx["should:return:"]=2;
  51173. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  51174. $ctx1.sendIdx["should:return:"]=3;
  51175. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  51176. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},globals.CodeGeneratorTest)})},
  51177. args: [],
  51178. source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
  51179. messageSends: ["should:return:"],
  51180. referencedClasses: []
  51181. }),
  51182. globals.CodeGeneratorTest);
  51183. smalltalk.addMethod(
  51184. smalltalk.method({
  51185. selector: "testPascalCaseGlobal",
  51186. protocol: 'tests',
  51187. fn: function (){
  51188. var self=this;
  51189. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51190. return smalltalk.withContext(function($ctx1) {
  51191. self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
  51192. $ctx1.sendIdx["should:return:"]=1;
  51193. self._should_return_("foo ^NonExistent",nil);
  51194. return self}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},globals.CodeGeneratorTest)})},
  51195. args: [],
  51196. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  51197. messageSends: ["should:return:", "at:", "globals"],
  51198. referencedClasses: ["Smalltalk"]
  51199. }),
  51200. globals.CodeGeneratorTest);
  51201. smalltalk.addMethod(
  51202. smalltalk.method({
  51203. selector: "testSendReceiverAndArgumentsOrdered",
  51204. protocol: 'tests',
  51205. fn: function (){
  51206. var self=this;
  51207. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  51208. return smalltalk.withContext(function($ctx1) {
  51209. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  51210. $ctx1.sendIdx["should:return:"]=1;
  51211. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  51212. return self}, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},globals.CodeGeneratorTest)})},
  51213. args: [],
  51214. source: "testSendReceiverAndArgumentsOrdered\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a' return: #(1 2).\x0a\x0a\x09self should: 'foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a' return: {Array. 2}.",
  51215. messageSends: ["should:return:"],
  51216. referencedClasses: ["Array"]
  51217. }),
  51218. globals.CodeGeneratorTest);
  51219. smalltalk.addMethod(
  51220. smalltalk.method({
  51221. selector: "testSuperSend",
  51222. protocol: 'tests',
  51223. fn: function (){
  51224. var self=this;
  51225. return smalltalk.withContext(function($ctx1) {
  51226. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  51227. return self}, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},globals.CodeGeneratorTest)})},
  51228. args: [],
  51229. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  51230. messageSends: ["should:receiver:return:"],
  51231. referencedClasses: []
  51232. }),
  51233. globals.CodeGeneratorTest);
  51234. smalltalk.addMethod(
  51235. smalltalk.method({
  51236. selector: "testTempVariables",
  51237. protocol: 'tests',
  51238. fn: function (){
  51239. var self=this;
  51240. return smalltalk.withContext(function($ctx1) {
  51241. self._should_return_("foo | a | ^ a",nil);
  51242. $ctx1.sendIdx["should:return:"]=1;
  51243. self._should_return_("foo | AVariable | ^ AVariable",nil);
  51244. $ctx1.sendIdx["should:return:"]=2;
  51245. self._should_return_("foo | a b c | ^ c",nil);
  51246. $ctx1.sendIdx["should:return:"]=3;
  51247. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  51248. $ctx1.sendIdx["should:return:"]=4;
  51249. self._should_return_("foo | a | a:= 1. ^ a",(1));
  51250. $ctx1.sendIdx["should:return:"]=5;
  51251. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  51252. return self}, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},globals.CodeGeneratorTest)})},
  51253. args: [],
  51254. source: "testTempVariables\x0a\x09self should: 'foo | a | ^ a' return: nil.\x0a\x09self should: 'foo | AVariable | ^ AVariable' return: nil.\x0a\x09self should: 'foo | a b c | ^ c' return: nil.\x0a\x09self should: 'foo | a | [ | d | ^ d ] value' return: nil.\x0a\x09\x0a\x09self should: 'foo | a | a:= 1. ^ a' return: 1.\x0a\x09self should: 'foo | AVariable | AVariable := 1. ^ AVariable' return: 1.",
  51255. messageSends: ["should:return:"],
  51256. referencedClasses: []
  51257. }),
  51258. globals.CodeGeneratorTest);
  51259. smalltalk.addMethod(
  51260. smalltalk.method({
  51261. selector: "testThisContext",
  51262. protocol: 'tests',
  51263. fn: function (){
  51264. var self=this;
  51265. return smalltalk.withContext(function($ctx1) {
  51266. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  51267. return self}, function($ctx1) {$ctx1.fill(self,"testThisContext",{},globals.CodeGeneratorTest)})},
  51268. args: [],
  51269. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  51270. messageSends: ["should:return:"],
  51271. referencedClasses: []
  51272. }),
  51273. globals.CodeGeneratorTest);
  51274. smalltalk.addMethod(
  51275. smalltalk.method({
  51276. selector: "testifFalse",
  51277. protocol: 'tests',
  51278. fn: function (){
  51279. var self=this;
  51280. return smalltalk.withContext(function($ctx1) {
  51281. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  51282. $ctx1.sendIdx["should:return:"]=1;
  51283. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  51284. $ctx1.sendIdx["should:return:"]=2;
  51285. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  51286. $ctx1.sendIdx["should:return:"]=3;
  51287. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  51288. return self}, function($ctx1) {$ctx1.fill(self,"testifFalse",{},globals.CodeGeneratorTest)})},
  51289. args: [],
  51290. source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
  51291. messageSends: ["should:return:"],
  51292. referencedClasses: []
  51293. }),
  51294. globals.CodeGeneratorTest);
  51295. smalltalk.addMethod(
  51296. smalltalk.method({
  51297. selector: "testifFalseIfTrue",
  51298. protocol: 'tests',
  51299. fn: function (){
  51300. var self=this;
  51301. return smalltalk.withContext(function($ctx1) {
  51302. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  51303. $ctx1.sendIdx["should:return:"]=1;
  51304. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  51305. $ctx1.sendIdx["should:return:"]=2;
  51306. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  51307. $ctx1.sendIdx["should:return:"]=3;
  51308. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  51309. return self}, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},globals.CodeGeneratorTest)})},
  51310. args: [],
  51311. source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
  51312. messageSends: ["should:return:"],
  51313. referencedClasses: []
  51314. }),
  51315. globals.CodeGeneratorTest);
  51316. smalltalk.addMethod(
  51317. smalltalk.method({
  51318. selector: "testifNil",
  51319. protocol: 'tests',
  51320. fn: function (){
  51321. var self=this;
  51322. return smalltalk.withContext(function($ctx1) {
  51323. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  51324. $ctx1.sendIdx["should:return:"]=1;
  51325. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  51326. $ctx1.sendIdx["should:return:"]=2;
  51327. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  51328. $ctx1.sendIdx["should:return:"]=3;
  51329. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  51330. return self}, function($ctx1) {$ctx1.fill(self,"testifNil",{},globals.CodeGeneratorTest)})},
  51331. args: [],
  51332. source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
  51333. messageSends: ["should:return:"],
  51334. referencedClasses: []
  51335. }),
  51336. globals.CodeGeneratorTest);
  51337. smalltalk.addMethod(
  51338. smalltalk.method({
  51339. selector: "testifNilIfNotNil",
  51340. protocol: 'tests',
  51341. fn: function (){
  51342. var self=this;
  51343. return smalltalk.withContext(function($ctx1) {
  51344. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  51345. $ctx1.sendIdx["should:return:"]=1;
  51346. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  51347. $ctx1.sendIdx["should:return:"]=2;
  51348. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  51349. $ctx1.sendIdx["should:return:"]=3;
  51350. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  51351. return self}, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},globals.CodeGeneratorTest)})},
  51352. args: [],
  51353. source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
  51354. messageSends: ["should:return:"],
  51355. referencedClasses: []
  51356. }),
  51357. globals.CodeGeneratorTest);
  51358. smalltalk.addMethod(
  51359. smalltalk.method({
  51360. selector: "testifNotNil",
  51361. protocol: 'tests',
  51362. fn: function (){
  51363. var self=this;
  51364. return smalltalk.withContext(function($ctx1) {
  51365. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  51366. $ctx1.sendIdx["should:return:"]=1;
  51367. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  51368. $ctx1.sendIdx["should:return:"]=2;
  51369. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  51370. $ctx1.sendIdx["should:return:"]=3;
  51371. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  51372. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},globals.CodeGeneratorTest)})},
  51373. args: [],
  51374. source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
  51375. messageSends: ["should:return:"],
  51376. referencedClasses: []
  51377. }),
  51378. globals.CodeGeneratorTest);
  51379. smalltalk.addMethod(
  51380. smalltalk.method({
  51381. selector: "testifNotNilWithArgument",
  51382. protocol: 'tests',
  51383. fn: function (){
  51384. var self=this;
  51385. return smalltalk.withContext(function($ctx1) {
  51386. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  51387. $ctx1.sendIdx["should:return:"]=1;
  51388. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  51389. $ctx1.sendIdx["should:return:"]=2;
  51390. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  51391. $ctx1.sendIdx["should:return:"]=3;
  51392. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  51393. $ctx1.sendIdx["should:return:"]=4;
  51394. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  51395. $ctx1.sendIdx["should:return:"]=5;
  51396. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  51397. return self}, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},globals.CodeGeneratorTest)})},
  51398. args: [],
  51399. source: "testifNotNilWithArgument\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ]' return: nil.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]' return: 5.\x0a\x09\x0a\x09self should: 'foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]' return: 5",
  51400. messageSends: ["should:return:"],
  51401. referencedClasses: []
  51402. }),
  51403. globals.CodeGeneratorTest);
  51404. smalltalk.addMethod(
  51405. smalltalk.method({
  51406. selector: "testifTrue",
  51407. protocol: 'tests',
  51408. fn: function (){
  51409. var self=this;
  51410. return smalltalk.withContext(function($ctx1) {
  51411. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  51412. $ctx1.sendIdx["should:return:"]=1;
  51413. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  51414. $ctx1.sendIdx["should:return:"]=2;
  51415. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  51416. $ctx1.sendIdx["should:return:"]=3;
  51417. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  51418. return self}, function($ctx1) {$ctx1.fill(self,"testifTrue",{},globals.CodeGeneratorTest)})},
  51419. args: [],
  51420. source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
  51421. messageSends: ["should:return:"],
  51422. referencedClasses: []
  51423. }),
  51424. globals.CodeGeneratorTest);
  51425. smalltalk.addMethod(
  51426. smalltalk.method({
  51427. selector: "testifTrueIfFalse",
  51428. protocol: 'tests',
  51429. fn: function (){
  51430. var self=this;
  51431. return smalltalk.withContext(function($ctx1) {
  51432. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  51433. $ctx1.sendIdx["should:return:"]=1;
  51434. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  51435. $ctx1.sendIdx["should:return:"]=2;
  51436. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  51437. $ctx1.sendIdx["should:return:"]=3;
  51438. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  51439. return self}, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},globals.CodeGeneratorTest)})},
  51440. args: [],
  51441. source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
  51442. messageSends: ["should:return:"],
  51443. referencedClasses: []
  51444. }),
  51445. globals.CodeGeneratorTest);
  51446. smalltalk.addClass('ASTInterpreterTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  51447. smalltalk.addMethod(
  51448. smalltalk.method({
  51449. selector: "analyze:forClass:",
  51450. protocol: 'parsing',
  51451. fn: function (aNode,aClass){
  51452. var self=this;
  51453. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  51454. return smalltalk.withContext(function($ctx1) {
  51455. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  51456. return aNode;
  51457. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTInterpreterTest)})},
  51458. args: ["aNode", "aClass"],
  51459. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  51460. messageSends: ["visit:", "on:"],
  51461. referencedClasses: ["SemanticAnalyzer"]
  51462. }),
  51463. globals.ASTInterpreterTest);
  51464. smalltalk.addMethod(
  51465. smalltalk.method({
  51466. selector: "interpret:receiver:withArguments:",
  51467. protocol: 'private',
  51468. fn: function (aString,anObject,aDictionary){
  51469. var self=this;
  51470. var ctx,ast,interpreter;
  51471. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  51472. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  51473. return smalltalk.withContext(function($ctx1) {
  51474. var $1,$2,$3,$5,$6,$4,$receiver;
  51475. interpreter=_st($ASTInterpreter())._new();
  51476. $ctx1.sendIdx["new"]=1;
  51477. ast=self._parse_forClass_(aString,_st(anObject)._class());
  51478. $1=_st($AIContext())._new();
  51479. _st($1)._receiver_(anObject);
  51480. _st($1)._interpreter_(interpreter);
  51481. $2=_st($1)._yourself();
  51482. ctx=$2;
  51483. $3=_st(ast)._sequenceNode();
  51484. if(($receiver = $3) == null || $receiver.isNil){
  51485. $3;
  51486. } else {
  51487. var sequence;
  51488. sequence=$receiver;
  51489. _st(_st(sequence)._temps())._do_((function(each){
  51490. return smalltalk.withContext(function($ctx2) {
  51491. return _st(ctx)._defineLocal_(each);
  51492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  51493. };
  51494. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  51495. return smalltalk.withContext(function($ctx2) {
  51496. return _st(ctx)._localAt_put_(key,value);
  51497. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  51498. $5=interpreter;
  51499. _st($5)._context_(ctx);
  51500. _st($5)._interpret_(_st(ast)._nextChild());
  51501. _st($5)._proceed();
  51502. $6=_st($5)._result();
  51503. $4=$6;
  51504. return $4;
  51505. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},globals.ASTInterpreterTest)})},
  51506. args: ["aString", "anObject", "aDictionary"],
  51507. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09\x22The food is a methodNode. Interpret the sequenceNode only\x22\x0a\x09\x0a\x09| ctx ast interpreter |\x0a\x09\x0a\x09interpreter := ASTInterpreter new.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: interpreter;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09\x0a\x09^ interpreter\x0a\x09\x09context: ctx;\x0a\x09\x09interpret: ast nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  51508. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"],
  51509. referencedClasses: ["ASTInterpreter", "AIContext"]
  51510. }),
  51511. globals.ASTInterpreterTest);
  51512. smalltalk.addMethod(
  51513. smalltalk.method({
  51514. selector: "parse:",
  51515. protocol: 'parsing',
  51516. fn: function (aString){
  51517. var self=this;
  51518. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51519. return smalltalk.withContext(function($ctx1) {
  51520. var $1;
  51521. $1=_st($Smalltalk())._parse_(aString);
  51522. return $1;
  51523. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTInterpreterTest)})},
  51524. args: ["aString"],
  51525. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  51526. messageSends: ["parse:"],
  51527. referencedClasses: ["Smalltalk"]
  51528. }),
  51529. globals.ASTInterpreterTest);
  51530. smalltalk.addMethod(
  51531. smalltalk.method({
  51532. selector: "parse:forClass:",
  51533. protocol: 'parsing',
  51534. fn: function (aString,aClass){
  51535. var self=this;
  51536. return smalltalk.withContext(function($ctx1) {
  51537. var $1;
  51538. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  51539. return $1;
  51540. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTInterpreterTest)})},
  51541. args: ["aString", "aClass"],
  51542. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  51543. messageSends: ["analyze:forClass:", "parse:"],
  51544. referencedClasses: []
  51545. }),
  51546. globals.ASTInterpreterTest);
  51547. smalltalk.addMethod(
  51548. smalltalk.method({
  51549. selector: "should:receiver:return:",
  51550. protocol: 'testing',
  51551. fn: function (aString,anObject,aResult){
  51552. var self=this;
  51553. return smalltalk.withContext(function($ctx1) {
  51554. var $1;
  51555. self["@receiver"]=anObject;
  51556. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],globals.HashedCollection._newFromPairs_([])),aResult);
  51557. return $1;
  51558. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},globals.ASTInterpreterTest)})},
  51559. args: ["aString", "anObject", "aResult"],
  51560. source: "should: aString receiver: anObject return: aResult\x0a\x09receiver := anObject.\x0a\x09\x0a\x09^ self \x0a\x09\x09assert: (self interpret: aString receiver: receiver withArguments: #{})\x0a\x09\x09equals: aResult",
  51561. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"],
  51562. referencedClasses: []
  51563. }),
  51564. globals.ASTInterpreterTest);
  51565. smalltalk.addMethod(
  51566. smalltalk.method({
  51567. selector: "should:return:",
  51568. protocol: 'testing',
  51569. fn: function (aString,anObject){
  51570. var self=this;
  51571. return smalltalk.withContext(function($ctx1) {
  51572. var $1;
  51573. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  51574. return $1;
  51575. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.ASTInterpreterTest)})},
  51576. args: ["aString", "anObject"],
  51577. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  51578. messageSends: ["should:receiver:return:"],
  51579. referencedClasses: []
  51580. }),
  51581. globals.ASTInterpreterTest);
  51582. smalltalk.addClass('ASTDebuggerTest', globals.ASTInterpreterTest, [], 'Compiler-Tests');
  51583. smalltalk.addMethod(
  51584. smalltalk.method({
  51585. selector: "interpret:receiver:withArguments:",
  51586. protocol: 'private',
  51587. fn: function (aString,anObject,aDictionary){
  51588. var self=this;
  51589. var ctx,ast,debugger_;
  51590. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  51591. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  51592. function $ASTDebugger(){return globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  51593. return smalltalk.withContext(function($ctx1) {
  51594. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  51595. $1=_st($AIContext())._new();
  51596. $ctx1.sendIdx["new"]=1;
  51597. _st($1)._receiver_(anObject);
  51598. _st($1)._interpreter_(_st($ASTInterpreter())._new());
  51599. $2=_st($1)._yourself();
  51600. ctx=$2;
  51601. ast=self._parse_forClass_(aString,_st(anObject)._class());
  51602. $3=_st(ast)._sequenceNode();
  51603. if(($receiver = $3) == null || $receiver.isNil){
  51604. $3;
  51605. } else {
  51606. var sequence;
  51607. sequence=$receiver;
  51608. _st(_st(sequence)._temps())._do_((function(each){
  51609. return smalltalk.withContext(function($ctx2) {
  51610. return _st(ctx)._defineLocal_(each);
  51611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  51612. };
  51613. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  51614. return smalltalk.withContext(function($ctx2) {
  51615. return _st(ctx)._localAt_put_(key,value);
  51616. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)})}));
  51617. $4=_st(ctx)._interpreter();
  51618. $ctx1.sendIdx["interpreter"]=1;
  51619. _st($4)._context_(ctx);
  51620. $ctx1.sendIdx["context:"]=1;
  51621. _st(_st(ctx)._interpreter())._node_(_st(ast)._nextChild());
  51622. debugger_=_st($ASTDebugger())._context_(ctx);
  51623. $6=debugger_;
  51624. _st($6)._proceed();
  51625. $7=_st($6)._result();
  51626. $5=$7;
  51627. return $5;
  51628. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},globals.ASTDebuggerTest)})},
  51629. args: ["aString", "anObject", "aDictionary"],
  51630. source: "interpret: aString receiver: anObject withArguments: aDictionary\x0a\x09| ctx ast debugger |\x0a\x09\x0a\x09ctx := AIContext new\x0a\x09\x09receiver: anObject;\x0a\x09\x09interpreter: ASTInterpreter new;\x0a\x09\x09yourself.\x0a\x09ast := self parse: aString forClass: anObject class.\x0a\x09\x09\x0a\x09\x22Define locals for the context\x22\x0a\x09ast sequenceNode ifNotNil: [ :sequence |\x0a\x09\x09sequence temps do: [ :each |\x0a\x09\x09\x09ctx defineLocal: each ] ].\x0a\x09\x0a\x09aDictionary keysAndValuesDo: [ :key :value |\x0a\x09\x09ctx localAt: key put: value ].\x0a\x09ctx interpreter context: ctx.\x0a\x09\x0a\x09ctx interpreter node: ast nextChild.\x0a\x09\x0a\x09debugger := ASTDebugger context: ctx.\x0a\x09\x0a\x09^ debugger \x0a\x09\x09proceed; \x0a\x09\x09result",
  51631. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"],
  51632. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"]
  51633. }),
  51634. globals.ASTDebuggerTest);
  51635. smalltalk.addClass('InliningCodeGeneratorTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  51636. smalltalk.addMethod(
  51637. smalltalk.method({
  51638. selector: "codeGeneratorClass",
  51639. protocol: 'accessing',
  51640. fn: function (){
  51641. var self=this;
  51642. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  51643. return $InliningCodeGenerator();
  51644. },
  51645. args: [],
  51646. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  51647. messageSends: [],
  51648. referencedClasses: ["InliningCodeGenerator"]
  51649. }),
  51650. globals.InliningCodeGeneratorTest);
  51651. smalltalk.addClass('ScopeVarTest', globals.TestCase, [], 'Compiler-Tests');
  51652. smalltalk.addMethod(
  51653. smalltalk.method({
  51654. selector: "testClassRefVar",
  51655. protocol: 'tests',
  51656. fn: function (){
  51657. var self=this;
  51658. var node;
  51659. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  51660. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  51661. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  51662. return smalltalk.withContext(function($ctx1) {
  51663. var $1,$2,$3,$4;
  51664. $1=_st($VariableNode())._new();
  51665. $ctx1.sendIdx["new"]=1;
  51666. _st($1)._value_("Object");
  51667. $2=_st($1)._yourself();
  51668. node=$2;
  51669. $3=_st($SemanticAnalyzer())._new();
  51670. $ctx1.sendIdx["new"]=2;
  51671. _st($3)._pushScope_(_st($MethodLexicalScope())._new());
  51672. $4=_st($3)._visit_(node);
  51673. self._assert_(_st(_st(node)._binding())._isClassRefVar());
  51674. return self}, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},globals.ScopeVarTest)})},
  51675. args: [],
  51676. source: "testClassRefVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new \x0a\x09\x09pushScope: MethodLexicalScope new;\x0a\x09\x09visit: node.\x0a\x09self assert: node binding isClassRefVar",
  51677. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"],
  51678. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"]
  51679. }),
  51680. globals.ScopeVarTest);
  51681. smalltalk.addMethod(
  51682. smalltalk.method({
  51683. selector: "testInstanceVar",
  51684. protocol: 'tests',
  51685. fn: function (){
  51686. var self=this;
  51687. var node,scope;
  51688. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  51689. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  51690. return smalltalk.withContext(function($ctx1) {
  51691. var $1,$2;
  51692. $1=_st($VariableNode())._new();
  51693. $ctx1.sendIdx["new"]=1;
  51694. _st($1)._value_("bzzz");
  51695. $2=_st($1)._yourself();
  51696. node=$2;
  51697. scope=_st($MethodLexicalScope())._new();
  51698. _st(scope)._addIVar_("bzzz");
  51699. self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  51700. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},globals.ScopeVarTest)})},
  51701. args: [],
  51702. source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
  51703. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"],
  51704. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  51705. }),
  51706. globals.ScopeVarTest);
  51707. smalltalk.addMethod(
  51708. smalltalk.method({
  51709. selector: "testPseudoVar",
  51710. protocol: 'tests',
  51711. fn: function (){
  51712. var self=this;
  51713. var node,pseudoVars;
  51714. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  51715. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  51716. return smalltalk.withContext(function($ctx1) {
  51717. var $1,$2;
  51718. pseudoVars=["self", "super", "true", "false", "nil"];
  51719. _st(pseudoVars)._do_((function(each){
  51720. return smalltalk.withContext(function($ctx2) {
  51721. $1=_st($VariableNode())._new();
  51722. $ctx2.sendIdx["new"]=1;
  51723. _st($1)._value_(each);
  51724. $2=_st($1)._yourself();
  51725. node=$2;
  51726. node;
  51727. return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  51728. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  51729. return self}, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},globals.ScopeVarTest)})},
  51730. args: [],
  51731. source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
  51732. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"],
  51733. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  51734. }),
  51735. globals.ScopeVarTest);
  51736. smalltalk.addMethod(
  51737. smalltalk.method({
  51738. selector: "testTempVar",
  51739. protocol: 'tests',
  51740. fn: function (){
  51741. var self=this;
  51742. var node,scope;
  51743. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  51744. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  51745. return smalltalk.withContext(function($ctx1) {
  51746. var $1,$2;
  51747. $1=_st($VariableNode())._new();
  51748. $ctx1.sendIdx["new"]=1;
  51749. _st($1)._value_("bzzz");
  51750. $2=_st($1)._yourself();
  51751. node=$2;
  51752. scope=_st($MethodLexicalScope())._new();
  51753. _st(scope)._addTemp_("bzzz");
  51754. self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  51755. return self}, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},globals.ScopeVarTest)})},
  51756. args: [],
  51757. source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
  51758. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"],
  51759. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  51760. }),
  51761. globals.ScopeVarTest);
  51762. smalltalk.addMethod(
  51763. smalltalk.method({
  51764. selector: "testUnknownVar",
  51765. protocol: 'tests',
  51766. fn: function (){
  51767. var self=this;
  51768. var node;
  51769. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  51770. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  51771. return smalltalk.withContext(function($ctx1) {
  51772. var $1,$2;
  51773. $1=_st($VariableNode())._new();
  51774. $ctx1.sendIdx["new"]=1;
  51775. _st($1)._value_("bzzz");
  51776. $2=_st($1)._yourself();
  51777. node=$2;
  51778. self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  51779. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},globals.ScopeVarTest)})},
  51780. args: [],
  51781. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  51782. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"],
  51783. referencedClasses: ["VariableNode", "MethodLexicalScope"]
  51784. }),
  51785. globals.ScopeVarTest);
  51786. smalltalk.addClass('SemanticAnalyzerTest', globals.TestCase, ['analyzer'], 'Compiler-Tests');
  51787. smalltalk.addMethod(
  51788. smalltalk.method({
  51789. selector: "setUp",
  51790. protocol: 'running',
  51791. fn: function (){
  51792. var self=this;
  51793. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  51794. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  51795. return smalltalk.withContext(function($ctx1) {
  51796. self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
  51797. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.SemanticAnalyzerTest)})},
  51798. args: [],
  51799. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  51800. messageSends: ["on:"],
  51801. referencedClasses: ["SemanticAnalyzer", "Object"]
  51802. }),
  51803. globals.SemanticAnalyzerTest);
  51804. smalltalk.addMethod(
  51805. smalltalk.method({
  51806. selector: "testAssignment",
  51807. protocol: 'tests',
  51808. fn: function (){
  51809. var self=this;
  51810. var src,ast;
  51811. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51812. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  51813. return smalltalk.withContext(function($ctx1) {
  51814. src="foo self := 1";
  51815. ast=_st($Smalltalk())._parse_(src);
  51816. self._should_raise_((function(){
  51817. return smalltalk.withContext(function($ctx2) {
  51818. return _st(self["@analyzer"])._visit_(ast);
  51819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$InvalidAssignmentError());
  51820. return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51821. args: [],
  51822. source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
  51823. messageSends: ["parse:", "should:raise:", "visit:"],
  51824. referencedClasses: ["Smalltalk", "InvalidAssignmentError"]
  51825. }),
  51826. globals.SemanticAnalyzerTest);
  51827. smalltalk.addMethod(
  51828. smalltalk.method({
  51829. selector: "testNonLocalReturn",
  51830. protocol: 'tests',
  51831. fn: function (){
  51832. var self=this;
  51833. var src,ast;
  51834. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51835. return smalltalk.withContext(function($ctx1) {
  51836. src="foo | a | a + 1. ^ a";
  51837. ast=_st($Smalltalk())._parse_(src);
  51838. _st(self["@analyzer"])._visit_(ast);
  51839. self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  51840. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51841. args: [],
  51842. source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
  51843. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"],
  51844. referencedClasses: ["Smalltalk"]
  51845. }),
  51846. globals.SemanticAnalyzerTest);
  51847. smalltalk.addMethod(
  51848. smalltalk.method({
  51849. selector: "testNonLocalReturn2",
  51850. protocol: 'tests',
  51851. fn: function (){
  51852. var self=this;
  51853. var src,ast;
  51854. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51855. return smalltalk.withContext(function($ctx1) {
  51856. src="foo | a | a + 1. [ [ ^ a] ]";
  51857. ast=_st($Smalltalk())._parse_(src);
  51858. _st(self["@analyzer"])._visit_(ast);
  51859. self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  51860. return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51861. args: [],
  51862. source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
  51863. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"],
  51864. referencedClasses: ["Smalltalk"]
  51865. }),
  51866. globals.SemanticAnalyzerTest);
  51867. smalltalk.addMethod(
  51868. smalltalk.method({
  51869. selector: "testScope",
  51870. protocol: 'tests',
  51871. fn: function (){
  51872. var self=this;
  51873. var src,ast;
  51874. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51875. return smalltalk.withContext(function($ctx1) {
  51876. var $4,$3,$2,$1;
  51877. src="foo | a | a + 1. [ | b | b := a ]";
  51878. ast=_st($Smalltalk())._parse_(src);
  51879. _st(self["@analyzer"])._visit_(ast);
  51880. $4=_st(_st(_st(ast)._nodes())._first())._nodes();
  51881. $ctx1.sendIdx["nodes"]=1;
  51882. $3=_st($4)._last();
  51883. $2=_st($3)._scope();
  51884. $ctx1.sendIdx["scope"]=1;
  51885. $1=_st($2).__eq_eq(_st(ast)._scope());
  51886. self._deny_($1);
  51887. return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51888. args: [],
  51889. source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
  51890. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
  51891. referencedClasses: ["Smalltalk"]
  51892. }),
  51893. globals.SemanticAnalyzerTest);
  51894. smalltalk.addMethod(
  51895. smalltalk.method({
  51896. selector: "testScope2",
  51897. protocol: 'tests',
  51898. fn: function (){
  51899. var self=this;
  51900. var src,ast;
  51901. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51902. return smalltalk.withContext(function($ctx1) {
  51903. var $8,$7,$6,$5,$4,$3,$2,$1;
  51904. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  51905. ast=_st($Smalltalk())._parse_(src);
  51906. _st(self["@analyzer"])._visit_(ast);
  51907. $8=_st(_st(_st(ast)._nodes())._first())._nodes();
  51908. $ctx1.sendIdx["nodes"]=3;
  51909. $7=_st($8)._last();
  51910. $6=_st($7)._nodes();
  51911. $ctx1.sendIdx["nodes"]=2;
  51912. $5=_st($6)._first();
  51913. $ctx1.sendIdx["first"]=2;
  51914. $4=_st($5)._nodes();
  51915. $ctx1.sendIdx["nodes"]=1;
  51916. $3=_st($4)._first();
  51917. $ctx1.sendIdx["first"]=1;
  51918. $2=_st($3)._scope();
  51919. $ctx1.sendIdx["scope"]=1;
  51920. $1=_st($2).__eq_eq(_st(ast)._scope());
  51921. self._deny_($1);
  51922. return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51923. args: [],
  51924. source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
  51925. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
  51926. referencedClasses: ["Smalltalk"]
  51927. }),
  51928. globals.SemanticAnalyzerTest);
  51929. smalltalk.addMethod(
  51930. smalltalk.method({
  51931. selector: "testScopeLevel",
  51932. protocol: 'tests',
  51933. fn: function (){
  51934. var self=this;
  51935. var src,ast;
  51936. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51937. return smalltalk.withContext(function($ctx1) {
  51938. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  51939. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  51940. ast=_st($Smalltalk())._parse_(src);
  51941. _st(self["@analyzer"])._visit_(ast);
  51942. $2=_st(ast)._scope();
  51943. $ctx1.sendIdx["scope"]=1;
  51944. $1=_st($2)._scopeLevel();
  51945. $ctx1.sendIdx["scopeLevel"]=1;
  51946. self._assert_equals_($1,(1));
  51947. $ctx1.sendIdx["assert:equals:"]=1;
  51948. $10=_st(_st(_st(ast)._nodes())._first())._nodes();
  51949. $ctx1.sendIdx["nodes"]=3;
  51950. $9=_st($10)._last();
  51951. $8=_st($9)._nodes();
  51952. $ctx1.sendIdx["nodes"]=2;
  51953. $7=_st($8)._first();
  51954. $ctx1.sendIdx["first"]=2;
  51955. $6=_st($7)._nodes();
  51956. $ctx1.sendIdx["nodes"]=1;
  51957. $5=_st($6)._first();
  51958. $ctx1.sendIdx["first"]=1;
  51959. $4=_st($5)._scope();
  51960. $3=_st($4)._scopeLevel();
  51961. self._assert_equals_($3,(3));
  51962. return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51963. args: [],
  51964. source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  51965. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"],
  51966. referencedClasses: ["Smalltalk"]
  51967. }),
  51968. globals.SemanticAnalyzerTest);
  51969. smalltalk.addMethod(
  51970. smalltalk.method({
  51971. selector: "testUnknownVariables",
  51972. protocol: 'tests',
  51973. fn: function (){
  51974. var self=this;
  51975. var src,ast;
  51976. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  51977. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  51978. return smalltalk.withContext(function($ctx1) {
  51979. src="foo | a | b + a";
  51980. ast=_st($Smalltalk())._parse_(src);
  51981. self._should_raise_((function(){
  51982. return smalltalk.withContext(function($ctx2) {
  51983. return _st(self["@analyzer"])._visit_(ast);
  51984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
  51985. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  51986. args: [],
  51987. source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  51988. messageSends: ["parse:", "should:raise:", "visit:"],
  51989. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  51990. }),
  51991. globals.SemanticAnalyzerTest);
  51992. smalltalk.addMethod(
  51993. smalltalk.method({
  51994. selector: "testUnknownVariablesWithScope",
  51995. protocol: 'tests',
  51996. fn: function (){
  51997. var self=this;
  51998. var src,ast;
  51999. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52000. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  52001. return smalltalk.withContext(function($ctx1) {
  52002. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  52003. ast=_st($Smalltalk())._parse_(src);
  52004. self._should_raise_((function(){
  52005. return smalltalk.withContext(function($ctx2) {
  52006. return _st(self["@analyzer"])._visit_(ast);
  52007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
  52008. return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52009. args: [],
  52010. source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
  52011. messageSends: ["parse:", "should:raise:", "visit:"],
  52012. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  52013. }),
  52014. globals.SemanticAnalyzerTest);
  52015. smalltalk.addMethod(
  52016. smalltalk.method({
  52017. selector: "testVariableShadowing",
  52018. protocol: 'tests',
  52019. fn: function (){
  52020. var self=this;
  52021. var src,ast;
  52022. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52023. return smalltalk.withContext(function($ctx1) {
  52024. src="foo | a | a + 1";
  52025. ast=_st($Smalltalk())._parse_(src);
  52026. _st(self["@analyzer"])._visit_(ast);
  52027. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52028. args: [],
  52029. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52030. messageSends: ["parse:", "visit:"],
  52031. referencedClasses: ["Smalltalk"]
  52032. }),
  52033. globals.SemanticAnalyzerTest);
  52034. smalltalk.addMethod(
  52035. smalltalk.method({
  52036. selector: "testVariableShadowing2",
  52037. protocol: 'tests',
  52038. fn: function (){
  52039. var self=this;
  52040. var src,ast;
  52041. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52042. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  52043. return smalltalk.withContext(function($ctx1) {
  52044. src="foo | a | a + 1. [ | a | a := 2 ]";
  52045. ast=_st($Smalltalk())._parse_(src);
  52046. self._should_raise_((function(){
  52047. return smalltalk.withContext(function($ctx2) {
  52048. return _st(self["@analyzer"])._visit_(ast);
  52049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
  52050. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52051. args: [],
  52052. source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  52053. messageSends: ["parse:", "should:raise:", "visit:"],
  52054. referencedClasses: ["Smalltalk", "ShadowingVariableError"]
  52055. }),
  52056. globals.SemanticAnalyzerTest);
  52057. smalltalk.addMethod(
  52058. smalltalk.method({
  52059. selector: "testVariableShadowing3",
  52060. protocol: 'tests',
  52061. fn: function (){
  52062. var self=this;
  52063. var src,ast;
  52064. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52065. return smalltalk.withContext(function($ctx1) {
  52066. src="foo | a | a + 1. [ | b | b := 2 ]";
  52067. ast=_st($Smalltalk())._parse_(src);
  52068. _st(self["@analyzer"])._visit_(ast);
  52069. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52070. args: [],
  52071. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52072. messageSends: ["parse:", "visit:"],
  52073. referencedClasses: ["Smalltalk"]
  52074. }),
  52075. globals.SemanticAnalyzerTest);
  52076. smalltalk.addMethod(
  52077. smalltalk.method({
  52078. selector: "testVariableShadowing4",
  52079. protocol: 'tests',
  52080. fn: function (){
  52081. var self=this;
  52082. var src,ast;
  52083. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52084. return smalltalk.withContext(function($ctx1) {
  52085. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  52086. ast=_st($Smalltalk())._parse_(src);
  52087. _st(self["@analyzer"])._visit_(ast);
  52088. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52089. args: [],
  52090. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  52091. messageSends: ["parse:", "visit:"],
  52092. referencedClasses: ["Smalltalk"]
  52093. }),
  52094. globals.SemanticAnalyzerTest);
  52095. smalltalk.addMethod(
  52096. smalltalk.method({
  52097. selector: "testVariableShadowing5",
  52098. protocol: 'tests',
  52099. fn: function (){
  52100. var self=this;
  52101. var src,ast;
  52102. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52103. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  52104. return smalltalk.withContext(function($ctx1) {
  52105. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  52106. ast=_st($Smalltalk())._parse_(src);
  52107. self._should_raise_((function(){
  52108. return smalltalk.withContext(function($ctx2) {
  52109. return _st(self["@analyzer"])._visit_(ast);
  52110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
  52111. return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52112. args: [],
  52113. source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
  52114. messageSends: ["parse:", "should:raise:", "visit:"],
  52115. referencedClasses: ["Smalltalk", "ShadowingVariableError"]
  52116. }),
  52117. globals.SemanticAnalyzerTest);
  52118. smalltalk.addMethod(
  52119. smalltalk.method({
  52120. selector: "testVariablesLookup",
  52121. protocol: 'tests',
  52122. fn: function (){
  52123. var self=this;
  52124. var src,ast;
  52125. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52126. return smalltalk.withContext(function($ctx1) {
  52127. var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
  52128. src="foo | a | a + 1. [ | b | b := a ]";
  52129. ast=_st($Smalltalk())._parse_(src);
  52130. _st(self["@analyzer"])._visit_(ast);
  52131. $7=_st(ast)._nodes();
  52132. $ctx1.sendIdx["nodes"]=2;
  52133. $6=_st($7)._first();
  52134. $ctx1.sendIdx["first"]=2;
  52135. $5=_st($6)._nodes();
  52136. $ctx1.sendIdx["nodes"]=1;
  52137. $4=_st($5)._first();
  52138. $ctx1.sendIdx["first"]=1;
  52139. $3=_st($4)._receiver();
  52140. $ctx1.sendIdx["receiver"]=1;
  52141. $2=_st($3)._binding();
  52142. $ctx1.sendIdx["binding"]=1;
  52143. $1=_st($2)._isTempVar();
  52144. $ctx1.sendIdx["isTempVar"]=1;
  52145. self._assert_($1);
  52146. $ctx1.sendIdx["assert:"]=1;
  52147. $15=_st(ast)._nodes();
  52148. $ctx1.sendIdx["nodes"]=4;
  52149. $14=_st($15)._first();
  52150. $ctx1.sendIdx["first"]=4;
  52151. $13=_st($14)._nodes();
  52152. $ctx1.sendIdx["nodes"]=3;
  52153. $12=_st($13)._first();
  52154. $ctx1.sendIdx["first"]=3;
  52155. $11=_st($12)._receiver();
  52156. $10=_st($11)._binding();
  52157. $ctx1.sendIdx["binding"]=2;
  52158. $9=_st($10)._scope();
  52159. $ctx1.sendIdx["scope"]=1;
  52160. $16=_st(ast)._scope();
  52161. $ctx1.sendIdx["scope"]=2;
  52162. $8=_st($9).__eq_eq($16);
  52163. $ctx1.sendIdx["=="]=1;
  52164. self._assert_($8);
  52165. $ctx1.sendIdx["assert:"]=2;
  52166. $27=_st(ast)._nodes();
  52167. $ctx1.sendIdx["nodes"]=8;
  52168. $26=_st($27)._first();
  52169. $ctx1.sendIdx["first"]=7;
  52170. $25=_st($26)._nodes();
  52171. $ctx1.sendIdx["nodes"]=7;
  52172. $24=_st($25)._last();
  52173. $ctx1.sendIdx["last"]=1;
  52174. $23=_st($24)._nodes();
  52175. $ctx1.sendIdx["nodes"]=6;
  52176. $22=_st($23)._first();
  52177. $ctx1.sendIdx["first"]=6;
  52178. $21=_st($22)._nodes();
  52179. $ctx1.sendIdx["nodes"]=5;
  52180. $20=_st($21)._first();
  52181. $ctx1.sendIdx["first"]=5;
  52182. $19=_st($20)._left();
  52183. $ctx1.sendIdx["left"]=1;
  52184. $18=_st($19)._binding();
  52185. $ctx1.sendIdx["binding"]=3;
  52186. $17=_st($18)._isTempVar();
  52187. self._assert_($17);
  52188. $ctx1.sendIdx["assert:"]=3;
  52189. $39=_st(ast)._nodes();
  52190. $ctx1.sendIdx["nodes"]=12;
  52191. $38=_st($39)._first();
  52192. $ctx1.sendIdx["first"]=10;
  52193. $37=_st($38)._nodes();
  52194. $ctx1.sendIdx["nodes"]=11;
  52195. $36=_st($37)._last();
  52196. $ctx1.sendIdx["last"]=2;
  52197. $35=_st($36)._nodes();
  52198. $ctx1.sendIdx["nodes"]=10;
  52199. $34=_st($35)._first();
  52200. $ctx1.sendIdx["first"]=9;
  52201. $33=_st($34)._nodes();
  52202. $ctx1.sendIdx["nodes"]=9;
  52203. $32=_st($33)._first();
  52204. $ctx1.sendIdx["first"]=8;
  52205. $31=_st($32)._left();
  52206. $30=_st($31)._binding();
  52207. $29=_st($30)._scope();
  52208. $ctx1.sendIdx["scope"]=3;
  52209. $42=_st(_st(_st(ast)._nodes())._first())._nodes();
  52210. $ctx1.sendIdx["nodes"]=13;
  52211. $41=_st($42)._last();
  52212. $40=_st($41)._scope();
  52213. $28=_st($29).__eq_eq($40);
  52214. self._assert_($28);
  52215. return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},globals.SemanticAnalyzerTest)})},
  52216. args: [],
  52217. source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  52218. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
  52219. referencedClasses: ["Smalltalk"]
  52220. }),
  52221. globals.SemanticAnalyzerTest);
  52222. smalltalk.addClass('AISemanticAnalyzerTest', globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  52223. smalltalk.addMethod(
  52224. smalltalk.method({
  52225. selector: "setUp",
  52226. protocol: 'running',
  52227. fn: function (){
  52228. var self=this;
  52229. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  52230. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  52231. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  52232. return smalltalk.withContext(function($ctx1) {
  52233. var $1,$2,$4,$5,$3,$6;
  52234. $1=_st($AISemanticAnalyzer())._on_($Object());
  52235. $2=$1;
  52236. $4=_st($AIContext())._new();
  52237. _st($4)._defineLocal_("local");
  52238. _st($4)._localAt_put_("local",(3));
  52239. $5=_st($4)._yourself();
  52240. $ctx1.sendIdx["yourself"]=1;
  52241. $3=$5;
  52242. _st($2)._context_($3);
  52243. $6=_st($1)._yourself();
  52244. self["@analyzer"]=$6;
  52245. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.AISemanticAnalyzerTest)})},
  52246. args: [],
  52247. source: "setUp\x0a\x09analyzer := (AISemanticAnalyzer on: Object)\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09defineLocal: 'local';\x0a\x09\x09\x09localAt: 'local' put: 3;\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  52248. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"],
  52249. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"]
  52250. }),
  52251. globals.AISemanticAnalyzerTest);
  52252. smalltalk.addMethod(
  52253. smalltalk.method({
  52254. selector: "testContextVariables",
  52255. protocol: 'tests',
  52256. fn: function (){
  52257. var self=this;
  52258. var src,ast;
  52259. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52260. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  52261. return smalltalk.withContext(function($ctx1) {
  52262. src="foo | a | local + a";
  52263. ast=_st($Smalltalk())._parse_(src);
  52264. self._shouldnt_raise_((function(){
  52265. return smalltalk.withContext(function($ctx2) {
  52266. return _st(self["@analyzer"])._visit_(ast);
  52267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
  52268. return self}, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},globals.AISemanticAnalyzerTest)})},
  52269. args: [],
  52270. source: "testContextVariables\x0a\x09| src ast |\x0a\x09\x0a\x09src := 'foo | a | local + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self shouldnt: [ analyzer visit: ast ] raise: UnknownVariableError",
  52271. messageSends: ["parse:", "shouldnt:raise:", "visit:"],
  52272. referencedClasses: ["Smalltalk", "UnknownVariableError"]
  52273. }),
  52274. globals.AISemanticAnalyzerTest);
  52275. });
  52276. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  52277. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  52278. smalltalk.addPackage('SUnit-Tests');
  52279. smalltalk.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  52280. smalltalk.addClass('ExampleSetTest', globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  52281. globals.ExampleSetTest.comment="ExampleSetTest is taken from Pharo 1.4.\x0a\x0aTHe purpose of this class is to demonstrate a simple use case of the test framework.";
  52282. smalltalk.addMethod(
  52283. smalltalk.method({
  52284. selector: "setUp",
  52285. protocol: 'running',
  52286. fn: function (){
  52287. var self=this;
  52288. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  52289. return smalltalk.withContext(function($ctx1) {
  52290. self["@empty"]=_st($Set())._new();
  52291. self["@full"]=_st($Set())._with_with_((5),"abc");
  52292. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ExampleSetTest)})},
  52293. args: [],
  52294. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  52295. messageSends: ["new", "with:with:"],
  52296. referencedClasses: ["Set"]
  52297. }),
  52298. globals.ExampleSetTest);
  52299. smalltalk.addMethod(
  52300. smalltalk.method({
  52301. selector: "testAdd",
  52302. protocol: 'tests',
  52303. fn: function (){
  52304. var self=this;
  52305. return smalltalk.withContext(function($ctx1) {
  52306. _st(self["@empty"])._add_((5));
  52307. self._assert_(_st(self["@empty"])._includes_((5)));
  52308. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{},globals.ExampleSetTest)})},
  52309. args: [],
  52310. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  52311. messageSends: ["add:", "assert:", "includes:"],
  52312. referencedClasses: []
  52313. }),
  52314. globals.ExampleSetTest);
  52315. smalltalk.addMethod(
  52316. smalltalk.method({
  52317. selector: "testGrow",
  52318. protocol: 'tests',
  52319. fn: function (){
  52320. var self=this;
  52321. return smalltalk.withContext(function($ctx1) {
  52322. _st(self["@empty"])._addAll_((1)._to_((100)));
  52323. self._assert_equals_(_st(self["@empty"])._size(),(100));
  52324. return self}, function($ctx1) {$ctx1.fill(self,"testGrow",{},globals.ExampleSetTest)})},
  52325. args: [],
  52326. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  52327. messageSends: ["addAll:", "to:", "assert:equals:", "size"],
  52328. referencedClasses: []
  52329. }),
  52330. globals.ExampleSetTest);
  52331. smalltalk.addMethod(
  52332. smalltalk.method({
  52333. selector: "testIllegal",
  52334. protocol: 'tests',
  52335. fn: function (){
  52336. var self=this;
  52337. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  52338. return smalltalk.withContext(function($ctx1) {
  52339. self._should_raise_((function(){
  52340. return smalltalk.withContext(function($ctx2) {
  52341. return _st(self["@empty"])._at_((5));
  52342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  52343. $ctx1.sendIdx["should:raise:"]=1;
  52344. self._should_raise_((function(){
  52345. return smalltalk.withContext(function($ctx2) {
  52346. return _st(self["@empty"])._at_put_((5),"abc");
  52347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  52348. return self}, function($ctx1) {$ctx1.fill(self,"testIllegal",{},globals.ExampleSetTest)})},
  52349. args: [],
  52350. source: "testIllegal\x0a\x09self\x0a\x09\x09should: [ empty at: 5 ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ empty at: 5 put: #abc ]\x0a\x09\x09raise: Error",
  52351. messageSends: ["should:raise:", "at:", "at:put:"],
  52352. referencedClasses: ["Error"]
  52353. }),
  52354. globals.ExampleSetTest);
  52355. smalltalk.addMethod(
  52356. smalltalk.method({
  52357. selector: "testIncludes",
  52358. protocol: 'tests',
  52359. fn: function (){
  52360. var self=this;
  52361. return smalltalk.withContext(function($ctx1) {
  52362. var $1;
  52363. $1=_st(self["@full"])._includes_((5));
  52364. $ctx1.sendIdx["includes:"]=1;
  52365. self._assert_($1);
  52366. $ctx1.sendIdx["assert:"]=1;
  52367. self._assert_(_st(self["@full"])._includes_("abc"));
  52368. return self}, function($ctx1) {$ctx1.fill(self,"testIncludes",{},globals.ExampleSetTest)})},
  52369. args: [],
  52370. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  52371. messageSends: ["assert:", "includes:"],
  52372. referencedClasses: []
  52373. }),
  52374. globals.ExampleSetTest);
  52375. smalltalk.addMethod(
  52376. smalltalk.method({
  52377. selector: "testOccurrences",
  52378. protocol: 'tests',
  52379. fn: function (){
  52380. var self=this;
  52381. return smalltalk.withContext(function($ctx1) {
  52382. var $1,$2;
  52383. $1=_st(self["@empty"])._occurrencesOf_((0));
  52384. $ctx1.sendIdx["occurrencesOf:"]=1;
  52385. self._assert_equals_($1,(0));
  52386. $ctx1.sendIdx["assert:equals:"]=1;
  52387. $2=_st(self["@full"])._occurrencesOf_((5));
  52388. $ctx1.sendIdx["occurrencesOf:"]=2;
  52389. self._assert_equals_($2,(1));
  52390. $ctx1.sendIdx["assert:equals:"]=2;
  52391. _st(self["@full"])._add_((5));
  52392. self._assert_equals_(_st(self["@full"])._occurrencesOf_((5)),(1));
  52393. return self}, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},globals.ExampleSetTest)})},
  52394. args: [],
  52395. source: "testOccurrences\x0a\x09self assert: (empty occurrencesOf: 0) equals: 0.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1.\x0a\x09full add: 5.\x0a\x09self assert: (full occurrencesOf: 5) equals: 1",
  52396. messageSends: ["assert:equals:", "occurrencesOf:", "add:"],
  52397. referencedClasses: []
  52398. }),
  52399. globals.ExampleSetTest);
  52400. smalltalk.addMethod(
  52401. smalltalk.method({
  52402. selector: "testRemove",
  52403. protocol: 'tests',
  52404. fn: function (){
  52405. var self=this;
  52406. return smalltalk.withContext(function($ctx1) {
  52407. var $1;
  52408. _st(self["@full"])._remove_((5));
  52409. $1=_st(self["@full"])._includes_("abc");
  52410. $ctx1.sendIdx["includes:"]=1;
  52411. self._assert_($1);
  52412. self._deny_(_st(self["@full"])._includes_((5)));
  52413. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{},globals.ExampleSetTest)})},
  52414. args: [],
  52415. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  52416. messageSends: ["remove:", "assert:", "includes:", "deny:"],
  52417. referencedClasses: []
  52418. }),
  52419. globals.ExampleSetTest);
  52420. smalltalk.addClass('SUnitAsyncTest', globals.TestCase, ['flag'], 'SUnit-Tests');
  52421. smalltalk.addMethod(
  52422. smalltalk.method({
  52423. selector: "fakeError",
  52424. protocol: 'helpers',
  52425. fn: function (){
  52426. var self=this;
  52427. return smalltalk.withContext(function($ctx1) {
  52428. self["@flag"]="bad";
  52429. self._timeout_((30));
  52430. self["@flag"]=_st(self._async_((function(){
  52431. return smalltalk.withContext(function($ctx2) {
  52432. self["@flag"]="ok";
  52433. self["@flag"];
  52434. return self._error_("Intentional");
  52435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((20));
  52436. return self}, function($ctx1) {$ctx1.fill(self,"fakeError",{},globals.SUnitAsyncTest)})},
  52437. args: [],
  52438. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  52439. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"],
  52440. referencedClasses: []
  52441. }),
  52442. globals.SUnitAsyncTest);
  52443. smalltalk.addMethod(
  52444. smalltalk.method({
  52445. selector: "fakeErrorFailingInTearDown",
  52446. protocol: 'helpers',
  52447. fn: function (){
  52448. var self=this;
  52449. return smalltalk.withContext(function($ctx1) {
  52450. self["@flag"]="bad";
  52451. self._timeout_((30));
  52452. self["@flag"]=_st(self._async_((function(){
  52453. return smalltalk.withContext(function($ctx2) {
  52454. return self._error_("Intentional");
  52455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((20));
  52456. return self}, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},globals.SUnitAsyncTest)})},
  52457. args: [],
  52458. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  52459. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"],
  52460. referencedClasses: []
  52461. }),
  52462. globals.SUnitAsyncTest);
  52463. smalltalk.addMethod(
  52464. smalltalk.method({
  52465. selector: "fakeFailure",
  52466. protocol: 'helpers',
  52467. fn: function (){
  52468. var self=this;
  52469. return smalltalk.withContext(function($ctx1) {
  52470. self["@flag"]="bad";
  52471. self._timeout_((30));
  52472. self["@flag"]=_st(self._async_((function(){
  52473. return smalltalk.withContext(function($ctx2) {
  52474. self["@flag"]="ok";
  52475. self["@flag"];
  52476. return self._assert_(false);
  52477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((20));
  52478. return self}, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},globals.SUnitAsyncTest)})},
  52479. args: [],
  52480. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  52481. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"],
  52482. referencedClasses: []
  52483. }),
  52484. globals.SUnitAsyncTest);
  52485. smalltalk.addMethod(
  52486. smalltalk.method({
  52487. selector: "fakeMultipleTimeoutFailing",
  52488. protocol: 'helpers',
  52489. fn: function (){
  52490. var self=this;
  52491. return smalltalk.withContext(function($ctx1) {
  52492. var $1;
  52493. self._timeout_((100));
  52494. $ctx1.sendIdx["timeout:"]=1;
  52495. $1=self._async_((function(){
  52496. return smalltalk.withContext(function($ctx2) {
  52497. self._timeout_((20));
  52498. return _st(self._async_((function(){
  52499. return smalltalk.withContext(function($ctx3) {
  52500. return self._finished();
  52501. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._valueWithTimeout_((30));
  52502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  52503. $ctx1.sendIdx["async:"]=1;
  52504. _st($1)._valueWithTimeout_((20));
  52505. $ctx1.sendIdx["valueWithTimeout:"]=1;
  52506. return self}, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},globals.SUnitAsyncTest)})},
  52507. args: [],
  52508. source: "fakeMultipleTimeoutFailing\x0a\x09self timeout: 100.\x0a\x09(self async: [ \x0a\x09\x09self timeout: 20.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 30\x0a\x09]) valueWithTimeout: 20",
  52509. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
  52510. referencedClasses: []
  52511. }),
  52512. globals.SUnitAsyncTest);
  52513. smalltalk.addMethod(
  52514. smalltalk.method({
  52515. selector: "fakeMultipleTimeoutPassing",
  52516. protocol: 'helpers',
  52517. fn: function (){
  52518. var self=this;
  52519. return smalltalk.withContext(function($ctx1) {
  52520. var $1;
  52521. self._timeout_((20));
  52522. $ctx1.sendIdx["timeout:"]=1;
  52523. $1=self._async_((function(){
  52524. return smalltalk.withContext(function($ctx2) {
  52525. self._timeout_((40));
  52526. return _st(self._async_((function(){
  52527. return smalltalk.withContext(function($ctx3) {
  52528. return self._finished();
  52529. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._valueWithTimeout_((20));
  52530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  52531. $ctx1.sendIdx["async:"]=1;
  52532. _st($1)._valueWithTimeout_((10));
  52533. $ctx1.sendIdx["valueWithTimeout:"]=1;
  52534. return self}, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},globals.SUnitAsyncTest)})},
  52535. args: [],
  52536. source: "fakeMultipleTimeoutPassing\x0a\x09self timeout: 20.\x0a\x09(self async: [\x0a\x09\x09self timeout: 40.\x0a\x09\x09(self async: [ self finished ]) valueWithTimeout: 20\x0a\x09]) valueWithTimeout: 10",
  52537. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
  52538. referencedClasses: []
  52539. }),
  52540. globals.SUnitAsyncTest);
  52541. smalltalk.addMethod(
  52542. smalltalk.method({
  52543. selector: "fakeTimeout",
  52544. protocol: 'helpers',
  52545. fn: function (){
  52546. var self=this;
  52547. return smalltalk.withContext(function($ctx1) {
  52548. self._timeout_((10));
  52549. _st(self._async_((function(){
  52550. return smalltalk.withContext(function($ctx2) {
  52551. return self._finished();
  52552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((20));
  52553. return self}, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},globals.SUnitAsyncTest)})},
  52554. args: [],
  52555. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  52556. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"],
  52557. referencedClasses: []
  52558. }),
  52559. globals.SUnitAsyncTest);
  52560. smalltalk.addMethod(
  52561. smalltalk.method({
  52562. selector: "selectorSetOf:",
  52563. protocol: 'private',
  52564. fn: function (aCollection){
  52565. var self=this;
  52566. return smalltalk.withContext(function($ctx1) {
  52567. var $1;
  52568. $1=_st(_st(aCollection)._collect_((function(each){
  52569. return smalltalk.withContext(function($ctx2) {
  52570. return _st(each)._selector();
  52571. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._asSet();
  52572. return $1;
  52573. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},globals.SUnitAsyncTest)})},
  52574. args: ["aCollection"],
  52575. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  52576. messageSends: ["asSet", "collect:", "selector"],
  52577. referencedClasses: []
  52578. }),
  52579. globals.SUnitAsyncTest);
  52580. smalltalk.addMethod(
  52581. smalltalk.method({
  52582. selector: "setUp",
  52583. protocol: 'running',
  52584. fn: function (){
  52585. var self=this;
  52586. self["@flag"]="ok";
  52587. return self},
  52588. args: [],
  52589. source: "setUp\x0a\x09flag := 'ok'",
  52590. messageSends: [],
  52591. referencedClasses: []
  52592. }),
  52593. globals.SUnitAsyncTest);
  52594. smalltalk.addMethod(
  52595. smalltalk.method({
  52596. selector: "tearDown",
  52597. protocol: 'running',
  52598. fn: function (){
  52599. var self=this;
  52600. return smalltalk.withContext(function($ctx1) {
  52601. self._assert_equals_("ok",self["@flag"]);
  52602. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.SUnitAsyncTest)})},
  52603. args: [],
  52604. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  52605. messageSends: ["assert:equals:"],
  52606. referencedClasses: []
  52607. }),
  52608. globals.SUnitAsyncTest);
  52609. smalltalk.addMethod(
  52610. smalltalk.method({
  52611. selector: "testAsyncErrorsAndFailures",
  52612. protocol: 'tests',
  52613. fn: function (){
  52614. var self=this;
  52615. var suite,runner,result,assertBlock;
  52616. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  52617. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  52618. return smalltalk.withContext(function($ctx1) {
  52619. var $1,$2,$3,$4;
  52620. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  52621. return smalltalk.withContext(function($ctx2) {
  52622. return _st(self._class())._selector_(each);
  52623. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  52624. runner=_st($TestSuiteRunner())._on_(suite);
  52625. self._timeout_((200));
  52626. result=_st(runner)._result();
  52627. $ctx1.sendIdx["result"]=1;
  52628. assertBlock=self._async_((function(){
  52629. return smalltalk.withContext(function($ctx2) {
  52630. $1=self._selectorSetOf_(_st(result)._errors());
  52631. $ctx2.sendIdx["selectorSetOf:"]=1;
  52632. $2=["fakeError"]._asSet();
  52633. $ctx2.sendIdx["asSet"]=1;
  52634. self._assert_equals_($1,$2);
  52635. $ctx2.sendIdx["assert:equals:"]=1;
  52636. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  52637. return self._finished();
  52638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  52639. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  52640. return smalltalk.withContext(function($ctx2) {
  52641. $3=_st(_st(ann)._result()).__eq_eq(result);
  52642. if(smalltalk.assert($3)){
  52643. $4=_st(_st(result)._runs()).__eq(_st(result)._total());
  52644. return _st($4)._ifTrue_(assertBlock);
  52645. };
  52646. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)})}));
  52647. _st(runner)._run();
  52648. return self}, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)})},
  52649. args: [],
  52650. source: "testAsyncErrorsAndFailures\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeError' 'fakeErrorFailingInTearDown' 'fakeFailure' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: #('fakeError') asSet.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeErrorFailingInTearDown' 'fakeFailure') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  52651. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"],
  52652. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"]
  52653. }),
  52654. globals.SUnitAsyncTest);
  52655. smalltalk.addMethod(
  52656. smalltalk.method({
  52657. selector: "testAsyncNeedsTimeout",
  52658. protocol: 'tests',
  52659. fn: function (){
  52660. var self=this;
  52661. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  52662. return smalltalk.withContext(function($ctx1) {
  52663. self._should_raise_((function(){
  52664. return smalltalk.withContext(function($ctx2) {
  52665. return self._async_((function(){
  52666. }));
  52667. $ctx2.sendIdx["async:"]=1;
  52668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  52669. self._timeout_((0));
  52670. self._shouldnt_raise_((function(){
  52671. return smalltalk.withContext(function($ctx2) {
  52672. return self._async_((function(){
  52673. }));
  52674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  52675. self._finished();
  52676. return self}, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},globals.SUnitAsyncTest)})},
  52677. args: [],
  52678. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  52679. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"],
  52680. referencedClasses: ["Error"]
  52681. }),
  52682. globals.SUnitAsyncTest);
  52683. smalltalk.addMethod(
  52684. smalltalk.method({
  52685. selector: "testFinishedNeedsTimeout",
  52686. protocol: 'tests',
  52687. fn: function (){
  52688. var self=this;
  52689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  52690. return smalltalk.withContext(function($ctx1) {
  52691. self._should_raise_((function(){
  52692. return smalltalk.withContext(function($ctx2) {
  52693. return self._finished();
  52694. $ctx2.sendIdx["finished"]=1;
  52695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  52696. self._timeout_((0));
  52697. self._shouldnt_raise_((function(){
  52698. return smalltalk.withContext(function($ctx2) {
  52699. return self._finished();
  52700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  52701. return self}, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},globals.SUnitAsyncTest)})},
  52702. args: [],
  52703. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  52704. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"],
  52705. referencedClasses: ["Error"]
  52706. }),
  52707. globals.SUnitAsyncTest);
  52708. smalltalk.addMethod(
  52709. smalltalk.method({
  52710. selector: "testIsAsyncReturnsCorrectValues",
  52711. protocol: 'tests',
  52712. fn: function (){
  52713. var self=this;
  52714. return smalltalk.withContext(function($ctx1) {
  52715. var $1,$2;
  52716. $1=self._isAsync();
  52717. $ctx1.sendIdx["isAsync"]=1;
  52718. self._deny_($1);
  52719. $ctx1.sendIdx["deny:"]=1;
  52720. self._timeout_((0));
  52721. $2=self._isAsync();
  52722. $ctx1.sendIdx["isAsync"]=2;
  52723. self._assert_($2);
  52724. self._finished();
  52725. self._deny_(self._isAsync());
  52726. return self}, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},globals.SUnitAsyncTest)})},
  52727. args: [],
  52728. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  52729. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"],
  52730. referencedClasses: []
  52731. }),
  52732. globals.SUnitAsyncTest);
  52733. smalltalk.addMethod(
  52734. smalltalk.method({
  52735. selector: "testPass",
  52736. protocol: 'tests',
  52737. fn: function (){
  52738. var self=this;
  52739. return smalltalk.withContext(function($ctx1) {
  52740. self["@flag"]="bad";
  52741. self._timeout_((10));
  52742. self["@flag"]=_st(self._async_((function(){
  52743. return smalltalk.withContext(function($ctx2) {
  52744. self._assert_(true);
  52745. self._finished();
  52746. self["@flag"]="ok";
  52747. return self["@flag"];
  52748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((5));
  52749. return self}, function($ctx1) {$ctx1.fill(self,"testPass",{},globals.SUnitAsyncTest)})},
  52750. args: [],
  52751. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  52752. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"],
  52753. referencedClasses: []
  52754. }),
  52755. globals.SUnitAsyncTest);
  52756. smalltalk.addMethod(
  52757. smalltalk.method({
  52758. selector: "testTimeouts",
  52759. protocol: 'tests',
  52760. fn: function (){
  52761. var self=this;
  52762. var suite,runner,result,assertBlock;
  52763. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  52764. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  52765. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  52766. return smalltalk.withContext(function($ctx1) {
  52767. var $1,$2,$3;
  52768. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  52769. return smalltalk.withContext(function($ctx2) {
  52770. return _st(self._class())._selector_(each);
  52771. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  52772. runner=_st($TestSuiteRunner())._on_(suite);
  52773. self._timeout_((200));
  52774. result=_st(runner)._result();
  52775. $ctx1.sendIdx["result"]=1;
  52776. assertBlock=self._async_((function(){
  52777. return smalltalk.withContext(function($ctx2) {
  52778. $1=self._selectorSetOf_(_st(result)._errors());
  52779. $ctx2.sendIdx["selectorSetOf:"]=1;
  52780. self._assert_equals_($1,_st($Set())._new());
  52781. $ctx2.sendIdx["assert:equals:"]=1;
  52782. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  52783. return self._finished();
  52784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  52785. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  52786. return smalltalk.withContext(function($ctx2) {
  52787. $2=_st(_st(ann)._result()).__eq_eq(result);
  52788. if(smalltalk.assert($2)){
  52789. $3=_st(_st(result)._runs()).__eq(_st(result)._total());
  52790. return _st($3)._ifTrue_(assertBlock);
  52791. };
  52792. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)})}));
  52793. _st(runner)._run();
  52794. return self}, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)})},
  52795. args: [],
  52796. source: "testTimeouts\x0a\x09| suite runner result assertBlock |\x0a\x09suite := #('fakeTimeout' 'fakeMultipleTimeoutFailing' 'fakeMultipleTimeoutPassing' 'testPass') collect: [ :each | self class selector: each ].\x0a\x09runner := TestSuiteRunner on: suite.\x0a\x09self timeout: 200.\x0a\x09result := runner result.\x0a\x09assertBlock := self async: [\x0a\x09\x09self assert: (self selectorSetOf: result errors) equals: Set new.\x0a\x09\x09self assert: (self selectorSetOf: result failures) equals: #('fakeMultipleTimeoutFailing' 'fakeTimeout') asSet.\x0a\x09\x09self finished\x0a\x09].\x0a\x09runner announcer on: ResultAnnouncement do: [ :ann |\x0a\x09\x09ann result == result ifTrue: [ result runs = result total ifTrue: assertBlock ] ].\x0a\x09runner run",
  52797. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"],
  52798. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"]
  52799. }),
  52800. globals.SUnitAsyncTest);
  52801. smalltalk.addMethod(
  52802. smalltalk.method({
  52803. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  52804. protocol: 'tests',
  52805. fn: function (){
  52806. var self=this;
  52807. var x;
  52808. return smalltalk.withContext(function($ctx1) {
  52809. var $1;
  52810. self["@flag"]="bad";
  52811. self._timeout_((10));
  52812. x=(0);
  52813. $1=self._async_((function(){
  52814. return smalltalk.withContext(function($ctx2) {
  52815. self._finished();
  52816. $ctx2.sendIdx["finished"]=1;
  52817. self["@flag"]="ok";
  52818. self["@flag"];
  52819. x=_st(x).__plus((1));
  52820. $ctx2.sendIdx["+"]=1;
  52821. x;
  52822. return self._assert_equals_(x,(1));
  52823. $ctx2.sendIdx["assert:equals:"]=1;
  52824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  52825. $ctx1.sendIdx["async:"]=1;
  52826. self["@flag"]=_st($1)._valueWithTimeout_((0));
  52827. $ctx1.sendIdx["valueWithTimeout:"]=1;
  52828. self["@flag"]=_st(self._async_((function(){
  52829. return smalltalk.withContext(function($ctx2) {
  52830. self._finished();
  52831. self["@flag"]="ok";
  52832. self["@flag"];
  52833. x=_st(x).__plus((1));
  52834. x;
  52835. return self._assert_equals_(x,(1));
  52836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})))._valueWithTimeout_((0));
  52837. return self}, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},globals.SUnitAsyncTest)})},
  52838. args: [],
  52839. source: "testTwoAsyncPassesWithFinishedOnlyOneIsRun\x0a\x09| x |\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09x := 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.\x0a\x09flag := (self async: [ self finished. flag := 'ok'. x := x+1. self assert: x equals: 1 ]) valueWithTimeout: 0.",
  52840. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"],
  52841. referencedClasses: []
  52842. }),
  52843. globals.SUnitAsyncTest);
  52844. });
  52845. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  52846. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  52847. smalltalk.addPackage('AmberCli');
  52848. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  52849. smalltalk.addClass('AmberCli', globals.Object, [], 'AmberCli');
  52850. globals.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  52851. smalltalk.addMethod(
  52852. smalltalk.method({
  52853. selector: "commandLineSwitches",
  52854. protocol: 'commandline',
  52855. fn: function (){
  52856. var self=this;
  52857. var switches;
  52858. return smalltalk.withContext(function($ctx1) {
  52859. var $1;
  52860. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  52861. return smalltalk.withContext(function($ctx2) {
  52862. return _st(each)._selector();
  52863. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  52864. $ctx1.sendIdx["collect:"]=1;
  52865. switches=_st(switches)._select_((function(each){
  52866. return smalltalk.withContext(function($ctx2) {
  52867. return _st(each)._match_("^[^:]*:$");
  52868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  52869. switches=_st(switches)._collect_((function(each){
  52870. return smalltalk.withContext(function($ctx2) {
  52871. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  52872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  52873. $1=switches;
  52874. return $1;
  52875. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.AmberCli.klass)})},
  52876. args: [],
  52877. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^ switches",
  52878. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  52879. referencedClasses: []
  52880. }),
  52881. globals.AmberCli.klass);
  52882. smalltalk.addMethod(
  52883. smalltalk.method({
  52884. selector: "handleArguments:",
  52885. protocol: 'commandline',
  52886. fn: function (args){
  52887. var self=this;
  52888. var selector;
  52889. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  52890. return smalltalk.withContext(function($ctx1) {
  52891. var $1;
  52892. $1=_st(args)._first();
  52893. $ctx1.sendIdx["first"]=1;
  52894. selector=self._selectorForCommandLineSwitch_($1);
  52895. _st(args)._remove_(_st(args)._first());
  52896. self._perform_withArguments_(selector,_st($Array())._with_(args));
  52897. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},globals.AmberCli.klass)})},
  52898. args: ["args"],
  52899. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  52900. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  52901. referencedClasses: ["Array"]
  52902. }),
  52903. globals.AmberCli.klass);
  52904. smalltalk.addMethod(
  52905. smalltalk.method({
  52906. selector: "help:",
  52907. protocol: 'commands',
  52908. fn: function (args){
  52909. var self=this;
  52910. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  52911. return smalltalk.withContext(function($ctx1) {
  52912. _st($Transcript())._show_("Available commands");
  52913. _st(self._commandLineSwitches())._do_((function(each){
  52914. return smalltalk.withContext(function($ctx2) {
  52915. return _st(console)._log_(each);
  52916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  52917. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},globals.AmberCli.klass)})},
  52918. args: ["args"],
  52919. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  52920. messageSends: ["show:", "do:", "commandLineSwitches", "log:"],
  52921. referencedClasses: ["Transcript"]
  52922. }),
  52923. globals.AmberCli.klass);
  52924. smalltalk.addMethod(
  52925. smalltalk.method({
  52926. selector: "init:",
  52927. protocol: 'commands',
  52928. fn: function (args){
  52929. var self=this;
  52930. function $Initer(){return globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  52931. return smalltalk.withContext(function($ctx1) {
  52932. _st(_st($Initer())._new())._start();
  52933. return self}, function($ctx1) {$ctx1.fill(self,"init:",{args:args},globals.AmberCli.klass)})},
  52934. args: ["args"],
  52935. source: "init: args\x0a\x09Initer new start",
  52936. messageSends: ["start", "new"],
  52937. referencedClasses: ["Initer"]
  52938. }),
  52939. globals.AmberCli.klass);
  52940. smalltalk.addMethod(
  52941. smalltalk.method({
  52942. selector: "main",
  52943. protocol: 'startup',
  52944. fn: function (){
  52945. var self=this;
  52946. var args,nodeMinorVersion;
  52947. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  52948. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  52949. return smalltalk.withContext(function($ctx1) {
  52950. var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11;
  52951. $5=_st($Smalltalk())._version();
  52952. $ctx1.sendIdx["version"]=1;
  52953. $4="Welcome to Amber version ".__comma($5);
  52954. $ctx1.sendIdx[","]=4;
  52955. $3=_st($4).__comma(" (NodeJS ");
  52956. $ctx1.sendIdx[","]=3;
  52957. $2=_st($3).__comma(_st(_st(process)._versions())._node());
  52958. $ctx1.sendIdx[","]=2;
  52959. $1=_st($2).__comma(").");
  52960. $ctx1.sendIdx[","]=1;
  52961. _st($Transcript())._show_($1);
  52962. $ctx1.sendIdx["show:"]=1;
  52963. $8=_st(process)._version();
  52964. $ctx1.sendIdx["version"]=2;
  52965. $7=_st($8)._tokenize_(".");
  52966. $6=_st($7)._second();
  52967. nodeMinorVersion=_st($6)._asNumber();
  52968. $9=_st(nodeMinorVersion).__lt((8));
  52969. if(smalltalk.assert($9)){
  52970. _st($Transcript())._show_("You are currently using Node.js ".__comma(_st(process)._version()));
  52971. $ctx1.sendIdx["show:"]=2;
  52972. _st($Transcript())._show_("Required is at least Node.js v0.8.x or greater.");
  52973. return (-1);
  52974. };
  52975. args=_st(process)._argv();
  52976. _st(args)._removeFrom_to_((1),(2));
  52977. $10=_st(args)._isEmpty();
  52978. if(smalltalk.assert($10)){
  52979. self._help_(nil);
  52980. } else {
  52981. $11=self._handleArguments_(args);
  52982. return $11;
  52983. };
  52984. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},globals.AmberCli.klass)})},
  52985. args: [],
  52986. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk version, ' (NodeJS ', process versions node, ').'.\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09Transcript show: 'You are currently using Node.js ', (process version).\x0a\x09\x09Transcript show: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  52987. messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"],
  52988. referencedClasses: ["Transcript", "Smalltalk"]
  52989. }),
  52990. globals.AmberCli.klass);
  52991. smalltalk.addMethod(
  52992. smalltalk.method({
  52993. selector: "repl:",
  52994. protocol: 'commands',
  52995. fn: function (args){
  52996. var self=this;
  52997. function $Repl(){return globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  52998. return smalltalk.withContext(function($ctx1) {
  52999. var $1;
  53000. $1=_st(_st($Repl())._new())._createInterface();
  53001. return $1;
  53002. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},globals.AmberCli.klass)})},
  53003. args: ["args"],
  53004. source: "repl: args\x0a\x09^ Repl new createInterface",
  53005. messageSends: ["createInterface", "new"],
  53006. referencedClasses: ["Repl"]
  53007. }),
  53008. globals.AmberCli.klass);
  53009. smalltalk.addMethod(
  53010. smalltalk.method({
  53011. selector: "selectorForCommandLineSwitch:",
  53012. protocol: 'commandline',
  53013. fn: function (aSwitch){
  53014. var self=this;
  53015. var command,selector;
  53016. return smalltalk.withContext(function($ctx1) {
  53017. var $1,$2;
  53018. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  53019. if(smalltalk.assert($1)){
  53020. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  53021. return smalltalk.withContext(function($ctx2) {
  53022. return _st(_st(each)._second())._asUppercase();
  53023. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}))).__comma(":");
  53024. selector;
  53025. } else {
  53026. selector="help:";
  53027. selector;
  53028. };
  53029. $2=selector;
  53030. return $2;
  53031. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},globals.AmberCli.klass)})},
  53032. args: ["aSwitch"],
  53033. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^ selector",
  53034. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"],
  53035. referencedClasses: []
  53036. }),
  53037. globals.AmberCli.klass);
  53038. smalltalk.addMethod(
  53039. smalltalk.method({
  53040. selector: "serve:",
  53041. protocol: 'commands',
  53042. fn: function (args){
  53043. var self=this;
  53044. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  53045. return smalltalk.withContext(function($ctx1) {
  53046. var $1;
  53047. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  53048. return $1;
  53049. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},globals.AmberCli.klass)})},
  53050. args: ["args"],
  53051. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  53052. messageSends: ["start", "createServerWithArguments:"],
  53053. referencedClasses: ["FileServer"]
  53054. }),
  53055. globals.AmberCli.klass);
  53056. smalltalk.addMethod(
  53057. smalltalk.method({
  53058. selector: "tests:",
  53059. protocol: 'commands',
  53060. fn: function (arguments){
  53061. var self=this;
  53062. function $NodeTestRunner(){return globals.NodeTestRunner||(typeof NodeTestRunner=="undefined"?nil:NodeTestRunner)}
  53063. return smalltalk.withContext(function($ctx1) {
  53064. var $1;
  53065. $1=_st($NodeTestRunner())._runTestSuite();
  53066. return $1;
  53067. }, function($ctx1) {$ctx1.fill(self,"tests:",{arguments:arguments},globals.AmberCli.klass)})},
  53068. args: ["arguments"],
  53069. source: "tests: arguments\x0a\x09^ NodeTestRunner runTestSuite",
  53070. messageSends: ["runTestSuite"],
  53071. referencedClasses: ["NodeTestRunner"]
  53072. }),
  53073. globals.AmberCli.klass);
  53074. smalltalk.addMethod(
  53075. smalltalk.method({
  53076. selector: "version:",
  53077. protocol: 'commands',
  53078. fn: function (arguments){
  53079. var self=this;
  53080. return self},
  53081. args: ["arguments"],
  53082. source: "version: arguments",
  53083. messageSends: [],
  53084. referencedClasses: []
  53085. }),
  53086. globals.AmberCli.klass);
  53087. smalltalk.addClass('FileServer', globals.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  53088. globals.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.";
  53089. smalltalk.addMethod(
  53090. smalltalk.method({
  53091. selector: "base64Decode:",
  53092. protocol: 'private',
  53093. fn: function (aString){
  53094. var self=this;
  53095. return smalltalk.withContext(function($ctx1) {
  53096. return (new Buffer(aString, 'base64').toString());
  53097. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},globals.FileServer)})},
  53098. args: ["aString"],
  53099. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  53100. messageSends: [],
  53101. referencedClasses: []
  53102. }),
  53103. globals.FileServer);
  53104. smalltalk.addMethod(
  53105. smalltalk.method({
  53106. selector: "basePath",
  53107. protocol: 'accessing',
  53108. fn: function (){
  53109. var self=this;
  53110. return smalltalk.withContext(function($ctx1) {
  53111. var $2,$1,$receiver;
  53112. $2=self["@basePath"];
  53113. if(($receiver = $2) == null || $receiver.isNil){
  53114. $1=_st(self._class())._defaultBasePath();
  53115. } else {
  53116. $1=$2;
  53117. };
  53118. return $1;
  53119. }, function($ctx1) {$ctx1.fill(self,"basePath",{},globals.FileServer)})},
  53120. args: [],
  53121. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  53122. messageSends: ["ifNil:", "defaultBasePath", "class"],
  53123. referencedClasses: []
  53124. }),
  53125. globals.FileServer);
  53126. smalltalk.addMethod(
  53127. smalltalk.method({
  53128. selector: "basePath:",
  53129. protocol: 'accessing',
  53130. fn: function (aString){
  53131. var self=this;
  53132. return smalltalk.withContext(function($ctx1) {
  53133. self["@basePath"]=aString;
  53134. self._validateBasePath();
  53135. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},globals.FileServer)})},
  53136. args: ["aString"],
  53137. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  53138. messageSends: ["validateBasePath"],
  53139. referencedClasses: []
  53140. }),
  53141. globals.FileServer);
  53142. smalltalk.addMethod(
  53143. smalltalk.method({
  53144. selector: "checkDirectoryLayout",
  53145. protocol: 'initialization',
  53146. fn: function (){
  53147. var self=this;
  53148. return smalltalk.withContext(function($ctx1) {
  53149. var $1;
  53150. $1=_st(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  53151. if(! smalltalk.assert($1)){
  53152. _st(console)._warn_("Warning: project directory does not contain index.html.");
  53153. $ctx1.sendIdx["warn:"]=1;
  53154. _st(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  53155. $ctx1.sendIdx["warn:"]=2;
  53156. _st(console)._warn_(" You can also specify a page to be served by default,");
  53157. $ctx1.sendIdx["warn:"]=3;
  53158. _st(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  53159. };
  53160. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},globals.FileServer)})},
  53161. args: [],
  53162. source: "checkDirectoryLayout\x0a\x09(fs existsSync:\x09(self withBasePath: 'index.html')) ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html.'.\x0a\x09\x09console warn: ' You can specify the directory containing index.html with --base-path.'.\x0a\x09\x09console warn: ' You can also specify a page to be served by default,'.\x0a\x09\x09console warn: ' for all paths that do not map to a file, with --fallback-page.'].",
  53163. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"],
  53164. referencedClasses: []
  53165. }),
  53166. globals.FileServer);
  53167. smalltalk.addMethod(
  53168. smalltalk.method({
  53169. selector: "fallbackPage",
  53170. protocol: 'accessing',
  53171. fn: function (){
  53172. var self=this;
  53173. var $1;
  53174. $1=self["@fallbackPage"];
  53175. return $1;
  53176. },
  53177. args: [],
  53178. source: "fallbackPage\x0a\x09^ fallbackPage",
  53179. messageSends: [],
  53180. referencedClasses: []
  53181. }),
  53182. globals.FileServer);
  53183. smalltalk.addMethod(
  53184. smalltalk.method({
  53185. selector: "fallbackPage:",
  53186. protocol: 'accessing',
  53187. fn: function (aString){
  53188. var self=this;
  53189. self["@fallbackPage"]=aString;
  53190. return self},
  53191. args: ["aString"],
  53192. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  53193. messageSends: [],
  53194. referencedClasses: []
  53195. }),
  53196. globals.FileServer);
  53197. smalltalk.addMethod(
  53198. smalltalk.method({
  53199. selector: "handleGETRequest:respondTo:",
  53200. protocol: 'request handling',
  53201. fn: function (aRequest,aResponse){
  53202. var self=this;
  53203. var uri,filename;
  53204. return smalltalk.withContext(function($ctx1) {
  53205. var $1;
  53206. uri=_st(self["@url"])._parse_(_st(aRequest)._url());
  53207. filename=_st(self["@path"])._join_with_(self._basePath(),_st(uri)._pathname());
  53208. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  53209. return smalltalk.withContext(function($ctx2) {
  53210. if(smalltalk.assert(aBoolean)){
  53211. $1=_st(_st(self["@fs"])._statSync_(filename))._isDirectory();
  53212. if(smalltalk.assert($1)){
  53213. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  53214. } else {
  53215. return self._respondFileNamed_to_(filename,aResponse);
  53216. };
  53217. } else {
  53218. return self._respondNotFoundTo_(aResponse);
  53219. };
  53220. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)})}));
  53221. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},globals.FileServer)})},
  53222. args: ["aRequest", "aResponse"],
  53223. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := url parse: aRequest url.\x0a\x09filename := path join: self basePath with: uri pathname.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [(fs statSync: filename) isDirectory\x0a\x09\x09\x09\x09ifTrue: [self respondDirectoryNamed: filename from: uri to: aResponse]\x0a\x09\x09\x09\x09ifFalse: [self respondFileNamed: filename to: aResponse]]]",
  53224. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"],
  53225. referencedClasses: []
  53226. }),
  53227. globals.FileServer);
  53228. smalltalk.addMethod(
  53229. smalltalk.method({
  53230. selector: "handleOPTIONSRequest:respondTo:",
  53231. protocol: 'request handling',
  53232. fn: function (aRequest,aResponse){
  53233. var self=this;
  53234. return smalltalk.withContext(function($ctx1) {
  53235. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Access-Control-Allow-Origin","*","Access-Control-Allow-Methods","GET, PUT, POST, DELETE, OPTIONS","Access-Control-Allow-Headers","Content-Type, Accept","Content-Length",(0),"Access-Control-Max-Age",(10)]));
  53236. _st(aResponse)._end();
  53237. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)})},
  53238. args: ["aRequest", "aResponse"],
  53239. source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end",
  53240. messageSends: ["writeHead:options:", "end"],
  53241. referencedClasses: []
  53242. }),
  53243. globals.FileServer);
  53244. smalltalk.addMethod(
  53245. smalltalk.method({
  53246. selector: "handlePUTRequest:respondTo:",
  53247. protocol: 'request handling',
  53248. fn: function (aRequest,aResponse){
  53249. var self=this;
  53250. var file,stream;
  53251. return smalltalk.withContext(function($ctx1) {
  53252. var $1,$2,$3,$4;
  53253. $1=self._isAuthenticated_(aRequest);
  53254. if(! smalltalk.assert($1)){
  53255. self._respondAuthenticationRequiredTo_(aResponse);
  53256. return nil;
  53257. };
  53258. file=".".__comma(_st(aRequest)._url());
  53259. $ctx1.sendIdx[","]=1;
  53260. stream=_st(self["@fs"])._createWriteStream_(file);
  53261. _st(stream)._on_do_("error",(function(error){
  53262. return smalltalk.withContext(function($ctx2) {
  53263. $2=console;
  53264. $3="Error creating WriteStream for file ".__comma(file);
  53265. $ctx2.sendIdx[","]=2;
  53266. _st($2)._warn_($3);
  53267. $ctx2.sendIdx["warn:"]=1;
  53268. _st(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  53269. $ctx2.sendIdx["warn:"]=2;
  53270. _st(console)._warn_(" The exact error is: ".__comma(error));
  53271. return self._respondNotCreatedTo_(aResponse);
  53272. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  53273. $ctx1.sendIdx["on:do:"]=1;
  53274. _st(stream)._on_do_("close",(function(){
  53275. return smalltalk.withContext(function($ctx2) {
  53276. return self._respondCreatedTo_(aResponse);
  53277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  53278. $ctx1.sendIdx["on:do:"]=2;
  53279. _st(aRequest)._setEncoding_("utf8");
  53280. _st(aRequest)._on_do_("data",(function(data){
  53281. return smalltalk.withContext(function($ctx2) {
  53282. return _st(stream)._write_(data);
  53283. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)})}));
  53284. $ctx1.sendIdx["on:do:"]=3;
  53285. _st(aRequest)._on_do_("end",(function(){
  53286. return smalltalk.withContext(function($ctx2) {
  53287. $4=_st(stream)._writable();
  53288. if(smalltalk.assert($4)){
  53289. return _st(stream)._end();
  53290. };
  53291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  53292. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},globals.FileServer)})},
  53293. args: ["aRequest", "aResponse"],
  53294. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^ nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary directory in your project (often /src)?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  53295. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"],
  53296. referencedClasses: []
  53297. }),
  53298. globals.FileServer);
  53299. smalltalk.addMethod(
  53300. smalltalk.method({
  53301. selector: "handleRequest:respondTo:",
  53302. protocol: 'request handling',
  53303. fn: function (aRequest,aResponse){
  53304. var self=this;
  53305. return smalltalk.withContext(function($ctx1) {
  53306. var $2,$1,$4,$3,$5;
  53307. $2=_st(aRequest)._method();
  53308. $ctx1.sendIdx["method"]=1;
  53309. $1=_st($2).__eq("PUT");
  53310. $ctx1.sendIdx["="]=1;
  53311. if(smalltalk.assert($1)){
  53312. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  53313. };
  53314. $4=_st(aRequest)._method();
  53315. $ctx1.sendIdx["method"]=2;
  53316. $3=_st($4).__eq("GET");
  53317. $ctx1.sendIdx["="]=2;
  53318. if(smalltalk.assert($3)){
  53319. self._handleGETRequest_respondTo_(aRequest,aResponse);
  53320. };
  53321. $5=_st(_st(aRequest)._method()).__eq("OPTIONS");
  53322. if(smalltalk.assert($5)){
  53323. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  53324. };
  53325. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)})},
  53326. args: ["aRequest", "aResponse"],
  53327. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  53328. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  53329. referencedClasses: []
  53330. }),
  53331. globals.FileServer);
  53332. smalltalk.addMethod(
  53333. smalltalk.method({
  53334. selector: "host",
  53335. protocol: 'accessing',
  53336. fn: function (){
  53337. var self=this;
  53338. var $1;
  53339. $1=self["@host"];
  53340. return $1;
  53341. },
  53342. args: [],
  53343. source: "host\x0a\x09^ host",
  53344. messageSends: [],
  53345. referencedClasses: []
  53346. }),
  53347. globals.FileServer);
  53348. smalltalk.addMethod(
  53349. smalltalk.method({
  53350. selector: "host:",
  53351. protocol: 'accessing',
  53352. fn: function (hostname){
  53353. var self=this;
  53354. self["@host"]=hostname;
  53355. return self},
  53356. args: ["hostname"],
  53357. source: "host: hostname\x0a\x09host := hostname",
  53358. messageSends: [],
  53359. referencedClasses: []
  53360. }),
  53361. globals.FileServer);
  53362. smalltalk.addMethod(
  53363. smalltalk.method({
  53364. selector: "initialize",
  53365. protocol: 'initialization',
  53366. fn: function (){
  53367. var self=this;
  53368. return smalltalk.withContext(function($ctx1) {
  53369. var $1;
  53370. ($ctx1.supercall = true, globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []));
  53371. $ctx1.supercall = false;
  53372. self["@path"]=self._require_("path");
  53373. $ctx1.sendIdx["require:"]=1;
  53374. self["@http"]=self._require_("http");
  53375. $ctx1.sendIdx["require:"]=2;
  53376. self["@fs"]=self._require_("fs");
  53377. $ctx1.sendIdx["require:"]=3;
  53378. self["@util"]=self._require_("util");
  53379. $ctx1.sendIdx["require:"]=4;
  53380. self["@url"]=self._require_("url");
  53381. $1=self._class();
  53382. $ctx1.sendIdx["class"]=1;
  53383. self["@host"]=_st($1)._defaultHost();
  53384. self["@port"]=_st(self._class())._defaultPort();
  53385. self["@username"]=nil;
  53386. self["@password"]=nil;
  53387. self["@fallbackPage"]=nil;
  53388. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.FileServer)})},
  53389. args: [],
  53390. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
  53391. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  53392. referencedClasses: []
  53393. }),
  53394. globals.FileServer);
  53395. smalltalk.addMethod(
  53396. smalltalk.method({
  53397. selector: "isAuthenticated:",
  53398. protocol: 'private',
  53399. fn: function (aRequest){
  53400. var self=this;
  53401. var header,token,auth,parts;
  53402. return smalltalk.withContext(function($ctx1) {
  53403. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  53404. $2=_st(self["@username"])._isNil();
  53405. $ctx1.sendIdx["isNil"]=1;
  53406. $1=_st($2)._and_((function(){
  53407. return smalltalk.withContext(function($ctx2) {
  53408. return _st(self["@password"])._isNil();
  53409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  53410. $ctx1.sendIdx["and:"]=1;
  53411. if(smalltalk.assert($1)){
  53412. return true;
  53413. };
  53414. $3=_st(_st(aRequest)._headers())._at_("authorization");
  53415. $ctx1.sendIdx["at:"]=1;
  53416. if(($receiver = $3) == null || $receiver.isNil){
  53417. header="";
  53418. } else {
  53419. header=$3;
  53420. };
  53421. $4=_st(header)._isEmpty();
  53422. if(smalltalk.assert($4)){
  53423. return false;
  53424. } else {
  53425. $5=_st(header)._tokenize_(" ");
  53426. $ctx1.sendIdx["tokenize:"]=1;
  53427. if(($receiver = $5) == null || $receiver.isNil){
  53428. token="";
  53429. } else {
  53430. token=$5;
  53431. };
  53432. token;
  53433. $6=_st(token)._at_((2));
  53434. $ctx1.sendIdx["at:"]=2;
  53435. auth=self._base64Decode_($6);
  53436. auth;
  53437. parts=_st(auth)._tokenize_(":");
  53438. parts;
  53439. $9=self["@username"];
  53440. $10=_st(parts)._at_((1));
  53441. $ctx1.sendIdx["at:"]=3;
  53442. $8=_st($9).__eq($10);
  53443. $ctx1.sendIdx["="]=1;
  53444. $7=_st($8)._and_((function(){
  53445. return smalltalk.withContext(function($ctx2) {
  53446. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  53447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  53448. if(smalltalk.assert($7)){
  53449. return true;
  53450. } else {
  53451. return false;
  53452. };
  53453. };
  53454. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},globals.FileServer)})},
  53455. args: ["aRequest"],
  53456. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^ true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^ false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^ true]\x0a\x09\x09\x09ifFalse: [^ false]\x0a\x09].",
  53457. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="],
  53458. referencedClasses: []
  53459. }),
  53460. globals.FileServer);
  53461. smalltalk.addMethod(
  53462. smalltalk.method({
  53463. selector: "password:",
  53464. protocol: 'accessing',
  53465. fn: function (aPassword){
  53466. var self=this;
  53467. self["@password"]=aPassword;
  53468. return self},
  53469. args: ["aPassword"],
  53470. source: "password: aPassword\x0a\x09password := aPassword.",
  53471. messageSends: [],
  53472. referencedClasses: []
  53473. }),
  53474. globals.FileServer);
  53475. smalltalk.addMethod(
  53476. smalltalk.method({
  53477. selector: "port",
  53478. protocol: 'accessing',
  53479. fn: function (){
  53480. var self=this;
  53481. var $1;
  53482. $1=self["@port"];
  53483. return $1;
  53484. },
  53485. args: [],
  53486. source: "port\x0a\x09^ port",
  53487. messageSends: [],
  53488. referencedClasses: []
  53489. }),
  53490. globals.FileServer);
  53491. smalltalk.addMethod(
  53492. smalltalk.method({
  53493. selector: "port:",
  53494. protocol: 'accessing',
  53495. fn: function (aNumber){
  53496. var self=this;
  53497. self["@port"]=aNumber;
  53498. return self},
  53499. args: ["aNumber"],
  53500. source: "port: aNumber\x0a\x09port := aNumber",
  53501. messageSends: [],
  53502. referencedClasses: []
  53503. }),
  53504. globals.FileServer);
  53505. smalltalk.addMethod(
  53506. smalltalk.method({
  53507. selector: "require:",
  53508. protocol: 'private',
  53509. fn: function (aModuleString){
  53510. var self=this;
  53511. return smalltalk.withContext(function($ctx1) {
  53512. var $1;
  53513. $1=_st(require)._value_(aModuleString);
  53514. return $1;
  53515. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},globals.FileServer)})},
  53516. args: ["aModuleString"],
  53517. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  53518. messageSends: ["value:"],
  53519. referencedClasses: []
  53520. }),
  53521. globals.FileServer);
  53522. smalltalk.addMethod(
  53523. smalltalk.method({
  53524. selector: "respondAuthenticationRequiredTo:",
  53525. protocol: 'request handling',
  53526. fn: function (aResponse){
  53527. var self=this;
  53528. return smalltalk.withContext(function($ctx1) {
  53529. var $1;
  53530. _st(aResponse)._writeHead_options_((401),globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  53531. _st(aResponse)._write_("<html><body>Authentication needed</body></html>");
  53532. $1=_st(aResponse)._end();
  53533. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},globals.FileServer)})},
  53534. args: ["aResponse"],
  53535. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  53536. messageSends: ["writeHead:options:", "write:", "end"],
  53537. referencedClasses: []
  53538. }),
  53539. globals.FileServer);
  53540. smalltalk.addMethod(
  53541. smalltalk.method({
  53542. selector: "respondCreatedTo:",
  53543. protocol: 'request handling',
  53544. fn: function (aResponse){
  53545. var self=this;
  53546. return smalltalk.withContext(function($ctx1) {
  53547. var $1;
  53548. _st(aResponse)._writeHead_options_((201),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  53549. $1=_st(aResponse)._end();
  53550. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},globals.FileServer)})},
  53551. args: ["aResponse"],
  53552. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  53553. messageSends: ["writeHead:options:", "end"],
  53554. referencedClasses: []
  53555. }),
  53556. globals.FileServer);
  53557. smalltalk.addMethod(
  53558. smalltalk.method({
  53559. selector: "respondDirectoryNamed:from:to:",
  53560. protocol: 'request handling',
  53561. fn: function (aDirname,aUrl,aResponse){
  53562. var self=this;
  53563. return smalltalk.withContext(function($ctx1) {
  53564. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  53565. $2=_st(aUrl)._pathname();
  53566. $ctx1.sendIdx["pathname"]=1;
  53567. $1=_st($2)._endsWith_("/");
  53568. if(smalltalk.assert($1)){
  53569. $3=_st(aDirname).__comma("index.html");
  53570. $ctx1.sendIdx[","]=1;
  53571. self._respondFileNamed_to_($3,aResponse);
  53572. } else {
  53573. $5=_st(_st(aUrl)._pathname()).__comma("/");
  53574. $7=_st(aUrl)._search();
  53575. if(($receiver = $7) == null || $receiver.isNil){
  53576. $6="";
  53577. } else {
  53578. $6=$7;
  53579. };
  53580. $4=_st($5).__comma($6);
  53581. $ctx1.sendIdx[","]=2;
  53582. self._respondRedirect_to_($4,aResponse);
  53583. };
  53584. return self}, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},globals.FileServer)})},
  53585. args: ["aDirname", "aUrl", "aResponse"],
  53586. source: "respondDirectoryNamed: aDirname from: aUrl to: aResponse\x0a\x09(aUrl pathname endsWith: '/')\x0a\x09\x09ifTrue: [self respondFileNamed: aDirname, 'index.html' to: aResponse]\x0a\x09\x09ifFalse: [self respondRedirect: aUrl pathname, '/', (aUrl search ifNil: ['']) to: aResponse]",
  53587. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"],
  53588. referencedClasses: []
  53589. }),
  53590. globals.FileServer);
  53591. smalltalk.addMethod(
  53592. smalltalk.method({
  53593. selector: "respondFileNamed:to:",
  53594. protocol: 'request handling',
  53595. fn: function (aFilename,aResponse){
  53596. var self=this;
  53597. var type,filename;
  53598. return smalltalk.withContext(function($ctx1) {
  53599. var $1,$2,$3,$4,$5;
  53600. filename=aFilename;
  53601. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  53602. return smalltalk.withContext(function($ctx2) {
  53603. $1=_st(ex)._notNil();
  53604. if(smalltalk.assert($1)){
  53605. $2=console;
  53606. $3=_st(filename).__comma(" does not exist");
  53607. $ctx2.sendIdx[","]=1;
  53608. _st($2)._log_($3);
  53609. return self._respondNotFoundTo_(aResponse);
  53610. } else {
  53611. type=_st(self._class())._mimeTypeFor_(filename);
  53612. type;
  53613. $4=_st(type).__eq("application/javascript");
  53614. if(smalltalk.assert($4)){
  53615. type=_st(type).__comma(";charset=utf-8");
  53616. type;
  53617. };
  53618. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  53619. _st(aResponse)._write_encoding_(file,"binary");
  53620. $5=_st(aResponse)._end();
  53621. return $5;
  53622. };
  53623. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)})}));
  53624. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},globals.FileServer)})},
  53625. args: ["aFilename", "aResponse"],
  53626. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  53627. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"],
  53628. referencedClasses: []
  53629. }),
  53630. globals.FileServer);
  53631. smalltalk.addMethod(
  53632. smalltalk.method({
  53633. selector: "respondInternalErrorTo:",
  53634. protocol: 'request handling',
  53635. fn: function (aResponse){
  53636. var self=this;
  53637. return smalltalk.withContext(function($ctx1) {
  53638. var $1;
  53639. _st(aResponse)._writeHead_options_((500),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  53640. _st(aResponse)._write_("500 Internal server error");
  53641. $1=_st(aResponse)._end();
  53642. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},globals.FileServer)})},
  53643. args: ["aResponse"],
  53644. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  53645. messageSends: ["writeHead:options:", "write:", "end"],
  53646. referencedClasses: []
  53647. }),
  53648. globals.FileServer);
  53649. smalltalk.addMethod(
  53650. smalltalk.method({
  53651. selector: "respondNotCreatedTo:",
  53652. protocol: 'request handling',
  53653. fn: function (aResponse){
  53654. var self=this;
  53655. return smalltalk.withContext(function($ctx1) {
  53656. var $1;
  53657. _st(aResponse)._writeHead_options_((400),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  53658. _st(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  53659. $1=_st(aResponse)._end();
  53660. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},globals.FileServer)})},
  53661. args: ["aResponse"],
  53662. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the src directory on the server?';\x0a\x09\x09end.",
  53663. messageSends: ["writeHead:options:", "write:", "end"],
  53664. referencedClasses: []
  53665. }),
  53666. globals.FileServer);
  53667. smalltalk.addMethod(
  53668. smalltalk.method({
  53669. selector: "respondNotFoundTo:",
  53670. protocol: 'request handling',
  53671. fn: function (aResponse){
  53672. var self=this;
  53673. return smalltalk.withContext(function($ctx1) {
  53674. var $2,$1,$3,$4;
  53675. $2=self._fallbackPage();
  53676. $ctx1.sendIdx["fallbackPage"]=1;
  53677. $1=_st($2)._isNil();
  53678. if(! smalltalk.assert($1)){
  53679. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  53680. return $3;
  53681. };
  53682. _st(aResponse)._writeHead_options_((404),globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  53683. _st(aResponse)._write_("<html><body><p>404 Not found</p>");
  53684. $ctx1.sendIdx["write:"]=1;
  53685. _st(aResponse)._write_("<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>");
  53686. $ctx1.sendIdx["write:"]=2;
  53687. _st(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  53688. $ctx1.sendIdx["write:"]=3;
  53689. _st(aResponse)._write_("<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>");
  53690. $ctx1.sendIdx["write:"]=4;
  53691. _st(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  53692. $ctx1.sendIdx["write:"]=5;
  53693. _st(aResponse)._write_("</ul></p></body></html>");
  53694. $4=_st(aResponse)._end();
  53695. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},globals.FileServer)})},
  53696. args: ["aResponse"],
  53697. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/html'};\x0a\x09\x09write: '<html><body><p>404 Not found</p>';\x0a\x09\x09write: '<p>Did you forget to put an index.html file into the directory which is served by \x22bin/amber serve\x22? To solve this you can:<ul>';\x0a\x09\x09write: '<li>create an index.html in the served directory.</li>';\x0a\x09\x09write: '<li>can also specify the location of a page to be served whenever path does not resolve to a file with the \x22--fallback-page\x22 option.</li>';\x0a\x09\x09write: '<li>change the directory to be served with the \x22--base-path\x22 option.</li>';\x0a\x09\x09write: '</ul></p></body></html>';\x0a\x09\x09end",
  53698. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"],
  53699. referencedClasses: []
  53700. }),
  53701. globals.FileServer);
  53702. smalltalk.addMethod(
  53703. smalltalk.method({
  53704. selector: "respondOKTo:",
  53705. protocol: 'request handling',
  53706. fn: function (aResponse){
  53707. var self=this;
  53708. return smalltalk.withContext(function($ctx1) {
  53709. var $1;
  53710. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  53711. $1=_st(aResponse)._end();
  53712. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},globals.FileServer)})},
  53713. args: ["aResponse"],
  53714. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  53715. messageSends: ["writeHead:options:", "end"],
  53716. referencedClasses: []
  53717. }),
  53718. globals.FileServer);
  53719. smalltalk.addMethod(
  53720. smalltalk.method({
  53721. selector: "respondRedirect:to:",
  53722. protocol: 'request handling',
  53723. fn: function (aString,aResponse){
  53724. var self=this;
  53725. return smalltalk.withContext(function($ctx1) {
  53726. var $1;
  53727. _st(aResponse)._writeHead_options_((303),globals.HashedCollection._newFromPairs_(["Location",aString]));
  53728. $1=_st(aResponse)._end();
  53729. return self}, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},globals.FileServer)})},
  53730. args: ["aString", "aResponse"],
  53731. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  53732. messageSends: ["writeHead:options:", "end"],
  53733. referencedClasses: []
  53734. }),
  53735. globals.FileServer);
  53736. smalltalk.addMethod(
  53737. smalltalk.method({
  53738. selector: "start",
  53739. protocol: 'starting',
  53740. fn: function (){
  53741. var self=this;
  53742. return smalltalk.withContext(function($ctx1) {
  53743. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  53744. self._checkDirectoryLayout();
  53745. $1=_st(self["@http"])._createServer_((function(request,response){
  53746. return smalltalk.withContext(function($ctx2) {
  53747. return self._handleRequest_respondTo_(request,response);
  53748. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)})}));
  53749. _st($1)._on_do_("error",(function(error){
  53750. return smalltalk.withContext(function($ctx2) {
  53751. $2=console;
  53752. $3="Error starting server: ".__comma(error);
  53753. $ctx2.sendIdx[","]=1;
  53754. return _st($2)._log_($3);
  53755. $ctx2.sendIdx["log:"]=1;
  53756. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  53757. $ctx1.sendIdx["on:do:"]=1;
  53758. _st($1)._on_do_("listening",(function(){
  53759. return smalltalk.withContext(function($ctx2) {
  53760. $4=console;
  53761. $8=self._host();
  53762. $ctx2.sendIdx["host"]=1;
  53763. $7="Starting file server on http://".__comma($8);
  53764. $6=_st($7).__comma(":");
  53765. $ctx2.sendIdx[","]=3;
  53766. $10=self._port();
  53767. $ctx2.sendIdx["port"]=1;
  53768. $9=_st($10)._asString();
  53769. $5=_st($6).__comma($9);
  53770. $ctx2.sendIdx[","]=2;
  53771. return _st($4)._log_($5);
  53772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  53773. $11=_st($1)._listen_host_(self._port(),self._host());
  53774. return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.FileServer)})},
  53775. args: [],
  53776. source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  53777. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"],
  53778. referencedClasses: []
  53779. }),
  53780. globals.FileServer);
  53781. smalltalk.addMethod(
  53782. smalltalk.method({
  53783. selector: "startOn:",
  53784. protocol: 'starting',
  53785. fn: function (aPort){
  53786. var self=this;
  53787. return smalltalk.withContext(function($ctx1) {
  53788. self._port_(aPort);
  53789. self._start();
  53790. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},globals.FileServer)})},
  53791. args: ["aPort"],
  53792. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  53793. messageSends: ["port:", "start"],
  53794. referencedClasses: []
  53795. }),
  53796. globals.FileServer);
  53797. smalltalk.addMethod(
  53798. smalltalk.method({
  53799. selector: "username:",
  53800. protocol: 'accessing',
  53801. fn: function (aUsername){
  53802. var self=this;
  53803. self["@username"]=aUsername;
  53804. return self},
  53805. args: ["aUsername"],
  53806. source: "username: aUsername\x0a\x09username := aUsername.",
  53807. messageSends: [],
  53808. referencedClasses: []
  53809. }),
  53810. globals.FileServer);
  53811. smalltalk.addMethod(
  53812. smalltalk.method({
  53813. selector: "validateBasePath",
  53814. protocol: 'private',
  53815. fn: function (){
  53816. var self=this;
  53817. return smalltalk.withContext(function($ctx1) {
  53818. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  53819. $1=self["@fs"];
  53820. $2=self._basePath();
  53821. $ctx1.sendIdx["basePath"]=1;
  53822. _st($1)._stat_then_($2,(function(err,stat){
  53823. return smalltalk.withContext(function($ctx2) {
  53824. if(($receiver = err) == null || $receiver.isNil){
  53825. $3=_st(stat)._isDirectory();
  53826. if(! smalltalk.assert($3)){
  53827. $4=console;
  53828. $7=self._basePath();
  53829. $ctx2.sendIdx["basePath"]=2;
  53830. $6="Warning: --base-path parameter ".__comma($7);
  53831. $ctx2.sendIdx[","]=2;
  53832. $5=_st($6).__comma(" is not a directory.");
  53833. $ctx2.sendIdx[","]=1;
  53834. return _st($4)._warn_($5);
  53835. $ctx2.sendIdx["warn:"]=1;
  53836. };
  53837. } else {
  53838. $8=console;
  53839. $9=_st("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  53840. $ctx2.sendIdx[","]=3;
  53841. return _st($8)._warn_($9);
  53842. };
  53843. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)})}));
  53844. return self}, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},globals.FileServer)})},
  53845. args: [],
  53846. source: "validateBasePath\x0a\x09\x22The basePath must be an existing directory. \x22\x0a\x09fs stat: self basePath then: [ :err :stat | err\x0a\x09\x09ifNil: [ stat isDirectory ifFalse: [ console warn: 'Warning: --base-path parameter ' , self basePath , ' is not a directory.' ]]\x0a\x09\x09ifNotNil: [ console warn: 'Warning: path at --base-path parameter ' , self basePath , ' does not exist.' ]].",
  53847. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","],
  53848. referencedClasses: []
  53849. }),
  53850. globals.FileServer);
  53851. smalltalk.addMethod(
  53852. smalltalk.method({
  53853. selector: "withBasePath:",
  53854. protocol: 'private',
  53855. fn: function (aBaseRelativePath){
  53856. var self=this;
  53857. return smalltalk.withContext(function($ctx1) {
  53858. var $1;
  53859. $1=_st(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  53860. return $1;
  53861. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},globals.FileServer)})},
  53862. args: ["aBaseRelativePath"],
  53863. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  53864. messageSends: ["join:with:", "basePath"],
  53865. referencedClasses: []
  53866. }),
  53867. globals.FileServer);
  53868. smalltalk.addMethod(
  53869. smalltalk.method({
  53870. selector: "writeData:toFileNamed:",
  53871. protocol: 'private',
  53872. fn: function (data,aFilename){
  53873. var self=this;
  53874. return smalltalk.withContext(function($ctx1) {
  53875. _st(console)._log_(aFilename);
  53876. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},globals.FileServer)})},
  53877. args: ["data", "aFilename"],
  53878. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  53879. messageSends: ["log:"],
  53880. referencedClasses: []
  53881. }),
  53882. globals.FileServer);
  53883. globals.FileServer.klass.iVarNames = ['mimeTypes'];
  53884. smalltalk.addMethod(
  53885. smalltalk.method({
  53886. selector: "commandLineSwitches",
  53887. protocol: 'accessing',
  53888. fn: function (){
  53889. var self=this;
  53890. var switches;
  53891. return smalltalk.withContext(function($ctx1) {
  53892. var $1;
  53893. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  53894. return smalltalk.withContext(function($ctx2) {
  53895. return _st(each)._selector();
  53896. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  53897. $ctx1.sendIdx["collect:"]=1;
  53898. switches=_st(switches)._select_((function(each){
  53899. return smalltalk.withContext(function($ctx2) {
  53900. return _st(each)._match_("^[^:]*:$");
  53901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  53902. switches=_st(switches)._collect_((function(each){
  53903. return smalltalk.withContext(function($ctx2) {
  53904. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  53905. $ctx2.sendIdx["replace:with:"]=1;
  53906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  53907. $1=switches;
  53908. return $1;
  53909. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.FileServer.klass)})},
  53910. args: [],
  53911. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^ switches",
  53912. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  53913. referencedClasses: []
  53914. }),
  53915. globals.FileServer.klass);
  53916. smalltalk.addMethod(
  53917. smalltalk.method({
  53918. selector: "createServerWithArguments:",
  53919. protocol: 'initialization',
  53920. fn: function (options){
  53921. var self=this;
  53922. var server,popFront,front,optionName,optionValue,switches;
  53923. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  53924. return smalltalk.withContext(function($ctx1) {
  53925. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  53926. var $early={};
  53927. try {
  53928. switches=self._commandLineSwitches();
  53929. server=self._new();
  53930. _st(options)._ifEmpty_((function(){
  53931. $1=server;
  53932. throw $early=[$1];
  53933. }));
  53934. $2=_st(_st(options)._size())._even();
  53935. if(! smalltalk.assert($2)){
  53936. _st(console)._log_("Using default parameters.");
  53937. $ctx1.sendIdx["log:"]=1;
  53938. $3=console;
  53939. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  53940. $ctx1.sendIdx[","]=1;
  53941. _st($3)._log_($4);
  53942. $ctx1.sendIdx["log:"]=2;
  53943. $5=console;
  53944. $6="Use any of the following ones: ".__comma(switches);
  53945. $ctx1.sendIdx[","]=2;
  53946. _st($5)._log_($6);
  53947. $ctx1.sendIdx["log:"]=3;
  53948. $7=server;
  53949. return $7;
  53950. };
  53951. popFront=(function(args){
  53952. return smalltalk.withContext(function($ctx2) {
  53953. front=_st(args)._first();
  53954. front;
  53955. _st(args)._remove_(front);
  53956. return front;
  53957. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)})});
  53958. _st((function(){
  53959. return smalltalk.withContext(function($ctx2) {
  53960. return _st(options)._notEmpty();
  53961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
  53962. return smalltalk.withContext(function($ctx2) {
  53963. optionName=_st(popFront)._value_(options);
  53964. $ctx2.sendIdx["value:"]=1;
  53965. optionName;
  53966. optionValue=_st(popFront)._value_(options);
  53967. optionValue;
  53968. $8=_st(switches)._includes_(optionName);
  53969. if(smalltalk.assert($8)){
  53970. optionName=self._selectorForCommandLineSwitch_(optionName);
  53971. optionName;
  53972. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  53973. } else {
  53974. $9=console;
  53975. $10=_st(optionName).__comma(" is not a valid commandline option");
  53976. $ctx2.sendIdx[","]=3;
  53977. _st($9)._log_($10);
  53978. $ctx2.sendIdx["log:"]=4;
  53979. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  53980. };
  53981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  53982. $11=server;
  53983. return $11;
  53984. }
  53985. catch(e) {if(e===$early)return e[0]; throw e}
  53986. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},globals.FileServer.klass)})},
  53987. args: ["options"],
  53988. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^ server.",
  53989. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"],
  53990. referencedClasses: ["Array"]
  53991. }),
  53992. globals.FileServer.klass);
  53993. smalltalk.addMethod(
  53994. smalltalk.method({
  53995. selector: "defaultBasePath",
  53996. protocol: 'accessing',
  53997. fn: function (){
  53998. var self=this;
  53999. return "./";
  54000. },
  54001. args: [],
  54002. source: "defaultBasePath\x0a\x09^ './'",
  54003. messageSends: [],
  54004. referencedClasses: []
  54005. }),
  54006. globals.FileServer.klass);
  54007. smalltalk.addMethod(
  54008. smalltalk.method({
  54009. selector: "defaultHost",
  54010. protocol: 'accessing',
  54011. fn: function (){
  54012. var self=this;
  54013. return "127.0.0.1";
  54014. },
  54015. args: [],
  54016. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  54017. messageSends: [],
  54018. referencedClasses: []
  54019. }),
  54020. globals.FileServer.klass);
  54021. smalltalk.addMethod(
  54022. smalltalk.method({
  54023. selector: "defaultMimeTypes",
  54024. protocol: 'accessing',
  54025. fn: function (){
  54026. var self=this;
  54027. var $1;
  54028. $1=globals.HashedCollection._newFromPairs_(["%","application/x-trash","323","text/h323","abw","application/x-abiword","ai","application/postscript","aif","audio/x-aiff","aifc","audio/x-aiff","aiff","audio/x-aiff","alc","chemical/x-alchemy","art","image/x-jg","asc","text/plain","asf","video/x-ms-asf","asn","chemical/x-ncbi-asn1-spec","aso","chemical/x-ncbi-asn1-binary","asx","video/x-ms-asf","au","audio/basic","avi","video/x-msvideo","b","chemical/x-molconn-Z","bak","application/x-trash","bat","application/x-msdos-program","bcpio","application/x-bcpio","bib","text/x-bibtex","bin","application/octet-stream","bmp","image/x-ms-bmp","book","application/x-maker","bsd","chemical/x-crossfire","c","text/x-csrc","c++","text/x-c++src","c3d","chemical/x-chem3d","cac","chemical/x-cache","cache","chemical/x-cache","cascii","chemical/x-cactvs-binary","cat","application/vnd.ms-pki.seccat","cbin","chemical/x-cactvs-binary","cc","text/x-c++src","cdf","application/x-cdf","cdr","image/x-coreldraw","cdt","image/x-coreldrawtemplate","cdx","chemical/x-cdx","cdy","application/vnd.cinderella","cef","chemical/x-cxf","cer","chemical/x-cerius","chm","chemical/x-chemdraw","chrt","application/x-kchart","cif","chemical/x-cif","class","application/java-vm","cls","text/x-tex","cmdf","chemical/x-cmdf","cml","chemical/x-cml","cod","application/vnd.rim.cod","com","application/x-msdos-program","cpa","chemical/x-compass","cpio","application/x-cpio","cpp","text/x-c++src","cpt","image/x-corelphotopaint","crl","application/x-pkcs7-crl","crt","application/x-x509-ca-cert","csf","chemical/x-cache-csf","csh","text/x-csh","csm","chemical/x-csml","csml","chemical/x-csml","css","text/css","csv","text/comma-separated-values","ctab","chemical/x-cactvs-binary","ctx","chemical/x-ctx","cu","application/cu-seeme","cub","chemical/x-gaussian-cube","cxf","chemical/x-cxf","cxx","text/x-c++src","dat","chemical/x-mopac-input","dcr","application/x-director","deb","application/x-debian-package","dif","video/dv","diff","text/plain","dir","application/x-director","djv","image/vnd.djvu","djvu","image/vnd.djvu","dl","video/dl","dll","application/x-msdos-program","dmg","application/x-apple-diskimage","dms","application/x-dms","doc","application/msword","dot","application/msword","dv","video/dv","dvi","application/x-dvi","dx","chemical/x-jcamp-dx","dxr","application/x-director","emb","chemical/x-embl-dl-nucleotide","embl","chemical/x-embl-dl-nucleotide","ent","chemical/x-pdb","eps","application/postscript","etx","text/x-setext","exe","application/x-msdos-program","ez","application/andrew-inset","fb","application/x-maker","fbdoc","application/x-maker","fch","chemical/x-gaussian-checkpoint","fchk","chemical/x-gaussian-checkpoint","fig","application/x-xfig","flac","application/x-flac","fli","video/fli","fm","application/x-maker","frame","application/x-maker","frm","application/x-maker","gal","chemical/x-gaussian-log","gam","chemical/x-gamess-input","gamin","chemical/x-gamess-input","gau","chemical/x-gaussian-input","gcd","text/x-pcs-gcd","gcf","application/x-graphing-calculator","gcg","chemical/x-gcg8-sequence","gen","chemical/x-genbank","gf","application/x-tex-gf","gif","image/gif","gjc","chemical/x-gaussian-input","gjf","chemical/x-gaussian-input","gl","video/gl","gnumeric","application/x-gnumeric","gpt","chemical/x-mopac-graph","gsf","application/x-font","gsm","audio/x-gsm","gtar","application/x-gtar","h","text/x-chdr","h++","text/x-c++hdr","hdf","application/x-hdf","hh","text/x-c++hdr","hin","chemical/x-hin","hpp","text/x-c++hdr","hqx","application/mac-binhex40","hs","text/x-haskell","hta","application/hta","htc","text/x-component","htm","text/html","html","text/html","hxx","text/x-c++hdr","ica","application/x-ica","ice","x-conference/x-cooltalk","ico","image/x-icon","ics","text/calendar","icz","text/calendar","ief","image/ief","iges","model/iges","igs","model/iges","iii","application/x-iphone","inp","chemical/x-gamess-input","ins","application/x-internet-signup","iso","application/x-iso9660-image","isp","application/x-internet-signup","ist","chemical/x-isostar","istr","chemical/x-isostar","jad","text/vnd.sun.j2me.app-descriptor","jar","application/java-archive","java","text/x-java","jdx","chemical/x-jcamp-dx","jmz","application/x-jmol","jng","image/x-jng","jnlp","application/x-java-jnlp-file","jpe","image/jpeg","jpeg","image/jpeg","jpg","image/jpeg","js","application/javascript","kar","audio/midi","key","application/pgp-keys","kil","application/x-killustrator","kin","chemical/x-kinemage","kpr","application/x-kpresenter","kpt","application/x-kpresenter","ksp","application/x-kspread","kwd","application/x-kword","kwt","application/x-kword","latex","application/x-latex","lha","application/x-lha","lhs","text/x-literate-haskell","lsf","video/x-la-asf","lsx","video/x-la-asf","ltx","text/x-tex","lzh","application/x-lzh","lzx","application/x-lzx","m3u","audio/x-mpegurl","m4a","audio/mpeg","maker","application/x-maker","man","application/x-troff-man","mcif","chemical/x-mmcif","mcm","chemical/x-macmolecule","mdb","application/msaccess","me","application/x-troff-me","mesh","model/mesh","mid","audio/midi","midi","audio/midi","mif","application/x-mif","mm","application/x-freemind","mmd","chemical/x-macromodel-input","mmf","application/vnd.smaf","mml","text/mathml","mmod","chemical/x-macromodel-input","mng","video/x-mng","moc","text/x-moc","mol","chemical/x-mdl-molfile","mol2","chemical/x-mol2","moo","chemical/x-mopac-out","mop","chemical/x-mopac-input","mopcrt","chemical/x-mopac-input","mov","video/quicktime","movie","video/x-sgi-movie","mp2","audio/mpeg","mp3","audio/mpeg","mp4","video/mp4","mpc","chemical/x-mopac-input","mpe","video/mpeg","mpeg","video/mpeg","mpega","audio/mpeg","mpg","video/mpeg","mpga","audio/mpeg","ms","application/x-troff-ms","msh","model/mesh","msi","application/x-msi","mvb","chemical/x-mopac-vib","mxu","video/vnd.mpegurl","nb","application/mathematica","nc","application/x-netcdf","nwc","application/x-nwc","o","application/x-object","oda","application/oda","odb","application/vnd.oasis.opendocument.database","odc","application/vnd.oasis.opendocument.chart","odf","application/vnd.oasis.opendocument.formula","odg","application/vnd.oasis.opendocument.graphics","odi","application/vnd.oasis.opendocument.image","odm","application/vnd.oasis.opendocument.text-master","odp","application/vnd.oasis.opendocument.presentation","ods","application/vnd.oasis.opendocument.spreadsheet","odt","application/vnd.oasis.opendocument.text","ogg","application/ogg","old","application/x-trash","oth","application/vnd.oasis.opendocument.text-web","oza","application/x-oz-application","p","text/x-pascal","p7r","application/x-pkcs7-certreqresp","pac","application/x-ns-proxy-autoconfig","pas","text/x-pascal","pat","image/x-coreldrawpattern","pbm","image/x-portable-bitmap","pcf","application/x-font","pcf.Z","application/x-font","pcx","image/pcx","pdb","chemical/x-pdb","pdf","application/pdf","pfa","application/x-font","pfb","application/x-font","pgm","image/x-portable-graymap","pgn","application/x-chess-pgn","pgp","application/pgp-signature","pk","application/x-tex-pk","pl","text/x-perl","pls","audio/x-scpls","pm","text/x-perl","png","image/png","pnm","image/x-portable-anymap","pot","text/plain","ppm","image/x-portable-pixmap","pps","application/vnd.ms-powerpoint","ppt","application/vnd.ms-powerpoint","prf","application/pics-rules","prt","chemical/x-ncbi-asn1-ascii","ps","application/postscript","psd","image/x-photoshop","psp","text/x-psp","py","text/x-python","pyc","application/x-python-code","pyo","application/x-python-code","qt","video/quicktime","qtl","application/x-quicktimeplayer","ra","audio/x-realaudio","ram","audio/x-pn-realaudio","rar","application/rar","ras","image/x-cmu-raster","rd","chemical/x-mdl-rdfile","rdf","application/rdf+xml","rgb","image/x-rgb","rm","audio/x-pn-realaudio","roff","application/x-troff","ros","chemical/x-rosdal","rpm","application/x-redhat-package-manager","rss","application/rss+xml","rtf","text/rtf","rtx","text/richtext","rxn","chemical/x-mdl-rxnfile","sct","text/scriptlet","sd","chemical/x-mdl-sdfile","sd2","audio/x-sd2","sda","application/vnd.stardivision.draw","sdc","application/vnd.stardivision.calc","sdd","application/vnd.stardivision.impress","sdf","chemical/x-mdl-sdfile","sdp","application/vnd.stardivision.impress","sdw","application/vnd.stardivision.writer","ser","application/java-serialized-object","sgf","application/x-go-sgf","sgl","application/vnd.stardivision.writer-global","sh","text/x-sh","shar","application/x-shar","shtml","text/html","sid","audio/prs.sid","sik","application/x-trash","silo","model/mesh","sis","application/vnd.symbian.install","sit","application/x-stuffit","skd","application/x-koan","skm","application/x-koan","skp","application/x-koan","skt","application/x-koan","smf","application/vnd.stardivision.math","smi","application/smil","smil","application/smil","snd","audio/basic","spc","chemical/x-galactic-spc","spl","application/x-futuresplash","src","application/x-wais-source","stc","application/vnd.sun.xml.calc.template","std","application/vnd.sun.xml.draw.template","sti","application/vnd.sun.xml.impress.template","stl","application/vnd.ms-pki.stl","stw","application/vnd.sun.xml.writer.template","sty","text/x-tex","sv4cpio","application/x-sv4cpio","sv4crc","application/x-sv4crc","svg","image/svg+xml","svgz","image/svg+xml","sw","chemical/x-swissprot","swf","application/x-shockwave-flash","swfl","application/x-shockwave-flash","sxc","application/vnd.sun.xml.calc","sxd","application/vnd.sun.xml.draw","sxg","application/vnd.sun.xml.writer.global","sxi","application/vnd.sun.xml.impress","sxm","application/vnd.sun.xml.math","sxw","application/vnd.sun.xml.writer","t","application/x-troff","tar","application/x-tar","taz","application/x-gtar","tcl","text/x-tcl","tex","text/x-tex","texi","application/x-texinfo","texinfo","application/x-texinfo","text","text/plain","tgf","chemical/x-mdl-tgf","tgz","application/x-gtar","tif","image/tiff","tiff","image/tiff","tk","text/x-tcl","tm","text/texmacs","torrent","application/x-bittorrent","tr","application/x-troff","ts","text/texmacs","tsp","application/dsptype","tsv","text/tab-separated-values","txt","text/plain","udeb","application/x-debian-package","uls","text/iuls","ustar","application/x-ustar","val","chemical/x-ncbi-asn1-binary","vcd","application/x-cdlink","vcf","text/x-vcard","vcs","text/x-vcalendar","vmd","chemical/x-vmd","vms","chemical/x-vamas-iso14976","vor","application/vnd.stardivision.writer","vrm","x-world/x-vrml","vrml","x-world/x-vrml","vsd","application/vnd.visio","wad","application/x-doom","wav","audio/x-wav","wax","audio/x-ms-wax","wbmp","image/vnd.wap.wbmp","wbxml","application/vnd.wap.wbxml","wk","application/x-123","wm","video/x-ms-wm","wma","audio/x-ms-wma","wmd","application/x-ms-wmd","wml","text/vnd.wap.wml","wmlc","application/vnd.wap.wmlc","wmls","text/vnd.wap.wmlscript","wmlsc","application/vnd.wap.wmlscriptc","wmv","video/x-ms-wmv","wmx","video/x-ms-wmx","wmz","application/x-ms-wmz","wp5","application/wordperfect5.1","wpd","application/wordperfect","wrl","x-world/x-vrml","wsc","text/scriptlet","wvx","video/x-ms-wvx","wz","application/x-wingz","xbm","image/x-xbitmap","xcf","application/x-xcf","xht","application/xhtml+xml","xhtml","application/xhtml+xml","xlb","application/vnd.ms-excel","xls","application/vnd.ms-excel","xlt","application/vnd.ms-excel","xml","application/xml","xpi","application/x-xpinstall","xpm","image/x-xpixmap","xsl","application/xml","xtel","chemical/x-xtel","xul","application/vnd.mozilla.xul+xml","xwd","image/x-xwindowdump","xyz","chemical/x-xyz","zip","application/zip","zmt","chemical/x-mopac-input","~","application/x-trash"]);
  54029. return $1;
  54030. },
  54031. args: [],
  54032. source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}",
  54033. messageSends: [],
  54034. referencedClasses: []
  54035. }),
  54036. globals.FileServer.klass);
  54037. smalltalk.addMethod(
  54038. smalltalk.method({
  54039. selector: "defaultPort",
  54040. protocol: 'accessing',
  54041. fn: function (){
  54042. var self=this;
  54043. return (4000);
  54044. },
  54045. args: [],
  54046. source: "defaultPort\x0a\x09^ 4000",
  54047. messageSends: [],
  54048. referencedClasses: []
  54049. }),
  54050. globals.FileServer.klass);
  54051. smalltalk.addMethod(
  54052. smalltalk.method({
  54053. selector: "main",
  54054. protocol: 'initialization',
  54055. fn: function (){
  54056. var self=this;
  54057. var fileServer,args;
  54058. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  54059. return smalltalk.withContext(function($ctx1) {
  54060. var $1,$2;
  54061. var $early={};
  54062. try {
  54063. args=_st(process)._argv();
  54064. _st(args)._removeFrom_to_((1),(3));
  54065. _st(args)._detect_ifNone_((function(each){
  54066. return smalltalk.withContext(function($ctx2) {
  54067. $1=_st(each).__eq("--help");
  54068. if(smalltalk.assert($1)){
  54069. return _st($FileServer())._printHelp();
  54070. };
  54071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  54072. return smalltalk.withContext(function($ctx2) {
  54073. fileServer=_st($FileServer())._createServerWithArguments_(args);
  54074. fileServer;
  54075. $2=_st(fileServer)._start();
  54076. throw $early=[$2];
  54077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  54078. return self}
  54079. catch(e) {if(e===$early)return e[0]; throw e}
  54080. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},globals.FileServer.klass)})},
  54081. args: [],
  54082. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^ fileServer start]",
  54083. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"],
  54084. referencedClasses: ["FileServer"]
  54085. }),
  54086. globals.FileServer.klass);
  54087. smalltalk.addMethod(
  54088. smalltalk.method({
  54089. selector: "mimeTypeFor:",
  54090. protocol: 'accessing',
  54091. fn: function (aString){
  54092. var self=this;
  54093. return smalltalk.withContext(function($ctx1) {
  54094. var $1;
  54095. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  54096. return "text/plain";
  54097. }));
  54098. return $1;
  54099. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},globals.FileServer.klass)})},
  54100. args: ["aString"],
  54101. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  54102. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  54103. referencedClasses: []
  54104. }),
  54105. globals.FileServer.klass);
  54106. smalltalk.addMethod(
  54107. smalltalk.method({
  54108. selector: "mimeTypes",
  54109. protocol: 'accessing',
  54110. fn: function (){
  54111. var self=this;
  54112. return smalltalk.withContext(function($ctx1) {
  54113. var $2,$1,$receiver;
  54114. $2=self["@mimeTypes"];
  54115. if(($receiver = $2) == null || $receiver.isNil){
  54116. self["@mimeTypes"]=self._defaultMimeTypes();
  54117. $1=self["@mimeTypes"];
  54118. } else {
  54119. $1=$2;
  54120. };
  54121. return $1;
  54122. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},globals.FileServer.klass)})},
  54123. args: [],
  54124. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  54125. messageSends: ["ifNil:", "defaultMimeTypes"],
  54126. referencedClasses: []
  54127. }),
  54128. globals.FileServer.klass);
  54129. smalltalk.addMethod(
  54130. smalltalk.method({
  54131. selector: "printHelp",
  54132. protocol: 'accessing',
  54133. fn: function (){
  54134. var self=this;
  54135. return smalltalk.withContext(function($ctx1) {
  54136. _st(console)._log_("Available commandline options are:");
  54137. $ctx1.sendIdx["log:"]=1;
  54138. _st(console)._log_("--help");
  54139. $ctx1.sendIdx["log:"]=2;
  54140. _st(self._commandLineSwitches())._do_((function(each){
  54141. return smalltalk.withContext(function($ctx2) {
  54142. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  54143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  54144. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},globals.FileServer.klass)})},
  54145. args: [],
  54146. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  54147. messageSends: ["log:", "do:", "commandLineSwitches", ","],
  54148. referencedClasses: []
  54149. }),
  54150. globals.FileServer.klass);
  54151. smalltalk.addMethod(
  54152. smalltalk.method({
  54153. selector: "selectorForCommandLineSwitch:",
  54154. protocol: 'accessing',
  54155. fn: function (aSwitch){
  54156. var self=this;
  54157. return smalltalk.withContext(function($ctx1) {
  54158. var $2,$1;
  54159. $2=_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  54160. return smalltalk.withContext(function($ctx2) {
  54161. return _st(_st(each)._second())._asUppercase();
  54162. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  54163. $ctx1.sendIdx["replace:with:"]=1;
  54164. $1=_st($2).__comma(":");
  54165. return $1;
  54166. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},globals.FileServer.klass)})},
  54167. args: ["aSwitch"],
  54168. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^ ((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
  54169. messageSends: [",", "replace:with:", "asUppercase", "second"],
  54170. referencedClasses: []
  54171. }),
  54172. globals.FileServer.klass);
  54173. smalltalk.addClass('Initer', globals.Object, ['path', 'childProcess', 'nmPath'], 'AmberCli');
  54174. smalltalk.addMethod(
  54175. smalltalk.method({
  54176. selector: "bowerInstallThenDo:",
  54177. protocol: 'action',
  54178. fn: function (aBlock){
  54179. var self=this;
  54180. var child;
  54181. return smalltalk.withContext(function($ctx1) {
  54182. var $1;
  54183. child=_st(self["@childProcess"])._exec_thenDo_(_st(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","bower")).__comma(" install"),aBlock);
  54184. $1=_st(child)._stdout();
  54185. $ctx1.sendIdx["stdout"]=1;
  54186. _st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  54187. return self}, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
  54188. args: ["aBlock"],
  54189. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'bower'), ' install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  54190. messageSends: ["exec:thenDo:", ",", "join:with:with:", "pipe:options:", "stdout"],
  54191. referencedClasses: []
  54192. }),
  54193. globals.Initer);
  54194. smalltalk.addMethod(
  54195. smalltalk.method({
  54196. selector: "dirname",
  54197. protocol: 'private',
  54198. fn: function (){
  54199. var self=this;
  54200. return smalltalk.withContext(function($ctx1) {
  54201. return __dirname;
  54202. return self}, function($ctx1) {$ctx1.fill(self,"dirname",{},globals.Initer)})},
  54203. args: [],
  54204. source: "dirname\x0a\x09<return __dirname>",
  54205. messageSends: [],
  54206. referencedClasses: []
  54207. }),
  54208. globals.Initer);
  54209. smalltalk.addMethod(
  54210. smalltalk.method({
  54211. selector: "finishMessage",
  54212. protocol: 'action',
  54213. fn: function (){
  54214. var self=this;
  54215. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  54216. return smalltalk.withContext(function($ctx1) {
  54217. _st(console)._log_([" ", "The project should now be set up.", " ", " ", "To manage project from cli (run tests, recompile),", "the `grunt` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g grunt-cli", " ", "To manage project dependencies,", "the `bower` command-line tool needs to be installed.", "If not present, it can be installed with:", " (sudo) npm install -g bower", " "]._join_(_st($String())._lf()));
  54218. _st((function(){
  54219. }))._valueWithTimeout_((600));
  54220. return self}, function($ctx1) {$ctx1.fill(self,"finishMessage",{},globals.Initer)})},
  54221. args: [],
  54222. source: "finishMessage\x0a\x09console log: (#(\x0a\x09\x09' '\x0a\x09\x09'The project should now be set up.'\x0a\x09\x09' '\x0a\x09\x09' '\x0a\x09\x09'To manage project from cli (run tests, recompile),'\x0a\x09\x09'the `grunt` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g grunt-cli'\x0a\x09\x09' '\x0a\x09\x09'To manage project dependencies,'\x0a\x09\x09'the `bower` command-line tool needs to be installed.'\x0a\x09\x09'If not present, it can be installed with:'\x0a\x09\x09' (sudo) npm install -g bower'\x0a\x09\x09' '\x0a\x09) join: String lf).\x0a\x09[] valueWithTimeout: 600",
  54223. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"],
  54224. referencedClasses: ["String"]
  54225. }),
  54226. globals.Initer);
  54227. smalltalk.addMethod(
  54228. smalltalk.method({
  54229. selector: "gruntInitThenDo:",
  54230. protocol: 'action',
  54231. fn: function (aBlock){
  54232. var self=this;
  54233. var child;
  54234. return smalltalk.withContext(function($ctx1) {
  54235. var $1,$3,$4,$2,$5,$6,$7;
  54236. $1=self["@childProcess"];
  54237. $3=_st(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt-init")).__comma(" ");
  54238. $4=_st(_st(_st(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  54239. $ctx1.sendIdx["replace:with:"]=1;
  54240. $2=_st($3).__comma($4);
  54241. $ctx1.sendIdx[","]=1;
  54242. child=_st($1)._exec_thenDo_($2,aBlock);
  54243. $5=_st(child)._stdout();
  54244. $ctx1.sendIdx["stdout"]=1;
  54245. _st($5)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  54246. $ctx1.sendIdx["pipe:options:"]=1;
  54247. $6=_st(process)._stdin();
  54248. $ctx1.sendIdx["stdin"]=1;
  54249. _st($6)._resume();
  54250. $7=_st(process)._stdin();
  54251. $ctx1.sendIdx["stdin"]=2;
  54252. _st($7)._pipe_options_(_st(child)._stdin(),globals.HashedCollection._newFromPairs_(["end",false]));
  54253. return self}, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
  54254. args: ["aBlock"],
  54255. source: "gruntInitThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'grunt-init'), ' ', (((path join: nmPath with: 'grunt-init-amber') replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:')\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }.\x0a\x09process stdin resume.\x0a\x09process stdin pipe: child stdin options: #{ 'end' -> false }",
  54256. messageSends: ["exec:thenDo:", ",", "join:with:with:", "replace:with:", "join:with:", "pipe:options:", "stdout", "resume", "stdin"],
  54257. referencedClasses: []
  54258. }),
  54259. globals.Initer);
  54260. smalltalk.addMethod(
  54261. smalltalk.method({
  54262. selector: "gruntThenDo:",
  54263. protocol: 'action',
  54264. fn: function (aBlock){
  54265. var self=this;
  54266. var child;
  54267. return smalltalk.withContext(function($ctx1) {
  54268. var $1;
  54269. child=_st(self["@childProcess"])._exec_thenDo_(_st(self["@path"])._join_with_with_(self["@nmPath"],".bin","grunt"),aBlock);
  54270. $1=_st(child)._stdout();
  54271. $ctx1.sendIdx["stdout"]=1;
  54272. _st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  54273. return self}, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
  54274. args: ["aBlock"],
  54275. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: (path join: nmPath with: '.bin' with: 'grunt')\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  54276. messageSends: ["exec:thenDo:", "join:with:with:", "pipe:options:", "stdout"],
  54277. referencedClasses: []
  54278. }),
  54279. globals.Initer);
  54280. smalltalk.addMethod(
  54281. smalltalk.method({
  54282. selector: "initialize",
  54283. protocol: 'initialization',
  54284. fn: function (){
  54285. var self=this;
  54286. return smalltalk.withContext(function($ctx1) {
  54287. ($ctx1.supercall = true, globals.Initer.superclass.fn.prototype._initialize.apply(_st(self), []));
  54288. $ctx1.supercall = false;
  54289. self["@path"]=_st(require)._value_("path");
  54290. $ctx1.sendIdx["value:"]=1;
  54291. self["@childProcess"]=_st(require)._value_("child_process");
  54292. self["@nmPath"]=_st(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  54293. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Initer)})},
  54294. args: [],
  54295. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  54296. messageSends: ["initialize", "value:", "join:with:", "rootDirname"],
  54297. referencedClasses: []
  54298. }),
  54299. globals.Initer);
  54300. smalltalk.addMethod(
  54301. smalltalk.method({
  54302. selector: "npmInstallThenDo:",
  54303. protocol: 'action',
  54304. fn: function (aBlock){
  54305. var self=this;
  54306. var child;
  54307. return smalltalk.withContext(function($ctx1) {
  54308. var $1;
  54309. child=_st(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  54310. $1=_st(child)._stdout();
  54311. $ctx1.sendIdx["stdout"]=1;
  54312. _st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  54313. return self}, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)})},
  54314. args: ["aBlock"],
  54315. source: "npmInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09exec: 'npm install'\x0a\x09\x09thenDo: aBlock.\x0a\x09child stdout pipe: process stdout options: #{ 'end' -> false }",
  54316. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"],
  54317. referencedClasses: []
  54318. }),
  54319. globals.Initer);
  54320. smalltalk.addMethod(
  54321. smalltalk.method({
  54322. selector: "rootDirname",
  54323. protocol: 'private',
  54324. fn: function (){
  54325. var self=this;
  54326. return smalltalk.withContext(function($ctx1) {
  54327. var $1;
  54328. $1=_st(self["@path"])._join_with_(self._dirname(),"..");
  54329. return $1;
  54330. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},globals.Initer)})},
  54331. args: [],
  54332. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  54333. messageSends: ["join:with:", "dirname"],
  54334. referencedClasses: []
  54335. }),
  54336. globals.Initer);
  54337. smalltalk.addMethod(
  54338. smalltalk.method({
  54339. selector: "start",
  54340. protocol: 'action',
  54341. fn: function (){
  54342. var self=this;
  54343. return smalltalk.withContext(function($ctx1) {
  54344. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  54345. self._gruntInitThenDo_((function(error){
  54346. return smalltalk.withContext(function($ctx2) {
  54347. if(($receiver = error) == null || $receiver.isNil){
  54348. return self._bowerInstallThenDo_((function(error2){
  54349. return smalltalk.withContext(function($ctx3) {
  54350. if(($receiver = error2) == null || $receiver.isNil){
  54351. return self._npmInstallThenDo_((function(error3){
  54352. return smalltalk.withContext(function($ctx4) {
  54353. if(($receiver = error3) == null || $receiver.isNil){
  54354. return self._gruntThenDo_((function(error4){
  54355. return smalltalk.withContext(function($ctx5) {
  54356. if(($receiver = error4) == null || $receiver.isNil){
  54357. self._finishMessage();
  54358. return _st(process)._exit();
  54359. } else {
  54360. $7=console;
  54361. _st($7)._log_("grunt exec error:");
  54362. $ctx5.sendIdx["log:"]=7;
  54363. $8=_st($7)._log_(error4);
  54364. $8;
  54365. return _st(process)._exit();
  54366. $ctx5.sendIdx["exit"]=4;
  54367. };
  54368. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)})}));
  54369. } else {
  54370. $5=console;
  54371. _st($5)._log_("npm install exec error:");
  54372. $ctx4.sendIdx["log:"]=5;
  54373. $6=_st($5)._log_(error3);
  54374. $ctx4.sendIdx["log:"]=6;
  54375. $6;
  54376. return _st(process)._exit();
  54377. $ctx4.sendIdx["exit"]=3;
  54378. };
  54379. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)})}));
  54380. } else {
  54381. $3=console;
  54382. _st($3)._log_("bower install exec error:");
  54383. $ctx3.sendIdx["log:"]=3;
  54384. $4=_st($3)._log_(error2);
  54385. $ctx3.sendIdx["log:"]=4;
  54386. $4;
  54387. return _st(process)._exit();
  54388. $ctx3.sendIdx["exit"]=2;
  54389. };
  54390. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)})}));
  54391. } else {
  54392. $1=console;
  54393. _st($1)._log_("grunt-init exec error:");
  54394. $ctx2.sendIdx["log:"]=1;
  54395. $2=_st($1)._log_(error);
  54396. $ctx2.sendIdx["log:"]=2;
  54397. $2;
  54398. return _st(process)._exit();
  54399. $ctx2.sendIdx["exit"]=1;
  54400. };
  54401. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)})}));
  54402. return self}, function($ctx1) {$ctx1.fill(self,"start",{},globals.Initer)})},
  54403. args: [],
  54404. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  54405. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage"],
  54406. referencedClasses: []
  54407. }),
  54408. globals.Initer);
  54409. smalltalk.addClass('NodeTestRunner', globals.Object, [], 'AmberCli');
  54410. smalltalk.addMethod(
  54411. smalltalk.method({
  54412. selector: "runTestSuite",
  54413. protocol: 'not yet classified',
  54414. fn: function (){
  54415. var self=this;
  54416. var suite,worker;
  54417. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  54418. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  54419. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  54420. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  54421. return smalltalk.withContext(function($ctx1) {
  54422. var $2,$1,$3,$9,$8,$12,$11,$10,$7,$6,$15,$14,$13,$5,$4,$17,$16,$19,$18,$26,$25,$24,$23,$22,$28,$27,$21,$20,$30,$29,$32,$31,$39,$38,$37,$36,$35,$34,$33;
  54423. suite=_st($OrderedCollection())._new();
  54424. _st(_st(_st($TestCase())._allSubclasses())._select_((function(each){
  54425. return smalltalk.withContext(function($ctx2) {
  54426. return _st(_st(each)._isAbstract())._not();
  54427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._do_((function(each){
  54428. return smalltalk.withContext(function($ctx2) {
  54429. return _st(suite)._addAll_(_st(each)._buildSuite());
  54430. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  54431. worker=_st($TestSuiteRunner())._on_(suite);
  54432. _st(_st(worker)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  54433. var result;
  54434. return smalltalk.withContext(function($ctx2) {
  54435. result=_st(ann)._result();
  54436. result;
  54437. $2=_st(result)._runs();
  54438. $ctx2.sendIdx["runs"]=1;
  54439. $1=_st($2).__eq(_st(result)._total());
  54440. if(smalltalk.assert($1)){
  54441. $3=console;
  54442. $9=_st(_st(result)._runs())._asString();
  54443. $ctx2.sendIdx["asString"]=1;
  54444. $8=_st($9).__comma(" tests run, ");
  54445. $ctx2.sendIdx[","]=5;
  54446. $12=_st(result)._failures();
  54447. $ctx2.sendIdx["failures"]=1;
  54448. $11=_st($12)._size();
  54449. $ctx2.sendIdx["size"]=1;
  54450. $10=_st($11)._asString();
  54451. $ctx2.sendIdx["asString"]=2;
  54452. $7=_st($8).__comma($10);
  54453. $ctx2.sendIdx[","]=4;
  54454. $6=_st($7).__comma(" failures, ");
  54455. $ctx2.sendIdx[","]=3;
  54456. $15=_st(result)._errors();
  54457. $ctx2.sendIdx["errors"]=1;
  54458. $14=_st($15)._size();
  54459. $13=_st($14)._asString();
  54460. $5=_st($6).__comma($13);
  54461. $ctx2.sendIdx[","]=2;
  54462. $4=_st($5).__comma(" errors.");
  54463. $ctx2.sendIdx[","]=1;
  54464. _st($3)._log_($4);
  54465. $17=_st(result)._failures();
  54466. $ctx2.sendIdx["failures"]=2;
  54467. $16=_st($17)._isEmpty();
  54468. $ctx2.sendIdx["isEmpty"]=1;
  54469. if(! smalltalk.assert($16)){
  54470. $19=_st(result)._failures();
  54471. $ctx2.sendIdx["failures"]=3;
  54472. $18=_st($19)._first();
  54473. $ctx2.sendIdx["first"]=1;
  54474. _st($18)._runCase();
  54475. $ctx2.sendIdx["runCase"]=1;
  54476. $26=_st(result)._failures();
  54477. $ctx2.sendIdx["failures"]=4;
  54478. $25=_st($26)._first();
  54479. $ctx2.sendIdx["first"]=2;
  54480. $24=_st($25)._class();
  54481. $ctx2.sendIdx["class"]=1;
  54482. $23=_st($24)._name();
  54483. $ctx2.sendIdx["name"]=1;
  54484. $22=_st($23).__comma(" >> ");
  54485. $ctx2.sendIdx[","]=8;
  54486. $28=_st(_st(result)._failures())._first();
  54487. $ctx2.sendIdx["first"]=3;
  54488. $27=_st($28)._selector();
  54489. $ctx2.sendIdx["selector"]=1;
  54490. $21=_st($22).__comma($27);
  54491. $ctx2.sendIdx[","]=7;
  54492. $20=_st($21).__comma(" is failing!!");
  54493. $ctx2.sendIdx[","]=6;
  54494. self._throw_($20);
  54495. $ctx2.sendIdx["throw:"]=1;
  54496. };
  54497. $30=_st(result)._errors();
  54498. $ctx2.sendIdx["errors"]=2;
  54499. $29=_st($30)._isEmpty();
  54500. if(! smalltalk.assert($29)){
  54501. $32=_st(result)._errors();
  54502. $ctx2.sendIdx["errors"]=3;
  54503. $31=_st($32)._first();
  54504. $ctx2.sendIdx["first"]=4;
  54505. _st($31)._runCase();
  54506. $39=_st(result)._errors();
  54507. $ctx2.sendIdx["errors"]=4;
  54508. $38=_st($39)._first();
  54509. $ctx2.sendIdx["first"]=5;
  54510. $37=_st($38)._class();
  54511. $36=_st($37)._name();
  54512. $35=_st($36).__comma(" >> ");
  54513. $34=_st($35).__comma(_st(_st(_st(result)._errors())._first())._selector());
  54514. $ctx2.sendIdx[","]=10;
  54515. $33=_st($34).__comma(" has errors!!");
  54516. $ctx2.sendIdx[","]=9;
  54517. return self._throw_($33);
  54518. };
  54519. };
  54520. }, function($ctx2) {$ctx2.fillBlock({ann:ann,result:result},$ctx1,3)})}));
  54521. _st(worker)._run();
  54522. return self}, function($ctx1) {$ctx1.fill(self,"runTestSuite",{suite:suite,worker:worker},globals.NodeTestRunner.klass)})},
  54523. args: [],
  54524. source: "runTestSuite\x0a\x09| suite worker |\x0a\x0a\x09suite := OrderedCollection new.\x0a\x09(TestCase allSubclasses select: [ :each | each isAbstract not ])\x0a\x09\x09do: [ :each | suite addAll: each buildSuite ].\x0a\x0a\x09worker := TestSuiteRunner on: suite.\x0a\x09worker announcer on: ResultAnnouncement do:\x0a\x09\x09[ :ann | | result |\x0a\x09\x09\x09result := ann result.\x0a\x09\x09\x09result runs = result total ifTrue: [\x0a\x09\x09\x09\x09console log: result runs asString, ' tests run, ', result failures size asString, ' failures, ', result errors size asString, ' errors.'.\x0a\x0a\x09\x09\x09\x09result failures isEmpty ifFalse: [\x0a\x09\x09\x09\x09\x09result failures first runCase.\x0a\x09\x09\x09\x09\x09\x22the line above should throw, normally, but just in case I leave the line below\x22\x0a\x09\x09\x09\x09\x09self throw: result failures first class name, ' >> ', result failures first selector, ' is failing!!' ].\x0a\x09\x09\x09\x09result errors isEmpty ifFalse: [\x0a\x09\x09\x09\x09\x09result errors first runCase.\x0a\x09\x09\x09\x09\x09\x22the line above should throw, normally, but just in case I leave the line below\x22\x0a\x09\x09\x09\x09\x09self throw: result errors first class name, ' >> ', result errors first selector, ' has errors!!' ].\x0a\x09]].\x0a\x09worker run",
  54525. messageSends: ["new", "do:", "select:", "allSubclasses", "not", "isAbstract", "addAll:", "buildSuite", "on:", "on:do:", "announcer", "result", "ifTrue:", "=", "runs", "total", "log:", ",", "asString", "size", "failures", "errors", "ifFalse:", "isEmpty", "runCase", "first", "throw:", "name", "class", "selector", "run"],
  54526. referencedClasses: ["OrderedCollection", "TestCase", "TestSuiteRunner", "ResultAnnouncement"]
  54527. }),
  54528. globals.NodeTestRunner.klass);
  54529. smalltalk.addClass('Repl', globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  54530. globals.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support.";
  54531. smalltalk.addMethod(
  54532. smalltalk.method({
  54533. selector: "addVariableNamed:to:",
  54534. protocol: 'private',
  54535. fn: function (aString,anObject){
  54536. var self=this;
  54537. var newClass,newObject;
  54538. return smalltalk.withContext(function($ctx1) {
  54539. var $1;
  54540. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  54541. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  54542. newObject=_st(newClass)._new();
  54543. self._setPreviousVariablesFor_from_(newObject,anObject);
  54544. $1=newObject;
  54545. return $1;
  54546. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},globals.Repl)})},
  54547. args: ["aString", "anObject"],
  54548. source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject",
  54549. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"],
  54550. referencedClasses: []
  54551. }),
  54552. globals.Repl);
  54553. smalltalk.addMethod(
  54554. smalltalk.method({
  54555. selector: "assignNewVariable:do:",
  54556. protocol: 'private',
  54557. fn: function (buffer,aBlock){
  54558. var self=this;
  54559. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  54560. function $ConsoleErrorHandler(){return globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  54561. return smalltalk.withContext(function($ctx1) {
  54562. var $3,$4,$2,$1,$receiver;
  54563. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  54564. var varName,value;
  54565. return smalltalk.withContext(function($ctx2) {
  54566. if(($receiver = name) == null || $receiver.isNil){
  54567. varName=self._nextResultName();
  54568. } else {
  54569. varName=name;
  54570. };
  54571. varName;
  54572. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  54573. self["@session"];
  54574. _st((function(){
  54575. return smalltalk.withContext(function($ctx3) {
  54576. $3=_st(varName).__comma(" := ");
  54577. if(($receiver = expr) == null || $receiver.isNil){
  54578. $4=buffer;
  54579. } else {
  54580. $4=expr;
  54581. };
  54582. $2=_st($3).__comma($4);
  54583. $ctx3.sendIdx[","]=1;
  54584. value=self._eval_on_($2,self["@session"]);
  54585. return value;
  54586. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}))._on_do_($Error(),(function(e){
  54587. return smalltalk.withContext(function($ctx3) {
  54588. _st(_st($ConsoleErrorHandler())._new())._logError_(e);
  54589. value=nil;
  54590. return value;
  54591. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)})}));
  54592. return _st(aBlock)._value_value_(varName,value);
  54593. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)})}));
  54594. return $1;
  54595. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},globals.Repl)})},
  54596. args: ["buffer", "aBlock"],
  54597. source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ConsoleErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  54598. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"],
  54599. referencedClasses: ["Error", "ConsoleErrorHandler"]
  54600. }),
  54601. globals.Repl);
  54602. smalltalk.addMethod(
  54603. smalltalk.method({
  54604. selector: "clearScreen",
  54605. protocol: 'actions',
  54606. fn: function (){
  54607. var self=this;
  54608. var esc,cls;
  54609. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  54610. return smalltalk.withContext(function($ctx1) {
  54611. var $1;
  54612. esc=_st($String())._fromCharCode_((27));
  54613. $1=_st(_st(esc).__comma("[2J")).__comma(esc);
  54614. $ctx1.sendIdx[","]=2;
  54615. cls=_st($1).__comma("[0;0f");
  54616. $ctx1.sendIdx[","]=1;
  54617. _st(_st(process)._stdout())._write_(cls);
  54618. _st(self["@interface"])._prompt();
  54619. return self}, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},globals.Repl)})},
  54620. args: [],
  54621. source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt",
  54622. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"],
  54623. referencedClasses: ["String"]
  54624. }),
  54625. globals.Repl);
  54626. smalltalk.addMethod(
  54627. smalltalk.method({
  54628. selector: "close",
  54629. protocol: 'actions',
  54630. fn: function (){
  54631. var self=this;
  54632. return smalltalk.withContext(function($ctx1) {
  54633. _st(_st(process)._stdin())._destroy();
  54634. return self}, function($ctx1) {$ctx1.fill(self,"close",{},globals.Repl)})},
  54635. args: [],
  54636. source: "close\x0a\x09process stdin destroy",
  54637. messageSends: ["destroy", "stdin"],
  54638. referencedClasses: []
  54639. }),
  54640. globals.Repl);
  54641. smalltalk.addMethod(
  54642. smalltalk.method({
  54643. selector: "commands",
  54644. protocol: 'accessing',
  54645. fn: function (){
  54646. var self=this;
  54647. var $1;
  54648. $1=self["@commands"];
  54649. return $1;
  54650. },
  54651. args: [],
  54652. source: "commands\x0a\x09^ commands",
  54653. messageSends: [],
  54654. referencedClasses: []
  54655. }),
  54656. globals.Repl);
  54657. smalltalk.addMethod(
  54658. smalltalk.method({
  54659. selector: "createInterface",
  54660. protocol: 'actions',
  54661. fn: function (){
  54662. var self=this;
  54663. return smalltalk.withContext(function($ctx1) {
  54664. var $1;
  54665. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  54666. _st(self["@interface"])._on_do_("line",(function(buffer){
  54667. return smalltalk.withContext(function($ctx2) {
  54668. return self._processLine_(buffer);
  54669. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)})}));
  54670. $ctx1.sendIdx["on:do:"]=1;
  54671. _st(self["@interface"])._on_do_("close",(function(){
  54672. return smalltalk.withContext(function($ctx2) {
  54673. return self._close();
  54674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  54675. self._printWelcome();
  54676. self._setupHotkeys();
  54677. $1=self._setPrompt();
  54678. _st(self["@interface"])._prompt();
  54679. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},globals.Repl)})},
  54680. args: [],
  54681. source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt",
  54682. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"],
  54683. referencedClasses: []
  54684. }),
  54685. globals.Repl);
  54686. smalltalk.addMethod(
  54687. smalltalk.method({
  54688. selector: "encapsulateVariable:withValue:in:",
  54689. protocol: 'private',
  54690. fn: function (aString,anObject,aClass){
  54691. var self=this;
  54692. var compiler;
  54693. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  54694. return smalltalk.withContext(function($ctx1) {
  54695. var $1,$4,$3,$2,$5,$6;
  54696. compiler=_st($Compiler())._new();
  54697. $1=compiler;
  54698. $4=_st(aString).__comma(": anObject ^ ");
  54699. $ctx1.sendIdx[","]=3;
  54700. $3=_st($4).__comma(aString);
  54701. $ctx1.sendIdx[","]=2;
  54702. $2=_st($3).__comma(" := anObject");
  54703. $ctx1.sendIdx[","]=1;
  54704. _st($1)._install_forClass_protocol_($2,aClass,"session");
  54705. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  54706. $5=compiler;
  54707. $6=_st(_st(aString).__comma(" ^ ")).__comma(aString);
  54708. $ctx1.sendIdx[","]=4;
  54709. _st($5)._install_forClass_protocol_($6,aClass,"session");
  54710. return self}, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},globals.Repl)})},
  54711. args: ["aString", "anObject", "aClass"],
  54712. source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass protocol: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass protocol: 'session'.",
  54713. messageSends: ["new", "install:forClass:protocol:", ","],
  54714. referencedClasses: ["Compiler"]
  54715. }),
  54716. globals.Repl);
  54717. smalltalk.addMethod(
  54718. smalltalk.method({
  54719. selector: "eval:",
  54720. protocol: 'actions',
  54721. fn: function (buffer){
  54722. var self=this;
  54723. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  54724. return smalltalk.withContext(function($ctx1) {
  54725. var $1;
  54726. $1=self._eval_on_(buffer,_st($DoIt())._new());
  54727. return $1;
  54728. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},globals.Repl)})},
  54729. args: ["buffer"],
  54730. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  54731. messageSends: ["eval:on:", "new"],
  54732. referencedClasses: ["DoIt"]
  54733. }),
  54734. globals.Repl);
  54735. smalltalk.addMethod(
  54736. smalltalk.method({
  54737. selector: "eval:on:",
  54738. protocol: 'actions',
  54739. fn: function (buffer,anObject){
  54740. var self=this;
  54741. var result;
  54742. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  54743. return smalltalk.withContext(function($ctx1) {
  54744. var $1,$2,$3;
  54745. $1=_st(buffer)._isEmpty();
  54746. if(! smalltalk.assert($1)){
  54747. _st((function(){
  54748. return smalltalk.withContext(function($ctx2) {
  54749. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  54750. return result;
  54751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._tryCatch_((function(e){
  54752. return smalltalk.withContext(function($ctx2) {
  54753. $2=_st(e)._isSmalltalkError();
  54754. if(smalltalk.assert($2)){
  54755. return _st(e)._resignal();
  54756. } else {
  54757. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  54758. };
  54759. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
  54760. };
  54761. $3=result;
  54762. return $3;
  54763. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},globals.Repl)})},
  54764. args: ["buffer", "anObject"],
  54765. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09[result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09\x09tryCatch: [:e |\x0a\x09\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  54766. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"],
  54767. referencedClasses: ["Compiler"]
  54768. }),
  54769. globals.Repl);
  54770. smalltalk.addMethod(
  54771. smalltalk.method({
  54772. selector: "executeCommand:",
  54773. protocol: 'private',
  54774. fn: function (aString){
  54775. var self=this;
  54776. return smalltalk.withContext(function($ctx1) {
  54777. var $1;
  54778. var $early={};
  54779. try {
  54780. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  54781. return smalltalk.withContext(function($ctx2) {
  54782. $1=_st(names)._includes_(aString);
  54783. if(smalltalk.assert($1)){
  54784. _st(cmd)._value();
  54785. throw $early=[true];
  54786. };
  54787. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)})}));
  54788. return false;
  54789. }
  54790. catch(e) {if(e===$early)return e[0]; throw e}
  54791. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},globals.Repl)})},
  54792. args: ["aString"],
  54793. source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false",
  54794. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"],
  54795. referencedClasses: []
  54796. }),
  54797. globals.Repl);
  54798. smalltalk.addMethod(
  54799. smalltalk.method({
  54800. selector: "initialize",
  54801. protocol: 'initialization',
  54802. fn: function (){
  54803. var self=this;
  54804. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  54805. return smalltalk.withContext(function($ctx1) {
  54806. ($ctx1.supercall = true, globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []));
  54807. $ctx1.supercall = false;
  54808. self["@session"]=_st($DoIt())._new();
  54809. self["@readline"]=_st(require)._value_("readline");
  54810. $ctx1.sendIdx["value:"]=1;
  54811. self["@util"]=_st(require)._value_("util");
  54812. self._setupCommands();
  54813. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Repl)})},
  54814. args: [],
  54815. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  54816. messageSends: ["initialize", "new", "value:", "setupCommands"],
  54817. referencedClasses: ["DoIt"]
  54818. }),
  54819. globals.Repl);
  54820. smalltalk.addMethod(
  54821. smalltalk.method({
  54822. selector: "instanceVariableNamesFor:",
  54823. protocol: 'private',
  54824. fn: function (aClass){
  54825. var self=this;
  54826. return smalltalk.withContext(function($ctx1) {
  54827. var $2,$3,$1,$receiver;
  54828. $2=_st(aClass)._superclass();
  54829. $ctx1.sendIdx["superclass"]=1;
  54830. if(($receiver = $2) == null || $receiver.isNil){
  54831. $1=_st(aClass)._instanceVariableNames();
  54832. } else {
  54833. $3=_st(aClass)._instanceVariableNames();
  54834. $ctx1.sendIdx["instanceVariableNames"]=1;
  54835. $1=_st($3)._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  54836. };
  54837. return $1;
  54838. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},globals.Repl)})},
  54839. args: ["aClass"],
  54840. source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]",
  54841. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"],
  54842. referencedClasses: []
  54843. }),
  54844. globals.Repl);
  54845. smalltalk.addMethod(
  54846. smalltalk.method({
  54847. selector: "isIdentifier:",
  54848. protocol: 'private',
  54849. fn: function (aString){
  54850. var self=this;
  54851. return smalltalk.withContext(function($ctx1) {
  54852. var $1;
  54853. $1=_st(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  54854. return $1;
  54855. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},globals.Repl)})},
  54856. args: ["aString"],
  54857. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  54858. messageSends: ["match:", "asRegexp"],
  54859. referencedClasses: []
  54860. }),
  54861. globals.Repl);
  54862. smalltalk.addMethod(
  54863. smalltalk.method({
  54864. selector: "isVariableDefined:",
  54865. protocol: 'private',
  54866. fn: function (aString){
  54867. var self=this;
  54868. return smalltalk.withContext(function($ctx1) {
  54869. var $1;
  54870. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  54871. return $1;
  54872. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},globals.Repl)})},
  54873. args: ["aString"],
  54874. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  54875. messageSends: ["includes:", "instanceVariableNamesFor:", "class"],
  54876. referencedClasses: []
  54877. }),
  54878. globals.Repl);
  54879. smalltalk.addMethod(
  54880. smalltalk.method({
  54881. selector: "nextResultName",
  54882. protocol: 'private',
  54883. fn: function (){
  54884. var self=this;
  54885. return smalltalk.withContext(function($ctx1) {
  54886. var $1,$2,$receiver;
  54887. $1=self["@resultCount"];
  54888. if(($receiver = $1) == null || $receiver.isNil){
  54889. self["@resultCount"]=(1);
  54890. } else {
  54891. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  54892. };
  54893. $2="res".__comma(_st(self["@resultCount"])._asString());
  54894. return $2;
  54895. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},globals.Repl)})},
  54896. args: [],
  54897. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  54898. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"],
  54899. referencedClasses: []
  54900. }),
  54901. globals.Repl);
  54902. smalltalk.addMethod(
  54903. smalltalk.method({
  54904. selector: "onKeyPress:",
  54905. protocol: 'private',
  54906. fn: function (key){
  54907. var self=this;
  54908. return smalltalk.withContext(function($ctx1) {
  54909. var $1;
  54910. $1=_st(_st(key)._ctrl())._and_((function(){
  54911. return smalltalk.withContext(function($ctx2) {
  54912. return _st(_st(key)._name()).__eq("l");
  54913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  54914. if(smalltalk.assert($1)){
  54915. self._clearScreen();
  54916. };
  54917. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},globals.Repl)})},
  54918. args: ["key"],
  54919. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  54920. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"],
  54921. referencedClasses: []
  54922. }),
  54923. globals.Repl);
  54924. smalltalk.addMethod(
  54925. smalltalk.method({
  54926. selector: "parseAssignment:do:",
  54927. protocol: 'private',
  54928. fn: function (aString,aBlock){
  54929. var self=this;
  54930. var assignment;
  54931. return smalltalk.withContext(function($ctx1) {
  54932. var $3,$2,$1;
  54933. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  54934. return smalltalk.withContext(function($ctx2) {
  54935. return _st(s)._trimBoth();
  54936. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)})}));
  54937. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  54938. return smalltalk.withContext(function($ctx2) {
  54939. $3=_st(assignment)._first();
  54940. $ctx2.sendIdx["first"]=1;
  54941. return self._isIdentifier_($3);
  54942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  54943. if(smalltalk.assert($2)){
  54944. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  54945. $ctx1.sendIdx["value:value:"]=1;
  54946. } else {
  54947. $1=_st(aBlock)._value_value_(nil,nil);
  54948. };
  54949. return $1;
  54950. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},globals.Repl)})},
  54951. args: ["aString", "aBlock"],
  54952. source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [ aBlock value: assignment first value: assignment last ]\x0a\x09\x09ifFalse: [ aBlock value: nil value: nil ]",
  54953. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"],
  54954. referencedClasses: []
  54955. }),
  54956. globals.Repl);
  54957. smalltalk.addMethod(
  54958. smalltalk.method({
  54959. selector: "presentResultNamed:withValue:",
  54960. protocol: 'private',
  54961. fn: function (varName,value){
  54962. var self=this;
  54963. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54964. return smalltalk.withContext(function($ctx1) {
  54965. var $3,$2,$1,$4;
  54966. $3=_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name());
  54967. $ctx1.sendIdx[","]=3;
  54968. $2=_st($3).__comma(" = ");
  54969. $ctx1.sendIdx[","]=2;
  54970. $1=_st($2).__comma(_st(value)._asString());
  54971. $ctx1.sendIdx[","]=1;
  54972. _st($Transcript())._show_($1);
  54973. $4=_st($Transcript())._cr();
  54974. _st(self["@interface"])._prompt();
  54975. return self}, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},globals.Repl)})},
  54976. args: ["varName", "value"],
  54977. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  54978. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"],
  54979. referencedClasses: ["Transcript"]
  54980. }),
  54981. globals.Repl);
  54982. smalltalk.addMethod(
  54983. smalltalk.method({
  54984. selector: "printWelcome",
  54985. protocol: 'actions',
  54986. fn: function (){
  54987. var self=this;
  54988. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  54989. return smalltalk.withContext(function($ctx1) {
  54990. var $1;
  54991. _st($Transcript())._show_("Type :q to exit.");
  54992. $1=_st($Transcript())._cr();
  54993. return self}, function($ctx1) {$ctx1.fill(self,"printWelcome",{},globals.Repl)})},
  54994. args: [],
  54995. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  54996. messageSends: ["show:", "cr"],
  54997. referencedClasses: ["Transcript"]
  54998. }),
  54999. globals.Repl);
  55000. smalltalk.addMethod(
  55001. smalltalk.method({
  55002. selector: "processLine:",
  55003. protocol: 'private',
  55004. fn: function (buffer){
  55005. var self=this;
  55006. var show;
  55007. return smalltalk.withContext(function($ctx1) {
  55008. var $1,$2;
  55009. show=(function(varName,value){
  55010. return smalltalk.withContext(function($ctx2) {
  55011. return self._presentResultNamed_withValue_(varName,value);
  55012. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)})});
  55013. $1=self._executeCommand_(buffer);
  55014. if(! smalltalk.assert($1)){
  55015. $2=self._isVariableDefined_(buffer);
  55016. if(smalltalk.assert($2)){
  55017. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  55018. } else {
  55019. self._assignNewVariable_do_(buffer,show);
  55020. };
  55021. };
  55022. return self}, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},globals.Repl)})},
  55023. args: ["buffer"],
  55024. source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]",
  55025. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"],
  55026. referencedClasses: []
  55027. }),
  55028. globals.Repl);
  55029. smalltalk.addMethod(
  55030. smalltalk.method({
  55031. selector: "prompt",
  55032. protocol: 'accessing',
  55033. fn: function (){
  55034. var self=this;
  55035. return "amber >> ";
  55036. },
  55037. args: [],
  55038. source: "prompt\x0a\x09^ 'amber >> '",
  55039. messageSends: [],
  55040. referencedClasses: []
  55041. }),
  55042. globals.Repl);
  55043. smalltalk.addMethod(
  55044. smalltalk.method({
  55045. selector: "setPreviousVariablesFor:from:",
  55046. protocol: 'private',
  55047. fn: function (newObject,oldObject){
  55048. var self=this;
  55049. return smalltalk.withContext(function($ctx1) {
  55050. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  55051. return smalltalk.withContext(function($ctx2) {
  55052. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  55053. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  55054. return self}, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},globals.Repl)})},
  55055. args: ["newObject", "oldObject"],
  55056. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  55057. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"],
  55058. referencedClasses: []
  55059. }),
  55060. globals.Repl);
  55061. smalltalk.addMethod(
  55062. smalltalk.method({
  55063. selector: "setPrompt",
  55064. protocol: 'actions',
  55065. fn: function (){
  55066. var self=this;
  55067. return smalltalk.withContext(function($ctx1) {
  55068. _st(self["@interface"])._setPrompt_(self._prompt());
  55069. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},globals.Repl)})},
  55070. args: [],
  55071. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  55072. messageSends: ["setPrompt:", "prompt"],
  55073. referencedClasses: []
  55074. }),
  55075. globals.Repl);
  55076. smalltalk.addMethod(
  55077. smalltalk.method({
  55078. selector: "setupCommands",
  55079. protocol: 'initialization',
  55080. fn: function (){
  55081. var self=this;
  55082. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  55083. return smalltalk.withContext(function($ctx1) {
  55084. var $2,$1;
  55085. $2=_st([":q"]).__minus_gt((function(){
  55086. return smalltalk.withContext(function($ctx2) {
  55087. return _st(process)._exit();
  55088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  55089. $ctx1.sendIdx["->"]=1;
  55090. $1=[$2,_st([""]).__minus_gt((function(){
  55091. return smalltalk.withContext(function($ctx2) {
  55092. return _st(self["@interface"])._prompt();
  55093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))];
  55094. self["@commands"]=_st($Dictionary())._from_($1);
  55095. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.Repl)})},
  55096. args: [],
  55097. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  55098. messageSends: ["from:", "->", "exit", "prompt"],
  55099. referencedClasses: ["Dictionary"]
  55100. }),
  55101. globals.Repl);
  55102. smalltalk.addMethod(
  55103. smalltalk.method({
  55104. selector: "setupHotkeys",
  55105. protocol: 'initialization',
  55106. fn: function (){
  55107. var self=this;
  55108. return smalltalk.withContext(function($ctx1) {
  55109. var $receiver;
  55110. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  55111. return smalltalk.withContext(function($ctx2) {
  55112. if(($receiver = key) == null || $receiver.isNil){
  55113. return key;
  55114. } else {
  55115. return self._onKeyPress_(key);
  55116. };
  55117. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)})}));
  55118. return self}, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},globals.Repl)})},
  55119. args: [],
  55120. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  55121. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"],
  55122. referencedClasses: []
  55123. }),
  55124. globals.Repl);
  55125. smalltalk.addMethod(
  55126. smalltalk.method({
  55127. selector: "subclass:withVariable:",
  55128. protocol: 'private',
  55129. fn: function (aClass,varName){
  55130. var self=this;
  55131. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  55132. return smalltalk.withContext(function($ctx1) {
  55133. var $1;
  55134. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  55135. return $1;
  55136. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},globals.Repl)})},
  55137. args: ["aClass", "varName"],
  55138. source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'",
  55139. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"],
  55140. referencedClasses: ["ClassBuilder"]
  55141. }),
  55142. globals.Repl);
  55143. smalltalk.addMethod(
  55144. smalltalk.method({
  55145. selector: "subclassNameFor:",
  55146. protocol: 'private',
  55147. fn: function (aClass){
  55148. var self=this;
  55149. return smalltalk.withContext(function($ctx1) {
  55150. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  55151. $3=_st(aClass)._name();
  55152. $ctx1.sendIdx["name"]=1;
  55153. $2=_st($3)._matchesOf_("\x5cd+$");
  55154. $ctx1.sendIdx["matchesOf:"]=1;
  55155. if(($receiver = $2) == null || $receiver.isNil){
  55156. $1=_st(_st(aClass)._name()).__comma("2");
  55157. } else {
  55158. var counter;
  55159. $7=_st(aClass)._name();
  55160. $ctx1.sendIdx["name"]=2;
  55161. $6=_st($7)._matchesOf_("\x5cd+$");
  55162. $5=_st($6)._first();
  55163. $4=_st($5)._asNumber();
  55164. counter=_st($4).__plus((1));
  55165. counter;
  55166. $8=_st(aClass)._name();
  55167. $ctx1.sendIdx["name"]=3;
  55168. $1=_st($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  55169. };
  55170. return $1;
  55171. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},globals.Repl)})},
  55172. args: ["aClass"],
  55173. source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].",
  55174. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","],
  55175. referencedClasses: []
  55176. }),
  55177. globals.Repl);
  55178. smalltalk.addMethod(
  55179. smalltalk.method({
  55180. selector: "main",
  55181. protocol: 'initialization',
  55182. fn: function (){
  55183. var self=this;
  55184. return smalltalk.withContext(function($ctx1) {
  55185. _st(self._new())._createInterface();
  55186. return self}, function($ctx1) {$ctx1.fill(self,"main",{},globals.Repl.klass)})},
  55187. args: [],
  55188. source: "main\x0a\x09self new createInterface",
  55189. messageSends: ["createInterface", "new"],
  55190. referencedClasses: []
  55191. }),
  55192. globals.Repl.klass);
  55193. });
  55194. define("amber_vm/boot", ["amber/boot"], function (boot) { return boot; });
  55195. define("amber/_init", ["amber/boot","amber_vm/smalltalk","amber_vm/globals","amber_vm/nil","amber_vm/_st","amber_core/Kernel-Objects","amber_core/Kernel-Classes","amber_core/Kernel-Methods","amber_core/Kernel-Collections","amber_core/Kernel-Infrastructure","amber_core/Kernel-Exceptions","amber_core/Kernel-Transcript","amber_core/Kernel-Announcements","amber_core/Compiler-Exceptions","amber_core/Compiler-Core","amber_core/Compiler-AST","amber_core/Compiler-IR","amber_core/Compiler-Inlining","amber_core/Compiler-Semantic","amber_core/Compiler-Interpreter","amber/parser","amber_core/SUnit","amber_core/Kernel-ImportExport","amber_core/Kernel-Tests","amber_core/Compiler-Tests","amber_core/SUnit-Tests","amber_cli/AmberCli"], function (boot) {
  55196. boot.vm.initialize();
  55197. var vm = boot.vm, globals = boot.globals;
  55198. globals.AmberCli._main();
  55199. });
  55200. requirejs("amber/_init");