amber-cli.js 2.7 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455
  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. if (src == null) { target[keys[i]] = undefined; } else {
  292. var value = src[keys[i]];
  293. if (typeof value !== "undefined") { target[keys[i]] = value; }
  294. }
  295. }
  296. return target;
  297. }
  298. var d={value: null, enumerable: false, configurable: true, writable: true};
  299. Object.defineProperties(this, { ensure: d, rebuild: d });
  300. var exclude = mixin(this, {});
  301. this.rebuild = function () {
  302. Object.keys(backup).forEach(function (key) {
  303. mixin(null, api, (backup[key]||0)[apiKey]||{});
  304. });
  305. var oapi = mixin(api, {}), order = [], chk = {};
  306. brikz.ensure = function(key) {
  307. if (key in exclude) { return null; }
  308. var b = brikz[key], bak = backup[key];
  309. mixin(null, api, api);
  310. while (typeof b === "function") { b = new b(brikz, api, bak); }
  311. if (b && !chk[key]) { chk[key]=true; order.push(b); }
  312. if (b && !b[apiKey]) { b[apiKey] = mixin(api, {}); }
  313. return brikz[key] = b;
  314. };
  315. Object.keys(brikz).forEach(function (key) { brikz.ensure(key); });
  316. brikz.ensure = null;
  317. mixin(oapi, mixin(null, api, api));
  318. order.forEach(function(brik) { mixin(brik[apiKey] || {}, api); });
  319. order.forEach(function(brik) { brik[initKey] && brik[initKey](); });
  320. backup = mixin(brikz, {});
  321. };
  322. }
  323. /* Brikz end */
  324. function inherits(child, parent) {
  325. child.prototype = Object.create(parent.prototype, {
  326. constructor: { value: child,
  327. enumerable: false, configurable: true, writable: true }
  328. });
  329. return child;
  330. }
  331. var globals = {};
  332. globals.SmalltalkSettings = {};
  333. var api = Object.create(globals);
  334. var brikz = new Brikz(api);
  335. function RootBrik(brikz, st) {
  336. /* Smalltalk foundational objects */
  337. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  338. All objects including `Object` inherit from SmalltalkRoot */
  339. function SmalltalkRoot() {}
  340. function SmalltalkProtoObject() {}
  341. inherits(SmalltalkProtoObject, SmalltalkRoot);
  342. function SmalltalkObject() {}
  343. inherits(SmalltalkObject, SmalltalkProtoObject);
  344. function SmalltalkNil() {}
  345. inherits(SmalltalkNil, SmalltalkObject);
  346. this.Object = SmalltalkObject;
  347. this.nil = new SmalltalkNil();
  348. // Adds an `isNil` property to the `nil` object. When sending
  349. // nil objects from one environment to another, doing
  350. // `anObject == nil` (in JavaScript) does not always answer
  351. // true as the referenced nil object might come from the other
  352. // environment.
  353. Object.defineProperty(this.nil, 'isNil', {
  354. value: true,
  355. enumerable: false, configurable: false, writable: false
  356. });
  357. // Hidden root class of the system.
  358. this.rootAsClass = {fn: SmalltalkRoot};
  359. this.__init__ = function () {
  360. st.addPackage("Kernel-Objects");
  361. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  362. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  363. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  364. };
  365. }
  366. function OrganizeBrik(brikz, st) {
  367. brikz.ensure("augments");
  368. var SmalltalkObject = brikz.ensure("root").Object;
  369. function SmalltalkOrganizer () {}
  370. function SmalltalkPackageOrganizer () {
  371. this.elements = [];
  372. }
  373. function SmalltalkClassOrganizer () {
  374. this.elements = [];
  375. }
  376. inherits(SmalltalkOrganizer, SmalltalkObject);
  377. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  378. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  379. this.__init__ = function () {
  380. st.addPackage("Kernel-Infrastructure");
  381. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  382. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  383. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  384. };
  385. this.setupClassOrganization = function (klass) {
  386. klass.organization = new SmalltalkClassOrganizer();
  387. klass.organization.theClass = klass;
  388. };
  389. this.setupPackageOrganization = function (pkg) {
  390. pkg.organization = new SmalltalkPackageOrganizer();
  391. };
  392. this.addOrganizationElement = function (owner, element) {
  393. owner.organization.elements.addElement(element);
  394. };
  395. this.removeOrganizationElement = function (owner, element) {
  396. owner.organization.elements.removeElement(element);
  397. };
  398. }
  399. function DNUBrik(brikz, st) {
  400. brikz.ensure("selectorConversion");
  401. brikz.ensure("messageSend");
  402. var manip = brikz.ensure("manipulation");
  403. var rootAsClass = brikz.ensure("root").rootAsClass;
  404. /* Method not implemented handlers */
  405. var methods = [], checker = Object.create(null);
  406. this.selectors = [];
  407. this.get = function (stSelector) {
  408. var index = this.selectors.indexOf(stSelector);
  409. if(index !== -1) {
  410. return methods[index];
  411. }
  412. this.selectors.push(stSelector);
  413. var jsSelector = st.selector(stSelector);
  414. checker[jsSelector] = true;
  415. var method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  416. methods.push(method);
  417. manip.installMethod(method, rootAsClass);
  418. return method;
  419. };
  420. this.isSelector = function (jsSelector) {
  421. return checker[jsSelector];
  422. };
  423. /* Dnu handler method */
  424. function createHandler(stSelector) {
  425. return function() {
  426. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  427. };
  428. }
  429. this.installHandlers = function (klass) {
  430. for(var i=0; i<methods.length; i++) {
  431. manip.installMethodIfAbsent(methods[i], klass);
  432. }
  433. };
  434. }
  435. function ClassInitBrik(brikz, st) {
  436. var dnu = brikz.ensure("dnu");
  437. var manip = brikz.ensure("manipulation");
  438. var nil = brikz.ensure("root").nil;
  439. /* Initialize a class in its class hierarchy. Handle both classes and
  440. metaclasses. */
  441. st.init = function(klass) {
  442. st.initClass(klass);
  443. if(klass.klass && !klass.meta) {
  444. st.initClass(klass.klass);
  445. }
  446. };
  447. st.initClass = function(klass) {
  448. if(klass.wrapped) {
  449. copySuperclass(klass);
  450. dnu.installHandlers(klass);
  451. }
  452. };
  453. function copySuperclass(klass, superclass) {
  454. var inheritedMethods = Object.create(null);
  455. deinstallAllMethods(klass);
  456. for (superclass = superclass || klass.superclass;
  457. superclass && superclass !== nil;
  458. superclass = superclass.superclass) {
  459. for (var keys = Object.keys(superclass.methods), i = 0; i < keys.length; i++) {
  460. inheritMethodIfAbsent(superclass.methods[keys[i]]);
  461. }
  462. }
  463. manip.reinstallMethods(klass);
  464. function inheritMethodIfAbsent(method) {
  465. var selector = method.selector;
  466. //TODO: prepare klass methods into inheritedMethods to only test once
  467. if(klass.methods[selector] || inheritedMethods[selector]) {
  468. return;
  469. }
  470. manip.installMethod(method, klass);
  471. inheritedMethods[method.selector] = true;
  472. }
  473. }
  474. function deinstallAllMethods(klass) {
  475. var proto = klass.fn.prototype;
  476. for(var keys = Object.getOwnPropertyNames(proto), i=0; i<keys.length; i++) {
  477. var key = keys[i];
  478. if (dnu.isSelector(key)) {
  479. proto[key] = null;
  480. }
  481. }
  482. }
  483. }
  484. function ManipulationBrik(brikz, st) {
  485. this.installMethodIfAbsent = function (handler, klass) {
  486. if(!klass.fn.prototype[handler.jsSelector]) {
  487. installMethod(handler, klass);
  488. }
  489. };
  490. function installMethod (method, klass) {
  491. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  492. value: method.fn,
  493. enumerable: false, configurable: true, writable: true
  494. });
  495. }
  496. this.installMethod = installMethod;
  497. this.reinstallMethods = function (klass) {
  498. var methods = klass.methods;
  499. for(var keys = Object.keys(methods), i=0; i<keys.length; i++) {
  500. installMethod(methods[keys[i]], klass);
  501. }
  502. };
  503. }
  504. function ClassesBrik(brikz, st) {
  505. var org = brikz.ensure("organize");
  506. var root = brikz.ensure("root");
  507. brikz.ensure("classInit");
  508. var nil = root.nil;
  509. var rootAsClass = root.rootAsClass;
  510. var SmalltalkObject = root.Object;
  511. rootAsClass.klass = {fn: SmalltalkClass};
  512. function SmalltalkPackage() {}
  513. function SmalltalkBehavior() {}
  514. function SmalltalkClass() {}
  515. function SmalltalkMetaclass() {}
  516. inherits(SmalltalkPackage, SmalltalkObject);
  517. inherits(SmalltalkBehavior, SmalltalkObject);
  518. inherits(SmalltalkClass, SmalltalkBehavior);
  519. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  520. SmalltalkMetaclass.prototype.meta = true;
  521. this.__init__ = function () {
  522. st.addPackage("Kernel-Classes");
  523. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  524. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  525. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  526. // Manually bootstrap the metaclass hierarchy
  527. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  528. addSubclass(globals.ProtoObject.klass);
  529. st.addPackage("Kernel-Infrastructure");
  530. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  531. };
  532. /* Smalltalk classes */
  533. var classes = [];
  534. var wrappedClasses = [];
  535. /* We hold all Packages in a separate Object */
  536. st.packages = {};
  537. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  538. function pkg(spec) {
  539. var that = new SmalltalkPackage();
  540. that.pkgName = spec.pkgName;
  541. org.setupPackageOrganization(that);
  542. that.properties = spec.properties || {};
  543. return that;
  544. }
  545. /* Smalltalk class creation. A class is an instance of an automatically
  546. created metaclass object. Newly created classes (not their metaclass)
  547. should be added to the smalltalk object, see smalltalk.addClass().
  548. Superclass linking is *not* handled here, see smalltalk.init() */
  549. function klass(spec) {
  550. spec = spec || {};
  551. var setSuperClass = spec.superclass;
  552. if(!spec.superclass) {
  553. spec.superclass = rootAsClass;
  554. }
  555. var meta = metaclass(spec);
  556. var that = meta.instanceClass;
  557. that.superclass = setSuperClass;
  558. that.fn = spec.fn || inherits(function () {}, spec.superclass.fn);
  559. that.subclasses = [];
  560. setupClass(that, spec);
  561. that.className = spec.className;
  562. that.wrapped = spec.wrapped || false;
  563. meta.className = spec.className + ' class';
  564. meta.superclass = spec.superclass.klass;
  565. return that;
  566. }
  567. function metaclass(spec) {
  568. spec = spec || {};
  569. var that = new SmalltalkMetaclass();
  570. that.fn = inherits(function () {}, spec.superclass.klass.fn);
  571. that.instanceClass = new that.fn();
  572. setupClass(that);
  573. return that;
  574. }
  575. SmalltalkBehavior.prototype.toString = function () {
  576. return 'Smalltalk ' + this.className;
  577. };
  578. function wireKlass(klass) {
  579. Object.defineProperty(klass.fn.prototype, "klass", {
  580. value: klass,
  581. enumerable: false, configurable: true, writable: true
  582. });
  583. }
  584. function setupClass(klass, spec) {
  585. spec = spec || {};
  586. klass.iVarNames = spec.iVarNames || [];
  587. klass.pkg = spec.pkg;
  588. org.setupClassOrganization(klass);
  589. Object.defineProperty(klass, "methods", {
  590. value: Object.create(null),
  591. enumerable: false, configurable: true, writable: true
  592. });
  593. wireKlass(klass);
  594. }
  595. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  596. If pkgName is null or empty we return nil, which is an allowed package for a class.
  597. If package already exists we still update the properties of it. */
  598. st.addPackage = function(pkgName, properties) {
  599. if(!pkgName) {return nil;}
  600. if(!(st.packages[pkgName])) {
  601. st.packages[pkgName] = pkg({
  602. pkgName: pkgName,
  603. properties: properties
  604. });
  605. } else {
  606. if(properties) {
  607. st.packages[pkgName].properties = properties;
  608. }
  609. }
  610. return st.packages[pkgName];
  611. };
  612. /* Add a class to the smalltalk object, creating a new one if needed.
  613. A Package is lazily created if it does not exist with given name. */
  614. st.addClass = function(className, superclass, iVarNames, pkgName) {
  615. // While subclassing nil is allowed, it might be an error, so
  616. // warn about it.
  617. if (typeof superclass == 'undefined' || superclass == nil) {
  618. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  619. }
  620. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  621. };
  622. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  623. var pkg = st.packages[pkgName];
  624. if (!pkg) {
  625. throw new Error("Missing package "+pkgName);
  626. }
  627. if (!superclass || superclass == nil) { superclass = null; }
  628. if(globals[className] && globals[className].superclass == superclass) {
  629. // globals[className].superclass = superclass;
  630. globals[className].iVarNames = iVarNames || [];
  631. if (pkg) globals[className].pkg = pkg;
  632. if (fn) {
  633. fn.prototype = globals[className].fn.prototype;
  634. globals[className].fn = fn;
  635. fn.prototype.constructor = fn;
  636. }
  637. } else {
  638. if(globals[className]) {
  639. st.removeClass(globals[className]);
  640. }
  641. globals[className] = klass({
  642. className: className,
  643. superclass: superclass,
  644. pkg: pkg,
  645. iVarNames: iVarNames,
  646. fn: fn,
  647. wrapped: wrapped
  648. });
  649. addSubclass(globals[className]);
  650. }
  651. classes.addElement(globals[className]);
  652. org.addOrganizationElement(pkg, globals[className]);
  653. }
  654. st.removeClass = function(klass) {
  655. org.removeOrganizationElement(klass.pkg, klass);
  656. classes.removeElement(klass);
  657. removeSubclass(klass);
  658. delete globals[klass.className];
  659. };
  660. function addSubclass(klass) {
  661. if(klass.superclass) {
  662. klass.superclass.subclasses.addElement(klass);
  663. }
  664. }
  665. function removeSubclass(klass) {
  666. if(klass.superclass) {
  667. klass.superclass.subclasses.removeElement(klass);
  668. }
  669. }
  670. /* Create a new class wrapping a JavaScript constructor, and add it to the
  671. global smalltalk object. Package is lazily created if it does not exist with given name. */
  672. st.wrapClassName = function(className, pkgName, fn, superclass, wrapped) {
  673. wrapped = wrapped !== false;
  674. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  675. if(wrapped) {
  676. wrappedClasses.addElement(globals[className]);
  677. }
  678. };
  679. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  680. st.setClassConstructor = function(klass, constructor) {
  681. wrappedClasses.addElement(klass);
  682. klass.wrapped = true;
  683. klass.fn = constructor;
  684. // The fn property changed. We need to add back the klass property to the prototype
  685. wireKlass(klass);
  686. st.initClass(klass);
  687. };
  688. /* Create an alias for an existing class */
  689. st.alias = function(klass, alias) {
  690. globals[alias] = klass;
  691. };
  692. /* Answer all registered Smalltalk classes */
  693. //TODO: remove the function and make smalltalk.classes an array
  694. st.classes = function() {
  695. return classes;
  696. };
  697. st.wrappedClasses = function() {
  698. return wrappedClasses;
  699. };
  700. // Still used, but could go away now that subclasses are stored
  701. // into classes directly.
  702. st.allSubclasses = function(klass) {
  703. return klass._allSubclasses();
  704. };
  705. }
  706. function MethodsBrik(brikz, st) {
  707. var manip = brikz.ensure("manipulation");
  708. var org = brikz.ensure("organize");
  709. var stInit = brikz.ensure("stInit");
  710. var dnu = brikz.ensure("dnu");
  711. var SmalltalkObject = brikz.ensure("root").Object;
  712. brikz.ensure("selectorConversion");
  713. brikz.ensure("classes");
  714. brikz.ensure("classInit");
  715. function SmalltalkMethod() {}
  716. inherits(SmalltalkMethod, SmalltalkObject);
  717. this.__init__ = function () {
  718. st.addPackage("Kernel-Methods");
  719. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  720. };
  721. /* Smalltalk method object. To add a method to a class,
  722. use smalltalk.addMethod() */
  723. st.method = function(spec) {
  724. var that = new SmalltalkMethod();
  725. that.selector = spec.selector;
  726. that.jsSelector = spec.jsSelector;
  727. that.args = spec.args || {};
  728. // spec.category is kept for compatibility
  729. that.protocol = spec.protocol || spec.category;
  730. that.source = spec.source;
  731. that.messageSends = spec.messageSends || [];
  732. that.referencedClasses = spec.referencedClasses || [];
  733. that.fn = spec.fn;
  734. return that;
  735. };
  736. function installNewDnuHandler(newHandler) {
  737. var wrappedClasses = st.wrappedClasses();
  738. for(var i = 0; i < wrappedClasses.length; i++) {
  739. manip.installMethodIfAbsent(newHandler, wrappedClasses[i]);
  740. }
  741. }
  742. /* Add/remove a method to/from a class */
  743. st.addMethod = function (method, klass) {
  744. if (!(method.jsSelector)) {
  745. method.jsSelector = st.selector(method.selector);
  746. }
  747. manip.installMethod(method, klass);
  748. klass.methods[method.selector] = method;
  749. method.methodClass = klass;
  750. // During the bootstrap, #addCompiledMethod is not used.
  751. // Therefore we populate the organizer here too
  752. org.addOrganizationElement(klass, method.protocol);
  753. propagateMethodChange(klass);
  754. var usedSelectors = method.messageSends;
  755. var dnuHandlers = [];
  756. dnuHandlers.push(dnu.get(method.selector));
  757. for(var i=0; i<usedSelectors.length; i++) {
  758. dnuHandlers.push(dnu.get(usedSelectors[i]));
  759. }
  760. if(stInit.initialized()) {
  761. dnuHandlers.forEach(function(each) {
  762. installNewDnuHandler(each);
  763. });
  764. }
  765. };
  766. function propagateMethodChange(klass) {
  767. // If already initialized (else it will be done later anyway),
  768. // re-initialize all subclasses to ensure the method change
  769. // propagation (for wrapped classes, not using the prototype
  770. // chain).
  771. //TODO: optimize, only one method need to be updated, not all of them
  772. if (stInit.initialized()) {
  773. st.allSubclasses(klass).forEach(function (subclass) {
  774. st.initClass(subclass);
  775. });
  776. }
  777. }
  778. st.removeMethod = function(method, klass) {
  779. if (klass !== method.methodClass) {
  780. throw new Error(
  781. "Refusing to remove method "
  782. + method.methodClass.className+">>"+method.selector
  783. + " from different class "
  784. + klass.className);
  785. }
  786. delete klass.fn.prototype[st.selector(method.selector)];
  787. delete klass.methods[method.selector];
  788. st.initClass(klass);
  789. propagateMethodChange(klass);
  790. // Do *not* delete protocols from here.
  791. // This is handled by #removeCompiledMethod
  792. };
  793. /* Answer all method selectors based on dnu handlers */
  794. st.allSelectors = function() {
  795. return dnu.selectors;
  796. };
  797. }
  798. function AugmentsBrik(brikz, st) {
  799. /* Array extensions */
  800. Array.prototype.addElement = function(el) {
  801. if(typeof el === 'undefined') { return; }
  802. if(this.indexOf(el) == -1) {
  803. this.push(el);
  804. }
  805. };
  806. Array.prototype.removeElement = function(el) {
  807. var i = this.indexOf(el);
  808. if (i !== -1) { this.splice(i, 1); }
  809. };
  810. }
  811. function SmalltalkInitBrik(brikz, st) {
  812. brikz.ensure("classInit");
  813. brikz.ensure("classes");
  814. var nil = brikz.ensure("root").nil;
  815. var initialized = false;
  816. /* Smalltalk initialization. Called on page load */
  817. st.initialize = function() {
  818. if(initialized) { return; }
  819. st.classes().forEach(function(klass) {
  820. st.init(klass);
  821. });
  822. runnable();
  823. st.classes().forEach(function(klass) {
  824. klass._initialize();
  825. });
  826. initialized = true;
  827. };
  828. this.initialized = function () {
  829. return initialized;
  830. };
  831. this.__init__ = function () {
  832. st.addPackage("Kernel-Methods");
  833. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  834. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  835. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  836. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  837. st.addPackage("Kernel-Collections");
  838. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  839. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  840. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  841. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  842. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  843. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  844. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  845. st.addPackage("Kernel-Exceptions");
  846. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  847. /* Alias definitions */
  848. st.alias(globals.Array, "OrderedCollection");
  849. st.alias(globals.Date, "Time");
  850. };
  851. }
  852. function PrimitivesBrik(brikz, st) {
  853. /* Unique ID number generator */
  854. var oid = 0;
  855. st.nextId = function() {
  856. oid += 1;
  857. return oid;
  858. };
  859. /* Converts a JavaScript object to valid Smalltalk Object */
  860. st.readJSObject = function(js) {
  861. var readObject = js.constructor === Object;
  862. var readArray = js.constructor === Array;
  863. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  864. for(var i in js) {
  865. if(readObject) {
  866. object._at_put_(i, st.readJSObject(js[i]));
  867. }
  868. if(readArray) {
  869. object[i] = st.readJSObject(js[i]);
  870. }
  871. }
  872. return object;
  873. };
  874. /* Boolean assertion */
  875. st.assert = function(shouldBeBoolean) {
  876. if (undefined !== shouldBeBoolean && shouldBeBoolean.klass === globals.Boolean) {
  877. return shouldBeBoolean == true;
  878. } else {
  879. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  880. }
  881. };
  882. /* List of all reserved words in JavaScript. They may not be used as variables
  883. in Smalltalk. */
  884. // list of reserved JavaScript keywords as of
  885. // http://es5.github.com/#x7.6.1.1
  886. // and
  887. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  888. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  889. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  890. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  891. 'try', 'typeof', 'var', 'void', 'while', 'with',
  892. // ES5: future use: http://es5.github.com/#x7.6.1.2
  893. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  894. // ES5: future use in strict mode
  895. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  896. 'public', 'static', 'yield'];
  897. st.globalJsVariables = ['jQuery', 'window', 'document', 'process', 'global'];
  898. }
  899. function RuntimeBrik(brikz, st) {
  900. brikz.ensure("selectorConversion");
  901. var root = brikz.ensure("root");
  902. var nil = root.nil;
  903. var SmalltalkObject = root.Object;
  904. function SmalltalkMethodContext(home, setup) {
  905. this.sendIdx = {};
  906. this.homeContext = home;
  907. this.setup = setup || function() {};
  908. this.supercall = false;
  909. }
  910. inherits(SmalltalkMethodContext, SmalltalkObject);
  911. this.__init__ = function () {
  912. st.addPackage("Kernel-Methods");
  913. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  914. // Fallbacks
  915. SmalltalkMethodContext.prototype.locals = {};
  916. SmalltalkMethodContext.prototype.receiver = null;
  917. SmalltalkMethodContext.prototype.selector = null;
  918. SmalltalkMethodContext.prototype.lookupClass = null;
  919. SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
  920. this.receiver = receiver;
  921. this.selector = selector;
  922. this.locals = locals || {};
  923. this.lookupClass = lookupClass;
  924. if(this.homeContext) {
  925. this.homeContext.evaluatedSelector = selector;
  926. }
  927. };
  928. SmalltalkMethodContext.prototype.fillBlock = function(locals, ctx, index) {
  929. this.locals = locals || {};
  930. this.outerContext = ctx;
  931. this.index = index || 0;
  932. };
  933. SmalltalkMethodContext.prototype.init = function() {
  934. var home = this.homeContext;
  935. if(home) {
  936. home.init();
  937. }
  938. this.setup(this);
  939. };
  940. SmalltalkMethodContext.prototype.method = function() {
  941. var method;
  942. var lookup = this.lookupClass || this.receiver.klass;
  943. while(!method && lookup) {
  944. method = lookup.methods[st.convertSelector(this.selector)];
  945. lookup = lookup.superclass;
  946. }
  947. return method;
  948. };
  949. };
  950. /* This is the current call context object. While it is publicly available,
  951. Use smalltalk.getThisContext() instead which will answer a safe copy of
  952. the current context */
  953. st.thisContext = undefined;
  954. st.withContext = function(worker, setup) {
  955. if(st.thisContext) {
  956. return inContext(worker, setup);
  957. } else {
  958. try {
  959. return inContext(worker, setup);
  960. } catch(error) {
  961. handleError(error);
  962. st.thisContext = null;
  963. // Rethrow the error in any case.
  964. error.amberHandled = true;
  965. throw error;
  966. }
  967. }
  968. };
  969. function inContext(worker, setup) {
  970. var context = pushContext(setup);
  971. var result = worker(context);
  972. popContext(context);
  973. return result;
  974. }
  975. /* Wrap a JavaScript exception in a Smalltalk Exception.
  976. In case of a RangeError, stub the stack after 100 contexts to
  977. avoid another RangeError later when the stack is manipulated. */
  978. function wrappedError(error) {
  979. var errorWrapper = globals.JavaScriptException._on_(error);
  980. // Add the error to the context, so it is visible in the stack
  981. try { errorWrapper._signal(); } catch (ex) {}
  982. var context = st.getThisContext();
  983. if(isRangeError(error)) {
  984. stubContextStack(context);
  985. }
  986. errorWrapper._context_(context);
  987. return errorWrapper;
  988. }
  989. /* Stub the context stack after 100 contexts */
  990. function stubContextStack(context) {
  991. var currentContext = context;
  992. var contexts = 0;
  993. while(contexts < 100) {
  994. if(currentContext) {
  995. currentContext = currentContext.homeContext;
  996. }
  997. contexts++;
  998. }
  999. if(currentContext) {
  1000. currentContext.homeContext = undefined;
  1001. }
  1002. }
  1003. function isRangeError(error) {
  1004. return error instanceof RangeError;
  1005. }
  1006. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  1007. (See the Smalltalk class ErrorHandler and its subclasses */
  1008. function handleError(error) {
  1009. if (!error.smalltalkError) {
  1010. error = wrappedError(error);
  1011. }
  1012. globals.ErrorHandler._handleError_(error);
  1013. }
  1014. /* Handle thisContext pseudo variable */
  1015. st.getThisContext = function() {
  1016. if(st.thisContext) {
  1017. st.thisContext.init();
  1018. return st.thisContext;
  1019. } else {
  1020. return nil;
  1021. }
  1022. };
  1023. function pushContext(setup) {
  1024. return st.thisContext = new SmalltalkMethodContext(st.thisContext, setup);
  1025. }
  1026. function popContext(context) {
  1027. st.thisContext = context.homeContext;
  1028. }
  1029. }
  1030. function MessageSendBrik(brikz, st) {
  1031. brikz.ensure("selectorConversion");
  1032. var nil = brikz.ensure("root").nil;
  1033. /* Handles unhandled errors during message sends */
  1034. // simply send the message and handle #dnu:
  1035. st.send = function(receiver, jsSelector, args, klass) {
  1036. var method;
  1037. if(receiver === null) {
  1038. receiver = nil;
  1039. }
  1040. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  1041. if(method) {
  1042. return method.apply(receiver, args);
  1043. } else {
  1044. return messageNotUnderstood(receiver, st.convertSelector(jsSelector), args);
  1045. }
  1046. };
  1047. function invokeDnuMethod(receiver, stSelector, args) {
  1048. return receiver._doesNotUnderstand_(
  1049. globals.Message._new()
  1050. ._selector_(stSelector)
  1051. ._arguments_([].slice.call(args))
  1052. );
  1053. }
  1054. /* Handles #dnu: *and* JavaScript method calls.
  1055. if the receiver has no klass, we consider it a JS object (outside of the
  1056. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  1057. function messageNotUnderstood(receiver, stSelector, args) {
  1058. if (receiver.klass !== undefined && !receiver.allowJavaScriptCalls) {
  1059. return invokeDnuMethod(receiver, stSelector, args);
  1060. }
  1061. /* Call a method of a JS object, or answer a property if it exists.
  1062. Else try wrapping a JSObjectProxy around the receiver. */
  1063. var propertyName = st.st2prop(stSelector);
  1064. if (!(propertyName in receiver)) {
  1065. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  1066. }
  1067. return accessJavaScript(receiver, propertyName, args);
  1068. }
  1069. /* If the object property is a function, then call it, except if it starts with
  1070. an uppercase character (we probably want to answer the function itself in this
  1071. case and send it #new from Amber).
  1072. Converts keyword-based selectors by using the first
  1073. keyword only, but keeping all message arguments.
  1074. Example:
  1075. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1076. function accessJavaScript(receiver, propertyName, args) {
  1077. var propertyValue = receiver[propertyName];
  1078. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1079. return propertyValue.apply(receiver, args);
  1080. } else if (args.length > 0) {
  1081. receiver[propertyName] = args[0];
  1082. return nil;
  1083. } else {
  1084. return propertyValue;
  1085. }
  1086. }
  1087. st.accessJavaScript = accessJavaScript;
  1088. this.messageNotUnderstood = messageNotUnderstood;
  1089. }
  1090. function SelectorConversionBrik(brikz, st) {
  1091. /* Convert a Smalltalk selector into a JS selector */
  1092. st.st2js = function(string) {
  1093. var selector = '_' + string;
  1094. selector = selector.replace(/:/g, '_');
  1095. selector = selector.replace(/[\&]/g, '_and');
  1096. selector = selector.replace(/[\|]/g, '_or');
  1097. selector = selector.replace(/[+]/g, '_plus');
  1098. selector = selector.replace(/-/g, '_minus');
  1099. selector = selector.replace(/[*]/g ,'_star');
  1100. selector = selector.replace(/[\/]/g ,'_slash');
  1101. selector = selector.replace(/[\\]/g ,'_backslash');
  1102. selector = selector.replace(/[\~]/g ,'_tild');
  1103. selector = selector.replace(/>/g ,'_gt');
  1104. selector = selector.replace(/</g ,'_lt');
  1105. selector = selector.replace(/=/g ,'_eq');
  1106. selector = selector.replace(/,/g ,'_comma');
  1107. selector = selector.replace(/[@]/g ,'_at');
  1108. return selector;
  1109. };
  1110. /* Convert a string to a valid smalltalk selector.
  1111. if you modify the following functions, also change st2js
  1112. accordingly */
  1113. st.js2st = function(selector) {
  1114. if(selector.match(/__/)) {
  1115. return binaryJsToSt(selector);
  1116. } else {
  1117. return keywordJsToSt(selector);
  1118. }
  1119. };
  1120. function keywordJsToSt(selector) {
  1121. return selector.replace(/^_/, '').replace(/_/g, ':');
  1122. }
  1123. function binaryJsToSt(selector) {
  1124. return selector
  1125. .replace(/^_/, '')
  1126. .replace(/_and/g, '&')
  1127. .replace(/_or/g, '|')
  1128. .replace(/_plus/g, '+')
  1129. .replace(/_minus/g, '-')
  1130. .replace(/_star/g, '*')
  1131. .replace(/_slash/g, '/')
  1132. .replace(/_backslash/g, '\\')
  1133. .replace(/_tild/g, '~')
  1134. .replace(/_gt/g, '>')
  1135. .replace(/_lt/g, '<')
  1136. .replace(/_eq/g, '=')
  1137. .replace(/_comma/g, ',')
  1138. .replace(/_at/g, '@');
  1139. }
  1140. st.st2prop = function (stSelector) {
  1141. var colonPosition = stSelector.indexOf(':');
  1142. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1143. };
  1144. // Backward-compatible names, deprecated.
  1145. st.selector = st.st2js;
  1146. st.convertSelector = st.js2st;
  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.asReceiver = AsReceiverBrik;
  1187. brikz.amd = AMDBrik;
  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.asReceiver.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. //>>excludeStart("ide", pragmas.excludeIdeData);
  1216. 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.";
  1217. //>>excludeEnd("ide");
  1218. smalltalk.addMethod(
  1219. smalltalk.method({
  1220. selector: "=",
  1221. protocol: 'comparing',
  1222. fn: function (anObject){
  1223. var self=this;
  1224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1225. return smalltalk.withContext(function($ctx1) {
  1226. //>>excludeEnd("ctx");
  1227. var $1;
  1228. $1=self.__eq_eq(anObject);
  1229. return $1;
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.ProtoObject)});
  1232. //>>excludeEnd("ctx");
  1233. },
  1234. //>>excludeStart("ide", pragmas.excludeIdeData);
  1235. args: ["anObject"],
  1236. source: "= anObject\x0a\x09^ self == anObject",
  1237. referencedClasses: [],
  1238. //>>excludeEnd("ide");
  1239. messageSends: ["=="]
  1240. }),
  1241. globals.ProtoObject);
  1242. smalltalk.addMethod(
  1243. smalltalk.method({
  1244. selector: "==",
  1245. protocol: 'comparing',
  1246. fn: function (anObject){
  1247. var self=this;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return smalltalk.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. var $2,$1;
  1252. $2=self._identityHash();
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. $ctx1.sendIdx["identityHash"]=1;
  1255. //>>excludeEnd("ctx");
  1256. $1=_st($2).__eq(_st(anObject)._identityHash());
  1257. return $1;
  1258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1259. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},globals.ProtoObject)});
  1260. //>>excludeEnd("ctx");
  1261. },
  1262. //>>excludeStart("ide", pragmas.excludeIdeData);
  1263. args: ["anObject"],
  1264. source: "== anObject\x0a\x09^ self identityHash = anObject identityHash",
  1265. referencedClasses: [],
  1266. //>>excludeEnd("ide");
  1267. messageSends: ["=", "identityHash"]
  1268. }),
  1269. globals.ProtoObject);
  1270. smalltalk.addMethod(
  1271. smalltalk.method({
  1272. selector: "asString",
  1273. protocol: 'converting',
  1274. fn: function (){
  1275. var self=this;
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. return smalltalk.withContext(function($ctx1) {
  1278. //>>excludeEnd("ctx");
  1279. var $1;
  1280. $1=self._printString();
  1281. return $1;
  1282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1283. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.ProtoObject)});
  1284. //>>excludeEnd("ctx");
  1285. },
  1286. //>>excludeStart("ide", pragmas.excludeIdeData);
  1287. args: [],
  1288. source: "asString\x0a\x09^ self printString",
  1289. referencedClasses: [],
  1290. //>>excludeEnd("ide");
  1291. messageSends: ["printString"]
  1292. }),
  1293. globals.ProtoObject);
  1294. smalltalk.addMethod(
  1295. smalltalk.method({
  1296. selector: "class",
  1297. protocol: 'accessing',
  1298. fn: function (){
  1299. var self=this;
  1300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1301. return smalltalk.withContext(function($ctx1) {
  1302. //>>excludeEnd("ctx");
  1303. return self.klass;
  1304. return self;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. }, function($ctx1) {$ctx1.fill(self,"class",{},globals.ProtoObject)});
  1307. //>>excludeEnd("ctx");
  1308. },
  1309. //>>excludeStart("ide", pragmas.excludeIdeData);
  1310. args: [],
  1311. source: "class\x0a\x09<return self.klass>",
  1312. referencedClasses: [],
  1313. //>>excludeEnd("ide");
  1314. messageSends: []
  1315. }),
  1316. globals.ProtoObject);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "doesNotUnderstand:",
  1320. protocol: 'error handling',
  1321. fn: function (aMessage){
  1322. var self=this;
  1323. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return smalltalk.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. var $1,$2;
  1328. $1=_st($MessageNotUnderstood())._new();
  1329. _st($1)._receiver_(self);
  1330. _st($1)._message_(aMessage);
  1331. $2=_st($1)._signal();
  1332. return self;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.ProtoObject)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: ["aMessage"],
  1339. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1340. referencedClasses: ["MessageNotUnderstood"],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["receiver:", "new", "message:", "signal"]
  1343. }),
  1344. globals.ProtoObject);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "evaluate:on:",
  1348. protocol: 'evaluating',
  1349. fn: function (aString,anEvaluator){
  1350. var self=this;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return smalltalk.withContext(function($ctx1) {
  1353. //>>excludeEnd("ctx");
  1354. var $1;
  1355. $1=_st(anEvaluator)._evaluate_receiver_(aString,self);
  1356. return $1;
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.ProtoObject)});
  1359. //>>excludeEnd("ctx");
  1360. },
  1361. //>>excludeStart("ide", pragmas.excludeIdeData);
  1362. args: ["aString", "anEvaluator"],
  1363. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1364. referencedClasses: [],
  1365. //>>excludeEnd("ide");
  1366. messageSends: ["evaluate:receiver:"]
  1367. }),
  1368. globals.ProtoObject);
  1369. smalltalk.addMethod(
  1370. smalltalk.method({
  1371. selector: "identityHash",
  1372. protocol: 'accessing',
  1373. fn: function (){
  1374. var self=this;
  1375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1376. return smalltalk.withContext(function($ctx1) {
  1377. //>>excludeEnd("ctx");
  1378. var hash=self.identityHash;
  1379. if (hash) return hash;
  1380. hash=smalltalk.nextId();
  1381. Object.defineProperty(self, 'identityHash', {value:hash});
  1382. return hash;
  1383. ;
  1384. return self;
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.ProtoObject)});
  1387. //>>excludeEnd("ctx");
  1388. },
  1389. //>>excludeStart("ide", pragmas.excludeIdeData);
  1390. args: [],
  1391. 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>",
  1392. referencedClasses: [],
  1393. //>>excludeEnd("ide");
  1394. messageSends: []
  1395. }),
  1396. globals.ProtoObject);
  1397. smalltalk.addMethod(
  1398. smalltalk.method({
  1399. selector: "initialize",
  1400. protocol: 'initialization',
  1401. fn: function (){
  1402. var self=this;
  1403. return self;
  1404. },
  1405. //>>excludeStart("ide", pragmas.excludeIdeData);
  1406. args: [],
  1407. source: "initialize",
  1408. referencedClasses: [],
  1409. //>>excludeEnd("ide");
  1410. messageSends: []
  1411. }),
  1412. globals.ProtoObject);
  1413. smalltalk.addMethod(
  1414. smalltalk.method({
  1415. selector: "inspect",
  1416. protocol: 'inspecting',
  1417. fn: function (){
  1418. var self=this;
  1419. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. return smalltalk.withContext(function($ctx1) {
  1422. //>>excludeEnd("ctx");
  1423. _st($Inspector())._inspect_(self);
  1424. return self;
  1425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1426. }, function($ctx1) {$ctx1.fill(self,"inspect",{},globals.ProtoObject)});
  1427. //>>excludeEnd("ctx");
  1428. },
  1429. //>>excludeStart("ide", pragmas.excludeIdeData);
  1430. args: [],
  1431. source: "inspect\x0a\x09Inspector inspect: self",
  1432. referencedClasses: ["Inspector"],
  1433. //>>excludeEnd("ide");
  1434. messageSends: ["inspect:"]
  1435. }),
  1436. globals.ProtoObject);
  1437. smalltalk.addMethod(
  1438. smalltalk.method({
  1439. selector: "inspectOn:",
  1440. protocol: 'inspecting',
  1441. fn: function (anInspector){
  1442. var self=this;
  1443. return self;
  1444. },
  1445. //>>excludeStart("ide", pragmas.excludeIdeData);
  1446. args: ["anInspector"],
  1447. source: "inspectOn: anInspector",
  1448. referencedClasses: [],
  1449. //>>excludeEnd("ide");
  1450. messageSends: []
  1451. }),
  1452. globals.ProtoObject);
  1453. smalltalk.addMethod(
  1454. smalltalk.method({
  1455. selector: "instVarAt:",
  1456. protocol: 'accessing',
  1457. fn: function (aString){
  1458. var self=this;
  1459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1460. return smalltalk.withContext(function($ctx1) {
  1461. //>>excludeEnd("ctx");
  1462. return self['@'+aString] ;
  1463. return self;
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},globals.ProtoObject)});
  1466. //>>excludeEnd("ctx");
  1467. },
  1468. //>>excludeStart("ide", pragmas.excludeIdeData);
  1469. args: ["aString"],
  1470. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  1471. referencedClasses: [],
  1472. //>>excludeEnd("ide");
  1473. messageSends: []
  1474. }),
  1475. globals.ProtoObject);
  1476. smalltalk.addMethod(
  1477. smalltalk.method({
  1478. selector: "instVarAt:put:",
  1479. protocol: 'accessing',
  1480. fn: function (aString,anObject){
  1481. var self=this;
  1482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1483. return smalltalk.withContext(function($ctx1) {
  1484. //>>excludeEnd("ctx");
  1485. self['@' + aString] = anObject ;
  1486. return self;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},globals.ProtoObject)});
  1489. //>>excludeEnd("ctx");
  1490. },
  1491. //>>excludeStart("ide", pragmas.excludeIdeData);
  1492. args: ["aString", "anObject"],
  1493. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  1494. referencedClasses: [],
  1495. //>>excludeEnd("ide");
  1496. messageSends: []
  1497. }),
  1498. globals.ProtoObject);
  1499. smalltalk.addMethod(
  1500. smalltalk.method({
  1501. selector: "isKindOf:",
  1502. protocol: 'testing',
  1503. fn: function (aClass){
  1504. var self=this;
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. return smalltalk.withContext(function($ctx1) {
  1507. //>>excludeEnd("ctx");
  1508. var $2,$1;
  1509. $2=self._isMemberOf_(aClass);
  1510. if(smalltalk.assert($2)){
  1511. $1=true;
  1512. } else {
  1513. $1=_st(self._class())._inheritsFrom_(aClass);
  1514. };
  1515. return $1;
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},globals.ProtoObject)});
  1518. //>>excludeEnd("ctx");
  1519. },
  1520. //>>excludeStart("ide", pragmas.excludeIdeData);
  1521. args: ["aClass"],
  1522. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  1523. referencedClasses: [],
  1524. //>>excludeEnd("ide");
  1525. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  1526. }),
  1527. globals.ProtoObject);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "perform:",
  1531. protocol: 'message handling',
  1532. fn: function (aString){
  1533. var self=this;
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. return smalltalk.withContext(function($ctx1) {
  1536. //>>excludeEnd("ctx");
  1537. var $1;
  1538. $1=self._perform_withArguments_(aString,[]);
  1539. return $1;
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},globals.ProtoObject)});
  1542. //>>excludeEnd("ctx");
  1543. },
  1544. //>>excludeStart("ide", pragmas.excludeIdeData);
  1545. args: ["aString"],
  1546. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  1547. referencedClasses: [],
  1548. //>>excludeEnd("ide");
  1549. messageSends: ["perform:withArguments:"]
  1550. }),
  1551. globals.ProtoObject);
  1552. smalltalk.addMethod(
  1553. smalltalk.method({
  1554. selector: "perform:withArguments:",
  1555. protocol: 'message handling',
  1556. fn: function (aString,aCollection){
  1557. var self=this;
  1558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1559. return smalltalk.withContext(function($ctx1) {
  1560. //>>excludeEnd("ctx");
  1561. return smalltalk.send(self, aString._asJavaScriptMethodName(), aCollection);
  1562. return self;
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},globals.ProtoObject)});
  1565. //>>excludeEnd("ctx");
  1566. },
  1567. //>>excludeStart("ide", pragmas.excludeIdeData);
  1568. args: ["aString", "aCollection"],
  1569. source: "perform: aString withArguments: aCollection\x0a\x09<return smalltalk.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  1570. referencedClasses: [],
  1571. //>>excludeEnd("ide");
  1572. messageSends: []
  1573. }),
  1574. globals.ProtoObject);
  1575. smalltalk.addMethod(
  1576. smalltalk.method({
  1577. selector: "printOn:",
  1578. protocol: 'printing',
  1579. fn: function (aStream){
  1580. var self=this;
  1581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1582. return smalltalk.withContext(function($ctx1) {
  1583. //>>excludeEnd("ctx");
  1584. var $5,$4,$3,$2,$1;
  1585. $5=self._class();
  1586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1587. $ctx1.sendIdx["class"]=1;
  1588. //>>excludeEnd("ctx");
  1589. $4=_st($5)._name();
  1590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1591. $ctx1.sendIdx["name"]=1;
  1592. //>>excludeEnd("ctx");
  1593. $3=_st($4)._first();
  1594. $2=_st($3)._isVowel();
  1595. if(smalltalk.assert($2)){
  1596. $1="an ";
  1597. } else {
  1598. $1="a ";
  1599. };
  1600. _st(aStream)._nextPutAll_($1);
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. $ctx1.sendIdx["nextPutAll:"]=1;
  1603. //>>excludeEnd("ctx");
  1604. _st(aStream)._nextPutAll_(_st(self._class())._name());
  1605. return self;
  1606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1607. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.ProtoObject)});
  1608. //>>excludeEnd("ctx");
  1609. },
  1610. //>>excludeStart("ide", pragmas.excludeIdeData);
  1611. args: ["aStream"],
  1612. 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",
  1613. referencedClasses: [],
  1614. //>>excludeEnd("ide");
  1615. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  1616. }),
  1617. globals.ProtoObject);
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "printString",
  1621. protocol: 'printing',
  1622. fn: function (){
  1623. var self=this;
  1624. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1626. return smalltalk.withContext(function($ctx1) {
  1627. //>>excludeEnd("ctx");
  1628. var $1;
  1629. $1=_st($String())._streamContents_((function(str){
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. return smalltalk.withContext(function($ctx2) {
  1632. //>>excludeEnd("ctx");
  1633. return self._printOn_(str);
  1634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1635. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  1636. //>>excludeEnd("ctx");
  1637. }));
  1638. return $1;
  1639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1640. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.ProtoObject)});
  1641. //>>excludeEnd("ctx");
  1642. },
  1643. //>>excludeStart("ide", pragmas.excludeIdeData);
  1644. args: [],
  1645. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  1646. referencedClasses: ["String"],
  1647. //>>excludeEnd("ide");
  1648. messageSends: ["streamContents:", "printOn:"]
  1649. }),
  1650. globals.ProtoObject);
  1651. smalltalk.addMethod(
  1652. smalltalk.method({
  1653. selector: "yourself",
  1654. protocol: 'accessing',
  1655. fn: function (){
  1656. var self=this;
  1657. return self;
  1658. },
  1659. //>>excludeStart("ide", pragmas.excludeIdeData);
  1660. args: [],
  1661. source: "yourself\x0a\x09^ self",
  1662. referencedClasses: [],
  1663. //>>excludeEnd("ide");
  1664. messageSends: []
  1665. }),
  1666. globals.ProtoObject);
  1667. smalltalk.addMethod(
  1668. smalltalk.method({
  1669. selector: "~=",
  1670. protocol: 'comparing',
  1671. fn: function (anObject){
  1672. var self=this;
  1673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1674. return smalltalk.withContext(function($ctx1) {
  1675. //>>excludeEnd("ctx");
  1676. var $1;
  1677. $1=_st(self.__eq(anObject)).__eq(false);
  1678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1679. $ctx1.sendIdx["="]=1;
  1680. //>>excludeEnd("ctx");
  1681. return $1;
  1682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1683. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},globals.ProtoObject)});
  1684. //>>excludeEnd("ctx");
  1685. },
  1686. //>>excludeStart("ide", pragmas.excludeIdeData);
  1687. args: ["anObject"],
  1688. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  1689. referencedClasses: [],
  1690. //>>excludeEnd("ide");
  1691. messageSends: ["="]
  1692. }),
  1693. globals.ProtoObject);
  1694. smalltalk.addMethod(
  1695. smalltalk.method({
  1696. selector: "~~",
  1697. protocol: 'comparing',
  1698. fn: function (anObject){
  1699. var self=this;
  1700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1701. return smalltalk.withContext(function($ctx1) {
  1702. //>>excludeEnd("ctx");
  1703. var $1;
  1704. $1=_st(self.__eq_eq(anObject)).__eq(false);
  1705. return $1;
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},globals.ProtoObject)});
  1708. //>>excludeEnd("ctx");
  1709. },
  1710. //>>excludeStart("ide", pragmas.excludeIdeData);
  1711. args: ["anObject"],
  1712. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  1713. referencedClasses: [],
  1714. //>>excludeEnd("ide");
  1715. messageSends: ["=", "=="]
  1716. }),
  1717. globals.ProtoObject);
  1718. smalltalk.addMethod(
  1719. smalltalk.method({
  1720. selector: "initialize",
  1721. protocol: 'initialization',
  1722. fn: function (){
  1723. var self=this;
  1724. return self;
  1725. },
  1726. //>>excludeStart("ide", pragmas.excludeIdeData);
  1727. args: [],
  1728. source: "initialize",
  1729. referencedClasses: [],
  1730. //>>excludeEnd("ide");
  1731. messageSends: []
  1732. }),
  1733. globals.ProtoObject.klass);
  1734. smalltalk.addClass('Object', globals.ProtoObject, [], 'Kernel-Objects');
  1735. //>>excludeStart("ide", pragmas.excludeIdeData);
  1736. 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.";
  1737. //>>excludeEnd("ide");
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "->",
  1741. protocol: 'converting',
  1742. fn: function (anObject){
  1743. var self=this;
  1744. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  1745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1746. return smalltalk.withContext(function($ctx1) {
  1747. //>>excludeEnd("ctx");
  1748. var $1;
  1749. $1=_st($Association())._key_value_(self,anObject);
  1750. return $1;
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},globals.Object)});
  1753. //>>excludeEnd("ctx");
  1754. },
  1755. //>>excludeStart("ide", pragmas.excludeIdeData);
  1756. args: ["anObject"],
  1757. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  1758. referencedClasses: ["Association"],
  1759. //>>excludeEnd("ide");
  1760. messageSends: ["key:value:"]
  1761. }),
  1762. globals.Object);
  1763. smalltalk.addMethod(
  1764. smalltalk.method({
  1765. selector: "asJSON",
  1766. protocol: 'converting',
  1767. fn: function (){
  1768. var self=this;
  1769. var variables;
  1770. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. return smalltalk.withContext(function($ctx1) {
  1773. //>>excludeEnd("ctx");
  1774. var $1;
  1775. variables=_st($HashedCollection())._new();
  1776. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. return smalltalk.withContext(function($ctx2) {
  1779. //>>excludeEnd("ctx");
  1780. return _st(variables)._at_put_(each,_st(self._instVarAt_(each))._asJSON());
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1783. //>>excludeEnd("ctx");
  1784. }));
  1785. $1=variables;
  1786. return $1;
  1787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1788. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},globals.Object)});
  1789. //>>excludeEnd("ctx");
  1790. },
  1791. //>>excludeStart("ide", pragmas.excludeIdeData);
  1792. args: [],
  1793. 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",
  1794. referencedClasses: ["HashedCollection"],
  1795. //>>excludeEnd("ide");
  1796. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  1797. }),
  1798. globals.Object);
  1799. smalltalk.addMethod(
  1800. smalltalk.method({
  1801. selector: "asJSONString",
  1802. protocol: 'converting',
  1803. fn: function (){
  1804. var self=this;
  1805. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  1806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1807. return smalltalk.withContext(function($ctx1) {
  1808. //>>excludeEnd("ctx");
  1809. var $1;
  1810. $1=_st($JSON())._stringify_(self._asJSON());
  1811. return $1;
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},globals.Object)});
  1814. //>>excludeEnd("ctx");
  1815. },
  1816. //>>excludeStart("ide", pragmas.excludeIdeData);
  1817. args: [],
  1818. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  1819. referencedClasses: ["JSON"],
  1820. //>>excludeEnd("ide");
  1821. messageSends: ["stringify:", "asJSON"]
  1822. }),
  1823. globals.Object);
  1824. smalltalk.addMethod(
  1825. smalltalk.method({
  1826. selector: "asJavascript",
  1827. protocol: 'converting',
  1828. fn: function (){
  1829. var self=this;
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. return smalltalk.withContext(function($ctx1) {
  1832. //>>excludeEnd("ctx");
  1833. var $1;
  1834. $1=self._asString();
  1835. return $1;
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Object)});
  1838. //>>excludeEnd("ctx");
  1839. },
  1840. //>>excludeStart("ide", pragmas.excludeIdeData);
  1841. args: [],
  1842. source: "asJavascript\x0a\x09^ self asString",
  1843. referencedClasses: [],
  1844. //>>excludeEnd("ide");
  1845. messageSends: ["asString"]
  1846. }),
  1847. globals.Object);
  1848. smalltalk.addMethod(
  1849. smalltalk.method({
  1850. selector: "basicAt:",
  1851. protocol: 'accessing',
  1852. fn: function (aString){
  1853. var self=this;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. return smalltalk.withContext(function($ctx1) {
  1856. //>>excludeEnd("ctx");
  1857. return self[aString];
  1858. return self;
  1859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1860. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},globals.Object)});
  1861. //>>excludeEnd("ctx");
  1862. },
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["aString"],
  1865. source: "basicAt: aString\x0a\x09<return self[aString]>",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. messageSends: []
  1869. }),
  1870. globals.Object);
  1871. smalltalk.addMethod(
  1872. smalltalk.method({
  1873. selector: "basicAt:put:",
  1874. protocol: 'accessing',
  1875. fn: function (aString,anObject){
  1876. var self=this;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. return smalltalk.withContext(function($ctx1) {
  1879. //>>excludeEnd("ctx");
  1880. return self[aString] = anObject;
  1881. return self;
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},globals.Object)});
  1884. //>>excludeEnd("ctx");
  1885. },
  1886. //>>excludeStart("ide", pragmas.excludeIdeData);
  1887. args: ["aString", "anObject"],
  1888. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  1889. referencedClasses: [],
  1890. //>>excludeEnd("ide");
  1891. messageSends: []
  1892. }),
  1893. globals.Object);
  1894. smalltalk.addMethod(
  1895. smalltalk.method({
  1896. selector: "basicDelete:",
  1897. protocol: 'accessing',
  1898. fn: function (aString){
  1899. var self=this;
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. return smalltalk.withContext(function($ctx1) {
  1902. //>>excludeEnd("ctx");
  1903. delete self[aString]; return aString;
  1904. return self;
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},globals.Object)});
  1907. //>>excludeEnd("ctx");
  1908. },
  1909. //>>excludeStart("ide", pragmas.excludeIdeData);
  1910. args: ["aString"],
  1911. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  1912. referencedClasses: [],
  1913. //>>excludeEnd("ide");
  1914. messageSends: []
  1915. }),
  1916. globals.Object);
  1917. smalltalk.addMethod(
  1918. smalltalk.method({
  1919. selector: "basicPerform:",
  1920. protocol: 'message handling',
  1921. fn: function (aString){
  1922. var self=this;
  1923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1924. return smalltalk.withContext(function($ctx1) {
  1925. //>>excludeEnd("ctx");
  1926. var $1;
  1927. $1=self._basicPerform_withArguments_(aString,[]);
  1928. return $1;
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},globals.Object)});
  1931. //>>excludeEnd("ctx");
  1932. },
  1933. //>>excludeStart("ide", pragmas.excludeIdeData);
  1934. args: ["aString"],
  1935. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  1936. referencedClasses: [],
  1937. //>>excludeEnd("ide");
  1938. messageSends: ["basicPerform:withArguments:"]
  1939. }),
  1940. globals.Object);
  1941. smalltalk.addMethod(
  1942. smalltalk.method({
  1943. selector: "basicPerform:withArguments:",
  1944. protocol: 'message handling',
  1945. fn: function (aString,aCollection){
  1946. var self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return smalltalk.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. return self[aString].apply(self, aCollection);;
  1951. return self;
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},globals.Object)});
  1954. //>>excludeEnd("ctx");
  1955. },
  1956. //>>excludeStart("ide", pragmas.excludeIdeData);
  1957. args: ["aString", "aCollection"],
  1958. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  1959. referencedClasses: [],
  1960. //>>excludeEnd("ide");
  1961. messageSends: []
  1962. }),
  1963. globals.Object);
  1964. smalltalk.addMethod(
  1965. smalltalk.method({
  1966. selector: "browse",
  1967. protocol: 'browsing',
  1968. fn: function (){
  1969. var self=this;
  1970. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  1971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1972. return smalltalk.withContext(function($ctx1) {
  1973. //>>excludeEnd("ctx");
  1974. _st($Finder())._findClass_(self._class());
  1975. return self;
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Object)});
  1978. //>>excludeEnd("ctx");
  1979. },
  1980. //>>excludeStart("ide", pragmas.excludeIdeData);
  1981. args: [],
  1982. source: "browse\x0a\x09Finder findClass: self class",
  1983. referencedClasses: ["Finder"],
  1984. //>>excludeEnd("ide");
  1985. messageSends: ["findClass:", "class"]
  1986. }),
  1987. globals.Object);
  1988. smalltalk.addMethod(
  1989. smalltalk.method({
  1990. selector: "copy",
  1991. protocol: 'copying',
  1992. fn: function (){
  1993. var self=this;
  1994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1995. return smalltalk.withContext(function($ctx1) {
  1996. //>>excludeEnd("ctx");
  1997. var $1;
  1998. $1=_st(self._shallowCopy())._postCopy();
  1999. return $1;
  2000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2001. }, function($ctx1) {$ctx1.fill(self,"copy",{},globals.Object)});
  2002. //>>excludeEnd("ctx");
  2003. },
  2004. //>>excludeStart("ide", pragmas.excludeIdeData);
  2005. args: [],
  2006. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2007. referencedClasses: [],
  2008. //>>excludeEnd("ide");
  2009. messageSends: ["postCopy", "shallowCopy"]
  2010. }),
  2011. globals.Object);
  2012. smalltalk.addMethod(
  2013. smalltalk.method({
  2014. selector: "deepCopy",
  2015. protocol: 'copying',
  2016. fn: function (){
  2017. var self=this;
  2018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2019. return smalltalk.withContext(function($ctx1) {
  2020. //>>excludeEnd("ctx");
  2021. var copy = self.klass._new();
  2022. Object.keys(self).forEach(function (i) {
  2023. if(/^@.+/.test(i)) {
  2024. copy[i] = self[i]._deepCopy();
  2025. }
  2026. });
  2027. return copy;
  2028. ;
  2029. return self;
  2030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2031. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Object)});
  2032. //>>excludeEnd("ctx");
  2033. },
  2034. //>>excludeStart("ide", pragmas.excludeIdeData);
  2035. args: [],
  2036. 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>",
  2037. referencedClasses: [],
  2038. //>>excludeEnd("ide");
  2039. messageSends: []
  2040. }),
  2041. globals.Object);
  2042. smalltalk.addMethod(
  2043. smalltalk.method({
  2044. selector: "deprecatedAPI",
  2045. protocol: 'error handling',
  2046. fn: function (){
  2047. var self=this;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. return smalltalk.withContext(function($ctx1) {
  2050. //>>excludeEnd("ctx");
  2051. var $1,$6,$5,$4,$8,$7,$3,$2;
  2052. $1=console;
  2053. $6=smalltalk.getThisContext()._home();
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. $ctx1.sendIdx["home"]=1;
  2056. //>>excludeEnd("ctx");
  2057. $5=_st($6)._asString();
  2058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2059. $ctx1.sendIdx["asString"]=1;
  2060. //>>excludeEnd("ctx");
  2061. $4=_st($5).__comma(" is deprecated! (in ");
  2062. $8=_st(smalltalk.getThisContext()._home())._home();
  2063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2064. $ctx1.sendIdx["home"]=2;
  2065. //>>excludeEnd("ctx");
  2066. $7=_st($8)._asString();
  2067. $3=_st($4).__comma($7);
  2068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2069. $ctx1.sendIdx[","]=2;
  2070. //>>excludeEnd("ctx");
  2071. $2=_st($3).__comma(")");
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. $ctx1.sendIdx[","]=1;
  2074. //>>excludeEnd("ctx");
  2075. _st($1)._warn_($2);
  2076. return self;
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},globals.Object)});
  2079. //>>excludeEnd("ctx");
  2080. },
  2081. //>>excludeStart("ide", pragmas.excludeIdeData);
  2082. args: [],
  2083. 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, ')'.",
  2084. referencedClasses: [],
  2085. //>>excludeEnd("ide");
  2086. messageSends: ["warn:", ",", "asString", "home"]
  2087. }),
  2088. globals.Object);
  2089. smalltalk.addMethod(
  2090. smalltalk.method({
  2091. selector: "deprecatedAPI:",
  2092. protocol: 'error handling',
  2093. fn: function (aString){
  2094. var self=this;
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. return smalltalk.withContext(function($ctx1) {
  2097. //>>excludeEnd("ctx");
  2098. var $1,$6,$5,$4,$8,$7,$3,$2;
  2099. $1=console;
  2100. $6=smalltalk.getThisContext()._home();
  2101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2102. $ctx1.sendIdx["home"]=1;
  2103. //>>excludeEnd("ctx");
  2104. $5=_st($6)._asString();
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. $ctx1.sendIdx["asString"]=1;
  2107. //>>excludeEnd("ctx");
  2108. $4=_st($5).__comma(" is deprecated! (in ");
  2109. $8=_st(smalltalk.getThisContext()._home())._home();
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. $ctx1.sendIdx["home"]=2;
  2112. //>>excludeEnd("ctx");
  2113. $7=_st($8)._asString();
  2114. $3=_st($4).__comma($7);
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. $ctx1.sendIdx[","]=2;
  2117. //>>excludeEnd("ctx");
  2118. $2=_st($3).__comma(")");
  2119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2120. $ctx1.sendIdx[","]=1;
  2121. //>>excludeEnd("ctx");
  2122. _st($1)._warn_($2);
  2123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2124. $ctx1.sendIdx["warn:"]=1;
  2125. //>>excludeEnd("ctx");
  2126. _st(console)._warn_(aString);
  2127. return self;
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},globals.Object)});
  2130. //>>excludeEnd("ctx");
  2131. },
  2132. //>>excludeStart("ide", pragmas.excludeIdeData);
  2133. args: ["aString"],
  2134. 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",
  2135. referencedClasses: [],
  2136. //>>excludeEnd("ide");
  2137. messageSends: ["warn:", ",", "asString", "home"]
  2138. }),
  2139. globals.Object);
  2140. smalltalk.addMethod(
  2141. smalltalk.method({
  2142. selector: "error:",
  2143. protocol: 'error handling',
  2144. fn: function (aString){
  2145. var self=this;
  2146. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. return smalltalk.withContext(function($ctx1) {
  2149. //>>excludeEnd("ctx");
  2150. _st($Error())._signal_(aString);
  2151. return self;
  2152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2153. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},globals.Object)});
  2154. //>>excludeEnd("ctx");
  2155. },
  2156. //>>excludeStart("ide", pragmas.excludeIdeData);
  2157. args: ["aString"],
  2158. source: "error: aString\x0a\x09Error signal: aString",
  2159. referencedClasses: ["Error"],
  2160. //>>excludeEnd("ide");
  2161. messageSends: ["signal:"]
  2162. }),
  2163. globals.Object);
  2164. smalltalk.addMethod(
  2165. smalltalk.method({
  2166. selector: "halt",
  2167. protocol: 'error handling',
  2168. fn: function (){
  2169. var self=this;
  2170. function $Halt(){return globals.Halt||(typeof Halt=="undefined"?nil:Halt)}
  2171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2172. return smalltalk.withContext(function($ctx1) {
  2173. //>>excludeEnd("ctx");
  2174. _st($Halt())._signal();
  2175. return self;
  2176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2177. }, function($ctx1) {$ctx1.fill(self,"halt",{},globals.Object)});
  2178. //>>excludeEnd("ctx");
  2179. },
  2180. //>>excludeStart("ide", pragmas.excludeIdeData);
  2181. args: [],
  2182. source: "halt\x0a\x09Halt signal",
  2183. referencedClasses: ["Halt"],
  2184. //>>excludeEnd("ide");
  2185. messageSends: ["signal"]
  2186. }),
  2187. globals.Object);
  2188. smalltalk.addMethod(
  2189. smalltalk.method({
  2190. selector: "ifNil:",
  2191. protocol: 'testing',
  2192. fn: function (aBlock){
  2193. var self=this;
  2194. return self;
  2195. },
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["aBlock"],
  2198. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. messageSends: []
  2202. }),
  2203. globals.Object);
  2204. smalltalk.addMethod(
  2205. smalltalk.method({
  2206. selector: "ifNil:ifNotNil:",
  2207. protocol: 'testing',
  2208. fn: function (aBlock,anotherBlock){
  2209. var self=this;
  2210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2211. return smalltalk.withContext(function($ctx1) {
  2212. //>>excludeEnd("ctx");
  2213. var $1;
  2214. $1=_st(anotherBlock)._value_(self);
  2215. return $1;
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2218. //>>excludeEnd("ctx");
  2219. },
  2220. //>>excludeStart("ide", pragmas.excludeIdeData);
  2221. args: ["aBlock", "anotherBlock"],
  2222. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2223. referencedClasses: [],
  2224. //>>excludeEnd("ide");
  2225. messageSends: ["value:"]
  2226. }),
  2227. globals.Object);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "ifNotNil:",
  2231. protocol: 'testing',
  2232. fn: function (aBlock){
  2233. var self=this;
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. return smalltalk.withContext(function($ctx1) {
  2236. //>>excludeEnd("ctx");
  2237. var $1;
  2238. $1=_st(aBlock)._value_(self);
  2239. return $1;
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},globals.Object)});
  2242. //>>excludeEnd("ctx");
  2243. },
  2244. //>>excludeStart("ide", pragmas.excludeIdeData);
  2245. args: ["aBlock"],
  2246. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2247. referencedClasses: [],
  2248. //>>excludeEnd("ide");
  2249. messageSends: ["value:"]
  2250. }),
  2251. globals.Object);
  2252. smalltalk.addMethod(
  2253. smalltalk.method({
  2254. selector: "ifNotNil:ifNil:",
  2255. protocol: 'testing',
  2256. fn: function (aBlock,anotherBlock){
  2257. var self=this;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. return smalltalk.withContext(function($ctx1) {
  2260. //>>excludeEnd("ctx");
  2261. var $1;
  2262. $1=_st(aBlock)._value_(self);
  2263. return $1;
  2264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2265. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2266. //>>excludeEnd("ctx");
  2267. },
  2268. //>>excludeStart("ide", pragmas.excludeIdeData);
  2269. args: ["aBlock", "anotherBlock"],
  2270. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2271. referencedClasses: [],
  2272. //>>excludeEnd("ide");
  2273. messageSends: ["value:"]
  2274. }),
  2275. globals.Object);
  2276. smalltalk.addMethod(
  2277. smalltalk.method({
  2278. selector: "inspectOn:",
  2279. protocol: 'inspecting',
  2280. fn: function (anInspector){
  2281. var self=this;
  2282. var variables;
  2283. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return smalltalk.withContext(function($ctx1) {
  2286. //>>excludeEnd("ctx");
  2287. var $1;
  2288. variables=_st($Dictionary())._new();
  2289. _st(variables)._at_put_("#self",self);
  2290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2291. $ctx1.sendIdx["at:put:"]=1;
  2292. //>>excludeEnd("ctx");
  2293. _st(_st(self._class())._allInstanceVariableNames())._do_((function(each){
  2294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2295. return smalltalk.withContext(function($ctx2) {
  2296. //>>excludeEnd("ctx");
  2297. return _st(variables)._at_put_(each,self._instVarAt_(each));
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2300. //>>excludeEnd("ctx");
  2301. }));
  2302. _st(anInspector)._setLabel_(self._printString());
  2303. $1=_st(anInspector)._setVariables_(variables);
  2304. return self;
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.Object)});
  2307. //>>excludeEnd("ctx");
  2308. },
  2309. //>>excludeStart("ide", pragmas.excludeIdeData);
  2310. args: ["anInspector"],
  2311. 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",
  2312. referencedClasses: ["Dictionary"],
  2313. //>>excludeEnd("ide");
  2314. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  2315. }),
  2316. globals.Object);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "isBehavior",
  2320. protocol: 'testing',
  2321. fn: function (){
  2322. var self=this;
  2323. return false;
  2324. },
  2325. //>>excludeStart("ide", pragmas.excludeIdeData);
  2326. args: [],
  2327. source: "isBehavior\x0a\x09^ false",
  2328. referencedClasses: [],
  2329. //>>excludeEnd("ide");
  2330. messageSends: []
  2331. }),
  2332. globals.Object);
  2333. smalltalk.addMethod(
  2334. smalltalk.method({
  2335. selector: "isBoolean",
  2336. protocol: 'testing',
  2337. fn: function (){
  2338. var self=this;
  2339. return false;
  2340. },
  2341. //>>excludeStart("ide", pragmas.excludeIdeData);
  2342. args: [],
  2343. source: "isBoolean\x0a\x09^ false",
  2344. referencedClasses: [],
  2345. //>>excludeEnd("ide");
  2346. messageSends: []
  2347. }),
  2348. globals.Object);
  2349. smalltalk.addMethod(
  2350. smalltalk.method({
  2351. selector: "isClass",
  2352. protocol: 'testing',
  2353. fn: function (){
  2354. var self=this;
  2355. return false;
  2356. },
  2357. //>>excludeStart("ide", pragmas.excludeIdeData);
  2358. args: [],
  2359. source: "isClass\x0a\x09^ false",
  2360. referencedClasses: [],
  2361. //>>excludeEnd("ide");
  2362. messageSends: []
  2363. }),
  2364. globals.Object);
  2365. smalltalk.addMethod(
  2366. smalltalk.method({
  2367. selector: "isCompiledMethod",
  2368. protocol: 'testing',
  2369. fn: function (){
  2370. var self=this;
  2371. return false;
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: [],
  2375. source: "isCompiledMethod\x0a\x09^ false",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: []
  2379. }),
  2380. globals.Object);
  2381. smalltalk.addMethod(
  2382. smalltalk.method({
  2383. selector: "isImmutable",
  2384. protocol: 'testing',
  2385. fn: function (){
  2386. var self=this;
  2387. return false;
  2388. },
  2389. //>>excludeStart("ide", pragmas.excludeIdeData);
  2390. args: [],
  2391. source: "isImmutable\x0a\x09^ false",
  2392. referencedClasses: [],
  2393. //>>excludeEnd("ide");
  2394. messageSends: []
  2395. }),
  2396. globals.Object);
  2397. smalltalk.addMethod(
  2398. smalltalk.method({
  2399. selector: "isMemberOf:",
  2400. protocol: 'testing',
  2401. fn: function (aClass){
  2402. var self=this;
  2403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2404. return smalltalk.withContext(function($ctx1) {
  2405. //>>excludeEnd("ctx");
  2406. var $1;
  2407. $1=_st(self._class()).__eq(aClass);
  2408. return $1;
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},globals.Object)});
  2411. //>>excludeEnd("ctx");
  2412. },
  2413. //>>excludeStart("ide", pragmas.excludeIdeData);
  2414. args: ["aClass"],
  2415. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2416. referencedClasses: [],
  2417. //>>excludeEnd("ide");
  2418. messageSends: ["=", "class"]
  2419. }),
  2420. globals.Object);
  2421. smalltalk.addMethod(
  2422. smalltalk.method({
  2423. selector: "isMetaclass",
  2424. protocol: 'testing',
  2425. fn: function (){
  2426. var self=this;
  2427. return false;
  2428. },
  2429. //>>excludeStart("ide", pragmas.excludeIdeData);
  2430. args: [],
  2431. source: "isMetaclass\x0a\x09^ false",
  2432. referencedClasses: [],
  2433. //>>excludeEnd("ide");
  2434. messageSends: []
  2435. }),
  2436. globals.Object);
  2437. smalltalk.addMethod(
  2438. smalltalk.method({
  2439. selector: "isNil",
  2440. protocol: 'testing',
  2441. fn: function (){
  2442. var self=this;
  2443. return false;
  2444. },
  2445. //>>excludeStart("ide", pragmas.excludeIdeData);
  2446. args: [],
  2447. source: "isNil\x0a\x09^ false",
  2448. referencedClasses: [],
  2449. //>>excludeEnd("ide");
  2450. messageSends: []
  2451. }),
  2452. globals.Object);
  2453. smalltalk.addMethod(
  2454. smalltalk.method({
  2455. selector: "isNumber",
  2456. protocol: 'testing',
  2457. fn: function (){
  2458. var self=this;
  2459. return false;
  2460. },
  2461. //>>excludeStart("ide", pragmas.excludeIdeData);
  2462. args: [],
  2463. source: "isNumber\x0a\x09^ false",
  2464. referencedClasses: [],
  2465. //>>excludeEnd("ide");
  2466. messageSends: []
  2467. }),
  2468. globals.Object);
  2469. smalltalk.addMethod(
  2470. smalltalk.method({
  2471. selector: "isPackage",
  2472. protocol: 'testing',
  2473. fn: function (){
  2474. var self=this;
  2475. return false;
  2476. },
  2477. //>>excludeStart("ide", pragmas.excludeIdeData);
  2478. args: [],
  2479. source: "isPackage\x0a\x09^ false",
  2480. referencedClasses: [],
  2481. //>>excludeEnd("ide");
  2482. messageSends: []
  2483. }),
  2484. globals.Object);
  2485. smalltalk.addMethod(
  2486. smalltalk.method({
  2487. selector: "isParseFailure",
  2488. protocol: 'testing',
  2489. fn: function (){
  2490. var self=this;
  2491. return false;
  2492. },
  2493. //>>excludeStart("ide", pragmas.excludeIdeData);
  2494. args: [],
  2495. source: "isParseFailure\x0a\x09^ false",
  2496. referencedClasses: [],
  2497. //>>excludeEnd("ide");
  2498. messageSends: []
  2499. }),
  2500. globals.Object);
  2501. smalltalk.addMethod(
  2502. smalltalk.method({
  2503. selector: "isString",
  2504. protocol: 'testing',
  2505. fn: function (){
  2506. var self=this;
  2507. return false;
  2508. },
  2509. //>>excludeStart("ide", pragmas.excludeIdeData);
  2510. args: [],
  2511. source: "isString\x0a\x09^ false",
  2512. referencedClasses: [],
  2513. //>>excludeEnd("ide");
  2514. messageSends: []
  2515. }),
  2516. globals.Object);
  2517. smalltalk.addMethod(
  2518. smalltalk.method({
  2519. selector: "isSymbol",
  2520. protocol: 'testing',
  2521. fn: function (){
  2522. var self=this;
  2523. return false;
  2524. },
  2525. //>>excludeStart("ide", pragmas.excludeIdeData);
  2526. args: [],
  2527. source: "isSymbol\x0a\x09^ false",
  2528. referencedClasses: [],
  2529. //>>excludeEnd("ide");
  2530. messageSends: []
  2531. }),
  2532. globals.Object);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "notNil",
  2536. protocol: 'testing',
  2537. fn: function (){
  2538. var self=this;
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. return smalltalk.withContext(function($ctx1) {
  2541. //>>excludeEnd("ctx");
  2542. var $1;
  2543. $1=_st(self._isNil())._not();
  2544. return $1;
  2545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2546. }, function($ctx1) {$ctx1.fill(self,"notNil",{},globals.Object)});
  2547. //>>excludeEnd("ctx");
  2548. },
  2549. //>>excludeStart("ide", pragmas.excludeIdeData);
  2550. args: [],
  2551. source: "notNil\x0a\x09^ self isNil not",
  2552. referencedClasses: [],
  2553. //>>excludeEnd("ide");
  2554. messageSends: ["not", "isNil"]
  2555. }),
  2556. globals.Object);
  2557. smalltalk.addMethod(
  2558. smalltalk.method({
  2559. selector: "postCopy",
  2560. protocol: 'copying',
  2561. fn: function (){
  2562. var self=this;
  2563. return self;
  2564. },
  2565. //>>excludeStart("ide", pragmas.excludeIdeData);
  2566. args: [],
  2567. source: "postCopy",
  2568. referencedClasses: [],
  2569. //>>excludeEnd("ide");
  2570. messageSends: []
  2571. }),
  2572. globals.Object);
  2573. smalltalk.addMethod(
  2574. smalltalk.method({
  2575. selector: "putOn:",
  2576. protocol: 'streaming',
  2577. fn: function (aStream){
  2578. var self=this;
  2579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2580. return smalltalk.withContext(function($ctx1) {
  2581. //>>excludeEnd("ctx");
  2582. _st(aStream)._nextPut_(self);
  2583. return self;
  2584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2585. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Object)});
  2586. //>>excludeEnd("ctx");
  2587. },
  2588. //>>excludeStart("ide", pragmas.excludeIdeData);
  2589. args: ["aStream"],
  2590. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2591. referencedClasses: [],
  2592. //>>excludeEnd("ide");
  2593. messageSends: ["nextPut:"]
  2594. }),
  2595. globals.Object);
  2596. smalltalk.addMethod(
  2597. smalltalk.method({
  2598. selector: "respondsTo:",
  2599. protocol: 'testing',
  2600. fn: function (aSelector){
  2601. var self=this;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return smalltalk.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. var $1;
  2606. $1=_st(self._class())._canUnderstand_(aSelector);
  2607. return $1;
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},globals.Object)});
  2610. //>>excludeEnd("ctx");
  2611. },
  2612. //>>excludeStart("ide", pragmas.excludeIdeData);
  2613. args: ["aSelector"],
  2614. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2615. referencedClasses: [],
  2616. //>>excludeEnd("ide");
  2617. messageSends: ["canUnderstand:", "class"]
  2618. }),
  2619. globals.Object);
  2620. smalltalk.addMethod(
  2621. smalltalk.method({
  2622. selector: "shallowCopy",
  2623. protocol: 'copying',
  2624. fn: function (){
  2625. var self=this;
  2626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2627. return smalltalk.withContext(function($ctx1) {
  2628. //>>excludeEnd("ctx");
  2629. var copy = self.klass._new();
  2630. Object.keys(self).forEach(function(i) {
  2631. if(/^@.+/.test(i)) {
  2632. copy[i] = self[i];
  2633. }
  2634. });
  2635. return copy;
  2636. ;
  2637. return self;
  2638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2639. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.Object)});
  2640. //>>excludeEnd("ctx");
  2641. },
  2642. //>>excludeStart("ide", pragmas.excludeIdeData);
  2643. args: [],
  2644. 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>",
  2645. referencedClasses: [],
  2646. //>>excludeEnd("ide");
  2647. messageSends: []
  2648. }),
  2649. globals.Object);
  2650. smalltalk.addMethod(
  2651. smalltalk.method({
  2652. selector: "shouldNotImplement",
  2653. protocol: 'error handling',
  2654. fn: function (){
  2655. var self=this;
  2656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2657. return smalltalk.withContext(function($ctx1) {
  2658. //>>excludeEnd("ctx");
  2659. self._error_("This method should not be implemented in ".__comma(_st(self._class())._name()));
  2660. return self;
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},globals.Object)});
  2663. //>>excludeEnd("ctx");
  2664. },
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. messageSends: ["error:", ",", "name", "class"]
  2671. }),
  2672. globals.Object);
  2673. smalltalk.addMethod(
  2674. smalltalk.method({
  2675. selector: "size",
  2676. protocol: 'accessing',
  2677. fn: function (){
  2678. var self=this;
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. return smalltalk.withContext(function($ctx1) {
  2681. //>>excludeEnd("ctx");
  2682. self._error_("Object not indexable");
  2683. return self;
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Object)});
  2686. //>>excludeEnd("ctx");
  2687. },
  2688. //>>excludeStart("ide", pragmas.excludeIdeData);
  2689. args: [],
  2690. source: "size\x0a\x09self error: 'Object not indexable'",
  2691. referencedClasses: [],
  2692. //>>excludeEnd("ide");
  2693. messageSends: ["error:"]
  2694. }),
  2695. globals.Object);
  2696. smalltalk.addMethod(
  2697. smalltalk.method({
  2698. selector: "subclassResponsibility",
  2699. protocol: 'error handling',
  2700. fn: function (){
  2701. var self=this;
  2702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2703. return smalltalk.withContext(function($ctx1) {
  2704. //>>excludeEnd("ctx");
  2705. self._error_("This method is a responsibility of a subclass");
  2706. return self;
  2707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2708. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},globals.Object)});
  2709. //>>excludeEnd("ctx");
  2710. },
  2711. //>>excludeStart("ide", pragmas.excludeIdeData);
  2712. args: [],
  2713. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2714. referencedClasses: [],
  2715. //>>excludeEnd("ide");
  2716. messageSends: ["error:"]
  2717. }),
  2718. globals.Object);
  2719. smalltalk.addMethod(
  2720. smalltalk.method({
  2721. selector: "throw:",
  2722. protocol: 'error handling',
  2723. fn: function (anObject){
  2724. var self=this;
  2725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2726. return smalltalk.withContext(function($ctx1) {
  2727. //>>excludeEnd("ctx");
  2728. throw anObject ;
  2729. return self;
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},globals.Object)});
  2732. //>>excludeEnd("ctx");
  2733. },
  2734. //>>excludeStart("ide", pragmas.excludeIdeData);
  2735. args: ["anObject"],
  2736. source: "throw: anObject\x0a\x09< throw anObject >",
  2737. referencedClasses: [],
  2738. //>>excludeEnd("ide");
  2739. messageSends: []
  2740. }),
  2741. globals.Object);
  2742. smalltalk.addMethod(
  2743. smalltalk.method({
  2744. selector: "try:catch:",
  2745. protocol: 'error handling',
  2746. fn: function (aBlock,anotherBlock){
  2747. var self=this;
  2748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2749. return smalltalk.withContext(function($ctx1) {
  2750. //>>excludeEnd("ctx");
  2751. var $1;
  2752. self._deprecatedAPI();
  2753. $1=_st(aBlock)._tryCatch_(anotherBlock);
  2754. return $1;
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. }, function($ctx1) {$ctx1.fill(self,"try:catch:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Object)});
  2757. //>>excludeEnd("ctx");
  2758. },
  2759. //>>excludeStart("ide", pragmas.excludeIdeData);
  2760. args: ["aBlock", "anotherBlock"],
  2761. source: "try: aBlock catch: anotherBlock\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ aBlock tryCatch: anotherBlock",
  2762. referencedClasses: [],
  2763. //>>excludeEnd("ide");
  2764. messageSends: ["deprecatedAPI", "tryCatch:"]
  2765. }),
  2766. globals.Object);
  2767. smalltalk.addMethod(
  2768. smalltalk.method({
  2769. selector: "value",
  2770. protocol: 'accessing',
  2771. fn: function (){
  2772. var self=this;
  2773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2774. return smalltalk.withContext(function($ctx1) {
  2775. //>>excludeEnd("ctx");
  2776. return self.valueOf();
  2777. return self;
  2778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2779. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Object)});
  2780. //>>excludeEnd("ctx");
  2781. },
  2782. //>>excludeStart("ide", pragmas.excludeIdeData);
  2783. args: [],
  2784. source: "value\x0a\x09<return self.valueOf()>",
  2785. referencedClasses: [],
  2786. //>>excludeEnd("ide");
  2787. messageSends: []
  2788. }),
  2789. globals.Object);
  2790. smalltalk.addMethod(
  2791. smalltalk.method({
  2792. selector: "accessorProtocolWith:",
  2793. protocol: 'helios',
  2794. fn: function (aGenerator){
  2795. var self=this;
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. return smalltalk.withContext(function($ctx1) {
  2798. //>>excludeEnd("ctx");
  2799. _st(aGenerator)._accessorProtocolForObject();
  2800. return self;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2803. //>>excludeEnd("ctx");
  2804. },
  2805. //>>excludeStart("ide", pragmas.excludeIdeData);
  2806. args: ["aGenerator"],
  2807. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2808. referencedClasses: [],
  2809. //>>excludeEnd("ide");
  2810. messageSends: ["accessorProtocolForObject"]
  2811. }),
  2812. globals.Object.klass);
  2813. smalltalk.addMethod(
  2814. smalltalk.method({
  2815. selector: "accessorsSourceCodesWith:",
  2816. protocol: 'helios',
  2817. fn: function (aGenerator){
  2818. var self=this;
  2819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2820. return smalltalk.withContext(function($ctx1) {
  2821. //>>excludeEnd("ctx");
  2822. _st(aGenerator)._accessorsForObject();
  2823. return self;
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2826. //>>excludeEnd("ctx");
  2827. },
  2828. //>>excludeStart("ide", pragmas.excludeIdeData);
  2829. args: ["aGenerator"],
  2830. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2831. referencedClasses: [],
  2832. //>>excludeEnd("ide");
  2833. messageSends: ["accessorsForObject"]
  2834. }),
  2835. globals.Object.klass);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "initialize",
  2839. protocol: 'initialization',
  2840. fn: function (){
  2841. var self=this;
  2842. return self;
  2843. },
  2844. //>>excludeStart("ide", pragmas.excludeIdeData);
  2845. args: [],
  2846. source: "initialize\x0a\x09\x22no op\x22",
  2847. referencedClasses: [],
  2848. //>>excludeEnd("ide");
  2849. messageSends: []
  2850. }),
  2851. globals.Object.klass);
  2852. smalltalk.addMethod(
  2853. smalltalk.method({
  2854. selector: "initializeProtocolWith:",
  2855. protocol: 'helios',
  2856. fn: function (aGenerator){
  2857. var self=this;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. return smalltalk.withContext(function($ctx1) {
  2860. //>>excludeEnd("ctx");
  2861. _st(aGenerator)._initializeProtocolForObject();
  2862. return self;
  2863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2864. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2865. //>>excludeEnd("ctx");
  2866. },
  2867. //>>excludeStart("ide", pragmas.excludeIdeData);
  2868. args: ["aGenerator"],
  2869. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2870. referencedClasses: [],
  2871. //>>excludeEnd("ide");
  2872. messageSends: ["initializeProtocolForObject"]
  2873. }),
  2874. globals.Object.klass);
  2875. smalltalk.addMethod(
  2876. smalltalk.method({
  2877. selector: "initializeSourceCodesWith:",
  2878. protocol: 'helios',
  2879. fn: function (aGenerator){
  2880. var self=this;
  2881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2882. return smalltalk.withContext(function($ctx1) {
  2883. //>>excludeEnd("ctx");
  2884. _st(aGenerator)._initializeForObject();
  2885. return self;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},globals.Object.klass)});
  2888. //>>excludeEnd("ctx");
  2889. },
  2890. //>>excludeStart("ide", pragmas.excludeIdeData);
  2891. args: ["aGenerator"],
  2892. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2893. referencedClasses: [],
  2894. //>>excludeEnd("ide");
  2895. messageSends: ["initializeForObject"]
  2896. }),
  2897. globals.Object.klass);
  2898. smalltalk.addClass('Boolean', globals.Object, [], 'Kernel-Objects');
  2899. //>>excludeStart("ide", pragmas.excludeIdeData);
  2900. 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: [ ... ]";
  2901. //>>excludeEnd("ide");
  2902. smalltalk.addMethod(
  2903. smalltalk.method({
  2904. selector: "&",
  2905. protocol: 'controlling',
  2906. fn: function (aBoolean){
  2907. var self=this;
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. return smalltalk.withContext(function($ctx1) {
  2910. //>>excludeEnd("ctx");
  2911. if(self == true) {
  2912. return aBoolean;
  2913. } else {
  2914. return false;
  2915. }
  2916. ;
  2917. return self;
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},globals.Boolean)});
  2920. //>>excludeEnd("ctx");
  2921. },
  2922. //>>excludeStart("ide", pragmas.excludeIdeData);
  2923. args: ["aBoolean"],
  2924. 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>",
  2925. referencedClasses: [],
  2926. //>>excludeEnd("ide");
  2927. messageSends: []
  2928. }),
  2929. globals.Boolean);
  2930. smalltalk.addMethod(
  2931. smalltalk.method({
  2932. selector: "=",
  2933. protocol: 'comparing',
  2934. fn: function (aBoolean){
  2935. var self=this;
  2936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2937. return smalltalk.withContext(function($ctx1) {
  2938. //>>excludeEnd("ctx");
  2939. return aBoolean != null &&
  2940. typeof aBoolean._isBoolean === "function" &&
  2941. aBoolean._isBoolean() &&
  2942. Boolean(self == true) == aBoolean
  2943. ;
  2944. return self;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"=",{aBoolean:aBoolean},globals.Boolean)});
  2947. //>>excludeEnd("ctx");
  2948. },
  2949. //>>excludeStart("ide", pragmas.excludeIdeData);
  2950. args: ["aBoolean"],
  2951. 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>",
  2952. referencedClasses: [],
  2953. //>>excludeEnd("ide");
  2954. messageSends: []
  2955. }),
  2956. globals.Boolean);
  2957. smalltalk.addMethod(
  2958. smalltalk.method({
  2959. selector: "==",
  2960. protocol: 'comparing',
  2961. fn: function (aBoolean){
  2962. var self=this;
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. return smalltalk.withContext(function($ctx1) {
  2965. //>>excludeEnd("ctx");
  2966. var $1;
  2967. $1=self.__eq(aBoolean);
  2968. return $1;
  2969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2970. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},globals.Boolean)});
  2971. //>>excludeEnd("ctx");
  2972. },
  2973. //>>excludeStart("ide", pragmas.excludeIdeData);
  2974. args: ["aBoolean"],
  2975. source: "== aBoolean\x0a\x09^ self = aBoolean",
  2976. referencedClasses: [],
  2977. //>>excludeEnd("ide");
  2978. messageSends: ["="]
  2979. }),
  2980. globals.Boolean);
  2981. smalltalk.addMethod(
  2982. smalltalk.method({
  2983. selector: "and:",
  2984. protocol: 'controlling',
  2985. fn: function (aBlock){
  2986. var self=this;
  2987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2988. return smalltalk.withContext(function($ctx1) {
  2989. //>>excludeEnd("ctx");
  2990. var $2,$1;
  2991. $2=self.__eq(true);
  2992. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  2993. return false;
  2994. }));
  2995. return $1;
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},globals.Boolean)});
  2998. //>>excludeEnd("ctx");
  2999. },
  3000. //>>excludeStart("ide", pragmas.excludeIdeData);
  3001. args: ["aBlock"],
  3002. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  3003. referencedClasses: [],
  3004. //>>excludeEnd("ide");
  3005. messageSends: ["ifTrue:ifFalse:", "="]
  3006. }),
  3007. globals.Boolean);
  3008. smalltalk.addMethod(
  3009. smalltalk.method({
  3010. selector: "asBit",
  3011. protocol: 'converting',
  3012. fn: function (){
  3013. var self=this;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return smalltalk.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. var $1;
  3018. if(smalltalk.assert(self)){
  3019. $1=(1);
  3020. } else {
  3021. $1=(0);
  3022. };
  3023. return $1;
  3024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3025. }, function($ctx1) {$ctx1.fill(self,"asBit",{},globals.Boolean)});
  3026. //>>excludeEnd("ctx");
  3027. },
  3028. //>>excludeStart("ide", pragmas.excludeIdeData);
  3029. args: [],
  3030. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3031. referencedClasses: [],
  3032. //>>excludeEnd("ide");
  3033. messageSends: ["ifTrue:ifFalse:"]
  3034. }),
  3035. globals.Boolean);
  3036. smalltalk.addMethod(
  3037. smalltalk.method({
  3038. selector: "asJSON",
  3039. protocol: 'converting',
  3040. fn: function (){
  3041. var self=this;
  3042. return self;
  3043. },
  3044. //>>excludeStart("ide", pragmas.excludeIdeData);
  3045. args: [],
  3046. source: "asJSON\x0a\x09^ self",
  3047. referencedClasses: [],
  3048. //>>excludeEnd("ide");
  3049. messageSends: []
  3050. }),
  3051. globals.Boolean);
  3052. smalltalk.addMethod(
  3053. smalltalk.method({
  3054. selector: "asString",
  3055. protocol: 'converting',
  3056. fn: function (){
  3057. var self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return smalltalk.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. return self.toString() ;
  3062. return self;
  3063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3064. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Boolean)});
  3065. //>>excludeEnd("ctx");
  3066. },
  3067. //>>excludeStart("ide", pragmas.excludeIdeData);
  3068. args: [],
  3069. source: "asString\x0a\x09< return self.toString() >",
  3070. referencedClasses: [],
  3071. //>>excludeEnd("ide");
  3072. messageSends: []
  3073. }),
  3074. globals.Boolean);
  3075. smalltalk.addMethod(
  3076. smalltalk.method({
  3077. selector: "deepCopy",
  3078. protocol: 'copying',
  3079. fn: function (){
  3080. var self=this;
  3081. return self;
  3082. },
  3083. //>>excludeStart("ide", pragmas.excludeIdeData);
  3084. args: [],
  3085. source: "deepCopy\x0a\x09^ self",
  3086. referencedClasses: [],
  3087. //>>excludeEnd("ide");
  3088. messageSends: []
  3089. }),
  3090. globals.Boolean);
  3091. smalltalk.addMethod(
  3092. smalltalk.method({
  3093. selector: "ifFalse:",
  3094. protocol: 'controlling',
  3095. fn: function (aBlock){
  3096. var self=this;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. return smalltalk.withContext(function($ctx1) {
  3099. //>>excludeEnd("ctx");
  3100. var $1;
  3101. $1=self._ifTrue_ifFalse_((function(){
  3102. }),aBlock);
  3103. return $1;
  3104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3105. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},globals.Boolean)});
  3106. //>>excludeEnd("ctx");
  3107. },
  3108. //>>excludeStart("ide", pragmas.excludeIdeData);
  3109. args: ["aBlock"],
  3110. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3111. referencedClasses: [],
  3112. //>>excludeEnd("ide");
  3113. messageSends: ["ifTrue:ifFalse:"]
  3114. }),
  3115. globals.Boolean);
  3116. smalltalk.addMethod(
  3117. smalltalk.method({
  3118. selector: "ifFalse:ifTrue:",
  3119. protocol: 'controlling',
  3120. fn: function (aBlock,anotherBlock){
  3121. var self=this;
  3122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3123. return smalltalk.withContext(function($ctx1) {
  3124. //>>excludeEnd("ctx");
  3125. var $1;
  3126. $1=self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3127. return $1;
  3128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3129. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)});
  3130. //>>excludeEnd("ctx");
  3131. },
  3132. //>>excludeStart("ide", pragmas.excludeIdeData);
  3133. args: ["aBlock", "anotherBlock"],
  3134. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3135. referencedClasses: [],
  3136. //>>excludeEnd("ide");
  3137. messageSends: ["ifTrue:ifFalse:"]
  3138. }),
  3139. globals.Boolean);
  3140. smalltalk.addMethod(
  3141. smalltalk.method({
  3142. selector: "ifTrue:",
  3143. protocol: 'controlling',
  3144. fn: function (aBlock){
  3145. var self=this;
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. return smalltalk.withContext(function($ctx1) {
  3148. //>>excludeEnd("ctx");
  3149. var $1;
  3150. $1=self._ifTrue_ifFalse_(aBlock,(function(){
  3151. }));
  3152. return $1;
  3153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3154. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},globals.Boolean)});
  3155. //>>excludeEnd("ctx");
  3156. },
  3157. //>>excludeStart("ide", pragmas.excludeIdeData);
  3158. args: ["aBlock"],
  3159. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3160. referencedClasses: [],
  3161. //>>excludeEnd("ide");
  3162. messageSends: ["ifTrue:ifFalse:"]
  3163. }),
  3164. globals.Boolean);
  3165. smalltalk.addMethod(
  3166. smalltalk.method({
  3167. selector: "ifTrue:ifFalse:",
  3168. protocol: 'controlling',
  3169. fn: function (aBlock,anotherBlock){
  3170. var self=this;
  3171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3172. return smalltalk.withContext(function($ctx1) {
  3173. //>>excludeEnd("ctx");
  3174. if(self == true) {
  3175. return aBlock._value();
  3176. } else {
  3177. return anotherBlock._value();
  3178. }
  3179. ;
  3180. return self;
  3181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3182. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Boolean)});
  3183. //>>excludeEnd("ctx");
  3184. },
  3185. //>>excludeStart("ide", pragmas.excludeIdeData);
  3186. args: ["aBlock", "anotherBlock"],
  3187. 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>",
  3188. referencedClasses: [],
  3189. //>>excludeEnd("ide");
  3190. messageSends: []
  3191. }),
  3192. globals.Boolean);
  3193. smalltalk.addMethod(
  3194. smalltalk.method({
  3195. selector: "isBoolean",
  3196. protocol: 'testing',
  3197. fn: function (){
  3198. var self=this;
  3199. return true;
  3200. },
  3201. //>>excludeStart("ide", pragmas.excludeIdeData);
  3202. args: [],
  3203. source: "isBoolean\x0a\x09^ true",
  3204. referencedClasses: [],
  3205. //>>excludeEnd("ide");
  3206. messageSends: []
  3207. }),
  3208. globals.Boolean);
  3209. smalltalk.addMethod(
  3210. smalltalk.method({
  3211. selector: "isImmutable",
  3212. protocol: 'testing',
  3213. fn: function (){
  3214. var self=this;
  3215. return true;
  3216. },
  3217. //>>excludeStart("ide", pragmas.excludeIdeData);
  3218. args: [],
  3219. source: "isImmutable\x0a\x09^ true",
  3220. referencedClasses: [],
  3221. //>>excludeEnd("ide");
  3222. messageSends: []
  3223. }),
  3224. globals.Boolean);
  3225. smalltalk.addMethod(
  3226. smalltalk.method({
  3227. selector: "not",
  3228. protocol: 'controlling',
  3229. fn: function (){
  3230. var self=this;
  3231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3232. return smalltalk.withContext(function($ctx1) {
  3233. //>>excludeEnd("ctx");
  3234. var $1;
  3235. $1=self.__eq(false);
  3236. return $1;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"not",{},globals.Boolean)});
  3239. //>>excludeEnd("ctx");
  3240. },
  3241. //>>excludeStart("ide", pragmas.excludeIdeData);
  3242. args: [],
  3243. source: "not\x0a\x09^ self = false",
  3244. referencedClasses: [],
  3245. //>>excludeEnd("ide");
  3246. messageSends: ["="]
  3247. }),
  3248. globals.Boolean);
  3249. smalltalk.addMethod(
  3250. smalltalk.method({
  3251. selector: "or:",
  3252. protocol: 'controlling',
  3253. fn: function (aBlock){
  3254. var self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return smalltalk.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. var $2,$1;
  3259. $2=self.__eq(true);
  3260. $1=_st($2)._ifTrue_ifFalse_((function(){
  3261. return true;
  3262. }),aBlock);
  3263. return $1;
  3264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3265. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},globals.Boolean)});
  3266. //>>excludeEnd("ctx");
  3267. },
  3268. //>>excludeStart("ide", pragmas.excludeIdeData);
  3269. args: ["aBlock"],
  3270. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3271. referencedClasses: [],
  3272. //>>excludeEnd("ide");
  3273. messageSends: ["ifTrue:ifFalse:", "="]
  3274. }),
  3275. globals.Boolean);
  3276. smalltalk.addMethod(
  3277. smalltalk.method({
  3278. selector: "printOn:",
  3279. protocol: 'printing',
  3280. fn: function (aStream){
  3281. var self=this;
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. return smalltalk.withContext(function($ctx1) {
  3284. //>>excludeEnd("ctx");
  3285. _st(aStream)._nextPutAll_(self._asString());
  3286. return self;
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Boolean)});
  3289. //>>excludeEnd("ctx");
  3290. },
  3291. //>>excludeStart("ide", pragmas.excludeIdeData);
  3292. args: ["aStream"],
  3293. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3294. referencedClasses: [],
  3295. //>>excludeEnd("ide");
  3296. messageSends: ["nextPutAll:", "asString"]
  3297. }),
  3298. globals.Boolean);
  3299. smalltalk.addMethod(
  3300. smalltalk.method({
  3301. selector: "shallowCopy",
  3302. protocol: 'copying',
  3303. fn: function (){
  3304. var self=this;
  3305. return self;
  3306. },
  3307. //>>excludeStart("ide", pragmas.excludeIdeData);
  3308. args: [],
  3309. source: "shallowCopy\x0a\x09^ self",
  3310. referencedClasses: [],
  3311. //>>excludeEnd("ide");
  3312. messageSends: []
  3313. }),
  3314. globals.Boolean);
  3315. smalltalk.addMethod(
  3316. smalltalk.method({
  3317. selector: "|",
  3318. protocol: 'controlling',
  3319. fn: function (aBoolean){
  3320. var self=this;
  3321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3322. return smalltalk.withContext(function($ctx1) {
  3323. //>>excludeEnd("ctx");
  3324. if(self == true) {
  3325. return true;
  3326. } else {
  3327. return aBoolean;
  3328. }
  3329. ;
  3330. return self;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},globals.Boolean)});
  3333. //>>excludeEnd("ctx");
  3334. },
  3335. //>>excludeStart("ide", pragmas.excludeIdeData);
  3336. args: ["aBoolean"],
  3337. 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>",
  3338. referencedClasses: [],
  3339. //>>excludeEnd("ide");
  3340. messageSends: []
  3341. }),
  3342. globals.Boolean);
  3343. smalltalk.addClass('Date', globals.Object, [], 'Kernel-Objects');
  3344. //>>excludeStart("ide", pragmas.excludeIdeData);
  3345. 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.).";
  3346. //>>excludeEnd("ide");
  3347. smalltalk.addMethod(
  3348. smalltalk.method({
  3349. selector: "+",
  3350. protocol: 'arithmetic',
  3351. fn: function (aDate){
  3352. var self=this;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. return smalltalk.withContext(function($ctx1) {
  3355. //>>excludeEnd("ctx");
  3356. return self + aDate;
  3357. return self;
  3358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3359. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},globals.Date)});
  3360. //>>excludeEnd("ctx");
  3361. },
  3362. //>>excludeStart("ide", pragmas.excludeIdeData);
  3363. args: ["aDate"],
  3364. source: "+ aDate\x0a\x09<return self + aDate>",
  3365. referencedClasses: [],
  3366. //>>excludeEnd("ide");
  3367. messageSends: []
  3368. }),
  3369. globals.Date);
  3370. smalltalk.addMethod(
  3371. smalltalk.method({
  3372. selector: "-",
  3373. protocol: 'arithmetic',
  3374. fn: function (aDate){
  3375. var self=this;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return smalltalk.withContext(function($ctx1) {
  3378. //>>excludeEnd("ctx");
  3379. return self - aDate;
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},globals.Date)});
  3383. //>>excludeEnd("ctx");
  3384. },
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: ["aDate"],
  3387. source: "- aDate\x0a\x09<return self - aDate>",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. messageSends: []
  3391. }),
  3392. globals.Date);
  3393. smalltalk.addMethod(
  3394. smalltalk.method({
  3395. selector: "<",
  3396. protocol: 'comparing',
  3397. fn: function (aDate){
  3398. var self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return smalltalk.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. return self < aDate;
  3403. return self;
  3404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3405. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},globals.Date)});
  3406. //>>excludeEnd("ctx");
  3407. },
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: ["aDate"],
  3410. source: "< aDate\x0a\x09<return self < aDate>",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. messageSends: []
  3414. }),
  3415. globals.Date);
  3416. smalltalk.addMethod(
  3417. smalltalk.method({
  3418. selector: "<=",
  3419. protocol: 'comparing',
  3420. fn: function (aDate){
  3421. var self=this;
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. return smalltalk.withContext(function($ctx1) {
  3424. //>>excludeEnd("ctx");
  3425. return self <= aDate;
  3426. return self;
  3427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3428. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},globals.Date)});
  3429. //>>excludeEnd("ctx");
  3430. },
  3431. //>>excludeStart("ide", pragmas.excludeIdeData);
  3432. args: ["aDate"],
  3433. source: "<= aDate\x0a\x09<return self <= aDate>",
  3434. referencedClasses: [],
  3435. //>>excludeEnd("ide");
  3436. messageSends: []
  3437. }),
  3438. globals.Date);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: ">",
  3442. protocol: 'comparing',
  3443. fn: function (aDate){
  3444. var self=this;
  3445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3446. return smalltalk.withContext(function($ctx1) {
  3447. //>>excludeEnd("ctx");
  3448. return self > aDate;
  3449. return self;
  3450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3451. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},globals.Date)});
  3452. //>>excludeEnd("ctx");
  3453. },
  3454. //>>excludeStart("ide", pragmas.excludeIdeData);
  3455. args: ["aDate"],
  3456. source: "> aDate\x0a\x09<return self >> aDate>",
  3457. referencedClasses: [],
  3458. //>>excludeEnd("ide");
  3459. messageSends: []
  3460. }),
  3461. globals.Date);
  3462. smalltalk.addMethod(
  3463. smalltalk.method({
  3464. selector: ">=",
  3465. protocol: 'comparing',
  3466. fn: function (aDate){
  3467. var self=this;
  3468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3469. return smalltalk.withContext(function($ctx1) {
  3470. //>>excludeEnd("ctx");
  3471. return self >= aDate;
  3472. return self;
  3473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3474. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},globals.Date)});
  3475. //>>excludeEnd("ctx");
  3476. },
  3477. //>>excludeStart("ide", pragmas.excludeIdeData);
  3478. args: ["aDate"],
  3479. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3480. referencedClasses: [],
  3481. //>>excludeEnd("ide");
  3482. messageSends: []
  3483. }),
  3484. globals.Date);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "asDateString",
  3488. protocol: 'converting',
  3489. fn: function (){
  3490. var self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return smalltalk.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. return self.toDateString();
  3495. return self;
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},globals.Date)});
  3498. //>>excludeEnd("ctx");
  3499. },
  3500. //>>excludeStart("ide", pragmas.excludeIdeData);
  3501. args: [],
  3502. source: "asDateString\x0a\x09<return self.toDateString()>",
  3503. referencedClasses: [],
  3504. //>>excludeEnd("ide");
  3505. messageSends: []
  3506. }),
  3507. globals.Date);
  3508. smalltalk.addMethod(
  3509. smalltalk.method({
  3510. selector: "asLocaleString",
  3511. protocol: 'converting',
  3512. fn: function (){
  3513. var self=this;
  3514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3515. return smalltalk.withContext(function($ctx1) {
  3516. //>>excludeEnd("ctx");
  3517. return self.toLocaleString();
  3518. return self;
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},globals.Date)});
  3521. //>>excludeEnd("ctx");
  3522. },
  3523. //>>excludeStart("ide", pragmas.excludeIdeData);
  3524. args: [],
  3525. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3526. referencedClasses: [],
  3527. //>>excludeEnd("ide");
  3528. messageSends: []
  3529. }),
  3530. globals.Date);
  3531. smalltalk.addMethod(
  3532. smalltalk.method({
  3533. selector: "asMilliseconds",
  3534. protocol: 'converting',
  3535. fn: function (){
  3536. var self=this;
  3537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3538. return smalltalk.withContext(function($ctx1) {
  3539. //>>excludeEnd("ctx");
  3540. var $1;
  3541. $1=self._time();
  3542. return $1;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},globals.Date)});
  3545. //>>excludeEnd("ctx");
  3546. },
  3547. //>>excludeStart("ide", pragmas.excludeIdeData);
  3548. args: [],
  3549. source: "asMilliseconds\x0a\x09^ self time",
  3550. referencedClasses: [],
  3551. //>>excludeEnd("ide");
  3552. messageSends: ["time"]
  3553. }),
  3554. globals.Date);
  3555. smalltalk.addMethod(
  3556. smalltalk.method({
  3557. selector: "asNumber",
  3558. protocol: 'converting',
  3559. fn: function (){
  3560. var self=this;
  3561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3562. return smalltalk.withContext(function($ctx1) {
  3563. //>>excludeEnd("ctx");
  3564. var $1;
  3565. $1=self._asMilliseconds();
  3566. return $1;
  3567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3568. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.Date)});
  3569. //>>excludeEnd("ctx");
  3570. },
  3571. //>>excludeStart("ide", pragmas.excludeIdeData);
  3572. args: [],
  3573. source: "asNumber\x0a\x09^ self asMilliseconds",
  3574. referencedClasses: [],
  3575. //>>excludeEnd("ide");
  3576. messageSends: ["asMilliseconds"]
  3577. }),
  3578. globals.Date);
  3579. smalltalk.addMethod(
  3580. smalltalk.method({
  3581. selector: "asString",
  3582. protocol: 'converting',
  3583. fn: function (){
  3584. var self=this;
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. return smalltalk.withContext(function($ctx1) {
  3587. //>>excludeEnd("ctx");
  3588. return self.toString();
  3589. return self;
  3590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3591. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Date)});
  3592. //>>excludeEnd("ctx");
  3593. },
  3594. //>>excludeStart("ide", pragmas.excludeIdeData);
  3595. args: [],
  3596. source: "asString\x0a\x09<return self.toString()>",
  3597. referencedClasses: [],
  3598. //>>excludeEnd("ide");
  3599. messageSends: []
  3600. }),
  3601. globals.Date);
  3602. smalltalk.addMethod(
  3603. smalltalk.method({
  3604. selector: "asTimeString",
  3605. protocol: 'converting',
  3606. fn: function (){
  3607. var self=this;
  3608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3609. return smalltalk.withContext(function($ctx1) {
  3610. //>>excludeEnd("ctx");
  3611. return self.toTimeString();
  3612. return self;
  3613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3614. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},globals.Date)});
  3615. //>>excludeEnd("ctx");
  3616. },
  3617. //>>excludeStart("ide", pragmas.excludeIdeData);
  3618. args: [],
  3619. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3620. referencedClasses: [],
  3621. //>>excludeEnd("ide");
  3622. messageSends: []
  3623. }),
  3624. globals.Date);
  3625. smalltalk.addMethod(
  3626. smalltalk.method({
  3627. selector: "day",
  3628. protocol: 'accessing',
  3629. fn: function (){
  3630. var self=this;
  3631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3632. return smalltalk.withContext(function($ctx1) {
  3633. //>>excludeEnd("ctx");
  3634. var $1;
  3635. $1=self._dayOfWeek();
  3636. return $1;
  3637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3638. }, function($ctx1) {$ctx1.fill(self,"day",{},globals.Date)});
  3639. //>>excludeEnd("ctx");
  3640. },
  3641. //>>excludeStart("ide", pragmas.excludeIdeData);
  3642. args: [],
  3643. source: "day\x0a\x09^ self dayOfWeek",
  3644. referencedClasses: [],
  3645. //>>excludeEnd("ide");
  3646. messageSends: ["dayOfWeek"]
  3647. }),
  3648. globals.Date);
  3649. smalltalk.addMethod(
  3650. smalltalk.method({
  3651. selector: "day:",
  3652. protocol: 'accessing',
  3653. fn: function (aNumber){
  3654. var self=this;
  3655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3656. return smalltalk.withContext(function($ctx1) {
  3657. //>>excludeEnd("ctx");
  3658. self._dayOfWeek_(aNumber);
  3659. return self;
  3660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3661. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},globals.Date)});
  3662. //>>excludeEnd("ctx");
  3663. },
  3664. //>>excludeStart("ide", pragmas.excludeIdeData);
  3665. args: ["aNumber"],
  3666. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3667. referencedClasses: [],
  3668. //>>excludeEnd("ide");
  3669. messageSends: ["dayOfWeek:"]
  3670. }),
  3671. globals.Date);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "dayOfMonth",
  3675. protocol: 'accessing',
  3676. fn: function (){
  3677. var self=this;
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. return smalltalk.withContext(function($ctx1) {
  3680. //>>excludeEnd("ctx");
  3681. return self.getDate();
  3682. return self;
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},globals.Date)});
  3685. //>>excludeEnd("ctx");
  3686. },
  3687. //>>excludeStart("ide", pragmas.excludeIdeData);
  3688. args: [],
  3689. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3690. referencedClasses: [],
  3691. //>>excludeEnd("ide");
  3692. messageSends: []
  3693. }),
  3694. globals.Date);
  3695. smalltalk.addMethod(
  3696. smalltalk.method({
  3697. selector: "dayOfMonth:",
  3698. protocol: 'accessing',
  3699. fn: function (aNumber){
  3700. var self=this;
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. return smalltalk.withContext(function($ctx1) {
  3703. //>>excludeEnd("ctx");
  3704. self.setDate(aNumber);
  3705. return self;
  3706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3707. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},globals.Date)});
  3708. //>>excludeEnd("ctx");
  3709. },
  3710. //>>excludeStart("ide", pragmas.excludeIdeData);
  3711. args: ["aNumber"],
  3712. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3713. referencedClasses: [],
  3714. //>>excludeEnd("ide");
  3715. messageSends: []
  3716. }),
  3717. globals.Date);
  3718. smalltalk.addMethod(
  3719. smalltalk.method({
  3720. selector: "dayOfWeek",
  3721. protocol: 'accessing',
  3722. fn: function (){
  3723. var self=this;
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. return smalltalk.withContext(function($ctx1) {
  3726. //>>excludeEnd("ctx");
  3727. return self.getDay() + 1;
  3728. return self;
  3729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3730. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},globals.Date)});
  3731. //>>excludeEnd("ctx");
  3732. },
  3733. //>>excludeStart("ide", pragmas.excludeIdeData);
  3734. args: [],
  3735. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3736. referencedClasses: [],
  3737. //>>excludeEnd("ide");
  3738. messageSends: []
  3739. }),
  3740. globals.Date);
  3741. smalltalk.addMethod(
  3742. smalltalk.method({
  3743. selector: "dayOfWeek:",
  3744. protocol: 'accessing',
  3745. fn: function (aNumber){
  3746. var self=this;
  3747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3748. return smalltalk.withContext(function($ctx1) {
  3749. //>>excludeEnd("ctx");
  3750. return self.setDay(aNumber - 1);
  3751. return self;
  3752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3753. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},globals.Date)});
  3754. //>>excludeEnd("ctx");
  3755. },
  3756. //>>excludeStart("ide", pragmas.excludeIdeData);
  3757. args: ["aNumber"],
  3758. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3759. referencedClasses: [],
  3760. //>>excludeEnd("ide");
  3761. messageSends: []
  3762. }),
  3763. globals.Date);
  3764. smalltalk.addMethod(
  3765. smalltalk.method({
  3766. selector: "hours",
  3767. protocol: 'accessing',
  3768. fn: function (){
  3769. var self=this;
  3770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3771. return smalltalk.withContext(function($ctx1) {
  3772. //>>excludeEnd("ctx");
  3773. return self.getHours();
  3774. return self;
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. }, function($ctx1) {$ctx1.fill(self,"hours",{},globals.Date)});
  3777. //>>excludeEnd("ctx");
  3778. },
  3779. //>>excludeStart("ide", pragmas.excludeIdeData);
  3780. args: [],
  3781. source: "hours\x0a\x09<return self.getHours()>",
  3782. referencedClasses: [],
  3783. //>>excludeEnd("ide");
  3784. messageSends: []
  3785. }),
  3786. globals.Date);
  3787. smalltalk.addMethod(
  3788. smalltalk.method({
  3789. selector: "hours:",
  3790. protocol: 'accessing',
  3791. fn: function (aNumber){
  3792. var self=this;
  3793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3794. return smalltalk.withContext(function($ctx1) {
  3795. //>>excludeEnd("ctx");
  3796. self.setHours(aNumber);
  3797. return self;
  3798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3799. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},globals.Date)});
  3800. //>>excludeEnd("ctx");
  3801. },
  3802. //>>excludeStart("ide", pragmas.excludeIdeData);
  3803. args: ["aNumber"],
  3804. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3805. referencedClasses: [],
  3806. //>>excludeEnd("ide");
  3807. messageSends: []
  3808. }),
  3809. globals.Date);
  3810. smalltalk.addMethod(
  3811. smalltalk.method({
  3812. selector: "milliseconds",
  3813. protocol: 'accessing',
  3814. fn: function (){
  3815. var self=this;
  3816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3817. return smalltalk.withContext(function($ctx1) {
  3818. //>>excludeEnd("ctx");
  3819. return self.getMilliseconds();
  3820. return self;
  3821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3822. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},globals.Date)});
  3823. //>>excludeEnd("ctx");
  3824. },
  3825. //>>excludeStart("ide", pragmas.excludeIdeData);
  3826. args: [],
  3827. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3828. referencedClasses: [],
  3829. //>>excludeEnd("ide");
  3830. messageSends: []
  3831. }),
  3832. globals.Date);
  3833. smalltalk.addMethod(
  3834. smalltalk.method({
  3835. selector: "milliseconds:",
  3836. protocol: 'accessing',
  3837. fn: function (aNumber){
  3838. var self=this;
  3839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3840. return smalltalk.withContext(function($ctx1) {
  3841. //>>excludeEnd("ctx");
  3842. self.setMilliseconds(aNumber);
  3843. return self;
  3844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3845. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},globals.Date)});
  3846. //>>excludeEnd("ctx");
  3847. },
  3848. //>>excludeStart("ide", pragmas.excludeIdeData);
  3849. args: ["aNumber"],
  3850. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3851. referencedClasses: [],
  3852. //>>excludeEnd("ide");
  3853. messageSends: []
  3854. }),
  3855. globals.Date);
  3856. smalltalk.addMethod(
  3857. smalltalk.method({
  3858. selector: "minutes",
  3859. protocol: 'accessing',
  3860. fn: function (){
  3861. var self=this;
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. return smalltalk.withContext(function($ctx1) {
  3864. //>>excludeEnd("ctx");
  3865. return self.getMinutes();
  3866. return self;
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. }, function($ctx1) {$ctx1.fill(self,"minutes",{},globals.Date)});
  3869. //>>excludeEnd("ctx");
  3870. },
  3871. //>>excludeStart("ide", pragmas.excludeIdeData);
  3872. args: [],
  3873. source: "minutes\x0a\x09<return self.getMinutes()>",
  3874. referencedClasses: [],
  3875. //>>excludeEnd("ide");
  3876. messageSends: []
  3877. }),
  3878. globals.Date);
  3879. smalltalk.addMethod(
  3880. smalltalk.method({
  3881. selector: "minutes:",
  3882. protocol: 'accessing',
  3883. fn: function (aNumber){
  3884. var self=this;
  3885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3886. return smalltalk.withContext(function($ctx1) {
  3887. //>>excludeEnd("ctx");
  3888. self.setMinutes(aNumber);
  3889. return self;
  3890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3891. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},globals.Date)});
  3892. //>>excludeEnd("ctx");
  3893. },
  3894. //>>excludeStart("ide", pragmas.excludeIdeData);
  3895. args: ["aNumber"],
  3896. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3897. referencedClasses: [],
  3898. //>>excludeEnd("ide");
  3899. messageSends: []
  3900. }),
  3901. globals.Date);
  3902. smalltalk.addMethod(
  3903. smalltalk.method({
  3904. selector: "month",
  3905. protocol: 'accessing',
  3906. fn: function (){
  3907. var self=this;
  3908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3909. return smalltalk.withContext(function($ctx1) {
  3910. //>>excludeEnd("ctx");
  3911. return self.getMonth() + 1;
  3912. return self;
  3913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3914. }, function($ctx1) {$ctx1.fill(self,"month",{},globals.Date)});
  3915. //>>excludeEnd("ctx");
  3916. },
  3917. //>>excludeStart("ide", pragmas.excludeIdeData);
  3918. args: [],
  3919. source: "month\x0a\x09<return self.getMonth() + 1>",
  3920. referencedClasses: [],
  3921. //>>excludeEnd("ide");
  3922. messageSends: []
  3923. }),
  3924. globals.Date);
  3925. smalltalk.addMethod(
  3926. smalltalk.method({
  3927. selector: "month:",
  3928. protocol: 'accessing',
  3929. fn: function (aNumber){
  3930. var self=this;
  3931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3932. return smalltalk.withContext(function($ctx1) {
  3933. //>>excludeEnd("ctx");
  3934. self.setMonth(aNumber - 1);
  3935. return self;
  3936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3937. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},globals.Date)});
  3938. //>>excludeEnd("ctx");
  3939. },
  3940. //>>excludeStart("ide", pragmas.excludeIdeData);
  3941. args: ["aNumber"],
  3942. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3943. referencedClasses: [],
  3944. //>>excludeEnd("ide");
  3945. messageSends: []
  3946. }),
  3947. globals.Date);
  3948. smalltalk.addMethod(
  3949. smalltalk.method({
  3950. selector: "printOn:",
  3951. protocol: 'printing',
  3952. fn: function (aStream){
  3953. var self=this;
  3954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3955. return smalltalk.withContext(function($ctx1) {
  3956. //>>excludeEnd("ctx");
  3957. _st(aStream)._nextPutAll_(self._asString());
  3958. return self;
  3959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3960. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Date)});
  3961. //>>excludeEnd("ctx");
  3962. },
  3963. //>>excludeStart("ide", pragmas.excludeIdeData);
  3964. args: ["aStream"],
  3965. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3966. referencedClasses: [],
  3967. //>>excludeEnd("ide");
  3968. messageSends: ["nextPutAll:", "asString"]
  3969. }),
  3970. globals.Date);
  3971. smalltalk.addMethod(
  3972. smalltalk.method({
  3973. selector: "seconds",
  3974. protocol: 'accessing',
  3975. fn: function (){
  3976. var self=this;
  3977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3978. return smalltalk.withContext(function($ctx1) {
  3979. //>>excludeEnd("ctx");
  3980. return self.getSeconds();
  3981. return self;
  3982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3983. }, function($ctx1) {$ctx1.fill(self,"seconds",{},globals.Date)});
  3984. //>>excludeEnd("ctx");
  3985. },
  3986. //>>excludeStart("ide", pragmas.excludeIdeData);
  3987. args: [],
  3988. source: "seconds\x0a\x09<return self.getSeconds()>",
  3989. referencedClasses: [],
  3990. //>>excludeEnd("ide");
  3991. messageSends: []
  3992. }),
  3993. globals.Date);
  3994. smalltalk.addMethod(
  3995. smalltalk.method({
  3996. selector: "seconds:",
  3997. protocol: 'accessing',
  3998. fn: function (aNumber){
  3999. var self=this;
  4000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4001. return smalltalk.withContext(function($ctx1) {
  4002. //>>excludeEnd("ctx");
  4003. self.setSeconds(aNumber);
  4004. return self;
  4005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4006. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},globals.Date)});
  4007. //>>excludeEnd("ctx");
  4008. },
  4009. //>>excludeStart("ide", pragmas.excludeIdeData);
  4010. args: ["aNumber"],
  4011. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  4012. referencedClasses: [],
  4013. //>>excludeEnd("ide");
  4014. messageSends: []
  4015. }),
  4016. globals.Date);
  4017. smalltalk.addMethod(
  4018. smalltalk.method({
  4019. selector: "time",
  4020. protocol: 'accessing',
  4021. fn: function (){
  4022. var self=this;
  4023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4024. return smalltalk.withContext(function($ctx1) {
  4025. //>>excludeEnd("ctx");
  4026. return self.getTime();
  4027. return self;
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. }, function($ctx1) {$ctx1.fill(self,"time",{},globals.Date)});
  4030. //>>excludeEnd("ctx");
  4031. },
  4032. //>>excludeStart("ide", pragmas.excludeIdeData);
  4033. args: [],
  4034. source: "time\x0a\x09<return self.getTime()>",
  4035. referencedClasses: [],
  4036. //>>excludeEnd("ide");
  4037. messageSends: []
  4038. }),
  4039. globals.Date);
  4040. smalltalk.addMethod(
  4041. smalltalk.method({
  4042. selector: "time:",
  4043. protocol: 'accessing',
  4044. fn: function (aNumber){
  4045. var self=this;
  4046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4047. return smalltalk.withContext(function($ctx1) {
  4048. //>>excludeEnd("ctx");
  4049. self.setTime(aNumber);
  4050. return self;
  4051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4052. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},globals.Date)});
  4053. //>>excludeEnd("ctx");
  4054. },
  4055. //>>excludeStart("ide", pragmas.excludeIdeData);
  4056. args: ["aNumber"],
  4057. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  4058. referencedClasses: [],
  4059. //>>excludeEnd("ide");
  4060. messageSends: []
  4061. }),
  4062. globals.Date);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "year",
  4066. protocol: 'accessing',
  4067. fn: function (){
  4068. var self=this;
  4069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4070. return smalltalk.withContext(function($ctx1) {
  4071. //>>excludeEnd("ctx");
  4072. return self.getFullYear();
  4073. return self;
  4074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4075. }, function($ctx1) {$ctx1.fill(self,"year",{},globals.Date)});
  4076. //>>excludeEnd("ctx");
  4077. },
  4078. //>>excludeStart("ide", pragmas.excludeIdeData);
  4079. args: [],
  4080. source: "year\x0a\x09<return self.getFullYear()>",
  4081. referencedClasses: [],
  4082. //>>excludeEnd("ide");
  4083. messageSends: []
  4084. }),
  4085. globals.Date);
  4086. smalltalk.addMethod(
  4087. smalltalk.method({
  4088. selector: "year:",
  4089. protocol: 'accessing',
  4090. fn: function (aNumber){
  4091. var self=this;
  4092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4093. return smalltalk.withContext(function($ctx1) {
  4094. //>>excludeEnd("ctx");
  4095. self.setFullYear(aNumber);
  4096. return self;
  4097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4098. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},globals.Date)});
  4099. //>>excludeEnd("ctx");
  4100. },
  4101. //>>excludeStart("ide", pragmas.excludeIdeData);
  4102. args: ["aNumber"],
  4103. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  4104. referencedClasses: [],
  4105. //>>excludeEnd("ide");
  4106. messageSends: []
  4107. }),
  4108. globals.Date);
  4109. smalltalk.addMethod(
  4110. smalltalk.method({
  4111. selector: "fromMilliseconds:",
  4112. protocol: 'instance creation',
  4113. fn: function (aNumber){
  4114. var self=this;
  4115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4116. return smalltalk.withContext(function($ctx1) {
  4117. //>>excludeEnd("ctx");
  4118. var $1;
  4119. $1=self._new_(aNumber);
  4120. return $1;
  4121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4122. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},globals.Date.klass)});
  4123. //>>excludeEnd("ctx");
  4124. },
  4125. //>>excludeStart("ide", pragmas.excludeIdeData);
  4126. args: ["aNumber"],
  4127. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4128. referencedClasses: [],
  4129. //>>excludeEnd("ide");
  4130. messageSends: ["new:"]
  4131. }),
  4132. globals.Date.klass);
  4133. smalltalk.addMethod(
  4134. smalltalk.method({
  4135. selector: "fromSeconds:",
  4136. protocol: 'instance creation',
  4137. fn: function (aNumber){
  4138. var self=this;
  4139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4140. return smalltalk.withContext(function($ctx1) {
  4141. //>>excludeEnd("ctx");
  4142. var $1;
  4143. $1=self._fromMilliseconds_(_st(aNumber).__star((1000)));
  4144. return $1;
  4145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4146. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},globals.Date.klass)});
  4147. //>>excludeEnd("ctx");
  4148. },
  4149. //>>excludeStart("ide", pragmas.excludeIdeData);
  4150. args: ["aNumber"],
  4151. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4152. referencedClasses: [],
  4153. //>>excludeEnd("ide");
  4154. messageSends: ["fromMilliseconds:", "*"]
  4155. }),
  4156. globals.Date.klass);
  4157. smalltalk.addMethod(
  4158. smalltalk.method({
  4159. selector: "fromString:",
  4160. protocol: 'instance creation',
  4161. fn: function (aString){
  4162. var self=this;
  4163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4164. return smalltalk.withContext(function($ctx1) {
  4165. //>>excludeEnd("ctx");
  4166. var $1;
  4167. $1=self._new_(aString);
  4168. return $1;
  4169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4170. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.Date.klass)});
  4171. //>>excludeEnd("ctx");
  4172. },
  4173. //>>excludeStart("ide", pragmas.excludeIdeData);
  4174. args: ["aString"],
  4175. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4176. referencedClasses: [],
  4177. //>>excludeEnd("ide");
  4178. messageSends: ["new:"]
  4179. }),
  4180. globals.Date.klass);
  4181. smalltalk.addMethod(
  4182. smalltalk.method({
  4183. selector: "heliosClass",
  4184. protocol: 'helios',
  4185. fn: function (){
  4186. var self=this;
  4187. return "magnitude";
  4188. },
  4189. //>>excludeStart("ide", pragmas.excludeIdeData);
  4190. args: [],
  4191. source: "heliosClass\x0a\x09^ 'magnitude'",
  4192. referencedClasses: [],
  4193. //>>excludeEnd("ide");
  4194. messageSends: []
  4195. }),
  4196. globals.Date.klass);
  4197. smalltalk.addMethod(
  4198. smalltalk.method({
  4199. selector: "millisecondsToRun:",
  4200. protocol: 'instance creation',
  4201. fn: function (aBlock){
  4202. var self=this;
  4203. var t;
  4204. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  4205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4206. return smalltalk.withContext(function($ctx1) {
  4207. //>>excludeEnd("ctx");
  4208. var $1;
  4209. t=_st($Date())._now();
  4210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4211. $ctx1.sendIdx["now"]=1;
  4212. //>>excludeEnd("ctx");
  4213. _st(aBlock)._value();
  4214. $1=_st(_st($Date())._now()).__minus(t);
  4215. return $1;
  4216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4217. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},globals.Date.klass)});
  4218. //>>excludeEnd("ctx");
  4219. },
  4220. //>>excludeStart("ide", pragmas.excludeIdeData);
  4221. args: ["aBlock"],
  4222. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4223. referencedClasses: ["Date"],
  4224. //>>excludeEnd("ide");
  4225. messageSends: ["now", "value", "-"]
  4226. }),
  4227. globals.Date.klass);
  4228. smalltalk.addMethod(
  4229. smalltalk.method({
  4230. selector: "new:",
  4231. protocol: 'instance creation',
  4232. fn: function (anObject){
  4233. var self=this;
  4234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4235. return smalltalk.withContext(function($ctx1) {
  4236. //>>excludeEnd("ctx");
  4237. return new Date(anObject);
  4238. return self;
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},globals.Date.klass)});
  4241. //>>excludeEnd("ctx");
  4242. },
  4243. //>>excludeStart("ide", pragmas.excludeIdeData);
  4244. args: ["anObject"],
  4245. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  4246. referencedClasses: [],
  4247. //>>excludeEnd("ide");
  4248. messageSends: []
  4249. }),
  4250. globals.Date.klass);
  4251. smalltalk.addMethod(
  4252. smalltalk.method({
  4253. selector: "now",
  4254. protocol: 'instance creation',
  4255. fn: function (){
  4256. var self=this;
  4257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4258. return smalltalk.withContext(function($ctx1) {
  4259. //>>excludeEnd("ctx");
  4260. var $1;
  4261. $1=self._today();
  4262. return $1;
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. }, function($ctx1) {$ctx1.fill(self,"now",{},globals.Date.klass)});
  4265. //>>excludeEnd("ctx");
  4266. },
  4267. //>>excludeStart("ide", pragmas.excludeIdeData);
  4268. args: [],
  4269. source: "now\x0a\x09^ self today",
  4270. referencedClasses: [],
  4271. //>>excludeEnd("ide");
  4272. messageSends: ["today"]
  4273. }),
  4274. globals.Date.klass);
  4275. smalltalk.addMethod(
  4276. smalltalk.method({
  4277. selector: "today",
  4278. protocol: 'instance creation',
  4279. fn: function (){
  4280. var self=this;
  4281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4282. return smalltalk.withContext(function($ctx1) {
  4283. //>>excludeEnd("ctx");
  4284. var $1;
  4285. $1=self._new();
  4286. return $1;
  4287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4288. }, function($ctx1) {$ctx1.fill(self,"today",{},globals.Date.klass)});
  4289. //>>excludeEnd("ctx");
  4290. },
  4291. //>>excludeStart("ide", pragmas.excludeIdeData);
  4292. args: [],
  4293. source: "today\x0a\x09^ self new",
  4294. referencedClasses: [],
  4295. //>>excludeEnd("ide");
  4296. messageSends: ["new"]
  4297. }),
  4298. globals.Date.klass);
  4299. smalltalk.addClass('Number', globals.Object, [], 'Kernel-Objects');
  4300. //>>excludeStart("ide", pragmas.excludeIdeData);
  4301. 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 ].";
  4302. //>>excludeEnd("ide");
  4303. smalltalk.addMethod(
  4304. smalltalk.method({
  4305. selector: "&",
  4306. protocol: 'converting',
  4307. fn: function (aNumber){
  4308. var self=this;
  4309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4310. return smalltalk.withContext(function($ctx1) {
  4311. //>>excludeEnd("ctx");
  4312. return self & aNumber;
  4313. return self;
  4314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4315. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},globals.Number)});
  4316. //>>excludeEnd("ctx");
  4317. },
  4318. //>>excludeStart("ide", pragmas.excludeIdeData);
  4319. args: ["aNumber"],
  4320. source: "& aNumber\x0a\x09<return self & aNumber>",
  4321. referencedClasses: [],
  4322. //>>excludeEnd("ide");
  4323. messageSends: []
  4324. }),
  4325. globals.Number);
  4326. smalltalk.addMethod(
  4327. smalltalk.method({
  4328. selector: "*",
  4329. protocol: 'arithmetic',
  4330. fn: function (aNumber){
  4331. var self=this;
  4332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4333. return smalltalk.withContext(function($ctx1) {
  4334. //>>excludeEnd("ctx");
  4335. return self * aNumber;
  4336. return self;
  4337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4338. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},globals.Number)});
  4339. //>>excludeEnd("ctx");
  4340. },
  4341. //>>excludeStart("ide", pragmas.excludeIdeData);
  4342. args: ["aNumber"],
  4343. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  4344. referencedClasses: [],
  4345. //>>excludeEnd("ide");
  4346. messageSends: []
  4347. }),
  4348. globals.Number);
  4349. smalltalk.addMethod(
  4350. smalltalk.method({
  4351. selector: "**",
  4352. protocol: 'mathematical functions',
  4353. fn: function (exponent){
  4354. var self=this;
  4355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4356. return smalltalk.withContext(function($ctx1) {
  4357. //>>excludeEnd("ctx");
  4358. var $1;
  4359. $1=self._raisedTo_(exponent);
  4360. return $1;
  4361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4362. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},globals.Number)});
  4363. //>>excludeEnd("ctx");
  4364. },
  4365. //>>excludeStart("ide", pragmas.excludeIdeData);
  4366. args: ["exponent"],
  4367. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4368. referencedClasses: [],
  4369. //>>excludeEnd("ide");
  4370. messageSends: ["raisedTo:"]
  4371. }),
  4372. globals.Number);
  4373. smalltalk.addMethod(
  4374. smalltalk.method({
  4375. selector: "+",
  4376. protocol: 'arithmetic',
  4377. fn: function (aNumber){
  4378. var self=this;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. return smalltalk.withContext(function($ctx1) {
  4381. //>>excludeEnd("ctx");
  4382. return self + aNumber;
  4383. return self;
  4384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4385. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},globals.Number)});
  4386. //>>excludeEnd("ctx");
  4387. },
  4388. //>>excludeStart("ide", pragmas.excludeIdeData);
  4389. args: ["aNumber"],
  4390. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  4391. referencedClasses: [],
  4392. //>>excludeEnd("ide");
  4393. messageSends: []
  4394. }),
  4395. globals.Number);
  4396. smalltalk.addMethod(
  4397. smalltalk.method({
  4398. selector: "-",
  4399. protocol: 'arithmetic',
  4400. fn: function (aNumber){
  4401. var self=this;
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. return smalltalk.withContext(function($ctx1) {
  4404. //>>excludeEnd("ctx");
  4405. return self - aNumber;
  4406. return self;
  4407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4408. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},globals.Number)});
  4409. //>>excludeEnd("ctx");
  4410. },
  4411. //>>excludeStart("ide", pragmas.excludeIdeData);
  4412. args: ["aNumber"],
  4413. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  4414. referencedClasses: [],
  4415. //>>excludeEnd("ide");
  4416. messageSends: []
  4417. }),
  4418. globals.Number);
  4419. smalltalk.addMethod(
  4420. smalltalk.method({
  4421. selector: "/",
  4422. protocol: 'arithmetic',
  4423. fn: function (aNumber){
  4424. var self=this;
  4425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4426. return smalltalk.withContext(function($ctx1) {
  4427. //>>excludeEnd("ctx");
  4428. return self / aNumber;
  4429. return self;
  4430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4431. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},globals.Number)});
  4432. //>>excludeEnd("ctx");
  4433. },
  4434. //>>excludeStart("ide", pragmas.excludeIdeData);
  4435. args: ["aNumber"],
  4436. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4437. referencedClasses: [],
  4438. //>>excludeEnd("ide");
  4439. messageSends: []
  4440. }),
  4441. globals.Number);
  4442. smalltalk.addMethod(
  4443. smalltalk.method({
  4444. selector: "//",
  4445. protocol: 'arithmetic',
  4446. fn: function (aNumber){
  4447. var self=this;
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. return smalltalk.withContext(function($ctx1) {
  4450. //>>excludeEnd("ctx");
  4451. var $1;
  4452. $1=_st(self.__slash(aNumber))._floor();
  4453. return $1;
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},globals.Number)});
  4456. //>>excludeEnd("ctx");
  4457. },
  4458. //>>excludeStart("ide", pragmas.excludeIdeData);
  4459. args: ["aNumber"],
  4460. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4461. referencedClasses: [],
  4462. //>>excludeEnd("ide");
  4463. messageSends: ["floor", "/"]
  4464. }),
  4465. globals.Number);
  4466. smalltalk.addMethod(
  4467. smalltalk.method({
  4468. selector: "<",
  4469. protocol: 'comparing',
  4470. fn: function (aNumber){
  4471. var self=this;
  4472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4473. return smalltalk.withContext(function($ctx1) {
  4474. //>>excludeEnd("ctx");
  4475. return self < aNumber;
  4476. return self;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},globals.Number)});
  4479. //>>excludeEnd("ctx");
  4480. },
  4481. //>>excludeStart("ide", pragmas.excludeIdeData);
  4482. args: ["aNumber"],
  4483. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  4484. referencedClasses: [],
  4485. //>>excludeEnd("ide");
  4486. messageSends: []
  4487. }),
  4488. globals.Number);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "<=",
  4492. protocol: 'comparing',
  4493. fn: function (aNumber){
  4494. var self=this;
  4495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4496. return smalltalk.withContext(function($ctx1) {
  4497. //>>excludeEnd("ctx");
  4498. return self <= aNumber;
  4499. return self;
  4500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4501. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},globals.Number)});
  4502. //>>excludeEnd("ctx");
  4503. },
  4504. //>>excludeStart("ide", pragmas.excludeIdeData);
  4505. args: ["aNumber"],
  4506. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4507. referencedClasses: [],
  4508. //>>excludeEnd("ide");
  4509. messageSends: []
  4510. }),
  4511. globals.Number);
  4512. smalltalk.addMethod(
  4513. smalltalk.method({
  4514. selector: "=",
  4515. protocol: 'comparing',
  4516. fn: function (aNumber){
  4517. var self=this;
  4518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4519. return smalltalk.withContext(function($ctx1) {
  4520. //>>excludeEnd("ctx");
  4521. return aNumber != null &&
  4522. typeof aNumber._isNumber === "function" &&
  4523. aNumber._isNumber() &&
  4524. Number(self) == aNumber
  4525. ;
  4526. return self;
  4527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4528. }, function($ctx1) {$ctx1.fill(self,"=",{aNumber:aNumber},globals.Number)});
  4529. //>>excludeEnd("ctx");
  4530. },
  4531. //>>excludeStart("ide", pragmas.excludeIdeData);
  4532. args: ["aNumber"],
  4533. 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>",
  4534. referencedClasses: [],
  4535. //>>excludeEnd("ide");
  4536. messageSends: []
  4537. }),
  4538. globals.Number);
  4539. smalltalk.addMethod(
  4540. smalltalk.method({
  4541. selector: ">",
  4542. protocol: 'comparing',
  4543. fn: function (aNumber){
  4544. var self=this;
  4545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4546. return smalltalk.withContext(function($ctx1) {
  4547. //>>excludeEnd("ctx");
  4548. return self > aNumber;
  4549. return self;
  4550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4551. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},globals.Number)});
  4552. //>>excludeEnd("ctx");
  4553. },
  4554. //>>excludeStart("ide", pragmas.excludeIdeData);
  4555. args: ["aNumber"],
  4556. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  4557. referencedClasses: [],
  4558. //>>excludeEnd("ide");
  4559. messageSends: []
  4560. }),
  4561. globals.Number);
  4562. smalltalk.addMethod(
  4563. smalltalk.method({
  4564. selector: ">=",
  4565. protocol: 'comparing',
  4566. fn: function (aNumber){
  4567. var self=this;
  4568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4569. return smalltalk.withContext(function($ctx1) {
  4570. //>>excludeEnd("ctx");
  4571. return self >= aNumber;
  4572. return self;
  4573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4574. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},globals.Number)});
  4575. //>>excludeEnd("ctx");
  4576. },
  4577. //>>excludeStart("ide", pragmas.excludeIdeData);
  4578. args: ["aNumber"],
  4579. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4580. referencedClasses: [],
  4581. //>>excludeEnd("ide");
  4582. messageSends: []
  4583. }),
  4584. globals.Number);
  4585. smalltalk.addMethod(
  4586. smalltalk.method({
  4587. selector: "@",
  4588. protocol: 'converting',
  4589. fn: function (aNumber){
  4590. var self=this;
  4591. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4593. return smalltalk.withContext(function($ctx1) {
  4594. //>>excludeEnd("ctx");
  4595. var $1;
  4596. $1=_st($Point())._x_y_(self,aNumber);
  4597. return $1;
  4598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4599. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},globals.Number)});
  4600. //>>excludeEnd("ctx");
  4601. },
  4602. //>>excludeStart("ide", pragmas.excludeIdeData);
  4603. args: ["aNumber"],
  4604. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4605. referencedClasses: ["Point"],
  4606. //>>excludeEnd("ide");
  4607. messageSends: ["x:y:"]
  4608. }),
  4609. globals.Number);
  4610. smalltalk.addMethod(
  4611. smalltalk.method({
  4612. selector: "\x5c\x5c",
  4613. protocol: 'arithmetic',
  4614. fn: function (aNumber){
  4615. var self=this;
  4616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4617. return smalltalk.withContext(function($ctx1) {
  4618. //>>excludeEnd("ctx");
  4619. return self % aNumber;
  4620. return self;
  4621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4622. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},globals.Number)});
  4623. //>>excludeEnd("ctx");
  4624. },
  4625. //>>excludeStart("ide", pragmas.excludeIdeData);
  4626. args: ["aNumber"],
  4627. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4628. referencedClasses: [],
  4629. //>>excludeEnd("ide");
  4630. messageSends: []
  4631. }),
  4632. globals.Number);
  4633. smalltalk.addMethod(
  4634. smalltalk.method({
  4635. selector: "abs",
  4636. protocol: 'arithmetic',
  4637. fn: function (){
  4638. var self=this;
  4639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4640. return smalltalk.withContext(function($ctx1) {
  4641. //>>excludeEnd("ctx");
  4642. return Math.abs(self);;
  4643. return self;
  4644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4645. }, function($ctx1) {$ctx1.fill(self,"abs",{},globals.Number)});
  4646. //>>excludeEnd("ctx");
  4647. },
  4648. //>>excludeStart("ide", pragmas.excludeIdeData);
  4649. args: [],
  4650. source: "abs\x0a\x09<return Math.abs(self);>",
  4651. referencedClasses: [],
  4652. //>>excludeEnd("ide");
  4653. messageSends: []
  4654. }),
  4655. globals.Number);
  4656. smalltalk.addMethod(
  4657. smalltalk.method({
  4658. selector: "arcCos",
  4659. protocol: 'mathematical functions',
  4660. fn: function (){
  4661. var self=this;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. return smalltalk.withContext(function($ctx1) {
  4664. //>>excludeEnd("ctx");
  4665. return Math.acos(self);;
  4666. return self;
  4667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4668. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},globals.Number)});
  4669. //>>excludeEnd("ctx");
  4670. },
  4671. //>>excludeStart("ide", pragmas.excludeIdeData);
  4672. args: [],
  4673. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4674. referencedClasses: [],
  4675. //>>excludeEnd("ide");
  4676. messageSends: []
  4677. }),
  4678. globals.Number);
  4679. smalltalk.addMethod(
  4680. smalltalk.method({
  4681. selector: "arcSin",
  4682. protocol: 'mathematical functions',
  4683. fn: function (){
  4684. var self=this;
  4685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4686. return smalltalk.withContext(function($ctx1) {
  4687. //>>excludeEnd("ctx");
  4688. return Math.asin(self);;
  4689. return self;
  4690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4691. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},globals.Number)});
  4692. //>>excludeEnd("ctx");
  4693. },
  4694. //>>excludeStart("ide", pragmas.excludeIdeData);
  4695. args: [],
  4696. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4697. referencedClasses: [],
  4698. //>>excludeEnd("ide");
  4699. messageSends: []
  4700. }),
  4701. globals.Number);
  4702. smalltalk.addMethod(
  4703. smalltalk.method({
  4704. selector: "arcTan",
  4705. protocol: 'mathematical functions',
  4706. fn: function (){
  4707. var self=this;
  4708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4709. return smalltalk.withContext(function($ctx1) {
  4710. //>>excludeEnd("ctx");
  4711. return Math.atan(self);;
  4712. return self;
  4713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4714. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},globals.Number)});
  4715. //>>excludeEnd("ctx");
  4716. },
  4717. //>>excludeStart("ide", pragmas.excludeIdeData);
  4718. args: [],
  4719. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4720. referencedClasses: [],
  4721. //>>excludeEnd("ide");
  4722. messageSends: []
  4723. }),
  4724. globals.Number);
  4725. smalltalk.addMethod(
  4726. smalltalk.method({
  4727. selector: "asJSON",
  4728. protocol: 'converting',
  4729. fn: function (){
  4730. var self=this;
  4731. return self;
  4732. },
  4733. //>>excludeStart("ide", pragmas.excludeIdeData);
  4734. args: [],
  4735. source: "asJSON\x0a\x09^ self",
  4736. referencedClasses: [],
  4737. //>>excludeEnd("ide");
  4738. messageSends: []
  4739. }),
  4740. globals.Number);
  4741. smalltalk.addMethod(
  4742. smalltalk.method({
  4743. selector: "asJavascript",
  4744. protocol: 'converting',
  4745. fn: function (){
  4746. var self=this;
  4747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4748. return smalltalk.withContext(function($ctx1) {
  4749. //>>excludeEnd("ctx");
  4750. var $1;
  4751. $1=_st("(".__comma(self._printString())).__comma(")");
  4752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4753. $ctx1.sendIdx[","]=1;
  4754. //>>excludeEnd("ctx");
  4755. return $1;
  4756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4757. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Number)});
  4758. //>>excludeEnd("ctx");
  4759. },
  4760. //>>excludeStart("ide", pragmas.excludeIdeData);
  4761. args: [],
  4762. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4763. referencedClasses: [],
  4764. //>>excludeEnd("ide");
  4765. messageSends: [",", "printString"]
  4766. }),
  4767. globals.Number);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "asNumber",
  4771. protocol: 'converting',
  4772. fn: function (){
  4773. var self=this;
  4774. return self;
  4775. },
  4776. //>>excludeStart("ide", pragmas.excludeIdeData);
  4777. args: [],
  4778. source: "asNumber\x0a\x09^ self",
  4779. referencedClasses: [],
  4780. //>>excludeEnd("ide");
  4781. messageSends: []
  4782. }),
  4783. globals.Number);
  4784. smalltalk.addMethod(
  4785. smalltalk.method({
  4786. selector: "asPoint",
  4787. protocol: 'converting',
  4788. fn: function (){
  4789. var self=this;
  4790. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. return smalltalk.withContext(function($ctx1) {
  4793. //>>excludeEnd("ctx");
  4794. var $1;
  4795. $1=_st($Point())._x_y_(self,self);
  4796. return $1;
  4797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4798. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},globals.Number)});
  4799. //>>excludeEnd("ctx");
  4800. },
  4801. //>>excludeStart("ide", pragmas.excludeIdeData);
  4802. args: [],
  4803. source: "asPoint\x0a\x09^ Point x: self y: self",
  4804. referencedClasses: ["Point"],
  4805. //>>excludeEnd("ide");
  4806. messageSends: ["x:y:"]
  4807. }),
  4808. globals.Number);
  4809. smalltalk.addMethod(
  4810. smalltalk.method({
  4811. selector: "asString",
  4812. protocol: 'converting',
  4813. fn: function (){
  4814. var self=this;
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. return smalltalk.withContext(function($ctx1) {
  4817. //>>excludeEnd("ctx");
  4818. return String(self) ;
  4819. return self;
  4820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4821. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.Number)});
  4822. //>>excludeEnd("ctx");
  4823. },
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: [],
  4826. source: "asString\x0a\x09< return String(self) >",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. messageSends: []
  4830. }),
  4831. globals.Number);
  4832. smalltalk.addMethod(
  4833. smalltalk.method({
  4834. selector: "atRandom",
  4835. protocol: 'converting',
  4836. fn: function (){
  4837. var self=this;
  4838. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  4839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4840. return smalltalk.withContext(function($ctx1) {
  4841. //>>excludeEnd("ctx");
  4842. var $1;
  4843. $1=_st(_st(_st(_st(_st($Random())._new())._next()).__star(self))._truncated()).__plus((1));
  4844. return $1;
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.Number)});
  4847. //>>excludeEnd("ctx");
  4848. },
  4849. //>>excludeStart("ide", pragmas.excludeIdeData);
  4850. args: [],
  4851. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4852. referencedClasses: ["Random"],
  4853. //>>excludeEnd("ide");
  4854. messageSends: ["+", "truncated", "*", "next", "new"]
  4855. }),
  4856. globals.Number);
  4857. smalltalk.addMethod(
  4858. smalltalk.method({
  4859. selector: "ceiling",
  4860. protocol: 'converting',
  4861. fn: function (){
  4862. var self=this;
  4863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4864. return smalltalk.withContext(function($ctx1) {
  4865. //>>excludeEnd("ctx");
  4866. return Math.ceil(self);;
  4867. return self;
  4868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4869. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},globals.Number)});
  4870. //>>excludeEnd("ctx");
  4871. },
  4872. //>>excludeStart("ide", pragmas.excludeIdeData);
  4873. args: [],
  4874. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4875. referencedClasses: [],
  4876. //>>excludeEnd("ide");
  4877. messageSends: []
  4878. }),
  4879. globals.Number);
  4880. smalltalk.addMethod(
  4881. smalltalk.method({
  4882. selector: "copy",
  4883. protocol: 'copying',
  4884. fn: function (){
  4885. var self=this;
  4886. return self;
  4887. },
  4888. //>>excludeStart("ide", pragmas.excludeIdeData);
  4889. args: [],
  4890. source: "copy\x0a\x09^ self",
  4891. referencedClasses: [],
  4892. //>>excludeEnd("ide");
  4893. messageSends: []
  4894. }),
  4895. globals.Number);
  4896. smalltalk.addMethod(
  4897. smalltalk.method({
  4898. selector: "cos",
  4899. protocol: 'mathematical functions',
  4900. fn: function (){
  4901. var self=this;
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. return smalltalk.withContext(function($ctx1) {
  4904. //>>excludeEnd("ctx");
  4905. return Math.cos(self);;
  4906. return self;
  4907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4908. }, function($ctx1) {$ctx1.fill(self,"cos",{},globals.Number)});
  4909. //>>excludeEnd("ctx");
  4910. },
  4911. //>>excludeStart("ide", pragmas.excludeIdeData);
  4912. args: [],
  4913. source: "cos\x0a\x09<return Math.cos(self);>",
  4914. referencedClasses: [],
  4915. //>>excludeEnd("ide");
  4916. messageSends: []
  4917. }),
  4918. globals.Number);
  4919. smalltalk.addMethod(
  4920. smalltalk.method({
  4921. selector: "deepCopy",
  4922. protocol: 'copying',
  4923. fn: function (){
  4924. var self=this;
  4925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4926. return smalltalk.withContext(function($ctx1) {
  4927. //>>excludeEnd("ctx");
  4928. var $1;
  4929. $1=self._copy();
  4930. return $1;
  4931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4932. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.Number)});
  4933. //>>excludeEnd("ctx");
  4934. },
  4935. //>>excludeStart("ide", pragmas.excludeIdeData);
  4936. args: [],
  4937. source: "deepCopy\x0a\x09^ self copy",
  4938. referencedClasses: [],
  4939. //>>excludeEnd("ide");
  4940. messageSends: ["copy"]
  4941. }),
  4942. globals.Number);
  4943. smalltalk.addMethod(
  4944. smalltalk.method({
  4945. selector: "even",
  4946. protocol: 'testing',
  4947. fn: function (){
  4948. var self=this;
  4949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4950. return smalltalk.withContext(function($ctx1) {
  4951. //>>excludeEnd("ctx");
  4952. var $1;
  4953. $1=(0).__eq(self.__backslash_backslash((2)));
  4954. return $1;
  4955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4956. }, function($ctx1) {$ctx1.fill(self,"even",{},globals.Number)});
  4957. //>>excludeEnd("ctx");
  4958. },
  4959. //>>excludeStart("ide", pragmas.excludeIdeData);
  4960. args: [],
  4961. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4962. referencedClasses: [],
  4963. //>>excludeEnd("ide");
  4964. messageSends: ["=", "\x5c\x5c"]
  4965. }),
  4966. globals.Number);
  4967. smalltalk.addMethod(
  4968. smalltalk.method({
  4969. selector: "floor",
  4970. protocol: 'converting',
  4971. fn: function (){
  4972. var self=this;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. return smalltalk.withContext(function($ctx1) {
  4975. //>>excludeEnd("ctx");
  4976. return Math.floor(self);;
  4977. return self;
  4978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4979. }, function($ctx1) {$ctx1.fill(self,"floor",{},globals.Number)});
  4980. //>>excludeEnd("ctx");
  4981. },
  4982. //>>excludeStart("ide", pragmas.excludeIdeData);
  4983. args: [],
  4984. source: "floor\x0a\x09<return Math.floor(self);>",
  4985. referencedClasses: [],
  4986. //>>excludeEnd("ide");
  4987. messageSends: []
  4988. }),
  4989. globals.Number);
  4990. smalltalk.addMethod(
  4991. smalltalk.method({
  4992. selector: "identityHash",
  4993. protocol: 'accessing',
  4994. fn: function (){
  4995. var self=this;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. return smalltalk.withContext(function($ctx1) {
  4998. //>>excludeEnd("ctx");
  4999. var $1;
  5000. $1=_st(self._asString()).__comma("n");
  5001. return $1;
  5002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5003. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.Number)});
  5004. //>>excludeEnd("ctx");
  5005. },
  5006. //>>excludeStart("ide", pragmas.excludeIdeData);
  5007. args: [],
  5008. source: "identityHash\x0a\x09^ self asString, 'n'",
  5009. referencedClasses: [],
  5010. //>>excludeEnd("ide");
  5011. messageSends: [",", "asString"]
  5012. }),
  5013. globals.Number);
  5014. smalltalk.addMethod(
  5015. smalltalk.method({
  5016. selector: "isImmutable",
  5017. protocol: 'testing',
  5018. fn: function (){
  5019. var self=this;
  5020. return true;
  5021. },
  5022. //>>excludeStart("ide", pragmas.excludeIdeData);
  5023. args: [],
  5024. source: "isImmutable\x0a\x09^ true",
  5025. referencedClasses: [],
  5026. //>>excludeEnd("ide");
  5027. messageSends: []
  5028. }),
  5029. globals.Number);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "isNumber",
  5033. protocol: 'testing',
  5034. fn: function (){
  5035. var self=this;
  5036. return true;
  5037. },
  5038. //>>excludeStart("ide", pragmas.excludeIdeData);
  5039. args: [],
  5040. source: "isNumber\x0a\x09^ true",
  5041. referencedClasses: [],
  5042. //>>excludeEnd("ide");
  5043. messageSends: []
  5044. }),
  5045. globals.Number);
  5046. smalltalk.addMethod(
  5047. smalltalk.method({
  5048. selector: "isZero",
  5049. protocol: 'testing',
  5050. fn: function (){
  5051. var self=this;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. return smalltalk.withContext(function($ctx1) {
  5054. //>>excludeEnd("ctx");
  5055. var $1;
  5056. $1=self.__eq((0));
  5057. return $1;
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. }, function($ctx1) {$ctx1.fill(self,"isZero",{},globals.Number)});
  5060. //>>excludeEnd("ctx");
  5061. },
  5062. //>>excludeStart("ide", pragmas.excludeIdeData);
  5063. args: [],
  5064. source: "isZero\x0a\x09^ self = 0",
  5065. referencedClasses: [],
  5066. //>>excludeEnd("ide");
  5067. messageSends: ["="]
  5068. }),
  5069. globals.Number);
  5070. smalltalk.addMethod(
  5071. smalltalk.method({
  5072. selector: "ln",
  5073. protocol: 'mathematical functions',
  5074. fn: function (){
  5075. var self=this;
  5076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5077. return smalltalk.withContext(function($ctx1) {
  5078. //>>excludeEnd("ctx");
  5079. return Math.log(self);;
  5080. return self;
  5081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5082. }, function($ctx1) {$ctx1.fill(self,"ln",{},globals.Number)});
  5083. //>>excludeEnd("ctx");
  5084. },
  5085. //>>excludeStart("ide", pragmas.excludeIdeData);
  5086. args: [],
  5087. source: "ln\x0a\x09<return Math.log(self);>",
  5088. referencedClasses: [],
  5089. //>>excludeEnd("ide");
  5090. messageSends: []
  5091. }),
  5092. globals.Number);
  5093. smalltalk.addMethod(
  5094. smalltalk.method({
  5095. selector: "log",
  5096. protocol: 'mathematical functions',
  5097. fn: function (){
  5098. var self=this;
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. return smalltalk.withContext(function($ctx1) {
  5101. //>>excludeEnd("ctx");
  5102. return Math.log(self) / Math.LN10;;
  5103. return self;
  5104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5105. }, function($ctx1) {$ctx1.fill(self,"log",{},globals.Number)});
  5106. //>>excludeEnd("ctx");
  5107. },
  5108. //>>excludeStart("ide", pragmas.excludeIdeData);
  5109. args: [],
  5110. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  5111. referencedClasses: [],
  5112. //>>excludeEnd("ide");
  5113. messageSends: []
  5114. }),
  5115. globals.Number);
  5116. smalltalk.addMethod(
  5117. smalltalk.method({
  5118. selector: "log:",
  5119. protocol: 'mathematical functions',
  5120. fn: function (aNumber){
  5121. var self=this;
  5122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5123. return smalltalk.withContext(function($ctx1) {
  5124. //>>excludeEnd("ctx");
  5125. return Math.log(self) / Math.log(aNumber);;
  5126. return self;
  5127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5128. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},globals.Number)});
  5129. //>>excludeEnd("ctx");
  5130. },
  5131. //>>excludeStart("ide", pragmas.excludeIdeData);
  5132. args: ["aNumber"],
  5133. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  5134. referencedClasses: [],
  5135. //>>excludeEnd("ide");
  5136. messageSends: []
  5137. }),
  5138. globals.Number);
  5139. smalltalk.addMethod(
  5140. smalltalk.method({
  5141. selector: "max:",
  5142. protocol: 'arithmetic',
  5143. fn: function (aNumber){
  5144. var self=this;
  5145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5146. return smalltalk.withContext(function($ctx1) {
  5147. //>>excludeEnd("ctx");
  5148. return Math.max(self, aNumber);;
  5149. return self;
  5150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5151. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},globals.Number)});
  5152. //>>excludeEnd("ctx");
  5153. },
  5154. //>>excludeStart("ide", pragmas.excludeIdeData);
  5155. args: ["aNumber"],
  5156. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  5157. referencedClasses: [],
  5158. //>>excludeEnd("ide");
  5159. messageSends: []
  5160. }),
  5161. globals.Number);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "min:",
  5165. protocol: 'arithmetic',
  5166. fn: function (aNumber){
  5167. var self=this;
  5168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5169. return smalltalk.withContext(function($ctx1) {
  5170. //>>excludeEnd("ctx");
  5171. return Math.min(self, aNumber);;
  5172. return self;
  5173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5174. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},globals.Number)});
  5175. //>>excludeEnd("ctx");
  5176. },
  5177. //>>excludeStart("ide", pragmas.excludeIdeData);
  5178. args: ["aNumber"],
  5179. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  5180. referencedClasses: [],
  5181. //>>excludeEnd("ide");
  5182. messageSends: []
  5183. }),
  5184. globals.Number);
  5185. smalltalk.addMethod(
  5186. smalltalk.method({
  5187. selector: "negated",
  5188. protocol: 'arithmetic',
  5189. fn: function (){
  5190. var self=this;
  5191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5192. return smalltalk.withContext(function($ctx1) {
  5193. //>>excludeEnd("ctx");
  5194. var $1;
  5195. $1=(0).__minus(self);
  5196. return $1;
  5197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5198. }, function($ctx1) {$ctx1.fill(self,"negated",{},globals.Number)});
  5199. //>>excludeEnd("ctx");
  5200. },
  5201. //>>excludeStart("ide", pragmas.excludeIdeData);
  5202. args: [],
  5203. source: "negated\x0a\x09^ 0 - self",
  5204. referencedClasses: [],
  5205. //>>excludeEnd("ide");
  5206. messageSends: ["-"]
  5207. }),
  5208. globals.Number);
  5209. smalltalk.addMethod(
  5210. smalltalk.method({
  5211. selector: "negative",
  5212. protocol: 'testing',
  5213. fn: function (){
  5214. var self=this;
  5215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5216. return smalltalk.withContext(function($ctx1) {
  5217. //>>excludeEnd("ctx");
  5218. var $1;
  5219. $1=self.__lt((0));
  5220. return $1;
  5221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5222. }, function($ctx1) {$ctx1.fill(self,"negative",{},globals.Number)});
  5223. //>>excludeEnd("ctx");
  5224. },
  5225. //>>excludeStart("ide", pragmas.excludeIdeData);
  5226. args: [],
  5227. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5228. referencedClasses: [],
  5229. //>>excludeEnd("ide");
  5230. messageSends: ["<"]
  5231. }),
  5232. globals.Number);
  5233. smalltalk.addMethod(
  5234. smalltalk.method({
  5235. selector: "odd",
  5236. protocol: 'testing',
  5237. fn: function (){
  5238. var self=this;
  5239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5240. return smalltalk.withContext(function($ctx1) {
  5241. //>>excludeEnd("ctx");
  5242. var $1;
  5243. $1=_st(self._even())._not();
  5244. return $1;
  5245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5246. }, function($ctx1) {$ctx1.fill(self,"odd",{},globals.Number)});
  5247. //>>excludeEnd("ctx");
  5248. },
  5249. //>>excludeStart("ide", pragmas.excludeIdeData);
  5250. args: [],
  5251. source: "odd\x0a\x09^ self even not",
  5252. referencedClasses: [],
  5253. //>>excludeEnd("ide");
  5254. messageSends: ["not", "even"]
  5255. }),
  5256. globals.Number);
  5257. smalltalk.addMethod(
  5258. smalltalk.method({
  5259. selector: "positive",
  5260. protocol: 'testing',
  5261. fn: function (){
  5262. var self=this;
  5263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5264. return smalltalk.withContext(function($ctx1) {
  5265. //>>excludeEnd("ctx");
  5266. var $1;
  5267. $1=self.__gt_eq((0));
  5268. return $1;
  5269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5270. }, function($ctx1) {$ctx1.fill(self,"positive",{},globals.Number)});
  5271. //>>excludeEnd("ctx");
  5272. },
  5273. //>>excludeStart("ide", pragmas.excludeIdeData);
  5274. args: [],
  5275. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5276. referencedClasses: [],
  5277. //>>excludeEnd("ide");
  5278. messageSends: [">="]
  5279. }),
  5280. globals.Number);
  5281. smalltalk.addMethod(
  5282. smalltalk.method({
  5283. selector: "printOn:",
  5284. protocol: 'printing',
  5285. fn: function (aStream){
  5286. var self=this;
  5287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5288. return smalltalk.withContext(function($ctx1) {
  5289. //>>excludeEnd("ctx");
  5290. _st(aStream)._nextPutAll_(self._asString());
  5291. return self;
  5292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5293. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Number)});
  5294. //>>excludeEnd("ctx");
  5295. },
  5296. //>>excludeStart("ide", pragmas.excludeIdeData);
  5297. args: ["aStream"],
  5298. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5299. referencedClasses: [],
  5300. //>>excludeEnd("ide");
  5301. messageSends: ["nextPutAll:", "asString"]
  5302. }),
  5303. globals.Number);
  5304. smalltalk.addMethod(
  5305. smalltalk.method({
  5306. selector: "printShowingDecimalPlaces:",
  5307. protocol: 'printing',
  5308. fn: function (placesDesired){
  5309. var self=this;
  5310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5311. return smalltalk.withContext(function($ctx1) {
  5312. //>>excludeEnd("ctx");
  5313. return self.toFixed(placesDesired);
  5314. return self;
  5315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5316. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},globals.Number)});
  5317. //>>excludeEnd("ctx");
  5318. },
  5319. //>>excludeStart("ide", pragmas.excludeIdeData);
  5320. args: ["placesDesired"],
  5321. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  5322. referencedClasses: [],
  5323. //>>excludeEnd("ide");
  5324. messageSends: []
  5325. }),
  5326. globals.Number);
  5327. smalltalk.addMethod(
  5328. smalltalk.method({
  5329. selector: "raisedTo:",
  5330. protocol: 'mathematical functions',
  5331. fn: function (exponent){
  5332. var self=this;
  5333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5334. return smalltalk.withContext(function($ctx1) {
  5335. //>>excludeEnd("ctx");
  5336. return Math.pow(self, exponent);;
  5337. return self;
  5338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5339. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},globals.Number)});
  5340. //>>excludeEnd("ctx");
  5341. },
  5342. //>>excludeStart("ide", pragmas.excludeIdeData);
  5343. args: ["exponent"],
  5344. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  5345. referencedClasses: [],
  5346. //>>excludeEnd("ide");
  5347. messageSends: []
  5348. }),
  5349. globals.Number);
  5350. smalltalk.addMethod(
  5351. smalltalk.method({
  5352. selector: "rounded",
  5353. protocol: 'converting',
  5354. fn: function (){
  5355. var self=this;
  5356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5357. return smalltalk.withContext(function($ctx1) {
  5358. //>>excludeEnd("ctx");
  5359. return Math.round(self);;
  5360. return self;
  5361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5362. }, function($ctx1) {$ctx1.fill(self,"rounded",{},globals.Number)});
  5363. //>>excludeEnd("ctx");
  5364. },
  5365. //>>excludeStart("ide", pragmas.excludeIdeData);
  5366. args: [],
  5367. source: "rounded\x0a\x09<return Math.round(self);>",
  5368. referencedClasses: [],
  5369. //>>excludeEnd("ide");
  5370. messageSends: []
  5371. }),
  5372. globals.Number);
  5373. smalltalk.addMethod(
  5374. smalltalk.method({
  5375. selector: "sign",
  5376. protocol: 'mathematical functions',
  5377. fn: function (){
  5378. var self=this;
  5379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5380. return smalltalk.withContext(function($ctx1) {
  5381. //>>excludeEnd("ctx");
  5382. var $1,$2;
  5383. $1=self._isZero();
  5384. if(smalltalk.assert($1)){
  5385. return (0);
  5386. };
  5387. $2=self._positive();
  5388. if(smalltalk.assert($2)){
  5389. return (1);
  5390. } else {
  5391. return (-1);
  5392. };
  5393. return self;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. }, function($ctx1) {$ctx1.fill(self,"sign",{},globals.Number)});
  5396. //>>excludeEnd("ctx");
  5397. },
  5398. //>>excludeStart("ide", pragmas.excludeIdeData);
  5399. args: [],
  5400. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5401. referencedClasses: [],
  5402. //>>excludeEnd("ide");
  5403. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5404. }),
  5405. globals.Number);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "sin",
  5409. protocol: 'mathematical functions',
  5410. fn: function (){
  5411. var self=this;
  5412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5413. return smalltalk.withContext(function($ctx1) {
  5414. //>>excludeEnd("ctx");
  5415. return Math.sin(self);;
  5416. return self;
  5417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5418. }, function($ctx1) {$ctx1.fill(self,"sin",{},globals.Number)});
  5419. //>>excludeEnd("ctx");
  5420. },
  5421. //>>excludeStart("ide", pragmas.excludeIdeData);
  5422. args: [],
  5423. source: "sin\x0a\x09<return Math.sin(self);>",
  5424. referencedClasses: [],
  5425. //>>excludeEnd("ide");
  5426. messageSends: []
  5427. }),
  5428. globals.Number);
  5429. smalltalk.addMethod(
  5430. smalltalk.method({
  5431. selector: "sqrt",
  5432. protocol: 'mathematical functions',
  5433. fn: function (){
  5434. var self=this;
  5435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5436. return smalltalk.withContext(function($ctx1) {
  5437. //>>excludeEnd("ctx");
  5438. return Math.sqrt(self);
  5439. return self;
  5440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5441. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},globals.Number)});
  5442. //>>excludeEnd("ctx");
  5443. },
  5444. //>>excludeStart("ide", pragmas.excludeIdeData);
  5445. args: [],
  5446. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  5447. referencedClasses: [],
  5448. //>>excludeEnd("ide");
  5449. messageSends: []
  5450. }),
  5451. globals.Number);
  5452. smalltalk.addMethod(
  5453. smalltalk.method({
  5454. selector: "squared",
  5455. protocol: 'mathematical functions',
  5456. fn: function (){
  5457. var self=this;
  5458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5459. return smalltalk.withContext(function($ctx1) {
  5460. //>>excludeEnd("ctx");
  5461. var $1;
  5462. $1=self.__star(self);
  5463. return $1;
  5464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5465. }, function($ctx1) {$ctx1.fill(self,"squared",{},globals.Number)});
  5466. //>>excludeEnd("ctx");
  5467. },
  5468. //>>excludeStart("ide", pragmas.excludeIdeData);
  5469. args: [],
  5470. source: "squared\x0a\x09^ self * self",
  5471. referencedClasses: [],
  5472. //>>excludeEnd("ide");
  5473. messageSends: ["*"]
  5474. }),
  5475. globals.Number);
  5476. smalltalk.addMethod(
  5477. smalltalk.method({
  5478. selector: "tan",
  5479. protocol: 'mathematical functions',
  5480. fn: function (){
  5481. var self=this;
  5482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5483. return smalltalk.withContext(function($ctx1) {
  5484. //>>excludeEnd("ctx");
  5485. return Math.tan(self);;
  5486. return self;
  5487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5488. }, function($ctx1) {$ctx1.fill(self,"tan",{},globals.Number)});
  5489. //>>excludeEnd("ctx");
  5490. },
  5491. //>>excludeStart("ide", pragmas.excludeIdeData);
  5492. args: [],
  5493. source: "tan\x0a\x09<return Math.tan(self);>",
  5494. referencedClasses: [],
  5495. //>>excludeEnd("ide");
  5496. messageSends: []
  5497. }),
  5498. globals.Number);
  5499. smalltalk.addMethod(
  5500. smalltalk.method({
  5501. selector: "timesRepeat:",
  5502. protocol: 'enumerating',
  5503. fn: function (aBlock){
  5504. var self=this;
  5505. var count;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. return smalltalk.withContext(function($ctx1) {
  5508. //>>excludeEnd("ctx");
  5509. count=(1);
  5510. _st((function(){
  5511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5512. return smalltalk.withContext(function($ctx2) {
  5513. //>>excludeEnd("ctx");
  5514. return _st(count).__gt(self);
  5515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5517. //>>excludeEnd("ctx");
  5518. }))._whileFalse_((function(){
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. return smalltalk.withContext(function($ctx2) {
  5521. //>>excludeEnd("ctx");
  5522. _st(aBlock)._value();
  5523. count=_st(count).__plus((1));
  5524. return count;
  5525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5527. //>>excludeEnd("ctx");
  5528. }));
  5529. return self;
  5530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5531. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},globals.Number)});
  5532. //>>excludeEnd("ctx");
  5533. },
  5534. //>>excludeStart("ide", pragmas.excludeIdeData);
  5535. args: ["aBlock"],
  5536. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5537. referencedClasses: [],
  5538. //>>excludeEnd("ide");
  5539. messageSends: ["whileFalse:", ">", "value", "+"]
  5540. }),
  5541. globals.Number);
  5542. smalltalk.addMethod(
  5543. smalltalk.method({
  5544. selector: "to:",
  5545. protocol: 'converting',
  5546. fn: function (aNumber){
  5547. var self=this;
  5548. var array,first,last,count;
  5549. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  5550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5551. return smalltalk.withContext(function($ctx1) {
  5552. //>>excludeEnd("ctx");
  5553. var $1;
  5554. first=self._truncated();
  5555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5556. $ctx1.sendIdx["truncated"]=1;
  5557. //>>excludeEnd("ctx");
  5558. last=_st(_st(aNumber)._truncated()).__plus((1));
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. $ctx1.sendIdx["+"]=1;
  5561. //>>excludeEnd("ctx");
  5562. count=(1);
  5563. array=_st($Array())._new();
  5564. _st(_st(last).__minus(first))._timesRepeat_((function(){
  5565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5566. return smalltalk.withContext(function($ctx2) {
  5567. //>>excludeEnd("ctx");
  5568. _st(array)._at_put_(count,first);
  5569. count=_st(count).__plus((1));
  5570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5571. $ctx2.sendIdx["+"]=2;
  5572. //>>excludeEnd("ctx");
  5573. count;
  5574. first=_st(first).__plus((1));
  5575. return first;
  5576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5577. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5578. //>>excludeEnd("ctx");
  5579. }));
  5580. $1=array;
  5581. return $1;
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},globals.Number)});
  5584. //>>excludeEnd("ctx");
  5585. },
  5586. //>>excludeStart("ide", pragmas.excludeIdeData);
  5587. args: ["aNumber"],
  5588. 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",
  5589. referencedClasses: ["Array"],
  5590. //>>excludeEnd("ide");
  5591. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5592. }),
  5593. globals.Number);
  5594. smalltalk.addMethod(
  5595. smalltalk.method({
  5596. selector: "to:by:",
  5597. protocol: 'converting',
  5598. fn: function (stop,step){
  5599. var self=this;
  5600. var array,value,pos;
  5601. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. return smalltalk.withContext(function($ctx1) {
  5604. //>>excludeEnd("ctx");
  5605. var $1,$2,$3;
  5606. value=self;
  5607. array=_st($Array())._new();
  5608. pos=(1);
  5609. $1=_st(step).__eq((0));
  5610. if(smalltalk.assert($1)){
  5611. self._error_("step must be non-zero");
  5612. };
  5613. $2=_st(step).__lt((0));
  5614. if(smalltalk.assert($2)){
  5615. _st((function(){
  5616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5617. return smalltalk.withContext(function($ctx2) {
  5618. //>>excludeEnd("ctx");
  5619. return _st(value).__gt_eq(stop);
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5622. //>>excludeEnd("ctx");
  5623. }))._whileTrue_((function(){
  5624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5625. return smalltalk.withContext(function($ctx2) {
  5626. //>>excludeEnd("ctx");
  5627. _st(array)._at_put_(pos,value);
  5628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5629. $ctx2.sendIdx["at:put:"]=1;
  5630. //>>excludeEnd("ctx");
  5631. pos=_st(pos).__plus((1));
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. $ctx2.sendIdx["+"]=1;
  5634. //>>excludeEnd("ctx");
  5635. pos;
  5636. value=_st(value).__plus(step);
  5637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5638. $ctx2.sendIdx["+"]=2;
  5639. //>>excludeEnd("ctx");
  5640. return value;
  5641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5643. //>>excludeEnd("ctx");
  5644. }));
  5645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5646. $ctx1.sendIdx["whileTrue:"]=1;
  5647. //>>excludeEnd("ctx");
  5648. } else {
  5649. _st((function(){
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. return smalltalk.withContext(function($ctx2) {
  5652. //>>excludeEnd("ctx");
  5653. return _st(value).__lt_eq(stop);
  5654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5655. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5656. //>>excludeEnd("ctx");
  5657. }))._whileTrue_((function(){
  5658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5659. return smalltalk.withContext(function($ctx2) {
  5660. //>>excludeEnd("ctx");
  5661. _st(array)._at_put_(pos,value);
  5662. pos=_st(pos).__plus((1));
  5663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5664. $ctx2.sendIdx["+"]=3;
  5665. //>>excludeEnd("ctx");
  5666. pos;
  5667. value=_st(value).__plus(step);
  5668. return value;
  5669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5671. //>>excludeEnd("ctx");
  5672. }));
  5673. };
  5674. $3=array;
  5675. return $3;
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},globals.Number)});
  5678. //>>excludeEnd("ctx");
  5679. },
  5680. //>>excludeStart("ide", pragmas.excludeIdeData);
  5681. args: ["stop", "step"],
  5682. 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",
  5683. referencedClasses: ["Array"],
  5684. //>>excludeEnd("ide");
  5685. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5686. }),
  5687. globals.Number);
  5688. smalltalk.addMethod(
  5689. smalltalk.method({
  5690. selector: "to:by:do:",
  5691. protocol: 'enumerating',
  5692. fn: function (stop,step,aBlock){
  5693. var self=this;
  5694. var value;
  5695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5696. return smalltalk.withContext(function($ctx1) {
  5697. //>>excludeEnd("ctx");
  5698. var $1,$2;
  5699. value=self;
  5700. $1=_st(step).__eq((0));
  5701. if(smalltalk.assert($1)){
  5702. self._error_("step must be non-zero");
  5703. };
  5704. $2=_st(step).__lt((0));
  5705. if(smalltalk.assert($2)){
  5706. _st((function(){
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. return smalltalk.withContext(function($ctx2) {
  5709. //>>excludeEnd("ctx");
  5710. return _st(value).__gt_eq(stop);
  5711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5713. //>>excludeEnd("ctx");
  5714. }))._whileTrue_((function(){
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. return smalltalk.withContext(function($ctx2) {
  5717. //>>excludeEnd("ctx");
  5718. _st(aBlock)._value_(value);
  5719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5720. $ctx2.sendIdx["value:"]=1;
  5721. //>>excludeEnd("ctx");
  5722. value=_st(value).__plus(step);
  5723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5724. $ctx2.sendIdx["+"]=1;
  5725. //>>excludeEnd("ctx");
  5726. return value;
  5727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5729. //>>excludeEnd("ctx");
  5730. }));
  5731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5732. $ctx1.sendIdx["whileTrue:"]=1;
  5733. //>>excludeEnd("ctx");
  5734. } else {
  5735. _st((function(){
  5736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5737. return smalltalk.withContext(function($ctx2) {
  5738. //>>excludeEnd("ctx");
  5739. return _st(value).__lt_eq(stop);
  5740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5742. //>>excludeEnd("ctx");
  5743. }))._whileTrue_((function(){
  5744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5745. return smalltalk.withContext(function($ctx2) {
  5746. //>>excludeEnd("ctx");
  5747. _st(aBlock)._value_(value);
  5748. value=_st(value).__plus(step);
  5749. return value;
  5750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5752. //>>excludeEnd("ctx");
  5753. }));
  5754. };
  5755. return self;
  5756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5757. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},globals.Number)});
  5758. //>>excludeEnd("ctx");
  5759. },
  5760. //>>excludeStart("ide", pragmas.excludeIdeData);
  5761. args: ["stop", "step", "aBlock"],
  5762. 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 ]]",
  5763. referencedClasses: [],
  5764. //>>excludeEnd("ide");
  5765. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5766. }),
  5767. globals.Number);
  5768. smalltalk.addMethod(
  5769. smalltalk.method({
  5770. selector: "to:do:",
  5771. protocol: 'enumerating',
  5772. fn: function (stop,aBlock){
  5773. var self=this;
  5774. var nextValue;
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. return smalltalk.withContext(function($ctx1) {
  5777. //>>excludeEnd("ctx");
  5778. nextValue=self;
  5779. _st((function(){
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. return smalltalk.withContext(function($ctx2) {
  5782. //>>excludeEnd("ctx");
  5783. return _st(nextValue).__lt_eq(stop);
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5786. //>>excludeEnd("ctx");
  5787. }))._whileTrue_((function(){
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. return smalltalk.withContext(function($ctx2) {
  5790. //>>excludeEnd("ctx");
  5791. _st(aBlock)._value_(nextValue);
  5792. nextValue=_st(nextValue).__plus((1));
  5793. return nextValue;
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5796. //>>excludeEnd("ctx");
  5797. }));
  5798. return self;
  5799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5800. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},globals.Number)});
  5801. //>>excludeEnd("ctx");
  5802. },
  5803. //>>excludeStart("ide", pragmas.excludeIdeData);
  5804. args: ["stop", "aBlock"],
  5805. 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 ]",
  5806. referencedClasses: [],
  5807. //>>excludeEnd("ide");
  5808. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5809. }),
  5810. globals.Number);
  5811. smalltalk.addMethod(
  5812. smalltalk.method({
  5813. selector: "truncated",
  5814. protocol: 'converting',
  5815. fn: function (){
  5816. var self=this;
  5817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5818. return smalltalk.withContext(function($ctx1) {
  5819. //>>excludeEnd("ctx");
  5820. if(self >= 0) {
  5821. return Math.floor(self);
  5822. } else {
  5823. return Math.floor(self * (-1)) * (-1);
  5824. };
  5825. ;
  5826. return self;
  5827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5828. }, function($ctx1) {$ctx1.fill(self,"truncated",{},globals.Number)});
  5829. //>>excludeEnd("ctx");
  5830. },
  5831. //>>excludeStart("ide", pragmas.excludeIdeData);
  5832. args: [],
  5833. 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>",
  5834. referencedClasses: [],
  5835. //>>excludeEnd("ide");
  5836. messageSends: []
  5837. }),
  5838. globals.Number);
  5839. smalltalk.addMethod(
  5840. smalltalk.method({
  5841. selector: "|",
  5842. protocol: 'converting',
  5843. fn: function (aNumber){
  5844. var self=this;
  5845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5846. return smalltalk.withContext(function($ctx1) {
  5847. //>>excludeEnd("ctx");
  5848. return self | aNumber;
  5849. return self;
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},globals.Number)});
  5852. //>>excludeEnd("ctx");
  5853. },
  5854. //>>excludeStart("ide", pragmas.excludeIdeData);
  5855. args: ["aNumber"],
  5856. source: "| aNumber\x0a\x09<return self | aNumber>",
  5857. referencedClasses: [],
  5858. //>>excludeEnd("ide");
  5859. messageSends: []
  5860. }),
  5861. globals.Number);
  5862. smalltalk.addMethod(
  5863. smalltalk.method({
  5864. selector: "e",
  5865. protocol: 'instance creation',
  5866. fn: function (){
  5867. var self=this;
  5868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5869. return smalltalk.withContext(function($ctx1) {
  5870. //>>excludeEnd("ctx");
  5871. return Math.E;;
  5872. return self;
  5873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5874. }, function($ctx1) {$ctx1.fill(self,"e",{},globals.Number.klass)});
  5875. //>>excludeEnd("ctx");
  5876. },
  5877. //>>excludeStart("ide", pragmas.excludeIdeData);
  5878. args: [],
  5879. source: "e\x0a\x09<return Math.E;>",
  5880. referencedClasses: [],
  5881. //>>excludeEnd("ide");
  5882. messageSends: []
  5883. }),
  5884. globals.Number.klass);
  5885. smalltalk.addMethod(
  5886. smalltalk.method({
  5887. selector: "heliosClass",
  5888. protocol: 'helios',
  5889. fn: function (){
  5890. var self=this;
  5891. return "magnitude";
  5892. },
  5893. //>>excludeStart("ide", pragmas.excludeIdeData);
  5894. args: [],
  5895. source: "heliosClass\x0a\x09^ 'magnitude'",
  5896. referencedClasses: [],
  5897. //>>excludeEnd("ide");
  5898. messageSends: []
  5899. }),
  5900. globals.Number.klass);
  5901. smalltalk.addMethod(
  5902. smalltalk.method({
  5903. selector: "pi",
  5904. protocol: 'instance creation',
  5905. fn: function (){
  5906. var self=this;
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. return smalltalk.withContext(function($ctx1) {
  5909. //>>excludeEnd("ctx");
  5910. return Math.PI;
  5911. return self;
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. }, function($ctx1) {$ctx1.fill(self,"pi",{},globals.Number.klass)});
  5914. //>>excludeEnd("ctx");
  5915. },
  5916. //>>excludeStart("ide", pragmas.excludeIdeData);
  5917. args: [],
  5918. source: "pi\x0a\x09<return Math.PI>",
  5919. referencedClasses: [],
  5920. //>>excludeEnd("ide");
  5921. messageSends: []
  5922. }),
  5923. globals.Number.klass);
  5924. smalltalk.addClass('Point', globals.Object, ['x', 'y'], 'Kernel-Objects');
  5925. //>>excludeStart("ide", pragmas.excludeIdeData);
  5926. 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";
  5927. //>>excludeEnd("ide");
  5928. smalltalk.addMethod(
  5929. smalltalk.method({
  5930. selector: "*",
  5931. protocol: 'arithmetic',
  5932. fn: function (aPoint){
  5933. var self=this;
  5934. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  5935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5936. return smalltalk.withContext(function($ctx1) {
  5937. //>>excludeEnd("ctx");
  5938. var $3,$5,$4,$2,$7,$6,$1;
  5939. $3=self._x();
  5940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5941. $ctx1.sendIdx["x"]=1;
  5942. //>>excludeEnd("ctx");
  5943. $5=_st(aPoint)._asPoint();
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. $ctx1.sendIdx["asPoint"]=1;
  5946. //>>excludeEnd("ctx");
  5947. $4=_st($5)._x();
  5948. $2=_st($3).__star($4);
  5949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5950. $ctx1.sendIdx["*"]=1;
  5951. //>>excludeEnd("ctx");
  5952. $7=self._y();
  5953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5954. $ctx1.sendIdx["y"]=1;
  5955. //>>excludeEnd("ctx");
  5956. $6=_st($7).__star(_st(_st(aPoint)._asPoint())._y());
  5957. $1=_st($Point())._x_y_($2,$6);
  5958. return $1;
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},globals.Point)});
  5961. //>>excludeEnd("ctx");
  5962. },
  5963. //>>excludeStart("ide", pragmas.excludeIdeData);
  5964. args: ["aPoint"],
  5965. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5966. referencedClasses: ["Point"],
  5967. //>>excludeEnd("ide");
  5968. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5969. }),
  5970. globals.Point);
  5971. smalltalk.addMethod(
  5972. smalltalk.method({
  5973. selector: "+",
  5974. protocol: 'arithmetic',
  5975. fn: function (aPoint){
  5976. var self=this;
  5977. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. return smalltalk.withContext(function($ctx1) {
  5980. //>>excludeEnd("ctx");
  5981. var $3,$5,$4,$2,$7,$6,$1;
  5982. $3=self._x();
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. $ctx1.sendIdx["x"]=1;
  5985. //>>excludeEnd("ctx");
  5986. $5=_st(aPoint)._asPoint();
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. $ctx1.sendIdx["asPoint"]=1;
  5989. //>>excludeEnd("ctx");
  5990. $4=_st($5)._x();
  5991. $2=_st($3).__plus($4);
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. $ctx1.sendIdx["+"]=1;
  5994. //>>excludeEnd("ctx");
  5995. $7=self._y();
  5996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5997. $ctx1.sendIdx["y"]=1;
  5998. //>>excludeEnd("ctx");
  5999. $6=_st($7).__plus(_st(_st(aPoint)._asPoint())._y());
  6000. $1=_st($Point())._x_y_($2,$6);
  6001. return $1;
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},globals.Point)});
  6004. //>>excludeEnd("ctx");
  6005. },
  6006. //>>excludeStart("ide", pragmas.excludeIdeData);
  6007. args: ["aPoint"],
  6008. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6009. referencedClasses: ["Point"],
  6010. //>>excludeEnd("ide");
  6011. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6012. }),
  6013. globals.Point);
  6014. smalltalk.addMethod(
  6015. smalltalk.method({
  6016. selector: "-",
  6017. protocol: 'arithmetic',
  6018. fn: function (aPoint){
  6019. var self=this;
  6020. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  6021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6022. return smalltalk.withContext(function($ctx1) {
  6023. //>>excludeEnd("ctx");
  6024. var $3,$5,$4,$2,$7,$6,$1;
  6025. $3=self._x();
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. $ctx1.sendIdx["x"]=1;
  6028. //>>excludeEnd("ctx");
  6029. $5=_st(aPoint)._asPoint();
  6030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6031. $ctx1.sendIdx["asPoint"]=1;
  6032. //>>excludeEnd("ctx");
  6033. $4=_st($5)._x();
  6034. $2=_st($3).__minus($4);
  6035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6036. $ctx1.sendIdx["-"]=1;
  6037. //>>excludeEnd("ctx");
  6038. $7=self._y();
  6039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6040. $ctx1.sendIdx["y"]=1;
  6041. //>>excludeEnd("ctx");
  6042. $6=_st($7).__minus(_st(_st(aPoint)._asPoint())._y());
  6043. $1=_st($Point())._x_y_($2,$6);
  6044. return $1;
  6045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6046. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},globals.Point)});
  6047. //>>excludeEnd("ctx");
  6048. },
  6049. //>>excludeStart("ide", pragmas.excludeIdeData);
  6050. args: ["aPoint"],
  6051. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6052. referencedClasses: ["Point"],
  6053. //>>excludeEnd("ide");
  6054. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6055. }),
  6056. globals.Point);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "/",
  6060. protocol: 'arithmetic',
  6061. fn: function (aPoint){
  6062. var self=this;
  6063. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. return smalltalk.withContext(function($ctx1) {
  6066. //>>excludeEnd("ctx");
  6067. var $3,$5,$4,$2,$7,$6,$1;
  6068. $3=self._x();
  6069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6070. $ctx1.sendIdx["x"]=1;
  6071. //>>excludeEnd("ctx");
  6072. $5=_st(aPoint)._asPoint();
  6073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6074. $ctx1.sendIdx["asPoint"]=1;
  6075. //>>excludeEnd("ctx");
  6076. $4=_st($5)._x();
  6077. $2=_st($3).__slash($4);
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. $ctx1.sendIdx["/"]=1;
  6080. //>>excludeEnd("ctx");
  6081. $7=self._y();
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. $ctx1.sendIdx["y"]=1;
  6084. //>>excludeEnd("ctx");
  6085. $6=_st($7).__slash(_st(_st(aPoint)._asPoint())._y());
  6086. $1=_st($Point())._x_y_($2,$6);
  6087. return $1;
  6088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6089. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},globals.Point)});
  6090. //>>excludeEnd("ctx");
  6091. },
  6092. //>>excludeStart("ide", pragmas.excludeIdeData);
  6093. args: ["aPoint"],
  6094. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6095. referencedClasses: ["Point"],
  6096. //>>excludeEnd("ide");
  6097. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6098. }),
  6099. globals.Point);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "<",
  6103. protocol: 'comparing',
  6104. fn: function (aPoint){
  6105. var self=this;
  6106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6107. return smalltalk.withContext(function($ctx1) {
  6108. //>>excludeEnd("ctx");
  6109. var $3,$2,$4,$1;
  6110. $3=self._x();
  6111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6112. $ctx1.sendIdx["x"]=1;
  6113. //>>excludeEnd("ctx");
  6114. $2=_st($3).__lt(_st(aPoint)._x());
  6115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6116. $ctx1.sendIdx["<"]=1;
  6117. //>>excludeEnd("ctx");
  6118. $1=_st($2)._and_((function(){
  6119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6120. return smalltalk.withContext(function($ctx2) {
  6121. //>>excludeEnd("ctx");
  6122. $4=self._y();
  6123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6124. $ctx2.sendIdx["y"]=1;
  6125. //>>excludeEnd("ctx");
  6126. return _st($4).__lt(_st(aPoint)._y());
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6129. //>>excludeEnd("ctx");
  6130. }));
  6131. return $1;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},globals.Point)});
  6134. //>>excludeEnd("ctx");
  6135. },
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["aPoint"],
  6138. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. messageSends: ["and:", "<", "x", "y"]
  6142. }),
  6143. globals.Point);
  6144. smalltalk.addMethod(
  6145. smalltalk.method({
  6146. selector: "<=",
  6147. protocol: 'comparing',
  6148. fn: function (aPoint){
  6149. var self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return smalltalk.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. var $3,$2,$4,$1;
  6154. $3=self._x();
  6155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6156. $ctx1.sendIdx["x"]=1;
  6157. //>>excludeEnd("ctx");
  6158. $2=_st($3).__lt_eq(_st(aPoint)._x());
  6159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6160. $ctx1.sendIdx["<="]=1;
  6161. //>>excludeEnd("ctx");
  6162. $1=_st($2)._and_((function(){
  6163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6164. return smalltalk.withContext(function($ctx2) {
  6165. //>>excludeEnd("ctx");
  6166. $4=self._y();
  6167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6168. $ctx2.sendIdx["y"]=1;
  6169. //>>excludeEnd("ctx");
  6170. return _st($4).__lt_eq(_st(aPoint)._y());
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6173. //>>excludeEnd("ctx");
  6174. }));
  6175. return $1;
  6176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6177. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},globals.Point)});
  6178. //>>excludeEnd("ctx");
  6179. },
  6180. //>>excludeStart("ide", pragmas.excludeIdeData);
  6181. args: ["aPoint"],
  6182. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6183. referencedClasses: [],
  6184. //>>excludeEnd("ide");
  6185. messageSends: ["and:", "<=", "x", "y"]
  6186. }),
  6187. globals.Point);
  6188. smalltalk.addMethod(
  6189. smalltalk.method({
  6190. selector: "=",
  6191. protocol: 'comparing',
  6192. fn: function (aPoint){
  6193. var self=this;
  6194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6195. return smalltalk.withContext(function($ctx1) {
  6196. //>>excludeEnd("ctx");
  6197. var $3,$2,$5,$4,$7,$6,$1;
  6198. $3=_st(aPoint)._class();
  6199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6200. $ctx1.sendIdx["class"]=1;
  6201. //>>excludeEnd("ctx");
  6202. $2=_st($3).__eq(self._class());
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. $ctx1.sendIdx["="]=1;
  6205. //>>excludeEnd("ctx");
  6206. $1=_st($2)._and_((function(){
  6207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6208. return smalltalk.withContext(function($ctx2) {
  6209. //>>excludeEnd("ctx");
  6210. $5=_st(aPoint)._x();
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. $ctx2.sendIdx["x"]=1;
  6213. //>>excludeEnd("ctx");
  6214. $4=_st($5).__eq(self._x());
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. $ctx2.sendIdx["="]=2;
  6217. //>>excludeEnd("ctx");
  6218. $7=_st(aPoint)._y();
  6219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6220. $ctx2.sendIdx["y"]=1;
  6221. //>>excludeEnd("ctx");
  6222. $6=_st($7).__eq(self._y());
  6223. return _st($4).__and($6);
  6224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6226. //>>excludeEnd("ctx");
  6227. }));
  6228. return $1;
  6229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6230. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},globals.Point)});
  6231. //>>excludeEnd("ctx");
  6232. },
  6233. //>>excludeStart("ide", pragmas.excludeIdeData);
  6234. args: ["aPoint"],
  6235. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6236. referencedClasses: [],
  6237. //>>excludeEnd("ide");
  6238. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6239. }),
  6240. globals.Point);
  6241. smalltalk.addMethod(
  6242. smalltalk.method({
  6243. selector: ">",
  6244. protocol: 'comparing',
  6245. fn: function (aPoint){
  6246. var self=this;
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. return smalltalk.withContext(function($ctx1) {
  6249. //>>excludeEnd("ctx");
  6250. var $3,$2,$4,$1;
  6251. $3=self._x();
  6252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6253. $ctx1.sendIdx["x"]=1;
  6254. //>>excludeEnd("ctx");
  6255. $2=_st($3).__gt(_st(aPoint)._x());
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. $ctx1.sendIdx[">"]=1;
  6258. //>>excludeEnd("ctx");
  6259. $1=_st($2)._and_((function(){
  6260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6261. return smalltalk.withContext(function($ctx2) {
  6262. //>>excludeEnd("ctx");
  6263. $4=self._y();
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. $ctx2.sendIdx["y"]=1;
  6266. //>>excludeEnd("ctx");
  6267. return _st($4).__gt(_st(aPoint)._y());
  6268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6270. //>>excludeEnd("ctx");
  6271. }));
  6272. return $1;
  6273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6274. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},globals.Point)});
  6275. //>>excludeEnd("ctx");
  6276. },
  6277. //>>excludeStart("ide", pragmas.excludeIdeData);
  6278. args: ["aPoint"],
  6279. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6280. referencedClasses: [],
  6281. //>>excludeEnd("ide");
  6282. messageSends: ["and:", ">", "x", "y"]
  6283. }),
  6284. globals.Point);
  6285. smalltalk.addMethod(
  6286. smalltalk.method({
  6287. selector: ">=",
  6288. protocol: 'comparing',
  6289. fn: function (aPoint){
  6290. var self=this;
  6291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6292. return smalltalk.withContext(function($ctx1) {
  6293. //>>excludeEnd("ctx");
  6294. var $3,$2,$4,$1;
  6295. $3=self._x();
  6296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6297. $ctx1.sendIdx["x"]=1;
  6298. //>>excludeEnd("ctx");
  6299. $2=_st($3).__gt_eq(_st(aPoint)._x());
  6300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6301. $ctx1.sendIdx[">="]=1;
  6302. //>>excludeEnd("ctx");
  6303. $1=_st($2)._and_((function(){
  6304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6305. return smalltalk.withContext(function($ctx2) {
  6306. //>>excludeEnd("ctx");
  6307. $4=self._y();
  6308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6309. $ctx2.sendIdx["y"]=1;
  6310. //>>excludeEnd("ctx");
  6311. return _st($4).__gt_eq(_st(aPoint)._y());
  6312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6314. //>>excludeEnd("ctx");
  6315. }));
  6316. return $1;
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},globals.Point)});
  6319. //>>excludeEnd("ctx");
  6320. },
  6321. //>>excludeStart("ide", pragmas.excludeIdeData);
  6322. args: ["aPoint"],
  6323. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6324. referencedClasses: [],
  6325. //>>excludeEnd("ide");
  6326. messageSends: ["and:", ">=", "x", "y"]
  6327. }),
  6328. globals.Point);
  6329. smalltalk.addMethod(
  6330. smalltalk.method({
  6331. selector: "asPoint",
  6332. protocol: 'converting',
  6333. fn: function (){
  6334. var self=this;
  6335. return self;
  6336. },
  6337. //>>excludeStart("ide", pragmas.excludeIdeData);
  6338. args: [],
  6339. source: "asPoint\x0a\x09^ self",
  6340. referencedClasses: [],
  6341. //>>excludeEnd("ide");
  6342. messageSends: []
  6343. }),
  6344. globals.Point);
  6345. smalltalk.addMethod(
  6346. smalltalk.method({
  6347. selector: "dist:",
  6348. protocol: 'transforming',
  6349. fn: function (aPoint){
  6350. var self=this;
  6351. var dx,dy;
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. return smalltalk.withContext(function($ctx1) {
  6354. //>>excludeEnd("ctx");
  6355. var $3,$2,$1;
  6356. dx=_st(_st(aPoint)._x()).__minus(self["@x"]);
  6357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6358. $ctx1.sendIdx["-"]=1;
  6359. //>>excludeEnd("ctx");
  6360. dy=_st(_st(aPoint)._y()).__minus(self["@y"]);
  6361. $3=_st(dx).__star(dx);
  6362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6363. $ctx1.sendIdx["*"]=1;
  6364. //>>excludeEnd("ctx");
  6365. $2=_st($3).__plus(_st(dy).__star(dy));
  6366. $1=_st($2)._sqrt();
  6367. return $1;
  6368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6369. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},globals.Point)});
  6370. //>>excludeEnd("ctx");
  6371. },
  6372. //>>excludeStart("ide", pragmas.excludeIdeData);
  6373. args: ["aPoint"],
  6374. 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",
  6375. referencedClasses: [],
  6376. //>>excludeEnd("ide");
  6377. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6378. }),
  6379. globals.Point);
  6380. smalltalk.addMethod(
  6381. smalltalk.method({
  6382. selector: "printOn:",
  6383. protocol: 'printing',
  6384. fn: function (aStream){
  6385. var self=this;
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. return smalltalk.withContext(function($ctx1) {
  6388. //>>excludeEnd("ctx");
  6389. var $1;
  6390. _st(self["@x"])._printOn_(aStream);
  6391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6392. $ctx1.sendIdx["printOn:"]=1;
  6393. //>>excludeEnd("ctx");
  6394. _st(aStream)._nextPutAll_("@");
  6395. $1=_st(_st(self["@y"])._notNil())._and_((function(){
  6396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6397. return smalltalk.withContext(function($ctx2) {
  6398. //>>excludeEnd("ctx");
  6399. return _st(self["@y"])._negative();
  6400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6402. //>>excludeEnd("ctx");
  6403. }));
  6404. if(smalltalk.assert($1)){
  6405. _st(aStream)._space();
  6406. };
  6407. _st(self["@y"])._printOn_(aStream);
  6408. return self;
  6409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6410. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Point)});
  6411. //>>excludeEnd("ctx");
  6412. },
  6413. //>>excludeStart("ide", pragmas.excludeIdeData);
  6414. args: ["aStream"],
  6415. 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",
  6416. referencedClasses: [],
  6417. //>>excludeEnd("ide");
  6418. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6419. }),
  6420. globals.Point);
  6421. smalltalk.addMethod(
  6422. smalltalk.method({
  6423. selector: "translateBy:",
  6424. protocol: 'transforming',
  6425. fn: function (delta){
  6426. var self=this;
  6427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6428. return smalltalk.withContext(function($ctx1) {
  6429. //>>excludeEnd("ctx");
  6430. var $2,$1;
  6431. $2=_st(_st(delta)._x()).__plus(self["@x"]);
  6432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6433. $ctx1.sendIdx["+"]=1;
  6434. //>>excludeEnd("ctx");
  6435. $1=_st($2).__at(_st(_st(delta)._y()).__plus(self["@y"]));
  6436. return $1;
  6437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6438. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},globals.Point)});
  6439. //>>excludeEnd("ctx");
  6440. },
  6441. //>>excludeStart("ide", pragmas.excludeIdeData);
  6442. args: ["delta"],
  6443. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6444. referencedClasses: [],
  6445. //>>excludeEnd("ide");
  6446. messageSends: ["@", "+", "x", "y"]
  6447. }),
  6448. globals.Point);
  6449. smalltalk.addMethod(
  6450. smalltalk.method({
  6451. selector: "x",
  6452. protocol: 'accessing',
  6453. fn: function (){
  6454. var self=this;
  6455. var $1;
  6456. $1=self["@x"];
  6457. return $1;
  6458. },
  6459. //>>excludeStart("ide", pragmas.excludeIdeData);
  6460. args: [],
  6461. source: "x\x0a\x09^ x",
  6462. referencedClasses: [],
  6463. //>>excludeEnd("ide");
  6464. messageSends: []
  6465. }),
  6466. globals.Point);
  6467. smalltalk.addMethod(
  6468. smalltalk.method({
  6469. selector: "x:",
  6470. protocol: 'accessing',
  6471. fn: function (aNumber){
  6472. var self=this;
  6473. self["@x"]=aNumber;
  6474. return self;
  6475. },
  6476. //>>excludeStart("ide", pragmas.excludeIdeData);
  6477. args: ["aNumber"],
  6478. source: "x: aNumber\x0a\x09x := aNumber",
  6479. referencedClasses: [],
  6480. //>>excludeEnd("ide");
  6481. messageSends: []
  6482. }),
  6483. globals.Point);
  6484. smalltalk.addMethod(
  6485. smalltalk.method({
  6486. selector: "y",
  6487. protocol: 'accessing',
  6488. fn: function (){
  6489. var self=this;
  6490. var $1;
  6491. $1=self["@y"];
  6492. return $1;
  6493. },
  6494. //>>excludeStart("ide", pragmas.excludeIdeData);
  6495. args: [],
  6496. source: "y\x0a\x09^ y",
  6497. referencedClasses: [],
  6498. //>>excludeEnd("ide");
  6499. messageSends: []
  6500. }),
  6501. globals.Point);
  6502. smalltalk.addMethod(
  6503. smalltalk.method({
  6504. selector: "y:",
  6505. protocol: 'accessing',
  6506. fn: function (aNumber){
  6507. var self=this;
  6508. self["@y"]=aNumber;
  6509. return self;
  6510. },
  6511. //>>excludeStart("ide", pragmas.excludeIdeData);
  6512. args: ["aNumber"],
  6513. source: "y: aNumber\x0a\x09y := aNumber",
  6514. referencedClasses: [],
  6515. //>>excludeEnd("ide");
  6516. messageSends: []
  6517. }),
  6518. globals.Point);
  6519. smalltalk.addMethod(
  6520. smalltalk.method({
  6521. selector: "heliosClass",
  6522. protocol: 'helios',
  6523. fn: function (){
  6524. var self=this;
  6525. return "magnitude";
  6526. },
  6527. //>>excludeStart("ide", pragmas.excludeIdeData);
  6528. args: [],
  6529. source: "heliosClass\x0a\x09^ 'magnitude'",
  6530. referencedClasses: [],
  6531. //>>excludeEnd("ide");
  6532. messageSends: []
  6533. }),
  6534. globals.Point.klass);
  6535. smalltalk.addMethod(
  6536. smalltalk.method({
  6537. selector: "x:y:",
  6538. protocol: 'instance creation',
  6539. fn: function (aNumber,anotherNumber){
  6540. var self=this;
  6541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6542. return smalltalk.withContext(function($ctx1) {
  6543. //>>excludeEnd("ctx");
  6544. var $2,$3,$1;
  6545. $2=self._new();
  6546. _st($2)._x_(aNumber);
  6547. _st($2)._y_(anotherNumber);
  6548. $3=_st($2)._yourself();
  6549. $1=$3;
  6550. return $1;
  6551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6552. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Point.klass)});
  6553. //>>excludeEnd("ctx");
  6554. },
  6555. //>>excludeStart("ide", pragmas.excludeIdeData);
  6556. args: ["aNumber", "anotherNumber"],
  6557. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6558. referencedClasses: [],
  6559. //>>excludeEnd("ide");
  6560. messageSends: ["x:", "new", "y:", "yourself"]
  6561. }),
  6562. globals.Point.klass);
  6563. smalltalk.addClass('Random', globals.Object, [], 'Kernel-Objects');
  6564. //>>excludeStart("ide", pragmas.excludeIdeData);
  6565. 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'`.";
  6566. //>>excludeEnd("ide");
  6567. smalltalk.addMethod(
  6568. smalltalk.method({
  6569. selector: "next",
  6570. protocol: 'accessing',
  6571. fn: function (){
  6572. var self=this;
  6573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6574. return smalltalk.withContext(function($ctx1) {
  6575. //>>excludeEnd("ctx");
  6576. return Math.random();
  6577. return self;
  6578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6579. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Random)});
  6580. //>>excludeEnd("ctx");
  6581. },
  6582. //>>excludeStart("ide", pragmas.excludeIdeData);
  6583. args: [],
  6584. source: "next\x0a\x09<return Math.random()>",
  6585. referencedClasses: [],
  6586. //>>excludeEnd("ide");
  6587. messageSends: []
  6588. }),
  6589. globals.Random);
  6590. smalltalk.addMethod(
  6591. smalltalk.method({
  6592. selector: "next:",
  6593. protocol: 'accessing',
  6594. fn: function (anInteger){
  6595. var self=this;
  6596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6597. return smalltalk.withContext(function($ctx1) {
  6598. //>>excludeEnd("ctx");
  6599. var $1;
  6600. $1=_st((1)._to_(anInteger))._collect_((function(each){
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return smalltalk.withContext(function($ctx2) {
  6603. //>>excludeEnd("ctx");
  6604. return self._next();
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6607. //>>excludeEnd("ctx");
  6608. }));
  6609. return $1;
  6610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6611. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},globals.Random)});
  6612. //>>excludeEnd("ctx");
  6613. },
  6614. //>>excludeStart("ide", pragmas.excludeIdeData);
  6615. args: ["anInteger"],
  6616. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6617. referencedClasses: [],
  6618. //>>excludeEnd("ide");
  6619. messageSends: ["collect:", "to:", "next"]
  6620. }),
  6621. globals.Random);
  6622. smalltalk.addClass('UndefinedObject', globals.Object, [], 'Kernel-Objects');
  6623. //>>excludeStart("ide", pragmas.excludeIdeData);
  6624. 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`.";
  6625. //>>excludeEnd("ide");
  6626. smalltalk.addMethod(
  6627. smalltalk.method({
  6628. selector: "asJSON",
  6629. protocol: 'converting',
  6630. fn: function (){
  6631. var self=this;
  6632. var $1;
  6633. $1=null;
  6634. return $1;
  6635. },
  6636. //>>excludeStart("ide", pragmas.excludeIdeData);
  6637. args: [],
  6638. source: "asJSON\x0a\x09^ null",
  6639. referencedClasses: [],
  6640. //>>excludeEnd("ide");
  6641. messageSends: []
  6642. }),
  6643. globals.UndefinedObject);
  6644. smalltalk.addMethod(
  6645. smalltalk.method({
  6646. selector: "deepCopy",
  6647. protocol: 'copying',
  6648. fn: function (){
  6649. var self=this;
  6650. return self;
  6651. },
  6652. //>>excludeStart("ide", pragmas.excludeIdeData);
  6653. args: [],
  6654. source: "deepCopy\x0a\x09^ self",
  6655. referencedClasses: [],
  6656. //>>excludeEnd("ide");
  6657. messageSends: []
  6658. }),
  6659. globals.UndefinedObject);
  6660. smalltalk.addMethod(
  6661. smalltalk.method({
  6662. selector: "ifNil:",
  6663. protocol: 'testing',
  6664. fn: function (aBlock){
  6665. var self=this;
  6666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6667. return smalltalk.withContext(function($ctx1) {
  6668. //>>excludeEnd("ctx");
  6669. var $1;
  6670. $1=self._ifNil_ifNotNil_(aBlock,(function(){
  6671. }));
  6672. return $1;
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},globals.UndefinedObject)});
  6675. //>>excludeEnd("ctx");
  6676. },
  6677. //>>excludeStart("ide", pragmas.excludeIdeData);
  6678. args: ["aBlock"],
  6679. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  6680. referencedClasses: [],
  6681. //>>excludeEnd("ide");
  6682. messageSends: ["ifNil:ifNotNil:"]
  6683. }),
  6684. globals.UndefinedObject);
  6685. smalltalk.addMethod(
  6686. smalltalk.method({
  6687. selector: "ifNil:ifNotNil:",
  6688. protocol: 'testing',
  6689. fn: function (aBlock,anotherBlock){
  6690. var self=this;
  6691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6692. return smalltalk.withContext(function($ctx1) {
  6693. //>>excludeEnd("ctx");
  6694. var $1;
  6695. $1=_st(aBlock)._value();
  6696. return $1;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)});
  6699. //>>excludeEnd("ctx");
  6700. },
  6701. //>>excludeStart("ide", pragmas.excludeIdeData);
  6702. args: ["aBlock", "anotherBlock"],
  6703. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  6704. referencedClasses: [],
  6705. //>>excludeEnd("ide");
  6706. messageSends: ["value"]
  6707. }),
  6708. globals.UndefinedObject);
  6709. smalltalk.addMethod(
  6710. smalltalk.method({
  6711. selector: "ifNotNil:",
  6712. protocol: 'testing',
  6713. fn: function (aBlock){
  6714. var self=this;
  6715. return self;
  6716. },
  6717. //>>excludeStart("ide", pragmas.excludeIdeData);
  6718. args: ["aBlock"],
  6719. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  6720. referencedClasses: [],
  6721. //>>excludeEnd("ide");
  6722. messageSends: []
  6723. }),
  6724. globals.UndefinedObject);
  6725. smalltalk.addMethod(
  6726. smalltalk.method({
  6727. selector: "ifNotNil:ifNil:",
  6728. protocol: 'testing',
  6729. fn: function (aBlock,anotherBlock){
  6730. var self=this;
  6731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6732. return smalltalk.withContext(function($ctx1) {
  6733. //>>excludeEnd("ctx");
  6734. var $1;
  6735. $1=_st(anotherBlock)._value();
  6736. return $1;
  6737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6738. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.UndefinedObject)});
  6739. //>>excludeEnd("ctx");
  6740. },
  6741. //>>excludeStart("ide", pragmas.excludeIdeData);
  6742. args: ["aBlock", "anotherBlock"],
  6743. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  6744. referencedClasses: [],
  6745. //>>excludeEnd("ide");
  6746. messageSends: ["value"]
  6747. }),
  6748. globals.UndefinedObject);
  6749. smalltalk.addMethod(
  6750. smalltalk.method({
  6751. selector: "isImmutable",
  6752. protocol: 'testing',
  6753. fn: function (){
  6754. var self=this;
  6755. return true;
  6756. },
  6757. //>>excludeStart("ide", pragmas.excludeIdeData);
  6758. args: [],
  6759. source: "isImmutable\x0a\x09^ true",
  6760. referencedClasses: [],
  6761. //>>excludeEnd("ide");
  6762. messageSends: []
  6763. }),
  6764. globals.UndefinedObject);
  6765. smalltalk.addMethod(
  6766. smalltalk.method({
  6767. selector: "isNil",
  6768. protocol: 'testing',
  6769. fn: function (){
  6770. var self=this;
  6771. return true;
  6772. },
  6773. //>>excludeStart("ide", pragmas.excludeIdeData);
  6774. args: [],
  6775. source: "isNil\x0a\x09^ true",
  6776. referencedClasses: [],
  6777. //>>excludeEnd("ide");
  6778. messageSends: []
  6779. }),
  6780. globals.UndefinedObject);
  6781. smalltalk.addMethod(
  6782. smalltalk.method({
  6783. selector: "notNil",
  6784. protocol: 'testing',
  6785. fn: function (){
  6786. var self=this;
  6787. return false;
  6788. },
  6789. //>>excludeStart("ide", pragmas.excludeIdeData);
  6790. args: [],
  6791. source: "notNil\x0a\x09^ false",
  6792. referencedClasses: [],
  6793. //>>excludeEnd("ide");
  6794. messageSends: []
  6795. }),
  6796. globals.UndefinedObject);
  6797. smalltalk.addMethod(
  6798. smalltalk.method({
  6799. selector: "printOn:",
  6800. protocol: 'printing',
  6801. fn: function (aStream){
  6802. var self=this;
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. return smalltalk.withContext(function($ctx1) {
  6805. //>>excludeEnd("ctx");
  6806. _st(aStream)._nextPutAll_("nil");
  6807. return self;
  6808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6809. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.UndefinedObject)});
  6810. //>>excludeEnd("ctx");
  6811. },
  6812. //>>excludeStart("ide", pragmas.excludeIdeData);
  6813. args: ["aStream"],
  6814. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  6815. referencedClasses: [],
  6816. //>>excludeEnd("ide");
  6817. messageSends: ["nextPutAll:"]
  6818. }),
  6819. globals.UndefinedObject);
  6820. smalltalk.addMethod(
  6821. smalltalk.method({
  6822. selector: "shallowCopy",
  6823. protocol: 'copying',
  6824. fn: function (){
  6825. var self=this;
  6826. return self;
  6827. },
  6828. //>>excludeStart("ide", pragmas.excludeIdeData);
  6829. args: [],
  6830. source: "shallowCopy\x0a\x09^ self",
  6831. referencedClasses: [],
  6832. //>>excludeEnd("ide");
  6833. messageSends: []
  6834. }),
  6835. globals.UndefinedObject);
  6836. smalltalk.addMethod(
  6837. smalltalk.method({
  6838. selector: "subclass:instanceVariableNames:",
  6839. protocol: 'class creation',
  6840. fn: function (aString,anotherString){
  6841. var self=this;
  6842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6843. return smalltalk.withContext(function($ctx1) {
  6844. //>>excludeEnd("ctx");
  6845. var $1;
  6846. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  6847. return $1;
  6848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6849. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.UndefinedObject)});
  6850. //>>excludeEnd("ctx");
  6851. },
  6852. //>>excludeStart("ide", pragmas.excludeIdeData);
  6853. args: ["aString", "anotherString"],
  6854. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  6855. referencedClasses: [],
  6856. //>>excludeEnd("ide");
  6857. messageSends: ["subclass:instanceVariableNames:package:"]
  6858. }),
  6859. globals.UndefinedObject);
  6860. smalltalk.addMethod(
  6861. smalltalk.method({
  6862. selector: "subclass:instanceVariableNames:category:",
  6863. protocol: 'class creation',
  6864. fn: function (aString,aString2,aString3){
  6865. var self=this;
  6866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6867. return smalltalk.withContext(function($ctx1) {
  6868. //>>excludeEnd("ctx");
  6869. var $1;
  6870. self._deprecatedAPI();
  6871. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  6872. return $1;
  6873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6874. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)});
  6875. //>>excludeEnd("ctx");
  6876. },
  6877. //>>excludeStart("ide", pragmas.excludeIdeData);
  6878. args: ["aString", "aString2", "aString3"],
  6879. 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",
  6880. referencedClasses: [],
  6881. //>>excludeEnd("ide");
  6882. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"]
  6883. }),
  6884. globals.UndefinedObject);
  6885. smalltalk.addMethod(
  6886. smalltalk.method({
  6887. selector: "subclass:instanceVariableNames:package:",
  6888. protocol: 'class creation',
  6889. fn: function (aString,aString2,aString3){
  6890. var self=this;
  6891. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  6892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6893. return smalltalk.withContext(function($ctx1) {
  6894. //>>excludeEnd("ctx");
  6895. var $1;
  6896. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  6897. return $1;
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.UndefinedObject)});
  6900. //>>excludeEnd("ctx");
  6901. },
  6902. //>>excludeStart("ide", pragmas.excludeIdeData);
  6903. args: ["aString", "aString2", "aString3"],
  6904. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  6905. referencedClasses: ["ClassBuilder"],
  6906. //>>excludeEnd("ide");
  6907. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  6908. }),
  6909. globals.UndefinedObject);
  6910. smalltalk.addMethod(
  6911. smalltalk.method({
  6912. selector: "new",
  6913. protocol: 'instance creation',
  6914. fn: function (){
  6915. var self=this;
  6916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6917. return smalltalk.withContext(function($ctx1) {
  6918. //>>excludeEnd("ctx");
  6919. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  6920. return self;
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.UndefinedObject.klass)});
  6923. //>>excludeEnd("ctx");
  6924. },
  6925. //>>excludeStart("ide", pragmas.excludeIdeData);
  6926. args: [],
  6927. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  6928. referencedClasses: [],
  6929. //>>excludeEnd("ide");
  6930. messageSends: ["error:"]
  6931. }),
  6932. globals.UndefinedObject.klass);
  6933. });
  6934. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  6935. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  6936. smalltalk.addPackage('Kernel-Classes');
  6937. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6938. smalltalk.addClass('Behavior', globals.Object, [], 'Kernel-Classes');
  6939. //>>excludeStart("ide", pragmas.excludeIdeData);
  6940. 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.";
  6941. //>>excludeEnd("ide");
  6942. smalltalk.addMethod(
  6943. smalltalk.method({
  6944. selector: ">>",
  6945. protocol: 'accessing',
  6946. fn: function (aString){
  6947. var self=this;
  6948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6949. return smalltalk.withContext(function($ctx1) {
  6950. //>>excludeEnd("ctx");
  6951. var $1;
  6952. $1=self._methodAt_(aString);
  6953. return $1;
  6954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6955. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},globals.Behavior)});
  6956. //>>excludeEnd("ctx");
  6957. },
  6958. //>>excludeStart("ide", pragmas.excludeIdeData);
  6959. args: ["aString"],
  6960. source: ">> aString\x0a\x09^ self methodAt: aString",
  6961. referencedClasses: [],
  6962. //>>excludeEnd("ide");
  6963. messageSends: ["methodAt:"]
  6964. }),
  6965. globals.Behavior);
  6966. smalltalk.addMethod(
  6967. smalltalk.method({
  6968. selector: "addCompiledMethod:",
  6969. protocol: 'compiling',
  6970. fn: function (aMethod){
  6971. var self=this;
  6972. var oldMethod,announcement;
  6973. function $MethodAdded(){return globals.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  6974. function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  6975. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  6976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6977. return smalltalk.withContext(function($ctx1) {
  6978. //>>excludeEnd("ctx");
  6979. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  6980. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  6981. return nil;
  6982. }));
  6983. $2=self._protocols();
  6984. $3=_st(aMethod)._protocol();
  6985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6986. $ctx1.sendIdx["protocol"]=1;
  6987. //>>excludeEnd("ctx");
  6988. $1=_st($2)._includes_($3);
  6989. if(! smalltalk.assert($1)){
  6990. $4=self._organization();
  6991. $5=_st(aMethod)._protocol();
  6992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6993. $ctx1.sendIdx["protocol"]=2;
  6994. //>>excludeEnd("ctx");
  6995. _st($4)._addElement_($5);
  6996. };
  6997. self._basicAddCompiledMethod_(aMethod);
  6998. $6=oldMethod;
  6999. if(($receiver = $6) == null || $receiver.isNil){
  7000. $6;
  7001. } else {
  7002. self._removeProtocolIfEmpty_(_st(oldMethod)._protocol());
  7003. };
  7004. $7=oldMethod;
  7005. if(($receiver = $7) == null || $receiver.isNil){
  7006. $8=_st($MethodAdded())._new();
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. $ctx1.sendIdx["new"]=1;
  7009. //>>excludeEnd("ctx");
  7010. _st($8)._method_(aMethod);
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. $ctx1.sendIdx["method:"]=1;
  7013. //>>excludeEnd("ctx");
  7014. $9=_st($8)._yourself();
  7015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7016. $ctx1.sendIdx["yourself"]=1;
  7017. //>>excludeEnd("ctx");
  7018. announcement=$9;
  7019. } else {
  7020. $10=_st($MethodModified())._new();
  7021. _st($10)._oldMethod_(oldMethod);
  7022. _st($10)._method_(aMethod);
  7023. $11=_st($10)._yourself();
  7024. announcement=$11;
  7025. };
  7026. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  7027. return self;
  7028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7029. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},globals.Behavior)});
  7030. //>>excludeEnd("ctx");
  7031. },
  7032. //>>excludeStart("ide", pragmas.excludeIdeData);
  7033. args: ["aMethod"],
  7034. 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",
  7035. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  7036. //>>excludeEnd("ide");
  7037. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  7038. }),
  7039. globals.Behavior);
  7040. smalltalk.addMethod(
  7041. smalltalk.method({
  7042. selector: "allInstanceVariableNames",
  7043. protocol: 'accessing',
  7044. fn: function (){
  7045. var self=this;
  7046. var result;
  7047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7048. return smalltalk.withContext(function($ctx1) {
  7049. //>>excludeEnd("ctx");
  7050. var $1,$2,$receiver;
  7051. result=_st(self._instanceVariableNames())._copy();
  7052. $1=self._superclass();
  7053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7054. $ctx1.sendIdx["superclass"]=1;
  7055. //>>excludeEnd("ctx");
  7056. if(($receiver = $1) == null || $receiver.isNil){
  7057. $1;
  7058. } else {
  7059. _st(result)._addAll_(_st(self._superclass())._allInstanceVariableNames());
  7060. };
  7061. $2=result;
  7062. return $2;
  7063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7064. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},globals.Behavior)});
  7065. //>>excludeEnd("ctx");
  7066. },
  7067. //>>excludeStart("ide", pragmas.excludeIdeData);
  7068. args: [],
  7069. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  7070. referencedClasses: [],
  7071. //>>excludeEnd("ide");
  7072. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  7073. }),
  7074. globals.Behavior);
  7075. smalltalk.addMethod(
  7076. smalltalk.method({
  7077. selector: "allSelectors",
  7078. protocol: 'accessing',
  7079. fn: function (){
  7080. var self=this;
  7081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7082. return smalltalk.withContext(function($ctx1) {
  7083. //>>excludeEnd("ctx");
  7084. var $2,$3,$4,$1;
  7085. $2=self._allSuperclasses();
  7086. $3=self._selectors();
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. $ctx1.sendIdx["selectors"]=1;
  7089. //>>excludeEnd("ctx");
  7090. $1=_st($2)._inject_into_($3,(function(acc,each){
  7091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7092. return smalltalk.withContext(function($ctx2) {
  7093. //>>excludeEnd("ctx");
  7094. _st(acc)._addAll_(_st(each)._selectors());
  7095. $4=_st(acc)._yourself();
  7096. return $4;
  7097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7098. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  7099. //>>excludeEnd("ctx");
  7100. }));
  7101. return $1;
  7102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7103. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Behavior)});
  7104. //>>excludeEnd("ctx");
  7105. },
  7106. //>>excludeStart("ide", pragmas.excludeIdeData);
  7107. args: [],
  7108. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  7109. referencedClasses: [],
  7110. //>>excludeEnd("ide");
  7111. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  7112. }),
  7113. globals.Behavior);
  7114. smalltalk.addMethod(
  7115. smalltalk.method({
  7116. selector: "allSubclasses",
  7117. protocol: 'accessing',
  7118. fn: function (){
  7119. var self=this;
  7120. var subclasses,index;
  7121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7122. return smalltalk.withContext(function($ctx1) {
  7123. //>>excludeEnd("ctx");
  7124. var $1;
  7125. subclasses=self._subclasses();
  7126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7127. $ctx1.sendIdx["subclasses"]=1;
  7128. //>>excludeEnd("ctx");
  7129. index=(1);
  7130. _st((function(){
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. return smalltalk.withContext(function($ctx2) {
  7133. //>>excludeEnd("ctx");
  7134. return _st(index).__gt(_st(subclasses)._size());
  7135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7137. //>>excludeEnd("ctx");
  7138. }))._whileFalse_((function(){
  7139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7140. return smalltalk.withContext(function($ctx2) {
  7141. //>>excludeEnd("ctx");
  7142. _st(subclasses)._addAll_(_st(_st(subclasses)._at_(index))._subclasses());
  7143. index=_st(index).__plus((1));
  7144. return index;
  7145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7147. //>>excludeEnd("ctx");
  7148. }));
  7149. $1=subclasses;
  7150. return $1;
  7151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7152. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},globals.Behavior)});
  7153. //>>excludeEnd("ctx");
  7154. },
  7155. //>>excludeStart("ide", pragmas.excludeIdeData);
  7156. args: [],
  7157. 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",
  7158. referencedClasses: [],
  7159. //>>excludeEnd("ide");
  7160. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  7161. }),
  7162. globals.Behavior);
  7163. smalltalk.addMethod(
  7164. smalltalk.method({
  7165. selector: "allSubclassesDo:",
  7166. protocol: 'enumerating',
  7167. fn: function (aBlock){
  7168. var self=this;
  7169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7170. return smalltalk.withContext(function($ctx1) {
  7171. //>>excludeEnd("ctx");
  7172. _st(self._allSubclasses())._do_((function(each){
  7173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7174. return smalltalk.withContext(function($ctx2) {
  7175. //>>excludeEnd("ctx");
  7176. return _st(aBlock)._value_(each);
  7177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7179. //>>excludeEnd("ctx");
  7180. }));
  7181. return self;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},globals.Behavior)});
  7184. //>>excludeEnd("ctx");
  7185. },
  7186. //>>excludeStart("ide", pragmas.excludeIdeData);
  7187. args: ["aBlock"],
  7188. 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 ]",
  7189. referencedClasses: [],
  7190. //>>excludeEnd("ide");
  7191. messageSends: ["do:", "allSubclasses", "value:"]
  7192. }),
  7193. globals.Behavior);
  7194. smalltalk.addMethod(
  7195. smalltalk.method({
  7196. selector: "allSuperclasses",
  7197. protocol: 'accessing',
  7198. fn: function (){
  7199. var self=this;
  7200. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return smalltalk.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. var $1,$2,$5,$4,$6,$3,$receiver;
  7205. $1=self._superclass();
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. $ctx1.sendIdx["superclass"]=1;
  7208. //>>excludeEnd("ctx");
  7209. if(($receiver = $1) == null || $receiver.isNil){
  7210. $2=[];
  7211. return $2;
  7212. } else {
  7213. $1;
  7214. };
  7215. $5=self._superclass();
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. $ctx1.sendIdx["superclass"]=2;
  7218. //>>excludeEnd("ctx");
  7219. $4=_st($OrderedCollection())._with_($5);
  7220. _st($4)._addAll_(_st(self._superclass())._allSuperclasses());
  7221. $6=_st($4)._yourself();
  7222. $3=$6;
  7223. return $3;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},globals.Behavior)});
  7226. //>>excludeEnd("ctx");
  7227. },
  7228. //>>excludeStart("ide", pragmas.excludeIdeData);
  7229. args: [],
  7230. 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",
  7231. referencedClasses: ["OrderedCollection"],
  7232. //>>excludeEnd("ide");
  7233. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  7234. }),
  7235. globals.Behavior);
  7236. smalltalk.addMethod(
  7237. smalltalk.method({
  7238. selector: "basicAddCompiledMethod:",
  7239. protocol: 'private',
  7240. fn: function (aMethod){
  7241. var self=this;
  7242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7243. return smalltalk.withContext(function($ctx1) {
  7244. //>>excludeEnd("ctx");
  7245. smalltalk.addMethod(aMethod, self);
  7246. return self;
  7247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7248. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  7249. //>>excludeEnd("ctx");
  7250. },
  7251. //>>excludeStart("ide", pragmas.excludeIdeData);
  7252. args: ["aMethod"],
  7253. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  7254. referencedClasses: [],
  7255. //>>excludeEnd("ide");
  7256. messageSends: []
  7257. }),
  7258. globals.Behavior);
  7259. smalltalk.addMethod(
  7260. smalltalk.method({
  7261. selector: "basicNew",
  7262. protocol: 'instance creation',
  7263. fn: function (){
  7264. var self=this;
  7265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7266. return smalltalk.withContext(function($ctx1) {
  7267. //>>excludeEnd("ctx");
  7268. return new self.fn();
  7269. return self;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},globals.Behavior)});
  7272. //>>excludeEnd("ctx");
  7273. },
  7274. //>>excludeStart("ide", pragmas.excludeIdeData);
  7275. args: [],
  7276. source: "basicNew\x0a\x09<return new self.fn()>",
  7277. referencedClasses: [],
  7278. //>>excludeEnd("ide");
  7279. messageSends: []
  7280. }),
  7281. globals.Behavior);
  7282. smalltalk.addMethod(
  7283. smalltalk.method({
  7284. selector: "basicRemoveCompiledMethod:",
  7285. protocol: 'private',
  7286. fn: function (aMethod){
  7287. var self=this;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. return smalltalk.withContext(function($ctx1) {
  7290. //>>excludeEnd("ctx");
  7291. smalltalk.removeMethod(aMethod,self);
  7292. return self;
  7293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7294. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  7295. //>>excludeEnd("ctx");
  7296. },
  7297. //>>excludeStart("ide", pragmas.excludeIdeData);
  7298. args: ["aMethod"],
  7299. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  7300. referencedClasses: [],
  7301. //>>excludeEnd("ide");
  7302. messageSends: []
  7303. }),
  7304. globals.Behavior);
  7305. smalltalk.addMethod(
  7306. smalltalk.method({
  7307. selector: "canUnderstand:",
  7308. protocol: 'testing',
  7309. fn: function (aSelector){
  7310. var self=this;
  7311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7312. return smalltalk.withContext(function($ctx1) {
  7313. //>>excludeEnd("ctx");
  7314. var $3,$2,$1;
  7315. $1=_st(self._includesSelector_(_st(aSelector)._asString()))._or_((function(){
  7316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7317. return smalltalk.withContext(function($ctx2) {
  7318. //>>excludeEnd("ctx");
  7319. $3=self._superclass();
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. $ctx2.sendIdx["superclass"]=1;
  7322. //>>excludeEnd("ctx");
  7323. $2=_st($3)._notNil();
  7324. return _st($2)._and_((function(){
  7325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7326. return smalltalk.withContext(function($ctx3) {
  7327. //>>excludeEnd("ctx");
  7328. return _st(self._superclass())._canUnderstand_(aSelector);
  7329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7330. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7331. //>>excludeEnd("ctx");
  7332. }));
  7333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7335. //>>excludeEnd("ctx");
  7336. }));
  7337. return $1;
  7338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7339. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},globals.Behavior)});
  7340. //>>excludeEnd("ctx");
  7341. },
  7342. //>>excludeStart("ide", pragmas.excludeIdeData);
  7343. args: ["aSelector"],
  7344. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  7345. referencedClasses: [],
  7346. //>>excludeEnd("ide");
  7347. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  7348. }),
  7349. globals.Behavior);
  7350. smalltalk.addMethod(
  7351. smalltalk.method({
  7352. selector: "comment",
  7353. protocol: 'accessing',
  7354. fn: function (){
  7355. var self=this;
  7356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7357. return smalltalk.withContext(function($ctx1) {
  7358. //>>excludeEnd("ctx");
  7359. var $2,$1,$receiver;
  7360. $2=self._basicAt_("comment");
  7361. if(($receiver = $2) == null || $receiver.isNil){
  7362. $1="";
  7363. } else {
  7364. $1=$2;
  7365. };
  7366. return $1;
  7367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7368. }, function($ctx1) {$ctx1.fill(self,"comment",{},globals.Behavior)});
  7369. //>>excludeEnd("ctx");
  7370. },
  7371. //>>excludeStart("ide", pragmas.excludeIdeData);
  7372. args: [],
  7373. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  7374. referencedClasses: [],
  7375. //>>excludeEnd("ide");
  7376. messageSends: ["ifNil:", "basicAt:"]
  7377. }),
  7378. globals.Behavior);
  7379. smalltalk.addMethod(
  7380. smalltalk.method({
  7381. selector: "comment:",
  7382. protocol: 'accessing',
  7383. fn: function (aString){
  7384. var self=this;
  7385. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  7386. function $ClassCommentChanged(){return globals.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. return smalltalk.withContext(function($ctx1) {
  7389. //>>excludeEnd("ctx");
  7390. var $1,$2;
  7391. self._basicAt_put_("comment",aString);
  7392. $1=_st($ClassCommentChanged())._new();
  7393. _st($1)._theClass_(self);
  7394. $2=_st($1)._yourself();
  7395. _st(_st($SystemAnnouncer())._current())._announce_($2);
  7396. return self;
  7397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7398. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},globals.Behavior)});
  7399. //>>excludeEnd("ctx");
  7400. },
  7401. //>>excludeStart("ide", pragmas.excludeIdeData);
  7402. args: ["aString"],
  7403. 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)",
  7404. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  7405. //>>excludeEnd("ide");
  7406. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  7407. }),
  7408. globals.Behavior);
  7409. smalltalk.addMethod(
  7410. smalltalk.method({
  7411. selector: "commentStamp",
  7412. protocol: 'accessing',
  7413. fn: function (){
  7414. var self=this;
  7415. function $ClassCommentReader(){return globals.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. return smalltalk.withContext(function($ctx1) {
  7418. //>>excludeEnd("ctx");
  7419. var $2,$3,$1;
  7420. $2=_st($ClassCommentReader())._new();
  7421. _st($2)._class_(self);
  7422. $3=_st($2)._yourself();
  7423. $1=$3;
  7424. return $1;
  7425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7426. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},globals.Behavior)});
  7427. //>>excludeEnd("ctx");
  7428. },
  7429. //>>excludeStart("ide", pragmas.excludeIdeData);
  7430. args: [],
  7431. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  7432. referencedClasses: ["ClassCommentReader"],
  7433. //>>excludeEnd("ide");
  7434. messageSends: ["class:", "new", "yourself"]
  7435. }),
  7436. globals.Behavior);
  7437. smalltalk.addMethod(
  7438. smalltalk.method({
  7439. selector: "commentStamp:prior:",
  7440. protocol: 'accessing',
  7441. fn: function (aStamp,prior){
  7442. var self=this;
  7443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7444. return smalltalk.withContext(function($ctx1) {
  7445. //>>excludeEnd("ctx");
  7446. var $1;
  7447. $1=self._commentStamp();
  7448. return $1;
  7449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7450. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},globals.Behavior)});
  7451. //>>excludeEnd("ctx");
  7452. },
  7453. //>>excludeStart("ide", pragmas.excludeIdeData);
  7454. args: ["aStamp", "prior"],
  7455. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  7456. referencedClasses: [],
  7457. //>>excludeEnd("ide");
  7458. messageSends: ["commentStamp"]
  7459. }),
  7460. globals.Behavior);
  7461. smalltalk.addMethod(
  7462. smalltalk.method({
  7463. selector: "compile:",
  7464. protocol: 'compiling',
  7465. fn: function (aString){
  7466. var self=this;
  7467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7468. return smalltalk.withContext(function($ctx1) {
  7469. //>>excludeEnd("ctx");
  7470. var $1;
  7471. $1=self._compile_protocol_(aString,"");
  7472. return $1;
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Behavior)});
  7475. //>>excludeEnd("ctx");
  7476. },
  7477. //>>excludeStart("ide", pragmas.excludeIdeData);
  7478. args: ["aString"],
  7479. source: "compile: aString\x0a\x09^ self compile: aString protocol: ''",
  7480. referencedClasses: [],
  7481. //>>excludeEnd("ide");
  7482. messageSends: ["compile:protocol:"]
  7483. }),
  7484. globals.Behavior);
  7485. smalltalk.addMethod(
  7486. smalltalk.method({
  7487. selector: "compile:protocol:",
  7488. protocol: 'compiling',
  7489. fn: function (aString,anotherString){
  7490. var self=this;
  7491. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  7492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7493. return smalltalk.withContext(function($ctx1) {
  7494. //>>excludeEnd("ctx");
  7495. var $1;
  7496. $1=_st(_st($Compiler())._new())._install_forClass_protocol_(aString,self,anotherString);
  7497. return $1;
  7498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7499. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},globals.Behavior)});
  7500. //>>excludeEnd("ctx");
  7501. },
  7502. //>>excludeStart("ide", pragmas.excludeIdeData);
  7503. args: ["aString", "anotherString"],
  7504. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  7505. referencedClasses: ["Compiler"],
  7506. //>>excludeEnd("ide");
  7507. messageSends: ["install:forClass:protocol:", "new"]
  7508. }),
  7509. globals.Behavior);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "definition",
  7513. protocol: 'accessing',
  7514. fn: function (){
  7515. var self=this;
  7516. return "";
  7517. },
  7518. //>>excludeStart("ide", pragmas.excludeIdeData);
  7519. args: [],
  7520. source: "definition\x0a\x09^ ''",
  7521. referencedClasses: [],
  7522. //>>excludeEnd("ide");
  7523. messageSends: []
  7524. }),
  7525. globals.Behavior);
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "includesBehavior:",
  7529. protocol: 'testing',
  7530. fn: function (aClass){
  7531. var self=this;
  7532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7533. return smalltalk.withContext(function($ctx1) {
  7534. //>>excludeEnd("ctx");
  7535. var $1;
  7536. $1=_st(self.__eq_eq(aClass))._or_((function(){
  7537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7538. return smalltalk.withContext(function($ctx2) {
  7539. //>>excludeEnd("ctx");
  7540. return self._inheritsFrom_(aClass);
  7541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7543. //>>excludeEnd("ctx");
  7544. }));
  7545. return $1;
  7546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7547. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},globals.Behavior)});
  7548. //>>excludeEnd("ctx");
  7549. },
  7550. //>>excludeStart("ide", pragmas.excludeIdeData);
  7551. args: ["aClass"],
  7552. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  7553. referencedClasses: [],
  7554. //>>excludeEnd("ide");
  7555. messageSends: ["or:", "==", "inheritsFrom:"]
  7556. }),
  7557. globals.Behavior);
  7558. smalltalk.addMethod(
  7559. smalltalk.method({
  7560. selector: "includesSelector:",
  7561. protocol: 'testing',
  7562. fn: function (aString){
  7563. var self=this;
  7564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7565. return smalltalk.withContext(function($ctx1) {
  7566. //>>excludeEnd("ctx");
  7567. var $1;
  7568. $1=_st(self._methodDictionary())._includesKey_(aString);
  7569. return $1;
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},globals.Behavior)});
  7572. //>>excludeEnd("ctx");
  7573. },
  7574. //>>excludeStart("ide", pragmas.excludeIdeData);
  7575. args: ["aString"],
  7576. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  7577. referencedClasses: [],
  7578. //>>excludeEnd("ide");
  7579. messageSends: ["includesKey:", "methodDictionary"]
  7580. }),
  7581. globals.Behavior);
  7582. smalltalk.addMethod(
  7583. smalltalk.method({
  7584. selector: "inheritsFrom:",
  7585. protocol: 'testing',
  7586. fn: function (aClass){
  7587. var self=this;
  7588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7589. return smalltalk.withContext(function($ctx1) {
  7590. //>>excludeEnd("ctx");
  7591. var $1,$4,$3,$2,$receiver;
  7592. $1=self._superclass();
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. $ctx1.sendIdx["superclass"]=1;
  7595. //>>excludeEnd("ctx");
  7596. if(($receiver = $1) == null || $receiver.isNil){
  7597. return false;
  7598. } else {
  7599. $1;
  7600. };
  7601. $4=self._superclass();
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. $ctx1.sendIdx["superclass"]=2;
  7604. //>>excludeEnd("ctx");
  7605. $3=_st(aClass).__eq_eq($4);
  7606. $2=_st($3)._or_((function(){
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. return smalltalk.withContext(function($ctx2) {
  7609. //>>excludeEnd("ctx");
  7610. return _st(self._superclass())._inheritsFrom_(aClass);
  7611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7613. //>>excludeEnd("ctx");
  7614. }));
  7615. return $2;
  7616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7617. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},globals.Behavior)});
  7618. //>>excludeEnd("ctx");
  7619. },
  7620. //>>excludeStart("ide", pragmas.excludeIdeData);
  7621. args: ["aClass"],
  7622. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  7623. referencedClasses: [],
  7624. //>>excludeEnd("ide");
  7625. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  7626. }),
  7627. globals.Behavior);
  7628. smalltalk.addMethod(
  7629. smalltalk.method({
  7630. selector: "instanceVariableNames",
  7631. protocol: 'accessing',
  7632. fn: function (){
  7633. var self=this;
  7634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7635. return smalltalk.withContext(function($ctx1) {
  7636. //>>excludeEnd("ctx");
  7637. return self.iVarNames;
  7638. return self;
  7639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7640. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},globals.Behavior)});
  7641. //>>excludeEnd("ctx");
  7642. },
  7643. //>>excludeStart("ide", pragmas.excludeIdeData);
  7644. args: [],
  7645. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  7646. referencedClasses: [],
  7647. //>>excludeEnd("ide");
  7648. messageSends: []
  7649. }),
  7650. globals.Behavior);
  7651. smalltalk.addMethod(
  7652. smalltalk.method({
  7653. selector: "isBehavior",
  7654. protocol: 'testing',
  7655. fn: function (){
  7656. var self=this;
  7657. return true;
  7658. },
  7659. //>>excludeStart("ide", pragmas.excludeIdeData);
  7660. args: [],
  7661. source: "isBehavior\x0a\x09^ true",
  7662. referencedClasses: [],
  7663. //>>excludeEnd("ide");
  7664. messageSends: []
  7665. }),
  7666. globals.Behavior);
  7667. smalltalk.addMethod(
  7668. smalltalk.method({
  7669. selector: "javascriptConstructor",
  7670. protocol: 'accessing',
  7671. fn: function (){
  7672. var self=this;
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. return smalltalk.withContext(function($ctx1) {
  7675. //>>excludeEnd("ctx");
  7676. return self.fn;
  7677. return self;
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},globals.Behavior)});
  7680. //>>excludeEnd("ctx");
  7681. },
  7682. //>>excludeStart("ide", pragmas.excludeIdeData);
  7683. args: [],
  7684. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  7685. referencedClasses: [],
  7686. //>>excludeEnd("ide");
  7687. messageSends: []
  7688. }),
  7689. globals.Behavior);
  7690. smalltalk.addMethod(
  7691. smalltalk.method({
  7692. selector: "javascriptConstructor:",
  7693. protocol: 'accessing',
  7694. fn: function (aJavaScriptFunction){
  7695. var self=this;
  7696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7697. return smalltalk.withContext(function($ctx1) {
  7698. //>>excludeEnd("ctx");
  7699. smalltalk.setClassConstructor(self, aJavaScriptFunction);;
  7700. return self;
  7701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7702. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},globals.Behavior)});
  7703. //>>excludeEnd("ctx");
  7704. },
  7705. //>>excludeStart("ide", pragmas.excludeIdeData);
  7706. args: ["aJavaScriptFunction"],
  7707. 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);>",
  7708. referencedClasses: [],
  7709. //>>excludeEnd("ide");
  7710. messageSends: []
  7711. }),
  7712. globals.Behavior);
  7713. smalltalk.addMethod(
  7714. smalltalk.method({
  7715. selector: "lookupSelector:",
  7716. protocol: 'accessing',
  7717. fn: function (selector){
  7718. var self=this;
  7719. var lookupClass;
  7720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7721. return smalltalk.withContext(function($ctx1) {
  7722. //>>excludeEnd("ctx");
  7723. var $1,$2;
  7724. var $early={};
  7725. try {
  7726. lookupClass=self;
  7727. _st((function(){
  7728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7729. return smalltalk.withContext(function($ctx2) {
  7730. //>>excludeEnd("ctx");
  7731. return _st(lookupClass).__eq(nil);
  7732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7734. //>>excludeEnd("ctx");
  7735. }))._whileFalse_((function(){
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return smalltalk.withContext(function($ctx2) {
  7738. //>>excludeEnd("ctx");
  7739. $1=_st(lookupClass)._includesSelector_(selector);
  7740. if(smalltalk.assert($1)){
  7741. $2=_st(lookupClass)._methodAt_(selector);
  7742. throw $early=[$2];
  7743. };
  7744. lookupClass=_st(lookupClass)._superclass();
  7745. return lookupClass;
  7746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7748. //>>excludeEnd("ctx");
  7749. }));
  7750. return nil;
  7751. }
  7752. catch(e) {if(e===$early)return e[0]; throw e}
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},globals.Behavior)});
  7755. //>>excludeEnd("ctx");
  7756. },
  7757. //>>excludeStart("ide", pragmas.excludeIdeData);
  7758. args: ["selector"],
  7759. 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",
  7760. referencedClasses: [],
  7761. //>>excludeEnd("ide");
  7762. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  7763. }),
  7764. globals.Behavior);
  7765. smalltalk.addMethod(
  7766. smalltalk.method({
  7767. selector: "methodAt:",
  7768. protocol: 'accessing',
  7769. fn: function (aString){
  7770. var self=this;
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. return smalltalk.withContext(function($ctx1) {
  7773. //>>excludeEnd("ctx");
  7774. var $1;
  7775. $1=_st(self._methodDictionary())._at_(aString);
  7776. return $1;
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},globals.Behavior)});
  7779. //>>excludeEnd("ctx");
  7780. },
  7781. //>>excludeStart("ide", pragmas.excludeIdeData);
  7782. args: ["aString"],
  7783. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  7784. referencedClasses: [],
  7785. //>>excludeEnd("ide");
  7786. messageSends: ["at:", "methodDictionary"]
  7787. }),
  7788. globals.Behavior);
  7789. smalltalk.addMethod(
  7790. smalltalk.method({
  7791. selector: "methodDictionary",
  7792. protocol: 'accessing',
  7793. fn: function (){
  7794. var self=this;
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. return smalltalk.withContext(function($ctx1) {
  7797. //>>excludeEnd("ctx");
  7798. var dict = globals.HashedCollection._new();
  7799. var methods = self.methods;
  7800. Object.keys(methods).forEach(function(i) {
  7801. if(methods[i].selector) {
  7802. dict._at_put_(methods[i].selector, methods[i]);
  7803. }
  7804. });
  7805. return dict;
  7806. return self;
  7807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7808. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},globals.Behavior)});
  7809. //>>excludeEnd("ctx");
  7810. },
  7811. //>>excludeStart("ide", pragmas.excludeIdeData);
  7812. args: [],
  7813. 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>",
  7814. referencedClasses: [],
  7815. //>>excludeEnd("ide");
  7816. messageSends: []
  7817. }),
  7818. globals.Behavior);
  7819. smalltalk.addMethod(
  7820. smalltalk.method({
  7821. selector: "methodTemplate",
  7822. protocol: 'accessing',
  7823. fn: function (){
  7824. var self=this;
  7825. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  7826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7827. return smalltalk.withContext(function($ctx1) {
  7828. //>>excludeEnd("ctx");
  7829. var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
  7830. $1=_st($String())._streamContents_((function(stream){
  7831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7832. return smalltalk.withContext(function($ctx2) {
  7833. //>>excludeEnd("ctx");
  7834. _st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  7835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7836. $ctx2.sendIdx["nextPutAll:"]=1;
  7837. //>>excludeEnd("ctx");
  7838. $3=_st($String())._lf();
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. $ctx2.sendIdx["lf"]=1;
  7841. //>>excludeEnd("ctx");
  7842. $4=_st($String())._tab();
  7843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7844. $ctx2.sendIdx["tab"]=1;
  7845. //>>excludeEnd("ctx");
  7846. $2=_st($3).__comma($4);
  7847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7848. $ctx2.sendIdx[","]=1;
  7849. //>>excludeEnd("ctx");
  7850. _st(stream)._nextPutAll_($2);
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. $ctx2.sendIdx["nextPutAll:"]=2;
  7853. //>>excludeEnd("ctx");
  7854. _st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. $ctx2.sendIdx["nextPutAll:"]=3;
  7857. //>>excludeEnd("ctx");
  7858. $7=_st($String())._lf();
  7859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7860. $ctx2.sendIdx["lf"]=2;
  7861. //>>excludeEnd("ctx");
  7862. $8=_st($String())._lf();
  7863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7864. $ctx2.sendIdx["lf"]=3;
  7865. //>>excludeEnd("ctx");
  7866. $6=_st($7).__comma($8);
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. $ctx2.sendIdx[","]=3;
  7869. //>>excludeEnd("ctx");
  7870. $9=_st($String())._tab();
  7871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7872. $ctx2.sendIdx["tab"]=2;
  7873. //>>excludeEnd("ctx");
  7874. $5=_st($6).__comma($9);
  7875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7876. $ctx2.sendIdx[","]=2;
  7877. //>>excludeEnd("ctx");
  7878. _st(stream)._nextPutAll_($5);
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. $ctx2.sendIdx["nextPutAll:"]=4;
  7881. //>>excludeEnd("ctx");
  7882. _st(stream)._nextPutAll_("| temporary variable names |");
  7883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7884. $ctx2.sendIdx["nextPutAll:"]=5;
  7885. //>>excludeEnd("ctx");
  7886. _st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
  7887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7888. $ctx2.sendIdx["nextPutAll:"]=6;
  7889. //>>excludeEnd("ctx");
  7890. $10=_st(stream)._nextPutAll_("statements");
  7891. return $10;
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7894. //>>excludeEnd("ctx");
  7895. }));
  7896. return $1;
  7897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7898. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)});
  7899. //>>excludeEnd("ctx");
  7900. },
  7901. //>>excludeStart("ide", pragmas.excludeIdeData);
  7902. args: [],
  7903. 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' ]",
  7904. referencedClasses: ["String"],
  7905. //>>excludeEnd("ide");
  7906. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  7907. }),
  7908. globals.Behavior);
  7909. smalltalk.addMethod(
  7910. smalltalk.method({
  7911. selector: "methods",
  7912. protocol: 'accessing',
  7913. fn: function (){
  7914. var self=this;
  7915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7916. return smalltalk.withContext(function($ctx1) {
  7917. //>>excludeEnd("ctx");
  7918. var $1;
  7919. $1=_st(self._methodDictionary())._values();
  7920. return $1;
  7921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7922. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.Behavior)});
  7923. //>>excludeEnd("ctx");
  7924. },
  7925. //>>excludeStart("ide", pragmas.excludeIdeData);
  7926. args: [],
  7927. source: "methods\x0a\x09^ self methodDictionary values",
  7928. referencedClasses: [],
  7929. //>>excludeEnd("ide");
  7930. messageSends: ["values", "methodDictionary"]
  7931. }),
  7932. globals.Behavior);
  7933. smalltalk.addMethod(
  7934. smalltalk.method({
  7935. selector: "methodsFor:",
  7936. protocol: 'accessing',
  7937. fn: function (aString){
  7938. var self=this;
  7939. function $ClassCategoryReader(){return globals.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  7940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7941. return smalltalk.withContext(function($ctx1) {
  7942. //>>excludeEnd("ctx");
  7943. var $2,$3,$1;
  7944. $2=_st($ClassCategoryReader())._new();
  7945. _st($2)._class_category_(self,aString);
  7946. $3=_st($2)._yourself();
  7947. $1=$3;
  7948. return $1;
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},globals.Behavior)});
  7951. //>>excludeEnd("ctx");
  7952. },
  7953. //>>excludeStart("ide", pragmas.excludeIdeData);
  7954. args: ["aString"],
  7955. source: "methodsFor: aString\x0a\x09^ ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  7956. referencedClasses: ["ClassCategoryReader"],
  7957. //>>excludeEnd("ide");
  7958. messageSends: ["class:category:", "new", "yourself"]
  7959. }),
  7960. globals.Behavior);
  7961. smalltalk.addMethod(
  7962. smalltalk.method({
  7963. selector: "methodsFor:stamp:",
  7964. protocol: 'accessing',
  7965. fn: function (aString,aStamp){
  7966. var self=this;
  7967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7968. return smalltalk.withContext(function($ctx1) {
  7969. //>>excludeEnd("ctx");
  7970. var $1;
  7971. $1=self._methodsFor_(aString);
  7972. return $1;
  7973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7974. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},globals.Behavior)});
  7975. //>>excludeEnd("ctx");
  7976. },
  7977. //>>excludeStart("ide", pragmas.excludeIdeData);
  7978. args: ["aString", "aStamp"],
  7979. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  7980. referencedClasses: [],
  7981. //>>excludeEnd("ide");
  7982. messageSends: ["methodsFor:"]
  7983. }),
  7984. globals.Behavior);
  7985. smalltalk.addMethod(
  7986. smalltalk.method({
  7987. selector: "methodsInProtocol:",
  7988. protocol: 'accessing',
  7989. fn: function (aString){
  7990. var self=this;
  7991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7992. return smalltalk.withContext(function($ctx1) {
  7993. //>>excludeEnd("ctx");
  7994. var $1;
  7995. $1=_st(self._methods())._select_((function(each){
  7996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7997. return smalltalk.withContext(function($ctx2) {
  7998. //>>excludeEnd("ctx");
  7999. return _st(_st(each)._protocol()).__eq(aString);
  8000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8002. //>>excludeEnd("ctx");
  8003. }));
  8004. return $1;
  8005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8006. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},globals.Behavior)});
  8007. //>>excludeEnd("ctx");
  8008. },
  8009. //>>excludeStart("ide", pragmas.excludeIdeData);
  8010. args: ["aString"],
  8011. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  8012. referencedClasses: [],
  8013. //>>excludeEnd("ide");
  8014. messageSends: ["select:", "methods", "=", "protocol"]
  8015. }),
  8016. globals.Behavior);
  8017. smalltalk.addMethod(
  8018. smalltalk.method({
  8019. selector: "name",
  8020. protocol: 'accessing',
  8021. fn: function (){
  8022. var self=this;
  8023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8024. return smalltalk.withContext(function($ctx1) {
  8025. //>>excludeEnd("ctx");
  8026. return self.className || nil;
  8027. return self;
  8028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8029. }, function($ctx1) {$ctx1.fill(self,"name",{},globals.Behavior)});
  8030. //>>excludeEnd("ctx");
  8031. },
  8032. //>>excludeStart("ide", pragmas.excludeIdeData);
  8033. args: [],
  8034. source: "name\x0a\x09<return self.className || nil>",
  8035. referencedClasses: [],
  8036. //>>excludeEnd("ide");
  8037. messageSends: []
  8038. }),
  8039. globals.Behavior);
  8040. smalltalk.addMethod(
  8041. smalltalk.method({
  8042. selector: "new",
  8043. protocol: 'instance creation',
  8044. fn: function (){
  8045. var self=this;
  8046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8047. return smalltalk.withContext(function($ctx1) {
  8048. //>>excludeEnd("ctx");
  8049. var $1;
  8050. $1=_st(self._basicNew())._initialize();
  8051. return $1;
  8052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8053. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Behavior)});
  8054. //>>excludeEnd("ctx");
  8055. },
  8056. //>>excludeStart("ide", pragmas.excludeIdeData);
  8057. args: [],
  8058. source: "new\x0a\x09^ self basicNew initialize",
  8059. referencedClasses: [],
  8060. //>>excludeEnd("ide");
  8061. messageSends: ["initialize", "basicNew"]
  8062. }),
  8063. globals.Behavior);
  8064. smalltalk.addMethod(
  8065. smalltalk.method({
  8066. selector: "organization",
  8067. protocol: 'accessing',
  8068. fn: function (){
  8069. var self=this;
  8070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8071. return smalltalk.withContext(function($ctx1) {
  8072. //>>excludeEnd("ctx");
  8073. var $1;
  8074. $1=self._basicAt_("organization");
  8075. return $1;
  8076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8077. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Behavior)});
  8078. //>>excludeEnd("ctx");
  8079. },
  8080. //>>excludeStart("ide", pragmas.excludeIdeData);
  8081. args: [],
  8082. source: "organization\x0a\x09^ self basicAt: 'organization'",
  8083. referencedClasses: [],
  8084. //>>excludeEnd("ide");
  8085. messageSends: ["basicAt:"]
  8086. }),
  8087. globals.Behavior);
  8088. smalltalk.addMethod(
  8089. smalltalk.method({
  8090. selector: "ownMethods",
  8091. protocol: 'accessing',
  8092. fn: function (){
  8093. var self=this;
  8094. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  8095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8096. return smalltalk.withContext(function($ctx1) {
  8097. //>>excludeEnd("ctx");
  8098. var $2,$1;
  8099. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  8100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8101. return smalltalk.withContext(function($ctx2) {
  8102. //>>excludeEnd("ctx");
  8103. return _st(acc).__comma(self._methodsInProtocol_(each));
  8104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8105. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  8106. //>>excludeEnd("ctx");
  8107. })))._sorted_((function(a,b){
  8108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8109. return smalltalk.withContext(function($ctx2) {
  8110. //>>excludeEnd("ctx");
  8111. $2=_st(a)._selector();
  8112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8113. $ctx2.sendIdx["selector"]=1;
  8114. //>>excludeEnd("ctx");
  8115. return _st($2).__lt_eq(_st(b)._selector());
  8116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8117. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  8118. //>>excludeEnd("ctx");
  8119. }));
  8120. return $1;
  8121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8122. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},globals.Behavior)});
  8123. //>>excludeEnd("ctx");
  8124. },
  8125. //>>excludeStart("ide", pragmas.excludeIdeData);
  8126. args: [],
  8127. 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 ]",
  8128. referencedClasses: ["OrderedCollection"],
  8129. //>>excludeEnd("ide");
  8130. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  8131. }),
  8132. globals.Behavior);
  8133. smalltalk.addMethod(
  8134. smalltalk.method({
  8135. selector: "ownProtocols",
  8136. protocol: 'accessing',
  8137. fn: function (){
  8138. var self=this;
  8139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8140. return smalltalk.withContext(function($ctx1) {
  8141. //>>excludeEnd("ctx");
  8142. var $1;
  8143. $1=_st(self._protocols())._reject_((function(each){
  8144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8145. return smalltalk.withContext(function($ctx2) {
  8146. //>>excludeEnd("ctx");
  8147. return _st(each)._match_("^\x5c*");
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8150. //>>excludeEnd("ctx");
  8151. }));
  8152. return $1;
  8153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8154. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},globals.Behavior)});
  8155. //>>excludeEnd("ctx");
  8156. },
  8157. //>>excludeStart("ide", pragmas.excludeIdeData);
  8158. args: [],
  8159. 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*' ]",
  8160. referencedClasses: [],
  8161. //>>excludeEnd("ide");
  8162. messageSends: ["reject:", "protocols", "match:"]
  8163. }),
  8164. globals.Behavior);
  8165. smalltalk.addMethod(
  8166. smalltalk.method({
  8167. selector: "protocols",
  8168. protocol: 'accessing',
  8169. fn: function (){
  8170. var self=this;
  8171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8172. return smalltalk.withContext(function($ctx1) {
  8173. //>>excludeEnd("ctx");
  8174. var $1;
  8175. $1=_st(_st(self._organization())._elements())._sorted();
  8176. return $1;
  8177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8178. }, function($ctx1) {$ctx1.fill(self,"protocols",{},globals.Behavior)});
  8179. //>>excludeEnd("ctx");
  8180. },
  8181. //>>excludeStart("ide", pragmas.excludeIdeData);
  8182. args: [],
  8183. source: "protocols\x0a\x09^ self organization elements sorted",
  8184. referencedClasses: [],
  8185. //>>excludeEnd("ide");
  8186. messageSends: ["sorted", "elements", "organization"]
  8187. }),
  8188. globals.Behavior);
  8189. smalltalk.addMethod(
  8190. smalltalk.method({
  8191. selector: "protocolsDo:",
  8192. protocol: 'enumerating',
  8193. fn: function (aBlock){
  8194. var self=this;
  8195. var methodsByProtocol;
  8196. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  8197. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. return smalltalk.withContext(function($ctx1) {
  8200. //>>excludeEnd("ctx");
  8201. methodsByProtocol=_st($HashedCollection())._new();
  8202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8203. $ctx1.sendIdx["new"]=1;
  8204. //>>excludeEnd("ctx");
  8205. _st(self._methodDictionary())._valuesDo_((function(m){
  8206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8207. return smalltalk.withContext(function($ctx2) {
  8208. //>>excludeEnd("ctx");
  8209. return _st(_st(methodsByProtocol)._at_ifAbsentPut_(_st(m)._protocol(),(function(){
  8210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8211. return smalltalk.withContext(function($ctx3) {
  8212. //>>excludeEnd("ctx");
  8213. return _st($Array())._new();
  8214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8216. //>>excludeEnd("ctx");
  8217. })))._add_(m);
  8218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8219. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  8220. //>>excludeEnd("ctx");
  8221. }));
  8222. _st(self._protocols())._do_((function(protocol){
  8223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8224. return smalltalk.withContext(function($ctx2) {
  8225. //>>excludeEnd("ctx");
  8226. return _st(aBlock)._value_value_(protocol,_st(methodsByProtocol)._at_(protocol));
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  8229. //>>excludeEnd("ctx");
  8230. }));
  8231. return self;
  8232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8233. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},globals.Behavior)});
  8234. //>>excludeEnd("ctx");
  8235. },
  8236. //>>excludeStart("ide", pragmas.excludeIdeData);
  8237. args: ["aBlock"],
  8238. 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) ]",
  8239. referencedClasses: ["HashedCollection", "Array"],
  8240. //>>excludeEnd("ide");
  8241. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  8242. }),
  8243. globals.Behavior);
  8244. smalltalk.addMethod(
  8245. smalltalk.method({
  8246. selector: "prototype",
  8247. protocol: 'accessing',
  8248. fn: function (){
  8249. var self=this;
  8250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8251. return smalltalk.withContext(function($ctx1) {
  8252. //>>excludeEnd("ctx");
  8253. return self.fn.prototype;
  8254. return self;
  8255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8256. }, function($ctx1) {$ctx1.fill(self,"prototype",{},globals.Behavior)});
  8257. //>>excludeEnd("ctx");
  8258. },
  8259. //>>excludeStart("ide", pragmas.excludeIdeData);
  8260. args: [],
  8261. source: "prototype\x0a\x09<return self.fn.prototype>",
  8262. referencedClasses: [],
  8263. //>>excludeEnd("ide");
  8264. messageSends: []
  8265. }),
  8266. globals.Behavior);
  8267. smalltalk.addMethod(
  8268. smalltalk.method({
  8269. selector: "recompile",
  8270. protocol: 'compiling',
  8271. fn: function (){
  8272. var self=this;
  8273. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  8274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8275. return smalltalk.withContext(function($ctx1) {
  8276. //>>excludeEnd("ctx");
  8277. var $1;
  8278. $1=_st(_st($Compiler())._new())._recompile_(self);
  8279. return $1;
  8280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8281. }, function($ctx1) {$ctx1.fill(self,"recompile",{},globals.Behavior)});
  8282. //>>excludeEnd("ctx");
  8283. },
  8284. //>>excludeStart("ide", pragmas.excludeIdeData);
  8285. args: [],
  8286. source: "recompile\x0a\x09^ Compiler new recompile: self",
  8287. referencedClasses: ["Compiler"],
  8288. //>>excludeEnd("ide");
  8289. messageSends: ["recompile:", "new"]
  8290. }),
  8291. globals.Behavior);
  8292. smalltalk.addMethod(
  8293. smalltalk.method({
  8294. selector: "removeCompiledMethod:",
  8295. protocol: 'compiling',
  8296. fn: function (aMethod){
  8297. var self=this;
  8298. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8299. function $MethodRemoved(){return globals.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  8300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8301. return smalltalk.withContext(function($ctx1) {
  8302. //>>excludeEnd("ctx");
  8303. var $1,$2;
  8304. self._basicRemoveCompiledMethod_(aMethod);
  8305. self._removeProtocolIfEmpty_(_st(aMethod)._protocol());
  8306. $1=_st($MethodRemoved())._new();
  8307. _st($1)._method_(aMethod);
  8308. $2=_st($1)._yourself();
  8309. _st(_st($SystemAnnouncer())._current())._announce_($2);
  8310. return self;
  8311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8312. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},globals.Behavior)});
  8313. //>>excludeEnd("ctx");
  8314. },
  8315. //>>excludeStart("ide", pragmas.excludeIdeData);
  8316. args: ["aMethod"],
  8317. 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)",
  8318. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  8319. //>>excludeEnd("ide");
  8320. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  8321. }),
  8322. globals.Behavior);
  8323. smalltalk.addMethod(
  8324. smalltalk.method({
  8325. selector: "removeProtocolIfEmpty:",
  8326. protocol: 'accessing',
  8327. fn: function (aString){
  8328. var self=this;
  8329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8330. return smalltalk.withContext(function($ctx1) {
  8331. //>>excludeEnd("ctx");
  8332. _st(self._methods())._detect_ifNone_((function(each){
  8333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8334. return smalltalk.withContext(function($ctx2) {
  8335. //>>excludeEnd("ctx");
  8336. return _st(_st(each)._protocol()).__eq(aString);
  8337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8339. //>>excludeEnd("ctx");
  8340. }),(function(){
  8341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8342. return smalltalk.withContext(function($ctx2) {
  8343. //>>excludeEnd("ctx");
  8344. return _st(self._organization())._removeElement_(aString);
  8345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8346. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8347. //>>excludeEnd("ctx");
  8348. }));
  8349. return self;
  8350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8351. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},globals.Behavior)});
  8352. //>>excludeEnd("ctx");
  8353. },
  8354. //>>excludeStart("ide", pragmas.excludeIdeData);
  8355. args: ["aString"],
  8356. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  8357. referencedClasses: [],
  8358. //>>excludeEnd("ide");
  8359. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  8360. }),
  8361. globals.Behavior);
  8362. smalltalk.addMethod(
  8363. smalltalk.method({
  8364. selector: "selectors",
  8365. protocol: 'accessing',
  8366. fn: function (){
  8367. var self=this;
  8368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8369. return smalltalk.withContext(function($ctx1) {
  8370. //>>excludeEnd("ctx");
  8371. var $1;
  8372. $1=_st(self._methodDictionary())._keys();
  8373. return $1;
  8374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8375. }, function($ctx1) {$ctx1.fill(self,"selectors",{},globals.Behavior)});
  8376. //>>excludeEnd("ctx");
  8377. },
  8378. //>>excludeStart("ide", pragmas.excludeIdeData);
  8379. args: [],
  8380. source: "selectors\x0a\x09^ self methodDictionary keys",
  8381. referencedClasses: [],
  8382. //>>excludeEnd("ide");
  8383. messageSends: ["keys", "methodDictionary"]
  8384. }),
  8385. globals.Behavior);
  8386. smalltalk.addMethod(
  8387. smalltalk.method({
  8388. selector: "subclasses",
  8389. protocol: 'accessing',
  8390. fn: function (){
  8391. var self=this;
  8392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8393. return smalltalk.withContext(function($ctx1) {
  8394. //>>excludeEnd("ctx");
  8395. self._subclassResponsibility();
  8396. return self;
  8397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8398. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Behavior)});
  8399. //>>excludeEnd("ctx");
  8400. },
  8401. //>>excludeStart("ide", pragmas.excludeIdeData);
  8402. args: [],
  8403. source: "subclasses\x0a\x09self subclassResponsibility",
  8404. referencedClasses: [],
  8405. //>>excludeEnd("ide");
  8406. messageSends: ["subclassResponsibility"]
  8407. }),
  8408. globals.Behavior);
  8409. smalltalk.addMethod(
  8410. smalltalk.method({
  8411. selector: "superclass",
  8412. protocol: 'accessing',
  8413. fn: function (){
  8414. var self=this;
  8415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8416. return smalltalk.withContext(function($ctx1) {
  8417. //>>excludeEnd("ctx");
  8418. return self.superclass || nil;
  8419. return self;
  8420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8421. }, function($ctx1) {$ctx1.fill(self,"superclass",{},globals.Behavior)});
  8422. //>>excludeEnd("ctx");
  8423. },
  8424. //>>excludeStart("ide", pragmas.excludeIdeData);
  8425. args: [],
  8426. source: "superclass\x0a\x09<return self.superclass || nil>",
  8427. referencedClasses: [],
  8428. //>>excludeEnd("ide");
  8429. messageSends: []
  8430. }),
  8431. globals.Behavior);
  8432. smalltalk.addMethod(
  8433. smalltalk.method({
  8434. selector: "theMetaClass",
  8435. protocol: 'accessing',
  8436. fn: function (){
  8437. var self=this;
  8438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8439. return smalltalk.withContext(function($ctx1) {
  8440. //>>excludeEnd("ctx");
  8441. var $1;
  8442. $1=self._class();
  8443. return $1;
  8444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8445. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},globals.Behavior)});
  8446. //>>excludeEnd("ctx");
  8447. },
  8448. //>>excludeStart("ide", pragmas.excludeIdeData);
  8449. args: [],
  8450. source: "theMetaClass\x0a\x09^ self class",
  8451. referencedClasses: [],
  8452. //>>excludeEnd("ide");
  8453. messageSends: ["class"]
  8454. }),
  8455. globals.Behavior);
  8456. smalltalk.addMethod(
  8457. smalltalk.method({
  8458. selector: "theNonMetaClass",
  8459. protocol: 'accessing',
  8460. fn: function (){
  8461. var self=this;
  8462. return self;
  8463. },
  8464. //>>excludeStart("ide", pragmas.excludeIdeData);
  8465. args: [],
  8466. source: "theNonMetaClass\x0a\x09^ self",
  8467. referencedClasses: [],
  8468. //>>excludeEnd("ide");
  8469. messageSends: []
  8470. }),
  8471. globals.Behavior);
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "withAllSubclasses",
  8475. protocol: 'accessing',
  8476. fn: function (){
  8477. var self=this;
  8478. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8480. return smalltalk.withContext(function($ctx1) {
  8481. //>>excludeEnd("ctx");
  8482. var $2,$3,$1;
  8483. $2=_st($Array())._with_(self);
  8484. _st($2)._addAll_(self._allSubclasses());
  8485. $3=_st($2)._yourself();
  8486. $1=$3;
  8487. return $1;
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},globals.Behavior)});
  8490. //>>excludeEnd("ctx");
  8491. },
  8492. //>>excludeStart("ide", pragmas.excludeIdeData);
  8493. args: [],
  8494. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  8495. referencedClasses: ["Array"],
  8496. //>>excludeEnd("ide");
  8497. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  8498. }),
  8499. globals.Behavior);
  8500. smalltalk.addClass('Class', globals.Behavior, [], 'Kernel-Classes');
  8501. //>>excludeStart("ide", pragmas.excludeIdeData);
  8502. 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.";
  8503. //>>excludeEnd("ide");
  8504. smalltalk.addMethod(
  8505. smalltalk.method({
  8506. selector: "asJavascript",
  8507. protocol: 'converting',
  8508. fn: function (){
  8509. var self=this;
  8510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8511. return smalltalk.withContext(function($ctx1) {
  8512. //>>excludeEnd("ctx");
  8513. var $1;
  8514. $1="globals.".__comma(self._name());
  8515. return $1;
  8516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8517. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Class)});
  8518. //>>excludeEnd("ctx");
  8519. },
  8520. //>>excludeStart("ide", pragmas.excludeIdeData);
  8521. args: [],
  8522. source: "asJavascript\x0a\x09^ 'globals.', self name",
  8523. referencedClasses: [],
  8524. //>>excludeEnd("ide");
  8525. messageSends: [",", "name"]
  8526. }),
  8527. globals.Class);
  8528. smalltalk.addMethod(
  8529. smalltalk.method({
  8530. selector: "browse",
  8531. protocol: 'browsing',
  8532. fn: function (){
  8533. var self=this;
  8534. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  8535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8536. return smalltalk.withContext(function($ctx1) {
  8537. //>>excludeEnd("ctx");
  8538. _st($Finder())._findClass_(self);
  8539. return self;
  8540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8541. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.Class)});
  8542. //>>excludeEnd("ctx");
  8543. },
  8544. //>>excludeStart("ide", pragmas.excludeIdeData);
  8545. args: [],
  8546. source: "browse\x0a\x09Finder findClass: self",
  8547. referencedClasses: ["Finder"],
  8548. //>>excludeEnd("ide");
  8549. messageSends: ["findClass:"]
  8550. }),
  8551. globals.Class);
  8552. smalltalk.addMethod(
  8553. smalltalk.method({
  8554. selector: "category",
  8555. protocol: 'accessing',
  8556. fn: function (){
  8557. var self=this;
  8558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8559. return smalltalk.withContext(function($ctx1) {
  8560. //>>excludeEnd("ctx");
  8561. var $2,$1,$receiver;
  8562. $2=self._package();
  8563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8564. $ctx1.sendIdx["package"]=1;
  8565. //>>excludeEnd("ctx");
  8566. if(($receiver = $2) == null || $receiver.isNil){
  8567. $1="Unclassified";
  8568. } else {
  8569. $1=_st(self._package())._name();
  8570. };
  8571. return $1;
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.Class)});
  8574. //>>excludeEnd("ctx");
  8575. },
  8576. //>>excludeStart("ide", pragmas.excludeIdeData);
  8577. args: [],
  8578. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  8579. referencedClasses: [],
  8580. //>>excludeEnd("ide");
  8581. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  8582. }),
  8583. globals.Class);
  8584. smalltalk.addMethod(
  8585. smalltalk.method({
  8586. selector: "definition",
  8587. protocol: 'accessing',
  8588. fn: function (){
  8589. var self=this;
  8590. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8592. return smalltalk.withContext(function($ctx1) {
  8593. //>>excludeEnd("ctx");
  8594. var $3,$4,$2,$5,$6,$7,$1;
  8595. $1=_st($String())._streamContents_((function(stream){
  8596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8597. return smalltalk.withContext(function($ctx2) {
  8598. //>>excludeEnd("ctx");
  8599. _st(stream)._nextPutAll_(_st(self._superclass())._asString());
  8600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8601. $ctx2.sendIdx["nextPutAll:"]=1;
  8602. //>>excludeEnd("ctx");
  8603. _st(stream)._nextPutAll_(" subclass: #");
  8604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8605. $ctx2.sendIdx["nextPutAll:"]=2;
  8606. //>>excludeEnd("ctx");
  8607. _st(stream)._nextPutAll_(self._name());
  8608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8609. $ctx2.sendIdx["nextPutAll:"]=3;
  8610. //>>excludeEnd("ctx");
  8611. $3=_st($String())._lf();
  8612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8613. $ctx2.sendIdx["lf"]=1;
  8614. //>>excludeEnd("ctx");
  8615. $4=_st($String())._tab();
  8616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8617. $ctx2.sendIdx["tab"]=1;
  8618. //>>excludeEnd("ctx");
  8619. $2=_st($3).__comma($4);
  8620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8621. $ctx2.sendIdx[","]=1;
  8622. //>>excludeEnd("ctx");
  8623. _st(stream)._nextPutAll_($2);
  8624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8625. $ctx2.sendIdx["nextPutAll:"]=4;
  8626. //>>excludeEnd("ctx");
  8627. $5=_st(stream)._nextPutAll_("instanceVariableNames: '");
  8628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8629. $ctx2.sendIdx["nextPutAll:"]=5;
  8630. //>>excludeEnd("ctx");
  8631. $5;
  8632. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  8633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8634. return smalltalk.withContext(function($ctx3) {
  8635. //>>excludeEnd("ctx");
  8636. return _st(stream)._nextPutAll_(each);
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. $ctx3.sendIdx["nextPutAll:"]=6;
  8639. //>>excludeEnd("ctx");
  8640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8641. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  8642. //>>excludeEnd("ctx");
  8643. }),(function(){
  8644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8645. return smalltalk.withContext(function($ctx3) {
  8646. //>>excludeEnd("ctx");
  8647. return _st(stream)._nextPutAll_(" ");
  8648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8649. $ctx3.sendIdx["nextPutAll:"]=7;
  8650. //>>excludeEnd("ctx");
  8651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8652. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  8653. //>>excludeEnd("ctx");
  8654. }));
  8655. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. $ctx2.sendIdx[","]=2;
  8658. //>>excludeEnd("ctx");
  8659. _st(stream)._nextPutAll_($6);
  8660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8661. $ctx2.sendIdx["nextPutAll:"]=8;
  8662. //>>excludeEnd("ctx");
  8663. _st(stream)._nextPutAll_("package: '");
  8664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8665. $ctx2.sendIdx["nextPutAll:"]=9;
  8666. //>>excludeEnd("ctx");
  8667. _st(stream)._nextPutAll_(self._category());
  8668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8669. $ctx2.sendIdx["nextPutAll:"]=10;
  8670. //>>excludeEnd("ctx");
  8671. $7=_st(stream)._nextPutAll_("'");
  8672. return $7;
  8673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8674. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  8675. //>>excludeEnd("ctx");
  8676. }));
  8677. return $1;
  8678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8679. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Class)});
  8680. //>>excludeEnd("ctx");
  8681. },
  8682. //>>excludeStart("ide", pragmas.excludeIdeData);
  8683. args: [],
  8684. 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: '''' ]",
  8685. referencedClasses: ["String"],
  8686. //>>excludeEnd("ide");
  8687. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  8688. }),
  8689. globals.Class);
  8690. smalltalk.addMethod(
  8691. smalltalk.method({
  8692. selector: "heliosClass",
  8693. protocol: 'accessing',
  8694. fn: function (){
  8695. var self=this;
  8696. return "class";
  8697. },
  8698. //>>excludeStart("ide", pragmas.excludeIdeData);
  8699. args: [],
  8700. 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'",
  8701. referencedClasses: [],
  8702. //>>excludeEnd("ide");
  8703. messageSends: []
  8704. }),
  8705. globals.Class);
  8706. smalltalk.addMethod(
  8707. smalltalk.method({
  8708. selector: "isClass",
  8709. protocol: 'testing',
  8710. fn: function (){
  8711. var self=this;
  8712. return true;
  8713. },
  8714. //>>excludeStart("ide", pragmas.excludeIdeData);
  8715. args: [],
  8716. source: "isClass\x0a\x09^ true",
  8717. referencedClasses: [],
  8718. //>>excludeEnd("ide");
  8719. messageSends: []
  8720. }),
  8721. globals.Class);
  8722. smalltalk.addMethod(
  8723. smalltalk.method({
  8724. selector: "package",
  8725. protocol: 'accessing',
  8726. fn: function (){
  8727. var self=this;
  8728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8729. return smalltalk.withContext(function($ctx1) {
  8730. //>>excludeEnd("ctx");
  8731. var $1;
  8732. $1=self._basicAt_("pkg");
  8733. return $1;
  8734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8735. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Class)});
  8736. //>>excludeEnd("ctx");
  8737. },
  8738. //>>excludeStart("ide", pragmas.excludeIdeData);
  8739. args: [],
  8740. source: "package\x0a\x09^ self basicAt: 'pkg'",
  8741. referencedClasses: [],
  8742. //>>excludeEnd("ide");
  8743. messageSends: ["basicAt:"]
  8744. }),
  8745. globals.Class);
  8746. smalltalk.addMethod(
  8747. smalltalk.method({
  8748. selector: "package:",
  8749. protocol: 'accessing',
  8750. fn: function (aPackage){
  8751. var self=this;
  8752. var oldPackage;
  8753. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  8754. function $ClassMoved(){return globals.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  8755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8756. return smalltalk.withContext(function($ctx1) {
  8757. //>>excludeEnd("ctx");
  8758. var $2,$1,$3,$4,$5;
  8759. $2=self._package();
  8760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8761. $ctx1.sendIdx["package"]=1;
  8762. //>>excludeEnd("ctx");
  8763. $1=_st($2).__eq(aPackage);
  8764. if(smalltalk.assert($1)){
  8765. return self;
  8766. };
  8767. oldPackage=self._package();
  8768. self._basicAt_put_("pkg",aPackage);
  8769. $3=_st(oldPackage)._organization();
  8770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8771. $ctx1.sendIdx["organization"]=1;
  8772. //>>excludeEnd("ctx");
  8773. _st($3)._removeElement_(self);
  8774. _st(_st(aPackage)._organization())._addElement_(self);
  8775. $4=_st($ClassMoved())._new();
  8776. _st($4)._theClass_(self);
  8777. _st($4)._oldPackage_(oldPackage);
  8778. $5=_st($4)._yourself();
  8779. _st(_st($SystemAnnouncer())._current())._announce_($5);
  8780. return self;
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},globals.Class)});
  8783. //>>excludeEnd("ctx");
  8784. },
  8785. //>>excludeStart("ide", pragmas.excludeIdeData);
  8786. args: ["aPackage"],
  8787. 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)",
  8788. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  8789. //>>excludeEnd("ide");
  8790. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  8791. }),
  8792. globals.Class);
  8793. smalltalk.addMethod(
  8794. smalltalk.method({
  8795. selector: "printOn:",
  8796. protocol: 'printing',
  8797. fn: function (aStream){
  8798. var self=this;
  8799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8800. return smalltalk.withContext(function($ctx1) {
  8801. //>>excludeEnd("ctx");
  8802. _st(aStream)._nextPutAll_(self._name());
  8803. return self;
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Class)});
  8806. //>>excludeEnd("ctx");
  8807. },
  8808. //>>excludeStart("ide", pragmas.excludeIdeData);
  8809. args: ["aStream"],
  8810. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  8811. referencedClasses: [],
  8812. //>>excludeEnd("ide");
  8813. messageSends: ["nextPutAll:", "name"]
  8814. }),
  8815. globals.Class);
  8816. smalltalk.addMethod(
  8817. smalltalk.method({
  8818. selector: "rename:",
  8819. protocol: 'accessing',
  8820. fn: function (aString){
  8821. var self=this;
  8822. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8824. return smalltalk.withContext(function($ctx1) {
  8825. //>>excludeEnd("ctx");
  8826. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  8827. return self;
  8828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8829. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},globals.Class)});
  8830. //>>excludeEnd("ctx");
  8831. },
  8832. //>>excludeStart("ide", pragmas.excludeIdeData);
  8833. args: ["aString"],
  8834. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  8835. referencedClasses: ["ClassBuilder"],
  8836. //>>excludeEnd("ide");
  8837. messageSends: ["renameClass:to:", "new"]
  8838. }),
  8839. globals.Class);
  8840. smalltalk.addMethod(
  8841. smalltalk.method({
  8842. selector: "subclass:instanceVariableNames:",
  8843. protocol: 'class creation',
  8844. fn: function (aString,anotherString){
  8845. var self=this;
  8846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8847. return smalltalk.withContext(function($ctx1) {
  8848. //>>excludeEnd("ctx");
  8849. var $1;
  8850. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  8851. return $1;
  8852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8853. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},globals.Class)});
  8854. //>>excludeEnd("ctx");
  8855. },
  8856. //>>excludeStart("ide", pragmas.excludeIdeData);
  8857. args: ["aString", "anotherString"],
  8858. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  8859. referencedClasses: [],
  8860. //>>excludeEnd("ide");
  8861. messageSends: ["subclass:instanceVariableNames:package:"]
  8862. }),
  8863. globals.Class);
  8864. smalltalk.addMethod(
  8865. smalltalk.method({
  8866. selector: "subclass:instanceVariableNames:category:",
  8867. protocol: 'class creation',
  8868. fn: function (aString,aString2,aString3){
  8869. var self=this;
  8870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8871. return smalltalk.withContext(function($ctx1) {
  8872. //>>excludeEnd("ctx");
  8873. var $1;
  8874. self._deprecatedAPI();
  8875. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  8876. return $1;
  8877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8878. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)});
  8879. //>>excludeEnd("ctx");
  8880. },
  8881. //>>excludeStart("ide", pragmas.excludeIdeData);
  8882. args: ["aString", "aString2", "aString3"],
  8883. 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",
  8884. referencedClasses: [],
  8885. //>>excludeEnd("ide");
  8886. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"]
  8887. }),
  8888. globals.Class);
  8889. smalltalk.addMethod(
  8890. smalltalk.method({
  8891. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  8892. protocol: 'class creation',
  8893. fn: function (aString,aString2,classVars,pools,aString3){
  8894. var self=this;
  8895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8896. return smalltalk.withContext(function($ctx1) {
  8897. //>>excludeEnd("ctx");
  8898. var $1;
  8899. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  8900. return $1;
  8901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8902. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},globals.Class)});
  8903. //>>excludeEnd("ctx");
  8904. },
  8905. //>>excludeStart("ide", pragmas.excludeIdeData);
  8906. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  8907. 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",
  8908. referencedClasses: [],
  8909. //>>excludeEnd("ide");
  8910. messageSends: ["subclass:instanceVariableNames:package:"]
  8911. }),
  8912. globals.Class);
  8913. smalltalk.addMethod(
  8914. smalltalk.method({
  8915. selector: "subclass:instanceVariableNames:package:",
  8916. protocol: 'class creation',
  8917. fn: function (aString,aString2,aString3){
  8918. var self=this;
  8919. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  8920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8921. return smalltalk.withContext(function($ctx1) {
  8922. //>>excludeEnd("ctx");
  8923. var $1;
  8924. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  8925. return $1;
  8926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8927. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},globals.Class)});
  8928. //>>excludeEnd("ctx");
  8929. },
  8930. //>>excludeStart("ide", pragmas.excludeIdeData);
  8931. args: ["aString", "aString2", "aString3"],
  8932. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  8933. referencedClasses: ["ClassBuilder"],
  8934. //>>excludeEnd("ide");
  8935. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  8936. }),
  8937. globals.Class);
  8938. smalltalk.addMethod(
  8939. smalltalk.method({
  8940. selector: "subclasses",
  8941. protocol: 'accessing',
  8942. fn: function (){
  8943. var self=this;
  8944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8945. return smalltalk.withContext(function($ctx1) {
  8946. //>>excludeEnd("ctx");
  8947. return self.subclasses._copy();
  8948. return self;
  8949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8950. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Class)});
  8951. //>>excludeEnd("ctx");
  8952. },
  8953. //>>excludeStart("ide", pragmas.excludeIdeData);
  8954. args: [],
  8955. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  8956. referencedClasses: [],
  8957. //>>excludeEnd("ide");
  8958. messageSends: []
  8959. }),
  8960. globals.Class);
  8961. smalltalk.addClass('Metaclass', globals.Behavior, [], 'Kernel-Classes');
  8962. //>>excludeStart("ide", pragmas.excludeIdeData);
  8963. 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.";
  8964. //>>excludeEnd("ide");
  8965. smalltalk.addMethod(
  8966. smalltalk.method({
  8967. selector: "asJavascript",
  8968. protocol: 'converting',
  8969. fn: function (){
  8970. var self=this;
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. return smalltalk.withContext(function($ctx1) {
  8973. //>>excludeEnd("ctx");
  8974. var $1;
  8975. $1=_st("globals.".__comma(_st(self._instanceClass())._name())).__comma(".klass");
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. $ctx1.sendIdx[","]=1;
  8978. //>>excludeEnd("ctx");
  8979. return $1;
  8980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8981. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Metaclass)});
  8982. //>>excludeEnd("ctx");
  8983. },
  8984. //>>excludeStart("ide", pragmas.excludeIdeData);
  8985. args: [],
  8986. source: "asJavascript\x0a\x09^ 'globals.', self instanceClass name, '.klass'",
  8987. referencedClasses: [],
  8988. //>>excludeEnd("ide");
  8989. messageSends: [",", "name", "instanceClass"]
  8990. }),
  8991. globals.Metaclass);
  8992. smalltalk.addMethod(
  8993. smalltalk.method({
  8994. selector: "definition",
  8995. protocol: 'accessing',
  8996. fn: function (){
  8997. var self=this;
  8998. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9000. return smalltalk.withContext(function($ctx1) {
  9001. //>>excludeEnd("ctx");
  9002. var $2,$1;
  9003. $1=_st($String())._streamContents_((function(stream){
  9004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9005. return smalltalk.withContext(function($ctx2) {
  9006. //>>excludeEnd("ctx");
  9007. _st(stream)._nextPutAll_(self._asString());
  9008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9009. $ctx2.sendIdx["nextPutAll:"]=1;
  9010. //>>excludeEnd("ctx");
  9011. $2=_st(stream)._nextPutAll_(" instanceVariableNames: '");
  9012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9013. $ctx2.sendIdx["nextPutAll:"]=2;
  9014. //>>excludeEnd("ctx");
  9015. $2;
  9016. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  9017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9018. return smalltalk.withContext(function($ctx3) {
  9019. //>>excludeEnd("ctx");
  9020. return _st(stream)._nextPutAll_(each);
  9021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9022. $ctx3.sendIdx["nextPutAll:"]=3;
  9023. //>>excludeEnd("ctx");
  9024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9025. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  9026. //>>excludeEnd("ctx");
  9027. }),(function(){
  9028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9029. return smalltalk.withContext(function($ctx3) {
  9030. //>>excludeEnd("ctx");
  9031. return _st(stream)._nextPutAll_(" ");
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. $ctx3.sendIdx["nextPutAll:"]=4;
  9034. //>>excludeEnd("ctx");
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  9037. //>>excludeEnd("ctx");
  9038. }));
  9039. return _st(stream)._nextPutAll_("'");
  9040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9041. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  9042. //>>excludeEnd("ctx");
  9043. }));
  9044. return $1;
  9045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9046. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Metaclass)});
  9047. //>>excludeEnd("ctx");
  9048. },
  9049. //>>excludeStart("ide", pragmas.excludeIdeData);
  9050. args: [],
  9051. 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: '''' ]",
  9052. referencedClasses: ["String"],
  9053. //>>excludeEnd("ide");
  9054. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  9055. }),
  9056. globals.Metaclass);
  9057. smalltalk.addMethod(
  9058. smalltalk.method({
  9059. selector: "instanceClass",
  9060. protocol: 'accessing',
  9061. fn: function (){
  9062. var self=this;
  9063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9064. return smalltalk.withContext(function($ctx1) {
  9065. //>>excludeEnd("ctx");
  9066. return self.instanceClass;
  9067. return self;
  9068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9069. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},globals.Metaclass)});
  9070. //>>excludeEnd("ctx");
  9071. },
  9072. //>>excludeStart("ide", pragmas.excludeIdeData);
  9073. args: [],
  9074. source: "instanceClass\x0a\x09<return self.instanceClass>",
  9075. referencedClasses: [],
  9076. //>>excludeEnd("ide");
  9077. messageSends: []
  9078. }),
  9079. globals.Metaclass);
  9080. smalltalk.addMethod(
  9081. smalltalk.method({
  9082. selector: "instanceVariableNames:",
  9083. protocol: 'accessing',
  9084. fn: function (aCollection){
  9085. var self=this;
  9086. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  9087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9088. return smalltalk.withContext(function($ctx1) {
  9089. //>>excludeEnd("ctx");
  9090. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  9091. return self;
  9092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9093. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},globals.Metaclass)});
  9094. //>>excludeEnd("ctx");
  9095. },
  9096. //>>excludeStart("ide", pragmas.excludeIdeData);
  9097. args: ["aCollection"],
  9098. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  9099. referencedClasses: ["ClassBuilder"],
  9100. //>>excludeEnd("ide");
  9101. messageSends: ["class:instanceVariableNames:", "new"]
  9102. }),
  9103. globals.Metaclass);
  9104. smalltalk.addMethod(
  9105. smalltalk.method({
  9106. selector: "isMetaclass",
  9107. protocol: 'testing',
  9108. fn: function (){
  9109. var self=this;
  9110. return true;
  9111. },
  9112. //>>excludeStart("ide", pragmas.excludeIdeData);
  9113. args: [],
  9114. source: "isMetaclass\x0a\x09^ true",
  9115. referencedClasses: [],
  9116. //>>excludeEnd("ide");
  9117. messageSends: []
  9118. }),
  9119. globals.Metaclass);
  9120. smalltalk.addMethod(
  9121. smalltalk.method({
  9122. selector: "package",
  9123. protocol: 'accessing',
  9124. fn: function (){
  9125. var self=this;
  9126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9127. return smalltalk.withContext(function($ctx1) {
  9128. //>>excludeEnd("ctx");
  9129. var $1;
  9130. $1=_st(self._instanceClass())._package();
  9131. return $1;
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.Metaclass)});
  9134. //>>excludeEnd("ctx");
  9135. },
  9136. //>>excludeStart("ide", pragmas.excludeIdeData);
  9137. args: [],
  9138. source: "package\x0a\x09^ self instanceClass package",
  9139. referencedClasses: [],
  9140. //>>excludeEnd("ide");
  9141. messageSends: ["package", "instanceClass"]
  9142. }),
  9143. globals.Metaclass);
  9144. smalltalk.addMethod(
  9145. smalltalk.method({
  9146. selector: "printOn:",
  9147. protocol: 'printing',
  9148. fn: function (aStream){
  9149. var self=this;
  9150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9151. return smalltalk.withContext(function($ctx1) {
  9152. //>>excludeEnd("ctx");
  9153. var $1;
  9154. _st(aStream)._nextPutAll_(_st(self._instanceClass())._name());
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. $ctx1.sendIdx["nextPutAll:"]=1;
  9157. //>>excludeEnd("ctx");
  9158. $1=_st(aStream)._nextPutAll_(" class");
  9159. return self;
  9160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9161. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Metaclass)});
  9162. //>>excludeEnd("ctx");
  9163. },
  9164. //>>excludeStart("ide", pragmas.excludeIdeData);
  9165. args: ["aStream"],
  9166. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  9167. referencedClasses: [],
  9168. //>>excludeEnd("ide");
  9169. messageSends: ["nextPutAll:", "name", "instanceClass"]
  9170. }),
  9171. globals.Metaclass);
  9172. smalltalk.addMethod(
  9173. smalltalk.method({
  9174. selector: "subclasses",
  9175. protocol: 'accessing',
  9176. fn: function (){
  9177. var self=this;
  9178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9179. return smalltalk.withContext(function($ctx1) {
  9180. //>>excludeEnd("ctx");
  9181. var $1;
  9182. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. return smalltalk.withContext(function($ctx2) {
  9185. //>>excludeEnd("ctx");
  9186. return _st(_st(each)._isMetaclass())._not();
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9189. //>>excludeEnd("ctx");
  9190. })))._collect_((function(each){
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. return smalltalk.withContext(function($ctx2) {
  9193. //>>excludeEnd("ctx");
  9194. return _st(each)._theMetaClass();
  9195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9196. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9197. //>>excludeEnd("ctx");
  9198. }));
  9199. return $1;
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},globals.Metaclass)});
  9202. //>>excludeEnd("ctx");
  9203. },
  9204. //>>excludeStart("ide", pragmas.excludeIdeData);
  9205. args: [],
  9206. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  9207. referencedClasses: [],
  9208. //>>excludeEnd("ide");
  9209. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  9210. }),
  9211. globals.Metaclass);
  9212. smalltalk.addMethod(
  9213. smalltalk.method({
  9214. selector: "theMetaClass",
  9215. protocol: 'accessing',
  9216. fn: function (){
  9217. var self=this;
  9218. return self;
  9219. },
  9220. //>>excludeStart("ide", pragmas.excludeIdeData);
  9221. args: [],
  9222. source: "theMetaClass\x0a\x09^ self",
  9223. referencedClasses: [],
  9224. //>>excludeEnd("ide");
  9225. messageSends: []
  9226. }),
  9227. globals.Metaclass);
  9228. smalltalk.addMethod(
  9229. smalltalk.method({
  9230. selector: "theNonMetaClass",
  9231. protocol: 'accessing',
  9232. fn: function (){
  9233. var self=this;
  9234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9235. return smalltalk.withContext(function($ctx1) {
  9236. //>>excludeEnd("ctx");
  9237. var $1;
  9238. $1=self._instanceClass();
  9239. return $1;
  9240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9241. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},globals.Metaclass)});
  9242. //>>excludeEnd("ctx");
  9243. },
  9244. //>>excludeStart("ide", pragmas.excludeIdeData);
  9245. args: [],
  9246. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  9247. referencedClasses: [],
  9248. //>>excludeEnd("ide");
  9249. messageSends: ["instanceClass"]
  9250. }),
  9251. globals.Metaclass);
  9252. smalltalk.addClass('ClassBuilder', globals.Object, [], 'Kernel-Classes');
  9253. //>>excludeStart("ide", pragmas.excludeIdeData);
  9254. 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:`.";
  9255. //>>excludeEnd("ide");
  9256. smalltalk.addMethod(
  9257. smalltalk.method({
  9258. selector: "addSubclassOf:named:instanceVariableNames:package:",
  9259. protocol: 'class definition',
  9260. fn: function (aClass,className,aCollection,packageName){
  9261. var self=this;
  9262. var theClass,thePackage;
  9263. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9264. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  9265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9266. return smalltalk.withContext(function($ctx1) {
  9267. //>>excludeEnd("ctx");
  9268. var $1,$2,$3,$4,$receiver;
  9269. theClass=_st(_st($Smalltalk())._globals())._at_(className);
  9270. thePackage=_st($Package())._named_(packageName);
  9271. $1=theClass;
  9272. if(($receiver = $1) == null || $receiver.isNil){
  9273. $1;
  9274. } else {
  9275. _st(theClass)._package_(thePackage);
  9276. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  9277. if(! smalltalk.assert($2)){
  9278. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  9279. return $3;
  9280. };
  9281. };
  9282. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  9283. return $4;
  9284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9285. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},globals.ClassBuilder)});
  9286. //>>excludeEnd("ctx");
  9287. },
  9288. //>>excludeStart("ide", pragmas.excludeIdeData);
  9289. args: ["aClass", "className", "aCollection", "packageName"],
  9290. 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",
  9291. referencedClasses: ["Smalltalk", "Package"],
  9292. //>>excludeEnd("ide");
  9293. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  9294. }),
  9295. globals.ClassBuilder);
  9296. smalltalk.addMethod(
  9297. smalltalk.method({
  9298. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  9299. protocol: 'private',
  9300. fn: function (aClass,aString,aCollection,packageName){
  9301. var self=this;
  9302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9303. return smalltalk.withContext(function($ctx1) {
  9304. //>>excludeEnd("ctx");
  9305. smalltalk.addClass(aString, aClass, aCollection, packageName);
  9306. return globals[aString]
  9307. ;
  9308. return self;
  9309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9310. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},globals.ClassBuilder)});
  9311. //>>excludeEnd("ctx");
  9312. },
  9313. //>>excludeStart("ide", pragmas.excludeIdeData);
  9314. args: ["aClass", "aString", "aCollection", "packageName"],
  9315. 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>",
  9316. referencedClasses: [],
  9317. //>>excludeEnd("ide");
  9318. messageSends: []
  9319. }),
  9320. globals.ClassBuilder);
  9321. smalltalk.addMethod(
  9322. smalltalk.method({
  9323. selector: "basicClass:instanceVariableNames:",
  9324. protocol: 'private',
  9325. fn: function (aClass,aString){
  9326. var self=this;
  9327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9328. return smalltalk.withContext(function($ctx1) {
  9329. //>>excludeEnd("ctx");
  9330. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  9331. return self;
  9332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9333. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9334. //>>excludeEnd("ctx");
  9335. },
  9336. //>>excludeStart("ide", pragmas.excludeIdeData);
  9337. args: ["aClass", "aString"],
  9338. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  9339. referencedClasses: [],
  9340. //>>excludeEnd("ide");
  9341. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  9342. }),
  9343. globals.ClassBuilder);
  9344. smalltalk.addMethod(
  9345. smalltalk.method({
  9346. selector: "basicClass:instanceVariables:",
  9347. protocol: 'private',
  9348. fn: function (aClass,aCollection){
  9349. var self=this;
  9350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9351. return smalltalk.withContext(function($ctx1) {
  9352. //>>excludeEnd("ctx");
  9353. var $1;
  9354. $1=_st(aClass)._isMetaclass();
  9355. if(! smalltalk.assert($1)){
  9356. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  9357. };
  9358. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  9359. return self;
  9360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9361. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},globals.ClassBuilder)});
  9362. //>>excludeEnd("ctx");
  9363. },
  9364. //>>excludeStart("ide", pragmas.excludeIdeData);
  9365. args: ["aClass", "aCollection"],
  9366. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  9367. referencedClasses: [],
  9368. //>>excludeEnd("ide");
  9369. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  9370. }),
  9371. globals.ClassBuilder);
  9372. smalltalk.addMethod(
  9373. smalltalk.method({
  9374. selector: "basicRemoveClass:",
  9375. protocol: 'private',
  9376. fn: function (aClass){
  9377. var self=this;
  9378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9379. return smalltalk.withContext(function($ctx1) {
  9380. //>>excludeEnd("ctx");
  9381. smalltalk.removeClass(aClass);
  9382. return self;
  9383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9384. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},globals.ClassBuilder)});
  9385. //>>excludeEnd("ctx");
  9386. },
  9387. //>>excludeStart("ide", pragmas.excludeIdeData);
  9388. args: ["aClass"],
  9389. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  9390. referencedClasses: [],
  9391. //>>excludeEnd("ide");
  9392. messageSends: []
  9393. }),
  9394. globals.ClassBuilder);
  9395. smalltalk.addMethod(
  9396. smalltalk.method({
  9397. selector: "basicRenameClass:to:",
  9398. protocol: 'private',
  9399. fn: function (aClass,aString){
  9400. var self=this;
  9401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9402. return smalltalk.withContext(function($ctx1) {
  9403. //>>excludeEnd("ctx");
  9404. globals[aString] = aClass;
  9405. delete globals[aClass.className];
  9406. aClass.className = aString;
  9407. ;
  9408. return self;
  9409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9410. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9411. //>>excludeEnd("ctx");
  9412. },
  9413. //>>excludeStart("ide", pragmas.excludeIdeData);
  9414. args: ["aClass", "aString"],
  9415. 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>",
  9416. referencedClasses: [],
  9417. //>>excludeEnd("ide");
  9418. messageSends: []
  9419. }),
  9420. globals.ClassBuilder);
  9421. smalltalk.addMethod(
  9422. smalltalk.method({
  9423. selector: "basicSwapClassNames:with:",
  9424. protocol: 'private',
  9425. fn: function (aClass,anotherClass){
  9426. var self=this;
  9427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9428. return smalltalk.withContext(function($ctx1) {
  9429. //>>excludeEnd("ctx");
  9430. var tmp = aClass.className;
  9431. aClass.className = anotherClass.className;
  9432. anotherClass.className = tmp;
  9433. ;
  9434. return self;
  9435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9436. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9437. //>>excludeEnd("ctx");
  9438. },
  9439. //>>excludeStart("ide", pragmas.excludeIdeData);
  9440. args: ["aClass", "anotherClass"],
  9441. 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>",
  9442. referencedClasses: [],
  9443. //>>excludeEnd("ide");
  9444. messageSends: []
  9445. }),
  9446. globals.ClassBuilder);
  9447. smalltalk.addMethod(
  9448. smalltalk.method({
  9449. selector: "class:instanceVariableNames:",
  9450. protocol: 'class definition',
  9451. fn: function (aClass,ivarNames){
  9452. var self=this;
  9453. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9454. function $ClassDefinitionChanged(){return globals.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  9455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9456. return smalltalk.withContext(function($ctx1) {
  9457. //>>excludeEnd("ctx");
  9458. var $1,$2;
  9459. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  9460. self._setupClass_(aClass);
  9461. $1=_st($ClassDefinitionChanged())._new();
  9462. _st($1)._theClass_(aClass);
  9463. $2=_st($1)._yourself();
  9464. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9465. return self;
  9466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9467. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},globals.ClassBuilder)});
  9468. //>>excludeEnd("ctx");
  9469. },
  9470. //>>excludeStart("ide", pragmas.excludeIdeData);
  9471. args: ["aClass", "ivarNames"],
  9472. 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)",
  9473. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  9474. //>>excludeEnd("ide");
  9475. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  9476. }),
  9477. globals.ClassBuilder);
  9478. smalltalk.addMethod(
  9479. smalltalk.method({
  9480. selector: "copyClass:named:",
  9481. protocol: 'copying',
  9482. fn: function (aClass,className){
  9483. var self=this;
  9484. var newClass;
  9485. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9486. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. return smalltalk.withContext(function($ctx1) {
  9489. //>>excludeEnd("ctx");
  9490. var $1,$2,$3;
  9491. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  9492. self._copyClass_to_(aClass,newClass);
  9493. $1=_st($ClassAdded())._new();
  9494. _st($1)._theClass_(newClass);
  9495. $2=_st($1)._yourself();
  9496. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9497. $3=newClass;
  9498. return $3;
  9499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9500. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},globals.ClassBuilder)});
  9501. //>>excludeEnd("ctx");
  9502. },
  9503. //>>excludeStart("ide", pragmas.excludeIdeData);
  9504. args: ["aClass", "className"],
  9505. 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",
  9506. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  9507. //>>excludeEnd("ide");
  9508. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  9509. }),
  9510. globals.ClassBuilder);
  9511. smalltalk.addMethod(
  9512. smalltalk.method({
  9513. selector: "copyClass:to:",
  9514. protocol: 'copying',
  9515. fn: function (aClass,anotherClass){
  9516. var self=this;
  9517. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. return smalltalk.withContext(function($ctx1) {
  9520. //>>excludeEnd("ctx");
  9521. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  9522. _st(anotherClass)._comment_(_st(aClass)._comment());
  9523. $1=_st(aClass)._methodDictionary();
  9524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9525. $ctx1.sendIdx["methodDictionary"]=1;
  9526. //>>excludeEnd("ctx");
  9527. _st($1)._valuesDo_((function(each){
  9528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9529. return smalltalk.withContext(function($ctx2) {
  9530. //>>excludeEnd("ctx");
  9531. $2=_st($Compiler())._new();
  9532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9533. $ctx2.sendIdx["new"]=1;
  9534. //>>excludeEnd("ctx");
  9535. $3=_st(each)._source();
  9536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9537. $ctx2.sendIdx["source"]=1;
  9538. //>>excludeEnd("ctx");
  9539. $4=_st(each)._protocol();
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. $ctx2.sendIdx["protocol"]=1;
  9542. //>>excludeEnd("ctx");
  9543. return _st($2)._install_forClass_protocol_($3,anotherClass,$4);
  9544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9545. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  9546. //>>excludeEnd("ctx");
  9547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9548. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9549. //>>excludeEnd("ctx");
  9550. }));
  9551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9552. $ctx1.sendIdx["valuesDo:"]=1;
  9553. //>>excludeEnd("ctx");
  9554. $5=_st(anotherClass)._class();
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. $ctx1.sendIdx["class"]=1;
  9557. //>>excludeEnd("ctx");
  9558. $7=_st(aClass)._class();
  9559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9560. $ctx1.sendIdx["class"]=2;
  9561. //>>excludeEnd("ctx");
  9562. $6=_st($7)._instanceVariableNames();
  9563. self._basicClass_instanceVariables_($5,$6);
  9564. $9=_st(aClass)._class();
  9565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9566. $ctx1.sendIdx["class"]=3;
  9567. //>>excludeEnd("ctx");
  9568. $8=_st($9)._methodDictionary();
  9569. _st($8)._valuesDo_((function(each){
  9570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9571. return smalltalk.withContext(function($ctx2) {
  9572. //>>excludeEnd("ctx");
  9573. return _st(_st($Compiler())._new())._install_forClass_protocol_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._protocol());
  9574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9576. //>>excludeEnd("ctx");
  9577. }));
  9578. self._setupClass_(anotherClass);
  9579. return self;
  9580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9581. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9582. //>>excludeEnd("ctx");
  9583. },
  9584. //>>excludeStart("ide", pragmas.excludeIdeData);
  9585. args: ["aClass", "anotherClass"],
  9586. 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",
  9587. referencedClasses: ["Compiler"],
  9588. //>>excludeEnd("ide");
  9589. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  9590. }),
  9591. globals.ClassBuilder);
  9592. smalltalk.addMethod(
  9593. smalltalk.method({
  9594. selector: "installMethod:forClass:protocol:",
  9595. protocol: 'method definition',
  9596. fn: function (aCompiledMethod,aBehavior,aString){
  9597. var self=this;
  9598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9599. return smalltalk.withContext(function($ctx1) {
  9600. //>>excludeEnd("ctx");
  9601. _st(aCompiledMethod)._protocol_(aString);
  9602. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  9603. self._setupClass_(aBehavior);
  9604. return aCompiledMethod;
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},globals.ClassBuilder)});
  9607. //>>excludeEnd("ctx");
  9608. },
  9609. //>>excludeStart("ide", pragmas.excludeIdeData);
  9610. args: ["aCompiledMethod", "aBehavior", "aString"],
  9611. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^ aCompiledMethod",
  9612. referencedClasses: [],
  9613. //>>excludeEnd("ide");
  9614. messageSends: ["protocol:", "addCompiledMethod:", "setupClass:"]
  9615. }),
  9616. globals.ClassBuilder);
  9617. smalltalk.addMethod(
  9618. smalltalk.method({
  9619. selector: "instanceVariableNamesFor:",
  9620. protocol: 'accessing',
  9621. fn: function (aString){
  9622. var self=this;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. return smalltalk.withContext(function($ctx1) {
  9625. //>>excludeEnd("ctx");
  9626. var $1;
  9627. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. return smalltalk.withContext(function($ctx2) {
  9630. //>>excludeEnd("ctx");
  9631. return _st(each)._isEmpty();
  9632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9633. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9634. //>>excludeEnd("ctx");
  9635. }));
  9636. return $1;
  9637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9638. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},globals.ClassBuilder)});
  9639. //>>excludeEnd("ctx");
  9640. },
  9641. //>>excludeStart("ide", pragmas.excludeIdeData);
  9642. args: ["aString"],
  9643. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  9644. referencedClasses: [],
  9645. //>>excludeEnd("ide");
  9646. messageSends: ["reject:", "tokenize:", "isEmpty"]
  9647. }),
  9648. globals.ClassBuilder);
  9649. smalltalk.addMethod(
  9650. smalltalk.method({
  9651. selector: "migrateClass:superclass:",
  9652. protocol: 'class migration',
  9653. fn: function (aClass,anotherClass){
  9654. var self=this;
  9655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9656. return smalltalk.withContext(function($ctx1) {
  9657. //>>excludeEnd("ctx");
  9658. var $2,$1;
  9659. $2=_st(aClass)._name();
  9660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9661. $ctx1.sendIdx["name"]=1;
  9662. //>>excludeEnd("ctx");
  9663. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  9664. return $1;
  9665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9666. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},globals.ClassBuilder)});
  9667. //>>excludeEnd("ctx");
  9668. },
  9669. //>>excludeStart("ide", pragmas.excludeIdeData);
  9670. args: ["aClass", "anotherClass"],
  9671. 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",
  9672. referencedClasses: [],
  9673. //>>excludeEnd("ide");
  9674. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  9675. }),
  9676. globals.ClassBuilder);
  9677. smalltalk.addMethod(
  9678. smalltalk.method({
  9679. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  9680. protocol: 'class migration',
  9681. fn: function (className,aClass,aCollection,packageName){
  9682. var self=this;
  9683. var oldClass,newClass,tmp;
  9684. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  9685. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  9686. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9687. function $ClassMigrated(){return globals.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  9688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9689. return smalltalk.withContext(function($ctx1) {
  9690. //>>excludeEnd("ctx");
  9691. var $1,$2,$3,$4,$5;
  9692. tmp="new*".__comma(className);
  9693. oldClass=_st(_st($Smalltalk())._globals())._at_(className);
  9694. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  9695. self._basicSwapClassNames_with_(oldClass,newClass);
  9696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9697. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  9698. //>>excludeEnd("ctx");
  9699. _st((function(){
  9700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9701. return smalltalk.withContext(function($ctx2) {
  9702. //>>excludeEnd("ctx");
  9703. return self._copyClass_to_(oldClass,newClass);
  9704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9706. //>>excludeEnd("ctx");
  9707. }))._on_do_($Error(),(function(exception){
  9708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9709. return smalltalk.withContext(function($ctx2) {
  9710. //>>excludeEnd("ctx");
  9711. self._basicSwapClassNames_with_(oldClass,newClass);
  9712. $1=self._basicRemoveClass_(newClass);
  9713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9714. $ctx2.sendIdx["basicRemoveClass:"]=1;
  9715. //>>excludeEnd("ctx");
  9716. $1;
  9717. return _st(exception)._signal();
  9718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9719. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  9720. //>>excludeEnd("ctx");
  9721. }));
  9722. self._rawRenameClass_to_(oldClass,tmp);
  9723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9724. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  9725. //>>excludeEnd("ctx");
  9726. $2=self._rawRenameClass_to_(newClass,className);
  9727. _st(_st(oldClass)._subclasses())._do_((function(each){
  9728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9729. return smalltalk.withContext(function($ctx2) {
  9730. //>>excludeEnd("ctx");
  9731. return self._migrateClass_superclass_(each,newClass);
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  9734. //>>excludeEnd("ctx");
  9735. }));
  9736. self._basicRemoveClass_(oldClass);
  9737. $3=_st($ClassMigrated())._new();
  9738. _st($3)._theClass_(newClass);
  9739. _st($3)._oldClass_(oldClass);
  9740. $4=_st($3)._yourself();
  9741. _st(_st($SystemAnnouncer())._current())._announce_($4);
  9742. $5=newClass;
  9743. return $5;
  9744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9745. }, 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)});
  9746. //>>excludeEnd("ctx");
  9747. },
  9748. //>>excludeStart("ide", pragmas.excludeIdeData);
  9749. args: ["className", "aClass", "aCollection", "packageName"],
  9750. 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",
  9751. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  9752. //>>excludeEnd("ide");
  9753. 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"]
  9754. }),
  9755. globals.ClassBuilder);
  9756. smalltalk.addMethod(
  9757. smalltalk.method({
  9758. selector: "rawRenameClass:to:",
  9759. protocol: 'private',
  9760. fn: function (aClass,aString){
  9761. var self=this;
  9762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9763. return smalltalk.withContext(function($ctx1) {
  9764. //>>excludeEnd("ctx");
  9765. globals[aString] = aClass;
  9766. ;
  9767. return self;
  9768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9769. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},globals.ClassBuilder)});
  9770. //>>excludeEnd("ctx");
  9771. },
  9772. //>>excludeStart("ide", pragmas.excludeIdeData);
  9773. args: ["aClass", "aString"],
  9774. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09globals[aString] = aClass;\x0a\x09>",
  9775. referencedClasses: [],
  9776. //>>excludeEnd("ide");
  9777. messageSends: []
  9778. }),
  9779. globals.ClassBuilder);
  9780. smalltalk.addMethod(
  9781. smalltalk.method({
  9782. selector: "renameClass:to:",
  9783. protocol: 'class migration',
  9784. fn: function (aClass,className){
  9785. var self=this;
  9786. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9787. function $ClassRenamed(){return globals.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  9788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9789. return smalltalk.withContext(function($ctx1) {
  9790. //>>excludeEnd("ctx");
  9791. var $1,$2;
  9792. self._basicRenameClass_to_(aClass,className);
  9793. _st(aClass)._recompile();
  9794. $1=_st($ClassRenamed())._new();
  9795. _st($1)._theClass_(aClass);
  9796. $2=_st($1)._yourself();
  9797. _st(_st($SystemAnnouncer())._current())._announce_($2);
  9798. return self;
  9799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9800. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},globals.ClassBuilder)});
  9801. //>>excludeEnd("ctx");
  9802. },
  9803. //>>excludeStart("ide", pragmas.excludeIdeData);
  9804. args: ["aClass", "className"],
  9805. 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)",
  9806. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  9807. //>>excludeEnd("ide");
  9808. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  9809. }),
  9810. globals.ClassBuilder);
  9811. smalltalk.addMethod(
  9812. smalltalk.method({
  9813. selector: "setupClass:",
  9814. protocol: 'public',
  9815. fn: function (aClass){
  9816. var self=this;
  9817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9818. return smalltalk.withContext(function($ctx1) {
  9819. //>>excludeEnd("ctx");
  9820. smalltalk.init(aClass);;
  9821. return self;
  9822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9823. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},globals.ClassBuilder)});
  9824. //>>excludeEnd("ctx");
  9825. },
  9826. //>>excludeStart("ide", pragmas.excludeIdeData);
  9827. args: ["aClass"],
  9828. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  9829. referencedClasses: [],
  9830. //>>excludeEnd("ide");
  9831. messageSends: []
  9832. }),
  9833. globals.ClassBuilder);
  9834. smalltalk.addMethod(
  9835. smalltalk.method({
  9836. selector: "superclass:subclass:",
  9837. protocol: 'class definition',
  9838. fn: function (aClass,className){
  9839. var self=this;
  9840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9841. return smalltalk.withContext(function($ctx1) {
  9842. //>>excludeEnd("ctx");
  9843. var $1;
  9844. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  9845. return $1;
  9846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9847. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},globals.ClassBuilder)});
  9848. //>>excludeEnd("ctx");
  9849. },
  9850. //>>excludeStart("ide", pragmas.excludeIdeData);
  9851. args: ["aClass", "className"],
  9852. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  9853. referencedClasses: [],
  9854. //>>excludeEnd("ide");
  9855. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  9856. }),
  9857. globals.ClassBuilder);
  9858. smalltalk.addMethod(
  9859. smalltalk.method({
  9860. selector: "superclass:subclass:instanceVariableNames:package:",
  9861. protocol: 'class definition',
  9862. fn: function (aClass,className,ivarNames,packageName){
  9863. var self=this;
  9864. var newClass;
  9865. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  9866. function $ClassAdded(){return globals.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  9867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9868. return smalltalk.withContext(function($ctx1) {
  9869. //>>excludeEnd("ctx");
  9870. var $1,$2,$3,$4,$5,$receiver;
  9871. $1=self._instanceVariableNamesFor_(ivarNames);
  9872. if(($receiver = packageName) == null || $receiver.isNil){
  9873. $2="unclassified";
  9874. } else {
  9875. $2=packageName;
  9876. };
  9877. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  9878. self._setupClass_(newClass);
  9879. $3=_st($ClassAdded())._new();
  9880. _st($3)._theClass_(newClass);
  9881. $4=_st($3)._yourself();
  9882. _st(_st($SystemAnnouncer())._current())._announce_($4);
  9883. $5=newClass;
  9884. return $5;
  9885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9886. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},globals.ClassBuilder)});
  9887. //>>excludeEnd("ctx");
  9888. },
  9889. //>>excludeStart("ide", pragmas.excludeIdeData);
  9890. args: ["aClass", "className", "ivarNames", "packageName"],
  9891. 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",
  9892. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  9893. //>>excludeEnd("ide");
  9894. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  9895. }),
  9896. globals.ClassBuilder);
  9897. smalltalk.addClass('ClassCategoryReader', globals.Object, ['class', 'category'], 'Kernel-Classes');
  9898. //>>excludeStart("ide", pragmas.excludeIdeData);
  9899. globals.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  9900. //>>excludeEnd("ide");
  9901. smalltalk.addMethod(
  9902. smalltalk.method({
  9903. selector: "class:category:",
  9904. protocol: 'accessing',
  9905. fn: function (aClass,aString){
  9906. var self=this;
  9907. self["@class"]=aClass;
  9908. self["@category"]=aString;
  9909. return self;
  9910. },
  9911. //>>excludeStart("ide", pragmas.excludeIdeData);
  9912. args: ["aClass", "aString"],
  9913. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  9914. referencedClasses: [],
  9915. //>>excludeEnd("ide");
  9916. messageSends: []
  9917. }),
  9918. globals.ClassCategoryReader);
  9919. smalltalk.addMethod(
  9920. smalltalk.method({
  9921. selector: "compileMethod:",
  9922. protocol: 'private',
  9923. fn: function (aString){
  9924. var self=this;
  9925. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  9926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9927. return smalltalk.withContext(function($ctx1) {
  9928. //>>excludeEnd("ctx");
  9929. _st(_st($Compiler())._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  9930. return self;
  9931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9932. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},globals.ClassCategoryReader)});
  9933. //>>excludeEnd("ctx");
  9934. },
  9935. //>>excludeStart("ide", pragmas.excludeIdeData);
  9936. args: ["aString"],
  9937. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  9938. referencedClasses: ["Compiler"],
  9939. //>>excludeEnd("ide");
  9940. messageSends: ["install:forClass:protocol:", "new"]
  9941. }),
  9942. globals.ClassCategoryReader);
  9943. smalltalk.addMethod(
  9944. smalltalk.method({
  9945. selector: "initialize",
  9946. protocol: 'initialization',
  9947. fn: function (){
  9948. var self=this;
  9949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9950. return smalltalk.withContext(function($ctx1) {
  9951. //>>excludeEnd("ctx");
  9952. (
  9953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9954. $ctx1.supercall = true,
  9955. //>>excludeEnd("ctx");
  9956. globals.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  9957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9958. $ctx1.supercall = false;
  9959. //>>excludeEnd("ctx");;
  9960. return self;
  9961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9962. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCategoryReader)});
  9963. //>>excludeEnd("ctx");
  9964. },
  9965. //>>excludeStart("ide", pragmas.excludeIdeData);
  9966. args: [],
  9967. source: "initialize\x0a\x09super initialize.",
  9968. referencedClasses: [],
  9969. //>>excludeEnd("ide");
  9970. messageSends: ["initialize"]
  9971. }),
  9972. globals.ClassCategoryReader);
  9973. smalltalk.addMethod(
  9974. smalltalk.method({
  9975. selector: "scanFrom:",
  9976. protocol: 'fileIn',
  9977. fn: function (aChunkParser){
  9978. var self=this;
  9979. var chunk;
  9980. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  9981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9982. return smalltalk.withContext(function($ctx1) {
  9983. //>>excludeEnd("ctx");
  9984. _st((function(){
  9985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9986. return smalltalk.withContext(function($ctx2) {
  9987. //>>excludeEnd("ctx");
  9988. chunk=_st(aChunkParser)._nextChunk();
  9989. chunk;
  9990. return _st(chunk)._isEmpty();
  9991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9993. //>>excludeEnd("ctx");
  9994. }))._whileFalse_((function(){
  9995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9996. return smalltalk.withContext(function($ctx2) {
  9997. //>>excludeEnd("ctx");
  9998. return self._compileMethod_(chunk);
  9999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10001. //>>excludeEnd("ctx");
  10002. }));
  10003. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  10004. return self;
  10005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10006. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCategoryReader)});
  10007. //>>excludeEnd("ctx");
  10008. },
  10009. //>>excludeStart("ide", pragmas.excludeIdeData);
  10010. args: ["aChunkParser"],
  10011. 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",
  10012. referencedClasses: ["ClassBuilder"],
  10013. //>>excludeEnd("ide");
  10014. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  10015. }),
  10016. globals.ClassCategoryReader);
  10017. smalltalk.addClass('ClassCommentReader', globals.Object, ['class'], 'Kernel-Classes');
  10018. //>>excludeStart("ide", pragmas.excludeIdeData);
  10019. globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  10020. //>>excludeEnd("ide");
  10021. smalltalk.addMethod(
  10022. smalltalk.method({
  10023. selector: "class:",
  10024. protocol: 'accessing',
  10025. fn: function (aClass){
  10026. var self=this;
  10027. self["@class"]=aClass;
  10028. return self;
  10029. },
  10030. //>>excludeStart("ide", pragmas.excludeIdeData);
  10031. args: ["aClass"],
  10032. source: "class: aClass\x0a\x09class := aClass",
  10033. referencedClasses: [],
  10034. //>>excludeEnd("ide");
  10035. messageSends: []
  10036. }),
  10037. globals.ClassCommentReader);
  10038. smalltalk.addMethod(
  10039. smalltalk.method({
  10040. selector: "initialize",
  10041. protocol: 'initialization',
  10042. fn: function (){
  10043. var self=this;
  10044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10045. return smalltalk.withContext(function($ctx1) {
  10046. //>>excludeEnd("ctx");
  10047. (
  10048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10049. $ctx1.supercall = true,
  10050. //>>excludeEnd("ctx");
  10051. globals.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []));
  10052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10053. $ctx1.supercall = false;
  10054. //>>excludeEnd("ctx");;
  10055. return self;
  10056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10057. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ClassCommentReader)});
  10058. //>>excludeEnd("ctx");
  10059. },
  10060. //>>excludeStart("ide", pragmas.excludeIdeData);
  10061. args: [],
  10062. source: "initialize\x0a\x09super initialize.",
  10063. referencedClasses: [],
  10064. //>>excludeEnd("ide");
  10065. messageSends: ["initialize"]
  10066. }),
  10067. globals.ClassCommentReader);
  10068. smalltalk.addMethod(
  10069. smalltalk.method({
  10070. selector: "scanFrom:",
  10071. protocol: 'fileIn',
  10072. fn: function (aChunkParser){
  10073. var self=this;
  10074. var chunk;
  10075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10076. return smalltalk.withContext(function($ctx1) {
  10077. //>>excludeEnd("ctx");
  10078. var $1;
  10079. chunk=_st(aChunkParser)._nextChunk();
  10080. $1=_st(chunk)._isEmpty();
  10081. if(! smalltalk.assert($1)){
  10082. self._setComment_(chunk);
  10083. };
  10084. return self;
  10085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10086. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},globals.ClassCommentReader)});
  10087. //>>excludeEnd("ctx");
  10088. },
  10089. //>>excludeStart("ide", pragmas.excludeIdeData);
  10090. args: ["aChunkParser"],
  10091. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  10092. referencedClasses: [],
  10093. //>>excludeEnd("ide");
  10094. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  10095. }),
  10096. globals.ClassCommentReader);
  10097. smalltalk.addMethod(
  10098. smalltalk.method({
  10099. selector: "setComment:",
  10100. protocol: 'private',
  10101. fn: function (aString){
  10102. var self=this;
  10103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10104. return smalltalk.withContext(function($ctx1) {
  10105. //>>excludeEnd("ctx");
  10106. _st(self["@class"])._comment_(aString);
  10107. return self;
  10108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10109. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},globals.ClassCommentReader)});
  10110. //>>excludeEnd("ctx");
  10111. },
  10112. //>>excludeStart("ide", pragmas.excludeIdeData);
  10113. args: ["aString"],
  10114. source: "setComment: aString\x0a\x09class comment: aString",
  10115. referencedClasses: [],
  10116. //>>excludeEnd("ide");
  10117. messageSends: ["comment:"]
  10118. }),
  10119. globals.ClassCommentReader);
  10120. smalltalk.addClass('ClassSorterNode', globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  10121. //>>excludeStart("ide", pragmas.excludeIdeData);
  10122. 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.";
  10123. //>>excludeEnd("ide");
  10124. smalltalk.addMethod(
  10125. smalltalk.method({
  10126. selector: "getNodesFrom:",
  10127. protocol: 'accessing',
  10128. fn: function (aCollection){
  10129. var self=this;
  10130. var children,others;
  10131. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  10132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10133. return smalltalk.withContext(function($ctx1) {
  10134. //>>excludeEnd("ctx");
  10135. var $1;
  10136. children=[];
  10137. others=[];
  10138. _st(aCollection)._do_((function(each){
  10139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10140. return smalltalk.withContext(function($ctx2) {
  10141. //>>excludeEnd("ctx");
  10142. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  10143. if(smalltalk.assert($1)){
  10144. return _st(children)._add_(each);
  10145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10146. $ctx2.sendIdx["add:"]=1;
  10147. //>>excludeEnd("ctx");
  10148. } else {
  10149. return _st(others)._add_(each);
  10150. };
  10151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10153. //>>excludeEnd("ctx");
  10154. }));
  10155. self["@nodes"]=_st(children)._collect_((function(each){
  10156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10157. return smalltalk.withContext(function($ctx2) {
  10158. //>>excludeEnd("ctx");
  10159. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  10160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10161. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  10162. //>>excludeEnd("ctx");
  10163. }));
  10164. return self;
  10165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10166. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},globals.ClassSorterNode)});
  10167. //>>excludeEnd("ctx");
  10168. },
  10169. //>>excludeStart("ide", pragmas.excludeIdeData);
  10170. args: ["aCollection"],
  10171. 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 ]",
  10172. referencedClasses: ["ClassSorterNode"],
  10173. //>>excludeEnd("ide");
  10174. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  10175. }),
  10176. globals.ClassSorterNode);
  10177. smalltalk.addMethod(
  10178. smalltalk.method({
  10179. selector: "level",
  10180. protocol: 'accessing',
  10181. fn: function (){
  10182. var self=this;
  10183. var $1;
  10184. $1=self["@level"];
  10185. return $1;
  10186. },
  10187. //>>excludeStart("ide", pragmas.excludeIdeData);
  10188. args: [],
  10189. source: "level\x0a\x09^ level",
  10190. referencedClasses: [],
  10191. //>>excludeEnd("ide");
  10192. messageSends: []
  10193. }),
  10194. globals.ClassSorterNode);
  10195. smalltalk.addMethod(
  10196. smalltalk.method({
  10197. selector: "level:",
  10198. protocol: 'accessing',
  10199. fn: function (anInteger){
  10200. var self=this;
  10201. self["@level"]=anInteger;
  10202. return self;
  10203. },
  10204. //>>excludeStart("ide", pragmas.excludeIdeData);
  10205. args: ["anInteger"],
  10206. source: "level: anInteger\x0a\x09level := anInteger",
  10207. referencedClasses: [],
  10208. //>>excludeEnd("ide");
  10209. messageSends: []
  10210. }),
  10211. globals.ClassSorterNode);
  10212. smalltalk.addMethod(
  10213. smalltalk.method({
  10214. selector: "nodes",
  10215. protocol: 'accessing',
  10216. fn: function (){
  10217. var self=this;
  10218. var $1;
  10219. $1=self["@nodes"];
  10220. return $1;
  10221. },
  10222. //>>excludeStart("ide", pragmas.excludeIdeData);
  10223. args: [],
  10224. source: "nodes\x0a\x09^ nodes",
  10225. referencedClasses: [],
  10226. //>>excludeEnd("ide");
  10227. messageSends: []
  10228. }),
  10229. globals.ClassSorterNode);
  10230. smalltalk.addMethod(
  10231. smalltalk.method({
  10232. selector: "theClass",
  10233. protocol: 'accessing',
  10234. fn: function (){
  10235. var self=this;
  10236. var $1;
  10237. $1=self["@theClass"];
  10238. return $1;
  10239. },
  10240. //>>excludeStart("ide", pragmas.excludeIdeData);
  10241. args: [],
  10242. source: "theClass\x0a\x09^ theClass",
  10243. referencedClasses: [],
  10244. //>>excludeEnd("ide");
  10245. messageSends: []
  10246. }),
  10247. globals.ClassSorterNode);
  10248. smalltalk.addMethod(
  10249. smalltalk.method({
  10250. selector: "theClass:",
  10251. protocol: 'accessing',
  10252. fn: function (aClass){
  10253. var self=this;
  10254. self["@theClass"]=aClass;
  10255. return self;
  10256. },
  10257. //>>excludeStart("ide", pragmas.excludeIdeData);
  10258. args: ["aClass"],
  10259. source: "theClass: aClass\x0a\x09theClass := aClass",
  10260. referencedClasses: [],
  10261. //>>excludeEnd("ide");
  10262. messageSends: []
  10263. }),
  10264. globals.ClassSorterNode);
  10265. smalltalk.addMethod(
  10266. smalltalk.method({
  10267. selector: "traverseClassesWith:",
  10268. protocol: 'visiting',
  10269. fn: function (aCollection){
  10270. var self=this;
  10271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10272. return smalltalk.withContext(function($ctx1) {
  10273. //>>excludeEnd("ctx");
  10274. var $1,$3,$2;
  10275. $1=self._theClass();
  10276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10277. $ctx1.sendIdx["theClass"]=1;
  10278. //>>excludeEnd("ctx");
  10279. _st(aCollection)._add_($1);
  10280. _st(_st(self._nodes())._sorted_((function(a,b){
  10281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10282. return smalltalk.withContext(function($ctx2) {
  10283. //>>excludeEnd("ctx");
  10284. $3=_st(a)._theClass();
  10285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10286. $ctx2.sendIdx["theClass"]=2;
  10287. //>>excludeEnd("ctx");
  10288. $2=_st($3)._name();
  10289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10290. $ctx2.sendIdx["name"]=1;
  10291. //>>excludeEnd("ctx");
  10292. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  10293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10294. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10295. //>>excludeEnd("ctx");
  10296. })))._do_((function(aNode){
  10297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10298. return smalltalk.withContext(function($ctx2) {
  10299. //>>excludeEnd("ctx");
  10300. return _st(aNode)._traverseClassesWith_(aCollection);
  10301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10302. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  10303. //>>excludeEnd("ctx");
  10304. }));
  10305. return self;
  10306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10307. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},globals.ClassSorterNode)});
  10308. //>>excludeEnd("ctx");
  10309. },
  10310. //>>excludeStart("ide", pragmas.excludeIdeData);
  10311. args: ["aCollection"],
  10312. 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 ].",
  10313. referencedClasses: [],
  10314. //>>excludeEnd("ide");
  10315. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  10316. }),
  10317. globals.ClassSorterNode);
  10318. smalltalk.addMethod(
  10319. smalltalk.method({
  10320. selector: "on:classes:level:",
  10321. protocol: 'instance creation',
  10322. fn: function (aClass,aCollection,anInteger){
  10323. var self=this;
  10324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10325. return smalltalk.withContext(function($ctx1) {
  10326. //>>excludeEnd("ctx");
  10327. var $2,$3,$1;
  10328. $2=self._new();
  10329. _st($2)._theClass_(aClass);
  10330. _st($2)._level_(anInteger);
  10331. _st($2)._getNodesFrom_(aCollection);
  10332. $3=_st($2)._yourself();
  10333. $1=$3;
  10334. return $1;
  10335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10336. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},globals.ClassSorterNode.klass)});
  10337. //>>excludeEnd("ctx");
  10338. },
  10339. //>>excludeStart("ide", pragmas.excludeIdeData);
  10340. args: ["aClass", "aCollection", "anInteger"],
  10341. 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",
  10342. referencedClasses: [],
  10343. //>>excludeEnd("ide");
  10344. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  10345. }),
  10346. globals.ClassSorterNode.klass);
  10347. });
  10348. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  10349. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  10350. smalltalk.addPackage('Kernel-Methods');
  10351. smalltalk.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10352. smalltalk.addClass('BlockClosure', globals.Object, [], 'Kernel-Methods');
  10353. //>>excludeStart("ide", pragmas.excludeIdeData);
  10354. 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 | ... ] `";
  10355. //>>excludeEnd("ide");
  10356. smalltalk.addMethod(
  10357. smalltalk.method({
  10358. selector: "applyTo:arguments:",
  10359. protocol: 'evaluating',
  10360. fn: function (anObject,aCollection){
  10361. var self=this;
  10362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10363. return smalltalk.withContext(function($ctx1) {
  10364. //>>excludeEnd("ctx");
  10365. return self.apply(anObject, aCollection);
  10366. return self;
  10367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10368. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.BlockClosure)});
  10369. //>>excludeEnd("ctx");
  10370. },
  10371. //>>excludeStart("ide", pragmas.excludeIdeData);
  10372. args: ["anObject", "aCollection"],
  10373. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  10374. referencedClasses: [],
  10375. //>>excludeEnd("ide");
  10376. messageSends: []
  10377. }),
  10378. globals.BlockClosure);
  10379. smalltalk.addMethod(
  10380. smalltalk.method({
  10381. selector: "asCompiledMethod:",
  10382. protocol: 'converting',
  10383. fn: function (aString){
  10384. var self=this;
  10385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10386. return smalltalk.withContext(function($ctx1) {
  10387. //>>excludeEnd("ctx");
  10388. return smalltalk.method({selector:aString, fn:self});;
  10389. return self;
  10390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10391. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},globals.BlockClosure)});
  10392. //>>excludeEnd("ctx");
  10393. },
  10394. //>>excludeStart("ide", pragmas.excludeIdeData);
  10395. args: ["aString"],
  10396. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  10397. referencedClasses: [],
  10398. //>>excludeEnd("ide");
  10399. messageSends: []
  10400. }),
  10401. globals.BlockClosure);
  10402. smalltalk.addMethod(
  10403. smalltalk.method({
  10404. selector: "compiledSource",
  10405. protocol: 'accessing',
  10406. fn: function (){
  10407. var self=this;
  10408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10409. return smalltalk.withContext(function($ctx1) {
  10410. //>>excludeEnd("ctx");
  10411. return self.toString();
  10412. return self;
  10413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10414. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},globals.BlockClosure)});
  10415. //>>excludeEnd("ctx");
  10416. },
  10417. //>>excludeStart("ide", pragmas.excludeIdeData);
  10418. args: [],
  10419. source: "compiledSource\x0a\x09<return self.toString()>",
  10420. referencedClasses: [],
  10421. //>>excludeEnd("ide");
  10422. messageSends: []
  10423. }),
  10424. globals.BlockClosure);
  10425. smalltalk.addMethod(
  10426. smalltalk.method({
  10427. selector: "currySelf",
  10428. protocol: 'converting',
  10429. fn: function (){
  10430. var self=this;
  10431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10432. return smalltalk.withContext(function($ctx1) {
  10433. //>>excludeEnd("ctx");
  10434. return function () {
  10435. var args = [ this ];
  10436. args.push.apply(args, arguments);
  10437. return self.apply(null, args);
  10438. }
  10439. ;
  10440. return self;
  10441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10442. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.BlockClosure)});
  10443. //>>excludeEnd("ctx");
  10444. },
  10445. //>>excludeStart("ide", pragmas.excludeIdeData);
  10446. args: [],
  10447. 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>",
  10448. referencedClasses: [],
  10449. //>>excludeEnd("ide");
  10450. messageSends: []
  10451. }),
  10452. globals.BlockClosure);
  10453. smalltalk.addMethod(
  10454. smalltalk.method({
  10455. selector: "ensure:",
  10456. protocol: 'evaluating',
  10457. fn: function (aBlock){
  10458. var self=this;
  10459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10460. return smalltalk.withContext(function($ctx1) {
  10461. //>>excludeEnd("ctx");
  10462. try{return self._value()}finally{aBlock._value()};
  10463. return self;
  10464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10465. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},globals.BlockClosure)});
  10466. //>>excludeEnd("ctx");
  10467. },
  10468. //>>excludeStart("ide", pragmas.excludeIdeData);
  10469. args: ["aBlock"],
  10470. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  10471. referencedClasses: [],
  10472. //>>excludeEnd("ide");
  10473. messageSends: []
  10474. }),
  10475. globals.BlockClosure);
  10476. smalltalk.addMethod(
  10477. smalltalk.method({
  10478. selector: "fork",
  10479. protocol: 'timeout/interval',
  10480. fn: function (){
  10481. var self=this;
  10482. function $ForkPool(){return globals.ForkPool||(typeof ForkPool=="undefined"?nil:ForkPool)}
  10483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10484. return smalltalk.withContext(function($ctx1) {
  10485. //>>excludeEnd("ctx");
  10486. _st(_st($ForkPool())._default())._fork_(self);
  10487. return self;
  10488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10489. }, function($ctx1) {$ctx1.fill(self,"fork",{},globals.BlockClosure)});
  10490. //>>excludeEnd("ctx");
  10491. },
  10492. //>>excludeStart("ide", pragmas.excludeIdeData);
  10493. args: [],
  10494. source: "fork\x0a\x09ForkPool default fork: self",
  10495. referencedClasses: ["ForkPool"],
  10496. //>>excludeEnd("ide");
  10497. messageSends: ["fork:", "default"]
  10498. }),
  10499. globals.BlockClosure);
  10500. smalltalk.addMethod(
  10501. smalltalk.method({
  10502. selector: "new",
  10503. protocol: 'evaluating',
  10504. fn: function (){
  10505. var self=this;
  10506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10507. return smalltalk.withContext(function($ctx1) {
  10508. //>>excludeEnd("ctx");
  10509. return new self();
  10510. return self;
  10511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10512. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.BlockClosure)});
  10513. //>>excludeEnd("ctx");
  10514. },
  10515. //>>excludeStart("ide", pragmas.excludeIdeData);
  10516. args: [],
  10517. 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()>",
  10518. referencedClasses: [],
  10519. //>>excludeEnd("ide");
  10520. messageSends: []
  10521. }),
  10522. globals.BlockClosure);
  10523. smalltalk.addMethod(
  10524. smalltalk.method({
  10525. selector: "newValue:",
  10526. protocol: 'evaluating',
  10527. fn: function (anObject){
  10528. var self=this;
  10529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10530. return smalltalk.withContext(function($ctx1) {
  10531. //>>excludeEnd("ctx");
  10532. var $1;
  10533. $1=self._newWithValues_([anObject]);
  10534. return $1;
  10535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10536. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},globals.BlockClosure)});
  10537. //>>excludeEnd("ctx");
  10538. },
  10539. //>>excludeStart("ide", pragmas.excludeIdeData);
  10540. args: ["anObject"],
  10541. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  10542. referencedClasses: [],
  10543. //>>excludeEnd("ide");
  10544. messageSends: ["newWithValues:"]
  10545. }),
  10546. globals.BlockClosure);
  10547. smalltalk.addMethod(
  10548. smalltalk.method({
  10549. selector: "newValue:value:",
  10550. protocol: 'evaluating',
  10551. fn: function (anObject,anObject2){
  10552. var self=this;
  10553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10554. return smalltalk.withContext(function($ctx1) {
  10555. //>>excludeEnd("ctx");
  10556. var $1;
  10557. $1=self._newWithValues_([anObject,anObject2]);
  10558. return $1;
  10559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10560. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},globals.BlockClosure)});
  10561. //>>excludeEnd("ctx");
  10562. },
  10563. //>>excludeStart("ide", pragmas.excludeIdeData);
  10564. args: ["anObject", "anObject2"],
  10565. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  10566. referencedClasses: [],
  10567. //>>excludeEnd("ide");
  10568. messageSends: ["newWithValues:"]
  10569. }),
  10570. globals.BlockClosure);
  10571. smalltalk.addMethod(
  10572. smalltalk.method({
  10573. selector: "newValue:value:value:",
  10574. protocol: 'evaluating',
  10575. fn: function (anObject,anObject2,anObject3){
  10576. var self=this;
  10577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10578. return smalltalk.withContext(function($ctx1) {
  10579. //>>excludeEnd("ctx");
  10580. var $1;
  10581. $1=self._newWithValues_([anObject,anObject2,anObject3]);
  10582. return $1;
  10583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10584. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.BlockClosure)});
  10585. //>>excludeEnd("ctx");
  10586. },
  10587. //>>excludeStart("ide", pragmas.excludeIdeData);
  10588. args: ["anObject", "anObject2", "anObject3"],
  10589. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  10590. referencedClasses: [],
  10591. //>>excludeEnd("ide");
  10592. messageSends: ["newWithValues:"]
  10593. }),
  10594. globals.BlockClosure);
  10595. smalltalk.addMethod(
  10596. smalltalk.method({
  10597. selector: "newWithValues:",
  10598. protocol: 'evaluating',
  10599. fn: function (aCollection){
  10600. var self=this;
  10601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10602. return smalltalk.withContext(function($ctx1) {
  10603. //>>excludeEnd("ctx");
  10604. var object = Object.create(self.prototype);
  10605. var result = self.apply(object, aCollection);
  10606. return typeof result === "object" ? result : object;
  10607. ;
  10608. return self;
  10609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10610. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},globals.BlockClosure)});
  10611. //>>excludeEnd("ctx");
  10612. },
  10613. //>>excludeStart("ide", pragmas.excludeIdeData);
  10614. args: ["aCollection"],
  10615. 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>",
  10616. referencedClasses: [],
  10617. //>>excludeEnd("ide");
  10618. messageSends: []
  10619. }),
  10620. globals.BlockClosure);
  10621. smalltalk.addMethod(
  10622. smalltalk.method({
  10623. selector: "numArgs",
  10624. protocol: 'accessing',
  10625. fn: function (){
  10626. var self=this;
  10627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10628. return smalltalk.withContext(function($ctx1) {
  10629. //>>excludeEnd("ctx");
  10630. return self.length;
  10631. return self;
  10632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10633. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.BlockClosure)});
  10634. //>>excludeEnd("ctx");
  10635. },
  10636. //>>excludeStart("ide", pragmas.excludeIdeData);
  10637. args: [],
  10638. source: "numArgs\x0a\x09<return self.length>",
  10639. referencedClasses: [],
  10640. //>>excludeEnd("ide");
  10641. messageSends: []
  10642. }),
  10643. globals.BlockClosure);
  10644. smalltalk.addMethod(
  10645. smalltalk.method({
  10646. selector: "on:do:",
  10647. protocol: 'error handling',
  10648. fn: function (anErrorClass,aBlock){
  10649. var self=this;
  10650. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  10651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10652. return smalltalk.withContext(function($ctx1) {
  10653. //>>excludeEnd("ctx");
  10654. var $2,$1;
  10655. $1=self._tryCatch_((function(error){
  10656. var smalltalkError;
  10657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10658. return smalltalk.withContext(function($ctx2) {
  10659. //>>excludeEnd("ctx");
  10660. smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
  10661. smalltalkError;
  10662. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  10663. if(smalltalk.assert($2)){
  10664. return _st(aBlock)._value_(smalltalkError);
  10665. } else {
  10666. return _st(smalltalkError)._resignal();
  10667. };
  10668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10669. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  10670. //>>excludeEnd("ctx");
  10671. }));
  10672. return $1;
  10673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10674. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},globals.BlockClosure)});
  10675. //>>excludeEnd("ctx");
  10676. },
  10677. //>>excludeStart("ide", pragmas.excludeIdeData);
  10678. args: ["anErrorClass", "aBlock"],
  10679. 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 ] ]",
  10680. referencedClasses: ["Smalltalk"],
  10681. //>>excludeEnd("ide");
  10682. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  10683. }),
  10684. globals.BlockClosure);
  10685. smalltalk.addMethod(
  10686. smalltalk.method({
  10687. selector: "receiver",
  10688. protocol: 'accessing',
  10689. fn: function (){
  10690. var self=this;
  10691. return nil;
  10692. },
  10693. //>>excludeStart("ide", pragmas.excludeIdeData);
  10694. args: [],
  10695. source: "receiver\x0a\x09^ nil",
  10696. referencedClasses: [],
  10697. //>>excludeEnd("ide");
  10698. messageSends: []
  10699. }),
  10700. globals.BlockClosure);
  10701. smalltalk.addMethod(
  10702. smalltalk.method({
  10703. selector: "timeToRun",
  10704. protocol: 'evaluating',
  10705. fn: function (){
  10706. var self=this;
  10707. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  10708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10709. return smalltalk.withContext(function($ctx1) {
  10710. //>>excludeEnd("ctx");
  10711. var $1;
  10712. $1=_st($Date())._millisecondsToRun_(self);
  10713. return $1;
  10714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10715. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},globals.BlockClosure)});
  10716. //>>excludeEnd("ctx");
  10717. },
  10718. //>>excludeStart("ide", pragmas.excludeIdeData);
  10719. args: [],
  10720. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  10721. referencedClasses: ["Date"],
  10722. //>>excludeEnd("ide");
  10723. messageSends: ["millisecondsToRun:"]
  10724. }),
  10725. globals.BlockClosure);
  10726. smalltalk.addMethod(
  10727. smalltalk.method({
  10728. selector: "tryCatch:",
  10729. protocol: 'error handling',
  10730. fn: function (aBlock){
  10731. var self=this;
  10732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10733. return smalltalk.withContext(function($ctx1) {
  10734. //>>excludeEnd("ctx");
  10735. try {
  10736. return self._value();
  10737. } catch(error) {
  10738. return aBlock._value_(error);
  10739. }
  10740. ;
  10741. return self;
  10742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10743. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},globals.BlockClosure)});
  10744. //>>excludeEnd("ctx");
  10745. },
  10746. //>>excludeStart("ide", pragmas.excludeIdeData);
  10747. args: ["aBlock"],
  10748. 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>",
  10749. referencedClasses: [],
  10750. //>>excludeEnd("ide");
  10751. messageSends: []
  10752. }),
  10753. globals.BlockClosure);
  10754. smalltalk.addMethod(
  10755. smalltalk.method({
  10756. selector: "value",
  10757. protocol: 'evaluating',
  10758. fn: function (){
  10759. var self=this;
  10760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10761. return smalltalk.withContext(function($ctx1) {
  10762. //>>excludeEnd("ctx");
  10763. return self();;
  10764. return self;
  10765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10766. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.BlockClosure)});
  10767. //>>excludeEnd("ctx");
  10768. },
  10769. //>>excludeStart("ide", pragmas.excludeIdeData);
  10770. args: [],
  10771. source: "value\x0a\x09<return self();>",
  10772. referencedClasses: [],
  10773. //>>excludeEnd("ide");
  10774. messageSends: []
  10775. }),
  10776. globals.BlockClosure);
  10777. smalltalk.addMethod(
  10778. smalltalk.method({
  10779. selector: "value:",
  10780. protocol: 'evaluating',
  10781. fn: function (anArg){
  10782. var self=this;
  10783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10784. return smalltalk.withContext(function($ctx1) {
  10785. //>>excludeEnd("ctx");
  10786. return self(anArg);;
  10787. return self;
  10788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10789. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},globals.BlockClosure)});
  10790. //>>excludeEnd("ctx");
  10791. },
  10792. //>>excludeStart("ide", pragmas.excludeIdeData);
  10793. args: ["anArg"],
  10794. source: "value: anArg\x0a\x09<return self(anArg);>",
  10795. referencedClasses: [],
  10796. //>>excludeEnd("ide");
  10797. messageSends: []
  10798. }),
  10799. globals.BlockClosure);
  10800. smalltalk.addMethod(
  10801. smalltalk.method({
  10802. selector: "value:value:",
  10803. protocol: 'evaluating',
  10804. fn: function (firstArg,secondArg){
  10805. var self=this;
  10806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10807. return smalltalk.withContext(function($ctx1) {
  10808. //>>excludeEnd("ctx");
  10809. return self(firstArg, secondArg);;
  10810. return self;
  10811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10812. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},globals.BlockClosure)});
  10813. //>>excludeEnd("ctx");
  10814. },
  10815. //>>excludeStart("ide", pragmas.excludeIdeData);
  10816. args: ["firstArg", "secondArg"],
  10817. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  10818. referencedClasses: [],
  10819. //>>excludeEnd("ide");
  10820. messageSends: []
  10821. }),
  10822. globals.BlockClosure);
  10823. smalltalk.addMethod(
  10824. smalltalk.method({
  10825. selector: "value:value:value:",
  10826. protocol: 'evaluating',
  10827. fn: function (firstArg,secondArg,thirdArg){
  10828. var self=this;
  10829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10830. return smalltalk.withContext(function($ctx1) {
  10831. //>>excludeEnd("ctx");
  10832. return self(firstArg, secondArg, thirdArg);;
  10833. return self;
  10834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10835. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},globals.BlockClosure)});
  10836. //>>excludeEnd("ctx");
  10837. },
  10838. //>>excludeStart("ide", pragmas.excludeIdeData);
  10839. args: ["firstArg", "secondArg", "thirdArg"],
  10840. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  10841. referencedClasses: [],
  10842. //>>excludeEnd("ide");
  10843. messageSends: []
  10844. }),
  10845. globals.BlockClosure);
  10846. smalltalk.addMethod(
  10847. smalltalk.method({
  10848. selector: "valueWithInterval:",
  10849. protocol: 'timeout/interval',
  10850. fn: function (aNumber){
  10851. var self=this;
  10852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10853. return smalltalk.withContext(function($ctx1) {
  10854. //>>excludeEnd("ctx");
  10855. var interval = setInterval(self, aNumber);
  10856. return globals.Timeout._on_(interval);
  10857. ;
  10858. return self;
  10859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10860. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},globals.BlockClosure)});
  10861. //>>excludeEnd("ctx");
  10862. },
  10863. //>>excludeStart("ide", pragmas.excludeIdeData);
  10864. args: ["aNumber"],
  10865. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(interval);\x0a\x09>",
  10866. referencedClasses: [],
  10867. //>>excludeEnd("ide");
  10868. messageSends: []
  10869. }),
  10870. globals.BlockClosure);
  10871. smalltalk.addMethod(
  10872. smalltalk.method({
  10873. selector: "valueWithPossibleArguments:",
  10874. protocol: 'evaluating',
  10875. fn: function (aCollection){
  10876. var self=this;
  10877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10878. return smalltalk.withContext(function($ctx1) {
  10879. //>>excludeEnd("ctx");
  10880. return self.apply(null, aCollection);;
  10881. return self;
  10882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10883. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.BlockClosure)});
  10884. //>>excludeEnd("ctx");
  10885. },
  10886. //>>excludeStart("ide", pragmas.excludeIdeData);
  10887. args: ["aCollection"],
  10888. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  10889. referencedClasses: [],
  10890. //>>excludeEnd("ide");
  10891. messageSends: []
  10892. }),
  10893. globals.BlockClosure);
  10894. smalltalk.addMethod(
  10895. smalltalk.method({
  10896. selector: "valueWithTimeout:",
  10897. protocol: 'timeout/interval',
  10898. fn: function (aNumber){
  10899. var self=this;
  10900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10901. return smalltalk.withContext(function($ctx1) {
  10902. //>>excludeEnd("ctx");
  10903. var timeout = setTimeout(self, aNumber);
  10904. return globals.Timeout._on_(timeout);
  10905. ;
  10906. return self;
  10907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10908. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},globals.BlockClosure)});
  10909. //>>excludeEnd("ctx");
  10910. },
  10911. //>>excludeStart("ide", pragmas.excludeIdeData);
  10912. args: ["aNumber"],
  10913. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return globals.Timeout._on_(timeout);\x0a\x09>",
  10914. referencedClasses: [],
  10915. //>>excludeEnd("ide");
  10916. messageSends: []
  10917. }),
  10918. globals.BlockClosure);
  10919. smalltalk.addMethod(
  10920. smalltalk.method({
  10921. selector: "whileFalse",
  10922. protocol: 'controlling',
  10923. fn: function (){
  10924. var self=this;
  10925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10926. return smalltalk.withContext(function($ctx1) {
  10927. //>>excludeEnd("ctx");
  10928. self._whileFalse_((function(){
  10929. }));
  10930. return self;
  10931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10932. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},globals.BlockClosure)});
  10933. //>>excludeEnd("ctx");
  10934. },
  10935. //>>excludeStart("ide", pragmas.excludeIdeData);
  10936. args: [],
  10937. source: "whileFalse\x0a\x09self whileFalse: []",
  10938. referencedClasses: [],
  10939. //>>excludeEnd("ide");
  10940. messageSends: ["whileFalse:"]
  10941. }),
  10942. globals.BlockClosure);
  10943. smalltalk.addMethod(
  10944. smalltalk.method({
  10945. selector: "whileFalse:",
  10946. protocol: 'controlling',
  10947. fn: function (aBlock){
  10948. var self=this;
  10949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10950. return smalltalk.withContext(function($ctx1) {
  10951. //>>excludeEnd("ctx");
  10952. while(!smalltalk.assert(self._value())) {aBlock._value()};
  10953. return self;
  10954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10955. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},globals.BlockClosure)});
  10956. //>>excludeEnd("ctx");
  10957. },
  10958. //>>excludeStart("ide", pragmas.excludeIdeData);
  10959. args: ["aBlock"],
  10960. source: "whileFalse: aBlock\x0a\x09<while(!smalltalk.assert(self._value())) {aBlock._value()}>",
  10961. referencedClasses: [],
  10962. //>>excludeEnd("ide");
  10963. messageSends: []
  10964. }),
  10965. globals.BlockClosure);
  10966. smalltalk.addMethod(
  10967. smalltalk.method({
  10968. selector: "whileTrue",
  10969. protocol: 'controlling',
  10970. fn: function (){
  10971. var self=this;
  10972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10973. return smalltalk.withContext(function($ctx1) {
  10974. //>>excludeEnd("ctx");
  10975. self._whileTrue_((function(){
  10976. }));
  10977. return self;
  10978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10979. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},globals.BlockClosure)});
  10980. //>>excludeEnd("ctx");
  10981. },
  10982. //>>excludeStart("ide", pragmas.excludeIdeData);
  10983. args: [],
  10984. source: "whileTrue\x0a\x09self whileTrue: []",
  10985. referencedClasses: [],
  10986. //>>excludeEnd("ide");
  10987. messageSends: ["whileTrue:"]
  10988. }),
  10989. globals.BlockClosure);
  10990. smalltalk.addMethod(
  10991. smalltalk.method({
  10992. selector: "whileTrue:",
  10993. protocol: 'controlling',
  10994. fn: function (aBlock){
  10995. var self=this;
  10996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  10997. return smalltalk.withContext(function($ctx1) {
  10998. //>>excludeEnd("ctx");
  10999. while(smalltalk.assert(self._value())) {aBlock._value()};
  11000. return self;
  11001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11002. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},globals.BlockClosure)});
  11003. //>>excludeEnd("ctx");
  11004. },
  11005. //>>excludeStart("ide", pragmas.excludeIdeData);
  11006. args: ["aBlock"],
  11007. source: "whileTrue: aBlock\x0a\x09<while(smalltalk.assert(self._value())) {aBlock._value()}>",
  11008. referencedClasses: [],
  11009. //>>excludeEnd("ide");
  11010. messageSends: []
  11011. }),
  11012. globals.BlockClosure);
  11013. smalltalk.addClass('CompiledMethod', globals.Object, [], 'Kernel-Methods');
  11014. //>>excludeStart("ide", pragmas.excludeIdeData);
  11015. 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";
  11016. //>>excludeEnd("ide");
  11017. smalltalk.addMethod(
  11018. smalltalk.method({
  11019. selector: "arguments",
  11020. protocol: 'accessing',
  11021. fn: function (){
  11022. var self=this;
  11023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11024. return smalltalk.withContext(function($ctx1) {
  11025. //>>excludeEnd("ctx");
  11026. return self.args || [];
  11027. return self;
  11028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11029. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.CompiledMethod)});
  11030. //>>excludeEnd("ctx");
  11031. },
  11032. //>>excludeStart("ide", pragmas.excludeIdeData);
  11033. args: [],
  11034. source: "arguments\x0a\x09<return self.args || []>",
  11035. referencedClasses: [],
  11036. //>>excludeEnd("ide");
  11037. messageSends: []
  11038. }),
  11039. globals.CompiledMethod);
  11040. smalltalk.addMethod(
  11041. smalltalk.method({
  11042. selector: "browse",
  11043. protocol: 'browsing',
  11044. fn: function (){
  11045. var self=this;
  11046. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  11047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11048. return smalltalk.withContext(function($ctx1) {
  11049. //>>excludeEnd("ctx");
  11050. _st($Finder())._findMethod_(self);
  11051. return self;
  11052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11053. }, function($ctx1) {$ctx1.fill(self,"browse",{},globals.CompiledMethod)});
  11054. //>>excludeEnd("ctx");
  11055. },
  11056. //>>excludeStart("ide", pragmas.excludeIdeData);
  11057. args: [],
  11058. source: "browse\x0a\x09Finder findMethod: self",
  11059. referencedClasses: ["Finder"],
  11060. //>>excludeEnd("ide");
  11061. messageSends: ["findMethod:"]
  11062. }),
  11063. globals.CompiledMethod);
  11064. smalltalk.addMethod(
  11065. smalltalk.method({
  11066. selector: "category",
  11067. protocol: 'accessing',
  11068. fn: function (){
  11069. var self=this;
  11070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11071. return smalltalk.withContext(function($ctx1) {
  11072. //>>excludeEnd("ctx");
  11073. var $1;
  11074. $1=self._protocol();
  11075. return $1;
  11076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11077. }, function($ctx1) {$ctx1.fill(self,"category",{},globals.CompiledMethod)});
  11078. //>>excludeEnd("ctx");
  11079. },
  11080. //>>excludeStart("ide", pragmas.excludeIdeData);
  11081. args: [],
  11082. source: "category\x0a\x09^ self protocol",
  11083. referencedClasses: [],
  11084. //>>excludeEnd("ide");
  11085. messageSends: ["protocol"]
  11086. }),
  11087. globals.CompiledMethod);
  11088. smalltalk.addMethod(
  11089. smalltalk.method({
  11090. selector: "defaultProtocol",
  11091. protocol: 'defaults',
  11092. fn: function (){
  11093. var self=this;
  11094. return "as yet unclassified";
  11095. },
  11096. //>>excludeStart("ide", pragmas.excludeIdeData);
  11097. args: [],
  11098. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  11099. referencedClasses: [],
  11100. //>>excludeEnd("ide");
  11101. messageSends: []
  11102. }),
  11103. globals.CompiledMethod);
  11104. smalltalk.addMethod(
  11105. smalltalk.method({
  11106. selector: "fn",
  11107. protocol: 'accessing',
  11108. fn: function (){
  11109. var self=this;
  11110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11111. return smalltalk.withContext(function($ctx1) {
  11112. //>>excludeEnd("ctx");
  11113. var $1;
  11114. $1=self._basicAt_("fn");
  11115. return $1;
  11116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11117. }, function($ctx1) {$ctx1.fill(self,"fn",{},globals.CompiledMethod)});
  11118. //>>excludeEnd("ctx");
  11119. },
  11120. //>>excludeStart("ide", pragmas.excludeIdeData);
  11121. args: [],
  11122. source: "fn\x0a\x09^ self basicAt: 'fn'",
  11123. referencedClasses: [],
  11124. //>>excludeEnd("ide");
  11125. messageSends: ["basicAt:"]
  11126. }),
  11127. globals.CompiledMethod);
  11128. smalltalk.addMethod(
  11129. smalltalk.method({
  11130. selector: "fn:",
  11131. protocol: 'accessing',
  11132. fn: function (aBlock){
  11133. var self=this;
  11134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11135. return smalltalk.withContext(function($ctx1) {
  11136. //>>excludeEnd("ctx");
  11137. self._basicAt_put_("fn",aBlock);
  11138. return self;
  11139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11140. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},globals.CompiledMethod)});
  11141. //>>excludeEnd("ctx");
  11142. },
  11143. //>>excludeStart("ide", pragmas.excludeIdeData);
  11144. args: ["aBlock"],
  11145. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  11146. referencedClasses: [],
  11147. //>>excludeEnd("ide");
  11148. messageSends: ["basicAt:put:"]
  11149. }),
  11150. globals.CompiledMethod);
  11151. smalltalk.addMethod(
  11152. smalltalk.method({
  11153. selector: "isCompiledMethod",
  11154. protocol: 'testing',
  11155. fn: function (){
  11156. var self=this;
  11157. return true;
  11158. },
  11159. //>>excludeStart("ide", pragmas.excludeIdeData);
  11160. args: [],
  11161. source: "isCompiledMethod\x0a\x09^ true",
  11162. referencedClasses: [],
  11163. //>>excludeEnd("ide");
  11164. messageSends: []
  11165. }),
  11166. globals.CompiledMethod);
  11167. smalltalk.addMethod(
  11168. smalltalk.method({
  11169. selector: "isOverridden",
  11170. protocol: 'testing',
  11171. fn: function (){
  11172. var self=this;
  11173. var selector;
  11174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11175. return smalltalk.withContext(function($ctx1) {
  11176. //>>excludeEnd("ctx");
  11177. var $1;
  11178. var $early={};
  11179. try {
  11180. selector=self._selector();
  11181. _st(self._methodClass())._allSubclassesDo_((function(each){
  11182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11183. return smalltalk.withContext(function($ctx2) {
  11184. //>>excludeEnd("ctx");
  11185. $1=_st(each)._includesSelector_(selector);
  11186. if(smalltalk.assert($1)){
  11187. throw $early=[true];
  11188. };
  11189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11190. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11191. //>>excludeEnd("ctx");
  11192. }));
  11193. return false;
  11194. }
  11195. catch(e) {if(e===$early)return e[0]; throw e}
  11196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11197. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},globals.CompiledMethod)});
  11198. //>>excludeEnd("ctx");
  11199. },
  11200. //>>excludeStart("ide", pragmas.excludeIdeData);
  11201. args: [],
  11202. 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",
  11203. referencedClasses: [],
  11204. //>>excludeEnd("ide");
  11205. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  11206. }),
  11207. globals.CompiledMethod);
  11208. smalltalk.addMethod(
  11209. smalltalk.method({
  11210. selector: "isOverride",
  11211. protocol: 'testing',
  11212. fn: function (){
  11213. var self=this;
  11214. var superclass;
  11215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11216. return smalltalk.withContext(function($ctx1) {
  11217. //>>excludeEnd("ctx");
  11218. var $1,$2,$3,$receiver;
  11219. $1=self._methodClass();
  11220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11221. $ctx1.sendIdx["methodClass"]=1;
  11222. //>>excludeEnd("ctx");
  11223. superclass=_st($1)._superclass();
  11224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11225. $ctx1.sendIdx["superclass"]=1;
  11226. //>>excludeEnd("ctx");
  11227. $2=superclass;
  11228. if(($receiver = $2) == null || $receiver.isNil){
  11229. return false;
  11230. } else {
  11231. $2;
  11232. };
  11233. $3=_st(_st(_st(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  11234. return $3;
  11235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11236. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},globals.CompiledMethod)});
  11237. //>>excludeEnd("ctx");
  11238. },
  11239. //>>excludeStart("ide", pragmas.excludeIdeData);
  11240. args: [],
  11241. 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",
  11242. referencedClasses: [],
  11243. //>>excludeEnd("ide");
  11244. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  11245. }),
  11246. globals.CompiledMethod);
  11247. smalltalk.addMethod(
  11248. smalltalk.method({
  11249. selector: "messageSends",
  11250. protocol: 'accessing',
  11251. fn: function (){
  11252. var self=this;
  11253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11254. return smalltalk.withContext(function($ctx1) {
  11255. //>>excludeEnd("ctx");
  11256. var $1;
  11257. $1=self._basicAt_("messageSends");
  11258. return $1;
  11259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11260. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.CompiledMethod)});
  11261. //>>excludeEnd("ctx");
  11262. },
  11263. //>>excludeStart("ide", pragmas.excludeIdeData);
  11264. args: [],
  11265. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  11266. referencedClasses: [],
  11267. //>>excludeEnd("ide");
  11268. messageSends: ["basicAt:"]
  11269. }),
  11270. globals.CompiledMethod);
  11271. smalltalk.addMethod(
  11272. smalltalk.method({
  11273. selector: "methodClass",
  11274. protocol: 'accessing',
  11275. fn: function (){
  11276. var self=this;
  11277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11278. return smalltalk.withContext(function($ctx1) {
  11279. //>>excludeEnd("ctx");
  11280. var $1;
  11281. $1=self._basicAt_("methodClass");
  11282. return $1;
  11283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11284. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},globals.CompiledMethod)});
  11285. //>>excludeEnd("ctx");
  11286. },
  11287. //>>excludeStart("ide", pragmas.excludeIdeData);
  11288. args: [],
  11289. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  11290. referencedClasses: [],
  11291. //>>excludeEnd("ide");
  11292. messageSends: ["basicAt:"]
  11293. }),
  11294. globals.CompiledMethod);
  11295. smalltalk.addMethod(
  11296. smalltalk.method({
  11297. selector: "package",
  11298. protocol: 'accessing',
  11299. fn: function (){
  11300. var self=this;
  11301. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  11302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11303. return smalltalk.withContext(function($ctx1) {
  11304. //>>excludeEnd("ctx");
  11305. var $1,$3,$2,$4,$5,$receiver;
  11306. $1=self._methodClass();
  11307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11308. $ctx1.sendIdx["methodClass"]=1;
  11309. //>>excludeEnd("ctx");
  11310. if(($receiver = $1) == null || $receiver.isNil){
  11311. return nil;
  11312. } else {
  11313. $1;
  11314. };
  11315. $3=self._protocol();
  11316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11317. $ctx1.sendIdx["protocol"]=1;
  11318. //>>excludeEnd("ctx");
  11319. $2=_st($3)._beginsWith_("*");
  11320. if(! smalltalk.assert($2)){
  11321. $4=_st(self._methodClass())._package();
  11322. return $4;
  11323. };
  11324. $5=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  11325. return nil;
  11326. }));
  11327. return $5;
  11328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11329. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.CompiledMethod)});
  11330. //>>excludeEnd("ctx");
  11331. },
  11332. //>>excludeStart("ide", pragmas.excludeIdeData);
  11333. args: [],
  11334. 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 ]",
  11335. referencedClasses: ["Package"],
  11336. //>>excludeEnd("ide");
  11337. messageSends: ["ifNil:", "methodClass", "ifFalse:", "beginsWith:", "protocol", "package", "named:ifAbsent:", "allButFirst"]
  11338. }),
  11339. globals.CompiledMethod);
  11340. smalltalk.addMethod(
  11341. smalltalk.method({
  11342. selector: "protocol",
  11343. protocol: 'accessing',
  11344. fn: function (){
  11345. var self=this;
  11346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11347. return smalltalk.withContext(function($ctx1) {
  11348. //>>excludeEnd("ctx");
  11349. var $2,$1,$receiver;
  11350. $2=self._basicAt_("protocol");
  11351. if(($receiver = $2) == null || $receiver.isNil){
  11352. $1=self._defaultProtocol();
  11353. } else {
  11354. $1=$2;
  11355. };
  11356. return $1;
  11357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11358. }, function($ctx1) {$ctx1.fill(self,"protocol",{},globals.CompiledMethod)});
  11359. //>>excludeEnd("ctx");
  11360. },
  11361. //>>excludeStart("ide", pragmas.excludeIdeData);
  11362. args: [],
  11363. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  11364. referencedClasses: [],
  11365. //>>excludeEnd("ide");
  11366. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  11367. }),
  11368. globals.CompiledMethod);
  11369. smalltalk.addMethod(
  11370. smalltalk.method({
  11371. selector: "protocol:",
  11372. protocol: 'accessing',
  11373. fn: function (aString){
  11374. var self=this;
  11375. var oldProtocol;
  11376. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  11377. function $MethodMoved(){return globals.MethodMoved||(typeof MethodMoved=="undefined"?nil:MethodMoved)}
  11378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11379. return smalltalk.withContext(function($ctx1) {
  11380. //>>excludeEnd("ctx");
  11381. var $1,$2,$3,$receiver;
  11382. oldProtocol=self._protocol();
  11383. self._basicAt_put_("protocol",aString);
  11384. $1=_st($MethodMoved())._new();
  11385. _st($1)._method_(self);
  11386. _st($1)._oldProtocol_(oldProtocol);
  11387. $2=_st($1)._yourself();
  11388. _st(_st($SystemAnnouncer())._current())._announce_($2);
  11389. $3=self._methodClass();
  11390. if(($receiver = $3) == null || $receiver.isNil){
  11391. $3;
  11392. } else {
  11393. var methodClass;
  11394. methodClass=$receiver;
  11395. _st(_st(methodClass)._organization())._addElement_(aString);
  11396. _st(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  11397. };
  11398. return self;
  11399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11400. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},globals.CompiledMethod)});
  11401. //>>excludeEnd("ctx");
  11402. },
  11403. //>>excludeStart("ide", pragmas.excludeIdeData);
  11404. args: ["aString"],
  11405. 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 ]",
  11406. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  11407. //>>excludeEnd("ide");
  11408. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  11409. }),
  11410. globals.CompiledMethod);
  11411. smalltalk.addMethod(
  11412. smalltalk.method({
  11413. selector: "referencedClasses",
  11414. protocol: 'accessing',
  11415. fn: function (){
  11416. var self=this;
  11417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11418. return smalltalk.withContext(function($ctx1) {
  11419. //>>excludeEnd("ctx");
  11420. var $1;
  11421. $1=self._basicAt_("referencedClasses");
  11422. return $1;
  11423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11424. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},globals.CompiledMethod)});
  11425. //>>excludeEnd("ctx");
  11426. },
  11427. //>>excludeStart("ide", pragmas.excludeIdeData);
  11428. args: [],
  11429. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  11430. referencedClasses: [],
  11431. //>>excludeEnd("ide");
  11432. messageSends: ["basicAt:"]
  11433. }),
  11434. globals.CompiledMethod);
  11435. smalltalk.addMethod(
  11436. smalltalk.method({
  11437. selector: "selector",
  11438. protocol: 'accessing',
  11439. fn: function (){
  11440. var self=this;
  11441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11442. return smalltalk.withContext(function($ctx1) {
  11443. //>>excludeEnd("ctx");
  11444. var $1;
  11445. $1=self._basicAt_("selector");
  11446. return $1;
  11447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11448. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.CompiledMethod)});
  11449. //>>excludeEnd("ctx");
  11450. },
  11451. //>>excludeStart("ide", pragmas.excludeIdeData);
  11452. args: [],
  11453. source: "selector\x0a\x09^ self basicAt: 'selector'",
  11454. referencedClasses: [],
  11455. //>>excludeEnd("ide");
  11456. messageSends: ["basicAt:"]
  11457. }),
  11458. globals.CompiledMethod);
  11459. smalltalk.addMethod(
  11460. smalltalk.method({
  11461. selector: "selector:",
  11462. protocol: 'accessing',
  11463. fn: function (aString){
  11464. var self=this;
  11465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11466. return smalltalk.withContext(function($ctx1) {
  11467. //>>excludeEnd("ctx");
  11468. self._basicAt_put_("selector",aString);
  11469. return self;
  11470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11471. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.CompiledMethod)});
  11472. //>>excludeEnd("ctx");
  11473. },
  11474. //>>excludeStart("ide", pragmas.excludeIdeData);
  11475. args: ["aString"],
  11476. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  11477. referencedClasses: [],
  11478. //>>excludeEnd("ide");
  11479. messageSends: ["basicAt:put:"]
  11480. }),
  11481. globals.CompiledMethod);
  11482. smalltalk.addMethod(
  11483. smalltalk.method({
  11484. selector: "sendTo:arguments:",
  11485. protocol: 'evaluating',
  11486. fn: function (anObject,aCollection){
  11487. var self=this;
  11488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11489. return smalltalk.withContext(function($ctx1) {
  11490. //>>excludeEnd("ctx");
  11491. var $1;
  11492. $1=_st(self._fn())._applyTo_arguments_(anObject,aCollection);
  11493. return $1;
  11494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11495. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.CompiledMethod)});
  11496. //>>excludeEnd("ctx");
  11497. },
  11498. //>>excludeStart("ide", pragmas.excludeIdeData);
  11499. args: ["anObject", "aCollection"],
  11500. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  11501. referencedClasses: [],
  11502. //>>excludeEnd("ide");
  11503. messageSends: ["applyTo:arguments:", "fn"]
  11504. }),
  11505. globals.CompiledMethod);
  11506. smalltalk.addMethod(
  11507. smalltalk.method({
  11508. selector: "source",
  11509. protocol: 'accessing',
  11510. fn: function (){
  11511. var self=this;
  11512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11513. return smalltalk.withContext(function($ctx1) {
  11514. //>>excludeEnd("ctx");
  11515. var $2,$1,$receiver;
  11516. $2=self._basicAt_("source");
  11517. if(($receiver = $2) == null || $receiver.isNil){
  11518. $1="";
  11519. } else {
  11520. $1=$2;
  11521. };
  11522. return $1;
  11523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11524. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.CompiledMethod)});
  11525. //>>excludeEnd("ctx");
  11526. },
  11527. //>>excludeStart("ide", pragmas.excludeIdeData);
  11528. args: [],
  11529. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  11530. referencedClasses: [],
  11531. //>>excludeEnd("ide");
  11532. messageSends: ["ifNil:", "basicAt:"]
  11533. }),
  11534. globals.CompiledMethod);
  11535. smalltalk.addMethod(
  11536. smalltalk.method({
  11537. selector: "source:",
  11538. protocol: 'accessing',
  11539. fn: function (aString){
  11540. var self=this;
  11541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11542. return smalltalk.withContext(function($ctx1) {
  11543. //>>excludeEnd("ctx");
  11544. self._basicAt_put_("source",aString);
  11545. return self;
  11546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11547. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},globals.CompiledMethod)});
  11548. //>>excludeEnd("ctx");
  11549. },
  11550. //>>excludeStart("ide", pragmas.excludeIdeData);
  11551. args: ["aString"],
  11552. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  11553. referencedClasses: [],
  11554. //>>excludeEnd("ide");
  11555. messageSends: ["basicAt:put:"]
  11556. }),
  11557. globals.CompiledMethod);
  11558. smalltalk.addClass('ForkPool', globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  11559. //>>excludeStart("ide", pragmas.excludeIdeData);
  11560. 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`";
  11561. //>>excludeEnd("ide");
  11562. smalltalk.addMethod(
  11563. smalltalk.method({
  11564. selector: "addWorker",
  11565. protocol: 'private',
  11566. fn: function (){
  11567. var self=this;
  11568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11569. return smalltalk.withContext(function($ctx1) {
  11570. //>>excludeEnd("ctx");
  11571. _st(self["@worker"])._valueWithTimeout_((0));
  11572. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  11573. return self;
  11574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11575. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},globals.ForkPool)});
  11576. //>>excludeEnd("ctx");
  11577. },
  11578. //>>excludeStart("ide", pragmas.excludeIdeData);
  11579. args: [],
  11580. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  11581. referencedClasses: [],
  11582. //>>excludeEnd("ide");
  11583. messageSends: ["valueWithTimeout:", "+"]
  11584. }),
  11585. globals.ForkPool);
  11586. smalltalk.addMethod(
  11587. smalltalk.method({
  11588. selector: "defaultMaxPoolSize",
  11589. protocol: 'defaults',
  11590. fn: function (){
  11591. var self=this;
  11592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11593. return smalltalk.withContext(function($ctx1) {
  11594. //>>excludeEnd("ctx");
  11595. var $1;
  11596. $1=_st(self._class())._defaultMaxPoolSize();
  11597. return $1;
  11598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11599. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},globals.ForkPool)});
  11600. //>>excludeEnd("ctx");
  11601. },
  11602. //>>excludeStart("ide", pragmas.excludeIdeData);
  11603. args: [],
  11604. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  11605. referencedClasses: [],
  11606. //>>excludeEnd("ide");
  11607. messageSends: ["defaultMaxPoolSize", "class"]
  11608. }),
  11609. globals.ForkPool);
  11610. smalltalk.addMethod(
  11611. smalltalk.method({
  11612. selector: "fork:",
  11613. protocol: 'actions',
  11614. fn: function (aBlock){
  11615. var self=this;
  11616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11617. return smalltalk.withContext(function($ctx1) {
  11618. //>>excludeEnd("ctx");
  11619. var $1;
  11620. $1=_st(self["@poolSize"]).__lt(self._maxPoolSize());
  11621. if(smalltalk.assert($1)){
  11622. self._addWorker();
  11623. };
  11624. _st(self["@queue"])._nextPut_(aBlock);
  11625. return self;
  11626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11627. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},globals.ForkPool)});
  11628. //>>excludeEnd("ctx");
  11629. },
  11630. //>>excludeStart("ide", pragmas.excludeIdeData);
  11631. args: ["aBlock"],
  11632. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  11633. referencedClasses: [],
  11634. //>>excludeEnd("ide");
  11635. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  11636. }),
  11637. globals.ForkPool);
  11638. smalltalk.addMethod(
  11639. smalltalk.method({
  11640. selector: "initialize",
  11641. protocol: 'initialization',
  11642. fn: function (){
  11643. var self=this;
  11644. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  11645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11646. return smalltalk.withContext(function($ctx1) {
  11647. //>>excludeEnd("ctx");
  11648. (
  11649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11650. $ctx1.supercall = true,
  11651. //>>excludeEnd("ctx");
  11652. globals.ForkPool.superclass.fn.prototype._initialize.apply(_st(self), []));
  11653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11654. $ctx1.supercall = false;
  11655. //>>excludeEnd("ctx");;
  11656. self["@poolSize"]=(0);
  11657. self["@queue"]=_st($Queue())._new();
  11658. self["@worker"]=self._makeWorker();
  11659. return self;
  11660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11661. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ForkPool)});
  11662. //>>excludeEnd("ctx");
  11663. },
  11664. //>>excludeStart("ide", pragmas.excludeIdeData);
  11665. args: [],
  11666. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  11667. referencedClasses: ["Queue"],
  11668. //>>excludeEnd("ide");
  11669. messageSends: ["initialize", "new", "makeWorker"]
  11670. }),
  11671. globals.ForkPool);
  11672. smalltalk.addMethod(
  11673. smalltalk.method({
  11674. selector: "makeWorker",
  11675. protocol: 'initialization',
  11676. fn: function (){
  11677. var self=this;
  11678. var sentinel;
  11679. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  11680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11681. return smalltalk.withContext(function($ctx1) {
  11682. //>>excludeEnd("ctx");
  11683. var $2,$1;
  11684. sentinel=_st($Object())._new();
  11685. $1=(function(){
  11686. var block;
  11687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11688. return smalltalk.withContext(function($ctx2) {
  11689. //>>excludeEnd("ctx");
  11690. self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  11691. self["@poolSize"];
  11692. block=_st(self["@queue"])._nextIfAbsent_((function(){
  11693. return sentinel;
  11694. }));
  11695. block;
  11696. $2=_st(block).__eq_eq(sentinel);
  11697. if(! smalltalk.assert($2)){
  11698. return _st((function(){
  11699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11700. return smalltalk.withContext(function($ctx3) {
  11701. //>>excludeEnd("ctx");
  11702. return _st(block)._value();
  11703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11704. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  11705. //>>excludeEnd("ctx");
  11706. }))._ensure_((function(){
  11707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11708. return smalltalk.withContext(function($ctx3) {
  11709. //>>excludeEnd("ctx");
  11710. return self._addWorker();
  11711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11712. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  11713. //>>excludeEnd("ctx");
  11714. }));
  11715. };
  11716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11717. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  11718. //>>excludeEnd("ctx");
  11719. });
  11720. return $1;
  11721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11722. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},globals.ForkPool)});
  11723. //>>excludeEnd("ctx");
  11724. },
  11725. //>>excludeStart("ide", pragmas.excludeIdeData);
  11726. args: [],
  11727. 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 ] ]]",
  11728. referencedClasses: ["Object"],
  11729. //>>excludeEnd("ide");
  11730. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  11731. }),
  11732. globals.ForkPool);
  11733. smalltalk.addMethod(
  11734. smalltalk.method({
  11735. selector: "maxPoolSize",
  11736. protocol: 'accessing',
  11737. fn: function (){
  11738. var self=this;
  11739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11740. return smalltalk.withContext(function($ctx1) {
  11741. //>>excludeEnd("ctx");
  11742. var $2,$1,$receiver;
  11743. $2=self["@maxPoolSize"];
  11744. if(($receiver = $2) == null || $receiver.isNil){
  11745. $1=self._defaultMaxPoolSize();
  11746. } else {
  11747. $1=$2;
  11748. };
  11749. return $1;
  11750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11751. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},globals.ForkPool)});
  11752. //>>excludeEnd("ctx");
  11753. },
  11754. //>>excludeStart("ide", pragmas.excludeIdeData);
  11755. args: [],
  11756. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  11757. referencedClasses: [],
  11758. //>>excludeEnd("ide");
  11759. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  11760. }),
  11761. globals.ForkPool);
  11762. smalltalk.addMethod(
  11763. smalltalk.method({
  11764. selector: "maxPoolSize:",
  11765. protocol: 'accessing',
  11766. fn: function (anInteger){
  11767. var self=this;
  11768. self["@maxPoolSize"]=anInteger;
  11769. return self;
  11770. },
  11771. //>>excludeStart("ide", pragmas.excludeIdeData);
  11772. args: ["anInteger"],
  11773. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  11774. referencedClasses: [],
  11775. //>>excludeEnd("ide");
  11776. messageSends: []
  11777. }),
  11778. globals.ForkPool);
  11779. globals.ForkPool.klass.iVarNames = ['default'];
  11780. smalltalk.addMethod(
  11781. smalltalk.method({
  11782. selector: "default",
  11783. protocol: 'accessing',
  11784. fn: function (){
  11785. var self=this;
  11786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11787. return smalltalk.withContext(function($ctx1) {
  11788. //>>excludeEnd("ctx");
  11789. var $2,$1,$receiver;
  11790. $2=self["@default"];
  11791. if(($receiver = $2) == null || $receiver.isNil){
  11792. self["@default"]=self._new();
  11793. $1=self["@default"];
  11794. } else {
  11795. $1=$2;
  11796. };
  11797. return $1;
  11798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11799. }, function($ctx1) {$ctx1.fill(self,"default",{},globals.ForkPool.klass)});
  11800. //>>excludeEnd("ctx");
  11801. },
  11802. //>>excludeStart("ide", pragmas.excludeIdeData);
  11803. args: [],
  11804. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  11805. referencedClasses: [],
  11806. //>>excludeEnd("ide");
  11807. messageSends: ["ifNil:", "new"]
  11808. }),
  11809. globals.ForkPool.klass);
  11810. smalltalk.addMethod(
  11811. smalltalk.method({
  11812. selector: "defaultMaxPoolSize",
  11813. protocol: 'accessing',
  11814. fn: function (){
  11815. var self=this;
  11816. return (100);
  11817. },
  11818. //>>excludeStart("ide", pragmas.excludeIdeData);
  11819. args: [],
  11820. source: "defaultMaxPoolSize\x0a\x09^ 100",
  11821. referencedClasses: [],
  11822. //>>excludeEnd("ide");
  11823. messageSends: []
  11824. }),
  11825. globals.ForkPool.klass);
  11826. smalltalk.addMethod(
  11827. smalltalk.method({
  11828. selector: "resetDefault",
  11829. protocol: 'accessing',
  11830. fn: function (){
  11831. var self=this;
  11832. self["@default"]=nil;
  11833. return self;
  11834. },
  11835. //>>excludeStart("ide", pragmas.excludeIdeData);
  11836. args: [],
  11837. source: "resetDefault\x0a\x09default := nil",
  11838. referencedClasses: [],
  11839. //>>excludeEnd("ide");
  11840. messageSends: []
  11841. }),
  11842. globals.ForkPool.klass);
  11843. smalltalk.addClass('Message', globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  11844. //>>excludeStart("ide", pragmas.excludeIdeData);
  11845. 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.";
  11846. //>>excludeEnd("ide");
  11847. smalltalk.addMethod(
  11848. smalltalk.method({
  11849. selector: "arguments",
  11850. protocol: 'accessing',
  11851. fn: function (){
  11852. var self=this;
  11853. var $1;
  11854. $1=self["@arguments"];
  11855. return $1;
  11856. },
  11857. //>>excludeStart("ide", pragmas.excludeIdeData);
  11858. args: [],
  11859. source: "arguments\x0a\x09^ arguments",
  11860. referencedClasses: [],
  11861. //>>excludeEnd("ide");
  11862. messageSends: []
  11863. }),
  11864. globals.Message);
  11865. smalltalk.addMethod(
  11866. smalltalk.method({
  11867. selector: "arguments:",
  11868. protocol: 'accessing',
  11869. fn: function (anArray){
  11870. var self=this;
  11871. self["@arguments"]=anArray;
  11872. return self;
  11873. },
  11874. //>>excludeStart("ide", pragmas.excludeIdeData);
  11875. args: ["anArray"],
  11876. source: "arguments: anArray\x0a\x09arguments := anArray",
  11877. referencedClasses: [],
  11878. //>>excludeEnd("ide");
  11879. messageSends: []
  11880. }),
  11881. globals.Message);
  11882. smalltalk.addMethod(
  11883. smalltalk.method({
  11884. selector: "printOn:",
  11885. protocol: 'printing',
  11886. fn: function (aStream){
  11887. var self=this;
  11888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11889. return smalltalk.withContext(function($ctx1) {
  11890. //>>excludeEnd("ctx");
  11891. var $1;
  11892. (
  11893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11894. $ctx1.supercall = true,
  11895. //>>excludeEnd("ctx");
  11896. globals.Message.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  11897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11898. $ctx1.supercall = false;
  11899. //>>excludeEnd("ctx");;
  11900. _st(aStream)._nextPutAll_("(");
  11901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11902. $ctx1.sendIdx["nextPutAll:"]=1;
  11903. //>>excludeEnd("ctx");
  11904. _st(aStream)._nextPutAll_(self._selector());
  11905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11906. $ctx1.sendIdx["nextPutAll:"]=2;
  11907. //>>excludeEnd("ctx");
  11908. $1=_st(aStream)._nextPutAll_(")");
  11909. return self;
  11910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11911. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Message)});
  11912. //>>excludeEnd("ctx");
  11913. },
  11914. //>>excludeStart("ide", pragmas.excludeIdeData);
  11915. args: ["aStream"],
  11916. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  11917. referencedClasses: [],
  11918. //>>excludeEnd("ide");
  11919. messageSends: ["printOn:", "nextPutAll:", "selector"]
  11920. }),
  11921. globals.Message);
  11922. smalltalk.addMethod(
  11923. smalltalk.method({
  11924. selector: "selector",
  11925. protocol: 'accessing',
  11926. fn: function (){
  11927. var self=this;
  11928. var $1;
  11929. $1=self["@selector"];
  11930. return $1;
  11931. },
  11932. //>>excludeStart("ide", pragmas.excludeIdeData);
  11933. args: [],
  11934. source: "selector\x0a\x09^ selector",
  11935. referencedClasses: [],
  11936. //>>excludeEnd("ide");
  11937. messageSends: []
  11938. }),
  11939. globals.Message);
  11940. smalltalk.addMethod(
  11941. smalltalk.method({
  11942. selector: "selector:",
  11943. protocol: 'accessing',
  11944. fn: function (aString){
  11945. var self=this;
  11946. self["@selector"]=aString;
  11947. return self;
  11948. },
  11949. //>>excludeStart("ide", pragmas.excludeIdeData);
  11950. args: ["aString"],
  11951. source: "selector: aString\x0a\x09selector := aString",
  11952. referencedClasses: [],
  11953. //>>excludeEnd("ide");
  11954. messageSends: []
  11955. }),
  11956. globals.Message);
  11957. smalltalk.addMethod(
  11958. smalltalk.method({
  11959. selector: "sendTo:",
  11960. protocol: 'actions',
  11961. fn: function (anObject){
  11962. var self=this;
  11963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11964. return smalltalk.withContext(function($ctx1) {
  11965. //>>excludeEnd("ctx");
  11966. var $1;
  11967. $1=_st(anObject)._perform_withArguments_(self._selector(),self._arguments());
  11968. return $1;
  11969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11970. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},globals.Message)});
  11971. //>>excludeEnd("ctx");
  11972. },
  11973. //>>excludeStart("ide", pragmas.excludeIdeData);
  11974. args: ["anObject"],
  11975. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  11976. referencedClasses: [],
  11977. //>>excludeEnd("ide");
  11978. messageSends: ["perform:withArguments:", "selector", "arguments"]
  11979. }),
  11980. globals.Message);
  11981. smalltalk.addMethod(
  11982. smalltalk.method({
  11983. selector: "selector:arguments:",
  11984. protocol: 'instance creation',
  11985. fn: function (aString,anArray){
  11986. var self=this;
  11987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11988. return smalltalk.withContext(function($ctx1) {
  11989. //>>excludeEnd("ctx");
  11990. var $2,$3,$1;
  11991. $2=self._new();
  11992. _st($2)._selector_(aString);
  11993. _st($2)._arguments_(anArray);
  11994. $3=_st($2)._yourself();
  11995. $1=$3;
  11996. return $1;
  11997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  11998. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},globals.Message.klass)});
  11999. //>>excludeEnd("ctx");
  12000. },
  12001. //>>excludeStart("ide", pragmas.excludeIdeData);
  12002. args: ["aString", "anArray"],
  12003. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  12004. referencedClasses: [],
  12005. //>>excludeEnd("ide");
  12006. messageSends: ["selector:", "new", "arguments:", "yourself"]
  12007. }),
  12008. globals.Message.klass);
  12009. smalltalk.addClass('MessageSend', globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  12010. //>>excludeStart("ide", pragmas.excludeIdeData);
  12011. 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.";
  12012. //>>excludeEnd("ide");
  12013. smalltalk.addMethod(
  12014. smalltalk.method({
  12015. selector: "arguments",
  12016. protocol: 'accessing',
  12017. fn: function (){
  12018. var self=this;
  12019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12020. return smalltalk.withContext(function($ctx1) {
  12021. //>>excludeEnd("ctx");
  12022. var $1;
  12023. $1=_st(self["@message"])._arguments();
  12024. return $1;
  12025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12026. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MessageSend)});
  12027. //>>excludeEnd("ctx");
  12028. },
  12029. //>>excludeStart("ide", pragmas.excludeIdeData);
  12030. args: [],
  12031. source: "arguments\x0a\x09^ message arguments",
  12032. referencedClasses: [],
  12033. //>>excludeEnd("ide");
  12034. messageSends: ["arguments"]
  12035. }),
  12036. globals.MessageSend);
  12037. smalltalk.addMethod(
  12038. smalltalk.method({
  12039. selector: "arguments:",
  12040. protocol: 'accessing',
  12041. fn: function (aCollection){
  12042. var self=this;
  12043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12044. return smalltalk.withContext(function($ctx1) {
  12045. //>>excludeEnd("ctx");
  12046. _st(self["@message"])._arguments_(aCollection);
  12047. return self;
  12048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12049. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.MessageSend)});
  12050. //>>excludeEnd("ctx");
  12051. },
  12052. //>>excludeStart("ide", pragmas.excludeIdeData);
  12053. args: ["aCollection"],
  12054. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  12055. referencedClasses: [],
  12056. //>>excludeEnd("ide");
  12057. messageSends: ["arguments:"]
  12058. }),
  12059. globals.MessageSend);
  12060. smalltalk.addMethod(
  12061. smalltalk.method({
  12062. selector: "initialize",
  12063. protocol: 'initialization',
  12064. fn: function (){
  12065. var self=this;
  12066. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  12067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12068. return smalltalk.withContext(function($ctx1) {
  12069. //>>excludeEnd("ctx");
  12070. (
  12071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12072. $ctx1.supercall = true,
  12073. //>>excludeEnd("ctx");
  12074. globals.MessageSend.superclass.fn.prototype._initialize.apply(_st(self), []));
  12075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12076. $ctx1.supercall = false;
  12077. //>>excludeEnd("ctx");;
  12078. self["@message"]=_st($Message())._new();
  12079. return self;
  12080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12081. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MessageSend)});
  12082. //>>excludeEnd("ctx");
  12083. },
  12084. //>>excludeStart("ide", pragmas.excludeIdeData);
  12085. args: [],
  12086. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  12087. referencedClasses: ["Message"],
  12088. //>>excludeEnd("ide");
  12089. messageSends: ["initialize", "new"]
  12090. }),
  12091. globals.MessageSend);
  12092. smalltalk.addMethod(
  12093. smalltalk.method({
  12094. selector: "printOn:",
  12095. protocol: 'printing',
  12096. fn: function (aStream){
  12097. var self=this;
  12098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12099. return smalltalk.withContext(function($ctx1) {
  12100. //>>excludeEnd("ctx");
  12101. var $1;
  12102. (
  12103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12104. $ctx1.supercall = true,
  12105. //>>excludeEnd("ctx");
  12106. globals.MessageSend.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  12107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12108. $ctx1.supercall = false;
  12109. //>>excludeEnd("ctx");;
  12110. _st(aStream)._nextPutAll_("(");
  12111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12112. $ctx1.sendIdx["nextPutAll:"]=1;
  12113. //>>excludeEnd("ctx");
  12114. _st(aStream)._nextPutAll_(self._receiver());
  12115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12116. $ctx1.sendIdx["nextPutAll:"]=2;
  12117. //>>excludeEnd("ctx");
  12118. _st(aStream)._nextPutAll_(" >> ");
  12119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12120. $ctx1.sendIdx["nextPutAll:"]=3;
  12121. //>>excludeEnd("ctx");
  12122. _st(aStream)._nextPutAll_(self._selector());
  12123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12124. $ctx1.sendIdx["nextPutAll:"]=4;
  12125. //>>excludeEnd("ctx");
  12126. $1=_st(aStream)._nextPutAll_(")");
  12127. return self;
  12128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12129. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MessageSend)});
  12130. //>>excludeEnd("ctx");
  12131. },
  12132. //>>excludeStart("ide", pragmas.excludeIdeData);
  12133. args: ["aStream"],
  12134. 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: ')'",
  12135. referencedClasses: [],
  12136. //>>excludeEnd("ide");
  12137. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  12138. }),
  12139. globals.MessageSend);
  12140. smalltalk.addMethod(
  12141. smalltalk.method({
  12142. selector: "receiver",
  12143. protocol: 'accessing',
  12144. fn: function (){
  12145. var self=this;
  12146. var $1;
  12147. $1=self["@receiver"];
  12148. return $1;
  12149. },
  12150. //>>excludeStart("ide", pragmas.excludeIdeData);
  12151. args: [],
  12152. source: "receiver\x0a\x09^ receiver",
  12153. referencedClasses: [],
  12154. //>>excludeEnd("ide");
  12155. messageSends: []
  12156. }),
  12157. globals.MessageSend);
  12158. smalltalk.addMethod(
  12159. smalltalk.method({
  12160. selector: "receiver:",
  12161. protocol: 'accessing',
  12162. fn: function (anObject){
  12163. var self=this;
  12164. self["@receiver"]=anObject;
  12165. return self;
  12166. },
  12167. //>>excludeStart("ide", pragmas.excludeIdeData);
  12168. args: ["anObject"],
  12169. source: "receiver: anObject\x0a\x09receiver := anObject",
  12170. referencedClasses: [],
  12171. //>>excludeEnd("ide");
  12172. messageSends: []
  12173. }),
  12174. globals.MessageSend);
  12175. smalltalk.addMethod(
  12176. smalltalk.method({
  12177. selector: "selector",
  12178. protocol: 'accessing',
  12179. fn: function (){
  12180. var self=this;
  12181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12182. return smalltalk.withContext(function($ctx1) {
  12183. //>>excludeEnd("ctx");
  12184. var $1;
  12185. $1=_st(self["@message"])._selector();
  12186. return $1;
  12187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12188. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MessageSend)});
  12189. //>>excludeEnd("ctx");
  12190. },
  12191. //>>excludeStart("ide", pragmas.excludeIdeData);
  12192. args: [],
  12193. source: "selector\x0a\x09^ message selector",
  12194. referencedClasses: [],
  12195. //>>excludeEnd("ide");
  12196. messageSends: ["selector"]
  12197. }),
  12198. globals.MessageSend);
  12199. smalltalk.addMethod(
  12200. smalltalk.method({
  12201. selector: "selector:",
  12202. protocol: 'accessing',
  12203. fn: function (aString){
  12204. var self=this;
  12205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12206. return smalltalk.withContext(function($ctx1) {
  12207. //>>excludeEnd("ctx");
  12208. _st(self["@message"])._selector_(aString);
  12209. return self;
  12210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12211. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},globals.MessageSend)});
  12212. //>>excludeEnd("ctx");
  12213. },
  12214. //>>excludeStart("ide", pragmas.excludeIdeData);
  12215. args: ["aString"],
  12216. source: "selector: aString\x0a\x09message selector: aString",
  12217. referencedClasses: [],
  12218. //>>excludeEnd("ide");
  12219. messageSends: ["selector:"]
  12220. }),
  12221. globals.MessageSend);
  12222. smalltalk.addMethod(
  12223. smalltalk.method({
  12224. selector: "value",
  12225. protocol: 'evaluating',
  12226. fn: function (){
  12227. var self=this;
  12228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12229. return smalltalk.withContext(function($ctx1) {
  12230. //>>excludeEnd("ctx");
  12231. var $1;
  12232. $1=_st(self["@message"])._sendTo_(self._receiver());
  12233. return $1;
  12234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12235. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.MessageSend)});
  12236. //>>excludeEnd("ctx");
  12237. },
  12238. //>>excludeStart("ide", pragmas.excludeIdeData);
  12239. args: [],
  12240. source: "value\x0a\x09^ message sendTo: self receiver",
  12241. referencedClasses: [],
  12242. //>>excludeEnd("ide");
  12243. messageSends: ["sendTo:", "receiver"]
  12244. }),
  12245. globals.MessageSend);
  12246. smalltalk.addMethod(
  12247. smalltalk.method({
  12248. selector: "value:",
  12249. protocol: 'evaluating',
  12250. fn: function (anObject){
  12251. var self=this;
  12252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12253. return smalltalk.withContext(function($ctx1) {
  12254. //>>excludeEnd("ctx");
  12255. var $2,$3,$1;
  12256. $2=self["@message"];
  12257. _st($2)._arguments_([anObject]);
  12258. $3=_st($2)._sendTo_(self._receiver());
  12259. $1=$3;
  12260. return $1;
  12261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12262. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.MessageSend)});
  12263. //>>excludeEnd("ctx");
  12264. },
  12265. //>>excludeStart("ide", pragmas.excludeIdeData);
  12266. args: ["anObject"],
  12267. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  12268. referencedClasses: [],
  12269. //>>excludeEnd("ide");
  12270. messageSends: ["arguments:", "sendTo:", "receiver"]
  12271. }),
  12272. globals.MessageSend);
  12273. smalltalk.addMethod(
  12274. smalltalk.method({
  12275. selector: "value:value:",
  12276. protocol: 'evaluating',
  12277. fn: function (firstArgument,secondArgument){
  12278. var self=this;
  12279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12280. return smalltalk.withContext(function($ctx1) {
  12281. //>>excludeEnd("ctx");
  12282. var $2,$3,$1;
  12283. $2=self["@message"];
  12284. _st($2)._arguments_([firstArgument,secondArgument]);
  12285. $3=_st($2)._sendTo_(self._receiver());
  12286. $1=$3;
  12287. return $1;
  12288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12289. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.MessageSend)});
  12290. //>>excludeEnd("ctx");
  12291. },
  12292. //>>excludeStart("ide", pragmas.excludeIdeData);
  12293. args: ["firstArgument", "secondArgument"],
  12294. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  12295. referencedClasses: [],
  12296. //>>excludeEnd("ide");
  12297. messageSends: ["arguments:", "sendTo:", "receiver"]
  12298. }),
  12299. globals.MessageSend);
  12300. smalltalk.addMethod(
  12301. smalltalk.method({
  12302. selector: "value:value:value:",
  12303. protocol: 'evaluating',
  12304. fn: function (firstArgument,secondArgument,thirdArgument){
  12305. var self=this;
  12306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12307. return smalltalk.withContext(function($ctx1) {
  12308. //>>excludeEnd("ctx");
  12309. var $2,$3,$1;
  12310. $2=self["@message"];
  12311. _st($2)._arguments_([firstArgument,secondArgument,thirdArgument]);
  12312. $3=_st($2)._sendTo_(self._receiver());
  12313. $1=$3;
  12314. return $1;
  12315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12316. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.MessageSend)});
  12317. //>>excludeEnd("ctx");
  12318. },
  12319. //>>excludeStart("ide", pragmas.excludeIdeData);
  12320. args: ["firstArgument", "secondArgument", "thirdArgument"],
  12321. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  12322. referencedClasses: [],
  12323. //>>excludeEnd("ide");
  12324. messageSends: ["arguments:", "sendTo:", "receiver"]
  12325. }),
  12326. globals.MessageSend);
  12327. smalltalk.addMethod(
  12328. smalltalk.method({
  12329. selector: "valueWithPossibleArguments:",
  12330. protocol: 'evaluating',
  12331. fn: function (aCollection){
  12332. var self=this;
  12333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12334. return smalltalk.withContext(function($ctx1) {
  12335. //>>excludeEnd("ctx");
  12336. var $1;
  12337. self._arguments_(aCollection);
  12338. $1=self._value();
  12339. return $1;
  12340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12341. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},globals.MessageSend)});
  12342. //>>excludeEnd("ctx");
  12343. },
  12344. //>>excludeStart("ide", pragmas.excludeIdeData);
  12345. args: ["aCollection"],
  12346. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  12347. referencedClasses: [],
  12348. //>>excludeEnd("ide");
  12349. messageSends: ["arguments:", "value"]
  12350. }),
  12351. globals.MessageSend);
  12352. smalltalk.addClass('MethodContext', globals.Object, [], 'Kernel-Methods');
  12353. //>>excludeStart("ide", pragmas.excludeIdeData);
  12354. 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`.";
  12355. //>>excludeEnd("ide");
  12356. smalltalk.addMethod(
  12357. smalltalk.method({
  12358. selector: "asString",
  12359. protocol: 'converting',
  12360. fn: function (){
  12361. var self=this;
  12362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12363. return smalltalk.withContext(function($ctx1) {
  12364. //>>excludeEnd("ctx");
  12365. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  12366. $2=self._isBlockContext();
  12367. if(smalltalk.assert($2)){
  12368. $3="a block (in ".__comma(_st(self._methodContext())._asString());
  12369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12370. $ctx1.sendIdx[","]=2;
  12371. //>>excludeEnd("ctx");
  12372. $1=_st($3).__comma(")");
  12373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12374. $ctx1.sendIdx[","]=1;
  12375. //>>excludeEnd("ctx");
  12376. } else {
  12377. var methodClass;
  12378. methodClass=_st(self._method())._methodClass();
  12379. methodClass;
  12380. $5=methodClass;
  12381. $7=self._receiver();
  12382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12383. $ctx1.sendIdx["receiver"]=1;
  12384. //>>excludeEnd("ctx");
  12385. $6=_st($7)._class();
  12386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12387. $ctx1.sendIdx["class"]=1;
  12388. //>>excludeEnd("ctx");
  12389. $4=_st($5).__eq($6);
  12390. if(smalltalk.assert($4)){
  12391. $11=self._receiver();
  12392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12393. $ctx1.sendIdx["receiver"]=2;
  12394. //>>excludeEnd("ctx");
  12395. $10=_st($11)._class();
  12396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12397. $ctx1.sendIdx["class"]=2;
  12398. //>>excludeEnd("ctx");
  12399. $9=_st($10)._name();
  12400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12401. $ctx1.sendIdx["name"]=1;
  12402. //>>excludeEnd("ctx");
  12403. $8=_st($9).__comma(" >> ");
  12404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12405. $ctx1.sendIdx[","]=4;
  12406. //>>excludeEnd("ctx");
  12407. $12=self._selector();
  12408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12409. $ctx1.sendIdx["selector"]=1;
  12410. //>>excludeEnd("ctx");
  12411. $1=_st($8).__comma($12);
  12412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12413. $ctx1.sendIdx[","]=3;
  12414. //>>excludeEnd("ctx");
  12415. } else {
  12416. $16=_st(_st(self._receiver())._class())._name();
  12417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12418. $ctx1.sendIdx["name"]=2;
  12419. //>>excludeEnd("ctx");
  12420. $15=_st($16).__comma("(");
  12421. $14=_st($15).__comma(_st(methodClass)._name());
  12422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12423. $ctx1.sendIdx[","]=7;
  12424. //>>excludeEnd("ctx");
  12425. $13=_st($14).__comma(") >> ");
  12426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12427. $ctx1.sendIdx[","]=6;
  12428. //>>excludeEnd("ctx");
  12429. $1=_st($13).__comma(self._selector());
  12430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12431. $ctx1.sendIdx[","]=5;
  12432. //>>excludeEnd("ctx");
  12433. };
  12434. };
  12435. return $1;
  12436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12437. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.MethodContext)});
  12438. //>>excludeEnd("ctx");
  12439. },
  12440. //>>excludeStart("ide", pragmas.excludeIdeData);
  12441. args: [],
  12442. 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 ] ]",
  12443. referencedClasses: [],
  12444. //>>excludeEnd("ide");
  12445. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  12446. }),
  12447. globals.MethodContext);
  12448. smalltalk.addMethod(
  12449. smalltalk.method({
  12450. selector: "basicReceiver",
  12451. protocol: 'accessing',
  12452. fn: function (){
  12453. var self=this;
  12454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12455. return smalltalk.withContext(function($ctx1) {
  12456. //>>excludeEnd("ctx");
  12457. return self.receiver;
  12458. return self;
  12459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12460. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.MethodContext)});
  12461. //>>excludeEnd("ctx");
  12462. },
  12463. //>>excludeStart("ide", pragmas.excludeIdeData);
  12464. args: [],
  12465. source: "basicReceiver\x0a\x09<return self.receiver>",
  12466. referencedClasses: [],
  12467. //>>excludeEnd("ide");
  12468. messageSends: []
  12469. }),
  12470. globals.MethodContext);
  12471. smalltalk.addMethod(
  12472. smalltalk.method({
  12473. selector: "evaluatedSelector",
  12474. protocol: 'accessing',
  12475. fn: function (){
  12476. var self=this;
  12477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12478. return smalltalk.withContext(function($ctx1) {
  12479. //>>excludeEnd("ctx");
  12480. return self.evaluatedSelector;
  12481. return self;
  12482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12483. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},globals.MethodContext)});
  12484. //>>excludeEnd("ctx");
  12485. },
  12486. //>>excludeStart("ide", pragmas.excludeIdeData);
  12487. args: [],
  12488. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  12489. referencedClasses: [],
  12490. //>>excludeEnd("ide");
  12491. messageSends: []
  12492. }),
  12493. globals.MethodContext);
  12494. smalltalk.addMethod(
  12495. smalltalk.method({
  12496. selector: "findContextSuchThat:",
  12497. protocol: 'accessing',
  12498. fn: function (testBlock){
  12499. var self=this;
  12500. var context;
  12501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12502. return smalltalk.withContext(function($ctx1) {
  12503. //>>excludeEnd("ctx");
  12504. var $1,$2;
  12505. var $early={};
  12506. try {
  12507. context=self;
  12508. _st((function(){
  12509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12510. return smalltalk.withContext(function($ctx2) {
  12511. //>>excludeEnd("ctx");
  12512. return _st(context)._isNil();
  12513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12515. //>>excludeEnd("ctx");
  12516. }))._whileFalse_((function(){
  12517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12518. return smalltalk.withContext(function($ctx2) {
  12519. //>>excludeEnd("ctx");
  12520. $1=_st(testBlock)._value_(context);
  12521. if(smalltalk.assert($1)){
  12522. $2=context;
  12523. throw $early=[$2];
  12524. };
  12525. context=_st(context)._outerContext();
  12526. return context;
  12527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12529. //>>excludeEnd("ctx");
  12530. }));
  12531. return nil;
  12532. }
  12533. catch(e) {if(e===$early)return e[0]; throw e}
  12534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12535. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},globals.MethodContext)});
  12536. //>>excludeEnd("ctx");
  12537. },
  12538. //>>excludeStart("ide", pragmas.excludeIdeData);
  12539. args: ["testBlock"],
  12540. 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",
  12541. referencedClasses: [],
  12542. //>>excludeEnd("ide");
  12543. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  12544. }),
  12545. globals.MethodContext);
  12546. smalltalk.addMethod(
  12547. smalltalk.method({
  12548. selector: "home",
  12549. protocol: 'accessing',
  12550. fn: function (){
  12551. var self=this;
  12552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12553. return smalltalk.withContext(function($ctx1) {
  12554. //>>excludeEnd("ctx");
  12555. return self.homeContext;
  12556. return self;
  12557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12558. }, function($ctx1) {$ctx1.fill(self,"home",{},globals.MethodContext)});
  12559. //>>excludeEnd("ctx");
  12560. },
  12561. //>>excludeStart("ide", pragmas.excludeIdeData);
  12562. args: [],
  12563. source: "home\x0a\x09<return self.homeContext>",
  12564. referencedClasses: [],
  12565. //>>excludeEnd("ide");
  12566. messageSends: []
  12567. }),
  12568. globals.MethodContext);
  12569. smalltalk.addMethod(
  12570. smalltalk.method({
  12571. selector: "index",
  12572. protocol: 'accessing',
  12573. fn: function (){
  12574. var self=this;
  12575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12576. return smalltalk.withContext(function($ctx1) {
  12577. //>>excludeEnd("ctx");
  12578. return self.index || 0;
  12579. return self;
  12580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12581. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.MethodContext)});
  12582. //>>excludeEnd("ctx");
  12583. },
  12584. //>>excludeStart("ide", pragmas.excludeIdeData);
  12585. args: [],
  12586. source: "index\x0a\x09<return self.index || 0>",
  12587. referencedClasses: [],
  12588. //>>excludeEnd("ide");
  12589. messageSends: []
  12590. }),
  12591. globals.MethodContext);
  12592. smalltalk.addMethod(
  12593. smalltalk.method({
  12594. selector: "isBlockContext",
  12595. protocol: 'testing',
  12596. fn: function (){
  12597. var self=this;
  12598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12599. return smalltalk.withContext(function($ctx1) {
  12600. //>>excludeEnd("ctx");
  12601. var $1;
  12602. $1=_st(self._selector())._isNil();
  12603. return $1;
  12604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12605. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},globals.MethodContext)});
  12606. //>>excludeEnd("ctx");
  12607. },
  12608. //>>excludeStart("ide", pragmas.excludeIdeData);
  12609. args: [],
  12610. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  12611. referencedClasses: [],
  12612. //>>excludeEnd("ide");
  12613. messageSends: ["isNil", "selector"]
  12614. }),
  12615. globals.MethodContext);
  12616. smalltalk.addMethod(
  12617. smalltalk.method({
  12618. selector: "locals",
  12619. protocol: 'accessing',
  12620. fn: function (){
  12621. var self=this;
  12622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12623. return smalltalk.withContext(function($ctx1) {
  12624. //>>excludeEnd("ctx");
  12625. return self.locals || {};
  12626. return self;
  12627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12628. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.MethodContext)});
  12629. //>>excludeEnd("ctx");
  12630. },
  12631. //>>excludeStart("ide", pragmas.excludeIdeData);
  12632. args: [],
  12633. source: "locals\x0a\x09<return self.locals || {}>",
  12634. referencedClasses: [],
  12635. //>>excludeEnd("ide");
  12636. messageSends: []
  12637. }),
  12638. globals.MethodContext);
  12639. smalltalk.addMethod(
  12640. smalltalk.method({
  12641. selector: "method",
  12642. protocol: 'accessing',
  12643. fn: function (){
  12644. var self=this;
  12645. var method,lookupClass,receiverClass,supercall;
  12646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12647. return smalltalk.withContext(function($ctx1) {
  12648. //>>excludeEnd("ctx");
  12649. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$receiver;
  12650. $1=self._methodContext();
  12651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12652. $ctx1.sendIdx["methodContext"]=1;
  12653. //>>excludeEnd("ctx");
  12654. if(($receiver = $1) == null || $receiver.isNil){
  12655. return nil;
  12656. } else {
  12657. $1;
  12658. };
  12659. $3=self._methodContext();
  12660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12661. $ctx1.sendIdx["methodContext"]=2;
  12662. //>>excludeEnd("ctx");
  12663. $2=_st($3)._receiver();
  12664. receiverClass=_st($2)._class();
  12665. $4=receiverClass;
  12666. $6=self._methodContext();
  12667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12668. $ctx1.sendIdx["methodContext"]=3;
  12669. //>>excludeEnd("ctx");
  12670. $5=_st($6)._selector();
  12671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12672. $ctx1.sendIdx["selector"]=1;
  12673. //>>excludeEnd("ctx");
  12674. method=_st($4)._lookupSelector_($5);
  12675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12676. $ctx1.sendIdx["lookupSelector:"]=1;
  12677. //>>excludeEnd("ctx");
  12678. $7=self._outerContext();
  12679. if(($receiver = $7) == null || $receiver.isNil){
  12680. supercall=false;
  12681. } else {
  12682. var outer;
  12683. outer=$receiver;
  12684. supercall=_st(outer)._supercall();
  12685. };
  12686. $9=supercall;
  12687. if(smalltalk.assert($9)){
  12688. $8=_st(_st(_st(method)._methodClass())._superclass())._lookupSelector_(_st(self._methodContext())._selector());
  12689. } else {
  12690. $8=method;
  12691. };
  12692. return $8;
  12693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12694. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},globals.MethodContext)});
  12695. //>>excludeEnd("ctx");
  12696. },
  12697. //>>excludeStart("ide", pragmas.excludeIdeData);
  12698. args: [],
  12699. 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 ]",
  12700. referencedClasses: [],
  12701. //>>excludeEnd("ide");
  12702. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  12703. }),
  12704. globals.MethodContext);
  12705. smalltalk.addMethod(
  12706. smalltalk.method({
  12707. selector: "methodContext",
  12708. protocol: 'accessing',
  12709. fn: function (){
  12710. var self=this;
  12711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12712. return smalltalk.withContext(function($ctx1) {
  12713. //>>excludeEnd("ctx");
  12714. var $1,$3,$2,$receiver;
  12715. $1=self._isBlockContext();
  12716. if(! smalltalk.assert($1)){
  12717. return self;
  12718. };
  12719. $3=self._outerContext();
  12720. if(($receiver = $3) == null || $receiver.isNil){
  12721. $2=$3;
  12722. } else {
  12723. var outer;
  12724. outer=$receiver;
  12725. $2=_st(outer)._methodContext();
  12726. };
  12727. return $2;
  12728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12729. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},globals.MethodContext)});
  12730. //>>excludeEnd("ctx");
  12731. },
  12732. //>>excludeStart("ide", pragmas.excludeIdeData);
  12733. args: [],
  12734. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  12735. referencedClasses: [],
  12736. //>>excludeEnd("ide");
  12737. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  12738. }),
  12739. globals.MethodContext);
  12740. smalltalk.addMethod(
  12741. smalltalk.method({
  12742. selector: "outerContext",
  12743. protocol: 'accessing',
  12744. fn: function (){
  12745. var self=this;
  12746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12747. return smalltalk.withContext(function($ctx1) {
  12748. //>>excludeEnd("ctx");
  12749. return self.outerContext || self.homeContext;
  12750. return self;
  12751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12752. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},globals.MethodContext)});
  12753. //>>excludeEnd("ctx");
  12754. },
  12755. //>>excludeStart("ide", pragmas.excludeIdeData);
  12756. args: [],
  12757. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  12758. referencedClasses: [],
  12759. //>>excludeEnd("ide");
  12760. messageSends: []
  12761. }),
  12762. globals.MethodContext);
  12763. smalltalk.addMethod(
  12764. smalltalk.method({
  12765. selector: "printOn:",
  12766. protocol: 'printing',
  12767. fn: function (aStream){
  12768. var self=this;
  12769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12770. return smalltalk.withContext(function($ctx1) {
  12771. //>>excludeEnd("ctx");
  12772. var $1;
  12773. (
  12774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12775. $ctx1.supercall = true,
  12776. //>>excludeEnd("ctx");
  12777. globals.MethodContext.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  12778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12779. $ctx1.supercall = false;
  12780. //>>excludeEnd("ctx");;
  12781. _st(aStream)._nextPutAll_("(");
  12782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12783. $ctx1.sendIdx["nextPutAll:"]=1;
  12784. //>>excludeEnd("ctx");
  12785. _st(aStream)._nextPutAll_(self._asString());
  12786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12787. $ctx1.sendIdx["nextPutAll:"]=2;
  12788. //>>excludeEnd("ctx");
  12789. $1=_st(aStream)._nextPutAll_(")");
  12790. return self;
  12791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12792. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.MethodContext)});
  12793. //>>excludeEnd("ctx");
  12794. },
  12795. //>>excludeStart("ide", pragmas.excludeIdeData);
  12796. args: ["aStream"],
  12797. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  12798. referencedClasses: [],
  12799. //>>excludeEnd("ide");
  12800. messageSends: ["printOn:", "nextPutAll:", "asString"]
  12801. }),
  12802. globals.MethodContext);
  12803. smalltalk.addMethod(
  12804. smalltalk.method({
  12805. selector: "receiver",
  12806. protocol: 'accessing',
  12807. fn: function (){
  12808. var self=this;
  12809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12810. return smalltalk.withContext(function($ctx1) {
  12811. //>>excludeEnd("ctx");
  12812. var $3,$2,$1;
  12813. $2=_st(self._isBlockContext())._and_((function(){
  12814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12815. return smalltalk.withContext(function($ctx2) {
  12816. //>>excludeEnd("ctx");
  12817. $3=self._outerContext();
  12818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12819. $ctx2.sendIdx["outerContext"]=1;
  12820. //>>excludeEnd("ctx");
  12821. return _st($3)._notNil();
  12822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12824. //>>excludeEnd("ctx");
  12825. }));
  12826. if(smalltalk.assert($2)){
  12827. $1=_st(self._outerContext())._receiver();
  12828. } else {
  12829. $1=self._basicReceiver();
  12830. };
  12831. return $1;
  12832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12833. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.MethodContext)});
  12834. //>>excludeEnd("ctx");
  12835. },
  12836. //>>excludeStart("ide", pragmas.excludeIdeData);
  12837. args: [],
  12838. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  12839. referencedClasses: [],
  12840. //>>excludeEnd("ide");
  12841. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  12842. }),
  12843. globals.MethodContext);
  12844. smalltalk.addMethod(
  12845. smalltalk.method({
  12846. selector: "selector",
  12847. protocol: 'accessing',
  12848. fn: function (){
  12849. var self=this;
  12850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12851. return smalltalk.withContext(function($ctx1) {
  12852. //>>excludeEnd("ctx");
  12853. if(self.selector) {
  12854. return smalltalk.js2st(self.selector);
  12855. } else {
  12856. return nil;
  12857. }
  12858. ;
  12859. return self;
  12860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12861. }, function($ctx1) {$ctx1.fill(self,"selector",{},globals.MethodContext)});
  12862. //>>excludeEnd("ctx");
  12863. },
  12864. //>>excludeStart("ide", pragmas.excludeIdeData);
  12865. args: [],
  12866. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.js2st(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  12867. referencedClasses: [],
  12868. //>>excludeEnd("ide");
  12869. messageSends: []
  12870. }),
  12871. globals.MethodContext);
  12872. smalltalk.addMethod(
  12873. smalltalk.method({
  12874. selector: "sendIndexAt:",
  12875. protocol: 'accessing',
  12876. fn: function (aSelector){
  12877. var self=this;
  12878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12879. return smalltalk.withContext(function($ctx1) {
  12880. //>>excludeEnd("ctx");
  12881. return self.sendIdx[aSelector] || 0;
  12882. return self;
  12883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12884. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},globals.MethodContext)});
  12885. //>>excludeEnd("ctx");
  12886. },
  12887. //>>excludeStart("ide", pragmas.excludeIdeData);
  12888. args: ["aSelector"],
  12889. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  12890. referencedClasses: [],
  12891. //>>excludeEnd("ide");
  12892. messageSends: []
  12893. }),
  12894. globals.MethodContext);
  12895. smalltalk.addMethod(
  12896. smalltalk.method({
  12897. selector: "sendIndexes",
  12898. protocol: 'accessing',
  12899. fn: function (){
  12900. var self=this;
  12901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12902. return smalltalk.withContext(function($ctx1) {
  12903. //>>excludeEnd("ctx");
  12904. return self.sendIdx;
  12905. return self;
  12906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12907. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.MethodContext)});
  12908. //>>excludeEnd("ctx");
  12909. },
  12910. //>>excludeStart("ide", pragmas.excludeIdeData);
  12911. args: [],
  12912. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  12913. referencedClasses: [],
  12914. //>>excludeEnd("ide");
  12915. messageSends: []
  12916. }),
  12917. globals.MethodContext);
  12918. smalltalk.addMethod(
  12919. smalltalk.method({
  12920. selector: "supercall",
  12921. protocol: 'accessing',
  12922. fn: function (){
  12923. var self=this;
  12924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12925. return smalltalk.withContext(function($ctx1) {
  12926. //>>excludeEnd("ctx");
  12927. return self.supercall == true;
  12928. return self;
  12929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12930. }, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.MethodContext)});
  12931. //>>excludeEnd("ctx");
  12932. },
  12933. //>>excludeStart("ide", pragmas.excludeIdeData);
  12934. args: [],
  12935. source: "supercall\x0a\x09<return self.supercall == true>",
  12936. referencedClasses: [],
  12937. //>>excludeEnd("ide");
  12938. messageSends: []
  12939. }),
  12940. globals.MethodContext);
  12941. smalltalk.addMethod(
  12942. smalltalk.method({
  12943. selector: "temps",
  12944. protocol: 'accessing',
  12945. fn: function (){
  12946. var self=this;
  12947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12948. return smalltalk.withContext(function($ctx1) {
  12949. //>>excludeEnd("ctx");
  12950. var $1;
  12951. self._deprecatedAPI();
  12952. $1=self._locals();
  12953. return $1;
  12954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12955. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.MethodContext)});
  12956. //>>excludeEnd("ctx");
  12957. },
  12958. //>>excludeStart("ide", pragmas.excludeIdeData);
  12959. args: [],
  12960. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  12961. referencedClasses: [],
  12962. //>>excludeEnd("ide");
  12963. messageSends: ["deprecatedAPI", "locals"]
  12964. }),
  12965. globals.MethodContext);
  12966. smalltalk.addClass('NativeFunction', globals.Object, [], 'Kernel-Methods');
  12967. //>>excludeStart("ide", pragmas.excludeIdeData);
  12968. 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' ]";
  12969. //>>excludeEnd("ide");
  12970. smalltalk.addMethod(
  12971. smalltalk.method({
  12972. selector: "constructor:",
  12973. protocol: 'instance creation',
  12974. fn: function (aString){
  12975. var self=this;
  12976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12977. return smalltalk.withContext(function($ctx1) {
  12978. //>>excludeEnd("ctx");
  12979. var nativeFunc=eval(aString);
  12980. return new nativeFunc();
  12981. ;
  12982. return self;
  12983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  12984. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},globals.NativeFunction.klass)});
  12985. //>>excludeEnd("ctx");
  12986. },
  12987. //>>excludeStart("ide", pragmas.excludeIdeData);
  12988. args: ["aString"],
  12989. source: "constructor: aString\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  12990. referencedClasses: [],
  12991. //>>excludeEnd("ide");
  12992. messageSends: []
  12993. }),
  12994. globals.NativeFunction.klass);
  12995. smalltalk.addMethod(
  12996. smalltalk.method({
  12997. selector: "constructor:value:",
  12998. protocol: 'instance creation',
  12999. fn: function (aString,anObject){
  13000. var self=this;
  13001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13002. return smalltalk.withContext(function($ctx1) {
  13003. //>>excludeEnd("ctx");
  13004. var nativeFunc=eval(aString);
  13005. return new nativeFunc(anObject);
  13006. ;
  13007. return self;
  13008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13009. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},globals.NativeFunction.klass)});
  13010. //>>excludeEnd("ctx");
  13011. },
  13012. //>>excludeStart("ide", pragmas.excludeIdeData);
  13013. args: ["aString", "anObject"],
  13014. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  13015. referencedClasses: [],
  13016. //>>excludeEnd("ide");
  13017. messageSends: []
  13018. }),
  13019. globals.NativeFunction.klass);
  13020. smalltalk.addMethod(
  13021. smalltalk.method({
  13022. selector: "constructor:value:value:",
  13023. protocol: 'instance creation',
  13024. fn: function (aString,anObject,anObject2){
  13025. var self=this;
  13026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13027. return smalltalk.withContext(function($ctx1) {
  13028. //>>excludeEnd("ctx");
  13029. var nativeFunc=eval(aString);
  13030. return new nativeFunc(anObject,anObject2);
  13031. ;
  13032. return self;
  13033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13034. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},globals.NativeFunction.klass)});
  13035. //>>excludeEnd("ctx");
  13036. },
  13037. //>>excludeStart("ide", pragmas.excludeIdeData);
  13038. args: ["aString", "anObject", "anObject2"],
  13039. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  13040. referencedClasses: [],
  13041. //>>excludeEnd("ide");
  13042. messageSends: []
  13043. }),
  13044. globals.NativeFunction.klass);
  13045. smalltalk.addMethod(
  13046. smalltalk.method({
  13047. selector: "constructor:value:value:value:",
  13048. protocol: 'instance creation',
  13049. fn: function (aString,anObject,anObject2,anObject3){
  13050. var self=this;
  13051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13052. return smalltalk.withContext(function($ctx1) {
  13053. //>>excludeEnd("ctx");
  13054. var nativeFunc=eval(aString);
  13055. return new nativeFunc(anObject,anObject2, anObject3);
  13056. ;
  13057. return self;
  13058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13059. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.NativeFunction.klass)});
  13060. //>>excludeEnd("ctx");
  13061. },
  13062. //>>excludeStart("ide", pragmas.excludeIdeData);
  13063. args: ["aString", "anObject", "anObject2", "anObject3"],
  13064. 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>",
  13065. referencedClasses: [],
  13066. //>>excludeEnd("ide");
  13067. messageSends: []
  13068. }),
  13069. globals.NativeFunction.klass);
  13070. smalltalk.addMethod(
  13071. smalltalk.method({
  13072. selector: "exists:",
  13073. protocol: 'testing',
  13074. fn: function (aString){
  13075. var self=this;
  13076. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  13077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13078. return smalltalk.withContext(function($ctx1) {
  13079. //>>excludeEnd("ctx");
  13080. var $1;
  13081. $1=_st($PlatformInterface())._existsGlobal_(aString);
  13082. return $1;
  13083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13084. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},globals.NativeFunction.klass)});
  13085. //>>excludeEnd("ctx");
  13086. },
  13087. //>>excludeStart("ide", pragmas.excludeIdeData);
  13088. args: ["aString"],
  13089. source: "exists: aString\x0a\x09^ PlatformInterface existsGlobal: aString",
  13090. referencedClasses: ["PlatformInterface"],
  13091. //>>excludeEnd("ide");
  13092. messageSends: ["existsGlobal:"]
  13093. }),
  13094. globals.NativeFunction.klass);
  13095. smalltalk.addClass('Timeout', globals.Object, ['rawTimeout'], 'Kernel-Methods');
  13096. //>>excludeStart("ide", pragmas.excludeIdeData);
  13097. 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.";
  13098. //>>excludeEnd("ide");
  13099. smalltalk.addMethod(
  13100. smalltalk.method({
  13101. selector: "clearInterval",
  13102. protocol: 'timeout/interval',
  13103. fn: function (){
  13104. var self=this;
  13105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13106. return smalltalk.withContext(function($ctx1) {
  13107. //>>excludeEnd("ctx");
  13108. var interval = self["@rawTimeout"];
  13109. clearInterval(interval);
  13110. ;
  13111. return self;
  13112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13113. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},globals.Timeout)});
  13114. //>>excludeEnd("ctx");
  13115. },
  13116. //>>excludeStart("ide", pragmas.excludeIdeData);
  13117. args: [],
  13118. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  13119. referencedClasses: [],
  13120. //>>excludeEnd("ide");
  13121. messageSends: []
  13122. }),
  13123. globals.Timeout);
  13124. smalltalk.addMethod(
  13125. smalltalk.method({
  13126. selector: "clearTimeout",
  13127. protocol: 'timeout/interval',
  13128. fn: function (){
  13129. var self=this;
  13130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13131. return smalltalk.withContext(function($ctx1) {
  13132. //>>excludeEnd("ctx");
  13133. var timeout = self["@rawTimeout"];
  13134. clearTimeout(timeout);
  13135. ;
  13136. return self;
  13137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13138. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},globals.Timeout)});
  13139. //>>excludeEnd("ctx");
  13140. },
  13141. //>>excludeStart("ide", pragmas.excludeIdeData);
  13142. args: [],
  13143. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  13144. referencedClasses: [],
  13145. //>>excludeEnd("ide");
  13146. messageSends: []
  13147. }),
  13148. globals.Timeout);
  13149. smalltalk.addMethod(
  13150. smalltalk.method({
  13151. selector: "rawTimeout:",
  13152. protocol: 'accessing',
  13153. fn: function (anObject){
  13154. var self=this;
  13155. self["@rawTimeout"]=anObject;
  13156. return self;
  13157. },
  13158. //>>excludeStart("ide", pragmas.excludeIdeData);
  13159. args: ["anObject"],
  13160. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  13161. referencedClasses: [],
  13162. //>>excludeEnd("ide");
  13163. messageSends: []
  13164. }),
  13165. globals.Timeout);
  13166. smalltalk.addMethod(
  13167. smalltalk.method({
  13168. selector: "on:",
  13169. protocol: 'instance creation',
  13170. fn: function (anObject){
  13171. var self=this;
  13172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13173. return smalltalk.withContext(function($ctx1) {
  13174. //>>excludeEnd("ctx");
  13175. var $2,$3,$1;
  13176. $2=self._new();
  13177. _st($2)._rawTimeout_(anObject);
  13178. $3=_st($2)._yourself();
  13179. $1=$3;
  13180. return $1;
  13181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13182. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},globals.Timeout.klass)});
  13183. //>>excludeEnd("ctx");
  13184. },
  13185. //>>excludeStart("ide", pragmas.excludeIdeData);
  13186. args: ["anObject"],
  13187. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  13188. referencedClasses: [],
  13189. //>>excludeEnd("ide");
  13190. messageSends: ["rawTimeout:", "new", "yourself"]
  13191. }),
  13192. globals.Timeout.klass);
  13193. });
  13194. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  13195. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  13196. smalltalk.addPackage('Kernel-Collections');
  13197. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  13198. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  13199. //>>excludeStart("ide", pragmas.excludeIdeData);
  13200. 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:`";
  13201. //>>excludeEnd("ide");
  13202. smalltalk.addMethod(
  13203. smalltalk.method({
  13204. selector: "=",
  13205. protocol: 'comparing',
  13206. fn: function (anAssociation){
  13207. var self=this;
  13208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13209. return smalltalk.withContext(function($ctx1) {
  13210. //>>excludeEnd("ctx");
  13211. var $3,$2,$5,$4,$6,$1;
  13212. $3=self._class();
  13213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13214. $ctx1.sendIdx["class"]=1;
  13215. //>>excludeEnd("ctx");
  13216. $2=_st($3).__eq(_st(anAssociation)._class());
  13217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13218. $ctx1.sendIdx["="]=1;
  13219. //>>excludeEnd("ctx");
  13220. $1=_st($2)._and_((function(){
  13221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13222. return smalltalk.withContext(function($ctx2) {
  13223. //>>excludeEnd("ctx");
  13224. $5=self._key();
  13225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13226. $ctx2.sendIdx["key"]=1;
  13227. //>>excludeEnd("ctx");
  13228. $4=_st($5).__eq(_st(anAssociation)._key());
  13229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13230. $ctx2.sendIdx["="]=2;
  13231. //>>excludeEnd("ctx");
  13232. return _st($4)._and_((function(){
  13233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13234. return smalltalk.withContext(function($ctx3) {
  13235. //>>excludeEnd("ctx");
  13236. $6=self._value();
  13237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13238. $ctx3.sendIdx["value"]=1;
  13239. //>>excludeEnd("ctx");
  13240. return _st($6).__eq(_st(anAssociation)._value());
  13241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13242. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  13243. //>>excludeEnd("ctx");
  13244. }));
  13245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13247. //>>excludeEnd("ctx");
  13248. }));
  13249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13250. $ctx1.sendIdx["and:"]=1;
  13251. //>>excludeEnd("ctx");
  13252. return $1;
  13253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13254. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)});
  13255. //>>excludeEnd("ctx");
  13256. },
  13257. //>>excludeStart("ide", pragmas.excludeIdeData);
  13258. args: ["anAssociation"],
  13259. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  13260. referencedClasses: [],
  13261. //>>excludeEnd("ide");
  13262. messageSends: ["and:", "=", "class", "key", "value"]
  13263. }),
  13264. globals.Association);
  13265. smalltalk.addMethod(
  13266. smalltalk.method({
  13267. selector: "key",
  13268. protocol: 'accessing',
  13269. fn: function (){
  13270. var self=this;
  13271. var $1;
  13272. $1=self["@key"];
  13273. return $1;
  13274. },
  13275. //>>excludeStart("ide", pragmas.excludeIdeData);
  13276. args: [],
  13277. source: "key\x0a\x09^ key",
  13278. referencedClasses: [],
  13279. //>>excludeEnd("ide");
  13280. messageSends: []
  13281. }),
  13282. globals.Association);
  13283. smalltalk.addMethod(
  13284. smalltalk.method({
  13285. selector: "key:",
  13286. protocol: 'accessing',
  13287. fn: function (aKey){
  13288. var self=this;
  13289. self["@key"]=aKey;
  13290. return self;
  13291. },
  13292. //>>excludeStart("ide", pragmas.excludeIdeData);
  13293. args: ["aKey"],
  13294. source: "key: aKey\x0a\x09key := aKey",
  13295. referencedClasses: [],
  13296. //>>excludeEnd("ide");
  13297. messageSends: []
  13298. }),
  13299. globals.Association);
  13300. smalltalk.addMethod(
  13301. smalltalk.method({
  13302. selector: "printOn:",
  13303. protocol: 'printing',
  13304. fn: function (aStream){
  13305. var self=this;
  13306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13307. return smalltalk.withContext(function($ctx1) {
  13308. //>>excludeEnd("ctx");
  13309. _st(self._key())._printOn_(aStream);
  13310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13311. $ctx1.sendIdx["printOn:"]=1;
  13312. //>>excludeEnd("ctx");
  13313. _st(aStream)._nextPutAll_(" -> ");
  13314. _st(self._value())._printOn_(aStream);
  13315. return self;
  13316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13317. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)});
  13318. //>>excludeEnd("ctx");
  13319. },
  13320. //>>excludeStart("ide", pragmas.excludeIdeData);
  13321. args: ["aStream"],
  13322. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  13323. referencedClasses: [],
  13324. //>>excludeEnd("ide");
  13325. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  13326. }),
  13327. globals.Association);
  13328. smalltalk.addMethod(
  13329. smalltalk.method({
  13330. selector: "value",
  13331. protocol: 'accessing',
  13332. fn: function (){
  13333. var self=this;
  13334. var $1;
  13335. $1=self["@value"];
  13336. return $1;
  13337. },
  13338. //>>excludeStart("ide", pragmas.excludeIdeData);
  13339. args: [],
  13340. source: "value\x0a\x09^ value",
  13341. referencedClasses: [],
  13342. //>>excludeEnd("ide");
  13343. messageSends: []
  13344. }),
  13345. globals.Association);
  13346. smalltalk.addMethod(
  13347. smalltalk.method({
  13348. selector: "value:",
  13349. protocol: 'accessing',
  13350. fn: function (aValue){
  13351. var self=this;
  13352. self["@value"]=aValue;
  13353. return self;
  13354. },
  13355. //>>excludeStart("ide", pragmas.excludeIdeData);
  13356. args: ["aValue"],
  13357. source: "value: aValue\x0a\x09value := aValue",
  13358. referencedClasses: [],
  13359. //>>excludeEnd("ide");
  13360. messageSends: []
  13361. }),
  13362. globals.Association);
  13363. smalltalk.addMethod(
  13364. smalltalk.method({
  13365. selector: "key:value:",
  13366. protocol: 'instance creation',
  13367. fn: function (aKey,aValue){
  13368. var self=this;
  13369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13370. return smalltalk.withContext(function($ctx1) {
  13371. //>>excludeEnd("ctx");
  13372. var $2,$3,$1;
  13373. $2=self._new();
  13374. _st($2)._key_(aKey);
  13375. _st($2)._value_(aValue);
  13376. $3=_st($2)._yourself();
  13377. $1=$3;
  13378. return $1;
  13379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13380. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)});
  13381. //>>excludeEnd("ctx");
  13382. },
  13383. //>>excludeStart("ide", pragmas.excludeIdeData);
  13384. args: ["aKey", "aValue"],
  13385. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  13386. referencedClasses: [],
  13387. //>>excludeEnd("ide");
  13388. messageSends: ["key:", "new", "value:", "yourself"]
  13389. }),
  13390. globals.Association.klass);
  13391. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  13392. //>>excludeStart("ide", pragmas.excludeIdeData);
  13393. 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`.";
  13394. //>>excludeEnd("ide");
  13395. smalltalk.addMethod(
  13396. smalltalk.method({
  13397. selector: "bucketOfElement:",
  13398. protocol: 'accessing',
  13399. fn: function (anObject){
  13400. var self=this;
  13401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13402. return smalltalk.withContext(function($ctx1) {
  13403. //>>excludeEnd("ctx");
  13404. var hash = self['@hashBlock'](anObject);
  13405. if (!hash) return null;
  13406. var buckets = self['@buckets'],
  13407. bucket = buckets[hash];
  13408. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  13409. return bucket;
  13410. ;
  13411. return self;
  13412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13413. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)});
  13414. //>>excludeEnd("ctx");
  13415. },
  13416. //>>excludeStart("ide", pragmas.excludeIdeData);
  13417. args: ["anObject"],
  13418. 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>",
  13419. referencedClasses: [],
  13420. //>>excludeEnd("ide");
  13421. messageSends: []
  13422. }),
  13423. globals.BucketStore);
  13424. smalltalk.addMethod(
  13425. smalltalk.method({
  13426. selector: "do:",
  13427. protocol: 'enumerating',
  13428. fn: function (aBlock){
  13429. var self=this;
  13430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13431. return smalltalk.withContext(function($ctx1) {
  13432. //>>excludeEnd("ctx");
  13433. var buckets = self['@buckets'];
  13434. var keys = Object.keys(buckets);
  13435. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  13436. ;
  13437. return self;
  13438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13439. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)});
  13440. //>>excludeEnd("ctx");
  13441. },
  13442. //>>excludeStart("ide", pragmas.excludeIdeData);
  13443. args: ["aBlock"],
  13444. 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>",
  13445. referencedClasses: [],
  13446. //>>excludeEnd("ide");
  13447. messageSends: []
  13448. }),
  13449. globals.BucketStore);
  13450. smalltalk.addMethod(
  13451. smalltalk.method({
  13452. selector: "hashBlock:",
  13453. protocol: 'accessing',
  13454. fn: function (aBlock){
  13455. var self=this;
  13456. self["@hashBlock"]=aBlock;
  13457. return self;
  13458. },
  13459. //>>excludeStart("ide", pragmas.excludeIdeData);
  13460. args: ["aBlock"],
  13461. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  13462. referencedClasses: [],
  13463. //>>excludeEnd("ide");
  13464. messageSends: []
  13465. }),
  13466. globals.BucketStore);
  13467. smalltalk.addMethod(
  13468. smalltalk.method({
  13469. selector: "initialize",
  13470. protocol: 'initialization',
  13471. fn: function (){
  13472. var self=this;
  13473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13474. return smalltalk.withContext(function($ctx1) {
  13475. //>>excludeEnd("ctx");
  13476. (
  13477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13478. $ctx1.supercall = true,
  13479. //>>excludeEnd("ctx");
  13480. globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []));
  13481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13482. $ctx1.supercall = false;
  13483. //>>excludeEnd("ctx");;
  13484. self._removeAll();
  13485. return self;
  13486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13487. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)});
  13488. //>>excludeEnd("ctx");
  13489. },
  13490. //>>excludeStart("ide", pragmas.excludeIdeData);
  13491. args: [],
  13492. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  13493. referencedClasses: [],
  13494. //>>excludeEnd("ide");
  13495. messageSends: ["initialize", "removeAll"]
  13496. }),
  13497. globals.BucketStore);
  13498. smalltalk.addMethod(
  13499. smalltalk.method({
  13500. selector: "newBucket",
  13501. protocol: 'private',
  13502. fn: function (){
  13503. var self=this;
  13504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13505. return smalltalk.withContext(function($ctx1) {
  13506. //>>excludeEnd("ctx");
  13507. self._subclassResponsibility();
  13508. return self;
  13509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13510. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)});
  13511. //>>excludeEnd("ctx");
  13512. },
  13513. //>>excludeStart("ide", pragmas.excludeIdeData);
  13514. args: [],
  13515. source: "newBucket\x0a\x09self subclassResponsibility",
  13516. referencedClasses: [],
  13517. //>>excludeEnd("ide");
  13518. messageSends: ["subclassResponsibility"]
  13519. }),
  13520. globals.BucketStore);
  13521. smalltalk.addMethod(
  13522. smalltalk.method({
  13523. selector: "removeAll",
  13524. protocol: 'adding/removing',
  13525. fn: function (){
  13526. var self=this;
  13527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13528. return smalltalk.withContext(function($ctx1) {
  13529. //>>excludeEnd("ctx");
  13530. self['@buckets'] = Object.create(null);;
  13531. return self;
  13532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13533. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)});
  13534. //>>excludeEnd("ctx");
  13535. },
  13536. //>>excludeStart("ide", pragmas.excludeIdeData);
  13537. args: [],
  13538. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  13539. referencedClasses: [],
  13540. //>>excludeEnd("ide");
  13541. messageSends: []
  13542. }),
  13543. globals.BucketStore);
  13544. smalltalk.addMethod(
  13545. smalltalk.method({
  13546. selector: "hashBlock:",
  13547. protocol: 'instance creation',
  13548. fn: function (aBlock){
  13549. var self=this;
  13550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13551. return smalltalk.withContext(function($ctx1) {
  13552. //>>excludeEnd("ctx");
  13553. var $2,$3,$1;
  13554. $2=self._new();
  13555. _st($2)._hashBlock_(aBlock);
  13556. $3=_st($2)._yourself();
  13557. $1=$3;
  13558. return $1;
  13559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13560. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)});
  13561. //>>excludeEnd("ctx");
  13562. },
  13563. //>>excludeStart("ide", pragmas.excludeIdeData);
  13564. args: ["aBlock"],
  13565. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  13566. referencedClasses: [],
  13567. //>>excludeEnd("ide");
  13568. messageSends: ["hashBlock:", "new", "yourself"]
  13569. }),
  13570. globals.BucketStore.klass);
  13571. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  13572. //>>excludeStart("ide", pragmas.excludeIdeData);
  13573. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  13574. //>>excludeEnd("ide");
  13575. smalltalk.addMethod(
  13576. smalltalk.method({
  13577. selector: "newBucket",
  13578. protocol: 'private',
  13579. fn: function (){
  13580. var self=this;
  13581. var $1;
  13582. $1=[];
  13583. return $1;
  13584. },
  13585. //>>excludeStart("ide", pragmas.excludeIdeData);
  13586. args: [],
  13587. source: "newBucket\x0a\x09^ #()",
  13588. referencedClasses: [],
  13589. //>>excludeEnd("ide");
  13590. messageSends: []
  13591. }),
  13592. globals.ArrayBucketStore);
  13593. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  13594. //>>excludeStart("ide", pragmas.excludeIdeData);
  13595. 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.";
  13596. //>>excludeEnd("ide");
  13597. smalltalk.addMethod(
  13598. smalltalk.method({
  13599. selector: ",",
  13600. protocol: 'copying',
  13601. fn: function (aCollection){
  13602. var self=this;
  13603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13604. return smalltalk.withContext(function($ctx1) {
  13605. //>>excludeEnd("ctx");
  13606. var $2,$3,$1;
  13607. $2=self._copy();
  13608. _st($2)._addAll_(aCollection);
  13609. $3=_st($2)._yourself();
  13610. $1=$3;
  13611. return $1;
  13612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13613. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)});
  13614. //>>excludeEnd("ctx");
  13615. },
  13616. //>>excludeStart("ide", pragmas.excludeIdeData);
  13617. args: ["aCollection"],
  13618. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  13619. referencedClasses: [],
  13620. //>>excludeEnd("ide");
  13621. messageSends: ["addAll:", "copy", "yourself"]
  13622. }),
  13623. globals.Collection);
  13624. smalltalk.addMethod(
  13625. smalltalk.method({
  13626. selector: "add:",
  13627. protocol: 'adding/removing',
  13628. fn: function (anObject){
  13629. var self=this;
  13630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13631. return smalltalk.withContext(function($ctx1) {
  13632. //>>excludeEnd("ctx");
  13633. self._subclassResponsibility();
  13634. return self;
  13635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13636. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)});
  13637. //>>excludeEnd("ctx");
  13638. },
  13639. //>>excludeStart("ide", pragmas.excludeIdeData);
  13640. args: ["anObject"],
  13641. source: "add: anObject\x0a\x09self subclassResponsibility",
  13642. referencedClasses: [],
  13643. //>>excludeEnd("ide");
  13644. messageSends: ["subclassResponsibility"]
  13645. }),
  13646. globals.Collection);
  13647. smalltalk.addMethod(
  13648. smalltalk.method({
  13649. selector: "addAll:",
  13650. protocol: 'adding/removing',
  13651. fn: function (aCollection){
  13652. var self=this;
  13653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13654. return smalltalk.withContext(function($ctx1) {
  13655. //>>excludeEnd("ctx");
  13656. _st(aCollection)._do_((function(each){
  13657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13658. return smalltalk.withContext(function($ctx2) {
  13659. //>>excludeEnd("ctx");
  13660. return self._add_(each);
  13661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13662. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13663. //>>excludeEnd("ctx");
  13664. }));
  13665. return aCollection;
  13666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13667. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)});
  13668. //>>excludeEnd("ctx");
  13669. },
  13670. //>>excludeStart("ide", pragmas.excludeIdeData);
  13671. args: ["aCollection"],
  13672. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  13673. referencedClasses: [],
  13674. //>>excludeEnd("ide");
  13675. messageSends: ["do:", "add:"]
  13676. }),
  13677. globals.Collection);
  13678. smalltalk.addMethod(
  13679. smalltalk.method({
  13680. selector: "allSatisfy:",
  13681. protocol: 'enumerating',
  13682. fn: function (aBlock){
  13683. var self=this;
  13684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13685. return smalltalk.withContext(function($ctx1) {
  13686. //>>excludeEnd("ctx");
  13687. var $1;
  13688. var $early={};
  13689. try {
  13690. self._do_((function(each){
  13691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13692. return smalltalk.withContext(function($ctx2) {
  13693. //>>excludeEnd("ctx");
  13694. $1=_st(aBlock)._value_(each);
  13695. if(! smalltalk.assert($1)){
  13696. throw $early=[false];
  13697. };
  13698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13699. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13700. //>>excludeEnd("ctx");
  13701. }));
  13702. return true;
  13703. }
  13704. catch(e) {if(e===$early)return e[0]; throw e}
  13705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13706. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)});
  13707. //>>excludeEnd("ctx");
  13708. },
  13709. //>>excludeStart("ide", pragmas.excludeIdeData);
  13710. args: ["aBlock"],
  13711. 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",
  13712. referencedClasses: [],
  13713. //>>excludeEnd("ide");
  13714. messageSends: ["do:", "ifFalse:", "value:"]
  13715. }),
  13716. globals.Collection);
  13717. smalltalk.addMethod(
  13718. smalltalk.method({
  13719. selector: "anyOne",
  13720. protocol: 'adding/removing',
  13721. fn: function (){
  13722. var self=this;
  13723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13724. return smalltalk.withContext(function($ctx1) {
  13725. //>>excludeEnd("ctx");
  13726. var $early={};
  13727. try {
  13728. self._ifEmpty_((function(){
  13729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13730. return smalltalk.withContext(function($ctx2) {
  13731. //>>excludeEnd("ctx");
  13732. return self._error_("Collection is empty");
  13733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13734. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13735. //>>excludeEnd("ctx");
  13736. }));
  13737. self._do_((function(each){
  13738. throw $early=[each];
  13739. }));
  13740. return self;
  13741. }
  13742. catch(e) {if(e===$early)return e[0]; throw e}
  13743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13744. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)});
  13745. //>>excludeEnd("ctx");
  13746. },
  13747. //>>excludeStart("ide", pragmas.excludeIdeData);
  13748. args: [],
  13749. 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 ]",
  13750. referencedClasses: [],
  13751. //>>excludeEnd("ide");
  13752. messageSends: ["ifEmpty:", "error:", "do:"]
  13753. }),
  13754. globals.Collection);
  13755. smalltalk.addMethod(
  13756. smalltalk.method({
  13757. selector: "anySatisfy:",
  13758. protocol: 'enumerating',
  13759. fn: function (aBlock){
  13760. var self=this;
  13761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13762. return smalltalk.withContext(function($ctx1) {
  13763. //>>excludeEnd("ctx");
  13764. var $1;
  13765. var $early={};
  13766. try {
  13767. self._do_((function(each){
  13768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13769. return smalltalk.withContext(function($ctx2) {
  13770. //>>excludeEnd("ctx");
  13771. $1=_st(aBlock)._value_(each);
  13772. if(smalltalk.assert($1)){
  13773. throw $early=[true];
  13774. };
  13775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13777. //>>excludeEnd("ctx");
  13778. }));
  13779. return false;
  13780. }
  13781. catch(e) {if(e===$early)return e[0]; throw e}
  13782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13783. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)});
  13784. //>>excludeEnd("ctx");
  13785. },
  13786. //>>excludeStart("ide", pragmas.excludeIdeData);
  13787. args: ["aBlock"],
  13788. 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",
  13789. referencedClasses: [],
  13790. //>>excludeEnd("ide");
  13791. messageSends: ["do:", "ifTrue:", "value:"]
  13792. }),
  13793. globals.Collection);
  13794. smalltalk.addMethod(
  13795. smalltalk.method({
  13796. selector: "asArray",
  13797. protocol: 'converting',
  13798. fn: function (){
  13799. var self=this;
  13800. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  13801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13802. return smalltalk.withContext(function($ctx1) {
  13803. //>>excludeEnd("ctx");
  13804. var $1;
  13805. $1=_st($Array())._withAll_(self);
  13806. return $1;
  13807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13808. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)});
  13809. //>>excludeEnd("ctx");
  13810. },
  13811. //>>excludeStart("ide", pragmas.excludeIdeData);
  13812. args: [],
  13813. source: "asArray\x0a\x09^ Array withAll: self",
  13814. referencedClasses: ["Array"],
  13815. //>>excludeEnd("ide");
  13816. messageSends: ["withAll:"]
  13817. }),
  13818. globals.Collection);
  13819. smalltalk.addMethod(
  13820. smalltalk.method({
  13821. selector: "asJSON",
  13822. protocol: 'converting',
  13823. fn: function (){
  13824. var self=this;
  13825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13826. return smalltalk.withContext(function($ctx1) {
  13827. //>>excludeEnd("ctx");
  13828. var $1;
  13829. $1=_st(self._asArray())._collect_((function(each){
  13830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13831. return smalltalk.withContext(function($ctx2) {
  13832. //>>excludeEnd("ctx");
  13833. return _st(each)._asJSON();
  13834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13836. //>>excludeEnd("ctx");
  13837. }));
  13838. return $1;
  13839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13840. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)});
  13841. //>>excludeEnd("ctx");
  13842. },
  13843. //>>excludeStart("ide", pragmas.excludeIdeData);
  13844. args: [],
  13845. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  13846. referencedClasses: [],
  13847. //>>excludeEnd("ide");
  13848. messageSends: ["collect:", "asArray", "asJSON"]
  13849. }),
  13850. globals.Collection);
  13851. smalltalk.addMethod(
  13852. smalltalk.method({
  13853. selector: "asOrderedCollection",
  13854. protocol: 'converting',
  13855. fn: function (){
  13856. var self=this;
  13857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13858. return smalltalk.withContext(function($ctx1) {
  13859. //>>excludeEnd("ctx");
  13860. var $1;
  13861. $1=self._asArray();
  13862. return $1;
  13863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13864. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)});
  13865. //>>excludeEnd("ctx");
  13866. },
  13867. //>>excludeStart("ide", pragmas.excludeIdeData);
  13868. args: [],
  13869. source: "asOrderedCollection\x0a\x09^ self asArray",
  13870. referencedClasses: [],
  13871. //>>excludeEnd("ide");
  13872. messageSends: ["asArray"]
  13873. }),
  13874. globals.Collection);
  13875. smalltalk.addMethod(
  13876. smalltalk.method({
  13877. selector: "asSet",
  13878. protocol: 'converting',
  13879. fn: function (){
  13880. var self=this;
  13881. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  13882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13883. return smalltalk.withContext(function($ctx1) {
  13884. //>>excludeEnd("ctx");
  13885. var $1;
  13886. $1=_st($Set())._withAll_(self);
  13887. return $1;
  13888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13889. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)});
  13890. //>>excludeEnd("ctx");
  13891. },
  13892. //>>excludeStart("ide", pragmas.excludeIdeData);
  13893. args: [],
  13894. source: "asSet\x0a\x09^ Set withAll: self",
  13895. referencedClasses: ["Set"],
  13896. //>>excludeEnd("ide");
  13897. messageSends: ["withAll:"]
  13898. }),
  13899. globals.Collection);
  13900. smalltalk.addMethod(
  13901. smalltalk.method({
  13902. selector: "collect:",
  13903. protocol: 'enumerating',
  13904. fn: function (aBlock){
  13905. var self=this;
  13906. var stream;
  13907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13908. return smalltalk.withContext(function($ctx1) {
  13909. //>>excludeEnd("ctx");
  13910. var $1;
  13911. stream=_st(_st(self._class())._new())._writeStream();
  13912. self._do_((function(each){
  13913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13914. return smalltalk.withContext(function($ctx2) {
  13915. //>>excludeEnd("ctx");
  13916. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  13917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13918. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13919. //>>excludeEnd("ctx");
  13920. }));
  13921. $1=_st(stream)._contents();
  13922. return $1;
  13923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13924. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)});
  13925. //>>excludeEnd("ctx");
  13926. },
  13927. //>>excludeStart("ide", pragmas.excludeIdeData);
  13928. args: ["aBlock"],
  13929. 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",
  13930. referencedClasses: [],
  13931. //>>excludeEnd("ide");
  13932. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  13933. }),
  13934. globals.Collection);
  13935. smalltalk.addMethod(
  13936. smalltalk.method({
  13937. selector: "contains:",
  13938. protocol: 'testing',
  13939. fn: function (aBlock){
  13940. var self=this;
  13941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13942. return smalltalk.withContext(function($ctx1) {
  13943. //>>excludeEnd("ctx");
  13944. var $1;
  13945. self._deprecatedAPI();
  13946. $1=self._anySatisfy_(aBlock);
  13947. return $1;
  13948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13949. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)});
  13950. //>>excludeEnd("ctx");
  13951. },
  13952. //>>excludeStart("ide", pragmas.excludeIdeData);
  13953. args: ["aBlock"],
  13954. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  13955. referencedClasses: [],
  13956. //>>excludeEnd("ide");
  13957. messageSends: ["deprecatedAPI", "anySatisfy:"]
  13958. }),
  13959. globals.Collection);
  13960. smalltalk.addMethod(
  13961. smalltalk.method({
  13962. selector: "copyWith:",
  13963. protocol: 'copying',
  13964. fn: function (anObject){
  13965. var self=this;
  13966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13967. return smalltalk.withContext(function($ctx1) {
  13968. //>>excludeEnd("ctx");
  13969. var $2,$3,$1;
  13970. $2=self._copy();
  13971. _st($2)._add_(anObject);
  13972. $3=_st($2)._yourself();
  13973. $1=$3;
  13974. return $1;
  13975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13976. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)});
  13977. //>>excludeEnd("ctx");
  13978. },
  13979. //>>excludeStart("ide", pragmas.excludeIdeData);
  13980. args: ["anObject"],
  13981. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  13982. referencedClasses: [],
  13983. //>>excludeEnd("ide");
  13984. messageSends: ["add:", "copy", "yourself"]
  13985. }),
  13986. globals.Collection);
  13987. smalltalk.addMethod(
  13988. smalltalk.method({
  13989. selector: "copyWithAll:",
  13990. protocol: 'copying',
  13991. fn: function (aCollection){
  13992. var self=this;
  13993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  13994. return smalltalk.withContext(function($ctx1) {
  13995. //>>excludeEnd("ctx");
  13996. var $2,$3,$1;
  13997. $2=self._copy();
  13998. _st($2)._addAll_(aCollection);
  13999. $3=_st($2)._yourself();
  14000. $1=$3;
  14001. return $1;
  14002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14003. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)});
  14004. //>>excludeEnd("ctx");
  14005. },
  14006. //>>excludeStart("ide", pragmas.excludeIdeData);
  14007. args: ["aCollection"],
  14008. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  14009. referencedClasses: [],
  14010. //>>excludeEnd("ide");
  14011. messageSends: ["addAll:", "copy", "yourself"]
  14012. }),
  14013. globals.Collection);
  14014. smalltalk.addMethod(
  14015. smalltalk.method({
  14016. selector: "copyWithoutAll:",
  14017. protocol: 'copying',
  14018. fn: function (aCollection){
  14019. var self=this;
  14020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14021. return smalltalk.withContext(function($ctx1) {
  14022. //>>excludeEnd("ctx");
  14023. var $1;
  14024. $1=self._reject_((function(each){
  14025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14026. return smalltalk.withContext(function($ctx2) {
  14027. //>>excludeEnd("ctx");
  14028. return _st(aCollection)._includes_(each);
  14029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14031. //>>excludeEnd("ctx");
  14032. }));
  14033. return $1;
  14034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14035. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)});
  14036. //>>excludeEnd("ctx");
  14037. },
  14038. //>>excludeStart("ide", pragmas.excludeIdeData);
  14039. args: ["aCollection"],
  14040. 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 ]",
  14041. referencedClasses: [],
  14042. //>>excludeEnd("ide");
  14043. messageSends: ["reject:", "includes:"]
  14044. }),
  14045. globals.Collection);
  14046. smalltalk.addMethod(
  14047. smalltalk.method({
  14048. selector: "detect:",
  14049. protocol: 'enumerating',
  14050. fn: function (aBlock){
  14051. var self=this;
  14052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14053. return smalltalk.withContext(function($ctx1) {
  14054. //>>excludeEnd("ctx");
  14055. var $1;
  14056. $1=self._detect_ifNone_(aBlock,(function(){
  14057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14058. return smalltalk.withContext(function($ctx2) {
  14059. //>>excludeEnd("ctx");
  14060. return self._errorNotFound();
  14061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14063. //>>excludeEnd("ctx");
  14064. }));
  14065. return $1;
  14066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14067. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)});
  14068. //>>excludeEnd("ctx");
  14069. },
  14070. //>>excludeStart("ide", pragmas.excludeIdeData);
  14071. args: ["aBlock"],
  14072. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  14073. referencedClasses: [],
  14074. //>>excludeEnd("ide");
  14075. messageSends: ["detect:ifNone:", "errorNotFound"]
  14076. }),
  14077. globals.Collection);
  14078. smalltalk.addMethod(
  14079. smalltalk.method({
  14080. selector: "detect:ifNone:",
  14081. protocol: 'enumerating',
  14082. fn: function (aBlock,anotherBlock){
  14083. var self=this;
  14084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14085. return smalltalk.withContext(function($ctx1) {
  14086. //>>excludeEnd("ctx");
  14087. self._subclassResponsibility();
  14088. return self;
  14089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14090. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14091. //>>excludeEnd("ctx");
  14092. },
  14093. //>>excludeStart("ide", pragmas.excludeIdeData);
  14094. args: ["aBlock", "anotherBlock"],
  14095. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  14096. referencedClasses: [],
  14097. //>>excludeEnd("ide");
  14098. messageSends: ["subclassResponsibility"]
  14099. }),
  14100. globals.Collection);
  14101. smalltalk.addMethod(
  14102. smalltalk.method({
  14103. selector: "do:",
  14104. protocol: 'enumerating',
  14105. fn: function (aBlock){
  14106. var self=this;
  14107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14108. return smalltalk.withContext(function($ctx1) {
  14109. //>>excludeEnd("ctx");
  14110. self._subclassResponsibility();
  14111. return self;
  14112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14113. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)});
  14114. //>>excludeEnd("ctx");
  14115. },
  14116. //>>excludeStart("ide", pragmas.excludeIdeData);
  14117. args: ["aBlock"],
  14118. source: "do: aBlock\x0a\x09self subclassResponsibility",
  14119. referencedClasses: [],
  14120. //>>excludeEnd("ide");
  14121. messageSends: ["subclassResponsibility"]
  14122. }),
  14123. globals.Collection);
  14124. smalltalk.addMethod(
  14125. smalltalk.method({
  14126. selector: "do:separatedBy:",
  14127. protocol: 'enumerating',
  14128. fn: function (aBlock,anotherBlock){
  14129. var self=this;
  14130. var actionBeforeElement;
  14131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14132. return smalltalk.withContext(function($ctx1) {
  14133. //>>excludeEnd("ctx");
  14134. actionBeforeElement=(function(){
  14135. actionBeforeElement=anotherBlock;
  14136. return actionBeforeElement;
  14137. });
  14138. self._do_((function(each){
  14139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14140. return smalltalk.withContext(function($ctx2) {
  14141. //>>excludeEnd("ctx");
  14142. _st(actionBeforeElement)._value();
  14143. return _st(aBlock)._value_(each);
  14144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14145. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  14146. //>>excludeEnd("ctx");
  14147. }));
  14148. return self;
  14149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14150. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)});
  14151. //>>excludeEnd("ctx");
  14152. },
  14153. //>>excludeStart("ide", pragmas.excludeIdeData);
  14154. args: ["aBlock", "anotherBlock"],
  14155. 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 ]",
  14156. referencedClasses: [],
  14157. //>>excludeEnd("ide");
  14158. messageSends: ["do:", "value", "value:"]
  14159. }),
  14160. globals.Collection);
  14161. smalltalk.addMethod(
  14162. smalltalk.method({
  14163. selector: "errorNotFound",
  14164. protocol: 'error handling',
  14165. fn: function (){
  14166. var self=this;
  14167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14168. return smalltalk.withContext(function($ctx1) {
  14169. //>>excludeEnd("ctx");
  14170. self._error_("Object is not in the collection");
  14171. return self;
  14172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14173. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)});
  14174. //>>excludeEnd("ctx");
  14175. },
  14176. //>>excludeStart("ide", pragmas.excludeIdeData);
  14177. args: [],
  14178. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  14179. referencedClasses: [],
  14180. //>>excludeEnd("ide");
  14181. messageSends: ["error:"]
  14182. }),
  14183. globals.Collection);
  14184. smalltalk.addMethod(
  14185. smalltalk.method({
  14186. selector: "ifEmpty:",
  14187. protocol: 'testing',
  14188. fn: function (aBlock){
  14189. var self=this;
  14190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14191. return smalltalk.withContext(function($ctx1) {
  14192. //>>excludeEnd("ctx");
  14193. var $2,$1;
  14194. $2=self._isEmpty();
  14195. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  14196. return self;
  14197. }));
  14198. return $1;
  14199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14200. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)});
  14201. //>>excludeEnd("ctx");
  14202. },
  14203. //>>excludeStart("ide", pragmas.excludeIdeData);
  14204. args: ["aBlock"],
  14205. 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 ]",
  14206. referencedClasses: [],
  14207. //>>excludeEnd("ide");
  14208. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  14209. }),
  14210. globals.Collection);
  14211. smalltalk.addMethod(
  14212. smalltalk.method({
  14213. selector: "ifEmpty:ifNotEmpty:",
  14214. protocol: 'testing',
  14215. fn: function (aBlock,anotherBlock){
  14216. var self=this;
  14217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14218. return smalltalk.withContext(function($ctx1) {
  14219. //>>excludeEnd("ctx");
  14220. var $2,$1;
  14221. $2=self._isEmpty();
  14222. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  14223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14224. return smalltalk.withContext(function($ctx2) {
  14225. //>>excludeEnd("ctx");
  14226. return _st(anotherBlock)._value_(self);
  14227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14229. //>>excludeEnd("ctx");
  14230. }));
  14231. return $1;
  14232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14233. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14234. //>>excludeEnd("ctx");
  14235. },
  14236. //>>excludeStart("ide", pragmas.excludeIdeData);
  14237. args: ["aBlock", "anotherBlock"],
  14238. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  14239. referencedClasses: [],
  14240. //>>excludeEnd("ide");
  14241. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  14242. }),
  14243. globals.Collection);
  14244. smalltalk.addMethod(
  14245. smalltalk.method({
  14246. selector: "ifNotEmpty:",
  14247. protocol: 'testing',
  14248. fn: function (aBlock){
  14249. var self=this;
  14250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14251. return smalltalk.withContext(function($ctx1) {
  14252. //>>excludeEnd("ctx");
  14253. var $2,$1;
  14254. $2=self._notEmpty();
  14255. if(smalltalk.assert($2)){
  14256. $1=_st(aBlock)._value_(self);
  14257. } else {
  14258. $1=self;
  14259. };
  14260. return $1;
  14261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14262. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)});
  14263. //>>excludeEnd("ctx");
  14264. },
  14265. //>>excludeStart("ide", pragmas.excludeIdeData);
  14266. args: ["aBlock"],
  14267. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  14268. referencedClasses: [],
  14269. //>>excludeEnd("ide");
  14270. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  14271. }),
  14272. globals.Collection);
  14273. smalltalk.addMethod(
  14274. smalltalk.method({
  14275. selector: "ifNotEmpty:ifEmpty:",
  14276. protocol: 'testing',
  14277. fn: function (aBlock,anotherBlock){
  14278. var self=this;
  14279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14280. return smalltalk.withContext(function($ctx1) {
  14281. //>>excludeEnd("ctx");
  14282. var $2,$1;
  14283. $2=self._notEmpty();
  14284. $1=_st($2)._ifTrue_ifFalse_((function(){
  14285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14286. return smalltalk.withContext(function($ctx2) {
  14287. //>>excludeEnd("ctx");
  14288. return _st(aBlock)._value_(self);
  14289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14291. //>>excludeEnd("ctx");
  14292. }),anotherBlock);
  14293. return $1;
  14294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14295. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  14296. //>>excludeEnd("ctx");
  14297. },
  14298. //>>excludeStart("ide", pragmas.excludeIdeData);
  14299. args: ["aBlock", "anotherBlock"],
  14300. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  14301. referencedClasses: [],
  14302. //>>excludeEnd("ide");
  14303. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  14304. }),
  14305. globals.Collection);
  14306. smalltalk.addMethod(
  14307. smalltalk.method({
  14308. selector: "includes:",
  14309. protocol: 'testing',
  14310. fn: function (anObject){
  14311. var self=this;
  14312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14313. return smalltalk.withContext(function($ctx1) {
  14314. //>>excludeEnd("ctx");
  14315. var $1;
  14316. $1=self._anySatisfy_((function(each){
  14317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14318. return smalltalk.withContext(function($ctx2) {
  14319. //>>excludeEnd("ctx");
  14320. return _st(each).__eq(anObject);
  14321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14323. //>>excludeEnd("ctx");
  14324. }));
  14325. return $1;
  14326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14327. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)});
  14328. //>>excludeEnd("ctx");
  14329. },
  14330. //>>excludeStart("ide", pragmas.excludeIdeData);
  14331. args: ["anObject"],
  14332. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  14333. referencedClasses: [],
  14334. //>>excludeEnd("ide");
  14335. messageSends: ["anySatisfy:", "="]
  14336. }),
  14337. globals.Collection);
  14338. smalltalk.addMethod(
  14339. smalltalk.method({
  14340. selector: "inject:into:",
  14341. protocol: 'enumerating',
  14342. fn: function (anObject,aBlock){
  14343. var self=this;
  14344. var result;
  14345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14346. return smalltalk.withContext(function($ctx1) {
  14347. //>>excludeEnd("ctx");
  14348. var $1;
  14349. result=anObject;
  14350. self._do_((function(each){
  14351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14352. return smalltalk.withContext(function($ctx2) {
  14353. //>>excludeEnd("ctx");
  14354. result=_st(aBlock)._value_value_(result,each);
  14355. return result;
  14356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14357. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14358. //>>excludeEnd("ctx");
  14359. }));
  14360. $1=result;
  14361. return $1;
  14362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14363. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)});
  14364. //>>excludeEnd("ctx");
  14365. },
  14366. //>>excludeStart("ide", pragmas.excludeIdeData);
  14367. args: ["anObject", "aBlock"],
  14368. 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",
  14369. referencedClasses: [],
  14370. //>>excludeEnd("ide");
  14371. messageSends: ["do:", "value:value:"]
  14372. }),
  14373. globals.Collection);
  14374. smalltalk.addMethod(
  14375. smalltalk.method({
  14376. selector: "intersection:",
  14377. protocol: 'enumerating',
  14378. fn: function (aCollection){
  14379. var self=this;
  14380. var set,outputSet;
  14381. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  14382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14383. return smalltalk.withContext(function($ctx1) {
  14384. //>>excludeEnd("ctx");
  14385. var $2,$1,$3;
  14386. set=self._asSet();
  14387. outputSet=_st($Set())._new();
  14388. _st(aCollection)._do_((function(each){
  14389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14390. return smalltalk.withContext(function($ctx2) {
  14391. //>>excludeEnd("ctx");
  14392. $2=_st(set)._includes_(each);
  14393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14394. $ctx2.sendIdx["includes:"]=1;
  14395. //>>excludeEnd("ctx");
  14396. $1=_st($2)._and_((function(){
  14397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14398. return smalltalk.withContext(function($ctx3) {
  14399. //>>excludeEnd("ctx");
  14400. return _st(_st(outputSet)._includes_(each))._not();
  14401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14402. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14403. //>>excludeEnd("ctx");
  14404. }));
  14405. if(smalltalk.assert($1)){
  14406. return _st(outputSet)._add_(each);
  14407. };
  14408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14410. //>>excludeEnd("ctx");
  14411. }));
  14412. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  14413. return $3;
  14414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14415. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)});
  14416. //>>excludeEnd("ctx");
  14417. },
  14418. //>>excludeStart("ide", pragmas.excludeIdeData);
  14419. args: ["aCollection"],
  14420. 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",
  14421. referencedClasses: ["Set"],
  14422. //>>excludeEnd("ide");
  14423. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  14424. }),
  14425. globals.Collection);
  14426. smalltalk.addMethod(
  14427. smalltalk.method({
  14428. selector: "isEmpty",
  14429. protocol: 'testing',
  14430. fn: function (){
  14431. var self=this;
  14432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14433. return smalltalk.withContext(function($ctx1) {
  14434. //>>excludeEnd("ctx");
  14435. var $1;
  14436. $1=_st(self._size()).__eq((0));
  14437. return $1;
  14438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14439. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)});
  14440. //>>excludeEnd("ctx");
  14441. },
  14442. //>>excludeStart("ide", pragmas.excludeIdeData);
  14443. args: [],
  14444. source: "isEmpty\x0a\x09^ self size = 0",
  14445. referencedClasses: [],
  14446. //>>excludeEnd("ide");
  14447. messageSends: ["=", "size"]
  14448. }),
  14449. globals.Collection);
  14450. smalltalk.addMethod(
  14451. smalltalk.method({
  14452. selector: "noneSatisfy:",
  14453. protocol: 'enumerating',
  14454. fn: function (aBlock){
  14455. var self=this;
  14456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14457. return smalltalk.withContext(function($ctx1) {
  14458. //>>excludeEnd("ctx");
  14459. var $1;
  14460. var $early={};
  14461. try {
  14462. self._do_((function(item){
  14463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14464. return smalltalk.withContext(function($ctx2) {
  14465. //>>excludeEnd("ctx");
  14466. $1=_st(aBlock)._value_(item);
  14467. if(smalltalk.assert($1)){
  14468. throw $early=[false];
  14469. };
  14470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14471. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  14472. //>>excludeEnd("ctx");
  14473. }));
  14474. return true;
  14475. }
  14476. catch(e) {if(e===$early)return e[0]; throw e}
  14477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14478. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)});
  14479. //>>excludeEnd("ctx");
  14480. },
  14481. //>>excludeStart("ide", pragmas.excludeIdeData);
  14482. args: ["aBlock"],
  14483. 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",
  14484. referencedClasses: [],
  14485. //>>excludeEnd("ide");
  14486. messageSends: ["do:", "ifTrue:", "value:"]
  14487. }),
  14488. globals.Collection);
  14489. smalltalk.addMethod(
  14490. smalltalk.method({
  14491. selector: "notEmpty",
  14492. protocol: 'testing',
  14493. fn: function (){
  14494. var self=this;
  14495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14496. return smalltalk.withContext(function($ctx1) {
  14497. //>>excludeEnd("ctx");
  14498. var $1;
  14499. $1=_st(self._isEmpty())._not();
  14500. return $1;
  14501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14502. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)});
  14503. //>>excludeEnd("ctx");
  14504. },
  14505. //>>excludeStart("ide", pragmas.excludeIdeData);
  14506. args: [],
  14507. source: "notEmpty\x0a\x09^ self isEmpty not",
  14508. referencedClasses: [],
  14509. //>>excludeEnd("ide");
  14510. messageSends: ["not", "isEmpty"]
  14511. }),
  14512. globals.Collection);
  14513. smalltalk.addMethod(
  14514. smalltalk.method({
  14515. selector: "occurrencesOf:",
  14516. protocol: 'accessing',
  14517. fn: function (anObject){
  14518. var self=this;
  14519. var tally;
  14520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14521. return smalltalk.withContext(function($ctx1) {
  14522. //>>excludeEnd("ctx");
  14523. var $1,$2;
  14524. tally=(0);
  14525. self._do_((function(each){
  14526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14527. return smalltalk.withContext(function($ctx2) {
  14528. //>>excludeEnd("ctx");
  14529. $1=_st(anObject).__eq(each);
  14530. if(smalltalk.assert($1)){
  14531. tally=_st(tally).__plus((1));
  14532. return tally;
  14533. };
  14534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14536. //>>excludeEnd("ctx");
  14537. }));
  14538. $2=tally;
  14539. return $2;
  14540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14541. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)});
  14542. //>>excludeEnd("ctx");
  14543. },
  14544. //>>excludeStart("ide", pragmas.excludeIdeData);
  14545. args: ["anObject"],
  14546. 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",
  14547. referencedClasses: [],
  14548. //>>excludeEnd("ide");
  14549. messageSends: ["do:", "ifTrue:", "=", "+"]
  14550. }),
  14551. globals.Collection);
  14552. smalltalk.addMethod(
  14553. smalltalk.method({
  14554. selector: "putOn:",
  14555. protocol: 'streaming',
  14556. fn: function (aStream){
  14557. var self=this;
  14558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14559. return smalltalk.withContext(function($ctx1) {
  14560. //>>excludeEnd("ctx");
  14561. self._do_((function(each){
  14562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14563. return smalltalk.withContext(function($ctx2) {
  14564. //>>excludeEnd("ctx");
  14565. return _st(each)._putOn_(aStream);
  14566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14568. //>>excludeEnd("ctx");
  14569. }));
  14570. return self;
  14571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14572. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)});
  14573. //>>excludeEnd("ctx");
  14574. },
  14575. //>>excludeStart("ide", pragmas.excludeIdeData);
  14576. args: ["aStream"],
  14577. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  14578. referencedClasses: [],
  14579. //>>excludeEnd("ide");
  14580. messageSends: ["do:", "putOn:"]
  14581. }),
  14582. globals.Collection);
  14583. smalltalk.addMethod(
  14584. smalltalk.method({
  14585. selector: "reject:",
  14586. protocol: 'enumerating',
  14587. fn: function (aBlock){
  14588. var self=this;
  14589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14590. return smalltalk.withContext(function($ctx1) {
  14591. //>>excludeEnd("ctx");
  14592. var $1;
  14593. $1=self._select_((function(each){
  14594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14595. return smalltalk.withContext(function($ctx2) {
  14596. //>>excludeEnd("ctx");
  14597. return _st(_st(aBlock)._value_(each)).__eq(false);
  14598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14599. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14600. //>>excludeEnd("ctx");
  14601. }));
  14602. return $1;
  14603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14604. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)});
  14605. //>>excludeEnd("ctx");
  14606. },
  14607. //>>excludeStart("ide", pragmas.excludeIdeData);
  14608. args: ["aBlock"],
  14609. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  14610. referencedClasses: [],
  14611. //>>excludeEnd("ide");
  14612. messageSends: ["select:", "=", "value:"]
  14613. }),
  14614. globals.Collection);
  14615. smalltalk.addMethod(
  14616. smalltalk.method({
  14617. selector: "remove:",
  14618. protocol: 'adding/removing',
  14619. fn: function (anObject){
  14620. var self=this;
  14621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14622. return smalltalk.withContext(function($ctx1) {
  14623. //>>excludeEnd("ctx");
  14624. var $1;
  14625. $1=self._remove_ifAbsent_(anObject,(function(){
  14626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14627. return smalltalk.withContext(function($ctx2) {
  14628. //>>excludeEnd("ctx");
  14629. return self._errorNotFound();
  14630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14632. //>>excludeEnd("ctx");
  14633. }));
  14634. return $1;
  14635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14636. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)});
  14637. //>>excludeEnd("ctx");
  14638. },
  14639. //>>excludeStart("ide", pragmas.excludeIdeData);
  14640. args: ["anObject"],
  14641. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  14642. referencedClasses: [],
  14643. //>>excludeEnd("ide");
  14644. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  14645. }),
  14646. globals.Collection);
  14647. smalltalk.addMethod(
  14648. smalltalk.method({
  14649. selector: "remove:ifAbsent:",
  14650. protocol: 'adding/removing',
  14651. fn: function (anObject,aBlock){
  14652. var self=this;
  14653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14654. return smalltalk.withContext(function($ctx1) {
  14655. //>>excludeEnd("ctx");
  14656. self._subclassResponsibility();
  14657. return self;
  14658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14659. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)});
  14660. //>>excludeEnd("ctx");
  14661. },
  14662. //>>excludeStart("ide", pragmas.excludeIdeData);
  14663. args: ["anObject", "aBlock"],
  14664. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  14665. referencedClasses: [],
  14666. //>>excludeEnd("ide");
  14667. messageSends: ["subclassResponsibility"]
  14668. }),
  14669. globals.Collection);
  14670. smalltalk.addMethod(
  14671. smalltalk.method({
  14672. selector: "removeAll",
  14673. protocol: 'adding/removing',
  14674. fn: function (){
  14675. var self=this;
  14676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14677. return smalltalk.withContext(function($ctx1) {
  14678. //>>excludeEnd("ctx");
  14679. self._subclassResponsibility();
  14680. return self;
  14681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14682. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)});
  14683. //>>excludeEnd("ctx");
  14684. },
  14685. //>>excludeStart("ide", pragmas.excludeIdeData);
  14686. args: [],
  14687. source: "removeAll\x0a\x09self subclassResponsibility",
  14688. referencedClasses: [],
  14689. //>>excludeEnd("ide");
  14690. messageSends: ["subclassResponsibility"]
  14691. }),
  14692. globals.Collection);
  14693. smalltalk.addMethod(
  14694. smalltalk.method({
  14695. selector: "select:",
  14696. protocol: 'enumerating',
  14697. fn: function (aBlock){
  14698. var self=this;
  14699. var stream;
  14700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14701. return smalltalk.withContext(function($ctx1) {
  14702. //>>excludeEnd("ctx");
  14703. var $1,$2;
  14704. stream=_st(_st(self._class())._new())._writeStream();
  14705. self._do_((function(each){
  14706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14707. return smalltalk.withContext(function($ctx2) {
  14708. //>>excludeEnd("ctx");
  14709. $1=_st(aBlock)._value_(each);
  14710. if(smalltalk.assert($1)){
  14711. return _st(stream)._nextPut_(each);
  14712. };
  14713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14715. //>>excludeEnd("ctx");
  14716. }));
  14717. $2=_st(stream)._contents();
  14718. return $2;
  14719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14720. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)});
  14721. //>>excludeEnd("ctx");
  14722. },
  14723. //>>excludeStart("ide", pragmas.excludeIdeData);
  14724. args: ["aBlock"],
  14725. 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",
  14726. referencedClasses: [],
  14727. //>>excludeEnd("ide");
  14728. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  14729. }),
  14730. globals.Collection);
  14731. smalltalk.addMethod(
  14732. smalltalk.method({
  14733. selector: "select:thenCollect:",
  14734. protocol: 'enumerating',
  14735. fn: function (selectBlock,collectBlock){
  14736. var self=this;
  14737. var stream;
  14738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14739. return smalltalk.withContext(function($ctx1) {
  14740. //>>excludeEnd("ctx");
  14741. var $1,$2;
  14742. stream=_st(_st(self._class())._new())._writeStream();
  14743. self._do_((function(each){
  14744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14745. return smalltalk.withContext(function($ctx2) {
  14746. //>>excludeEnd("ctx");
  14747. $1=_st(selectBlock)._value_(each);
  14748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14749. $ctx2.sendIdx["value:"]=1;
  14750. //>>excludeEnd("ctx");
  14751. if(smalltalk.assert($1)){
  14752. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  14753. };
  14754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14756. //>>excludeEnd("ctx");
  14757. }));
  14758. $2=_st(stream)._contents();
  14759. return $2;
  14760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14761. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)});
  14762. //>>excludeEnd("ctx");
  14763. },
  14764. //>>excludeStart("ide", pragmas.excludeIdeData);
  14765. args: ["selectBlock", "collectBlock"],
  14766. 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",
  14767. referencedClasses: [],
  14768. //>>excludeEnd("ide");
  14769. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  14770. }),
  14771. globals.Collection);
  14772. smalltalk.addMethod(
  14773. smalltalk.method({
  14774. selector: "size",
  14775. protocol: 'accessing',
  14776. fn: function (){
  14777. var self=this;
  14778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14779. return smalltalk.withContext(function($ctx1) {
  14780. //>>excludeEnd("ctx");
  14781. self._subclassResponsibility();
  14782. return self;
  14783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14784. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)});
  14785. //>>excludeEnd("ctx");
  14786. },
  14787. //>>excludeStart("ide", pragmas.excludeIdeData);
  14788. args: [],
  14789. source: "size\x0a\x09self subclassResponsibility",
  14790. referencedClasses: [],
  14791. //>>excludeEnd("ide");
  14792. messageSends: ["subclassResponsibility"]
  14793. }),
  14794. globals.Collection);
  14795. smalltalk.addMethod(
  14796. smalltalk.method({
  14797. selector: "heliosClass",
  14798. protocol: 'helios',
  14799. fn: function (){
  14800. var self=this;
  14801. return "collection";
  14802. },
  14803. //>>excludeStart("ide", pragmas.excludeIdeData);
  14804. args: [],
  14805. source: "heliosClass\x0a\x09^ 'collection'",
  14806. referencedClasses: [],
  14807. //>>excludeEnd("ide");
  14808. messageSends: []
  14809. }),
  14810. globals.Collection.klass);
  14811. smalltalk.addMethod(
  14812. smalltalk.method({
  14813. selector: "new:",
  14814. protocol: 'instance creation',
  14815. fn: function (anInteger){
  14816. var self=this;
  14817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14818. return smalltalk.withContext(function($ctx1) {
  14819. //>>excludeEnd("ctx");
  14820. var $1;
  14821. $1=self._new();
  14822. return $1;
  14823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14824. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)});
  14825. //>>excludeEnd("ctx");
  14826. },
  14827. //>>excludeStart("ide", pragmas.excludeIdeData);
  14828. args: ["anInteger"],
  14829. source: "new: anInteger\x0a\x09^ self new",
  14830. referencedClasses: [],
  14831. //>>excludeEnd("ide");
  14832. messageSends: ["new"]
  14833. }),
  14834. globals.Collection.klass);
  14835. smalltalk.addMethod(
  14836. smalltalk.method({
  14837. selector: "with:",
  14838. protocol: 'instance creation',
  14839. fn: function (anObject){
  14840. var self=this;
  14841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14842. return smalltalk.withContext(function($ctx1) {
  14843. //>>excludeEnd("ctx");
  14844. var $2,$3,$1;
  14845. $2=self._new();
  14846. _st($2)._add_(anObject);
  14847. $3=_st($2)._yourself();
  14848. $1=$3;
  14849. return $1;
  14850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14851. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)});
  14852. //>>excludeEnd("ctx");
  14853. },
  14854. //>>excludeStart("ide", pragmas.excludeIdeData);
  14855. args: ["anObject"],
  14856. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  14857. referencedClasses: [],
  14858. //>>excludeEnd("ide");
  14859. messageSends: ["add:", "new", "yourself"]
  14860. }),
  14861. globals.Collection.klass);
  14862. smalltalk.addMethod(
  14863. smalltalk.method({
  14864. selector: "with:with:",
  14865. protocol: 'instance creation',
  14866. fn: function (anObject,anotherObject){
  14867. var self=this;
  14868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14869. return smalltalk.withContext(function($ctx1) {
  14870. //>>excludeEnd("ctx");
  14871. var $2,$3,$1;
  14872. $2=self._new();
  14873. _st($2)._add_(anObject);
  14874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14875. $ctx1.sendIdx["add:"]=1;
  14876. //>>excludeEnd("ctx");
  14877. _st($2)._add_(anotherObject);
  14878. $3=_st($2)._yourself();
  14879. $1=$3;
  14880. return $1;
  14881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14882. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)});
  14883. //>>excludeEnd("ctx");
  14884. },
  14885. //>>excludeStart("ide", pragmas.excludeIdeData);
  14886. args: ["anObject", "anotherObject"],
  14887. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  14888. referencedClasses: [],
  14889. //>>excludeEnd("ide");
  14890. messageSends: ["add:", "new", "yourself"]
  14891. }),
  14892. globals.Collection.klass);
  14893. smalltalk.addMethod(
  14894. smalltalk.method({
  14895. selector: "with:with:with:",
  14896. protocol: 'instance creation',
  14897. fn: function (firstObject,secondObject,thirdObject){
  14898. var self=this;
  14899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14900. return smalltalk.withContext(function($ctx1) {
  14901. //>>excludeEnd("ctx");
  14902. var $2,$3,$1;
  14903. $2=self._new();
  14904. _st($2)._add_(firstObject);
  14905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14906. $ctx1.sendIdx["add:"]=1;
  14907. //>>excludeEnd("ctx");
  14908. _st($2)._add_(secondObject);
  14909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14910. $ctx1.sendIdx["add:"]=2;
  14911. //>>excludeEnd("ctx");
  14912. _st($2)._add_(thirdObject);
  14913. $3=_st($2)._yourself();
  14914. $1=$3;
  14915. return $1;
  14916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14917. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)});
  14918. //>>excludeEnd("ctx");
  14919. },
  14920. //>>excludeStart("ide", pragmas.excludeIdeData);
  14921. args: ["firstObject", "secondObject", "thirdObject"],
  14922. 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",
  14923. referencedClasses: [],
  14924. //>>excludeEnd("ide");
  14925. messageSends: ["add:", "new", "yourself"]
  14926. }),
  14927. globals.Collection.klass);
  14928. smalltalk.addMethod(
  14929. smalltalk.method({
  14930. selector: "withAll:",
  14931. protocol: 'instance creation',
  14932. fn: function (aCollection){
  14933. var self=this;
  14934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14935. return smalltalk.withContext(function($ctx1) {
  14936. //>>excludeEnd("ctx");
  14937. var $2,$3,$1;
  14938. $2=self._new();
  14939. _st($2)._addAll_(aCollection);
  14940. $3=_st($2)._yourself();
  14941. $1=$3;
  14942. return $1;
  14943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14944. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)});
  14945. //>>excludeEnd("ctx");
  14946. },
  14947. //>>excludeStart("ide", pragmas.excludeIdeData);
  14948. args: ["aCollection"],
  14949. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  14950. referencedClasses: [],
  14951. //>>excludeEnd("ide");
  14952. messageSends: ["addAll:", "new", "yourself"]
  14953. }),
  14954. globals.Collection.klass);
  14955. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  14956. //>>excludeStart("ide", pragmas.excludeIdeData);
  14957. 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.";
  14958. //>>excludeEnd("ide");
  14959. smalltalk.addMethod(
  14960. smalltalk.method({
  14961. selector: "at:",
  14962. protocol: 'accessing',
  14963. fn: function (anIndex){
  14964. var self=this;
  14965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14966. return smalltalk.withContext(function($ctx1) {
  14967. //>>excludeEnd("ctx");
  14968. var $1;
  14969. $1=self._at_ifAbsent_(anIndex,(function(){
  14970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14971. return smalltalk.withContext(function($ctx2) {
  14972. //>>excludeEnd("ctx");
  14973. return self._errorNotFound();
  14974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14976. //>>excludeEnd("ctx");
  14977. }));
  14978. return $1;
  14979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14980. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)});
  14981. //>>excludeEnd("ctx");
  14982. },
  14983. //>>excludeStart("ide", pragmas.excludeIdeData);
  14984. args: ["anIndex"],
  14985. 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 ]",
  14986. referencedClasses: [],
  14987. //>>excludeEnd("ide");
  14988. messageSends: ["at:ifAbsent:", "errorNotFound"]
  14989. }),
  14990. globals.IndexableCollection);
  14991. smalltalk.addMethod(
  14992. smalltalk.method({
  14993. selector: "at:ifAbsent:",
  14994. protocol: 'accessing',
  14995. fn: function (anIndex,aBlock){
  14996. var self=this;
  14997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  14998. return smalltalk.withContext(function($ctx1) {
  14999. //>>excludeEnd("ctx");
  15000. self._subclassResponsibility();
  15001. return self;
  15002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15003. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  15004. //>>excludeEnd("ctx");
  15005. },
  15006. //>>excludeStart("ide", pragmas.excludeIdeData);
  15007. args: ["anIndex", "aBlock"],
  15008. 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",
  15009. referencedClasses: [],
  15010. //>>excludeEnd("ide");
  15011. messageSends: ["subclassResponsibility"]
  15012. }),
  15013. globals.IndexableCollection);
  15014. smalltalk.addMethod(
  15015. smalltalk.method({
  15016. selector: "at:ifAbsentPut:",
  15017. protocol: 'accessing',
  15018. fn: function (aKey,aBlock){
  15019. var self=this;
  15020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15021. return smalltalk.withContext(function($ctx1) {
  15022. //>>excludeEnd("ctx");
  15023. var $1;
  15024. $1=self._at_ifAbsent_(aKey,(function(){
  15025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15026. return smalltalk.withContext(function($ctx2) {
  15027. //>>excludeEnd("ctx");
  15028. return self._at_put_(aKey,_st(aBlock)._value());
  15029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15031. //>>excludeEnd("ctx");
  15032. }));
  15033. return $1;
  15034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15035. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)});
  15036. //>>excludeEnd("ctx");
  15037. },
  15038. //>>excludeStart("ide", pragmas.excludeIdeData);
  15039. args: ["aKey", "aBlock"],
  15040. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  15041. referencedClasses: [],
  15042. //>>excludeEnd("ide");
  15043. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  15044. }),
  15045. globals.IndexableCollection);
  15046. smalltalk.addMethod(
  15047. smalltalk.method({
  15048. selector: "at:ifPresent:",
  15049. protocol: 'accessing',
  15050. fn: function (anIndex,aBlock){
  15051. var self=this;
  15052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15053. return smalltalk.withContext(function($ctx1) {
  15054. //>>excludeEnd("ctx");
  15055. var $1;
  15056. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  15057. return nil;
  15058. }));
  15059. return $1;
  15060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15061. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  15062. //>>excludeEnd("ctx");
  15063. },
  15064. //>>excludeStart("ide", pragmas.excludeIdeData);
  15065. args: ["anIndex", "aBlock"],
  15066. 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 ]",
  15067. referencedClasses: [],
  15068. //>>excludeEnd("ide");
  15069. messageSends: ["at:ifPresent:ifAbsent:"]
  15070. }),
  15071. globals.IndexableCollection);
  15072. smalltalk.addMethod(
  15073. smalltalk.method({
  15074. selector: "at:ifPresent:ifAbsent:",
  15075. protocol: 'accessing',
  15076. fn: function (anIndex,aBlock,anotherBlock){
  15077. var self=this;
  15078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15079. return smalltalk.withContext(function($ctx1) {
  15080. //>>excludeEnd("ctx");
  15081. self._subclassResponsibility();
  15082. return self;
  15083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15084. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)});
  15085. //>>excludeEnd("ctx");
  15086. },
  15087. //>>excludeStart("ide", pragmas.excludeIdeData);
  15088. args: ["anIndex", "aBlock", "anotherBlock"],
  15089. 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",
  15090. referencedClasses: [],
  15091. //>>excludeEnd("ide");
  15092. messageSends: ["subclassResponsibility"]
  15093. }),
  15094. globals.IndexableCollection);
  15095. smalltalk.addMethod(
  15096. smalltalk.method({
  15097. selector: "at:put:",
  15098. protocol: 'accessing',
  15099. fn: function (anIndex,anObject){
  15100. var self=this;
  15101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15102. return smalltalk.withContext(function($ctx1) {
  15103. //>>excludeEnd("ctx");
  15104. self._subclassResponsibility();
  15105. return self;
  15106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15107. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)});
  15108. //>>excludeEnd("ctx");
  15109. },
  15110. //>>excludeStart("ide", pragmas.excludeIdeData);
  15111. args: ["anIndex", "anObject"],
  15112. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  15113. referencedClasses: [],
  15114. //>>excludeEnd("ide");
  15115. messageSends: ["subclassResponsibility"]
  15116. }),
  15117. globals.IndexableCollection);
  15118. smalltalk.addMethod(
  15119. smalltalk.method({
  15120. selector: "indexOf:",
  15121. protocol: 'accessing',
  15122. fn: function (anObject){
  15123. var self=this;
  15124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15125. return smalltalk.withContext(function($ctx1) {
  15126. //>>excludeEnd("ctx");
  15127. var $1;
  15128. $1=self._indexOf_ifAbsent_(anObject,(function(){
  15129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15130. return smalltalk.withContext(function($ctx2) {
  15131. //>>excludeEnd("ctx");
  15132. return self._errorNotFound();
  15133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15135. //>>excludeEnd("ctx");
  15136. }));
  15137. return $1;
  15138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15139. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)});
  15140. //>>excludeEnd("ctx");
  15141. },
  15142. //>>excludeStart("ide", pragmas.excludeIdeData);
  15143. args: ["anObject"],
  15144. 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 ]",
  15145. referencedClasses: [],
  15146. //>>excludeEnd("ide");
  15147. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  15148. }),
  15149. globals.IndexableCollection);
  15150. smalltalk.addMethod(
  15151. smalltalk.method({
  15152. selector: "indexOf:ifAbsent:",
  15153. protocol: 'accessing',
  15154. fn: function (anObject,aBlock){
  15155. var self=this;
  15156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15157. return smalltalk.withContext(function($ctx1) {
  15158. //>>excludeEnd("ctx");
  15159. self._subclassResponsibility();
  15160. return self;
  15161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15162. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)});
  15163. //>>excludeEnd("ctx");
  15164. },
  15165. //>>excludeStart("ide", pragmas.excludeIdeData);
  15166. args: ["anObject", "aBlock"],
  15167. 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",
  15168. referencedClasses: [],
  15169. //>>excludeEnd("ide");
  15170. messageSends: ["subclassResponsibility"]
  15171. }),
  15172. globals.IndexableCollection);
  15173. smalltalk.addMethod(
  15174. smalltalk.method({
  15175. selector: "with:do:",
  15176. protocol: 'enumerating',
  15177. fn: function (anotherCollection,aBlock){
  15178. var self=this;
  15179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15180. return smalltalk.withContext(function($ctx1) {
  15181. //>>excludeEnd("ctx");
  15182. self._withIndexDo_((function(each,index){
  15183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15184. return smalltalk.withContext(function($ctx2) {
  15185. //>>excludeEnd("ctx");
  15186. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  15187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15188. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  15189. //>>excludeEnd("ctx");
  15190. }));
  15191. return self;
  15192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15193. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)});
  15194. //>>excludeEnd("ctx");
  15195. },
  15196. //>>excludeStart("ide", pragmas.excludeIdeData);
  15197. args: ["anotherCollection", "aBlock"],
  15198. 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) ]",
  15199. referencedClasses: [],
  15200. //>>excludeEnd("ide");
  15201. messageSends: ["withIndexDo:", "value:value:", "at:"]
  15202. }),
  15203. globals.IndexableCollection);
  15204. smalltalk.addMethod(
  15205. smalltalk.method({
  15206. selector: "withIndexDo:",
  15207. protocol: 'enumerating',
  15208. fn: function (aBlock){
  15209. var self=this;
  15210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15211. return smalltalk.withContext(function($ctx1) {
  15212. //>>excludeEnd("ctx");
  15213. self._subclassResponsibility();
  15214. return self;
  15215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15216. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)});
  15217. //>>excludeEnd("ctx");
  15218. },
  15219. //>>excludeStart("ide", pragmas.excludeIdeData);
  15220. args: ["aBlock"],
  15221. 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",
  15222. referencedClasses: [],
  15223. //>>excludeEnd("ide");
  15224. messageSends: ["subclassResponsibility"]
  15225. }),
  15226. globals.IndexableCollection);
  15227. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  15228. //>>excludeStart("ide", pragmas.excludeIdeData);
  15229. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  15230. //>>excludeEnd("ide");
  15231. smalltalk.addMethod(
  15232. smalltalk.method({
  15233. selector: "=",
  15234. protocol: 'comparing',
  15235. fn: function (anAssocitativeCollection){
  15236. var self=this;
  15237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15238. return smalltalk.withContext(function($ctx1) {
  15239. //>>excludeEnd("ctx");
  15240. var $2,$1,$4,$3,$6,$5;
  15241. $2=self._class();
  15242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15243. $ctx1.sendIdx["class"]=1;
  15244. //>>excludeEnd("ctx");
  15245. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  15246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15247. $ctx1.sendIdx["="]=1;
  15248. //>>excludeEnd("ctx");
  15249. if(! smalltalk.assert($1)){
  15250. return false;
  15251. };
  15252. $4=self._size();
  15253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15254. $ctx1.sendIdx["size"]=1;
  15255. //>>excludeEnd("ctx");
  15256. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  15257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15258. $ctx1.sendIdx["="]=2;
  15259. //>>excludeEnd("ctx");
  15260. if(! smalltalk.assert($3)){
  15261. return false;
  15262. };
  15263. $6=self._associations();
  15264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15265. $ctx1.sendIdx["associations"]=1;
  15266. //>>excludeEnd("ctx");
  15267. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  15268. return $5;
  15269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15270. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)});
  15271. //>>excludeEnd("ctx");
  15272. },
  15273. //>>excludeStart("ide", pragmas.excludeIdeData);
  15274. args: ["anAssocitativeCollection"],
  15275. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  15276. referencedClasses: [],
  15277. //>>excludeEnd("ide");
  15278. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  15279. }),
  15280. globals.AssociativeCollection);
  15281. smalltalk.addMethod(
  15282. smalltalk.method({
  15283. selector: "add:",
  15284. protocol: 'adding/removing',
  15285. fn: function (anAssociation){
  15286. var self=this;
  15287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15288. return smalltalk.withContext(function($ctx1) {
  15289. //>>excludeEnd("ctx");
  15290. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  15291. return self;
  15292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15293. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)});
  15294. //>>excludeEnd("ctx");
  15295. },
  15296. //>>excludeStart("ide", pragmas.excludeIdeData);
  15297. args: ["anAssociation"],
  15298. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  15299. referencedClasses: [],
  15300. //>>excludeEnd("ide");
  15301. messageSends: ["at:put:", "key", "value"]
  15302. }),
  15303. globals.AssociativeCollection);
  15304. smalltalk.addMethod(
  15305. smalltalk.method({
  15306. selector: "addAll:",
  15307. protocol: 'adding/removing',
  15308. fn: function (anAssociativeCollection){
  15309. var self=this;
  15310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15311. return smalltalk.withContext(function($ctx1) {
  15312. //>>excludeEnd("ctx");
  15313. (
  15314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15315. $ctx1.supercall = true,
  15316. //>>excludeEnd("ctx");
  15317. globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]));
  15318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15319. $ctx1.supercall = false;
  15320. //>>excludeEnd("ctx");;
  15321. return anAssociativeCollection;
  15322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15323. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)});
  15324. //>>excludeEnd("ctx");
  15325. },
  15326. //>>excludeStart("ide", pragmas.excludeIdeData);
  15327. args: ["anAssociativeCollection"],
  15328. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  15329. referencedClasses: [],
  15330. //>>excludeEnd("ide");
  15331. messageSends: ["addAll:", "associations"]
  15332. }),
  15333. globals.AssociativeCollection);
  15334. smalltalk.addMethod(
  15335. smalltalk.method({
  15336. selector: "asDictionary",
  15337. protocol: 'converting',
  15338. fn: function (){
  15339. var self=this;
  15340. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  15341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15342. return smalltalk.withContext(function($ctx1) {
  15343. //>>excludeEnd("ctx");
  15344. var $1;
  15345. $1=_st($Dictionary())._from_(self._associations());
  15346. return $1;
  15347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15348. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)});
  15349. //>>excludeEnd("ctx");
  15350. },
  15351. //>>excludeStart("ide", pragmas.excludeIdeData);
  15352. args: [],
  15353. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  15354. referencedClasses: ["Dictionary"],
  15355. //>>excludeEnd("ide");
  15356. messageSends: ["from:", "associations"]
  15357. }),
  15358. globals.AssociativeCollection);
  15359. smalltalk.addMethod(
  15360. smalltalk.method({
  15361. selector: "asHashedCollection",
  15362. protocol: 'converting',
  15363. fn: function (){
  15364. var self=this;
  15365. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  15366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15367. return smalltalk.withContext(function($ctx1) {
  15368. //>>excludeEnd("ctx");
  15369. var $1;
  15370. $1=_st($HashedCollection())._from_(self._associations());
  15371. return $1;
  15372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15373. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)});
  15374. //>>excludeEnd("ctx");
  15375. },
  15376. //>>excludeStart("ide", pragmas.excludeIdeData);
  15377. args: [],
  15378. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  15379. referencedClasses: ["HashedCollection"],
  15380. //>>excludeEnd("ide");
  15381. messageSends: ["from:", "associations"]
  15382. }),
  15383. globals.AssociativeCollection);
  15384. smalltalk.addMethod(
  15385. smalltalk.method({
  15386. selector: "asJSON",
  15387. protocol: 'converting',
  15388. fn: function (){
  15389. var self=this;
  15390. var hash;
  15391. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  15392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15393. return smalltalk.withContext(function($ctx1) {
  15394. //>>excludeEnd("ctx");
  15395. var $1;
  15396. hash=_st($HashedCollection())._new();
  15397. self._keysAndValuesDo_((function(key,value){
  15398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15399. return smalltalk.withContext(function($ctx2) {
  15400. //>>excludeEnd("ctx");
  15401. return _st(hash)._at_put_(key,_st(value)._asJSON());
  15402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15403. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15404. //>>excludeEnd("ctx");
  15405. }));
  15406. $1=hash;
  15407. return $1;
  15408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15409. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)});
  15410. //>>excludeEnd("ctx");
  15411. },
  15412. //>>excludeStart("ide", pragmas.excludeIdeData);
  15413. args: [],
  15414. 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",
  15415. referencedClasses: ["HashedCollection"],
  15416. //>>excludeEnd("ide");
  15417. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  15418. }),
  15419. globals.AssociativeCollection);
  15420. smalltalk.addMethod(
  15421. smalltalk.method({
  15422. selector: "associations",
  15423. protocol: 'accessing',
  15424. fn: function (){
  15425. var self=this;
  15426. var associations;
  15427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15428. return smalltalk.withContext(function($ctx1) {
  15429. //>>excludeEnd("ctx");
  15430. var $1;
  15431. associations=[];
  15432. self._associationsDo_((function(each){
  15433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15434. return smalltalk.withContext(function($ctx2) {
  15435. //>>excludeEnd("ctx");
  15436. return _st(associations)._add_(each);
  15437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15439. //>>excludeEnd("ctx");
  15440. }));
  15441. $1=associations;
  15442. return $1;
  15443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15444. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)});
  15445. //>>excludeEnd("ctx");
  15446. },
  15447. //>>excludeStart("ide", pragmas.excludeIdeData);
  15448. args: [],
  15449. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  15450. referencedClasses: [],
  15451. //>>excludeEnd("ide");
  15452. messageSends: ["associationsDo:", "add:"]
  15453. }),
  15454. globals.AssociativeCollection);
  15455. smalltalk.addMethod(
  15456. smalltalk.method({
  15457. selector: "associationsDo:",
  15458. protocol: 'enumerating',
  15459. fn: function (aBlock){
  15460. var self=this;
  15461. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  15462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15463. return smalltalk.withContext(function($ctx1) {
  15464. //>>excludeEnd("ctx");
  15465. self._keysAndValuesDo_((function(key,value){
  15466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15467. return smalltalk.withContext(function($ctx2) {
  15468. //>>excludeEnd("ctx");
  15469. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  15470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15471. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15472. //>>excludeEnd("ctx");
  15473. }));
  15474. return self;
  15475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15476. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15477. //>>excludeEnd("ctx");
  15478. },
  15479. //>>excludeStart("ide", pragmas.excludeIdeData);
  15480. args: ["aBlock"],
  15481. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  15482. referencedClasses: ["Association"],
  15483. //>>excludeEnd("ide");
  15484. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  15485. }),
  15486. globals.AssociativeCollection);
  15487. smalltalk.addMethod(
  15488. smalltalk.method({
  15489. selector: "at:ifPresent:ifAbsent:",
  15490. protocol: 'accessing',
  15491. fn: function (aKey,aBlock,anotherBlock){
  15492. var self=this;
  15493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15494. return smalltalk.withContext(function($ctx1) {
  15495. //>>excludeEnd("ctx");
  15496. var $2,$1;
  15497. $2=self._includesKey_(aKey);
  15498. if(smalltalk.assert($2)){
  15499. $1=_st(aBlock)._value_(self._at_(aKey));
  15500. } else {
  15501. $1=_st(anotherBlock)._value();
  15502. };
  15503. return $1;
  15504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15505. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  15506. //>>excludeEnd("ctx");
  15507. },
  15508. //>>excludeStart("ide", pragmas.excludeIdeData);
  15509. args: ["aKey", "aBlock", "anotherBlock"],
  15510. 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 ]",
  15511. referencedClasses: [],
  15512. //>>excludeEnd("ide");
  15513. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  15514. }),
  15515. globals.AssociativeCollection);
  15516. smalltalk.addMethod(
  15517. smalltalk.method({
  15518. selector: "collect:",
  15519. protocol: 'enumerating',
  15520. fn: function (aBlock){
  15521. var self=this;
  15522. var newDict;
  15523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15524. return smalltalk.withContext(function($ctx1) {
  15525. //>>excludeEnd("ctx");
  15526. var $1;
  15527. newDict=_st(self._class())._new();
  15528. self._keysAndValuesDo_((function(key,value){
  15529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15530. return smalltalk.withContext(function($ctx2) {
  15531. //>>excludeEnd("ctx");
  15532. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  15533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15534. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15535. //>>excludeEnd("ctx");
  15536. }));
  15537. $1=newDict;
  15538. return $1;
  15539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15540. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  15541. //>>excludeEnd("ctx");
  15542. },
  15543. //>>excludeStart("ide", pragmas.excludeIdeData);
  15544. args: ["aBlock"],
  15545. 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",
  15546. referencedClasses: [],
  15547. //>>excludeEnd("ide");
  15548. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  15549. }),
  15550. globals.AssociativeCollection);
  15551. smalltalk.addMethod(
  15552. smalltalk.method({
  15553. selector: "deepCopy",
  15554. protocol: 'copying',
  15555. fn: function (){
  15556. var self=this;
  15557. var copy;
  15558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15559. return smalltalk.withContext(function($ctx1) {
  15560. //>>excludeEnd("ctx");
  15561. var $1;
  15562. copy=_st(self._class())._new();
  15563. self._keysAndValuesDo_((function(key,value){
  15564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15565. return smalltalk.withContext(function($ctx2) {
  15566. //>>excludeEnd("ctx");
  15567. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  15568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15569. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  15570. //>>excludeEnd("ctx");
  15571. }));
  15572. $1=copy;
  15573. return $1;
  15574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15575. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)});
  15576. //>>excludeEnd("ctx");
  15577. },
  15578. //>>excludeStart("ide", pragmas.excludeIdeData);
  15579. args: [],
  15580. 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",
  15581. referencedClasses: [],
  15582. //>>excludeEnd("ide");
  15583. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  15584. }),
  15585. globals.AssociativeCollection);
  15586. smalltalk.addMethod(
  15587. smalltalk.method({
  15588. selector: "detect:ifNone:",
  15589. protocol: 'enumerating',
  15590. fn: function (aBlock,anotherBlock){
  15591. var self=this;
  15592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15593. return smalltalk.withContext(function($ctx1) {
  15594. //>>excludeEnd("ctx");
  15595. var $1;
  15596. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  15597. return $1;
  15598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15599. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  15600. //>>excludeEnd("ctx");
  15601. },
  15602. //>>excludeStart("ide", pragmas.excludeIdeData);
  15603. args: ["aBlock", "anotherBlock"],
  15604. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  15605. referencedClasses: [],
  15606. //>>excludeEnd("ide");
  15607. messageSends: ["detect:ifNone:", "values"]
  15608. }),
  15609. globals.AssociativeCollection);
  15610. smalltalk.addMethod(
  15611. smalltalk.method({
  15612. selector: "do:",
  15613. protocol: 'enumerating',
  15614. fn: function (aBlock){
  15615. var self=this;
  15616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15617. return smalltalk.withContext(function($ctx1) {
  15618. //>>excludeEnd("ctx");
  15619. self._valuesDo_(aBlock);
  15620. return self;
  15621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15622. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)});
  15623. //>>excludeEnd("ctx");
  15624. },
  15625. //>>excludeStart("ide", pragmas.excludeIdeData);
  15626. args: ["aBlock"],
  15627. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  15628. referencedClasses: [],
  15629. //>>excludeEnd("ide");
  15630. messageSends: ["valuesDo:"]
  15631. }),
  15632. globals.AssociativeCollection);
  15633. smalltalk.addMethod(
  15634. smalltalk.method({
  15635. selector: "includes:",
  15636. protocol: 'enumerating',
  15637. fn: function (anObject){
  15638. var self=this;
  15639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15640. return smalltalk.withContext(function($ctx1) {
  15641. //>>excludeEnd("ctx");
  15642. var $1;
  15643. $1=_st(self._values())._includes_(anObject);
  15644. return $1;
  15645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15646. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)});
  15647. //>>excludeEnd("ctx");
  15648. },
  15649. //>>excludeStart("ide", pragmas.excludeIdeData);
  15650. args: ["anObject"],
  15651. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  15652. referencedClasses: [],
  15653. //>>excludeEnd("ide");
  15654. messageSends: ["includes:", "values"]
  15655. }),
  15656. globals.AssociativeCollection);
  15657. smalltalk.addMethod(
  15658. smalltalk.method({
  15659. selector: "includesKey:",
  15660. protocol: 'testing',
  15661. fn: function (aKey){
  15662. var self=this;
  15663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15664. return smalltalk.withContext(function($ctx1) {
  15665. //>>excludeEnd("ctx");
  15666. self._subclassResponsibility();
  15667. return self;
  15668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15669. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)});
  15670. //>>excludeEnd("ctx");
  15671. },
  15672. //>>excludeStart("ide", pragmas.excludeIdeData);
  15673. args: ["aKey"],
  15674. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  15675. referencedClasses: [],
  15676. //>>excludeEnd("ide");
  15677. messageSends: ["subclassResponsibility"]
  15678. }),
  15679. globals.AssociativeCollection);
  15680. smalltalk.addMethod(
  15681. smalltalk.method({
  15682. selector: "indexOf:ifAbsent:",
  15683. protocol: 'accessing',
  15684. fn: function (anObject,aBlock){
  15685. var self=this;
  15686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15687. return smalltalk.withContext(function($ctx1) {
  15688. //>>excludeEnd("ctx");
  15689. var $1;
  15690. $1=_st(self._keys())._detect_ifNone_((function(each){
  15691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15692. return smalltalk.withContext(function($ctx2) {
  15693. //>>excludeEnd("ctx");
  15694. return _st(self._at_(each)).__eq(anObject);
  15695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15696. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15697. //>>excludeEnd("ctx");
  15698. }),aBlock);
  15699. return $1;
  15700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15701. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  15702. //>>excludeEnd("ctx");
  15703. },
  15704. //>>excludeStart("ide", pragmas.excludeIdeData);
  15705. args: ["anObject", "aBlock"],
  15706. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  15707. referencedClasses: [],
  15708. //>>excludeEnd("ide");
  15709. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  15710. }),
  15711. globals.AssociativeCollection);
  15712. smalltalk.addMethod(
  15713. smalltalk.method({
  15714. selector: "keyAtValue:",
  15715. protocol: 'accessing',
  15716. fn: function (anObject){
  15717. var self=this;
  15718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15719. return smalltalk.withContext(function($ctx1) {
  15720. //>>excludeEnd("ctx");
  15721. var $1;
  15722. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  15723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15724. return smalltalk.withContext(function($ctx2) {
  15725. //>>excludeEnd("ctx");
  15726. return self._errorNotFound();
  15727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15729. //>>excludeEnd("ctx");
  15730. }));
  15731. return $1;
  15732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15733. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)});
  15734. //>>excludeEnd("ctx");
  15735. },
  15736. //>>excludeStart("ide", pragmas.excludeIdeData);
  15737. args: ["anObject"],
  15738. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  15739. referencedClasses: [],
  15740. //>>excludeEnd("ide");
  15741. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  15742. }),
  15743. globals.AssociativeCollection);
  15744. smalltalk.addMethod(
  15745. smalltalk.method({
  15746. selector: "keyAtValue:ifAbsent:",
  15747. protocol: 'accessing',
  15748. fn: function (anObject,aBlock){
  15749. var self=this;
  15750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15751. return smalltalk.withContext(function($ctx1) {
  15752. //>>excludeEnd("ctx");
  15753. var $1;
  15754. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  15755. return $1;
  15756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15757. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  15758. //>>excludeEnd("ctx");
  15759. },
  15760. //>>excludeStart("ide", pragmas.excludeIdeData);
  15761. args: ["anObject", "aBlock"],
  15762. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  15763. referencedClasses: [],
  15764. //>>excludeEnd("ide");
  15765. messageSends: ["indexOf:ifAbsent:"]
  15766. }),
  15767. globals.AssociativeCollection);
  15768. smalltalk.addMethod(
  15769. smalltalk.method({
  15770. selector: "keys",
  15771. protocol: 'accessing',
  15772. fn: function (){
  15773. var self=this;
  15774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15775. return smalltalk.withContext(function($ctx1) {
  15776. //>>excludeEnd("ctx");
  15777. self._subclassResponsibility();
  15778. return self;
  15779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15780. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)});
  15781. //>>excludeEnd("ctx");
  15782. },
  15783. //>>excludeStart("ide", pragmas.excludeIdeData);
  15784. args: [],
  15785. source: "keys\x0a\x09self subclassResponsibility",
  15786. referencedClasses: [],
  15787. //>>excludeEnd("ide");
  15788. messageSends: ["subclassResponsibility"]
  15789. }),
  15790. globals.AssociativeCollection);
  15791. smalltalk.addMethod(
  15792. smalltalk.method({
  15793. selector: "keysAndValuesDo:",
  15794. protocol: 'enumerating',
  15795. fn: function (aBlock){
  15796. var self=this;
  15797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15798. return smalltalk.withContext(function($ctx1) {
  15799. //>>excludeEnd("ctx");
  15800. self._keysDo_((function(each){
  15801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15802. return smalltalk.withContext(function($ctx2) {
  15803. //>>excludeEnd("ctx");
  15804. return _st(aBlock)._value_value_(each,self._at_(each));
  15805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15806. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15807. //>>excludeEnd("ctx");
  15808. }));
  15809. return self;
  15810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15811. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15812. //>>excludeEnd("ctx");
  15813. },
  15814. //>>excludeStart("ide", pragmas.excludeIdeData);
  15815. args: ["aBlock"],
  15816. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  15817. referencedClasses: [],
  15818. //>>excludeEnd("ide");
  15819. messageSends: ["keysDo:", "value:value:", "at:"]
  15820. }),
  15821. globals.AssociativeCollection);
  15822. smalltalk.addMethod(
  15823. smalltalk.method({
  15824. selector: "keysDo:",
  15825. protocol: 'enumerating',
  15826. fn: function (aBlock){
  15827. var self=this;
  15828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15829. return smalltalk.withContext(function($ctx1) {
  15830. //>>excludeEnd("ctx");
  15831. self._subclassResponsibility();
  15832. return self;
  15833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15834. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  15835. //>>excludeEnd("ctx");
  15836. },
  15837. //>>excludeStart("ide", pragmas.excludeIdeData);
  15838. args: ["aBlock"],
  15839. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  15840. referencedClasses: [],
  15841. //>>excludeEnd("ide");
  15842. messageSends: ["subclassResponsibility"]
  15843. }),
  15844. globals.AssociativeCollection);
  15845. smalltalk.addMethod(
  15846. smalltalk.method({
  15847. selector: "printOn:",
  15848. protocol: 'printing',
  15849. fn: function (aStream){
  15850. var self=this;
  15851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15852. return smalltalk.withContext(function($ctx1) {
  15853. //>>excludeEnd("ctx");
  15854. (
  15855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15856. $ctx1.supercall = true,
  15857. //>>excludeEnd("ctx");
  15858. globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  15859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15860. $ctx1.supercall = false;
  15861. //>>excludeEnd("ctx");;
  15862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15863. $ctx1.sendIdx["printOn:"]=1;
  15864. //>>excludeEnd("ctx");
  15865. _st(aStream)._nextPutAll_(" (");
  15866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15867. $ctx1.sendIdx["nextPutAll:"]=1;
  15868. //>>excludeEnd("ctx");
  15869. _st(self._associations())._do_separatedBy_((function(each){
  15870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15871. return smalltalk.withContext(function($ctx2) {
  15872. //>>excludeEnd("ctx");
  15873. return _st(each)._printOn_(aStream);
  15874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15876. //>>excludeEnd("ctx");
  15877. }),(function(){
  15878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15879. return smalltalk.withContext(function($ctx2) {
  15880. //>>excludeEnd("ctx");
  15881. return _st(aStream)._nextPutAll_(" , ");
  15882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15883. $ctx2.sendIdx["nextPutAll:"]=2;
  15884. //>>excludeEnd("ctx");
  15885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15887. //>>excludeEnd("ctx");
  15888. }));
  15889. _st(aStream)._nextPutAll_(")");
  15890. return self;
  15891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15892. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)});
  15893. //>>excludeEnd("ctx");
  15894. },
  15895. //>>excludeStart("ide", pragmas.excludeIdeData);
  15896. args: ["aStream"],
  15897. 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: ')'",
  15898. referencedClasses: [],
  15899. //>>excludeEnd("ide");
  15900. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  15901. }),
  15902. globals.AssociativeCollection);
  15903. smalltalk.addMethod(
  15904. smalltalk.method({
  15905. selector: "remove:ifAbsent:",
  15906. protocol: 'adding/removing',
  15907. fn: function (aKey,aBlock){
  15908. var self=this;
  15909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15910. return smalltalk.withContext(function($ctx1) {
  15911. //>>excludeEnd("ctx");
  15912. var $1;
  15913. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  15914. return $1;
  15915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15916. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  15917. //>>excludeEnd("ctx");
  15918. },
  15919. //>>excludeStart("ide", pragmas.excludeIdeData);
  15920. args: ["aKey", "aBlock"],
  15921. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  15922. referencedClasses: [],
  15923. //>>excludeEnd("ide");
  15924. messageSends: ["removeKey:ifAbsent:"]
  15925. }),
  15926. globals.AssociativeCollection);
  15927. smalltalk.addMethod(
  15928. smalltalk.method({
  15929. selector: "removeAll",
  15930. protocol: 'adding/removing',
  15931. fn: function (){
  15932. var self=this;
  15933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15934. return smalltalk.withContext(function($ctx1) {
  15935. //>>excludeEnd("ctx");
  15936. var $1;
  15937. $1=_st(self._keys())._do_((function(each){
  15938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15939. return smalltalk.withContext(function($ctx2) {
  15940. //>>excludeEnd("ctx");
  15941. return self._removeKey_(each);
  15942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15943. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15944. //>>excludeEnd("ctx");
  15945. }));
  15946. return $1;
  15947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15948. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)});
  15949. //>>excludeEnd("ctx");
  15950. },
  15951. //>>excludeStart("ide", pragmas.excludeIdeData);
  15952. args: [],
  15953. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  15954. referencedClasses: [],
  15955. //>>excludeEnd("ide");
  15956. messageSends: ["do:", "keys", "removeKey:"]
  15957. }),
  15958. globals.AssociativeCollection);
  15959. smalltalk.addMethod(
  15960. smalltalk.method({
  15961. selector: "removeKey:",
  15962. protocol: 'adding/removing',
  15963. fn: function (aKey){
  15964. var self=this;
  15965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15966. return smalltalk.withContext(function($ctx1) {
  15967. //>>excludeEnd("ctx");
  15968. var $1;
  15969. $1=self._remove_(aKey);
  15970. return $1;
  15971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15972. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)});
  15973. //>>excludeEnd("ctx");
  15974. },
  15975. //>>excludeStart("ide", pragmas.excludeIdeData);
  15976. args: ["aKey"],
  15977. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  15978. referencedClasses: [],
  15979. //>>excludeEnd("ide");
  15980. messageSends: ["remove:"]
  15981. }),
  15982. globals.AssociativeCollection);
  15983. smalltalk.addMethod(
  15984. smalltalk.method({
  15985. selector: "removeKey:ifAbsent:",
  15986. protocol: 'adding/removing',
  15987. fn: function (aKey,aBlock){
  15988. var self=this;
  15989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15990. return smalltalk.withContext(function($ctx1) {
  15991. //>>excludeEnd("ctx");
  15992. self._subclassResponsibility();
  15993. return self;
  15994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  15995. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  15996. //>>excludeEnd("ctx");
  15997. },
  15998. //>>excludeStart("ide", pragmas.excludeIdeData);
  15999. args: ["aKey", "aBlock"],
  16000. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  16001. referencedClasses: [],
  16002. //>>excludeEnd("ide");
  16003. messageSends: ["subclassResponsibility"]
  16004. }),
  16005. globals.AssociativeCollection);
  16006. smalltalk.addMethod(
  16007. smalltalk.method({
  16008. selector: "select:",
  16009. protocol: 'enumerating',
  16010. fn: function (aBlock){
  16011. var self=this;
  16012. var newDict;
  16013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16014. return smalltalk.withContext(function($ctx1) {
  16015. //>>excludeEnd("ctx");
  16016. var $1,$2;
  16017. newDict=_st(self._class())._new();
  16018. self._keysAndValuesDo_((function(key,value){
  16019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16020. return smalltalk.withContext(function($ctx2) {
  16021. //>>excludeEnd("ctx");
  16022. $1=_st(aBlock)._value_(value);
  16023. if(smalltalk.assert($1)){
  16024. return _st(newDict)._at_put_(key,value);
  16025. };
  16026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16027. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16028. //>>excludeEnd("ctx");
  16029. }));
  16030. $2=newDict;
  16031. return $2;
  16032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16033. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  16034. //>>excludeEnd("ctx");
  16035. },
  16036. //>>excludeStart("ide", pragmas.excludeIdeData);
  16037. args: ["aBlock"],
  16038. 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",
  16039. referencedClasses: [],
  16040. //>>excludeEnd("ide");
  16041. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  16042. }),
  16043. globals.AssociativeCollection);
  16044. smalltalk.addMethod(
  16045. smalltalk.method({
  16046. selector: "shallowCopy",
  16047. protocol: 'copying',
  16048. fn: function (){
  16049. var self=this;
  16050. var copy;
  16051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16052. return smalltalk.withContext(function($ctx1) {
  16053. //>>excludeEnd("ctx");
  16054. var $1;
  16055. copy=_st(self._class())._new();
  16056. self._keysAndValuesDo_((function(key,value){
  16057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16058. return smalltalk.withContext(function($ctx2) {
  16059. //>>excludeEnd("ctx");
  16060. return _st(copy)._at_put_(key,value);
  16061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16062. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16063. //>>excludeEnd("ctx");
  16064. }));
  16065. $1=copy;
  16066. return $1;
  16067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16068. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)});
  16069. //>>excludeEnd("ctx");
  16070. },
  16071. //>>excludeStart("ide", pragmas.excludeIdeData);
  16072. args: [],
  16073. 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",
  16074. referencedClasses: [],
  16075. //>>excludeEnd("ide");
  16076. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  16077. }),
  16078. globals.AssociativeCollection);
  16079. smalltalk.addMethod(
  16080. smalltalk.method({
  16081. selector: "size",
  16082. protocol: 'accessing',
  16083. fn: function (){
  16084. var self=this;
  16085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16086. return smalltalk.withContext(function($ctx1) {
  16087. //>>excludeEnd("ctx");
  16088. var $1;
  16089. $1=_st(self._keys())._size();
  16090. return $1;
  16091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16092. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)});
  16093. //>>excludeEnd("ctx");
  16094. },
  16095. //>>excludeStart("ide", pragmas.excludeIdeData);
  16096. args: [],
  16097. source: "size\x0a\x09^ self keys size",
  16098. referencedClasses: [],
  16099. //>>excludeEnd("ide");
  16100. messageSends: ["size", "keys"]
  16101. }),
  16102. globals.AssociativeCollection);
  16103. smalltalk.addMethod(
  16104. smalltalk.method({
  16105. selector: "values",
  16106. protocol: 'accessing',
  16107. fn: function (){
  16108. var self=this;
  16109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16110. return smalltalk.withContext(function($ctx1) {
  16111. //>>excludeEnd("ctx");
  16112. self._subclassResponsibility();
  16113. return self;
  16114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16115. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)});
  16116. //>>excludeEnd("ctx");
  16117. },
  16118. //>>excludeStart("ide", pragmas.excludeIdeData);
  16119. args: [],
  16120. source: "values\x0a\x09self subclassResponsibility",
  16121. referencedClasses: [],
  16122. //>>excludeEnd("ide");
  16123. messageSends: ["subclassResponsibility"]
  16124. }),
  16125. globals.AssociativeCollection);
  16126. smalltalk.addMethod(
  16127. smalltalk.method({
  16128. selector: "valuesDo:",
  16129. protocol: 'enumerating',
  16130. fn: function (aBlock){
  16131. var self=this;
  16132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16133. return smalltalk.withContext(function($ctx1) {
  16134. //>>excludeEnd("ctx");
  16135. self._subclassResponsibility();
  16136. return self;
  16137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16138. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  16139. //>>excludeEnd("ctx");
  16140. },
  16141. //>>excludeStart("ide", pragmas.excludeIdeData);
  16142. args: ["aBlock"],
  16143. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  16144. referencedClasses: [],
  16145. //>>excludeEnd("ide");
  16146. messageSends: ["subclassResponsibility"]
  16147. }),
  16148. globals.AssociativeCollection);
  16149. smalltalk.addMethod(
  16150. smalltalk.method({
  16151. selector: "withIndexDo:",
  16152. protocol: 'enumerating',
  16153. fn: function (aBlock){
  16154. var self=this;
  16155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16156. return smalltalk.withContext(function($ctx1) {
  16157. //>>excludeEnd("ctx");
  16158. self._keysAndValuesDo_((function(key,value){
  16159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16160. return smalltalk.withContext(function($ctx2) {
  16161. //>>excludeEnd("ctx");
  16162. return _st(aBlock)._value_value_(value,key);
  16163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16164. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  16165. //>>excludeEnd("ctx");
  16166. }));
  16167. return self;
  16168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16169. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  16170. //>>excludeEnd("ctx");
  16171. },
  16172. //>>excludeStart("ide", pragmas.excludeIdeData);
  16173. args: ["aBlock"],
  16174. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  16175. referencedClasses: [],
  16176. //>>excludeEnd("ide");
  16177. messageSends: ["keysAndValuesDo:", "value:value:"]
  16178. }),
  16179. globals.AssociativeCollection);
  16180. smalltalk.addMethod(
  16181. smalltalk.method({
  16182. selector: "from:",
  16183. protocol: 'instance creation',
  16184. fn: function (aCollection){
  16185. var self=this;
  16186. var newCollection;
  16187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16188. return smalltalk.withContext(function($ctx1) {
  16189. //>>excludeEnd("ctx");
  16190. var $1;
  16191. newCollection=self._new();
  16192. _st(aCollection)._do_((function(each){
  16193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16194. return smalltalk.withContext(function($ctx2) {
  16195. //>>excludeEnd("ctx");
  16196. return _st(newCollection)._add_(each);
  16197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16199. //>>excludeEnd("ctx");
  16200. }));
  16201. $1=newCollection;
  16202. return $1;
  16203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16204. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  16205. //>>excludeEnd("ctx");
  16206. },
  16207. //>>excludeStart("ide", pragmas.excludeIdeData);
  16208. args: ["aCollection"],
  16209. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  16210. referencedClasses: [],
  16211. //>>excludeEnd("ide");
  16212. messageSends: ["new", "do:", "add:"]
  16213. }),
  16214. globals.AssociativeCollection.klass);
  16215. smalltalk.addMethod(
  16216. smalltalk.method({
  16217. selector: "fromPairs:",
  16218. protocol: 'instance creation',
  16219. fn: function (aCollection){
  16220. var self=this;
  16221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16222. return smalltalk.withContext(function($ctx1) {
  16223. //>>excludeEnd("ctx");
  16224. var $1;
  16225. $1=self._from_(aCollection);
  16226. return $1;
  16227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16228. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)});
  16229. //>>excludeEnd("ctx");
  16230. },
  16231. //>>excludeStart("ide", pragmas.excludeIdeData);
  16232. args: ["aCollection"],
  16233. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  16234. referencedClasses: [],
  16235. //>>excludeEnd("ide");
  16236. messageSends: ["from:"]
  16237. }),
  16238. globals.AssociativeCollection.klass);
  16239. smalltalk.addMethod(
  16240. smalltalk.method({
  16241. selector: "newFromPairs:",
  16242. protocol: 'instance creation',
  16243. fn: function (aCollection){
  16244. var self=this;
  16245. var newCollection;
  16246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16247. return smalltalk.withContext(function($ctx1) {
  16248. //>>excludeEnd("ctx");
  16249. var $2,$1,$3,$4,$5;
  16250. $2=_st(aCollection)._size();
  16251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16252. $ctx1.sendIdx["size"]=1;
  16253. //>>excludeEnd("ctx");
  16254. $1=_st($2)._even();
  16255. if(! smalltalk.assert($1)){
  16256. self._error_("#newFromPairs only accepts arrays of an even length");
  16257. };
  16258. newCollection=self._new();
  16259. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  16260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16261. return smalltalk.withContext(function($ctx2) {
  16262. //>>excludeEnd("ctx");
  16263. $3=newCollection;
  16264. $4=_st(aCollection)._at_(each);
  16265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16266. $ctx2.sendIdx["at:"]=1;
  16267. //>>excludeEnd("ctx");
  16268. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  16269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  16271. //>>excludeEnd("ctx");
  16272. }));
  16273. $5=newCollection;
  16274. return $5;
  16275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16276. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  16277. //>>excludeEnd("ctx");
  16278. },
  16279. //>>excludeStart("ide", pragmas.excludeIdeData);
  16280. args: ["aCollection"],
  16281. 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",
  16282. referencedClasses: [],
  16283. //>>excludeEnd("ide");
  16284. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  16285. }),
  16286. globals.AssociativeCollection.klass);
  16287. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  16288. //>>excludeStart("ide", pragmas.excludeIdeData);
  16289. 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.";
  16290. //>>excludeEnd("ide");
  16291. smalltalk.addMethod(
  16292. smalltalk.method({
  16293. selector: "at:ifAbsent:",
  16294. protocol: 'accessing',
  16295. fn: function (aKey,aBlock){
  16296. var self=this;
  16297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16298. return smalltalk.withContext(function($ctx1) {
  16299. //>>excludeEnd("ctx");
  16300. var index = self._positionOfKey_(aKey);
  16301. return index >=0 ? self['@values'][index] : aBlock._value();
  16302. ;
  16303. return self;
  16304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16305. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  16306. //>>excludeEnd("ctx");
  16307. },
  16308. //>>excludeStart("ide", pragmas.excludeIdeData);
  16309. args: ["aKey", "aBlock"],
  16310. 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>",
  16311. referencedClasses: [],
  16312. //>>excludeEnd("ide");
  16313. messageSends: []
  16314. }),
  16315. globals.Dictionary);
  16316. smalltalk.addMethod(
  16317. smalltalk.method({
  16318. selector: "at:put:",
  16319. protocol: 'accessing',
  16320. fn: function (aKey,aValue){
  16321. var self=this;
  16322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16323. return smalltalk.withContext(function($ctx1) {
  16324. //>>excludeEnd("ctx");
  16325. var index = self._positionOfKey_(aKey);
  16326. if(index === -1) {
  16327. var keys = self['@keys'];
  16328. index = keys.length;
  16329. keys.push(aKey);
  16330. }
  16331. return self['@values'][index] = aValue;
  16332. ;
  16333. return self;
  16334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16335. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)});
  16336. //>>excludeEnd("ctx");
  16337. },
  16338. //>>excludeStart("ide", pragmas.excludeIdeData);
  16339. args: ["aKey", "aValue"],
  16340. 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>",
  16341. referencedClasses: [],
  16342. //>>excludeEnd("ide");
  16343. messageSends: []
  16344. }),
  16345. globals.Dictionary);
  16346. smalltalk.addMethod(
  16347. smalltalk.method({
  16348. selector: "includesKey:",
  16349. protocol: 'testing',
  16350. fn: function (aKey){
  16351. var self=this;
  16352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16353. return smalltalk.withContext(function($ctx1) {
  16354. //>>excludeEnd("ctx");
  16355. return self._positionOfKey_(aKey) >= 0; ;
  16356. return self;
  16357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16358. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)});
  16359. //>>excludeEnd("ctx");
  16360. },
  16361. //>>excludeStart("ide", pragmas.excludeIdeData);
  16362. args: ["aKey"],
  16363. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  16364. referencedClasses: [],
  16365. //>>excludeEnd("ide");
  16366. messageSends: []
  16367. }),
  16368. globals.Dictionary);
  16369. smalltalk.addMethod(
  16370. smalltalk.method({
  16371. selector: "indexOf:ifAbsent:",
  16372. protocol: 'accessing',
  16373. fn: function (anObject,aBlock){
  16374. var self=this;
  16375. var index;
  16376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16377. return smalltalk.withContext(function($ctx1) {
  16378. //>>excludeEnd("ctx");
  16379. var $2,$1;
  16380. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  16381. return (0);
  16382. }));
  16383. $2=_st(index).__eq((0));
  16384. if(smalltalk.assert($2)){
  16385. $1=_st(aBlock)._value();
  16386. } else {
  16387. $1=_st(self["@keys"])._at_(index);
  16388. };
  16389. return $1;
  16390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16391. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)});
  16392. //>>excludeEnd("ctx");
  16393. },
  16394. //>>excludeStart("ide", pragmas.excludeIdeData);
  16395. args: ["anObject", "aBlock"],
  16396. 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 ]",
  16397. referencedClasses: [],
  16398. //>>excludeEnd("ide");
  16399. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  16400. }),
  16401. globals.Dictionary);
  16402. smalltalk.addMethod(
  16403. smalltalk.method({
  16404. selector: "initialize",
  16405. protocol: 'initialization',
  16406. fn: function (){
  16407. var self=this;
  16408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16409. return smalltalk.withContext(function($ctx1) {
  16410. //>>excludeEnd("ctx");
  16411. (
  16412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16413. $ctx1.supercall = true,
  16414. //>>excludeEnd("ctx");
  16415. globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []));
  16416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16417. $ctx1.supercall = false;
  16418. //>>excludeEnd("ctx");;
  16419. self["@keys"]=[];
  16420. self["@values"]=[];
  16421. return self;
  16422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16423. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)});
  16424. //>>excludeEnd("ctx");
  16425. },
  16426. //>>excludeStart("ide", pragmas.excludeIdeData);
  16427. args: [],
  16428. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  16429. referencedClasses: [],
  16430. //>>excludeEnd("ide");
  16431. messageSends: ["initialize"]
  16432. }),
  16433. globals.Dictionary);
  16434. smalltalk.addMethod(
  16435. smalltalk.method({
  16436. selector: "keys",
  16437. protocol: 'accessing',
  16438. fn: function (){
  16439. var self=this;
  16440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16441. return smalltalk.withContext(function($ctx1) {
  16442. //>>excludeEnd("ctx");
  16443. var $1;
  16444. $1=_st(self["@keys"])._copy();
  16445. return $1;
  16446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16447. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)});
  16448. //>>excludeEnd("ctx");
  16449. },
  16450. //>>excludeStart("ide", pragmas.excludeIdeData);
  16451. args: [],
  16452. source: "keys\x0a\x09^ keys copy",
  16453. referencedClasses: [],
  16454. //>>excludeEnd("ide");
  16455. messageSends: ["copy"]
  16456. }),
  16457. globals.Dictionary);
  16458. smalltalk.addMethod(
  16459. smalltalk.method({
  16460. selector: "keysAndValuesDo:",
  16461. protocol: 'enumerating',
  16462. fn: function (aBlock){
  16463. var self=this;
  16464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16465. return smalltalk.withContext(function($ctx1) {
  16466. //>>excludeEnd("ctx");
  16467. var $1;
  16468. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  16469. return $1;
  16470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16471. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)});
  16472. //>>excludeEnd("ctx");
  16473. },
  16474. //>>excludeStart("ide", pragmas.excludeIdeData);
  16475. args: ["aBlock"],
  16476. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  16477. referencedClasses: [],
  16478. //>>excludeEnd("ide");
  16479. messageSends: ["with:do:"]
  16480. }),
  16481. globals.Dictionary);
  16482. smalltalk.addMethod(
  16483. smalltalk.method({
  16484. selector: "keysDo:",
  16485. protocol: 'enumerating',
  16486. fn: function (aBlock){
  16487. var self=this;
  16488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16489. return smalltalk.withContext(function($ctx1) {
  16490. //>>excludeEnd("ctx");
  16491. var $1;
  16492. $1=_st(self["@keys"])._do_(aBlock);
  16493. return $1;
  16494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16495. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)});
  16496. //>>excludeEnd("ctx");
  16497. },
  16498. //>>excludeStart("ide", pragmas.excludeIdeData);
  16499. args: ["aBlock"],
  16500. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  16501. referencedClasses: [],
  16502. //>>excludeEnd("ide");
  16503. messageSends: ["do:"]
  16504. }),
  16505. globals.Dictionary);
  16506. smalltalk.addMethod(
  16507. smalltalk.method({
  16508. selector: "positionOfKey:",
  16509. protocol: 'private',
  16510. fn: function (anObject){
  16511. var self=this;
  16512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16513. return smalltalk.withContext(function($ctx1) {
  16514. //>>excludeEnd("ctx");
  16515. var keys = self['@keys'];
  16516. for(var i=0;i<keys.length;i++){
  16517. if(keys[i].__eq(anObject)) { return i;}
  16518. }
  16519. return -1;
  16520. ;
  16521. return self;
  16522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16523. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)});
  16524. //>>excludeEnd("ctx");
  16525. },
  16526. //>>excludeStart("ide", pragmas.excludeIdeData);
  16527. args: ["anObject"],
  16528. 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>",
  16529. referencedClasses: [],
  16530. //>>excludeEnd("ide");
  16531. messageSends: []
  16532. }),
  16533. globals.Dictionary);
  16534. smalltalk.addMethod(
  16535. smalltalk.method({
  16536. selector: "removeAll",
  16537. protocol: 'adding/removing',
  16538. fn: function (){
  16539. var self=this;
  16540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16541. return smalltalk.withContext(function($ctx1) {
  16542. //>>excludeEnd("ctx");
  16543. _st(self["@keys"])._removeAll();
  16544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16545. $ctx1.sendIdx["removeAll"]=1;
  16546. //>>excludeEnd("ctx");
  16547. _st(self["@values"])._removeAll();
  16548. return self;
  16549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16550. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)});
  16551. //>>excludeEnd("ctx");
  16552. },
  16553. //>>excludeStart("ide", pragmas.excludeIdeData);
  16554. args: [],
  16555. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  16556. referencedClasses: [],
  16557. //>>excludeEnd("ide");
  16558. messageSends: ["removeAll"]
  16559. }),
  16560. globals.Dictionary);
  16561. smalltalk.addMethod(
  16562. smalltalk.method({
  16563. selector: "removeKey:ifAbsent:",
  16564. protocol: 'adding/removing',
  16565. fn: function (aKey,aBlock){
  16566. var self=this;
  16567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16568. return smalltalk.withContext(function($ctx1) {
  16569. //>>excludeEnd("ctx");
  16570. var index = self._positionOfKey_(aKey);
  16571. if(index === -1) {
  16572. return aBlock._value()
  16573. } else {
  16574. var keys = self['@keys'], values = self['@values'];
  16575. var value = values[index], l = keys.length;
  16576. keys[index] = keys[l-1];
  16577. keys.pop();
  16578. values[index] = values[l-1];
  16579. values.pop();
  16580. return value;
  16581. }
  16582. ;
  16583. return self;
  16584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16585. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  16586. //>>excludeEnd("ctx");
  16587. },
  16588. //>>excludeStart("ide", pragmas.excludeIdeData);
  16589. args: ["aKey", "aBlock"],
  16590. 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>",
  16591. referencedClasses: [],
  16592. //>>excludeEnd("ide");
  16593. messageSends: []
  16594. }),
  16595. globals.Dictionary);
  16596. smalltalk.addMethod(
  16597. smalltalk.method({
  16598. selector: "values",
  16599. protocol: 'accessing',
  16600. fn: function (){
  16601. var self=this;
  16602. var $1;
  16603. $1=self["@values"];
  16604. return $1;
  16605. },
  16606. //>>excludeStart("ide", pragmas.excludeIdeData);
  16607. args: [],
  16608. source: "values\x0a\x09^ values",
  16609. referencedClasses: [],
  16610. //>>excludeEnd("ide");
  16611. messageSends: []
  16612. }),
  16613. globals.Dictionary);
  16614. smalltalk.addMethod(
  16615. smalltalk.method({
  16616. selector: "valuesDo:",
  16617. protocol: 'enumerating',
  16618. fn: function (aBlock){
  16619. var self=this;
  16620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16621. return smalltalk.withContext(function($ctx1) {
  16622. //>>excludeEnd("ctx");
  16623. var $1;
  16624. $1=_st(self["@values"])._do_(aBlock);
  16625. return $1;
  16626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16627. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)});
  16628. //>>excludeEnd("ctx");
  16629. },
  16630. //>>excludeStart("ide", pragmas.excludeIdeData);
  16631. args: ["aBlock"],
  16632. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  16633. referencedClasses: [],
  16634. //>>excludeEnd("ide");
  16635. messageSends: ["do:"]
  16636. }),
  16637. globals.Dictionary);
  16638. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  16639. //>>excludeStart("ide", pragmas.excludeIdeData);
  16640. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  16641. //>>excludeEnd("ide");
  16642. smalltalk.addMethod(
  16643. smalltalk.method({
  16644. selector: "at:ifAbsent:",
  16645. protocol: 'accessing',
  16646. fn: function (aKey,aBlock){
  16647. var self=this;
  16648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16649. return smalltalk.withContext(function($ctx1) {
  16650. //>>excludeEnd("ctx");
  16651. var $2,$1;
  16652. $2=self._includesKey_(aKey);
  16653. if(smalltalk.assert($2)){
  16654. $1=self._basicAt_(aKey);
  16655. } else {
  16656. $1=_st(aBlock)._value();
  16657. };
  16658. return $1;
  16659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16660. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  16661. //>>excludeEnd("ctx");
  16662. },
  16663. //>>excludeStart("ide", pragmas.excludeIdeData);
  16664. args: ["aKey", "aBlock"],
  16665. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  16666. referencedClasses: [],
  16667. //>>excludeEnd("ide");
  16668. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  16669. }),
  16670. globals.HashedCollection);
  16671. smalltalk.addMethod(
  16672. smalltalk.method({
  16673. selector: "at:put:",
  16674. protocol: 'accessing',
  16675. fn: function (aKey,aValue){
  16676. var self=this;
  16677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16678. return smalltalk.withContext(function($ctx1) {
  16679. //>>excludeEnd("ctx");
  16680. var $1;
  16681. $1=self._basicAt_put_(aKey,aValue);
  16682. return $1;
  16683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16684. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)});
  16685. //>>excludeEnd("ctx");
  16686. },
  16687. //>>excludeStart("ide", pragmas.excludeIdeData);
  16688. args: ["aKey", "aValue"],
  16689. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  16690. referencedClasses: [],
  16691. //>>excludeEnd("ide");
  16692. messageSends: ["basicAt:put:"]
  16693. }),
  16694. globals.HashedCollection);
  16695. smalltalk.addMethod(
  16696. smalltalk.method({
  16697. selector: "includesKey:",
  16698. protocol: 'testing',
  16699. fn: function (aKey){
  16700. var self=this;
  16701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16702. return smalltalk.withContext(function($ctx1) {
  16703. //>>excludeEnd("ctx");
  16704. return self.hasOwnProperty(aKey);
  16705. return self;
  16706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16707. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)});
  16708. //>>excludeEnd("ctx");
  16709. },
  16710. //>>excludeStart("ide", pragmas.excludeIdeData);
  16711. args: ["aKey"],
  16712. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  16713. referencedClasses: [],
  16714. //>>excludeEnd("ide");
  16715. messageSends: []
  16716. }),
  16717. globals.HashedCollection);
  16718. smalltalk.addMethod(
  16719. smalltalk.method({
  16720. selector: "keys",
  16721. protocol: 'accessing',
  16722. fn: function (){
  16723. var self=this;
  16724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16725. return smalltalk.withContext(function($ctx1) {
  16726. //>>excludeEnd("ctx");
  16727. return Object.keys(self);
  16728. return self;
  16729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16730. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)});
  16731. //>>excludeEnd("ctx");
  16732. },
  16733. //>>excludeStart("ide", pragmas.excludeIdeData);
  16734. args: [],
  16735. source: "keys\x0a\x09<return Object.keys(self)>",
  16736. referencedClasses: [],
  16737. //>>excludeEnd("ide");
  16738. messageSends: []
  16739. }),
  16740. globals.HashedCollection);
  16741. smalltalk.addMethod(
  16742. smalltalk.method({
  16743. selector: "keysDo:",
  16744. protocol: 'enumerating',
  16745. fn: function (aBlock){
  16746. var self=this;
  16747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16748. return smalltalk.withContext(function($ctx1) {
  16749. //>>excludeEnd("ctx");
  16750. _st(self._keys())._do_(aBlock);
  16751. return self;
  16752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16753. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)});
  16754. //>>excludeEnd("ctx");
  16755. },
  16756. //>>excludeStart("ide", pragmas.excludeIdeData);
  16757. args: ["aBlock"],
  16758. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  16759. referencedClasses: [],
  16760. //>>excludeEnd("ide");
  16761. messageSends: ["do:", "keys"]
  16762. }),
  16763. globals.HashedCollection);
  16764. smalltalk.addMethod(
  16765. smalltalk.method({
  16766. selector: "removeKey:ifAbsent:",
  16767. protocol: 'adding/removing',
  16768. fn: function (aKey,aBlock){
  16769. var self=this;
  16770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16771. return smalltalk.withContext(function($ctx1) {
  16772. //>>excludeEnd("ctx");
  16773. var $1;
  16774. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  16775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16776. return smalltalk.withContext(function($ctx2) {
  16777. //>>excludeEnd("ctx");
  16778. self._basicDelete_(aKey);
  16779. return removed;
  16780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16781. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  16782. //>>excludeEnd("ctx");
  16783. }),(function(){
  16784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16785. return smalltalk.withContext(function($ctx2) {
  16786. //>>excludeEnd("ctx");
  16787. return _st(aBlock)._value();
  16788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16789. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16790. //>>excludeEnd("ctx");
  16791. }));
  16792. return $1;
  16793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16794. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  16795. //>>excludeEnd("ctx");
  16796. },
  16797. //>>excludeStart("ide", pragmas.excludeIdeData);
  16798. args: ["aKey", "aBlock"],
  16799. 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 ]",
  16800. referencedClasses: [],
  16801. //>>excludeEnd("ide");
  16802. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  16803. }),
  16804. globals.HashedCollection);
  16805. smalltalk.addMethod(
  16806. smalltalk.method({
  16807. selector: "values",
  16808. protocol: 'accessing',
  16809. fn: function (){
  16810. var self=this;
  16811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16812. return smalltalk.withContext(function($ctx1) {
  16813. //>>excludeEnd("ctx");
  16814. return self._keys().map(function(key){
  16815. return self._at_(key);
  16816. });
  16817. ;
  16818. return self;
  16819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16820. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)});
  16821. //>>excludeEnd("ctx");
  16822. },
  16823. //>>excludeStart("ide", pragmas.excludeIdeData);
  16824. args: [],
  16825. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  16826. referencedClasses: [],
  16827. //>>excludeEnd("ide");
  16828. messageSends: []
  16829. }),
  16830. globals.HashedCollection);
  16831. smalltalk.addMethod(
  16832. smalltalk.method({
  16833. selector: "valuesDo:",
  16834. protocol: 'enumerating',
  16835. fn: function (aBlock){
  16836. var self=this;
  16837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16838. return smalltalk.withContext(function($ctx1) {
  16839. //>>excludeEnd("ctx");
  16840. _st(self._values())._do_(aBlock);
  16841. return self;
  16842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16843. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)});
  16844. //>>excludeEnd("ctx");
  16845. },
  16846. //>>excludeStart("ide", pragmas.excludeIdeData);
  16847. args: ["aBlock"],
  16848. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  16849. referencedClasses: [],
  16850. //>>excludeEnd("ide");
  16851. messageSends: ["do:", "values"]
  16852. }),
  16853. globals.HashedCollection);
  16854. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  16855. //>>excludeStart("ide", pragmas.excludeIdeData);
  16856. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  16857. //>>excludeEnd("ide");
  16858. smalltalk.addMethod(
  16859. smalltalk.method({
  16860. selector: "=",
  16861. protocol: 'comparing',
  16862. fn: function (aCollection){
  16863. var self=this;
  16864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16865. return smalltalk.withContext(function($ctx1) {
  16866. //>>excludeEnd("ctx");
  16867. var $3,$2,$4,$1,$5;
  16868. var $early={};
  16869. try {
  16870. $3=self._class();
  16871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16872. $ctx1.sendIdx["class"]=1;
  16873. //>>excludeEnd("ctx");
  16874. $2=_st($3).__eq(_st(aCollection)._class());
  16875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16876. $ctx1.sendIdx["="]=1;
  16877. //>>excludeEnd("ctx");
  16878. $1=_st($2)._and_((function(){
  16879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16880. return smalltalk.withContext(function($ctx2) {
  16881. //>>excludeEnd("ctx");
  16882. $4=self._size();
  16883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16884. $ctx2.sendIdx["size"]=1;
  16885. //>>excludeEnd("ctx");
  16886. return _st($4).__eq(_st(aCollection)._size());
  16887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16888. $ctx2.sendIdx["="]=2;
  16889. //>>excludeEnd("ctx");
  16890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16892. //>>excludeEnd("ctx");
  16893. }));
  16894. if(! smalltalk.assert($1)){
  16895. return false;
  16896. };
  16897. self._withIndexDo_((function(each,i){
  16898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16899. return smalltalk.withContext(function($ctx2) {
  16900. //>>excludeEnd("ctx");
  16901. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  16902. if(! smalltalk.assert($5)){
  16903. throw $early=[false];
  16904. };
  16905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16906. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  16907. //>>excludeEnd("ctx");
  16908. }));
  16909. return true;
  16910. }
  16911. catch(e) {if(e===$early)return e[0]; throw e}
  16912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16913. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)});
  16914. //>>excludeEnd("ctx");
  16915. },
  16916. //>>excludeStart("ide", pragmas.excludeIdeData);
  16917. args: ["aCollection"],
  16918. 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",
  16919. referencedClasses: [],
  16920. //>>excludeEnd("ide");
  16921. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  16922. }),
  16923. globals.SequenceableCollection);
  16924. smalltalk.addMethod(
  16925. smalltalk.method({
  16926. selector: "addLast:",
  16927. protocol: 'adding/removing',
  16928. fn: function (anObject){
  16929. var self=this;
  16930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16931. return smalltalk.withContext(function($ctx1) {
  16932. //>>excludeEnd("ctx");
  16933. self._add_(anObject);
  16934. return self;
  16935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16936. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)});
  16937. //>>excludeEnd("ctx");
  16938. },
  16939. //>>excludeStart("ide", pragmas.excludeIdeData);
  16940. args: ["anObject"],
  16941. source: "addLast: anObject\x0a\x09self add: anObject",
  16942. referencedClasses: [],
  16943. //>>excludeEnd("ide");
  16944. messageSends: ["add:"]
  16945. }),
  16946. globals.SequenceableCollection);
  16947. smalltalk.addMethod(
  16948. smalltalk.method({
  16949. selector: "allButFirst",
  16950. protocol: 'accessing',
  16951. fn: function (){
  16952. var self=this;
  16953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16954. return smalltalk.withContext(function($ctx1) {
  16955. //>>excludeEnd("ctx");
  16956. var $1;
  16957. $1=self._copyFrom_to_((2),self._size());
  16958. return $1;
  16959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16960. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)});
  16961. //>>excludeEnd("ctx");
  16962. },
  16963. //>>excludeStart("ide", pragmas.excludeIdeData);
  16964. args: [],
  16965. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  16966. referencedClasses: [],
  16967. //>>excludeEnd("ide");
  16968. messageSends: ["copyFrom:to:", "size"]
  16969. }),
  16970. globals.SequenceableCollection);
  16971. smalltalk.addMethod(
  16972. smalltalk.method({
  16973. selector: "allButLast",
  16974. protocol: 'accessing',
  16975. fn: function (){
  16976. var self=this;
  16977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16978. return smalltalk.withContext(function($ctx1) {
  16979. //>>excludeEnd("ctx");
  16980. var $1;
  16981. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  16982. return $1;
  16983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16984. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)});
  16985. //>>excludeEnd("ctx");
  16986. },
  16987. //>>excludeStart("ide", pragmas.excludeIdeData);
  16988. args: [],
  16989. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  16990. referencedClasses: [],
  16991. //>>excludeEnd("ide");
  16992. messageSends: ["copyFrom:to:", "-", "size"]
  16993. }),
  16994. globals.SequenceableCollection);
  16995. smalltalk.addMethod(
  16996. smalltalk.method({
  16997. selector: "atRandom",
  16998. protocol: 'accessing',
  16999. fn: function (){
  17000. var self=this;
  17001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17002. return smalltalk.withContext(function($ctx1) {
  17003. //>>excludeEnd("ctx");
  17004. var $1;
  17005. $1=self._at_(_st(self._size())._atRandom());
  17006. return $1;
  17007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17008. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)});
  17009. //>>excludeEnd("ctx");
  17010. },
  17011. //>>excludeStart("ide", pragmas.excludeIdeData);
  17012. args: [],
  17013. source: "atRandom\x0a\x09^ self at: self size atRandom",
  17014. referencedClasses: [],
  17015. //>>excludeEnd("ide");
  17016. messageSends: ["at:", "atRandom", "size"]
  17017. }),
  17018. globals.SequenceableCollection);
  17019. smalltalk.addMethod(
  17020. smalltalk.method({
  17021. selector: "beginsWith:",
  17022. protocol: 'testing',
  17023. fn: function (prefix){
  17024. var self=this;
  17025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17026. return smalltalk.withContext(function($ctx1) {
  17027. //>>excludeEnd("ctx");
  17028. var $2,$3,$1,$4;
  17029. $2=self._size();
  17030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17031. $ctx1.sendIdx["size"]=1;
  17032. //>>excludeEnd("ctx");
  17033. $3=_st(prefix)._size();
  17034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17035. $ctx1.sendIdx["size"]=2;
  17036. //>>excludeEnd("ctx");
  17037. $1=_st($2).__lt($3);
  17038. if(smalltalk.assert($1)){
  17039. return false;
  17040. };
  17041. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  17042. return $4;
  17043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17044. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)});
  17045. //>>excludeEnd("ctx");
  17046. },
  17047. //>>excludeStart("ide", pragmas.excludeIdeData);
  17048. args: ["prefix"],
  17049. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  17050. referencedClasses: [],
  17051. //>>excludeEnd("ide");
  17052. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  17053. }),
  17054. globals.SequenceableCollection);
  17055. smalltalk.addMethod(
  17056. smalltalk.method({
  17057. selector: "copyFrom:to:",
  17058. protocol: 'copying',
  17059. fn: function (anIndex,anotherIndex){
  17060. var self=this;
  17061. var range,newCollection;
  17062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17063. return smalltalk.withContext(function($ctx1) {
  17064. //>>excludeEnd("ctx");
  17065. var $1;
  17066. range=_st(anIndex)._to_(anotherIndex);
  17067. newCollection=_st(self._class())._new_(_st(range)._size());
  17068. _st(range)._withIndexDo_((function(each,i){
  17069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17070. return smalltalk.withContext(function($ctx2) {
  17071. //>>excludeEnd("ctx");
  17072. return _st(newCollection)._at_put_(i,self._at_(each));
  17073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17074. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  17075. //>>excludeEnd("ctx");
  17076. }));
  17077. $1=newCollection;
  17078. return $1;
  17079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17080. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)});
  17081. //>>excludeEnd("ctx");
  17082. },
  17083. //>>excludeStart("ide", pragmas.excludeIdeData);
  17084. args: ["anIndex", "anotherIndex"],
  17085. 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",
  17086. referencedClasses: [],
  17087. //>>excludeEnd("ide");
  17088. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  17089. }),
  17090. globals.SequenceableCollection);
  17091. smalltalk.addMethod(
  17092. smalltalk.method({
  17093. selector: "deepCopy",
  17094. protocol: 'copying',
  17095. fn: function (){
  17096. var self=this;
  17097. var newCollection;
  17098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17099. return smalltalk.withContext(function($ctx1) {
  17100. //>>excludeEnd("ctx");
  17101. var $1;
  17102. newCollection=_st(self._class())._new_(self._size());
  17103. self._withIndexDo_((function(each,index){
  17104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17105. return smalltalk.withContext(function($ctx2) {
  17106. //>>excludeEnd("ctx");
  17107. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  17108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17109. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  17110. //>>excludeEnd("ctx");
  17111. }));
  17112. $1=newCollection;
  17113. return $1;
  17114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17115. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  17116. //>>excludeEnd("ctx");
  17117. },
  17118. //>>excludeStart("ide", pragmas.excludeIdeData);
  17119. args: [],
  17120. 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",
  17121. referencedClasses: [],
  17122. //>>excludeEnd("ide");
  17123. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  17124. }),
  17125. globals.SequenceableCollection);
  17126. smalltalk.addMethod(
  17127. smalltalk.method({
  17128. selector: "detect:ifNone:",
  17129. protocol: 'enumerating',
  17130. fn: function (aBlock,anotherBlock){
  17131. var self=this;
  17132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17133. return smalltalk.withContext(function($ctx1) {
  17134. //>>excludeEnd("ctx");
  17135. self = self._numericallyIndexable();
  17136. for(var i = 0; i < self.length; i++)
  17137. if(aBlock._value_(self[i]))
  17138. return self[i];
  17139. return anotherBlock._value();
  17140. ;
  17141. return self;
  17142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17143. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)});
  17144. //>>excludeEnd("ctx");
  17145. },
  17146. //>>excludeStart("ide", pragmas.excludeIdeData);
  17147. args: ["aBlock", "anotherBlock"],
  17148. 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>",
  17149. referencedClasses: [],
  17150. //>>excludeEnd("ide");
  17151. messageSends: []
  17152. }),
  17153. globals.SequenceableCollection);
  17154. smalltalk.addMethod(
  17155. smalltalk.method({
  17156. selector: "do:",
  17157. protocol: 'enumerating',
  17158. fn: function (aBlock){
  17159. var self=this;
  17160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17161. return smalltalk.withContext(function($ctx1) {
  17162. //>>excludeEnd("ctx");
  17163. self = self._numericallyIndexable();
  17164. for(var i=0; i < self.length; i++) {
  17165. aBlock._value_(self[i]);
  17166. }
  17167. ;
  17168. return self;
  17169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17170. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)});
  17171. //>>excludeEnd("ctx");
  17172. },
  17173. //>>excludeStart("ide", pragmas.excludeIdeData);
  17174. args: ["aBlock"],
  17175. 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>",
  17176. referencedClasses: [],
  17177. //>>excludeEnd("ide");
  17178. messageSends: []
  17179. }),
  17180. globals.SequenceableCollection);
  17181. smalltalk.addMethod(
  17182. smalltalk.method({
  17183. selector: "endsWith:",
  17184. protocol: 'testing',
  17185. fn: function (suffix){
  17186. var self=this;
  17187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17188. return smalltalk.withContext(function($ctx1) {
  17189. //>>excludeEnd("ctx");
  17190. var $2,$3,$1,$4;
  17191. $2=self._size();
  17192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17193. $ctx1.sendIdx["size"]=1;
  17194. //>>excludeEnd("ctx");
  17195. $3=_st(suffix)._size();
  17196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17197. $ctx1.sendIdx["size"]=2;
  17198. //>>excludeEnd("ctx");
  17199. $1=_st($2).__lt($3);
  17200. if(smalltalk.assert($1)){
  17201. return false;
  17202. };
  17203. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  17204. return $4;
  17205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17206. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)});
  17207. //>>excludeEnd("ctx");
  17208. },
  17209. //>>excludeStart("ide", pragmas.excludeIdeData);
  17210. args: ["suffix"],
  17211. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  17212. referencedClasses: [],
  17213. //>>excludeEnd("ide");
  17214. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  17215. }),
  17216. globals.SequenceableCollection);
  17217. smalltalk.addMethod(
  17218. smalltalk.method({
  17219. selector: "first",
  17220. protocol: 'accessing',
  17221. fn: function (){
  17222. var self=this;
  17223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17224. return smalltalk.withContext(function($ctx1) {
  17225. //>>excludeEnd("ctx");
  17226. var $1;
  17227. $1=self._at_((1));
  17228. return $1;
  17229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17230. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)});
  17231. //>>excludeEnd("ctx");
  17232. },
  17233. //>>excludeStart("ide", pragmas.excludeIdeData);
  17234. args: [],
  17235. source: "first\x0a\x09^ self at: 1",
  17236. referencedClasses: [],
  17237. //>>excludeEnd("ide");
  17238. messageSends: ["at:"]
  17239. }),
  17240. globals.SequenceableCollection);
  17241. smalltalk.addMethod(
  17242. smalltalk.method({
  17243. selector: "first:",
  17244. protocol: 'accessing',
  17245. fn: function (aNumber){
  17246. var self=this;
  17247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17248. return smalltalk.withContext(function($ctx1) {
  17249. //>>excludeEnd("ctx");
  17250. var $1,$2;
  17251. $1=_st(self._size()).__lt(aNumber);
  17252. if(smalltalk.assert($1)){
  17253. self._error_("Invalid number of elements");
  17254. };
  17255. $2=self._copyFrom_to_((1),aNumber);
  17256. return $2;
  17257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17258. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)});
  17259. //>>excludeEnd("ctx");
  17260. },
  17261. //>>excludeStart("ide", pragmas.excludeIdeData);
  17262. args: ["aNumber"],
  17263. 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",
  17264. referencedClasses: [],
  17265. //>>excludeEnd("ide");
  17266. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  17267. }),
  17268. globals.SequenceableCollection);
  17269. smalltalk.addMethod(
  17270. smalltalk.method({
  17271. selector: "fourth",
  17272. protocol: 'accessing',
  17273. fn: function (){
  17274. var self=this;
  17275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17276. return smalltalk.withContext(function($ctx1) {
  17277. //>>excludeEnd("ctx");
  17278. var $1;
  17279. $1=self._at_((4));
  17280. return $1;
  17281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17282. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)});
  17283. //>>excludeEnd("ctx");
  17284. },
  17285. //>>excludeStart("ide", pragmas.excludeIdeData);
  17286. args: [],
  17287. source: "fourth\x0a\x09^ self at: 4",
  17288. referencedClasses: [],
  17289. //>>excludeEnd("ide");
  17290. messageSends: ["at:"]
  17291. }),
  17292. globals.SequenceableCollection);
  17293. smalltalk.addMethod(
  17294. smalltalk.method({
  17295. selector: "includes:",
  17296. protocol: 'testing',
  17297. fn: function (anObject){
  17298. var self=this;
  17299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17300. return smalltalk.withContext(function($ctx1) {
  17301. //>>excludeEnd("ctx");
  17302. var $1;
  17303. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  17304. return nil;
  17305. })))._notNil();
  17306. return $1;
  17307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17308. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)});
  17309. //>>excludeEnd("ctx");
  17310. },
  17311. //>>excludeStart("ide", pragmas.excludeIdeData);
  17312. args: ["anObject"],
  17313. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  17314. referencedClasses: [],
  17315. //>>excludeEnd("ide");
  17316. messageSends: ["notNil", "indexOf:ifAbsent:"]
  17317. }),
  17318. globals.SequenceableCollection);
  17319. smalltalk.addMethod(
  17320. smalltalk.method({
  17321. selector: "indexOf:ifAbsent:",
  17322. protocol: 'accessing',
  17323. fn: function (anObject,aBlock){
  17324. var self=this;
  17325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17326. return smalltalk.withContext(function($ctx1) {
  17327. //>>excludeEnd("ctx");
  17328. self = self._numericallyIndexable();
  17329. for(var i=0; i < self.length; i++) {
  17330. if(_st(self[i]).__eq(anObject)) {return i+1}
  17331. };
  17332. return aBlock._value();
  17333. ;
  17334. return self;
  17335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17336. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)});
  17337. //>>excludeEnd("ctx");
  17338. },
  17339. //>>excludeStart("ide", pragmas.excludeIdeData);
  17340. args: ["anObject", "aBlock"],
  17341. 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>",
  17342. referencedClasses: [],
  17343. //>>excludeEnd("ide");
  17344. messageSends: []
  17345. }),
  17346. globals.SequenceableCollection);
  17347. smalltalk.addMethod(
  17348. smalltalk.method({
  17349. selector: "indexOf:startingAt:",
  17350. protocol: 'accessing',
  17351. fn: function (anObject,start){
  17352. var self=this;
  17353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17354. return smalltalk.withContext(function($ctx1) {
  17355. //>>excludeEnd("ctx");
  17356. var $1;
  17357. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  17358. return (0);
  17359. }));
  17360. return $1;
  17361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17362. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)});
  17363. //>>excludeEnd("ctx");
  17364. },
  17365. //>>excludeStart("ide", pragmas.excludeIdeData);
  17366. args: ["anObject", "start"],
  17367. 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 ]",
  17368. referencedClasses: [],
  17369. //>>excludeEnd("ide");
  17370. messageSends: ["indexOf:startingAt:ifAbsent:"]
  17371. }),
  17372. globals.SequenceableCollection);
  17373. smalltalk.addMethod(
  17374. smalltalk.method({
  17375. selector: "indexOf:startingAt:ifAbsent:",
  17376. protocol: 'accessing',
  17377. fn: function (anObject,start,aBlock){
  17378. var self=this;
  17379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17380. return smalltalk.withContext(function($ctx1) {
  17381. //>>excludeEnd("ctx");
  17382. self = self._numericallyIndexable();
  17383. for(var i=start - 1; i < self.length; i++){
  17384. if(_st(self[i]).__eq(anObject)) {return i+1}
  17385. }
  17386. return aBlock._value();
  17387. ;
  17388. return self;
  17389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17390. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)});
  17391. //>>excludeEnd("ctx");
  17392. },
  17393. //>>excludeStart("ide", pragmas.excludeIdeData);
  17394. args: ["anObject", "start", "aBlock"],
  17395. 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>",
  17396. referencedClasses: [],
  17397. //>>excludeEnd("ide");
  17398. messageSends: []
  17399. }),
  17400. globals.SequenceableCollection);
  17401. smalltalk.addMethod(
  17402. smalltalk.method({
  17403. selector: "last",
  17404. protocol: 'accessing',
  17405. fn: function (){
  17406. var self=this;
  17407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17408. return smalltalk.withContext(function($ctx1) {
  17409. //>>excludeEnd("ctx");
  17410. var $1;
  17411. $1=self._at_(self._size());
  17412. return $1;
  17413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17414. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)});
  17415. //>>excludeEnd("ctx");
  17416. },
  17417. //>>excludeStart("ide", pragmas.excludeIdeData);
  17418. args: [],
  17419. source: "last\x0a\x09^ self at: self size",
  17420. referencedClasses: [],
  17421. //>>excludeEnd("ide");
  17422. messageSends: ["at:", "size"]
  17423. }),
  17424. globals.SequenceableCollection);
  17425. smalltalk.addMethod(
  17426. smalltalk.method({
  17427. selector: "last:",
  17428. protocol: 'accessing',
  17429. fn: function (aNumber){
  17430. var self=this;
  17431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17432. return smalltalk.withContext(function($ctx1) {
  17433. //>>excludeEnd("ctx");
  17434. var $2,$1,$6,$5,$4,$3;
  17435. $2=self._size();
  17436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17437. $ctx1.sendIdx["size"]=1;
  17438. //>>excludeEnd("ctx");
  17439. $1=_st($2).__lt(aNumber);
  17440. if(smalltalk.assert($1)){
  17441. self._error_("Invalid number of elements");
  17442. };
  17443. $6=self._size();
  17444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17445. $ctx1.sendIdx["size"]=2;
  17446. //>>excludeEnd("ctx");
  17447. $5=_st($6).__minus(aNumber);
  17448. $4=_st($5).__plus((1));
  17449. $3=self._copyFrom_to_($4,self._size());
  17450. return $3;
  17451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17452. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)});
  17453. //>>excludeEnd("ctx");
  17454. },
  17455. //>>excludeStart("ide", pragmas.excludeIdeData);
  17456. args: ["aNumber"],
  17457. 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",
  17458. referencedClasses: [],
  17459. //>>excludeEnd("ide");
  17460. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  17461. }),
  17462. globals.SequenceableCollection);
  17463. smalltalk.addMethod(
  17464. smalltalk.method({
  17465. selector: "newStream",
  17466. protocol: 'streaming',
  17467. fn: function (){
  17468. var self=this;
  17469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17470. return smalltalk.withContext(function($ctx1) {
  17471. //>>excludeEnd("ctx");
  17472. var $1;
  17473. $1=_st(self._streamClass())._on_(self);
  17474. return $1;
  17475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17476. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)});
  17477. //>>excludeEnd("ctx");
  17478. },
  17479. //>>excludeStart("ide", pragmas.excludeIdeData);
  17480. args: [],
  17481. source: "newStream\x0a\x09^ self streamClass on: self",
  17482. referencedClasses: [],
  17483. //>>excludeEnd("ide");
  17484. messageSends: ["on:", "streamClass"]
  17485. }),
  17486. globals.SequenceableCollection);
  17487. smalltalk.addMethod(
  17488. smalltalk.method({
  17489. selector: "numericallyIndexable",
  17490. protocol: 'private',
  17491. fn: function (){
  17492. var self=this;
  17493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17494. return smalltalk.withContext(function($ctx1) {
  17495. //>>excludeEnd("ctx");
  17496. self._subclassResponsibility();
  17497. return self;
  17498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17499. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)});
  17500. //>>excludeEnd("ctx");
  17501. },
  17502. //>>excludeStart("ide", pragmas.excludeIdeData);
  17503. args: [],
  17504. 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",
  17505. referencedClasses: [],
  17506. //>>excludeEnd("ide");
  17507. messageSends: ["subclassResponsibility"]
  17508. }),
  17509. globals.SequenceableCollection);
  17510. smalltalk.addMethod(
  17511. smalltalk.method({
  17512. selector: "readStream",
  17513. protocol: 'streaming',
  17514. fn: function (){
  17515. var self=this;
  17516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17517. return smalltalk.withContext(function($ctx1) {
  17518. //>>excludeEnd("ctx");
  17519. var $1;
  17520. $1=self._stream();
  17521. return $1;
  17522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17523. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)});
  17524. //>>excludeEnd("ctx");
  17525. },
  17526. //>>excludeStart("ide", pragmas.excludeIdeData);
  17527. args: [],
  17528. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  17529. referencedClasses: [],
  17530. //>>excludeEnd("ide");
  17531. messageSends: ["stream"]
  17532. }),
  17533. globals.SequenceableCollection);
  17534. smalltalk.addMethod(
  17535. smalltalk.method({
  17536. selector: "removeLast",
  17537. protocol: 'adding/removing',
  17538. fn: function (){
  17539. var self=this;
  17540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17541. return smalltalk.withContext(function($ctx1) {
  17542. //>>excludeEnd("ctx");
  17543. var $1;
  17544. $1=self._remove_(self._last());
  17545. return $1;
  17546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17547. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)});
  17548. //>>excludeEnd("ctx");
  17549. },
  17550. //>>excludeStart("ide", pragmas.excludeIdeData);
  17551. args: [],
  17552. source: "removeLast\x0a\x09^ self remove: self last",
  17553. referencedClasses: [],
  17554. //>>excludeEnd("ide");
  17555. messageSends: ["remove:", "last"]
  17556. }),
  17557. globals.SequenceableCollection);
  17558. smalltalk.addMethod(
  17559. smalltalk.method({
  17560. selector: "reversed",
  17561. protocol: 'converting',
  17562. fn: function (){
  17563. var self=this;
  17564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17565. return smalltalk.withContext(function($ctx1) {
  17566. //>>excludeEnd("ctx");
  17567. self._subclassResponsibility();
  17568. return self;
  17569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17570. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)});
  17571. //>>excludeEnd("ctx");
  17572. },
  17573. //>>excludeStart("ide", pragmas.excludeIdeData);
  17574. args: [],
  17575. source: "reversed\x0a\x09self subclassResponsibility",
  17576. referencedClasses: [],
  17577. //>>excludeEnd("ide");
  17578. messageSends: ["subclassResponsibility"]
  17579. }),
  17580. globals.SequenceableCollection);
  17581. smalltalk.addMethod(
  17582. smalltalk.method({
  17583. selector: "second",
  17584. protocol: 'accessing',
  17585. fn: function (){
  17586. var self=this;
  17587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17588. return smalltalk.withContext(function($ctx1) {
  17589. //>>excludeEnd("ctx");
  17590. var $1;
  17591. $1=self._at_((2));
  17592. return $1;
  17593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17594. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)});
  17595. //>>excludeEnd("ctx");
  17596. },
  17597. //>>excludeStart("ide", pragmas.excludeIdeData);
  17598. args: [],
  17599. source: "second\x0a\x09^ self at: 2",
  17600. referencedClasses: [],
  17601. //>>excludeEnd("ide");
  17602. messageSends: ["at:"]
  17603. }),
  17604. globals.SequenceableCollection);
  17605. smalltalk.addMethod(
  17606. smalltalk.method({
  17607. selector: "shallowCopy",
  17608. protocol: 'copying',
  17609. fn: function (){
  17610. var self=this;
  17611. var newCollection;
  17612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17613. return smalltalk.withContext(function($ctx1) {
  17614. //>>excludeEnd("ctx");
  17615. var $1;
  17616. newCollection=_st(self._class())._new_(self._size());
  17617. self._withIndexDo_((function(each,index){
  17618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17619. return smalltalk.withContext(function($ctx2) {
  17620. //>>excludeEnd("ctx");
  17621. return _st(newCollection)._at_put_(index,each);
  17622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17623. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  17624. //>>excludeEnd("ctx");
  17625. }));
  17626. $1=newCollection;
  17627. return $1;
  17628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17629. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  17630. //>>excludeEnd("ctx");
  17631. },
  17632. //>>excludeStart("ide", pragmas.excludeIdeData);
  17633. args: [],
  17634. 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",
  17635. referencedClasses: [],
  17636. //>>excludeEnd("ide");
  17637. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  17638. }),
  17639. globals.SequenceableCollection);
  17640. smalltalk.addMethod(
  17641. smalltalk.method({
  17642. selector: "stream",
  17643. protocol: 'streaming',
  17644. fn: function (){
  17645. var self=this;
  17646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17647. return smalltalk.withContext(function($ctx1) {
  17648. //>>excludeEnd("ctx");
  17649. var $1;
  17650. $1=self._newStream();
  17651. return $1;
  17652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17653. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)});
  17654. //>>excludeEnd("ctx");
  17655. },
  17656. //>>excludeStart("ide", pragmas.excludeIdeData);
  17657. args: [],
  17658. source: "stream\x0a\x09^ self newStream",
  17659. referencedClasses: [],
  17660. //>>excludeEnd("ide");
  17661. messageSends: ["newStream"]
  17662. }),
  17663. globals.SequenceableCollection);
  17664. smalltalk.addMethod(
  17665. smalltalk.method({
  17666. selector: "streamClass",
  17667. protocol: 'streaming',
  17668. fn: function (){
  17669. var self=this;
  17670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17671. return smalltalk.withContext(function($ctx1) {
  17672. //>>excludeEnd("ctx");
  17673. var $1;
  17674. $1=_st(self._class())._streamClass();
  17675. return $1;
  17676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17677. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)});
  17678. //>>excludeEnd("ctx");
  17679. },
  17680. //>>excludeStart("ide", pragmas.excludeIdeData);
  17681. args: [],
  17682. source: "streamClass\x0a\x09^ self class streamClass",
  17683. referencedClasses: [],
  17684. //>>excludeEnd("ide");
  17685. messageSends: ["streamClass", "class"]
  17686. }),
  17687. globals.SequenceableCollection);
  17688. smalltalk.addMethod(
  17689. smalltalk.method({
  17690. selector: "third",
  17691. protocol: 'accessing',
  17692. fn: function (){
  17693. var self=this;
  17694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17695. return smalltalk.withContext(function($ctx1) {
  17696. //>>excludeEnd("ctx");
  17697. var $1;
  17698. $1=self._at_((3));
  17699. return $1;
  17700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17701. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)});
  17702. //>>excludeEnd("ctx");
  17703. },
  17704. //>>excludeStart("ide", pragmas.excludeIdeData);
  17705. args: [],
  17706. source: "third\x0a\x09^ self at: 3",
  17707. referencedClasses: [],
  17708. //>>excludeEnd("ide");
  17709. messageSends: ["at:"]
  17710. }),
  17711. globals.SequenceableCollection);
  17712. smalltalk.addMethod(
  17713. smalltalk.method({
  17714. selector: "with:do:",
  17715. protocol: 'enumerating',
  17716. fn: function (anotherCollection,aBlock){
  17717. var self=this;
  17718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17719. return smalltalk.withContext(function($ctx1) {
  17720. //>>excludeEnd("ctx");
  17721. self = self._numericallyIndexable();
  17722. anotherCollection = anotherCollection._numericallyIndexable();
  17723. for(var i=0; i<self.length; i++) {
  17724. aBlock._value_value_(self[i], anotherCollection[i]);
  17725. }
  17726. ;
  17727. return self;
  17728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17729. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)});
  17730. //>>excludeEnd("ctx");
  17731. },
  17732. //>>excludeStart("ide", pragmas.excludeIdeData);
  17733. args: ["anotherCollection", "aBlock"],
  17734. 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>",
  17735. referencedClasses: [],
  17736. //>>excludeEnd("ide");
  17737. messageSends: []
  17738. }),
  17739. globals.SequenceableCollection);
  17740. smalltalk.addMethod(
  17741. smalltalk.method({
  17742. selector: "withIndexDo:",
  17743. protocol: 'enumerating',
  17744. fn: function (aBlock){
  17745. var self=this;
  17746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17747. return smalltalk.withContext(function($ctx1) {
  17748. //>>excludeEnd("ctx");
  17749. self = self._numericallyIndexable();
  17750. for(var i=0; i < self.length; i++) {
  17751. aBlock._value_value_(self[i], i+1);
  17752. }
  17753. ;
  17754. return self;
  17755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17756. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)});
  17757. //>>excludeEnd("ctx");
  17758. },
  17759. //>>excludeStart("ide", pragmas.excludeIdeData);
  17760. args: ["aBlock"],
  17761. 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>",
  17762. referencedClasses: [],
  17763. //>>excludeEnd("ide");
  17764. messageSends: []
  17765. }),
  17766. globals.SequenceableCollection);
  17767. smalltalk.addMethod(
  17768. smalltalk.method({
  17769. selector: "writeStream",
  17770. protocol: 'streaming',
  17771. fn: function (){
  17772. var self=this;
  17773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17774. return smalltalk.withContext(function($ctx1) {
  17775. //>>excludeEnd("ctx");
  17776. var $1;
  17777. $1=self._stream();
  17778. return $1;
  17779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17780. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)});
  17781. //>>excludeEnd("ctx");
  17782. },
  17783. //>>excludeStart("ide", pragmas.excludeIdeData);
  17784. args: [],
  17785. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  17786. referencedClasses: [],
  17787. //>>excludeEnd("ide");
  17788. messageSends: ["stream"]
  17789. }),
  17790. globals.SequenceableCollection);
  17791. smalltalk.addMethod(
  17792. smalltalk.method({
  17793. selector: "streamClass",
  17794. protocol: 'accessing',
  17795. fn: function (){
  17796. var self=this;
  17797. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  17798. return $Stream();
  17799. },
  17800. //>>excludeStart("ide", pragmas.excludeIdeData);
  17801. args: [],
  17802. source: "streamClass\x0a\x09\x09^ Stream",
  17803. referencedClasses: ["Stream"],
  17804. //>>excludeEnd("ide");
  17805. messageSends: []
  17806. }),
  17807. globals.SequenceableCollection.klass);
  17808. smalltalk.addMethod(
  17809. smalltalk.method({
  17810. selector: "streamContents:",
  17811. protocol: 'streaming',
  17812. fn: function (aBlock){
  17813. var self=this;
  17814. var stream;
  17815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17816. return smalltalk.withContext(function($ctx1) {
  17817. //>>excludeEnd("ctx");
  17818. var $1;
  17819. stream=_st(self._streamClass())._on_(self._new());
  17820. _st(aBlock)._value_(stream);
  17821. $1=_st(stream)._contents();
  17822. return $1;
  17823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17824. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)});
  17825. //>>excludeEnd("ctx");
  17826. },
  17827. //>>excludeStart("ide", pragmas.excludeIdeData);
  17828. args: ["aBlock"],
  17829. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  17830. referencedClasses: [],
  17831. //>>excludeEnd("ide");
  17832. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  17833. }),
  17834. globals.SequenceableCollection.klass);
  17835. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  17836. //>>excludeStart("ide", pragmas.excludeIdeData);
  17837. 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`.";
  17838. //>>excludeEnd("ide");
  17839. smalltalk.addMethod(
  17840. smalltalk.method({
  17841. selector: "add:",
  17842. protocol: 'adding/removing',
  17843. fn: function (anObject){
  17844. var self=this;
  17845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17846. return smalltalk.withContext(function($ctx1) {
  17847. //>>excludeEnd("ctx");
  17848. self.push(anObject); return anObject;;
  17849. return self;
  17850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17851. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)});
  17852. //>>excludeEnd("ctx");
  17853. },
  17854. //>>excludeStart("ide", pragmas.excludeIdeData);
  17855. args: ["anObject"],
  17856. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  17857. referencedClasses: [],
  17858. //>>excludeEnd("ide");
  17859. messageSends: []
  17860. }),
  17861. globals.Array);
  17862. smalltalk.addMethod(
  17863. smalltalk.method({
  17864. selector: "addFirst:",
  17865. protocol: 'adding/removing',
  17866. fn: function (anObject){
  17867. var self=this;
  17868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17869. return smalltalk.withContext(function($ctx1) {
  17870. //>>excludeEnd("ctx");
  17871. self.unshift(anObject); return anObject;;
  17872. return self;
  17873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17874. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)});
  17875. //>>excludeEnd("ctx");
  17876. },
  17877. //>>excludeStart("ide", pragmas.excludeIdeData);
  17878. args: ["anObject"],
  17879. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  17880. referencedClasses: [],
  17881. //>>excludeEnd("ide");
  17882. messageSends: []
  17883. }),
  17884. globals.Array);
  17885. smalltalk.addMethod(
  17886. smalltalk.method({
  17887. selector: "asJavascript",
  17888. protocol: 'converting',
  17889. fn: function (){
  17890. var self=this;
  17891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17892. return smalltalk.withContext(function($ctx1) {
  17893. //>>excludeEnd("ctx");
  17894. var $1;
  17895. $1=_st("[".__comma(_st(self._collect_((function(each){
  17896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17897. return smalltalk.withContext(function($ctx2) {
  17898. //>>excludeEnd("ctx");
  17899. return _st(each)._asJavascript();
  17900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17902. //>>excludeEnd("ctx");
  17903. })))._join_(", "))).__comma("]");
  17904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17905. $ctx1.sendIdx[","]=1;
  17906. //>>excludeEnd("ctx");
  17907. return $1;
  17908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17909. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)});
  17910. //>>excludeEnd("ctx");
  17911. },
  17912. //>>excludeStart("ide", pragmas.excludeIdeData);
  17913. args: [],
  17914. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  17915. referencedClasses: [],
  17916. //>>excludeEnd("ide");
  17917. messageSends: [",", "join:", "collect:", "asJavascript"]
  17918. }),
  17919. globals.Array);
  17920. smalltalk.addMethod(
  17921. smalltalk.method({
  17922. selector: "at:ifAbsent:",
  17923. protocol: 'accessing',
  17924. fn: function (anIndex,aBlock){
  17925. var self=this;
  17926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17927. return smalltalk.withContext(function($ctx1) {
  17928. //>>excludeEnd("ctx");
  17929. return anIndex >= 1 && anIndex <= self.length
  17930. ? self[anIndex - 1]
  17931. : aBlock._value()
  17932. ;
  17933. return self;
  17934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17935. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)});
  17936. //>>excludeEnd("ctx");
  17937. },
  17938. //>>excludeStart("ide", pragmas.excludeIdeData);
  17939. args: ["anIndex", "aBlock"],
  17940. 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>",
  17941. referencedClasses: [],
  17942. //>>excludeEnd("ide");
  17943. messageSends: []
  17944. }),
  17945. globals.Array);
  17946. smalltalk.addMethod(
  17947. smalltalk.method({
  17948. selector: "at:ifPresent:ifAbsent:",
  17949. protocol: 'accessing',
  17950. fn: function (anIndex,aBlock,anotherBlock){
  17951. var self=this;
  17952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17953. return smalltalk.withContext(function($ctx1) {
  17954. //>>excludeEnd("ctx");
  17955. return anIndex >= 1 && anIndex <= self.length
  17956. ? aBlock._value_(self[anIndex - 1])
  17957. : anotherBlock._value()
  17958. ;
  17959. return self;
  17960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17961. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)});
  17962. //>>excludeEnd("ctx");
  17963. },
  17964. //>>excludeStart("ide", pragmas.excludeIdeData);
  17965. args: ["anIndex", "aBlock", "anotherBlock"],
  17966. 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>",
  17967. referencedClasses: [],
  17968. //>>excludeEnd("ide");
  17969. messageSends: []
  17970. }),
  17971. globals.Array);
  17972. smalltalk.addMethod(
  17973. smalltalk.method({
  17974. selector: "at:put:",
  17975. protocol: 'accessing',
  17976. fn: function (anIndex,anObject){
  17977. var self=this;
  17978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17979. return smalltalk.withContext(function($ctx1) {
  17980. //>>excludeEnd("ctx");
  17981. return self[anIndex - 1] = anObject;
  17982. return self;
  17983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17984. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)});
  17985. //>>excludeEnd("ctx");
  17986. },
  17987. //>>excludeStart("ide", pragmas.excludeIdeData);
  17988. args: ["anIndex", "anObject"],
  17989. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  17990. referencedClasses: [],
  17991. //>>excludeEnd("ide");
  17992. messageSends: []
  17993. }),
  17994. globals.Array);
  17995. smalltalk.addMethod(
  17996. smalltalk.method({
  17997. selector: "collect:",
  17998. protocol: 'enumerating',
  17999. fn: function (aBlock){
  18000. var self=this;
  18001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18002. return smalltalk.withContext(function($ctx1) {
  18003. //>>excludeEnd("ctx");
  18004. return self.map(function(each) {return aBlock._value_(each)});
  18005. return self;
  18006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18007. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)});
  18008. //>>excludeEnd("ctx");
  18009. },
  18010. //>>excludeStart("ide", pragmas.excludeIdeData);
  18011. args: ["aBlock"],
  18012. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  18013. referencedClasses: [],
  18014. //>>excludeEnd("ide");
  18015. messageSends: []
  18016. }),
  18017. globals.Array);
  18018. smalltalk.addMethod(
  18019. smalltalk.method({
  18020. selector: "join:",
  18021. protocol: 'enumerating',
  18022. fn: function (aString){
  18023. var self=this;
  18024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18025. return smalltalk.withContext(function($ctx1) {
  18026. //>>excludeEnd("ctx");
  18027. return self.join(aString);
  18028. return self;
  18029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18030. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)});
  18031. //>>excludeEnd("ctx");
  18032. },
  18033. //>>excludeStart("ide", pragmas.excludeIdeData);
  18034. args: ["aString"],
  18035. source: "join: aString\x0a\x09<return self.join(aString)>",
  18036. referencedClasses: [],
  18037. //>>excludeEnd("ide");
  18038. messageSends: []
  18039. }),
  18040. globals.Array);
  18041. smalltalk.addMethod(
  18042. smalltalk.method({
  18043. selector: "numericallyIndexable",
  18044. protocol: 'private',
  18045. fn: function (){
  18046. var self=this;
  18047. return self;
  18048. },
  18049. //>>excludeStart("ide", pragmas.excludeIdeData);
  18050. args: [],
  18051. source: "numericallyIndexable\x0a\x09^ self",
  18052. referencedClasses: [],
  18053. //>>excludeEnd("ide");
  18054. messageSends: []
  18055. }),
  18056. globals.Array);
  18057. smalltalk.addMethod(
  18058. smalltalk.method({
  18059. selector: "printOn:",
  18060. protocol: 'printing',
  18061. fn: function (aStream){
  18062. var self=this;
  18063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18064. return smalltalk.withContext(function($ctx1) {
  18065. //>>excludeEnd("ctx");
  18066. (
  18067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18068. $ctx1.supercall = true,
  18069. //>>excludeEnd("ctx");
  18070. globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  18071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18072. $ctx1.supercall = false;
  18073. //>>excludeEnd("ctx");;
  18074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18075. $ctx1.sendIdx["printOn:"]=1;
  18076. //>>excludeEnd("ctx");
  18077. _st(aStream)._nextPutAll_(" (");
  18078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18079. $ctx1.sendIdx["nextPutAll:"]=1;
  18080. //>>excludeEnd("ctx");
  18081. self._do_separatedBy_((function(each){
  18082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18083. return smalltalk.withContext(function($ctx2) {
  18084. //>>excludeEnd("ctx");
  18085. return _st(each)._printOn_(aStream);
  18086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18088. //>>excludeEnd("ctx");
  18089. }),(function(){
  18090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18091. return smalltalk.withContext(function($ctx2) {
  18092. //>>excludeEnd("ctx");
  18093. return _st(aStream)._nextPutAll_(" ");
  18094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18095. $ctx2.sendIdx["nextPutAll:"]=2;
  18096. //>>excludeEnd("ctx");
  18097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  18099. //>>excludeEnd("ctx");
  18100. }));
  18101. _st(aStream)._nextPutAll_(")");
  18102. return self;
  18103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18104. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)});
  18105. //>>excludeEnd("ctx");
  18106. },
  18107. //>>excludeStart("ide", pragmas.excludeIdeData);
  18108. args: ["aStream"],
  18109. 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: ')'",
  18110. referencedClasses: [],
  18111. //>>excludeEnd("ide");
  18112. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  18113. }),
  18114. globals.Array);
  18115. smalltalk.addMethod(
  18116. smalltalk.method({
  18117. selector: "remove:ifAbsent:",
  18118. protocol: 'adding/removing',
  18119. fn: function (anObject,aBlock){
  18120. var self=this;
  18121. var index;
  18122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18123. return smalltalk.withContext(function($ctx1) {
  18124. //>>excludeEnd("ctx");
  18125. var $2,$1;
  18126. index=self._indexOf_ifAbsent_(anObject,(function(){
  18127. return (0);
  18128. }));
  18129. $2=_st(index).__eq((0));
  18130. if(smalltalk.assert($2)){
  18131. $1=_st(aBlock)._value();
  18132. } else {
  18133. self._removeIndex_(index);
  18134. $1=anObject;
  18135. };
  18136. return $1;
  18137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18138. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)});
  18139. //>>excludeEnd("ctx");
  18140. },
  18141. //>>excludeStart("ide", pragmas.excludeIdeData);
  18142. args: ["anObject", "aBlock"],
  18143. 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 ]",
  18144. referencedClasses: [],
  18145. //>>excludeEnd("ide");
  18146. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  18147. }),
  18148. globals.Array);
  18149. smalltalk.addMethod(
  18150. smalltalk.method({
  18151. selector: "removeAll",
  18152. protocol: 'adding/removing',
  18153. fn: function (){
  18154. var self=this;
  18155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18156. return smalltalk.withContext(function($ctx1) {
  18157. //>>excludeEnd("ctx");
  18158. self.length = 0;
  18159. return self;
  18160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18161. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)});
  18162. //>>excludeEnd("ctx");
  18163. },
  18164. //>>excludeStart("ide", pragmas.excludeIdeData);
  18165. args: [],
  18166. source: "removeAll\x0a\x09<self.length = 0>",
  18167. referencedClasses: [],
  18168. //>>excludeEnd("ide");
  18169. messageSends: []
  18170. }),
  18171. globals.Array);
  18172. smalltalk.addMethod(
  18173. smalltalk.method({
  18174. selector: "removeFrom:to:",
  18175. protocol: 'adding/removing',
  18176. fn: function (aNumber,anotherNumber){
  18177. var self=this;
  18178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18179. return smalltalk.withContext(function($ctx1) {
  18180. //>>excludeEnd("ctx");
  18181. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  18182. return self;
  18183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18184. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)});
  18185. //>>excludeEnd("ctx");
  18186. },
  18187. //>>excludeStart("ide", pragmas.excludeIdeData);
  18188. args: ["aNumber", "anotherNumber"],
  18189. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  18190. referencedClasses: [],
  18191. //>>excludeEnd("ide");
  18192. messageSends: []
  18193. }),
  18194. globals.Array);
  18195. smalltalk.addMethod(
  18196. smalltalk.method({
  18197. selector: "removeIndex:",
  18198. protocol: 'adding/removing',
  18199. fn: function (anInteger){
  18200. var self=this;
  18201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18202. return smalltalk.withContext(function($ctx1) {
  18203. //>>excludeEnd("ctx");
  18204. self.splice(anInteger - 1, 1);
  18205. return self;
  18206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18207. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)});
  18208. //>>excludeEnd("ctx");
  18209. },
  18210. //>>excludeStart("ide", pragmas.excludeIdeData);
  18211. args: ["anInteger"],
  18212. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  18213. referencedClasses: [],
  18214. //>>excludeEnd("ide");
  18215. messageSends: []
  18216. }),
  18217. globals.Array);
  18218. smalltalk.addMethod(
  18219. smalltalk.method({
  18220. selector: "removeLast",
  18221. protocol: 'adding/removing',
  18222. fn: function (){
  18223. var self=this;
  18224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18225. return smalltalk.withContext(function($ctx1) {
  18226. //>>excludeEnd("ctx");
  18227. return self.pop();;
  18228. return self;
  18229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18230. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)});
  18231. //>>excludeEnd("ctx");
  18232. },
  18233. //>>excludeStart("ide", pragmas.excludeIdeData);
  18234. args: [],
  18235. source: "removeLast\x0a\x09<return self.pop();>",
  18236. referencedClasses: [],
  18237. //>>excludeEnd("ide");
  18238. messageSends: []
  18239. }),
  18240. globals.Array);
  18241. smalltalk.addMethod(
  18242. smalltalk.method({
  18243. selector: "reversed",
  18244. protocol: 'converting',
  18245. fn: function (){
  18246. var self=this;
  18247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18248. return smalltalk.withContext(function($ctx1) {
  18249. //>>excludeEnd("ctx");
  18250. return self._copy().reverse();
  18251. return self;
  18252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18253. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)});
  18254. //>>excludeEnd("ctx");
  18255. },
  18256. //>>excludeStart("ide", pragmas.excludeIdeData);
  18257. args: [],
  18258. source: "reversed\x0a\x09<return self._copy().reverse()>",
  18259. referencedClasses: [],
  18260. //>>excludeEnd("ide");
  18261. messageSends: []
  18262. }),
  18263. globals.Array);
  18264. smalltalk.addMethod(
  18265. smalltalk.method({
  18266. selector: "select:",
  18267. protocol: 'enumerating',
  18268. fn: function (aBlock){
  18269. var self=this;
  18270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18271. return smalltalk.withContext(function($ctx1) {
  18272. //>>excludeEnd("ctx");
  18273. var result = self.klass._new();
  18274. for(var i=0; i<self.length; i++) {
  18275. if(aBlock._value_(self[i])) {
  18276. result.push(self[i]);
  18277. }
  18278. }
  18279. return result;
  18280. ;
  18281. return self;
  18282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18283. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)});
  18284. //>>excludeEnd("ctx");
  18285. },
  18286. //>>excludeStart("ide", pragmas.excludeIdeData);
  18287. args: ["aBlock"],
  18288. 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>",
  18289. referencedClasses: [],
  18290. //>>excludeEnd("ide");
  18291. messageSends: []
  18292. }),
  18293. globals.Array);
  18294. smalltalk.addMethod(
  18295. smalltalk.method({
  18296. selector: "size",
  18297. protocol: 'accessing',
  18298. fn: function (){
  18299. var self=this;
  18300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18301. return smalltalk.withContext(function($ctx1) {
  18302. //>>excludeEnd("ctx");
  18303. return self.length;
  18304. return self;
  18305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18306. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)});
  18307. //>>excludeEnd("ctx");
  18308. },
  18309. //>>excludeStart("ide", pragmas.excludeIdeData);
  18310. args: [],
  18311. source: "size\x0a\x09<return self.length>",
  18312. referencedClasses: [],
  18313. //>>excludeEnd("ide");
  18314. messageSends: []
  18315. }),
  18316. globals.Array);
  18317. smalltalk.addMethod(
  18318. smalltalk.method({
  18319. selector: "sort",
  18320. protocol: 'enumerating',
  18321. fn: function (){
  18322. var self=this;
  18323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18324. return smalltalk.withContext(function($ctx1) {
  18325. //>>excludeEnd("ctx");
  18326. var $1;
  18327. $1=self._sort_((function(a,b){
  18328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18329. return smalltalk.withContext(function($ctx2) {
  18330. //>>excludeEnd("ctx");
  18331. return _st(a).__lt(b);
  18332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18333. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  18334. //>>excludeEnd("ctx");
  18335. }));
  18336. return $1;
  18337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18338. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)});
  18339. //>>excludeEnd("ctx");
  18340. },
  18341. //>>excludeStart("ide", pragmas.excludeIdeData);
  18342. args: [],
  18343. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  18344. referencedClasses: [],
  18345. //>>excludeEnd("ide");
  18346. messageSends: ["sort:", "<"]
  18347. }),
  18348. globals.Array);
  18349. smalltalk.addMethod(
  18350. smalltalk.method({
  18351. selector: "sort:",
  18352. protocol: 'enumerating',
  18353. fn: function (aBlock){
  18354. var self=this;
  18355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18356. return smalltalk.withContext(function($ctx1) {
  18357. //>>excludeEnd("ctx");
  18358. return self.sort(function(a, b) {
  18359. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  18360. })
  18361. ;
  18362. return self;
  18363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18364. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)});
  18365. //>>excludeEnd("ctx");
  18366. },
  18367. //>>excludeStart("ide", pragmas.excludeIdeData);
  18368. args: ["aBlock"],
  18369. 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>",
  18370. referencedClasses: [],
  18371. //>>excludeEnd("ide");
  18372. messageSends: []
  18373. }),
  18374. globals.Array);
  18375. smalltalk.addMethod(
  18376. smalltalk.method({
  18377. selector: "sorted",
  18378. protocol: 'enumerating',
  18379. fn: function (){
  18380. var self=this;
  18381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18382. return smalltalk.withContext(function($ctx1) {
  18383. //>>excludeEnd("ctx");
  18384. var $1;
  18385. $1=_st(self._copy())._sort();
  18386. return $1;
  18387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18388. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)});
  18389. //>>excludeEnd("ctx");
  18390. },
  18391. //>>excludeStart("ide", pragmas.excludeIdeData);
  18392. args: [],
  18393. source: "sorted\x0a\x09^ self copy sort",
  18394. referencedClasses: [],
  18395. //>>excludeEnd("ide");
  18396. messageSends: ["sort", "copy"]
  18397. }),
  18398. globals.Array);
  18399. smalltalk.addMethod(
  18400. smalltalk.method({
  18401. selector: "sorted:",
  18402. protocol: 'enumerating',
  18403. fn: function (aBlock){
  18404. var self=this;
  18405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18406. return smalltalk.withContext(function($ctx1) {
  18407. //>>excludeEnd("ctx");
  18408. var $1;
  18409. $1=_st(self._copy())._sort_(aBlock);
  18410. return $1;
  18411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18412. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)});
  18413. //>>excludeEnd("ctx");
  18414. },
  18415. //>>excludeStart("ide", pragmas.excludeIdeData);
  18416. args: ["aBlock"],
  18417. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  18418. referencedClasses: [],
  18419. //>>excludeEnd("ide");
  18420. messageSends: ["sort:", "copy"]
  18421. }),
  18422. globals.Array);
  18423. smalltalk.addMethod(
  18424. smalltalk.method({
  18425. selector: "new:",
  18426. protocol: 'instance creation',
  18427. fn: function (anInteger){
  18428. var self=this;
  18429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18430. return smalltalk.withContext(function($ctx1) {
  18431. //>>excludeEnd("ctx");
  18432. return new Array(anInteger);
  18433. return self;
  18434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18435. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)});
  18436. //>>excludeEnd("ctx");
  18437. },
  18438. //>>excludeStart("ide", pragmas.excludeIdeData);
  18439. args: ["anInteger"],
  18440. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  18441. referencedClasses: [],
  18442. //>>excludeEnd("ide");
  18443. messageSends: []
  18444. }),
  18445. globals.Array.klass);
  18446. smalltalk.addMethod(
  18447. smalltalk.method({
  18448. selector: "with:",
  18449. protocol: 'instance creation',
  18450. fn: function (anObject){
  18451. var self=this;
  18452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18453. return smalltalk.withContext(function($ctx1) {
  18454. //>>excludeEnd("ctx");
  18455. var $2,$3,$1;
  18456. $2=self._new_((1));
  18457. _st($2)._at_put_((1),anObject);
  18458. $3=_st($2)._yourself();
  18459. $1=$3;
  18460. return $1;
  18461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18462. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)});
  18463. //>>excludeEnd("ctx");
  18464. },
  18465. //>>excludeStart("ide", pragmas.excludeIdeData);
  18466. args: ["anObject"],
  18467. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  18468. referencedClasses: [],
  18469. //>>excludeEnd("ide");
  18470. messageSends: ["at:put:", "new:", "yourself"]
  18471. }),
  18472. globals.Array.klass);
  18473. smalltalk.addMethod(
  18474. smalltalk.method({
  18475. selector: "with:with:",
  18476. protocol: 'instance creation',
  18477. fn: function (anObject,anObject2){
  18478. var self=this;
  18479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18480. return smalltalk.withContext(function($ctx1) {
  18481. //>>excludeEnd("ctx");
  18482. var $2,$3,$1;
  18483. $2=self._new_((2));
  18484. _st($2)._at_put_((1),anObject);
  18485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18486. $ctx1.sendIdx["at:put:"]=1;
  18487. //>>excludeEnd("ctx");
  18488. _st($2)._at_put_((2),anObject2);
  18489. $3=_st($2)._yourself();
  18490. $1=$3;
  18491. return $1;
  18492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18493. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)});
  18494. //>>excludeEnd("ctx");
  18495. },
  18496. //>>excludeStart("ide", pragmas.excludeIdeData);
  18497. args: ["anObject", "anObject2"],
  18498. 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",
  18499. referencedClasses: [],
  18500. //>>excludeEnd("ide");
  18501. messageSends: ["at:put:", "new:", "yourself"]
  18502. }),
  18503. globals.Array.klass);
  18504. smalltalk.addMethod(
  18505. smalltalk.method({
  18506. selector: "with:with:with:",
  18507. protocol: 'instance creation',
  18508. fn: function (anObject,anObject2,anObject3){
  18509. var self=this;
  18510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18511. return smalltalk.withContext(function($ctx1) {
  18512. //>>excludeEnd("ctx");
  18513. var $2,$3,$1;
  18514. $2=self._new_((3));
  18515. _st($2)._at_put_((1),anObject);
  18516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18517. $ctx1.sendIdx["at:put:"]=1;
  18518. //>>excludeEnd("ctx");
  18519. _st($2)._at_put_((2),anObject2);
  18520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18521. $ctx1.sendIdx["at:put:"]=2;
  18522. //>>excludeEnd("ctx");
  18523. _st($2)._at_put_((3),anObject3);
  18524. $3=_st($2)._yourself();
  18525. $1=$3;
  18526. return $1;
  18527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18528. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)});
  18529. //>>excludeEnd("ctx");
  18530. },
  18531. //>>excludeStart("ide", pragmas.excludeIdeData);
  18532. args: ["anObject", "anObject2", "anObject3"],
  18533. 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",
  18534. referencedClasses: [],
  18535. //>>excludeEnd("ide");
  18536. messageSends: ["at:put:", "new:", "yourself"]
  18537. }),
  18538. globals.Array.klass);
  18539. smalltalk.addMethod(
  18540. smalltalk.method({
  18541. selector: "withAll:",
  18542. protocol: 'instance creation',
  18543. fn: function (aCollection){
  18544. var self=this;
  18545. var instance,index;
  18546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18547. return smalltalk.withContext(function($ctx1) {
  18548. //>>excludeEnd("ctx");
  18549. var $1;
  18550. index=(1);
  18551. instance=self._new_(_st(aCollection)._size());
  18552. _st(aCollection)._do_((function(each){
  18553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18554. return smalltalk.withContext(function($ctx2) {
  18555. //>>excludeEnd("ctx");
  18556. _st(instance)._at_put_(index,each);
  18557. index=_st(index).__plus((1));
  18558. return index;
  18559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18560. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18561. //>>excludeEnd("ctx");
  18562. }));
  18563. $1=instance;
  18564. return $1;
  18565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18566. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)});
  18567. //>>excludeEnd("ctx");
  18568. },
  18569. //>>excludeStart("ide", pragmas.excludeIdeData);
  18570. args: ["aCollection"],
  18571. 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",
  18572. referencedClasses: [],
  18573. //>>excludeEnd("ide");
  18574. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  18575. }),
  18576. globals.Array.klass);
  18577. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  18578. //>>excludeStart("ide", pragmas.excludeIdeData);
  18579. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  18580. //>>excludeEnd("ide");
  18581. smalltalk.addMethod(
  18582. smalltalk.method({
  18583. selector: ",",
  18584. protocol: 'copying',
  18585. fn: function (aString){
  18586. var self=this;
  18587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18588. return smalltalk.withContext(function($ctx1) {
  18589. //>>excludeEnd("ctx");
  18590. var $2,$1;
  18591. $2=self._asString();
  18592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18593. $ctx1.sendIdx["asString"]=1;
  18594. //>>excludeEnd("ctx");
  18595. $1=_st($2).__comma(_st(aString)._asString());
  18596. return $1;
  18597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18598. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)});
  18599. //>>excludeEnd("ctx");
  18600. },
  18601. //>>excludeStart("ide", pragmas.excludeIdeData);
  18602. args: ["aString"],
  18603. source: ", aString\x0a\x09^ self asString, aString asString",
  18604. referencedClasses: [],
  18605. //>>excludeEnd("ide");
  18606. messageSends: [",", "asString"]
  18607. }),
  18608. globals.CharacterArray);
  18609. smalltalk.addMethod(
  18610. smalltalk.method({
  18611. selector: "add:",
  18612. protocol: 'adding/removing',
  18613. fn: function (anObject){
  18614. var self=this;
  18615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18616. return smalltalk.withContext(function($ctx1) {
  18617. //>>excludeEnd("ctx");
  18618. self._errorReadOnly();
  18619. return self;
  18620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18621. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)});
  18622. //>>excludeEnd("ctx");
  18623. },
  18624. //>>excludeStart("ide", pragmas.excludeIdeData);
  18625. args: ["anObject"],
  18626. source: "add: anObject\x0a\x09self errorReadOnly",
  18627. referencedClasses: [],
  18628. //>>excludeEnd("ide");
  18629. messageSends: ["errorReadOnly"]
  18630. }),
  18631. globals.CharacterArray);
  18632. smalltalk.addMethod(
  18633. smalltalk.method({
  18634. selector: "asLowercase",
  18635. protocol: 'converting',
  18636. fn: function (){
  18637. var self=this;
  18638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18639. return smalltalk.withContext(function($ctx1) {
  18640. //>>excludeEnd("ctx");
  18641. var $1;
  18642. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  18643. return $1;
  18644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18645. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)});
  18646. //>>excludeEnd("ctx");
  18647. },
  18648. //>>excludeStart("ide", pragmas.excludeIdeData);
  18649. args: [],
  18650. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  18651. referencedClasses: [],
  18652. //>>excludeEnd("ide");
  18653. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  18654. }),
  18655. globals.CharacterArray);
  18656. smalltalk.addMethod(
  18657. smalltalk.method({
  18658. selector: "asNumber",
  18659. protocol: 'converting',
  18660. fn: function (){
  18661. var self=this;
  18662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18663. return smalltalk.withContext(function($ctx1) {
  18664. //>>excludeEnd("ctx");
  18665. var $1;
  18666. $1=_st(self._asString())._asNumber();
  18667. return $1;
  18668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18669. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)});
  18670. //>>excludeEnd("ctx");
  18671. },
  18672. //>>excludeStart("ide", pragmas.excludeIdeData);
  18673. args: [],
  18674. source: "asNumber\x0a\x09^ self asString asNumber",
  18675. referencedClasses: [],
  18676. //>>excludeEnd("ide");
  18677. messageSends: ["asNumber", "asString"]
  18678. }),
  18679. globals.CharacterArray);
  18680. smalltalk.addMethod(
  18681. smalltalk.method({
  18682. selector: "asString",
  18683. protocol: 'converting',
  18684. fn: function (){
  18685. var self=this;
  18686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18687. return smalltalk.withContext(function($ctx1) {
  18688. //>>excludeEnd("ctx");
  18689. var $1;
  18690. $1=self._subclassResponsibility();
  18691. return $1;
  18692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18693. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)});
  18694. //>>excludeEnd("ctx");
  18695. },
  18696. //>>excludeStart("ide", pragmas.excludeIdeData);
  18697. args: [],
  18698. source: "asString\x0a\x09^ self subclassResponsibility",
  18699. referencedClasses: [],
  18700. //>>excludeEnd("ide");
  18701. messageSends: ["subclassResponsibility"]
  18702. }),
  18703. globals.CharacterArray);
  18704. smalltalk.addMethod(
  18705. smalltalk.method({
  18706. selector: "asSymbol",
  18707. protocol: 'converting',
  18708. fn: function (){
  18709. var self=this;
  18710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18711. return smalltalk.withContext(function($ctx1) {
  18712. //>>excludeEnd("ctx");
  18713. var $1;
  18714. $1=self._asString();
  18715. return $1;
  18716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18717. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)});
  18718. //>>excludeEnd("ctx");
  18719. },
  18720. //>>excludeStart("ide", pragmas.excludeIdeData);
  18721. args: [],
  18722. source: "asSymbol\x0a\x09^ self asString",
  18723. referencedClasses: [],
  18724. //>>excludeEnd("ide");
  18725. messageSends: ["asString"]
  18726. }),
  18727. globals.CharacterArray);
  18728. smalltalk.addMethod(
  18729. smalltalk.method({
  18730. selector: "asUppercase",
  18731. protocol: 'converting',
  18732. fn: function (){
  18733. var self=this;
  18734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18735. return smalltalk.withContext(function($ctx1) {
  18736. //>>excludeEnd("ctx");
  18737. var $1;
  18738. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  18739. return $1;
  18740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18741. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)});
  18742. //>>excludeEnd("ctx");
  18743. },
  18744. //>>excludeStart("ide", pragmas.excludeIdeData);
  18745. args: [],
  18746. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  18747. referencedClasses: [],
  18748. //>>excludeEnd("ide");
  18749. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  18750. }),
  18751. globals.CharacterArray);
  18752. smalltalk.addMethod(
  18753. smalltalk.method({
  18754. selector: "at:put:",
  18755. protocol: 'accessing',
  18756. fn: function (anIndex,anObject){
  18757. var self=this;
  18758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18759. return smalltalk.withContext(function($ctx1) {
  18760. //>>excludeEnd("ctx");
  18761. self._errorReadOnly();
  18762. return self;
  18763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18764. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)});
  18765. //>>excludeEnd("ctx");
  18766. },
  18767. //>>excludeStart("ide", pragmas.excludeIdeData);
  18768. args: ["anIndex", "anObject"],
  18769. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  18770. referencedClasses: [],
  18771. //>>excludeEnd("ide");
  18772. messageSends: ["errorReadOnly"]
  18773. }),
  18774. globals.CharacterArray);
  18775. smalltalk.addMethod(
  18776. smalltalk.method({
  18777. selector: "errorReadOnly",
  18778. protocol: 'error handling',
  18779. fn: function (){
  18780. var self=this;
  18781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18782. return smalltalk.withContext(function($ctx1) {
  18783. //>>excludeEnd("ctx");
  18784. self._error_("Object is read-only");
  18785. return self;
  18786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18787. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)});
  18788. //>>excludeEnd("ctx");
  18789. },
  18790. //>>excludeStart("ide", pragmas.excludeIdeData);
  18791. args: [],
  18792. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  18793. referencedClasses: [],
  18794. //>>excludeEnd("ide");
  18795. messageSends: ["error:"]
  18796. }),
  18797. globals.CharacterArray);
  18798. smalltalk.addMethod(
  18799. smalltalk.method({
  18800. selector: "printOn:",
  18801. protocol: 'printing',
  18802. fn: function (aStream){
  18803. var self=this;
  18804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18805. return smalltalk.withContext(function($ctx1) {
  18806. //>>excludeEnd("ctx");
  18807. _st(self._asString())._printOn_(aStream);
  18808. return self;
  18809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18810. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)});
  18811. //>>excludeEnd("ctx");
  18812. },
  18813. //>>excludeStart("ide", pragmas.excludeIdeData);
  18814. args: ["aStream"],
  18815. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  18816. referencedClasses: [],
  18817. //>>excludeEnd("ide");
  18818. messageSends: ["printOn:", "asString"]
  18819. }),
  18820. globals.CharacterArray);
  18821. smalltalk.addMethod(
  18822. smalltalk.method({
  18823. selector: "putOn:",
  18824. protocol: 'streaming',
  18825. fn: function (aStream){
  18826. var self=this;
  18827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18828. return smalltalk.withContext(function($ctx1) {
  18829. //>>excludeEnd("ctx");
  18830. _st(aStream)._nextPutString_(self);
  18831. return self;
  18832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18833. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)});
  18834. //>>excludeEnd("ctx");
  18835. },
  18836. //>>excludeStart("ide", pragmas.excludeIdeData);
  18837. args: ["aStream"],
  18838. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  18839. referencedClasses: [],
  18840. //>>excludeEnd("ide");
  18841. messageSends: ["nextPutString:"]
  18842. }),
  18843. globals.CharacterArray);
  18844. smalltalk.addMethod(
  18845. smalltalk.method({
  18846. selector: "remove:",
  18847. protocol: 'adding/removing',
  18848. fn: function (anObject){
  18849. var self=this;
  18850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18851. return smalltalk.withContext(function($ctx1) {
  18852. //>>excludeEnd("ctx");
  18853. self._errorReadOnly();
  18854. return self;
  18855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18856. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)});
  18857. //>>excludeEnd("ctx");
  18858. },
  18859. //>>excludeStart("ide", pragmas.excludeIdeData);
  18860. args: ["anObject"],
  18861. source: "remove: anObject\x0a\x09self errorReadOnly",
  18862. referencedClasses: [],
  18863. //>>excludeEnd("ide");
  18864. messageSends: ["errorReadOnly"]
  18865. }),
  18866. globals.CharacterArray);
  18867. smalltalk.addMethod(
  18868. smalltalk.method({
  18869. selector: "fromString:",
  18870. protocol: 'instance creation',
  18871. fn: function (aString){
  18872. var self=this;
  18873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18874. return smalltalk.withContext(function($ctx1) {
  18875. //>>excludeEnd("ctx");
  18876. self._subclassResponsibility();
  18877. return self;
  18878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18879. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)});
  18880. //>>excludeEnd("ctx");
  18881. },
  18882. //>>excludeStart("ide", pragmas.excludeIdeData);
  18883. args: ["aString"],
  18884. source: "fromString: aString\x0a\x09self subclassResponsibility",
  18885. referencedClasses: [],
  18886. //>>excludeEnd("ide");
  18887. messageSends: ["subclassResponsibility"]
  18888. }),
  18889. globals.CharacterArray.klass);
  18890. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  18891. //>>excludeStart("ide", pragmas.excludeIdeData);
  18892. 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 >> #,`";
  18893. //>>excludeEnd("ide");
  18894. smalltalk.addMethod(
  18895. smalltalk.method({
  18896. selector: ",",
  18897. protocol: 'copying',
  18898. fn: function (aString){
  18899. var self=this;
  18900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18901. return smalltalk.withContext(function($ctx1) {
  18902. //>>excludeEnd("ctx");
  18903. return String(self) + aString;
  18904. return self;
  18905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18906. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)});
  18907. //>>excludeEnd("ctx");
  18908. },
  18909. //>>excludeStart("ide", pragmas.excludeIdeData);
  18910. args: ["aString"],
  18911. source: ", aString\x0a\x09<return String(self) + aString>",
  18912. referencedClasses: [],
  18913. //>>excludeEnd("ide");
  18914. messageSends: []
  18915. }),
  18916. globals.String);
  18917. smalltalk.addMethod(
  18918. smalltalk.method({
  18919. selector: "<",
  18920. protocol: 'comparing',
  18921. fn: function (aString){
  18922. var self=this;
  18923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18924. return smalltalk.withContext(function($ctx1) {
  18925. //>>excludeEnd("ctx");
  18926. return String(self) < aString._asString();
  18927. return self;
  18928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18929. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)});
  18930. //>>excludeEnd("ctx");
  18931. },
  18932. //>>excludeStart("ide", pragmas.excludeIdeData);
  18933. args: ["aString"],
  18934. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  18935. referencedClasses: [],
  18936. //>>excludeEnd("ide");
  18937. messageSends: []
  18938. }),
  18939. globals.String);
  18940. smalltalk.addMethod(
  18941. smalltalk.method({
  18942. selector: "<=",
  18943. protocol: 'comparing',
  18944. fn: function (aString){
  18945. var self=this;
  18946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18947. return smalltalk.withContext(function($ctx1) {
  18948. //>>excludeEnd("ctx");
  18949. return String(self) <= aString._asString();
  18950. return self;
  18951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18952. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)});
  18953. //>>excludeEnd("ctx");
  18954. },
  18955. //>>excludeStart("ide", pragmas.excludeIdeData);
  18956. args: ["aString"],
  18957. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  18958. referencedClasses: [],
  18959. //>>excludeEnd("ide");
  18960. messageSends: []
  18961. }),
  18962. globals.String);
  18963. smalltalk.addMethod(
  18964. smalltalk.method({
  18965. selector: "=",
  18966. protocol: 'comparing',
  18967. fn: function (aString){
  18968. var self=this;
  18969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18970. return smalltalk.withContext(function($ctx1) {
  18971. //>>excludeEnd("ctx");
  18972. return aString != null &&
  18973. typeof aString._isString === "function" &&
  18974. aString._isString() &&
  18975. String(self) === String(aString)
  18976. ;
  18977. return self;
  18978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18979. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)});
  18980. //>>excludeEnd("ctx");
  18981. },
  18982. //>>excludeStart("ide", pragmas.excludeIdeData);
  18983. args: ["aString"],
  18984. 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>",
  18985. referencedClasses: [],
  18986. //>>excludeEnd("ide");
  18987. messageSends: []
  18988. }),
  18989. globals.String);
  18990. smalltalk.addMethod(
  18991. smalltalk.method({
  18992. selector: "==",
  18993. protocol: 'comparing',
  18994. fn: function (aString){
  18995. var self=this;
  18996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18997. return smalltalk.withContext(function($ctx1) {
  18998. //>>excludeEnd("ctx");
  18999. var $1;
  19000. $1=self.__eq(aString);
  19001. return $1;
  19002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19003. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)});
  19004. //>>excludeEnd("ctx");
  19005. },
  19006. //>>excludeStart("ide", pragmas.excludeIdeData);
  19007. args: ["aString"],
  19008. source: "== aString\x0a\x09^ self = aString",
  19009. referencedClasses: [],
  19010. //>>excludeEnd("ide");
  19011. messageSends: ["="]
  19012. }),
  19013. globals.String);
  19014. smalltalk.addMethod(
  19015. smalltalk.method({
  19016. selector: ">",
  19017. protocol: 'comparing',
  19018. fn: function (aString){
  19019. var self=this;
  19020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19021. return smalltalk.withContext(function($ctx1) {
  19022. //>>excludeEnd("ctx");
  19023. return String(self) > aString._asString();
  19024. return self;
  19025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19026. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)});
  19027. //>>excludeEnd("ctx");
  19028. },
  19029. //>>excludeStart("ide", pragmas.excludeIdeData);
  19030. args: ["aString"],
  19031. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  19032. referencedClasses: [],
  19033. //>>excludeEnd("ide");
  19034. messageSends: []
  19035. }),
  19036. globals.String);
  19037. smalltalk.addMethod(
  19038. smalltalk.method({
  19039. selector: ">=",
  19040. protocol: 'comparing',
  19041. fn: function (aString){
  19042. var self=this;
  19043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19044. return smalltalk.withContext(function($ctx1) {
  19045. //>>excludeEnd("ctx");
  19046. return String(self) >= aString._asString();
  19047. return self;
  19048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19049. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)});
  19050. //>>excludeEnd("ctx");
  19051. },
  19052. //>>excludeStart("ide", pragmas.excludeIdeData);
  19053. args: ["aString"],
  19054. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  19055. referencedClasses: [],
  19056. //>>excludeEnd("ide");
  19057. messageSends: []
  19058. }),
  19059. globals.String);
  19060. smalltalk.addMethod(
  19061. smalltalk.method({
  19062. selector: "asJSON",
  19063. protocol: 'converting',
  19064. fn: function (){
  19065. var self=this;
  19066. return self;
  19067. },
  19068. //>>excludeStart("ide", pragmas.excludeIdeData);
  19069. args: [],
  19070. source: "asJSON\x0a\x09^ self",
  19071. referencedClasses: [],
  19072. //>>excludeEnd("ide");
  19073. messageSends: []
  19074. }),
  19075. globals.String);
  19076. smalltalk.addMethod(
  19077. smalltalk.method({
  19078. selector: "asJavaScriptMethodName",
  19079. protocol: 'converting',
  19080. fn: function (){
  19081. var self=this;
  19082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19083. return smalltalk.withContext(function($ctx1) {
  19084. //>>excludeEnd("ctx");
  19085. return smalltalk.st2js(self);
  19086. return self;
  19087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19088. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},globals.String)});
  19089. //>>excludeEnd("ctx");
  19090. },
  19091. //>>excludeStart("ide", pragmas.excludeIdeData);
  19092. args: [],
  19093. source: "asJavaScriptMethodName\x0a\x09<return smalltalk.st2js(self)>",
  19094. referencedClasses: [],
  19095. //>>excludeEnd("ide");
  19096. messageSends: []
  19097. }),
  19098. globals.String);
  19099. smalltalk.addMethod(
  19100. smalltalk.method({
  19101. selector: "asJavascript",
  19102. protocol: 'converting',
  19103. fn: function (){
  19104. var self=this;
  19105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19106. return smalltalk.withContext(function($ctx1) {
  19107. //>>excludeEnd("ctx");
  19108. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  19109. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  19110. else
  19111. return "\"" + self + "\"";
  19112. ;
  19113. return self;
  19114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19115. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)});
  19116. //>>excludeEnd("ctx");
  19117. },
  19118. //>>excludeStart("ide", pragmas.excludeIdeData);
  19119. args: [],
  19120. 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>",
  19121. referencedClasses: [],
  19122. //>>excludeEnd("ide");
  19123. messageSends: []
  19124. }),
  19125. globals.String);
  19126. smalltalk.addMethod(
  19127. smalltalk.method({
  19128. selector: "asLowercase",
  19129. protocol: 'converting',
  19130. fn: function (){
  19131. var self=this;
  19132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19133. return smalltalk.withContext(function($ctx1) {
  19134. //>>excludeEnd("ctx");
  19135. return self.toLowerCase();
  19136. return self;
  19137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19138. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)});
  19139. //>>excludeEnd("ctx");
  19140. },
  19141. //>>excludeStart("ide", pragmas.excludeIdeData);
  19142. args: [],
  19143. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  19144. referencedClasses: [],
  19145. //>>excludeEnd("ide");
  19146. messageSends: []
  19147. }),
  19148. globals.String);
  19149. smalltalk.addMethod(
  19150. smalltalk.method({
  19151. selector: "asMutator",
  19152. protocol: 'converting',
  19153. fn: function (){
  19154. var self=this;
  19155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19156. return smalltalk.withContext(function($ctx1) {
  19157. //>>excludeEnd("ctx");
  19158. var $1,$2;
  19159. $1=_st(self._last()).__eq(":");
  19160. if(! smalltalk.assert($1)){
  19161. $2=self.__comma(":");
  19162. return $2;
  19163. };
  19164. return self;
  19165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19166. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)});
  19167. //>>excludeEnd("ctx");
  19168. },
  19169. //>>excludeStart("ide", pragmas.excludeIdeData);
  19170. args: [],
  19171. 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",
  19172. referencedClasses: [],
  19173. //>>excludeEnd("ide");
  19174. messageSends: ["ifFalse:", "=", "last", ","]
  19175. }),
  19176. globals.String);
  19177. smalltalk.addMethod(
  19178. smalltalk.method({
  19179. selector: "asNumber",
  19180. protocol: 'converting',
  19181. fn: function (){
  19182. var self=this;
  19183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19184. return smalltalk.withContext(function($ctx1) {
  19185. //>>excludeEnd("ctx");
  19186. return Number(self);
  19187. return self;
  19188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19189. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)});
  19190. //>>excludeEnd("ctx");
  19191. },
  19192. //>>excludeStart("ide", pragmas.excludeIdeData);
  19193. args: [],
  19194. source: "asNumber\x0a\x09<return Number(self)>",
  19195. referencedClasses: [],
  19196. //>>excludeEnd("ide");
  19197. messageSends: []
  19198. }),
  19199. globals.String);
  19200. smalltalk.addMethod(
  19201. smalltalk.method({
  19202. selector: "asRegexp",
  19203. protocol: 'converting',
  19204. fn: function (){
  19205. var self=this;
  19206. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  19207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19208. return smalltalk.withContext(function($ctx1) {
  19209. //>>excludeEnd("ctx");
  19210. var $1;
  19211. $1=_st($RegularExpression())._fromString_(self);
  19212. return $1;
  19213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19214. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)});
  19215. //>>excludeEnd("ctx");
  19216. },
  19217. //>>excludeStart("ide", pragmas.excludeIdeData);
  19218. args: [],
  19219. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  19220. referencedClasses: ["RegularExpression"],
  19221. //>>excludeEnd("ide");
  19222. messageSends: ["fromString:"]
  19223. }),
  19224. globals.String);
  19225. smalltalk.addMethod(
  19226. smalltalk.method({
  19227. selector: "asSelector",
  19228. protocol: 'converting',
  19229. fn: function (){
  19230. var self=this;
  19231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19232. return smalltalk.withContext(function($ctx1) {
  19233. //>>excludeEnd("ctx");
  19234. var $1;
  19235. self._deprecatedAPI_("Use #asJavaScriptMethodName");
  19236. $1=self._asJavaScriptMethodName();
  19237. return $1;
  19238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19239. }, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)});
  19240. //>>excludeEnd("ctx");
  19241. },
  19242. //>>excludeStart("ide", pragmas.excludeIdeData);
  19243. args: [],
  19244. source: "asSelector\x0a\x09self deprecatedAPI: 'Use #asJavaScriptMethodName'.\x0a\x09^ self asJavaScriptMethodName",
  19245. referencedClasses: [],
  19246. //>>excludeEnd("ide");
  19247. messageSends: ["deprecatedAPI:", "asJavaScriptMethodName"]
  19248. }),
  19249. globals.String);
  19250. smalltalk.addMethod(
  19251. smalltalk.method({
  19252. selector: "asString",
  19253. protocol: 'converting',
  19254. fn: function (){
  19255. var self=this;
  19256. return self;
  19257. },
  19258. //>>excludeStart("ide", pragmas.excludeIdeData);
  19259. args: [],
  19260. source: "asString\x0a\x09^ self",
  19261. referencedClasses: [],
  19262. //>>excludeEnd("ide");
  19263. messageSends: []
  19264. }),
  19265. globals.String);
  19266. smalltalk.addMethod(
  19267. smalltalk.method({
  19268. selector: "asSymbol",
  19269. protocol: 'converting',
  19270. fn: function (){
  19271. var self=this;
  19272. return self;
  19273. },
  19274. //>>excludeStart("ide", pragmas.excludeIdeData);
  19275. args: [],
  19276. source: "asSymbol\x0a\x09^ self",
  19277. referencedClasses: [],
  19278. //>>excludeEnd("ide");
  19279. messageSends: []
  19280. }),
  19281. globals.String);
  19282. smalltalk.addMethod(
  19283. smalltalk.method({
  19284. selector: "asUppercase",
  19285. protocol: 'converting',
  19286. fn: function (){
  19287. var self=this;
  19288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19289. return smalltalk.withContext(function($ctx1) {
  19290. //>>excludeEnd("ctx");
  19291. return self.toUpperCase();
  19292. return self;
  19293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19294. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)});
  19295. //>>excludeEnd("ctx");
  19296. },
  19297. //>>excludeStart("ide", pragmas.excludeIdeData);
  19298. args: [],
  19299. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  19300. referencedClasses: [],
  19301. //>>excludeEnd("ide");
  19302. messageSends: []
  19303. }),
  19304. globals.String);
  19305. smalltalk.addMethod(
  19306. smalltalk.method({
  19307. selector: "asciiValue",
  19308. protocol: 'accessing',
  19309. fn: function (){
  19310. var self=this;
  19311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19312. return smalltalk.withContext(function($ctx1) {
  19313. //>>excludeEnd("ctx");
  19314. return self.charCodeAt(0);;
  19315. return self;
  19316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19317. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)});
  19318. //>>excludeEnd("ctx");
  19319. },
  19320. //>>excludeStart("ide", pragmas.excludeIdeData);
  19321. args: [],
  19322. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  19323. referencedClasses: [],
  19324. //>>excludeEnd("ide");
  19325. messageSends: []
  19326. }),
  19327. globals.String);
  19328. smalltalk.addMethod(
  19329. smalltalk.method({
  19330. selector: "at:ifAbsent:",
  19331. protocol: 'accessing',
  19332. fn: function (anIndex,aBlock){
  19333. var self=this;
  19334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19335. return smalltalk.withContext(function($ctx1) {
  19336. //>>excludeEnd("ctx");
  19337. return String(self)[anIndex - 1] || aBlock._value();
  19338. return self;
  19339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19340. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)});
  19341. //>>excludeEnd("ctx");
  19342. },
  19343. //>>excludeStart("ide", pragmas.excludeIdeData);
  19344. args: ["anIndex", "aBlock"],
  19345. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  19346. referencedClasses: [],
  19347. //>>excludeEnd("ide");
  19348. messageSends: []
  19349. }),
  19350. globals.String);
  19351. smalltalk.addMethod(
  19352. smalltalk.method({
  19353. selector: "at:ifPresent:ifAbsent:",
  19354. protocol: 'accessing',
  19355. fn: function (anIndex,aBlock,anotherBlock){
  19356. var self=this;
  19357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19358. return smalltalk.withContext(function($ctx1) {
  19359. //>>excludeEnd("ctx");
  19360. var result = String(self)[anIndex - 1];
  19361. return result ? aBlock._value_(result) : anotherBlock._value();
  19362. ;
  19363. return self;
  19364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19365. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)});
  19366. //>>excludeEnd("ctx");
  19367. },
  19368. //>>excludeStart("ide", pragmas.excludeIdeData);
  19369. args: ["anIndex", "aBlock", "anotherBlock"],
  19370. 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>",
  19371. referencedClasses: [],
  19372. //>>excludeEnd("ide");
  19373. messageSends: []
  19374. }),
  19375. globals.String);
  19376. smalltalk.addMethod(
  19377. smalltalk.method({
  19378. selector: "capitalized",
  19379. protocol: 'converting',
  19380. fn: function (){
  19381. var self=this;
  19382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19383. return smalltalk.withContext(function($ctx1) {
  19384. //>>excludeEnd("ctx");
  19385. var $2,$1;
  19386. $2=self._isEmpty();
  19387. if(smalltalk.assert($2)){
  19388. $1=self;
  19389. } else {
  19390. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  19391. };
  19392. return $1;
  19393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19394. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)});
  19395. //>>excludeEnd("ctx");
  19396. },
  19397. //>>excludeStart("ide", pragmas.excludeIdeData);
  19398. args: [],
  19399. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  19400. referencedClasses: [],
  19401. //>>excludeEnd("ide");
  19402. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  19403. }),
  19404. globals.String);
  19405. smalltalk.addMethod(
  19406. smalltalk.method({
  19407. selector: "charCodeAt:",
  19408. protocol: 'accessing',
  19409. fn: function (anInteger){
  19410. var self=this;
  19411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19412. return smalltalk.withContext(function($ctx1) {
  19413. //>>excludeEnd("ctx");
  19414. return self.charCodeAt(anInteger - 1);
  19415. return self;
  19416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19417. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)});
  19418. //>>excludeEnd("ctx");
  19419. },
  19420. //>>excludeStart("ide", pragmas.excludeIdeData);
  19421. args: ["anInteger"],
  19422. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  19423. referencedClasses: [],
  19424. //>>excludeEnd("ide");
  19425. messageSends: []
  19426. }),
  19427. globals.String);
  19428. smalltalk.addMethod(
  19429. smalltalk.method({
  19430. selector: "copyFrom:to:",
  19431. protocol: 'copying',
  19432. fn: function (anIndex,anotherIndex){
  19433. var self=this;
  19434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19435. return smalltalk.withContext(function($ctx1) {
  19436. //>>excludeEnd("ctx");
  19437. return self.substring(anIndex - 1, anotherIndex);
  19438. return self;
  19439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19440. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)});
  19441. //>>excludeEnd("ctx");
  19442. },
  19443. //>>excludeStart("ide", pragmas.excludeIdeData);
  19444. args: ["anIndex", "anotherIndex"],
  19445. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  19446. referencedClasses: [],
  19447. //>>excludeEnd("ide");
  19448. messageSends: []
  19449. }),
  19450. globals.String);
  19451. smalltalk.addMethod(
  19452. smalltalk.method({
  19453. selector: "crlfSanitized",
  19454. protocol: 'converting',
  19455. fn: function (){
  19456. var self=this;
  19457. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19459. return smalltalk.withContext(function($ctx1) {
  19460. //>>excludeEnd("ctx");
  19461. var $1;
  19462. $1=_st(self._lines())._join_(_st($String())._lf());
  19463. return $1;
  19464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19465. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)});
  19466. //>>excludeEnd("ctx");
  19467. },
  19468. //>>excludeStart("ide", pragmas.excludeIdeData);
  19469. args: [],
  19470. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  19471. referencedClasses: ["String"],
  19472. //>>excludeEnd("ide");
  19473. messageSends: ["join:", "lines", "lf"]
  19474. }),
  19475. globals.String);
  19476. smalltalk.addMethod(
  19477. smalltalk.method({
  19478. selector: "deepCopy",
  19479. protocol: 'copying',
  19480. fn: function (){
  19481. var self=this;
  19482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19483. return smalltalk.withContext(function($ctx1) {
  19484. //>>excludeEnd("ctx");
  19485. var $1;
  19486. $1=self._shallowCopy();
  19487. return $1;
  19488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19489. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)});
  19490. //>>excludeEnd("ctx");
  19491. },
  19492. //>>excludeStart("ide", pragmas.excludeIdeData);
  19493. args: [],
  19494. source: "deepCopy\x0a\x09^ self shallowCopy",
  19495. referencedClasses: [],
  19496. //>>excludeEnd("ide");
  19497. messageSends: ["shallowCopy"]
  19498. }),
  19499. globals.String);
  19500. smalltalk.addMethod(
  19501. smalltalk.method({
  19502. selector: "escaped",
  19503. protocol: 'converting',
  19504. fn: function (){
  19505. var self=this;
  19506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19507. return smalltalk.withContext(function($ctx1) {
  19508. //>>excludeEnd("ctx");
  19509. return escape(self);
  19510. return self;
  19511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19512. }, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)});
  19513. //>>excludeEnd("ctx");
  19514. },
  19515. //>>excludeStart("ide", pragmas.excludeIdeData);
  19516. args: [],
  19517. source: "escaped\x0a\x09<return escape(self)>",
  19518. referencedClasses: [],
  19519. //>>excludeEnd("ide");
  19520. messageSends: []
  19521. }),
  19522. globals.String);
  19523. smalltalk.addMethod(
  19524. smalltalk.method({
  19525. selector: "identityHash",
  19526. protocol: 'accessing',
  19527. fn: function (){
  19528. var self=this;
  19529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19530. return smalltalk.withContext(function($ctx1) {
  19531. //>>excludeEnd("ctx");
  19532. var $1;
  19533. $1=self.__comma("s");
  19534. return $1;
  19535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19536. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)});
  19537. //>>excludeEnd("ctx");
  19538. },
  19539. //>>excludeStart("ide", pragmas.excludeIdeData);
  19540. args: [],
  19541. source: "identityHash\x0a\x09^ self, 's'",
  19542. referencedClasses: [],
  19543. //>>excludeEnd("ide");
  19544. messageSends: [","]
  19545. }),
  19546. globals.String);
  19547. smalltalk.addMethod(
  19548. smalltalk.method({
  19549. selector: "includesSubString:",
  19550. protocol: 'testing',
  19551. fn: function (subString){
  19552. var self=this;
  19553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19554. return smalltalk.withContext(function($ctx1) {
  19555. //>>excludeEnd("ctx");
  19556. return self.indexOf(subString) != -1;
  19557. return self;
  19558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19559. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)});
  19560. //>>excludeEnd("ctx");
  19561. },
  19562. //>>excludeStart("ide", pragmas.excludeIdeData);
  19563. args: ["subString"],
  19564. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  19565. referencedClasses: [],
  19566. //>>excludeEnd("ide");
  19567. messageSends: []
  19568. }),
  19569. globals.String);
  19570. smalltalk.addMethod(
  19571. smalltalk.method({
  19572. selector: "isCapitalized",
  19573. protocol: 'testing',
  19574. fn: function (){
  19575. var self=this;
  19576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19577. return smalltalk.withContext(function($ctx1) {
  19578. //>>excludeEnd("ctx");
  19579. var $3,$2,$1;
  19580. $3=self._first();
  19581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19582. $ctx1.sendIdx["first"]=1;
  19583. //>>excludeEnd("ctx");
  19584. $2=_st($3)._asUppercase();
  19585. $1=_st($2).__eq_eq(self._first());
  19586. return $1;
  19587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19588. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)});
  19589. //>>excludeEnd("ctx");
  19590. },
  19591. //>>excludeStart("ide", pragmas.excludeIdeData);
  19592. args: [],
  19593. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  19594. referencedClasses: [],
  19595. //>>excludeEnd("ide");
  19596. messageSends: ["==", "asUppercase", "first"]
  19597. }),
  19598. globals.String);
  19599. smalltalk.addMethod(
  19600. smalltalk.method({
  19601. selector: "isImmutable",
  19602. protocol: 'testing',
  19603. fn: function (){
  19604. var self=this;
  19605. return true;
  19606. },
  19607. //>>excludeStart("ide", pragmas.excludeIdeData);
  19608. args: [],
  19609. source: "isImmutable\x0a\x09^ true",
  19610. referencedClasses: [],
  19611. //>>excludeEnd("ide");
  19612. messageSends: []
  19613. }),
  19614. globals.String);
  19615. smalltalk.addMethod(
  19616. smalltalk.method({
  19617. selector: "isString",
  19618. protocol: 'testing',
  19619. fn: function (){
  19620. var self=this;
  19621. return true;
  19622. },
  19623. //>>excludeStart("ide", pragmas.excludeIdeData);
  19624. args: [],
  19625. source: "isString\x0a\x09^ true",
  19626. referencedClasses: [],
  19627. //>>excludeEnd("ide");
  19628. messageSends: []
  19629. }),
  19630. globals.String);
  19631. smalltalk.addMethod(
  19632. smalltalk.method({
  19633. selector: "isVowel",
  19634. protocol: 'testing',
  19635. fn: function (){
  19636. var self=this;
  19637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19638. return smalltalk.withContext(function($ctx1) {
  19639. //>>excludeEnd("ctx");
  19640. var $1;
  19641. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  19642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19643. return smalltalk.withContext(function($ctx2) {
  19644. //>>excludeEnd("ctx");
  19645. return "aeiou"._includes_(self._asLowercase());
  19646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19648. //>>excludeEnd("ctx");
  19649. }));
  19650. return $1;
  19651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19652. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)});
  19653. //>>excludeEnd("ctx");
  19654. },
  19655. //>>excludeStart("ide", pragmas.excludeIdeData);
  19656. args: [],
  19657. 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 ]",
  19658. referencedClasses: [],
  19659. //>>excludeEnd("ide");
  19660. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  19661. }),
  19662. globals.String);
  19663. smalltalk.addMethod(
  19664. smalltalk.method({
  19665. selector: "join:",
  19666. protocol: 'split join',
  19667. fn: function (aCollection){
  19668. var self=this;
  19669. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19671. return smalltalk.withContext(function($ctx1) {
  19672. //>>excludeEnd("ctx");
  19673. var $1;
  19674. $1=_st($String())._streamContents_((function(stream){
  19675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19676. return smalltalk.withContext(function($ctx2) {
  19677. //>>excludeEnd("ctx");
  19678. return _st(aCollection)._do_separatedBy_((function(each){
  19679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19680. return smalltalk.withContext(function($ctx3) {
  19681. //>>excludeEnd("ctx");
  19682. return _st(stream)._nextPutAll_(_st(each)._asString());
  19683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19684. $ctx3.sendIdx["nextPutAll:"]=1;
  19685. //>>excludeEnd("ctx");
  19686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19687. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  19688. //>>excludeEnd("ctx");
  19689. }),(function(){
  19690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19691. return smalltalk.withContext(function($ctx3) {
  19692. //>>excludeEnd("ctx");
  19693. return _st(stream)._nextPutAll_(self);
  19694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19695. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19696. //>>excludeEnd("ctx");
  19697. }));
  19698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19699. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  19700. //>>excludeEnd("ctx");
  19701. }));
  19702. return $1;
  19703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19704. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)});
  19705. //>>excludeEnd("ctx");
  19706. },
  19707. //>>excludeStart("ide", pragmas.excludeIdeData);
  19708. args: ["aCollection"],
  19709. 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 ]]",
  19710. referencedClasses: ["String"],
  19711. //>>excludeEnd("ide");
  19712. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  19713. }),
  19714. globals.String);
  19715. smalltalk.addMethod(
  19716. smalltalk.method({
  19717. selector: "lineIndicesDo:",
  19718. protocol: 'split join',
  19719. fn: function (aBlock){
  19720. var self=this;
  19721. var cr,lf,start,sz,nextLF,nextCR;
  19722. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  19723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19724. return smalltalk.withContext(function($ctx1) {
  19725. //>>excludeEnd("ctx");
  19726. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  19727. var $early={};
  19728. try {
  19729. start=(1);
  19730. sz=self._size();
  19731. cr=_st($String())._cr();
  19732. nextCR=self._indexOf_startingAt_(cr,(1));
  19733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19734. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  19735. //>>excludeEnd("ctx");
  19736. lf=_st($String())._lf();
  19737. nextLF=self._indexOf_startingAt_(lf,(1));
  19738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19739. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  19740. //>>excludeEnd("ctx");
  19741. _st((function(){
  19742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19743. return smalltalk.withContext(function($ctx2) {
  19744. //>>excludeEnd("ctx");
  19745. return _st(start).__lt_eq(sz);
  19746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19748. //>>excludeEnd("ctx");
  19749. }))._whileTrue_((function(){
  19750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19751. return smalltalk.withContext(function($ctx2) {
  19752. //>>excludeEnd("ctx");
  19753. $2=_st(nextLF).__eq((0));
  19754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19755. $ctx2.sendIdx["="]=1;
  19756. //>>excludeEnd("ctx");
  19757. $1=_st($2)._and_((function(){
  19758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19759. return smalltalk.withContext(function($ctx3) {
  19760. //>>excludeEnd("ctx");
  19761. return _st(nextCR).__eq((0));
  19762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19763. $ctx3.sendIdx["="]=2;
  19764. //>>excludeEnd("ctx");
  19765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  19767. //>>excludeEnd("ctx");
  19768. }));
  19769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19770. $ctx2.sendIdx["and:"]=1;
  19771. //>>excludeEnd("ctx");
  19772. if(smalltalk.assert($1)){
  19773. _st(aBlock)._value_value_value_(start,sz,sz);
  19774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19775. $ctx2.sendIdx["value:value:value:"]=1;
  19776. //>>excludeEnd("ctx");
  19777. throw $early=[self];
  19778. };
  19779. $4=_st(nextCR).__eq((0));
  19780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19781. $ctx2.sendIdx["="]=3;
  19782. //>>excludeEnd("ctx");
  19783. $3=_st($4)._or_((function(){
  19784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19785. return smalltalk.withContext(function($ctx3) {
  19786. //>>excludeEnd("ctx");
  19787. $5=(0).__lt(nextLF);
  19788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19789. $ctx3.sendIdx["<"]=1;
  19790. //>>excludeEnd("ctx");
  19791. return _st($5)._and_((function(){
  19792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19793. return smalltalk.withContext(function($ctx4) {
  19794. //>>excludeEnd("ctx");
  19795. return _st(nextLF).__lt(nextCR);
  19796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19797. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  19798. //>>excludeEnd("ctx");
  19799. }));
  19800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19801. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  19802. //>>excludeEnd("ctx");
  19803. }));
  19804. if(smalltalk.assert($3)){
  19805. $6=start;
  19806. $7=_st(nextLF).__minus((1));
  19807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19808. $ctx2.sendIdx["-"]=1;
  19809. //>>excludeEnd("ctx");
  19810. _st(aBlock)._value_value_value_($6,$7,nextLF);
  19811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19812. $ctx2.sendIdx["value:value:value:"]=2;
  19813. //>>excludeEnd("ctx");
  19814. start=(1).__plus(nextLF);
  19815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19816. $ctx2.sendIdx["+"]=1;
  19817. //>>excludeEnd("ctx");
  19818. start;
  19819. nextLF=self._indexOf_startingAt_(lf,start);
  19820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19821. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  19822. //>>excludeEnd("ctx");
  19823. return nextLF;
  19824. } else {
  19825. $9=(1).__plus(nextCR);
  19826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19827. $ctx2.sendIdx["+"]=2;
  19828. //>>excludeEnd("ctx");
  19829. $8=_st($9).__eq(nextLF);
  19830. if(smalltalk.assert($8)){
  19831. $10=start;
  19832. $11=_st(nextCR).__minus((1));
  19833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19834. $ctx2.sendIdx["-"]=2;
  19835. //>>excludeEnd("ctx");
  19836. _st(aBlock)._value_value_value_($10,$11,nextLF);
  19837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19838. $ctx2.sendIdx["value:value:value:"]=3;
  19839. //>>excludeEnd("ctx");
  19840. start=(1).__plus(nextLF);
  19841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19842. $ctx2.sendIdx["+"]=3;
  19843. //>>excludeEnd("ctx");
  19844. start;
  19845. nextCR=self._indexOf_startingAt_(cr,start);
  19846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19847. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  19848. //>>excludeEnd("ctx");
  19849. nextCR;
  19850. nextLF=self._indexOf_startingAt_(lf,start);
  19851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19852. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  19853. //>>excludeEnd("ctx");
  19854. return nextLF;
  19855. } else {
  19856. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  19857. start=(1).__plus(nextCR);
  19858. start;
  19859. nextCR=self._indexOf_startingAt_(cr,start);
  19860. return nextCR;
  19861. };
  19862. };
  19863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19865. //>>excludeEnd("ctx");
  19866. }));
  19867. return self;
  19868. }
  19869. catch(e) {if(e===$early)return e[0]; throw e}
  19870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19871. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)});
  19872. //>>excludeEnd("ctx");
  19873. },
  19874. //>>excludeStart("ide", pragmas.excludeIdeData);
  19875. args: ["aBlock"],
  19876. 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 ] ]]",
  19877. referencedClasses: ["String"],
  19878. //>>excludeEnd("ide");
  19879. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  19880. }),
  19881. globals.String);
  19882. smalltalk.addMethod(
  19883. smalltalk.method({
  19884. selector: "lineNumber:",
  19885. protocol: 'split join',
  19886. fn: function (anIndex){
  19887. var self=this;
  19888. var lineCount;
  19889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19890. return smalltalk.withContext(function($ctx1) {
  19891. //>>excludeEnd("ctx");
  19892. var $2,$1,$3;
  19893. var $early={};
  19894. try {
  19895. lineCount=(0);
  19896. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  19897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19898. return smalltalk.withContext(function($ctx2) {
  19899. //>>excludeEnd("ctx");
  19900. lineCount=_st(lineCount).__plus((1));
  19901. $2=lineCount;
  19902. $1=_st($2).__eq(anIndex);
  19903. if(smalltalk.assert($1)){
  19904. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  19905. throw $early=[$3];
  19906. };
  19907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19908. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  19909. //>>excludeEnd("ctx");
  19910. }));
  19911. return nil;
  19912. }
  19913. catch(e) {if(e===$early)return e[0]; throw e}
  19914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19915. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)});
  19916. //>>excludeEnd("ctx");
  19917. },
  19918. //>>excludeStart("ide", pragmas.excludeIdeData);
  19919. args: ["anIndex"],
  19920. 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",
  19921. referencedClasses: [],
  19922. //>>excludeEnd("ide");
  19923. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  19924. }),
  19925. globals.String);
  19926. smalltalk.addMethod(
  19927. smalltalk.method({
  19928. selector: "lines",
  19929. protocol: 'split join',
  19930. fn: function (){
  19931. var self=this;
  19932. var lines;
  19933. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  19934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19935. return smalltalk.withContext(function($ctx1) {
  19936. //>>excludeEnd("ctx");
  19937. var $1;
  19938. lines=_st($Array())._new();
  19939. self._linesDo_((function(aLine){
  19940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19941. return smalltalk.withContext(function($ctx2) {
  19942. //>>excludeEnd("ctx");
  19943. return _st(lines)._add_(aLine);
  19944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19945. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  19946. //>>excludeEnd("ctx");
  19947. }));
  19948. $1=lines;
  19949. return $1;
  19950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19951. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)});
  19952. //>>excludeEnd("ctx");
  19953. },
  19954. //>>excludeStart("ide", pragmas.excludeIdeData);
  19955. args: [],
  19956. 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",
  19957. referencedClasses: ["Array"],
  19958. //>>excludeEnd("ide");
  19959. messageSends: ["new", "linesDo:", "add:"]
  19960. }),
  19961. globals.String);
  19962. smalltalk.addMethod(
  19963. smalltalk.method({
  19964. selector: "linesDo:",
  19965. protocol: 'split join',
  19966. fn: function (aBlock){
  19967. var self=this;
  19968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19969. return smalltalk.withContext(function($ctx1) {
  19970. //>>excludeEnd("ctx");
  19971. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  19972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19973. return smalltalk.withContext(function($ctx2) {
  19974. //>>excludeEnd("ctx");
  19975. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  19976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19977. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  19978. //>>excludeEnd("ctx");
  19979. }));
  19980. return self;
  19981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19982. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)});
  19983. //>>excludeEnd("ctx");
  19984. },
  19985. //>>excludeStart("ide", pragmas.excludeIdeData);
  19986. args: ["aBlock"],
  19987. 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) ]",
  19988. referencedClasses: [],
  19989. //>>excludeEnd("ide");
  19990. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  19991. }),
  19992. globals.String);
  19993. smalltalk.addMethod(
  19994. smalltalk.method({
  19995. selector: "match:",
  19996. protocol: 'regular expressions',
  19997. fn: function (aRegexp){
  19998. var self=this;
  19999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20000. return smalltalk.withContext(function($ctx1) {
  20001. //>>excludeEnd("ctx");
  20002. return self.search(aRegexp) != -1;
  20003. return self;
  20004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20005. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)});
  20006. //>>excludeEnd("ctx");
  20007. },
  20008. //>>excludeStart("ide", pragmas.excludeIdeData);
  20009. args: ["aRegexp"],
  20010. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  20011. referencedClasses: [],
  20012. //>>excludeEnd("ide");
  20013. messageSends: []
  20014. }),
  20015. globals.String);
  20016. smalltalk.addMethod(
  20017. smalltalk.method({
  20018. selector: "matchesOf:",
  20019. protocol: 'regular expressions',
  20020. fn: function (aRegularExpression){
  20021. var self=this;
  20022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20023. return smalltalk.withContext(function($ctx1) {
  20024. //>>excludeEnd("ctx");
  20025. return self.match(aRegularExpression);
  20026. return self;
  20027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20028. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)});
  20029. //>>excludeEnd("ctx");
  20030. },
  20031. //>>excludeStart("ide", pragmas.excludeIdeData);
  20032. args: ["aRegularExpression"],
  20033. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  20034. referencedClasses: [],
  20035. //>>excludeEnd("ide");
  20036. messageSends: []
  20037. }),
  20038. globals.String);
  20039. smalltalk.addMethod(
  20040. smalltalk.method({
  20041. selector: "numericallyIndexable",
  20042. protocol: 'private',
  20043. fn: function (){
  20044. var self=this;
  20045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20046. return smalltalk.withContext(function($ctx1) {
  20047. //>>excludeEnd("ctx");
  20048. return String(self);
  20049. return self;
  20050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20051. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)});
  20052. //>>excludeEnd("ctx");
  20053. },
  20054. //>>excludeStart("ide", pragmas.excludeIdeData);
  20055. args: [],
  20056. source: "numericallyIndexable\x0a\x09<return String(self)>",
  20057. referencedClasses: [],
  20058. //>>excludeEnd("ide");
  20059. messageSends: []
  20060. }),
  20061. globals.String);
  20062. smalltalk.addMethod(
  20063. smalltalk.method({
  20064. selector: "printNl",
  20065. protocol: 'printing',
  20066. fn: function (){
  20067. var self=this;
  20068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20069. return smalltalk.withContext(function($ctx1) {
  20070. //>>excludeEnd("ctx");
  20071. console.log(self);
  20072. return self;
  20073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20074. }, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)});
  20075. //>>excludeEnd("ctx");
  20076. },
  20077. //>>excludeStart("ide", pragmas.excludeIdeData);
  20078. args: [],
  20079. source: "printNl\x0a\x09<console.log(self)>",
  20080. referencedClasses: [],
  20081. //>>excludeEnd("ide");
  20082. messageSends: []
  20083. }),
  20084. globals.String);
  20085. smalltalk.addMethod(
  20086. smalltalk.method({
  20087. selector: "printOn:",
  20088. protocol: 'printing',
  20089. fn: function (aStream){
  20090. var self=this;
  20091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20092. return smalltalk.withContext(function($ctx1) {
  20093. //>>excludeEnd("ctx");
  20094. var $1;
  20095. _st(aStream)._nextPutAll_("'");
  20096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20097. $ctx1.sendIdx["nextPutAll:"]=1;
  20098. //>>excludeEnd("ctx");
  20099. _st(aStream)._nextPutAll_(self);
  20100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20101. $ctx1.sendIdx["nextPutAll:"]=2;
  20102. //>>excludeEnd("ctx");
  20103. $1=_st(aStream)._nextPutAll_("'");
  20104. return self;
  20105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20106. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)});
  20107. //>>excludeEnd("ctx");
  20108. },
  20109. //>>excludeStart("ide", pragmas.excludeIdeData);
  20110. args: ["aStream"],
  20111. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  20112. referencedClasses: [],
  20113. //>>excludeEnd("ide");
  20114. messageSends: ["nextPutAll:"]
  20115. }),
  20116. globals.String);
  20117. smalltalk.addMethod(
  20118. smalltalk.method({
  20119. selector: "replace:with:",
  20120. protocol: 'regular expressions',
  20121. fn: function (aString,anotherString){
  20122. var self=this;
  20123. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20125. return smalltalk.withContext(function($ctx1) {
  20126. //>>excludeEnd("ctx");
  20127. var $1;
  20128. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  20129. return $1;
  20130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20131. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)});
  20132. //>>excludeEnd("ctx");
  20133. },
  20134. //>>excludeStart("ide", pragmas.excludeIdeData);
  20135. args: ["aString", "anotherString"],
  20136. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  20137. referencedClasses: ["RegularExpression"],
  20138. //>>excludeEnd("ide");
  20139. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  20140. }),
  20141. globals.String);
  20142. smalltalk.addMethod(
  20143. smalltalk.method({
  20144. selector: "replaceRegexp:with:",
  20145. protocol: 'regular expressions',
  20146. fn: function (aRegexp,aString){
  20147. var self=this;
  20148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20149. return smalltalk.withContext(function($ctx1) {
  20150. //>>excludeEnd("ctx");
  20151. return self.replace(aRegexp, aString);
  20152. return self;
  20153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20154. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)});
  20155. //>>excludeEnd("ctx");
  20156. },
  20157. //>>excludeStart("ide", pragmas.excludeIdeData);
  20158. args: ["aRegexp", "aString"],
  20159. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  20160. referencedClasses: [],
  20161. //>>excludeEnd("ide");
  20162. messageSends: []
  20163. }),
  20164. globals.String);
  20165. smalltalk.addMethod(
  20166. smalltalk.method({
  20167. selector: "reversed",
  20168. protocol: 'converting',
  20169. fn: function (){
  20170. var self=this;
  20171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20172. return smalltalk.withContext(function($ctx1) {
  20173. //>>excludeEnd("ctx");
  20174. return self.split("").reverse().join("");
  20175. return self;
  20176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20177. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)});
  20178. //>>excludeEnd("ctx");
  20179. },
  20180. //>>excludeStart("ide", pragmas.excludeIdeData);
  20181. args: [],
  20182. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  20183. referencedClasses: [],
  20184. //>>excludeEnd("ide");
  20185. messageSends: []
  20186. }),
  20187. globals.String);
  20188. smalltalk.addMethod(
  20189. smalltalk.method({
  20190. selector: "shallowCopy",
  20191. protocol: 'copying',
  20192. fn: function (){
  20193. var self=this;
  20194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20195. return smalltalk.withContext(function($ctx1) {
  20196. //>>excludeEnd("ctx");
  20197. var $1;
  20198. $1=_st(self._class())._fromString_(self);
  20199. return $1;
  20200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20201. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)});
  20202. //>>excludeEnd("ctx");
  20203. },
  20204. //>>excludeStart("ide", pragmas.excludeIdeData);
  20205. args: [],
  20206. source: "shallowCopy\x0a\x09^ self class fromString: self",
  20207. referencedClasses: [],
  20208. //>>excludeEnd("ide");
  20209. messageSends: ["fromString:", "class"]
  20210. }),
  20211. globals.String);
  20212. smalltalk.addMethod(
  20213. smalltalk.method({
  20214. selector: "size",
  20215. protocol: 'accessing',
  20216. fn: function (){
  20217. var self=this;
  20218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20219. return smalltalk.withContext(function($ctx1) {
  20220. //>>excludeEnd("ctx");
  20221. return self.length;
  20222. return self;
  20223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20224. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)});
  20225. //>>excludeEnd("ctx");
  20226. },
  20227. //>>excludeStart("ide", pragmas.excludeIdeData);
  20228. args: [],
  20229. source: "size\x0a\x09<return self.length>",
  20230. referencedClasses: [],
  20231. //>>excludeEnd("ide");
  20232. messageSends: []
  20233. }),
  20234. globals.String);
  20235. smalltalk.addMethod(
  20236. smalltalk.method({
  20237. selector: "subStrings:",
  20238. protocol: 'split join',
  20239. fn: function (aString){
  20240. var self=this;
  20241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20242. return smalltalk.withContext(function($ctx1) {
  20243. //>>excludeEnd("ctx");
  20244. var $1;
  20245. $1=self._tokenize_(aString);
  20246. return $1;
  20247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20248. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)});
  20249. //>>excludeEnd("ctx");
  20250. },
  20251. //>>excludeStart("ide", pragmas.excludeIdeData);
  20252. args: ["aString"],
  20253. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  20254. referencedClasses: [],
  20255. //>>excludeEnd("ide");
  20256. messageSends: ["tokenize:"]
  20257. }),
  20258. globals.String);
  20259. smalltalk.addMethod(
  20260. smalltalk.method({
  20261. selector: "tokenize:",
  20262. protocol: 'split join',
  20263. fn: function (aString){
  20264. var self=this;
  20265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20266. return smalltalk.withContext(function($ctx1) {
  20267. //>>excludeEnd("ctx");
  20268. return self.split(aString);
  20269. return self;
  20270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20271. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)});
  20272. //>>excludeEnd("ctx");
  20273. },
  20274. //>>excludeStart("ide", pragmas.excludeIdeData);
  20275. args: ["aString"],
  20276. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  20277. referencedClasses: [],
  20278. //>>excludeEnd("ide");
  20279. messageSends: []
  20280. }),
  20281. globals.String);
  20282. smalltalk.addMethod(
  20283. smalltalk.method({
  20284. selector: "trimBoth",
  20285. protocol: 'regular expressions',
  20286. fn: function (){
  20287. var self=this;
  20288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20289. return smalltalk.withContext(function($ctx1) {
  20290. //>>excludeEnd("ctx");
  20291. var $1;
  20292. $1=self._trimBoth_("\x5cs");
  20293. return $1;
  20294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20295. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)});
  20296. //>>excludeEnd("ctx");
  20297. },
  20298. //>>excludeStart("ide", pragmas.excludeIdeData);
  20299. args: [],
  20300. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  20301. referencedClasses: [],
  20302. //>>excludeEnd("ide");
  20303. messageSends: ["trimBoth:"]
  20304. }),
  20305. globals.String);
  20306. smalltalk.addMethod(
  20307. smalltalk.method({
  20308. selector: "trimBoth:",
  20309. protocol: 'regular expressions',
  20310. fn: function (separators){
  20311. var self=this;
  20312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20313. return smalltalk.withContext(function($ctx1) {
  20314. //>>excludeEnd("ctx");
  20315. var $1;
  20316. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  20317. return $1;
  20318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20319. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)});
  20320. //>>excludeEnd("ctx");
  20321. },
  20322. //>>excludeStart("ide", pragmas.excludeIdeData);
  20323. args: ["separators"],
  20324. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  20325. referencedClasses: [],
  20326. //>>excludeEnd("ide");
  20327. messageSends: ["trimRight:", "trimLeft:"]
  20328. }),
  20329. globals.String);
  20330. smalltalk.addMethod(
  20331. smalltalk.method({
  20332. selector: "trimLeft",
  20333. protocol: 'regular expressions',
  20334. fn: function (){
  20335. var self=this;
  20336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20337. return smalltalk.withContext(function($ctx1) {
  20338. //>>excludeEnd("ctx");
  20339. var $1;
  20340. $1=self._trimLeft_("\x5cs");
  20341. return $1;
  20342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20343. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)});
  20344. //>>excludeEnd("ctx");
  20345. },
  20346. //>>excludeStart("ide", pragmas.excludeIdeData);
  20347. args: [],
  20348. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  20349. referencedClasses: [],
  20350. //>>excludeEnd("ide");
  20351. messageSends: ["trimLeft:"]
  20352. }),
  20353. globals.String);
  20354. smalltalk.addMethod(
  20355. smalltalk.method({
  20356. selector: "trimLeft:",
  20357. protocol: 'regular expressions',
  20358. fn: function (separators){
  20359. var self=this;
  20360. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20362. return smalltalk.withContext(function($ctx1) {
  20363. //>>excludeEnd("ctx");
  20364. var $3,$2,$1;
  20365. $3=_st("^[".__comma(separators)).__comma("]+");
  20366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20367. $ctx1.sendIdx[","]=1;
  20368. //>>excludeEnd("ctx");
  20369. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  20370. $1=self._replaceRegexp_with_($2,"");
  20371. return $1;
  20372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20373. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)});
  20374. //>>excludeEnd("ctx");
  20375. },
  20376. //>>excludeStart("ide", pragmas.excludeIdeData);
  20377. args: ["separators"],
  20378. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  20379. referencedClasses: ["RegularExpression"],
  20380. //>>excludeEnd("ide");
  20381. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  20382. }),
  20383. globals.String);
  20384. smalltalk.addMethod(
  20385. smalltalk.method({
  20386. selector: "trimRight",
  20387. protocol: 'regular expressions',
  20388. fn: function (){
  20389. var self=this;
  20390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20391. return smalltalk.withContext(function($ctx1) {
  20392. //>>excludeEnd("ctx");
  20393. var $1;
  20394. $1=self._trimRight_("\x5cs");
  20395. return $1;
  20396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20397. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)});
  20398. //>>excludeEnd("ctx");
  20399. },
  20400. //>>excludeStart("ide", pragmas.excludeIdeData);
  20401. args: [],
  20402. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  20403. referencedClasses: [],
  20404. //>>excludeEnd("ide");
  20405. messageSends: ["trimRight:"]
  20406. }),
  20407. globals.String);
  20408. smalltalk.addMethod(
  20409. smalltalk.method({
  20410. selector: "trimRight:",
  20411. protocol: 'regular expressions',
  20412. fn: function (separators){
  20413. var self=this;
  20414. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  20415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20416. return smalltalk.withContext(function($ctx1) {
  20417. //>>excludeEnd("ctx");
  20418. var $3,$2,$1;
  20419. $3=_st("[".__comma(separators)).__comma("]+$");
  20420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20421. $ctx1.sendIdx[","]=1;
  20422. //>>excludeEnd("ctx");
  20423. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  20424. $1=self._replaceRegexp_with_($2,"");
  20425. return $1;
  20426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20427. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)});
  20428. //>>excludeEnd("ctx");
  20429. },
  20430. //>>excludeStart("ide", pragmas.excludeIdeData);
  20431. args: ["separators"],
  20432. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  20433. referencedClasses: ["RegularExpression"],
  20434. //>>excludeEnd("ide");
  20435. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  20436. }),
  20437. globals.String);
  20438. smalltalk.addMethod(
  20439. smalltalk.method({
  20440. selector: "unescaped",
  20441. protocol: 'converting',
  20442. fn: function (){
  20443. var self=this;
  20444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20445. return smalltalk.withContext(function($ctx1) {
  20446. //>>excludeEnd("ctx");
  20447. return unescape(self);
  20448. return self;
  20449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20450. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)});
  20451. //>>excludeEnd("ctx");
  20452. },
  20453. //>>excludeStart("ide", pragmas.excludeIdeData);
  20454. args: [],
  20455. source: "unescaped\x0a\x09<return unescape(self)>",
  20456. referencedClasses: [],
  20457. //>>excludeEnd("ide");
  20458. messageSends: []
  20459. }),
  20460. globals.String);
  20461. smalltalk.addMethod(
  20462. smalltalk.method({
  20463. selector: "uriComponentDecoded",
  20464. protocol: 'converting',
  20465. fn: function (){
  20466. var self=this;
  20467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20468. return smalltalk.withContext(function($ctx1) {
  20469. //>>excludeEnd("ctx");
  20470. return decodeURIComponent(self);
  20471. return self;
  20472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20473. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)});
  20474. //>>excludeEnd("ctx");
  20475. },
  20476. //>>excludeStart("ide", pragmas.excludeIdeData);
  20477. args: [],
  20478. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  20479. referencedClasses: [],
  20480. //>>excludeEnd("ide");
  20481. messageSends: []
  20482. }),
  20483. globals.String);
  20484. smalltalk.addMethod(
  20485. smalltalk.method({
  20486. selector: "uriComponentEncoded",
  20487. protocol: 'converting',
  20488. fn: function (){
  20489. var self=this;
  20490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20491. return smalltalk.withContext(function($ctx1) {
  20492. //>>excludeEnd("ctx");
  20493. return encodeURIComponent(self);
  20494. return self;
  20495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20496. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)});
  20497. //>>excludeEnd("ctx");
  20498. },
  20499. //>>excludeStart("ide", pragmas.excludeIdeData);
  20500. args: [],
  20501. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  20502. referencedClasses: [],
  20503. //>>excludeEnd("ide");
  20504. messageSends: []
  20505. }),
  20506. globals.String);
  20507. smalltalk.addMethod(
  20508. smalltalk.method({
  20509. selector: "uriDecoded",
  20510. protocol: 'converting',
  20511. fn: function (){
  20512. var self=this;
  20513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20514. return smalltalk.withContext(function($ctx1) {
  20515. //>>excludeEnd("ctx");
  20516. return decodeURI(self);
  20517. return self;
  20518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20519. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)});
  20520. //>>excludeEnd("ctx");
  20521. },
  20522. //>>excludeStart("ide", pragmas.excludeIdeData);
  20523. args: [],
  20524. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  20525. referencedClasses: [],
  20526. //>>excludeEnd("ide");
  20527. messageSends: []
  20528. }),
  20529. globals.String);
  20530. smalltalk.addMethod(
  20531. smalltalk.method({
  20532. selector: "uriEncoded",
  20533. protocol: 'converting',
  20534. fn: function (){
  20535. var self=this;
  20536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20537. return smalltalk.withContext(function($ctx1) {
  20538. //>>excludeEnd("ctx");
  20539. return encodeURI(self);
  20540. return self;
  20541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20542. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)});
  20543. //>>excludeEnd("ctx");
  20544. },
  20545. //>>excludeStart("ide", pragmas.excludeIdeData);
  20546. args: [],
  20547. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  20548. referencedClasses: [],
  20549. //>>excludeEnd("ide");
  20550. messageSends: []
  20551. }),
  20552. globals.String);
  20553. smalltalk.addMethod(
  20554. smalltalk.method({
  20555. selector: "value:",
  20556. protocol: 'evaluating',
  20557. fn: function (anObject){
  20558. var self=this;
  20559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20560. return smalltalk.withContext(function($ctx1) {
  20561. //>>excludeEnd("ctx");
  20562. var $1;
  20563. $1=_st(anObject)._perform_(self);
  20564. return $1;
  20565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20566. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.String)});
  20567. //>>excludeEnd("ctx");
  20568. },
  20569. //>>excludeStart("ide", pragmas.excludeIdeData);
  20570. args: ["anObject"],
  20571. source: "value: anObject \x0a\x09^ anObject perform: self",
  20572. referencedClasses: [],
  20573. //>>excludeEnd("ide");
  20574. messageSends: ["perform:"]
  20575. }),
  20576. globals.String);
  20577. smalltalk.addMethod(
  20578. smalltalk.method({
  20579. selector: "cr",
  20580. protocol: 'accessing',
  20581. fn: function (){
  20582. var self=this;
  20583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20584. return smalltalk.withContext(function($ctx1) {
  20585. //>>excludeEnd("ctx");
  20586. return '\r';
  20587. return self;
  20588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20589. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)});
  20590. //>>excludeEnd("ctx");
  20591. },
  20592. //>>excludeStart("ide", pragmas.excludeIdeData);
  20593. args: [],
  20594. source: "cr\x0a\x09<return '\x5cr'>",
  20595. referencedClasses: [],
  20596. //>>excludeEnd("ide");
  20597. messageSends: []
  20598. }),
  20599. globals.String.klass);
  20600. smalltalk.addMethod(
  20601. smalltalk.method({
  20602. selector: "crlf",
  20603. protocol: 'accessing',
  20604. fn: function (){
  20605. var self=this;
  20606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20607. return smalltalk.withContext(function($ctx1) {
  20608. //>>excludeEnd("ctx");
  20609. return '\r\n';
  20610. return self;
  20611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20612. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)});
  20613. //>>excludeEnd("ctx");
  20614. },
  20615. //>>excludeStart("ide", pragmas.excludeIdeData);
  20616. args: [],
  20617. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  20618. referencedClasses: [],
  20619. //>>excludeEnd("ide");
  20620. messageSends: []
  20621. }),
  20622. globals.String.klass);
  20623. smalltalk.addMethod(
  20624. smalltalk.method({
  20625. selector: "esc",
  20626. protocol: 'accessing',
  20627. fn: function (){
  20628. var self=this;
  20629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20630. return smalltalk.withContext(function($ctx1) {
  20631. //>>excludeEnd("ctx");
  20632. var $1;
  20633. $1=self._fromCharCode_((27));
  20634. return $1;
  20635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20636. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)});
  20637. //>>excludeEnd("ctx");
  20638. },
  20639. //>>excludeStart("ide", pragmas.excludeIdeData);
  20640. args: [],
  20641. source: "esc\x0a\x09^ self fromCharCode: 27",
  20642. referencedClasses: [],
  20643. //>>excludeEnd("ide");
  20644. messageSends: ["fromCharCode:"]
  20645. }),
  20646. globals.String.klass);
  20647. smalltalk.addMethod(
  20648. smalltalk.method({
  20649. selector: "fromCharCode:",
  20650. protocol: 'instance creation',
  20651. fn: function (anInteger){
  20652. var self=this;
  20653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20654. return smalltalk.withContext(function($ctx1) {
  20655. //>>excludeEnd("ctx");
  20656. return String.fromCharCode(anInteger);
  20657. return self;
  20658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20659. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)});
  20660. //>>excludeEnd("ctx");
  20661. },
  20662. //>>excludeStart("ide", pragmas.excludeIdeData);
  20663. args: ["anInteger"],
  20664. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  20665. referencedClasses: [],
  20666. //>>excludeEnd("ide");
  20667. messageSends: []
  20668. }),
  20669. globals.String.klass);
  20670. smalltalk.addMethod(
  20671. smalltalk.method({
  20672. selector: "fromString:",
  20673. protocol: 'instance creation',
  20674. fn: function (aString){
  20675. var self=this;
  20676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20677. return smalltalk.withContext(function($ctx1) {
  20678. //>>excludeEnd("ctx");
  20679. return String(aString);
  20680. return self;
  20681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20682. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)});
  20683. //>>excludeEnd("ctx");
  20684. },
  20685. //>>excludeStart("ide", pragmas.excludeIdeData);
  20686. args: ["aString"],
  20687. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  20688. referencedClasses: [],
  20689. //>>excludeEnd("ide");
  20690. messageSends: []
  20691. }),
  20692. globals.String.klass);
  20693. smalltalk.addMethod(
  20694. smalltalk.method({
  20695. selector: "lf",
  20696. protocol: 'accessing',
  20697. fn: function (){
  20698. var self=this;
  20699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20700. return smalltalk.withContext(function($ctx1) {
  20701. //>>excludeEnd("ctx");
  20702. return '\n';
  20703. return self;
  20704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20705. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)});
  20706. //>>excludeEnd("ctx");
  20707. },
  20708. //>>excludeStart("ide", pragmas.excludeIdeData);
  20709. args: [],
  20710. source: "lf\x0a\x09<return '\x5cn'>",
  20711. referencedClasses: [],
  20712. //>>excludeEnd("ide");
  20713. messageSends: []
  20714. }),
  20715. globals.String.klass);
  20716. smalltalk.addMethod(
  20717. smalltalk.method({
  20718. selector: "random",
  20719. protocol: 'random',
  20720. fn: function (){
  20721. var self=this;
  20722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20723. return smalltalk.withContext(function($ctx1) {
  20724. //>>excludeEnd("ctx");
  20725. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  20726. return self;
  20727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20728. }, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)});
  20729. //>>excludeEnd("ctx");
  20730. },
  20731. //>>excludeStart("ide", pragmas.excludeIdeData);
  20732. args: [],
  20733. 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);>",
  20734. referencedClasses: [],
  20735. //>>excludeEnd("ide");
  20736. messageSends: []
  20737. }),
  20738. globals.String.klass);
  20739. smalltalk.addMethod(
  20740. smalltalk.method({
  20741. selector: "randomNotIn:",
  20742. protocol: 'random',
  20743. fn: function (aString){
  20744. var self=this;
  20745. var result;
  20746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20747. return smalltalk.withContext(function($ctx1) {
  20748. //>>excludeEnd("ctx");
  20749. var $1;
  20750. _st((function(){
  20751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20752. return smalltalk.withContext(function($ctx2) {
  20753. //>>excludeEnd("ctx");
  20754. result=self._random();
  20755. result;
  20756. return _st(aString)._includesSubString_(result);
  20757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20759. //>>excludeEnd("ctx");
  20760. }))._whileTrue();
  20761. $1=result;
  20762. return $1;
  20763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20764. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)});
  20765. //>>excludeEnd("ctx");
  20766. },
  20767. //>>excludeStart("ide", pragmas.excludeIdeData);
  20768. args: ["aString"],
  20769. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  20770. referencedClasses: [],
  20771. //>>excludeEnd("ide");
  20772. messageSends: ["whileTrue", "random", "includesSubString:"]
  20773. }),
  20774. globals.String.klass);
  20775. smalltalk.addMethod(
  20776. smalltalk.method({
  20777. selector: "space",
  20778. protocol: 'accessing',
  20779. fn: function (){
  20780. var self=this;
  20781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20782. return smalltalk.withContext(function($ctx1) {
  20783. //>>excludeEnd("ctx");
  20784. return ' ';
  20785. return self;
  20786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20787. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)});
  20788. //>>excludeEnd("ctx");
  20789. },
  20790. //>>excludeStart("ide", pragmas.excludeIdeData);
  20791. args: [],
  20792. source: "space\x0a\x09<return ' '>",
  20793. referencedClasses: [],
  20794. //>>excludeEnd("ide");
  20795. messageSends: []
  20796. }),
  20797. globals.String.klass);
  20798. smalltalk.addMethod(
  20799. smalltalk.method({
  20800. selector: "streamClass",
  20801. protocol: 'accessing',
  20802. fn: function (){
  20803. var self=this;
  20804. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  20805. return $StringStream();
  20806. },
  20807. //>>excludeStart("ide", pragmas.excludeIdeData);
  20808. args: [],
  20809. source: "streamClass\x0a\x09\x09^ StringStream",
  20810. referencedClasses: ["StringStream"],
  20811. //>>excludeEnd("ide");
  20812. messageSends: []
  20813. }),
  20814. globals.String.klass);
  20815. smalltalk.addMethod(
  20816. smalltalk.method({
  20817. selector: "tab",
  20818. protocol: 'accessing',
  20819. fn: function (){
  20820. var self=this;
  20821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20822. return smalltalk.withContext(function($ctx1) {
  20823. //>>excludeEnd("ctx");
  20824. return '\t';
  20825. return self;
  20826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20827. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)});
  20828. //>>excludeEnd("ctx");
  20829. },
  20830. //>>excludeStart("ide", pragmas.excludeIdeData);
  20831. args: [],
  20832. source: "tab\x0a\x09<return '\x5ct'>",
  20833. referencedClasses: [],
  20834. //>>excludeEnd("ide");
  20835. messageSends: []
  20836. }),
  20837. globals.String.klass);
  20838. smalltalk.addMethod(
  20839. smalltalk.method({
  20840. selector: "value:",
  20841. protocol: 'instance creation',
  20842. fn: function (aUTFCharCode){
  20843. var self=this;
  20844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20845. return smalltalk.withContext(function($ctx1) {
  20846. //>>excludeEnd("ctx");
  20847. return String.fromCharCode(aUTFCharCode);;
  20848. return self;
  20849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20850. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)});
  20851. //>>excludeEnd("ctx");
  20852. },
  20853. //>>excludeStart("ide", pragmas.excludeIdeData);
  20854. args: ["aUTFCharCode"],
  20855. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  20856. referencedClasses: [],
  20857. //>>excludeEnd("ide");
  20858. messageSends: []
  20859. }),
  20860. globals.String.klass);
  20861. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  20862. //>>excludeStart("ide", pragmas.excludeIdeData);
  20863. 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`.";
  20864. //>>excludeEnd("ide");
  20865. smalltalk.addMethod(
  20866. smalltalk.method({
  20867. selector: "=",
  20868. protocol: 'comparing',
  20869. fn: function (aCollection){
  20870. var self=this;
  20871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20872. return smalltalk.withContext(function($ctx1) {
  20873. //>>excludeEnd("ctx");
  20874. var $2,$1,$4,$3,$5;
  20875. var $early={};
  20876. try {
  20877. $2=self._class();
  20878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20879. $ctx1.sendIdx["class"]=1;
  20880. //>>excludeEnd("ctx");
  20881. $1=_st($2).__eq(_st(aCollection)._class());
  20882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20883. $ctx1.sendIdx["="]=1;
  20884. //>>excludeEnd("ctx");
  20885. if(! smalltalk.assert($1)){
  20886. return false;
  20887. };
  20888. $4=self._size();
  20889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20890. $ctx1.sendIdx["size"]=1;
  20891. //>>excludeEnd("ctx");
  20892. $3=_st($4).__eq(_st(aCollection)._size());
  20893. if(! smalltalk.assert($3)){
  20894. return false;
  20895. };
  20896. self._do_((function(each){
  20897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20898. return smalltalk.withContext(function($ctx2) {
  20899. //>>excludeEnd("ctx");
  20900. $5=_st(aCollection)._includes_(each);
  20901. if(! smalltalk.assert($5)){
  20902. throw $early=[false];
  20903. };
  20904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20905. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  20906. //>>excludeEnd("ctx");
  20907. }));
  20908. return true;
  20909. }
  20910. catch(e) {if(e===$early)return e[0]; throw e}
  20911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20912. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)});
  20913. //>>excludeEnd("ctx");
  20914. },
  20915. //>>excludeStart("ide", pragmas.excludeIdeData);
  20916. args: ["aCollection"],
  20917. 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",
  20918. referencedClasses: [],
  20919. //>>excludeEnd("ide");
  20920. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  20921. }),
  20922. globals.Set);
  20923. smalltalk.addMethod(
  20924. smalltalk.method({
  20925. selector: "add:",
  20926. protocol: 'adding/removing',
  20927. fn: function (anObject){
  20928. var self=this;
  20929. var bucket;
  20930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20931. return smalltalk.withContext(function($ctx1) {
  20932. //>>excludeEnd("ctx");
  20933. var $2,$1,$receiver;
  20934. bucket=self._bucketsOfElement_(anObject);
  20935. $2=_st(bucket)._second();
  20936. if(($receiver = $2) == null || $receiver.isNil){
  20937. var object,slowBucket;
  20938. object=_st(bucket)._first();
  20939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20940. $ctx1.sendIdx["first"]=1;
  20941. //>>excludeEnd("ctx");
  20942. object;
  20943. slowBucket=_st(bucket)._third();
  20944. slowBucket;
  20945. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  20946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20947. return smalltalk.withContext(function($ctx2) {
  20948. //>>excludeEnd("ctx");
  20949. _st(slowBucket)._add_(object);
  20950. self["@size"]=_st(self["@size"]).__plus((1));
  20951. return self["@size"];
  20952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20954. //>>excludeEnd("ctx");
  20955. }));
  20956. $1=object;
  20957. } else {
  20958. var primitiveBucket;
  20959. primitiveBucket=$receiver;
  20960. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  20961. };
  20962. return $1;
  20963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20964. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)});
  20965. //>>excludeEnd("ctx");
  20966. },
  20967. //>>excludeStart("ide", pragmas.excludeIdeData);
  20968. args: ["anObject"],
  20969. 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 ]",
  20970. referencedClasses: [],
  20971. //>>excludeEnd("ide");
  20972. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  20973. }),
  20974. globals.Set);
  20975. smalltalk.addMethod(
  20976. smalltalk.method({
  20977. selector: "add:in:",
  20978. protocol: 'private',
  20979. fn: function (anObject,anotherObject){
  20980. var self=this;
  20981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20982. return smalltalk.withContext(function($ctx1) {
  20983. //>>excludeEnd("ctx");
  20984. if (anObject in anotherObject.store) { return false; }
  20985. self['@size']++;
  20986. return anotherObject.store[anObject] = true;
  20987. ;
  20988. return self;
  20989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  20990. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  20991. //>>excludeEnd("ctx");
  20992. },
  20993. //>>excludeStart("ide", pragmas.excludeIdeData);
  20994. args: ["anObject", "anotherObject"],
  20995. 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>",
  20996. referencedClasses: [],
  20997. //>>excludeEnd("ide");
  20998. messageSends: []
  20999. }),
  21000. globals.Set);
  21001. smalltalk.addMethod(
  21002. smalltalk.method({
  21003. selector: "bucketsOfElement:",
  21004. protocol: 'private',
  21005. fn: function (anObject){
  21006. var self=this;
  21007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21008. return smalltalk.withContext(function($ctx1) {
  21009. //>>excludeEnd("ctx");
  21010. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  21011. if ((type = typeof prim) === "object") {
  21012. if (anObject !== nil) {
  21013. bucket = null;
  21014. self['@slowBucketStores'].some(function (store) {
  21015. return bucket = store._bucketOfElement_(anObject);
  21016. });
  21017. return [ anObject, null, bucket || self['@defaultBucket'] ];
  21018. }
  21019. // include nil to well-known objects under 'boolean' fastBucket
  21020. prim = null;
  21021. type = 'boolean';
  21022. }
  21023. return [ prim, self['@fastBuckets'][type] ];
  21024. ;
  21025. return self;
  21026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21027. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)});
  21028. //>>excludeEnd("ctx");
  21029. },
  21030. //>>excludeStart("ide", pragmas.excludeIdeData);
  21031. args: ["anObject"],
  21032. 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>",
  21033. referencedClasses: [],
  21034. //>>excludeEnd("ide");
  21035. messageSends: []
  21036. }),
  21037. globals.Set);
  21038. smalltalk.addMethod(
  21039. smalltalk.method({
  21040. selector: "classNameOf:",
  21041. protocol: 'private',
  21042. fn: function (anObject){
  21043. var self=this;
  21044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21045. return smalltalk.withContext(function($ctx1) {
  21046. //>>excludeEnd("ctx");
  21047. return anObject.klass && anObject.klass.className;
  21048. return self;
  21049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21050. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)});
  21051. //>>excludeEnd("ctx");
  21052. },
  21053. //>>excludeStart("ide", pragmas.excludeIdeData);
  21054. args: ["anObject"],
  21055. 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>",
  21056. referencedClasses: [],
  21057. //>>excludeEnd("ide");
  21058. messageSends: []
  21059. }),
  21060. globals.Set);
  21061. smalltalk.addMethod(
  21062. smalltalk.method({
  21063. selector: "collect:",
  21064. protocol: 'enumerating',
  21065. fn: function (aBlock){
  21066. var self=this;
  21067. var collection;
  21068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21069. return smalltalk.withContext(function($ctx1) {
  21070. //>>excludeEnd("ctx");
  21071. var $1;
  21072. collection=_st(self._class())._new();
  21073. self._do_((function(each){
  21074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21075. return smalltalk.withContext(function($ctx2) {
  21076. //>>excludeEnd("ctx");
  21077. return _st(collection)._add_(_st(aBlock)._value_(each));
  21078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21079. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21080. //>>excludeEnd("ctx");
  21081. }));
  21082. $1=collection;
  21083. return $1;
  21084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21085. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)});
  21086. //>>excludeEnd("ctx");
  21087. },
  21088. //>>excludeStart("ide", pragmas.excludeIdeData);
  21089. args: ["aBlock"],
  21090. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  21091. referencedClasses: [],
  21092. //>>excludeEnd("ide");
  21093. messageSends: ["new", "class", "do:", "add:", "value:"]
  21094. }),
  21095. globals.Set);
  21096. smalltalk.addMethod(
  21097. smalltalk.method({
  21098. selector: "detect:ifNone:",
  21099. protocol: 'enumerating',
  21100. fn: function (aBlock,anotherBlock){
  21101. var self=this;
  21102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21103. return smalltalk.withContext(function($ctx1) {
  21104. //>>excludeEnd("ctx");
  21105. var $1,$2;
  21106. var $early={};
  21107. try {
  21108. self._do_((function(each){
  21109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21110. return smalltalk.withContext(function($ctx2) {
  21111. //>>excludeEnd("ctx");
  21112. $1=_st(aBlock)._value_(each);
  21113. if(smalltalk.assert($1)){
  21114. throw $early=[each];
  21115. };
  21116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21117. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21118. //>>excludeEnd("ctx");
  21119. }));
  21120. $2=_st(anotherBlock)._value();
  21121. return $2;
  21122. }
  21123. catch(e) {if(e===$early)return e[0]; throw e}
  21124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21125. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)});
  21126. //>>excludeEnd("ctx");
  21127. },
  21128. //>>excludeStart("ide", pragmas.excludeIdeData);
  21129. args: ["aBlock", "anotherBlock"],
  21130. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  21131. referencedClasses: [],
  21132. //>>excludeEnd("ide");
  21133. messageSends: ["do:", "ifTrue:", "value:", "value"]
  21134. }),
  21135. globals.Set);
  21136. smalltalk.addMethod(
  21137. smalltalk.method({
  21138. selector: "do:",
  21139. protocol: 'enumerating',
  21140. fn: function (aBlock){
  21141. var self=this;
  21142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21143. return smalltalk.withContext(function($ctx1) {
  21144. //>>excludeEnd("ctx");
  21145. var el, keys, i;
  21146. el = self['@fastBuckets'];
  21147. keys = Object.keys(el);
  21148. for (i = 0; i < keys.length; ++i) {
  21149. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  21150. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  21151. else { store._do_(aBlock); }
  21152. }
  21153. el = self['@slowBucketStores'];
  21154. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  21155. self['@defaultBucket']._do_(aBlock);
  21156. ;
  21157. return self;
  21158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21159. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)});
  21160. //>>excludeEnd("ctx");
  21161. },
  21162. //>>excludeStart("ide", pragmas.excludeIdeData);
  21163. args: ["aBlock"],
  21164. 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>",
  21165. referencedClasses: [],
  21166. //>>excludeEnd("ide");
  21167. messageSends: []
  21168. }),
  21169. globals.Set);
  21170. smalltalk.addMethod(
  21171. smalltalk.method({
  21172. selector: "includes:",
  21173. protocol: 'testing',
  21174. fn: function (anObject){
  21175. var self=this;
  21176. var bucket;
  21177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21178. return smalltalk.withContext(function($ctx1) {
  21179. //>>excludeEnd("ctx");
  21180. var $2,$3,$4,$1,$receiver;
  21181. bucket=self._bucketsOfElement_(anObject);
  21182. $2=_st(bucket)._second();
  21183. if(($receiver = $2) == null || $receiver.isNil){
  21184. $3=_st(bucket)._third();
  21185. $4=_st(bucket)._first();
  21186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21187. $ctx1.sendIdx["first"]=1;
  21188. //>>excludeEnd("ctx");
  21189. $1=_st($3)._includes_($4);
  21190. } else {
  21191. var primitiveBucket;
  21192. primitiveBucket=$receiver;
  21193. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  21194. };
  21195. return $1;
  21196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21197. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)});
  21198. //>>excludeEnd("ctx");
  21199. },
  21200. //>>excludeStart("ide", pragmas.excludeIdeData);
  21201. args: ["anObject"],
  21202. 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 ]",
  21203. referencedClasses: [],
  21204. //>>excludeEnd("ide");
  21205. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  21206. }),
  21207. globals.Set);
  21208. smalltalk.addMethod(
  21209. smalltalk.method({
  21210. selector: "includes:in:",
  21211. protocol: 'private',
  21212. fn: function (anObject,anotherObject){
  21213. var self=this;
  21214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21215. return smalltalk.withContext(function($ctx1) {
  21216. //>>excludeEnd("ctx");
  21217. return anObject in anotherObject.store;
  21218. return self;
  21219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21220. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  21221. //>>excludeEnd("ctx");
  21222. },
  21223. //>>excludeStart("ide", pragmas.excludeIdeData);
  21224. args: ["anObject", "anotherObject"],
  21225. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  21226. referencedClasses: [],
  21227. //>>excludeEnd("ide");
  21228. messageSends: []
  21229. }),
  21230. globals.Set);
  21231. smalltalk.addMethod(
  21232. smalltalk.method({
  21233. selector: "initialize",
  21234. protocol: 'initialization',
  21235. fn: function (){
  21236. var self=this;
  21237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21238. return smalltalk.withContext(function($ctx1) {
  21239. //>>excludeEnd("ctx");
  21240. var $1;
  21241. (
  21242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21243. $ctx1.supercall = true,
  21244. //>>excludeEnd("ctx");
  21245. globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []));
  21246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21247. $ctx1.supercall = false;
  21248. //>>excludeEnd("ctx");;
  21249. self["@defaultBucket"]=[];
  21250. self._initializeSlowBucketStores();
  21251. $1=self._removeAll();
  21252. return self;
  21253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21254. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)});
  21255. //>>excludeEnd("ctx");
  21256. },
  21257. //>>excludeStart("ide", pragmas.excludeIdeData);
  21258. args: [],
  21259. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  21260. referencedClasses: [],
  21261. //>>excludeEnd("ide");
  21262. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  21263. }),
  21264. globals.Set);
  21265. smalltalk.addMethod(
  21266. smalltalk.method({
  21267. selector: "initializeSlowBucketStores",
  21268. protocol: 'initialization',
  21269. fn: function (){
  21270. var self=this;
  21271. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  21272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21273. return smalltalk.withContext(function($ctx1) {
  21274. //>>excludeEnd("ctx");
  21275. var $1;
  21276. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  21277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21278. return smalltalk.withContext(function($ctx2) {
  21279. //>>excludeEnd("ctx");
  21280. return self._classNameOf_(x);
  21281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21282. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  21283. //>>excludeEnd("ctx");
  21284. }));
  21285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21286. $ctx1.sendIdx["hashBlock:"]=1;
  21287. //>>excludeEnd("ctx");
  21288. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  21289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21290. return smalltalk.withContext(function($ctx2) {
  21291. //>>excludeEnd("ctx");
  21292. return self._jsConstructorNameOf_(x);
  21293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21294. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  21295. //>>excludeEnd("ctx");
  21296. }))];
  21297. return self;
  21298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21299. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)});
  21300. //>>excludeEnd("ctx");
  21301. },
  21302. //>>excludeStart("ide", pragmas.excludeIdeData);
  21303. args: [],
  21304. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  21305. referencedClasses: ["ArrayBucketStore"],
  21306. //>>excludeEnd("ide");
  21307. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  21308. }),
  21309. globals.Set);
  21310. smalltalk.addMethod(
  21311. smalltalk.method({
  21312. selector: "jsConstructorNameOf:",
  21313. protocol: 'private',
  21314. fn: function (anObject){
  21315. var self=this;
  21316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21317. return smalltalk.withContext(function($ctx1) {
  21318. //>>excludeEnd("ctx");
  21319. return anObject.constructor && anObject.constructor.name;
  21320. return self;
  21321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21322. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)});
  21323. //>>excludeEnd("ctx");
  21324. },
  21325. //>>excludeStart("ide", pragmas.excludeIdeData);
  21326. args: ["anObject"],
  21327. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  21328. referencedClasses: [],
  21329. //>>excludeEnd("ide");
  21330. messageSends: []
  21331. }),
  21332. globals.Set);
  21333. smalltalk.addMethod(
  21334. smalltalk.method({
  21335. selector: "printOn:",
  21336. protocol: 'printing',
  21337. fn: function (aStream){
  21338. var self=this;
  21339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21340. return smalltalk.withContext(function($ctx1) {
  21341. //>>excludeEnd("ctx");
  21342. (
  21343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21344. $ctx1.supercall = true,
  21345. //>>excludeEnd("ctx");
  21346. globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  21347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21348. $ctx1.supercall = false;
  21349. //>>excludeEnd("ctx");;
  21350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21351. $ctx1.sendIdx["printOn:"]=1;
  21352. //>>excludeEnd("ctx");
  21353. _st(aStream)._nextPutAll_(" (");
  21354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21355. $ctx1.sendIdx["nextPutAll:"]=1;
  21356. //>>excludeEnd("ctx");
  21357. self._do_separatedBy_((function(each){
  21358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21359. return smalltalk.withContext(function($ctx2) {
  21360. //>>excludeEnd("ctx");
  21361. return _st(each)._printOn_(aStream);
  21362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21364. //>>excludeEnd("ctx");
  21365. }),(function(){
  21366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21367. return smalltalk.withContext(function($ctx2) {
  21368. //>>excludeEnd("ctx");
  21369. return _st(aStream)._nextPutAll_(" ");
  21370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21371. $ctx2.sendIdx["nextPutAll:"]=2;
  21372. //>>excludeEnd("ctx");
  21373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21375. //>>excludeEnd("ctx");
  21376. }));
  21377. _st(aStream)._nextPutAll_(")");
  21378. return self;
  21379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21380. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)});
  21381. //>>excludeEnd("ctx");
  21382. },
  21383. //>>excludeStart("ide", pragmas.excludeIdeData);
  21384. args: ["aStream"],
  21385. 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: ')'",
  21386. referencedClasses: [],
  21387. //>>excludeEnd("ide");
  21388. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  21389. }),
  21390. globals.Set);
  21391. smalltalk.addMethod(
  21392. smalltalk.method({
  21393. selector: "remove:ifAbsent:",
  21394. protocol: 'adding/removing',
  21395. fn: function (anObject,aBlock){
  21396. var self=this;
  21397. var bucket;
  21398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21399. return smalltalk.withContext(function($ctx1) {
  21400. //>>excludeEnd("ctx");
  21401. var $2,$3,$4,$5,$1,$receiver;
  21402. var $early={};
  21403. try {
  21404. bucket=self._bucketsOfElement_(anObject);
  21405. $2=_st(bucket)._second();
  21406. if(($receiver = $2) == null || $receiver.isNil){
  21407. $3=_st(bucket)._third();
  21408. $4=_st(bucket)._first();
  21409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21410. $ctx1.sendIdx["first"]=1;
  21411. //>>excludeEnd("ctx");
  21412. _st($3)._remove_ifAbsent_($4,(function(){
  21413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21414. return smalltalk.withContext(function($ctx2) {
  21415. //>>excludeEnd("ctx");
  21416. $5=_st(aBlock)._value();
  21417. throw $early=[$5];
  21418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21420. //>>excludeEnd("ctx");
  21421. }));
  21422. self["@size"]=_st(self["@size"]).__minus((1));
  21423. $1=self["@size"];
  21424. } else {
  21425. var primitiveBucket;
  21426. primitiveBucket=$receiver;
  21427. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  21428. };
  21429. return $1;
  21430. }
  21431. catch(e) {if(e===$early)return e[0]; throw e}
  21432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21433. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)});
  21434. //>>excludeEnd("ctx");
  21435. },
  21436. //>>excludeStart("ide", pragmas.excludeIdeData);
  21437. args: ["anObject", "aBlock"],
  21438. 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 ]",
  21439. referencedClasses: [],
  21440. //>>excludeEnd("ide");
  21441. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  21442. }),
  21443. globals.Set);
  21444. smalltalk.addMethod(
  21445. smalltalk.method({
  21446. selector: "remove:in:",
  21447. protocol: 'private',
  21448. fn: function (anObject,anotherObject){
  21449. var self=this;
  21450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21451. return smalltalk.withContext(function($ctx1) {
  21452. //>>excludeEnd("ctx");
  21453. if (delete anotherObject.store[anObject]) self['@size']--;
  21454. return self;
  21455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21456. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  21457. //>>excludeEnd("ctx");
  21458. },
  21459. //>>excludeStart("ide", pragmas.excludeIdeData);
  21460. args: ["anObject", "anotherObject"],
  21461. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  21462. referencedClasses: [],
  21463. //>>excludeEnd("ide");
  21464. messageSends: []
  21465. }),
  21466. globals.Set);
  21467. smalltalk.addMethod(
  21468. smalltalk.method({
  21469. selector: "removeAll",
  21470. protocol: 'adding/removing',
  21471. fn: function (){
  21472. var self=this;
  21473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21474. return smalltalk.withContext(function($ctx1) {
  21475. //>>excludeEnd("ctx");
  21476. self['@fastBuckets'] = {
  21477. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  21478. 'number': { store: Object.create(null), fn: Number },
  21479. 'string': { store: Object.create(null) }
  21480. };
  21481. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  21482. self['@defaultBucket']._removeAll();
  21483. self['@size'] = 0;
  21484. ;
  21485. return self;
  21486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21487. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)});
  21488. //>>excludeEnd("ctx");
  21489. },
  21490. //>>excludeStart("ide", pragmas.excludeIdeData);
  21491. args: [],
  21492. 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>",
  21493. referencedClasses: [],
  21494. //>>excludeEnd("ide");
  21495. messageSends: []
  21496. }),
  21497. globals.Set);
  21498. smalltalk.addMethod(
  21499. smalltalk.method({
  21500. selector: "select:",
  21501. protocol: 'enumerating',
  21502. fn: function (aBlock){
  21503. var self=this;
  21504. var collection;
  21505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21506. return smalltalk.withContext(function($ctx1) {
  21507. //>>excludeEnd("ctx");
  21508. var $1,$2;
  21509. collection=_st(self._class())._new();
  21510. self._do_((function(each){
  21511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21512. return smalltalk.withContext(function($ctx2) {
  21513. //>>excludeEnd("ctx");
  21514. $1=_st(aBlock)._value_(each);
  21515. if(smalltalk.assert($1)){
  21516. return _st(collection)._add_(each);
  21517. };
  21518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21520. //>>excludeEnd("ctx");
  21521. }));
  21522. $2=collection;
  21523. return $2;
  21524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21525. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)});
  21526. //>>excludeEnd("ctx");
  21527. },
  21528. //>>excludeStart("ide", pragmas.excludeIdeData);
  21529. args: ["aBlock"],
  21530. 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",
  21531. referencedClasses: [],
  21532. //>>excludeEnd("ide");
  21533. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  21534. }),
  21535. globals.Set);
  21536. smalltalk.addMethod(
  21537. smalltalk.method({
  21538. selector: "size",
  21539. protocol: 'accessing',
  21540. fn: function (){
  21541. var self=this;
  21542. var $1;
  21543. $1=self["@size"];
  21544. return $1;
  21545. },
  21546. //>>excludeStart("ide", pragmas.excludeIdeData);
  21547. args: [],
  21548. source: "size\x0a\x09^ size",
  21549. referencedClasses: [],
  21550. //>>excludeEnd("ide");
  21551. messageSends: []
  21552. }),
  21553. globals.Set);
  21554. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  21555. //>>excludeStart("ide", pragmas.excludeIdeData);
  21556. 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.";
  21557. //>>excludeEnd("ide");
  21558. smalltalk.addMethod(
  21559. smalltalk.method({
  21560. selector: "initialize",
  21561. protocol: 'initialization',
  21562. fn: function (){
  21563. var self=this;
  21564. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21566. return smalltalk.withContext(function($ctx1) {
  21567. //>>excludeEnd("ctx");
  21568. (
  21569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21570. $ctx1.supercall = true,
  21571. //>>excludeEnd("ctx");
  21572. globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []));
  21573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21574. $ctx1.supercall = false;
  21575. //>>excludeEnd("ctx");;
  21576. self["@read"]=_st($OrderedCollection())._new();
  21577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21578. $ctx1.sendIdx["new"]=1;
  21579. //>>excludeEnd("ctx");
  21580. self["@write"]=_st($OrderedCollection())._new();
  21581. self["@readIndex"]=(1);
  21582. return self;
  21583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21584. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)});
  21585. //>>excludeEnd("ctx");
  21586. },
  21587. //>>excludeStart("ide", pragmas.excludeIdeData);
  21588. args: [],
  21589. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  21590. referencedClasses: ["OrderedCollection"],
  21591. //>>excludeEnd("ide");
  21592. messageSends: ["initialize", "new"]
  21593. }),
  21594. globals.Queue);
  21595. smalltalk.addMethod(
  21596. smalltalk.method({
  21597. selector: "next",
  21598. protocol: 'accessing',
  21599. fn: function (){
  21600. var self=this;
  21601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21602. return smalltalk.withContext(function($ctx1) {
  21603. //>>excludeEnd("ctx");
  21604. var $1;
  21605. $1=self._nextIfAbsent_((function(){
  21606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21607. return smalltalk.withContext(function($ctx2) {
  21608. //>>excludeEnd("ctx");
  21609. return self._error_("Cannot read from empty Queue.");
  21610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21612. //>>excludeEnd("ctx");
  21613. }));
  21614. return $1;
  21615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21616. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)});
  21617. //>>excludeEnd("ctx");
  21618. },
  21619. //>>excludeStart("ide", pragmas.excludeIdeData);
  21620. args: [],
  21621. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  21622. referencedClasses: [],
  21623. //>>excludeEnd("ide");
  21624. messageSends: ["nextIfAbsent:", "error:"]
  21625. }),
  21626. globals.Queue);
  21627. smalltalk.addMethod(
  21628. smalltalk.method({
  21629. selector: "nextIfAbsent:",
  21630. protocol: 'accessing',
  21631. fn: function (aBlock){
  21632. var self=this;
  21633. var result;
  21634. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  21635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21636. return smalltalk.withContext(function($ctx1) {
  21637. //>>excludeEnd("ctx");
  21638. var $1,$2,$3,$4;
  21639. var $early={};
  21640. try {
  21641. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  21642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21643. return smalltalk.withContext(function($ctx2) {
  21644. //>>excludeEnd("ctx");
  21645. $1=_st(self["@write"])._isEmpty();
  21646. if(smalltalk.assert($1)){
  21647. $2=_st(self["@readIndex"]).__gt((1));
  21648. if(smalltalk.assert($2)){
  21649. self["@read"]=[];
  21650. self["@read"];
  21651. self["@readIndex"]=(1);
  21652. self["@readIndex"];
  21653. };
  21654. $3=_st(aBlock)._value();
  21655. throw $early=[$3];
  21656. };
  21657. self["@read"]=self["@write"];
  21658. self["@read"];
  21659. self["@readIndex"]=(1);
  21660. self["@readIndex"];
  21661. self["@write"]=_st($OrderedCollection())._new();
  21662. self["@write"];
  21663. return _st(self["@read"])._first();
  21664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21666. //>>excludeEnd("ctx");
  21667. }));
  21668. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  21669. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  21670. $4=result;
  21671. return $4;
  21672. }
  21673. catch(e) {if(e===$early)return e[0]; throw e}
  21674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21675. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)});
  21676. //>>excludeEnd("ctx");
  21677. },
  21678. //>>excludeStart("ide", pragmas.excludeIdeData);
  21679. args: ["aBlock"],
  21680. 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",
  21681. referencedClasses: ["OrderedCollection"],
  21682. //>>excludeEnd("ide");
  21683. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  21684. }),
  21685. globals.Queue);
  21686. smalltalk.addMethod(
  21687. smalltalk.method({
  21688. selector: "nextPut:",
  21689. protocol: 'accessing',
  21690. fn: function (anObject){
  21691. var self=this;
  21692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21693. return smalltalk.withContext(function($ctx1) {
  21694. //>>excludeEnd("ctx");
  21695. _st(self["@write"])._add_(anObject);
  21696. return self;
  21697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21698. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)});
  21699. //>>excludeEnd("ctx");
  21700. },
  21701. //>>excludeStart("ide", pragmas.excludeIdeData);
  21702. args: ["anObject"],
  21703. source: "nextPut: anObject\x0a\x09write add: anObject",
  21704. referencedClasses: [],
  21705. //>>excludeEnd("ide");
  21706. messageSends: ["add:"]
  21707. }),
  21708. globals.Queue);
  21709. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  21710. //>>excludeStart("ide", pragmas.excludeIdeData);
  21711. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  21712. //>>excludeEnd("ide");
  21713. smalltalk.addMethod(
  21714. smalltalk.method({
  21715. selector: "compile:",
  21716. protocol: 'evaluating',
  21717. fn: function (aString){
  21718. var self=this;
  21719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21720. return smalltalk.withContext(function($ctx1) {
  21721. //>>excludeEnd("ctx");
  21722. return self.compile(aString);
  21723. return self;
  21724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21725. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)});
  21726. //>>excludeEnd("ctx");
  21727. },
  21728. //>>excludeStart("ide", pragmas.excludeIdeData);
  21729. args: ["aString"],
  21730. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  21731. referencedClasses: [],
  21732. //>>excludeEnd("ide");
  21733. messageSends: []
  21734. }),
  21735. globals.RegularExpression);
  21736. smalltalk.addMethod(
  21737. smalltalk.method({
  21738. selector: "exec:",
  21739. protocol: 'evaluating',
  21740. fn: function (aString){
  21741. var self=this;
  21742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21743. return smalltalk.withContext(function($ctx1) {
  21744. //>>excludeEnd("ctx");
  21745. return self.exec(aString) || nil;
  21746. return self;
  21747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21748. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)});
  21749. //>>excludeEnd("ctx");
  21750. },
  21751. //>>excludeStart("ide", pragmas.excludeIdeData);
  21752. args: ["aString"],
  21753. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  21754. referencedClasses: [],
  21755. //>>excludeEnd("ide");
  21756. messageSends: []
  21757. }),
  21758. globals.RegularExpression);
  21759. smalltalk.addMethod(
  21760. smalltalk.method({
  21761. selector: "test:",
  21762. protocol: 'evaluating',
  21763. fn: function (aString){
  21764. var self=this;
  21765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21766. return smalltalk.withContext(function($ctx1) {
  21767. //>>excludeEnd("ctx");
  21768. return self.test(aString);
  21769. return self;
  21770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21771. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)});
  21772. //>>excludeEnd("ctx");
  21773. },
  21774. //>>excludeStart("ide", pragmas.excludeIdeData);
  21775. args: ["aString"],
  21776. source: "test: aString\x0a\x09<return self.test(aString)>",
  21777. referencedClasses: [],
  21778. //>>excludeEnd("ide");
  21779. messageSends: []
  21780. }),
  21781. globals.RegularExpression);
  21782. smalltalk.addMethod(
  21783. smalltalk.method({
  21784. selector: "fromString:",
  21785. protocol: 'instance creation',
  21786. fn: function (aString){
  21787. var self=this;
  21788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21789. return smalltalk.withContext(function($ctx1) {
  21790. //>>excludeEnd("ctx");
  21791. var $1;
  21792. $1=self._fromString_flag_(aString,"");
  21793. return $1;
  21794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21795. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)});
  21796. //>>excludeEnd("ctx");
  21797. },
  21798. //>>excludeStart("ide", pragmas.excludeIdeData);
  21799. args: ["aString"],
  21800. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  21801. referencedClasses: [],
  21802. //>>excludeEnd("ide");
  21803. messageSends: ["fromString:flag:"]
  21804. }),
  21805. globals.RegularExpression.klass);
  21806. smalltalk.addMethod(
  21807. smalltalk.method({
  21808. selector: "fromString:flag:",
  21809. protocol: 'instance creation',
  21810. fn: function (aString,anotherString){
  21811. var self=this;
  21812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21813. return smalltalk.withContext(function($ctx1) {
  21814. //>>excludeEnd("ctx");
  21815. return new RegExp(aString, anotherString);
  21816. return self;
  21817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21818. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)});
  21819. //>>excludeEnd("ctx");
  21820. },
  21821. //>>excludeStart("ide", pragmas.excludeIdeData);
  21822. args: ["aString", "anotherString"],
  21823. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  21824. referencedClasses: [],
  21825. //>>excludeEnd("ide");
  21826. messageSends: []
  21827. }),
  21828. globals.RegularExpression.klass);
  21829. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  21830. //>>excludeStart("ide", pragmas.excludeIdeData);
  21831. 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.";
  21832. //>>excludeEnd("ide");
  21833. smalltalk.addMethod(
  21834. smalltalk.method({
  21835. selector: "<<",
  21836. protocol: 'writing',
  21837. fn: function (anObject){
  21838. var self=this;
  21839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21840. return smalltalk.withContext(function($ctx1) {
  21841. //>>excludeEnd("ctx");
  21842. self._write_(anObject);
  21843. return self;
  21844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21845. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)});
  21846. //>>excludeEnd("ctx");
  21847. },
  21848. //>>excludeStart("ide", pragmas.excludeIdeData);
  21849. args: ["anObject"],
  21850. source: "<< anObject\x0a\x09self write: anObject",
  21851. referencedClasses: [],
  21852. //>>excludeEnd("ide");
  21853. messageSends: ["write:"]
  21854. }),
  21855. globals.Stream);
  21856. smalltalk.addMethod(
  21857. smalltalk.method({
  21858. selector: "atEnd",
  21859. protocol: 'testing',
  21860. fn: function (){
  21861. var self=this;
  21862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21863. return smalltalk.withContext(function($ctx1) {
  21864. //>>excludeEnd("ctx");
  21865. var $1;
  21866. $1=_st(self._position()).__eq(self._size());
  21867. return $1;
  21868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21869. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)});
  21870. //>>excludeEnd("ctx");
  21871. },
  21872. //>>excludeStart("ide", pragmas.excludeIdeData);
  21873. args: [],
  21874. source: "atEnd\x0a\x09^ self position = self size",
  21875. referencedClasses: [],
  21876. //>>excludeEnd("ide");
  21877. messageSends: ["=", "position", "size"]
  21878. }),
  21879. globals.Stream);
  21880. smalltalk.addMethod(
  21881. smalltalk.method({
  21882. selector: "atStart",
  21883. protocol: 'testing',
  21884. fn: function (){
  21885. var self=this;
  21886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21887. return smalltalk.withContext(function($ctx1) {
  21888. //>>excludeEnd("ctx");
  21889. var $1;
  21890. $1=_st(self._position()).__eq((0));
  21891. return $1;
  21892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21893. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)});
  21894. //>>excludeEnd("ctx");
  21895. },
  21896. //>>excludeStart("ide", pragmas.excludeIdeData);
  21897. args: [],
  21898. source: "atStart\x0a\x09^ self position = 0",
  21899. referencedClasses: [],
  21900. //>>excludeEnd("ide");
  21901. messageSends: ["=", "position"]
  21902. }),
  21903. globals.Stream);
  21904. smalltalk.addMethod(
  21905. smalltalk.method({
  21906. selector: "close",
  21907. protocol: 'actions',
  21908. fn: function (){
  21909. var self=this;
  21910. return self;
  21911. },
  21912. //>>excludeStart("ide", pragmas.excludeIdeData);
  21913. args: [],
  21914. source: "close",
  21915. referencedClasses: [],
  21916. //>>excludeEnd("ide");
  21917. messageSends: []
  21918. }),
  21919. globals.Stream);
  21920. smalltalk.addMethod(
  21921. smalltalk.method({
  21922. selector: "collection",
  21923. protocol: 'accessing',
  21924. fn: function (){
  21925. var self=this;
  21926. var $1;
  21927. $1=self["@collection"];
  21928. return $1;
  21929. },
  21930. //>>excludeStart("ide", pragmas.excludeIdeData);
  21931. args: [],
  21932. source: "collection\x0a\x09^ collection",
  21933. referencedClasses: [],
  21934. //>>excludeEnd("ide");
  21935. messageSends: []
  21936. }),
  21937. globals.Stream);
  21938. smalltalk.addMethod(
  21939. smalltalk.method({
  21940. selector: "contents",
  21941. protocol: 'accessing',
  21942. fn: function (){
  21943. var self=this;
  21944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21945. return smalltalk.withContext(function($ctx1) {
  21946. //>>excludeEnd("ctx");
  21947. var $1;
  21948. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  21949. return $1;
  21950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21951. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)});
  21952. //>>excludeEnd("ctx");
  21953. },
  21954. //>>excludeStart("ide", pragmas.excludeIdeData);
  21955. args: [],
  21956. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  21957. referencedClasses: [],
  21958. //>>excludeEnd("ide");
  21959. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  21960. }),
  21961. globals.Stream);
  21962. smalltalk.addMethod(
  21963. smalltalk.method({
  21964. selector: "do:",
  21965. protocol: 'enumerating',
  21966. fn: function (aBlock){
  21967. var self=this;
  21968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21969. return smalltalk.withContext(function($ctx1) {
  21970. //>>excludeEnd("ctx");
  21971. _st((function(){
  21972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21973. return smalltalk.withContext(function($ctx2) {
  21974. //>>excludeEnd("ctx");
  21975. return self._atEnd();
  21976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  21978. //>>excludeEnd("ctx");
  21979. }))._whileFalse_((function(){
  21980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21981. return smalltalk.withContext(function($ctx2) {
  21982. //>>excludeEnd("ctx");
  21983. return _st(aBlock)._value_(self._next());
  21984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  21986. //>>excludeEnd("ctx");
  21987. }));
  21988. return self;
  21989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21990. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)});
  21991. //>>excludeEnd("ctx");
  21992. },
  21993. //>>excludeStart("ide", pragmas.excludeIdeData);
  21994. args: ["aBlock"],
  21995. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  21996. referencedClasses: [],
  21997. //>>excludeEnd("ide");
  21998. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  21999. }),
  22000. globals.Stream);
  22001. smalltalk.addMethod(
  22002. smalltalk.method({
  22003. selector: "flush",
  22004. protocol: 'actions',
  22005. fn: function (){
  22006. var self=this;
  22007. return self;
  22008. },
  22009. //>>excludeStart("ide", pragmas.excludeIdeData);
  22010. args: [],
  22011. source: "flush",
  22012. referencedClasses: [],
  22013. //>>excludeEnd("ide");
  22014. messageSends: []
  22015. }),
  22016. globals.Stream);
  22017. smalltalk.addMethod(
  22018. smalltalk.method({
  22019. selector: "isEmpty",
  22020. protocol: 'testing',
  22021. fn: function (){
  22022. var self=this;
  22023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22024. return smalltalk.withContext(function($ctx1) {
  22025. //>>excludeEnd("ctx");
  22026. var $1;
  22027. $1=_st(self._size()).__eq((0));
  22028. return $1;
  22029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22030. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)});
  22031. //>>excludeEnd("ctx");
  22032. },
  22033. //>>excludeStart("ide", pragmas.excludeIdeData);
  22034. args: [],
  22035. source: "isEmpty\x0a\x09^ self size = 0",
  22036. referencedClasses: [],
  22037. //>>excludeEnd("ide");
  22038. messageSends: ["=", "size"]
  22039. }),
  22040. globals.Stream);
  22041. smalltalk.addMethod(
  22042. smalltalk.method({
  22043. selector: "next",
  22044. protocol: 'reading',
  22045. fn: function (){
  22046. var self=this;
  22047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22048. return smalltalk.withContext(function($ctx1) {
  22049. //>>excludeEnd("ctx");
  22050. var $2,$4,$3,$1;
  22051. $2=self._atEnd();
  22052. if(smalltalk.assert($2)){
  22053. $1=nil;
  22054. } else {
  22055. $4=self._position();
  22056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22057. $ctx1.sendIdx["position"]=1;
  22058. //>>excludeEnd("ctx");
  22059. $3=_st($4).__plus((1));
  22060. self._position_($3);
  22061. $1=_st(self["@collection"])._at_(self._position());
  22062. };
  22063. return $1;
  22064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22065. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)});
  22066. //>>excludeEnd("ctx");
  22067. },
  22068. //>>excludeStart("ide", pragmas.excludeIdeData);
  22069. args: [],
  22070. 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 ]",
  22071. referencedClasses: [],
  22072. //>>excludeEnd("ide");
  22073. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  22074. }),
  22075. globals.Stream);
  22076. smalltalk.addMethod(
  22077. smalltalk.method({
  22078. selector: "next:",
  22079. protocol: 'reading',
  22080. fn: function (anInteger){
  22081. var self=this;
  22082. var tempCollection;
  22083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22084. return smalltalk.withContext(function($ctx1) {
  22085. //>>excludeEnd("ctx");
  22086. var $1,$2;
  22087. tempCollection=_st(_st(self._collection())._class())._new();
  22088. _st(anInteger)._timesRepeat_((function(){
  22089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22090. return smalltalk.withContext(function($ctx2) {
  22091. //>>excludeEnd("ctx");
  22092. $1=self._atEnd();
  22093. if(! smalltalk.assert($1)){
  22094. return _st(tempCollection)._add_(self._next());
  22095. };
  22096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22098. //>>excludeEnd("ctx");
  22099. }));
  22100. $2=tempCollection;
  22101. return $2;
  22102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22103. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)});
  22104. //>>excludeEnd("ctx");
  22105. },
  22106. //>>excludeStart("ide", pragmas.excludeIdeData);
  22107. args: ["anInteger"],
  22108. 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",
  22109. referencedClasses: [],
  22110. //>>excludeEnd("ide");
  22111. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  22112. }),
  22113. globals.Stream);
  22114. smalltalk.addMethod(
  22115. smalltalk.method({
  22116. selector: "nextPut:",
  22117. protocol: 'writing',
  22118. fn: function (anObject){
  22119. var self=this;
  22120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22121. return smalltalk.withContext(function($ctx1) {
  22122. //>>excludeEnd("ctx");
  22123. var $2,$1,$3,$4;
  22124. $2=self._position();
  22125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22126. $ctx1.sendIdx["position"]=1;
  22127. //>>excludeEnd("ctx");
  22128. $1=_st($2).__plus((1));
  22129. self._position_($1);
  22130. $3=self._collection();
  22131. $4=self._position();
  22132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22133. $ctx1.sendIdx["position"]=2;
  22134. //>>excludeEnd("ctx");
  22135. _st($3)._at_put_($4,anObject);
  22136. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  22137. return self;
  22138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22139. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)});
  22140. //>>excludeEnd("ctx");
  22141. },
  22142. //>>excludeStart("ide", pragmas.excludeIdeData);
  22143. args: ["anObject"],
  22144. 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)",
  22145. referencedClasses: [],
  22146. //>>excludeEnd("ide");
  22147. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  22148. }),
  22149. globals.Stream);
  22150. smalltalk.addMethod(
  22151. smalltalk.method({
  22152. selector: "nextPutAll:",
  22153. protocol: 'writing',
  22154. fn: function (aCollection){
  22155. var self=this;
  22156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22157. return smalltalk.withContext(function($ctx1) {
  22158. //>>excludeEnd("ctx");
  22159. _st(aCollection)._do_((function(each){
  22160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22161. return smalltalk.withContext(function($ctx2) {
  22162. //>>excludeEnd("ctx");
  22163. return self._nextPut_(each);
  22164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22165. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22166. //>>excludeEnd("ctx");
  22167. }));
  22168. return self;
  22169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22170. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)});
  22171. //>>excludeEnd("ctx");
  22172. },
  22173. //>>excludeStart("ide", pragmas.excludeIdeData);
  22174. args: ["aCollection"],
  22175. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  22176. referencedClasses: [],
  22177. //>>excludeEnd("ide");
  22178. messageSends: ["do:", "nextPut:"]
  22179. }),
  22180. globals.Stream);
  22181. smalltalk.addMethod(
  22182. smalltalk.method({
  22183. selector: "nextPutString:",
  22184. protocol: 'writing',
  22185. fn: function (aString){
  22186. var self=this;
  22187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22188. return smalltalk.withContext(function($ctx1) {
  22189. //>>excludeEnd("ctx");
  22190. self._nextPut_(aString);
  22191. return self;
  22192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22193. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)});
  22194. //>>excludeEnd("ctx");
  22195. },
  22196. //>>excludeStart("ide", pragmas.excludeIdeData);
  22197. args: ["aString"],
  22198. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  22199. referencedClasses: [],
  22200. //>>excludeEnd("ide");
  22201. messageSends: ["nextPut:"]
  22202. }),
  22203. globals.Stream);
  22204. smalltalk.addMethod(
  22205. smalltalk.method({
  22206. selector: "peek",
  22207. protocol: 'reading',
  22208. fn: function (){
  22209. var self=this;
  22210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22211. return smalltalk.withContext(function($ctx1) {
  22212. //>>excludeEnd("ctx");
  22213. var $2,$1;
  22214. $2=self._atEnd();
  22215. if(! smalltalk.assert($2)){
  22216. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  22217. };
  22218. return $1;
  22219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22220. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)});
  22221. //>>excludeEnd("ctx");
  22222. },
  22223. //>>excludeStart("ide", pragmas.excludeIdeData);
  22224. args: [],
  22225. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  22226. referencedClasses: [],
  22227. //>>excludeEnd("ide");
  22228. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  22229. }),
  22230. globals.Stream);
  22231. smalltalk.addMethod(
  22232. smalltalk.method({
  22233. selector: "position",
  22234. protocol: 'accessing',
  22235. fn: function (){
  22236. var self=this;
  22237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22238. return smalltalk.withContext(function($ctx1) {
  22239. //>>excludeEnd("ctx");
  22240. var $2,$1,$receiver;
  22241. $2=self["@position"];
  22242. if(($receiver = $2) == null || $receiver.isNil){
  22243. self["@position"]=(0);
  22244. $1=self["@position"];
  22245. } else {
  22246. $1=$2;
  22247. };
  22248. return $1;
  22249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22250. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)});
  22251. //>>excludeEnd("ctx");
  22252. },
  22253. //>>excludeStart("ide", pragmas.excludeIdeData);
  22254. args: [],
  22255. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  22256. referencedClasses: [],
  22257. //>>excludeEnd("ide");
  22258. messageSends: ["ifNil:"]
  22259. }),
  22260. globals.Stream);
  22261. smalltalk.addMethod(
  22262. smalltalk.method({
  22263. selector: "position:",
  22264. protocol: 'accessing',
  22265. fn: function (anInteger){
  22266. var self=this;
  22267. self["@position"]=anInteger;
  22268. return self;
  22269. },
  22270. //>>excludeStart("ide", pragmas.excludeIdeData);
  22271. args: ["anInteger"],
  22272. source: "position: anInteger\x0a\x09position := anInteger",
  22273. referencedClasses: [],
  22274. //>>excludeEnd("ide");
  22275. messageSends: []
  22276. }),
  22277. globals.Stream);
  22278. smalltalk.addMethod(
  22279. smalltalk.method({
  22280. selector: "reset",
  22281. protocol: 'actions',
  22282. fn: function (){
  22283. var self=this;
  22284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22285. return smalltalk.withContext(function($ctx1) {
  22286. //>>excludeEnd("ctx");
  22287. self._position_((0));
  22288. return self;
  22289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22290. }, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)});
  22291. //>>excludeEnd("ctx");
  22292. },
  22293. //>>excludeStart("ide", pragmas.excludeIdeData);
  22294. args: [],
  22295. source: "reset\x0a\x09self position: 0",
  22296. referencedClasses: [],
  22297. //>>excludeEnd("ide");
  22298. messageSends: ["position:"]
  22299. }),
  22300. globals.Stream);
  22301. smalltalk.addMethod(
  22302. smalltalk.method({
  22303. selector: "resetContents",
  22304. protocol: 'actions',
  22305. fn: function (){
  22306. var self=this;
  22307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22308. return smalltalk.withContext(function($ctx1) {
  22309. //>>excludeEnd("ctx");
  22310. self._reset();
  22311. self._setStreamSize_((0));
  22312. return self;
  22313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22314. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)});
  22315. //>>excludeEnd("ctx");
  22316. },
  22317. //>>excludeStart("ide", pragmas.excludeIdeData);
  22318. args: [],
  22319. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  22320. referencedClasses: [],
  22321. //>>excludeEnd("ide");
  22322. messageSends: ["reset", "setStreamSize:"]
  22323. }),
  22324. globals.Stream);
  22325. smalltalk.addMethod(
  22326. smalltalk.method({
  22327. selector: "setCollection:",
  22328. protocol: 'accessing',
  22329. fn: function (aCollection){
  22330. var self=this;
  22331. self["@collection"]=aCollection;
  22332. return self;
  22333. },
  22334. //>>excludeStart("ide", pragmas.excludeIdeData);
  22335. args: ["aCollection"],
  22336. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  22337. referencedClasses: [],
  22338. //>>excludeEnd("ide");
  22339. messageSends: []
  22340. }),
  22341. globals.Stream);
  22342. smalltalk.addMethod(
  22343. smalltalk.method({
  22344. selector: "setStreamSize:",
  22345. protocol: 'accessing',
  22346. fn: function (anInteger){
  22347. var self=this;
  22348. self["@streamSize"]=anInteger;
  22349. return self;
  22350. },
  22351. //>>excludeStart("ide", pragmas.excludeIdeData);
  22352. args: ["anInteger"],
  22353. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  22354. referencedClasses: [],
  22355. //>>excludeEnd("ide");
  22356. messageSends: []
  22357. }),
  22358. globals.Stream);
  22359. smalltalk.addMethod(
  22360. smalltalk.method({
  22361. selector: "setToEnd",
  22362. protocol: 'positioning',
  22363. fn: function (){
  22364. var self=this;
  22365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22366. return smalltalk.withContext(function($ctx1) {
  22367. //>>excludeEnd("ctx");
  22368. self._position_(self._size());
  22369. return self;
  22370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22371. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)});
  22372. //>>excludeEnd("ctx");
  22373. },
  22374. //>>excludeStart("ide", pragmas.excludeIdeData);
  22375. args: [],
  22376. source: "setToEnd\x0a\x09self position: self size",
  22377. referencedClasses: [],
  22378. //>>excludeEnd("ide");
  22379. messageSends: ["position:", "size"]
  22380. }),
  22381. globals.Stream);
  22382. smalltalk.addMethod(
  22383. smalltalk.method({
  22384. selector: "size",
  22385. protocol: 'accessing',
  22386. fn: function (){
  22387. var self=this;
  22388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22389. return smalltalk.withContext(function($ctx1) {
  22390. //>>excludeEnd("ctx");
  22391. var $1;
  22392. $1=self._streamSize();
  22393. return $1;
  22394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22395. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)});
  22396. //>>excludeEnd("ctx");
  22397. },
  22398. //>>excludeStart("ide", pragmas.excludeIdeData);
  22399. args: [],
  22400. source: "size\x0a\x09^ self streamSize",
  22401. referencedClasses: [],
  22402. //>>excludeEnd("ide");
  22403. messageSends: ["streamSize"]
  22404. }),
  22405. globals.Stream);
  22406. smalltalk.addMethod(
  22407. smalltalk.method({
  22408. selector: "skip:",
  22409. protocol: 'positioning',
  22410. fn: function (anInteger){
  22411. var self=this;
  22412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22413. return smalltalk.withContext(function($ctx1) {
  22414. //>>excludeEnd("ctx");
  22415. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  22416. return self;
  22417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22418. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)});
  22419. //>>excludeEnd("ctx");
  22420. },
  22421. //>>excludeStart("ide", pragmas.excludeIdeData);
  22422. args: ["anInteger"],
  22423. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  22424. referencedClasses: [],
  22425. //>>excludeEnd("ide");
  22426. messageSends: ["position:", "min:max:", "+", "position", "size"]
  22427. }),
  22428. globals.Stream);
  22429. smalltalk.addMethod(
  22430. smalltalk.method({
  22431. selector: "streamSize",
  22432. protocol: 'accessing',
  22433. fn: function (){
  22434. var self=this;
  22435. var $1;
  22436. $1=self["@streamSize"];
  22437. return $1;
  22438. },
  22439. //>>excludeStart("ide", pragmas.excludeIdeData);
  22440. args: [],
  22441. source: "streamSize\x0a\x09^ streamSize",
  22442. referencedClasses: [],
  22443. //>>excludeEnd("ide");
  22444. messageSends: []
  22445. }),
  22446. globals.Stream);
  22447. smalltalk.addMethod(
  22448. smalltalk.method({
  22449. selector: "write:",
  22450. protocol: 'writing',
  22451. fn: function (anObject){
  22452. var self=this;
  22453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22454. return smalltalk.withContext(function($ctx1) {
  22455. //>>excludeEnd("ctx");
  22456. _st(anObject)._putOn_(self);
  22457. return self;
  22458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22459. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)});
  22460. //>>excludeEnd("ctx");
  22461. },
  22462. //>>excludeStart("ide", pragmas.excludeIdeData);
  22463. args: ["anObject"],
  22464. source: "write: anObject\x0a\x09anObject putOn: self",
  22465. referencedClasses: [],
  22466. //>>excludeEnd("ide");
  22467. messageSends: ["putOn:"]
  22468. }),
  22469. globals.Stream);
  22470. smalltalk.addMethod(
  22471. smalltalk.method({
  22472. selector: "on:",
  22473. protocol: 'instance creation',
  22474. fn: function (aCollection){
  22475. var self=this;
  22476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22477. return smalltalk.withContext(function($ctx1) {
  22478. //>>excludeEnd("ctx");
  22479. var $2,$3,$1;
  22480. $2=self._new();
  22481. _st($2)._setCollection_(aCollection);
  22482. _st($2)._setStreamSize_(_st(aCollection)._size());
  22483. $3=_st($2)._yourself();
  22484. $1=$3;
  22485. return $1;
  22486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22487. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)});
  22488. //>>excludeEnd("ctx");
  22489. },
  22490. //>>excludeStart("ide", pragmas.excludeIdeData);
  22491. args: ["aCollection"],
  22492. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  22493. referencedClasses: [],
  22494. //>>excludeEnd("ide");
  22495. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  22496. }),
  22497. globals.Stream.klass);
  22498. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  22499. //>>excludeStart("ide", pragmas.excludeIdeData);
  22500. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  22501. //>>excludeEnd("ide");
  22502. smalltalk.addMethod(
  22503. smalltalk.method({
  22504. selector: "cr",
  22505. protocol: 'writing',
  22506. fn: function (){
  22507. var self=this;
  22508. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22510. return smalltalk.withContext(function($ctx1) {
  22511. //>>excludeEnd("ctx");
  22512. var $1;
  22513. $1=self._nextPutAll_(_st($String())._cr());
  22514. return $1;
  22515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22516. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)});
  22517. //>>excludeEnd("ctx");
  22518. },
  22519. //>>excludeStart("ide", pragmas.excludeIdeData);
  22520. args: [],
  22521. source: "cr\x0a\x09^ self nextPutAll: String cr",
  22522. referencedClasses: ["String"],
  22523. //>>excludeEnd("ide");
  22524. messageSends: ["nextPutAll:", "cr"]
  22525. }),
  22526. globals.StringStream);
  22527. smalltalk.addMethod(
  22528. smalltalk.method({
  22529. selector: "crlf",
  22530. protocol: 'writing',
  22531. fn: function (){
  22532. var self=this;
  22533. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22535. return smalltalk.withContext(function($ctx1) {
  22536. //>>excludeEnd("ctx");
  22537. var $1;
  22538. $1=self._nextPutAll_(_st($String())._crlf());
  22539. return $1;
  22540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22541. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)});
  22542. //>>excludeEnd("ctx");
  22543. },
  22544. //>>excludeStart("ide", pragmas.excludeIdeData);
  22545. args: [],
  22546. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  22547. referencedClasses: ["String"],
  22548. //>>excludeEnd("ide");
  22549. messageSends: ["nextPutAll:", "crlf"]
  22550. }),
  22551. globals.StringStream);
  22552. smalltalk.addMethod(
  22553. smalltalk.method({
  22554. selector: "lf",
  22555. protocol: 'writing',
  22556. fn: function (){
  22557. var self=this;
  22558. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22560. return smalltalk.withContext(function($ctx1) {
  22561. //>>excludeEnd("ctx");
  22562. var $1;
  22563. $1=self._nextPutAll_(_st($String())._lf());
  22564. return $1;
  22565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22566. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)});
  22567. //>>excludeEnd("ctx");
  22568. },
  22569. //>>excludeStart("ide", pragmas.excludeIdeData);
  22570. args: [],
  22571. source: "lf\x0a\x09^ self nextPutAll: String lf",
  22572. referencedClasses: ["String"],
  22573. //>>excludeEnd("ide");
  22574. messageSends: ["nextPutAll:", "lf"]
  22575. }),
  22576. globals.StringStream);
  22577. smalltalk.addMethod(
  22578. smalltalk.method({
  22579. selector: "next:",
  22580. protocol: 'reading',
  22581. fn: function (anInteger){
  22582. var self=this;
  22583. var tempCollection;
  22584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22585. return smalltalk.withContext(function($ctx1) {
  22586. //>>excludeEnd("ctx");
  22587. var $1,$2;
  22588. tempCollection=_st(_st(self._collection())._class())._new();
  22589. _st(anInteger)._timesRepeat_((function(){
  22590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22591. return smalltalk.withContext(function($ctx2) {
  22592. //>>excludeEnd("ctx");
  22593. $1=self._atEnd();
  22594. if(! smalltalk.assert($1)){
  22595. tempCollection=_st(tempCollection).__comma(self._next());
  22596. return tempCollection;
  22597. };
  22598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22600. //>>excludeEnd("ctx");
  22601. }));
  22602. $2=tempCollection;
  22603. return $2;
  22604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22605. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)});
  22606. //>>excludeEnd("ctx");
  22607. },
  22608. //>>excludeStart("ide", pragmas.excludeIdeData);
  22609. args: ["anInteger"],
  22610. 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",
  22611. referencedClasses: [],
  22612. //>>excludeEnd("ide");
  22613. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  22614. }),
  22615. globals.StringStream);
  22616. smalltalk.addMethod(
  22617. smalltalk.method({
  22618. selector: "nextPut:",
  22619. protocol: 'writing',
  22620. fn: function (aString){
  22621. var self=this;
  22622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22623. return smalltalk.withContext(function($ctx1) {
  22624. //>>excludeEnd("ctx");
  22625. self._nextPutAll_(aString);
  22626. return self;
  22627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22628. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)});
  22629. //>>excludeEnd("ctx");
  22630. },
  22631. //>>excludeStart("ide", pragmas.excludeIdeData);
  22632. args: ["aString"],
  22633. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  22634. referencedClasses: [],
  22635. //>>excludeEnd("ide");
  22636. messageSends: ["nextPutAll:"]
  22637. }),
  22638. globals.StringStream);
  22639. smalltalk.addMethod(
  22640. smalltalk.method({
  22641. selector: "nextPutAll:",
  22642. protocol: 'writing',
  22643. fn: function (aString){
  22644. var self=this;
  22645. var pre,post;
  22646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22647. return smalltalk.withContext(function($ctx1) {
  22648. //>>excludeEnd("ctx");
  22649. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  22650. $1=self._atEnd();
  22651. if(smalltalk.assert($1)){
  22652. $3=self._collection();
  22653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22654. $ctx1.sendIdx["collection"]=1;
  22655. //>>excludeEnd("ctx");
  22656. $2=_st($3).__comma(aString);
  22657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22658. $ctx1.sendIdx[","]=1;
  22659. //>>excludeEnd("ctx");
  22660. self._setCollection_($2);
  22661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22662. $ctx1.sendIdx["setCollection:"]=1;
  22663. //>>excludeEnd("ctx");
  22664. } else {
  22665. $4=self._collection();
  22666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22667. $ctx1.sendIdx["collection"]=2;
  22668. //>>excludeEnd("ctx");
  22669. $5=self._position();
  22670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22671. $ctx1.sendIdx["position"]=1;
  22672. //>>excludeEnd("ctx");
  22673. pre=_st($4)._copyFrom_to_((1),$5);
  22674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22675. $ctx1.sendIdx["copyFrom:to:"]=1;
  22676. //>>excludeEnd("ctx");
  22677. pre;
  22678. $6=self._collection();
  22679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22680. $ctx1.sendIdx["collection"]=3;
  22681. //>>excludeEnd("ctx");
  22682. $9=self._position();
  22683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22684. $ctx1.sendIdx["position"]=2;
  22685. //>>excludeEnd("ctx");
  22686. $8=_st($9).__plus((1));
  22687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22688. $ctx1.sendIdx["+"]=2;
  22689. //>>excludeEnd("ctx");
  22690. $10=_st(aString)._size();
  22691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22692. $ctx1.sendIdx["size"]=1;
  22693. //>>excludeEnd("ctx");
  22694. $7=_st($8).__plus($10);
  22695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22696. $ctx1.sendIdx["+"]=1;
  22697. //>>excludeEnd("ctx");
  22698. $11=_st(self._collection())._size();
  22699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22700. $ctx1.sendIdx["size"]=2;
  22701. //>>excludeEnd("ctx");
  22702. post=_st($6)._copyFrom_to_($7,$11);
  22703. post;
  22704. $12=_st(_st(pre).__comma(aString)).__comma(post);
  22705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22706. $ctx1.sendIdx[","]=2;
  22707. //>>excludeEnd("ctx");
  22708. self._setCollection_($12);
  22709. };
  22710. $14=self._position();
  22711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22712. $ctx1.sendIdx["position"]=3;
  22713. //>>excludeEnd("ctx");
  22714. $13=_st($14).__plus(_st(aString)._size());
  22715. self._position_($13);
  22716. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  22717. return self;
  22718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22719. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)});
  22720. //>>excludeEnd("ctx");
  22721. },
  22722. //>>excludeStart("ide", pragmas.excludeIdeData);
  22723. args: ["aString"],
  22724. 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)",
  22725. referencedClasses: [],
  22726. //>>excludeEnd("ide");
  22727. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  22728. }),
  22729. globals.StringStream);
  22730. smalltalk.addMethod(
  22731. smalltalk.method({
  22732. selector: "nextPutString:",
  22733. protocol: 'writing',
  22734. fn: function (aString){
  22735. var self=this;
  22736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22737. return smalltalk.withContext(function($ctx1) {
  22738. //>>excludeEnd("ctx");
  22739. self._nextPutAll_(aString);
  22740. return self;
  22741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22742. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)});
  22743. //>>excludeEnd("ctx");
  22744. },
  22745. //>>excludeStart("ide", pragmas.excludeIdeData);
  22746. args: ["aString"],
  22747. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  22748. referencedClasses: [],
  22749. //>>excludeEnd("ide");
  22750. messageSends: ["nextPutAll:"]
  22751. }),
  22752. globals.StringStream);
  22753. smalltalk.addMethod(
  22754. smalltalk.method({
  22755. selector: "space",
  22756. protocol: 'writing',
  22757. fn: function (){
  22758. var self=this;
  22759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22760. return smalltalk.withContext(function($ctx1) {
  22761. //>>excludeEnd("ctx");
  22762. self._nextPut_(" ");
  22763. return self;
  22764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22765. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)});
  22766. //>>excludeEnd("ctx");
  22767. },
  22768. //>>excludeStart("ide", pragmas.excludeIdeData);
  22769. args: [],
  22770. source: "space\x0a\x09self nextPut: ' '",
  22771. referencedClasses: [],
  22772. //>>excludeEnd("ide");
  22773. messageSends: ["nextPut:"]
  22774. }),
  22775. globals.StringStream);
  22776. smalltalk.addMethod(
  22777. smalltalk.method({
  22778. selector: "tab",
  22779. protocol: 'writing',
  22780. fn: function (){
  22781. var self=this;
  22782. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  22783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22784. return smalltalk.withContext(function($ctx1) {
  22785. //>>excludeEnd("ctx");
  22786. var $1;
  22787. $1=self._nextPutAll_(_st($String())._tab());
  22788. return $1;
  22789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22790. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)});
  22791. //>>excludeEnd("ctx");
  22792. },
  22793. //>>excludeStart("ide", pragmas.excludeIdeData);
  22794. args: [],
  22795. source: "tab\x0a\x09^ self nextPutAll: String tab",
  22796. referencedClasses: ["String"],
  22797. //>>excludeEnd("ide");
  22798. messageSends: ["nextPutAll:", "tab"]
  22799. }),
  22800. globals.StringStream);
  22801. });
  22802. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function($boot){
  22803. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  22804. smalltalk.addPackage('Kernel-Infrastructure');
  22805. smalltalk.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  22806. smalltalk.addClass('ConsoleErrorHandler', globals.Object, [], 'Kernel-Infrastructure');
  22807. //>>excludeStart("ide", pragmas.excludeIdeData);
  22808. globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  22809. //>>excludeEnd("ide");
  22810. smalltalk.addMethod(
  22811. smalltalk.method({
  22812. selector: "handleError:",
  22813. protocol: 'error handling',
  22814. fn: function (anError){
  22815. var self=this;
  22816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22817. return smalltalk.withContext(function($ctx1) {
  22818. //>>excludeEnd("ctx");
  22819. var $1,$receiver;
  22820. $1=_st(anError)._context();
  22821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22822. $ctx1.sendIdx["context"]=1;
  22823. //>>excludeEnd("ctx");
  22824. if(($receiver = $1) == null || $receiver.isNil){
  22825. $1;
  22826. } else {
  22827. self._logErrorContext_(_st(anError)._context());
  22828. };
  22829. self._logError_(anError);
  22830. return self;
  22831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22832. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ConsoleErrorHandler)});
  22833. //>>excludeEnd("ctx");
  22834. },
  22835. //>>excludeStart("ide", pragmas.excludeIdeData);
  22836. args: ["anError"],
  22837. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  22838. referencedClasses: [],
  22839. //>>excludeEnd("ide");
  22840. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  22841. }),
  22842. globals.ConsoleErrorHandler);
  22843. smalltalk.addMethod(
  22844. smalltalk.method({
  22845. selector: "log:",
  22846. protocol: 'private',
  22847. fn: function (aString){
  22848. var self=this;
  22849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22850. return smalltalk.withContext(function($ctx1) {
  22851. //>>excludeEnd("ctx");
  22852. _st(console)._log_(aString);
  22853. return self;
  22854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22855. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},globals.ConsoleErrorHandler)});
  22856. //>>excludeEnd("ctx");
  22857. },
  22858. //>>excludeStart("ide", pragmas.excludeIdeData);
  22859. args: ["aString"],
  22860. source: "log: aString\x0a\x09console log: aString",
  22861. referencedClasses: [],
  22862. //>>excludeEnd("ide");
  22863. messageSends: ["log:"]
  22864. }),
  22865. globals.ConsoleErrorHandler);
  22866. smalltalk.addMethod(
  22867. smalltalk.method({
  22868. selector: "logContext:",
  22869. protocol: 'private',
  22870. fn: function (aContext){
  22871. var self=this;
  22872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22873. return smalltalk.withContext(function($ctx1) {
  22874. //>>excludeEnd("ctx");
  22875. var $1,$receiver;
  22876. $1=_st(aContext)._home();
  22877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22878. $ctx1.sendIdx["home"]=1;
  22879. //>>excludeEnd("ctx");
  22880. if(($receiver = $1) == null || $receiver.isNil){
  22881. $1;
  22882. } else {
  22883. self._logContext_(_st(aContext)._home());
  22884. };
  22885. self._log_(_st(aContext)._asString());
  22886. return self;
  22887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22888. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},globals.ConsoleErrorHandler)});
  22889. //>>excludeEnd("ctx");
  22890. },
  22891. //>>excludeStart("ide", pragmas.excludeIdeData);
  22892. args: ["aContext"],
  22893. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  22894. referencedClasses: [],
  22895. //>>excludeEnd("ide");
  22896. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  22897. }),
  22898. globals.ConsoleErrorHandler);
  22899. smalltalk.addMethod(
  22900. smalltalk.method({
  22901. selector: "logError:",
  22902. protocol: 'private',
  22903. fn: function (anError){
  22904. var self=this;
  22905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22906. return smalltalk.withContext(function($ctx1) {
  22907. //>>excludeEnd("ctx");
  22908. self._log_(_st(anError)._messageText());
  22909. return self;
  22910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22911. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},globals.ConsoleErrorHandler)});
  22912. //>>excludeEnd("ctx");
  22913. },
  22914. //>>excludeStart("ide", pragmas.excludeIdeData);
  22915. args: ["anError"],
  22916. source: "logError: anError\x0a\x09self log: anError messageText",
  22917. referencedClasses: [],
  22918. //>>excludeEnd("ide");
  22919. messageSends: ["log:", "messageText"]
  22920. }),
  22921. globals.ConsoleErrorHandler);
  22922. smalltalk.addMethod(
  22923. smalltalk.method({
  22924. selector: "logErrorContext:",
  22925. protocol: 'private',
  22926. fn: function (aContext){
  22927. var self=this;
  22928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22929. return smalltalk.withContext(function($ctx1) {
  22930. //>>excludeEnd("ctx");
  22931. var $1,$receiver;
  22932. if(($receiver = aContext) == null || $receiver.isNil){
  22933. aContext;
  22934. } else {
  22935. $1=_st(aContext)._home();
  22936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22937. $ctx1.sendIdx["home"]=1;
  22938. //>>excludeEnd("ctx");
  22939. if(($receiver = $1) == null || $receiver.isNil){
  22940. $1;
  22941. } else {
  22942. self._logContext_(_st(aContext)._home());
  22943. };
  22944. };
  22945. return self;
  22946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22947. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},globals.ConsoleErrorHandler)});
  22948. //>>excludeEnd("ctx");
  22949. },
  22950. //>>excludeStart("ide", pragmas.excludeIdeData);
  22951. args: ["aContext"],
  22952. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  22953. referencedClasses: [],
  22954. //>>excludeEnd("ide");
  22955. messageSends: ["ifNotNil:", "home", "logContext:"]
  22956. }),
  22957. globals.ConsoleErrorHandler);
  22958. globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  22959. smalltalk.addMethod(
  22960. smalltalk.method({
  22961. selector: "initialize",
  22962. protocol: 'initialization',
  22963. fn: function (){
  22964. var self=this;
  22965. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  22966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22967. return smalltalk.withContext(function($ctx1) {
  22968. //>>excludeEnd("ctx");
  22969. _st($ErrorHandler())._registerIfNone_(self._new());
  22970. return self;
  22971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22972. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleErrorHandler.klass)});
  22973. //>>excludeEnd("ctx");
  22974. },
  22975. //>>excludeStart("ide", pragmas.excludeIdeData);
  22976. args: [],
  22977. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  22978. referencedClasses: ["ErrorHandler"],
  22979. //>>excludeEnd("ide");
  22980. messageSends: ["registerIfNone:", "new"]
  22981. }),
  22982. globals.ConsoleErrorHandler.klass);
  22983. smalltalk.addClass('InterfacingObject', globals.Object, [], 'Kernel-Infrastructure');
  22984. //>>excludeStart("ide", pragmas.excludeIdeData);
  22985. 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 }.";
  22986. //>>excludeEnd("ide");
  22987. smalltalk.addMethod(
  22988. smalltalk.method({
  22989. selector: "ajax:",
  22990. protocol: 'actions',
  22991. fn: function (anObject){
  22992. var self=this;
  22993. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  22994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22995. return smalltalk.withContext(function($ctx1) {
  22996. //>>excludeEnd("ctx");
  22997. var $1;
  22998. $1=_st($PlatformInterface())._ajax_(anObject);
  22999. return $1;
  23000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23001. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.InterfacingObject)});
  23002. //>>excludeEnd("ctx");
  23003. },
  23004. //>>excludeStart("ide", pragmas.excludeIdeData);
  23005. args: ["anObject"],
  23006. source: "ajax: anObject\x0a\x09^ PlatformInterface ajax: anObject",
  23007. referencedClasses: ["PlatformInterface"],
  23008. //>>excludeEnd("ide");
  23009. messageSends: ["ajax:"]
  23010. }),
  23011. globals.InterfacingObject);
  23012. smalltalk.addMethod(
  23013. smalltalk.method({
  23014. selector: "alert:",
  23015. protocol: 'actions',
  23016. fn: function (aString){
  23017. var self=this;
  23018. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23020. return smalltalk.withContext(function($ctx1) {
  23021. //>>excludeEnd("ctx");
  23022. var $1;
  23023. $1=_st($PlatformInterface())._alert_(aString);
  23024. return $1;
  23025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23026. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.InterfacingObject)});
  23027. //>>excludeEnd("ctx");
  23028. },
  23029. //>>excludeStart("ide", pragmas.excludeIdeData);
  23030. args: ["aString"],
  23031. source: "alert: aString\x0a\x09^ PlatformInterface alert: aString",
  23032. referencedClasses: ["PlatformInterface"],
  23033. //>>excludeEnd("ide");
  23034. messageSends: ["alert:"]
  23035. }),
  23036. globals.InterfacingObject);
  23037. smalltalk.addMethod(
  23038. smalltalk.method({
  23039. selector: "confirm:",
  23040. protocol: 'actions',
  23041. fn: function (aString){
  23042. var self=this;
  23043. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23045. return smalltalk.withContext(function($ctx1) {
  23046. //>>excludeEnd("ctx");
  23047. var $1;
  23048. $1=_st($PlatformInterface())._confirm_(aString);
  23049. return $1;
  23050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23051. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.InterfacingObject)});
  23052. //>>excludeEnd("ctx");
  23053. },
  23054. //>>excludeStart("ide", pragmas.excludeIdeData);
  23055. args: ["aString"],
  23056. source: "confirm: aString\x0a\x09^ PlatformInterface confirm: aString",
  23057. referencedClasses: ["PlatformInterface"],
  23058. //>>excludeEnd("ide");
  23059. messageSends: ["confirm:"]
  23060. }),
  23061. globals.InterfacingObject);
  23062. smalltalk.addMethod(
  23063. smalltalk.method({
  23064. selector: "prompt:",
  23065. protocol: 'actions',
  23066. fn: function (aString){
  23067. var self=this;
  23068. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23070. return smalltalk.withContext(function($ctx1) {
  23071. //>>excludeEnd("ctx");
  23072. var $1;
  23073. $1=_st($PlatformInterface())._prompt_(aString);
  23074. return $1;
  23075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23076. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.InterfacingObject)});
  23077. //>>excludeEnd("ctx");
  23078. },
  23079. //>>excludeStart("ide", pragmas.excludeIdeData);
  23080. args: ["aString"],
  23081. source: "prompt: aString\x0a\x09^ PlatformInterface prompt: aString",
  23082. referencedClasses: ["PlatformInterface"],
  23083. //>>excludeEnd("ide");
  23084. messageSends: ["prompt:"]
  23085. }),
  23086. globals.InterfacingObject);
  23087. smalltalk.addMethod(
  23088. smalltalk.method({
  23089. selector: "prompt:default:",
  23090. protocol: 'actions',
  23091. fn: function (aString,defaultString){
  23092. var self=this;
  23093. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  23094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23095. return smalltalk.withContext(function($ctx1) {
  23096. //>>excludeEnd("ctx");
  23097. var $1;
  23098. $1=_st($PlatformInterface())._prompt_default_(aString,defaultString);
  23099. return $1;
  23100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23101. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.InterfacingObject)});
  23102. //>>excludeEnd("ctx");
  23103. },
  23104. //>>excludeStart("ide", pragmas.excludeIdeData);
  23105. args: ["aString", "defaultString"],
  23106. source: "prompt: aString default: defaultString\x0a\x09^ PlatformInterface prompt: aString default: defaultString",
  23107. referencedClasses: ["PlatformInterface"],
  23108. //>>excludeEnd("ide");
  23109. messageSends: ["prompt:default:"]
  23110. }),
  23111. globals.InterfacingObject);
  23112. smalltalk.addClass('Environment', globals.InterfacingObject, [], 'Kernel-Infrastructure');
  23113. //>>excludeStart("ide", pragmas.excludeIdeData);
  23114. 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.";
  23115. //>>excludeEnd("ide");
  23116. smalltalk.addMethod(
  23117. smalltalk.method({
  23118. selector: "addInstVarNamed:to:",
  23119. protocol: 'compiling',
  23120. fn: function (aString,aClass){
  23121. var self=this;
  23122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23123. return smalltalk.withContext(function($ctx1) {
  23124. //>>excludeEnd("ctx");
  23125. var $1,$2,$3,$4,$5;
  23126. $1=self._classBuilder();
  23127. $2=_st(aClass)._superclass();
  23128. $3=_st(aClass)._name();
  23129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23130. $ctx1.sendIdx["name"]=1;
  23131. //>>excludeEnd("ctx");
  23132. $4=_st(_st(aClass)._instanceVariableNames())._copy();
  23133. _st($4)._add_(aString);
  23134. $5=_st($4)._yourself();
  23135. _st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$5,_st(_st(aClass)._package())._name());
  23136. return self;
  23137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23138. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},globals.Environment)});
  23139. //>>excludeEnd("ctx");
  23140. },
  23141. //>>excludeStart("ide", pragmas.excludeIdeData);
  23142. args: ["aString", "aClass"],
  23143. 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",
  23144. referencedClasses: [],
  23145. //>>excludeEnd("ide");
  23146. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  23147. }),
  23148. globals.Environment);
  23149. smalltalk.addMethod(
  23150. smalltalk.method({
  23151. selector: "allSelectors",
  23152. protocol: 'accessing',
  23153. fn: function (){
  23154. var self=this;
  23155. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23157. return smalltalk.withContext(function($ctx1) {
  23158. //>>excludeEnd("ctx");
  23159. var $1;
  23160. $1=_st(_st($Smalltalk())._vm())._allSelectors();
  23161. return $1;
  23162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23163. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},globals.Environment)});
  23164. //>>excludeEnd("ctx");
  23165. },
  23166. //>>excludeStart("ide", pragmas.excludeIdeData);
  23167. args: [],
  23168. source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
  23169. referencedClasses: ["Smalltalk"],
  23170. //>>excludeEnd("ide");
  23171. messageSends: ["allSelectors", "vm"]
  23172. }),
  23173. globals.Environment);
  23174. smalltalk.addMethod(
  23175. smalltalk.method({
  23176. selector: "availableClassNames",
  23177. protocol: 'accessing',
  23178. fn: function (){
  23179. var self=this;
  23180. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23182. return smalltalk.withContext(function($ctx1) {
  23183. //>>excludeEnd("ctx");
  23184. var $1;
  23185. $1=_st(_st($Smalltalk())._classes())._collect_((function(each){
  23186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23187. return smalltalk.withContext(function($ctx2) {
  23188. //>>excludeEnd("ctx");
  23189. return _st(each)._name();
  23190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23192. //>>excludeEnd("ctx");
  23193. }));
  23194. return $1;
  23195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23196. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},globals.Environment)});
  23197. //>>excludeEnd("ctx");
  23198. },
  23199. //>>excludeStart("ide", pragmas.excludeIdeData);
  23200. args: [],
  23201. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  23202. referencedClasses: ["Smalltalk"],
  23203. //>>excludeEnd("ide");
  23204. messageSends: ["collect:", "classes", "name"]
  23205. }),
  23206. globals.Environment);
  23207. smalltalk.addMethod(
  23208. smalltalk.method({
  23209. selector: "availablePackageNames",
  23210. protocol: 'accessing',
  23211. fn: function (){
  23212. var self=this;
  23213. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23215. return smalltalk.withContext(function($ctx1) {
  23216. //>>excludeEnd("ctx");
  23217. var $1;
  23218. $1=_st(_st($Smalltalk())._packages())._collect_((function(each){
  23219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23220. return smalltalk.withContext(function($ctx2) {
  23221. //>>excludeEnd("ctx");
  23222. return _st(each)._name();
  23223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23224. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23225. //>>excludeEnd("ctx");
  23226. }));
  23227. return $1;
  23228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23229. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},globals.Environment)});
  23230. //>>excludeEnd("ctx");
  23231. },
  23232. //>>excludeStart("ide", pragmas.excludeIdeData);
  23233. args: [],
  23234. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  23235. referencedClasses: ["Smalltalk"],
  23236. //>>excludeEnd("ide");
  23237. messageSends: ["collect:", "packages", "name"]
  23238. }),
  23239. globals.Environment);
  23240. smalltalk.addMethod(
  23241. smalltalk.method({
  23242. selector: "availableProtocolsFor:",
  23243. protocol: 'accessing',
  23244. fn: function (aClass){
  23245. var self=this;
  23246. var protocols;
  23247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23248. return smalltalk.withContext(function($ctx1) {
  23249. //>>excludeEnd("ctx");
  23250. var $1,$2,$receiver;
  23251. protocols=_st(aClass)._protocols();
  23252. $1=_st(aClass)._superclass();
  23253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23254. $ctx1.sendIdx["superclass"]=1;
  23255. //>>excludeEnd("ctx");
  23256. if(($receiver = $1) == null || $receiver.isNil){
  23257. $1;
  23258. } else {
  23259. _st(protocols)._addAll_(self._availableProtocolsFor_(_st(aClass)._superclass()));
  23260. };
  23261. $2=_st(_st(_st(protocols)._asSet())._asArray())._sort();
  23262. return $2;
  23263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23264. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},globals.Environment)});
  23265. //>>excludeEnd("ctx");
  23266. },
  23267. //>>excludeStart("ide", pragmas.excludeIdeData);
  23268. args: ["aClass"],
  23269. 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",
  23270. referencedClasses: [],
  23271. //>>excludeEnd("ide");
  23272. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  23273. }),
  23274. globals.Environment);
  23275. smalltalk.addMethod(
  23276. smalltalk.method({
  23277. selector: "classBuilder",
  23278. protocol: 'accessing',
  23279. fn: function (){
  23280. var self=this;
  23281. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23283. return smalltalk.withContext(function($ctx1) {
  23284. //>>excludeEnd("ctx");
  23285. var $1;
  23286. $1=_st($ClassBuilder())._new();
  23287. return $1;
  23288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23289. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},globals.Environment)});
  23290. //>>excludeEnd("ctx");
  23291. },
  23292. //>>excludeStart("ide", pragmas.excludeIdeData);
  23293. args: [],
  23294. source: "classBuilder\x0a\x09^ ClassBuilder new",
  23295. referencedClasses: ["ClassBuilder"],
  23296. //>>excludeEnd("ide");
  23297. messageSends: ["new"]
  23298. }),
  23299. globals.Environment);
  23300. smalltalk.addMethod(
  23301. smalltalk.method({
  23302. selector: "classNamed:",
  23303. protocol: 'accessing',
  23304. fn: function (aString){
  23305. var self=this;
  23306. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23308. return smalltalk.withContext(function($ctx1) {
  23309. //>>excludeEnd("ctx");
  23310. var $2,$1,$receiver;
  23311. $2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
  23312. if(($receiver = $2) == null || $receiver.isNil){
  23313. $1=self._error_("Invalid class name");
  23314. } else {
  23315. $1=$2;
  23316. };
  23317. return $1;
  23318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23319. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},globals.Environment)});
  23320. //>>excludeEnd("ctx");
  23321. },
  23322. //>>excludeStart("ide", pragmas.excludeIdeData);
  23323. args: ["aString"],
  23324. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  23325. referencedClasses: ["Smalltalk"],
  23326. //>>excludeEnd("ide");
  23327. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  23328. }),
  23329. globals.Environment);
  23330. smalltalk.addMethod(
  23331. smalltalk.method({
  23332. selector: "classes",
  23333. protocol: 'accessing',
  23334. fn: function (){
  23335. var self=this;
  23336. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23338. return smalltalk.withContext(function($ctx1) {
  23339. //>>excludeEnd("ctx");
  23340. var $1;
  23341. $1=_st($Smalltalk())._classes();
  23342. return $1;
  23343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23344. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Environment)});
  23345. //>>excludeEnd("ctx");
  23346. },
  23347. //>>excludeStart("ide", pragmas.excludeIdeData);
  23348. args: [],
  23349. source: "classes\x0a\x09^ Smalltalk classes",
  23350. referencedClasses: ["Smalltalk"],
  23351. //>>excludeEnd("ide");
  23352. messageSends: ["classes"]
  23353. }),
  23354. globals.Environment);
  23355. smalltalk.addMethod(
  23356. smalltalk.method({
  23357. selector: "commitPackage:onSuccess:onError:",
  23358. protocol: 'actions',
  23359. fn: function (aPackage,aBlock,anotherBlock){
  23360. var self=this;
  23361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23362. return smalltalk.withContext(function($ctx1) {
  23363. //>>excludeEnd("ctx");
  23364. _st(_st(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  23365. return self;
  23366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23367. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.Environment)});
  23368. //>>excludeEnd("ctx");
  23369. },
  23370. //>>excludeStart("ide", pragmas.excludeIdeData);
  23371. args: ["aPackage", "aBlock", "anotherBlock"],
  23372. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  23373. referencedClasses: [],
  23374. //>>excludeEnd("ide");
  23375. messageSends: ["commitOnSuccess:onError:", "transport"]
  23376. }),
  23377. globals.Environment);
  23378. smalltalk.addMethod(
  23379. smalltalk.method({
  23380. selector: "compileClassComment:for:",
  23381. protocol: 'compiling',
  23382. fn: function (aString,aClass){
  23383. var self=this;
  23384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23385. return smalltalk.withContext(function($ctx1) {
  23386. //>>excludeEnd("ctx");
  23387. _st(aClass)._comment_(aString);
  23388. return self;
  23389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23390. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},globals.Environment)});
  23391. //>>excludeEnd("ctx");
  23392. },
  23393. //>>excludeStart("ide", pragmas.excludeIdeData);
  23394. args: ["aString", "aClass"],
  23395. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  23396. referencedClasses: [],
  23397. //>>excludeEnd("ide");
  23398. messageSends: ["comment:"]
  23399. }),
  23400. globals.Environment);
  23401. smalltalk.addMethod(
  23402. smalltalk.method({
  23403. selector: "compileClassDefinition:",
  23404. protocol: 'compiling',
  23405. fn: function (aString){
  23406. var self=this;
  23407. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  23408. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  23409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23410. return smalltalk.withContext(function($ctx1) {
  23411. //>>excludeEnd("ctx");
  23412. _st((function(){
  23413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23414. return smalltalk.withContext(function($ctx2) {
  23415. //>>excludeEnd("ctx");
  23416. return self._evaluate_for_(aString,_st($DoIt())._new());
  23417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23419. //>>excludeEnd("ctx");
  23420. }))._on_do_($Error(),(function(error){
  23421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23422. return smalltalk.withContext(function($ctx2) {
  23423. //>>excludeEnd("ctx");
  23424. return self._alert_(_st(error)._messageText());
  23425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23426. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  23427. //>>excludeEnd("ctx");
  23428. }));
  23429. return self;
  23430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23431. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},globals.Environment)});
  23432. //>>excludeEnd("ctx");
  23433. },
  23434. //>>excludeStart("ide", pragmas.excludeIdeData);
  23435. args: ["aString"],
  23436. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  23437. referencedClasses: ["DoIt", "Error"],
  23438. //>>excludeEnd("ide");
  23439. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  23440. }),
  23441. globals.Environment);
  23442. smalltalk.addMethod(
  23443. smalltalk.method({
  23444. selector: "compileMethod:for:protocol:",
  23445. protocol: 'compiling',
  23446. fn: function (sourceCode,class_,protocol){
  23447. var self=this;
  23448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23449. return smalltalk.withContext(function($ctx1) {
  23450. //>>excludeEnd("ctx");
  23451. var $1;
  23452. $1=_st(class_)._compile_protocol_(sourceCode,protocol);
  23453. return $1;
  23454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23455. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},globals.Environment)});
  23456. //>>excludeEnd("ctx");
  23457. },
  23458. //>>excludeStart("ide", pragmas.excludeIdeData);
  23459. args: ["sourceCode", "class", "protocol"],
  23460. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  23461. referencedClasses: [],
  23462. //>>excludeEnd("ide");
  23463. messageSends: ["compile:protocol:"]
  23464. }),
  23465. globals.Environment);
  23466. smalltalk.addMethod(
  23467. smalltalk.method({
  23468. selector: "copyClass:to:",
  23469. protocol: 'actions',
  23470. fn: function (aClass,aClassName){
  23471. var self=this;
  23472. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23473. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23475. return smalltalk.withContext(function($ctx1) {
  23476. //>>excludeEnd("ctx");
  23477. var $1,$2,$receiver;
  23478. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  23479. if(($receiver = $1) == null || $receiver.isNil){
  23480. $1;
  23481. } else {
  23482. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  23483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23484. $ctx1.sendIdx[","]=1;
  23485. //>>excludeEnd("ctx");
  23486. self._error_($2);
  23487. };
  23488. _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
  23489. return self;
  23490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23491. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)});
  23492. //>>excludeEnd("ctx");
  23493. },
  23494. //>>excludeStart("ide", pragmas.excludeIdeData);
  23495. args: ["aClass", "aClassName"],
  23496. 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",
  23497. referencedClasses: ["Smalltalk", "ClassBuilder"],
  23498. //>>excludeEnd("ide");
  23499. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  23500. }),
  23501. globals.Environment);
  23502. smalltalk.addMethod(
  23503. smalltalk.method({
  23504. selector: "doItReceiver",
  23505. protocol: 'accessing',
  23506. fn: function (){
  23507. var self=this;
  23508. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  23509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23510. return smalltalk.withContext(function($ctx1) {
  23511. //>>excludeEnd("ctx");
  23512. var $1;
  23513. $1=_st($DoIt())._new();
  23514. return $1;
  23515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23516. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},globals.Environment)});
  23517. //>>excludeEnd("ctx");
  23518. },
  23519. //>>excludeStart("ide", pragmas.excludeIdeData);
  23520. args: [],
  23521. source: "doItReceiver\x0a\x09^ DoIt new",
  23522. referencedClasses: ["DoIt"],
  23523. //>>excludeEnd("ide");
  23524. messageSends: ["new"]
  23525. }),
  23526. globals.Environment);
  23527. smalltalk.addMethod(
  23528. smalltalk.method({
  23529. selector: "evaluate:for:",
  23530. protocol: 'evaluating',
  23531. fn: function (aString,anObject){
  23532. var self=this;
  23533. function $Evaluator(){return globals.Evaluator||(typeof Evaluator=="undefined"?nil:Evaluator)}
  23534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23535. return smalltalk.withContext(function($ctx1) {
  23536. //>>excludeEnd("ctx");
  23537. var $1;
  23538. $1=_st($Evaluator())._evaluate_for_(aString,anObject);
  23539. return $1;
  23540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23541. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Environment)});
  23542. //>>excludeEnd("ctx");
  23543. },
  23544. //>>excludeStart("ide", pragmas.excludeIdeData);
  23545. args: ["aString", "anObject"],
  23546. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  23547. referencedClasses: ["Evaluator"],
  23548. //>>excludeEnd("ide");
  23549. messageSends: ["evaluate:for:"]
  23550. }),
  23551. globals.Environment);
  23552. smalltalk.addMethod(
  23553. smalltalk.method({
  23554. selector: "evaluate:on:do:",
  23555. protocol: 'error handling',
  23556. fn: function (aBlock,anErrorClass,exceptionBlock){
  23557. var self=this;
  23558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23559. return smalltalk.withContext(function($ctx1) {
  23560. //>>excludeEnd("ctx");
  23561. var $1;
  23562. _st(aBlock)._tryCatch_((function(exception){
  23563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23564. return smalltalk.withContext(function($ctx2) {
  23565. //>>excludeEnd("ctx");
  23566. $1=_st(exception)._isKindOf_(self._classNamed_(_st(anErrorClass)._name()));
  23567. if(smalltalk.assert($1)){
  23568. return _st(exceptionBlock)._value_(exception);
  23569. } else {
  23570. return _st(exception)._signal();
  23571. };
  23572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23573. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  23574. //>>excludeEnd("ctx");
  23575. }));
  23576. return self;
  23577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23578. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},globals.Environment)});
  23579. //>>excludeEnd("ctx");
  23580. },
  23581. //>>excludeStart("ide", pragmas.excludeIdeData);
  23582. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  23583. 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 ] ]",
  23584. referencedClasses: [],
  23585. //>>excludeEnd("ide");
  23586. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "signal"]
  23587. }),
  23588. globals.Environment);
  23589. smalltalk.addMethod(
  23590. smalltalk.method({
  23591. selector: "inspect:",
  23592. protocol: 'actions',
  23593. fn: function (anObject){
  23594. var self=this;
  23595. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  23596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23597. return smalltalk.withContext(function($ctx1) {
  23598. //>>excludeEnd("ctx");
  23599. _st($Inspector())._inspect_(anObject);
  23600. return self;
  23601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23602. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Environment)});
  23603. //>>excludeEnd("ctx");
  23604. },
  23605. //>>excludeStart("ide", pragmas.excludeIdeData);
  23606. args: ["anObject"],
  23607. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  23608. referencedClasses: ["Inspector"],
  23609. //>>excludeEnd("ide");
  23610. messageSends: ["inspect:"]
  23611. }),
  23612. globals.Environment);
  23613. smalltalk.addMethod(
  23614. smalltalk.method({
  23615. selector: "moveClass:toPackage:",
  23616. protocol: 'actions',
  23617. fn: function (aClass,aPackageName){
  23618. var self=this;
  23619. var package_;
  23620. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  23621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23622. return smalltalk.withContext(function($ctx1) {
  23623. //>>excludeEnd("ctx");
  23624. var $1,$2,$receiver;
  23625. package_=_st($Package())._named_(aPackageName);
  23626. $1=package_;
  23627. if(($receiver = $1) == null || $receiver.isNil){
  23628. self._error_("Invalid package name");
  23629. } else {
  23630. $1;
  23631. };
  23632. $2=_st(package_).__eq_eq(_st(aClass)._package());
  23633. if(smalltalk.assert($2)){
  23634. return self;
  23635. };
  23636. _st(aClass)._package_(package_);
  23637. return self;
  23638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23639. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},globals.Environment)});
  23640. //>>excludeEnd("ctx");
  23641. },
  23642. //>>excludeStart("ide", pragmas.excludeIdeData);
  23643. args: ["aClass", "aPackageName"],
  23644. 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",
  23645. referencedClasses: ["Package"],
  23646. //>>excludeEnd("ide");
  23647. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  23648. }),
  23649. globals.Environment);
  23650. smalltalk.addMethod(
  23651. smalltalk.method({
  23652. selector: "moveMethod:toClass:",
  23653. protocol: 'actions',
  23654. fn: function (aMethod,aClassName){
  23655. var self=this;
  23656. var destinationClass;
  23657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23658. return smalltalk.withContext(function($ctx1) {
  23659. //>>excludeEnd("ctx");
  23660. var $2,$3,$1,$5,$4;
  23661. destinationClass=self._classNamed_(aClassName);
  23662. $2=destinationClass;
  23663. $3=_st(aMethod)._methodClass();
  23664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23665. $ctx1.sendIdx["methodClass"]=1;
  23666. //>>excludeEnd("ctx");
  23667. $1=_st($2).__eq_eq($3);
  23668. if(smalltalk.assert($1)){
  23669. return self;
  23670. };
  23671. $5=_st(aMethod)._methodClass();
  23672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23673. $ctx1.sendIdx["methodClass"]=2;
  23674. //>>excludeEnd("ctx");
  23675. $4=_st($5)._isMetaclass();
  23676. if(smalltalk.assert($4)){
  23677. destinationClass=_st(destinationClass)._class();
  23678. destinationClass;
  23679. };
  23680. _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
  23681. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  23682. return self;
  23683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23684. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},globals.Environment)});
  23685. //>>excludeEnd("ctx");
  23686. },
  23687. //>>excludeStart("ide", pragmas.excludeIdeData);
  23688. args: ["aMethod", "aClassName"],
  23689. 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",
  23690. referencedClasses: [],
  23691. //>>excludeEnd("ide");
  23692. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  23693. }),
  23694. globals.Environment);
  23695. smalltalk.addMethod(
  23696. smalltalk.method({
  23697. selector: "moveMethod:toProtocol:",
  23698. protocol: 'actions',
  23699. fn: function (aMethod,aProtocol){
  23700. var self=this;
  23701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23702. return smalltalk.withContext(function($ctx1) {
  23703. //>>excludeEnd("ctx");
  23704. _st(aMethod)._protocol_(aProtocol);
  23705. return self;
  23706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23707. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},globals.Environment)});
  23708. //>>excludeEnd("ctx");
  23709. },
  23710. //>>excludeStart("ide", pragmas.excludeIdeData);
  23711. args: ["aMethod", "aProtocol"],
  23712. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  23713. referencedClasses: [],
  23714. //>>excludeEnd("ide");
  23715. messageSends: ["protocol:"]
  23716. }),
  23717. globals.Environment);
  23718. smalltalk.addMethod(
  23719. smalltalk.method({
  23720. selector: "packages",
  23721. protocol: 'accessing',
  23722. fn: function (){
  23723. var self=this;
  23724. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23726. return smalltalk.withContext(function($ctx1) {
  23727. //>>excludeEnd("ctx");
  23728. var $1;
  23729. $1=_st($Smalltalk())._packages();
  23730. return $1;
  23731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23732. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.Environment)});
  23733. //>>excludeEnd("ctx");
  23734. },
  23735. //>>excludeStart("ide", pragmas.excludeIdeData);
  23736. args: [],
  23737. source: "packages\x0a\x09^ Smalltalk packages",
  23738. referencedClasses: ["Smalltalk"],
  23739. //>>excludeEnd("ide");
  23740. messageSends: ["packages"]
  23741. }),
  23742. globals.Environment);
  23743. smalltalk.addMethod(
  23744. smalltalk.method({
  23745. selector: "registerErrorHandler:",
  23746. protocol: 'services',
  23747. fn: function (anErrorHandler){
  23748. var self=this;
  23749. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  23750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23751. return smalltalk.withContext(function($ctx1) {
  23752. //>>excludeEnd("ctx");
  23753. _st($ErrorHandler())._register_(anErrorHandler);
  23754. return self;
  23755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23756. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},globals.Environment)});
  23757. //>>excludeEnd("ctx");
  23758. },
  23759. //>>excludeStart("ide", pragmas.excludeIdeData);
  23760. args: ["anErrorHandler"],
  23761. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  23762. referencedClasses: ["ErrorHandler"],
  23763. //>>excludeEnd("ide");
  23764. messageSends: ["register:"]
  23765. }),
  23766. globals.Environment);
  23767. smalltalk.addMethod(
  23768. smalltalk.method({
  23769. selector: "registerFinder:",
  23770. protocol: 'services',
  23771. fn: function (aFinder){
  23772. var self=this;
  23773. function $Finder(){return globals.Finder||(typeof Finder=="undefined"?nil:Finder)}
  23774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23775. return smalltalk.withContext(function($ctx1) {
  23776. //>>excludeEnd("ctx");
  23777. _st($Finder())._register_(aFinder);
  23778. return self;
  23779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23780. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},globals.Environment)});
  23781. //>>excludeEnd("ctx");
  23782. },
  23783. //>>excludeStart("ide", pragmas.excludeIdeData);
  23784. args: ["aFinder"],
  23785. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  23786. referencedClasses: ["Finder"],
  23787. //>>excludeEnd("ide");
  23788. messageSends: ["register:"]
  23789. }),
  23790. globals.Environment);
  23791. smalltalk.addMethod(
  23792. smalltalk.method({
  23793. selector: "registerInspector:",
  23794. protocol: 'services',
  23795. fn: function (anInspector){
  23796. var self=this;
  23797. function $Inspector(){return globals.Inspector||(typeof Inspector=="undefined"?nil:Inspector)}
  23798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23799. return smalltalk.withContext(function($ctx1) {
  23800. //>>excludeEnd("ctx");
  23801. _st($Inspector())._register_(anInspector);
  23802. return self;
  23803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23804. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},globals.Environment)});
  23805. //>>excludeEnd("ctx");
  23806. },
  23807. //>>excludeStart("ide", pragmas.excludeIdeData);
  23808. args: ["anInspector"],
  23809. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  23810. referencedClasses: ["Inspector"],
  23811. //>>excludeEnd("ide");
  23812. messageSends: ["register:"]
  23813. }),
  23814. globals.Environment);
  23815. smalltalk.addMethod(
  23816. smalltalk.method({
  23817. selector: "registerProgressHandler:",
  23818. protocol: 'services',
  23819. fn: function (aProgressHandler){
  23820. var self=this;
  23821. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  23822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23823. return smalltalk.withContext(function($ctx1) {
  23824. //>>excludeEnd("ctx");
  23825. _st($ProgressHandler())._register_(aProgressHandler);
  23826. return self;
  23827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23828. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},globals.Environment)});
  23829. //>>excludeEnd("ctx");
  23830. },
  23831. //>>excludeStart("ide", pragmas.excludeIdeData);
  23832. args: ["aProgressHandler"],
  23833. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  23834. referencedClasses: ["ProgressHandler"],
  23835. //>>excludeEnd("ide");
  23836. messageSends: ["register:"]
  23837. }),
  23838. globals.Environment);
  23839. smalltalk.addMethod(
  23840. smalltalk.method({
  23841. selector: "registerTranscript:",
  23842. protocol: 'services',
  23843. fn: function (aTranscript){
  23844. var self=this;
  23845. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  23846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23847. return smalltalk.withContext(function($ctx1) {
  23848. //>>excludeEnd("ctx");
  23849. _st($Transcript())._register_(aTranscript);
  23850. return self;
  23851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23852. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},globals.Environment)});
  23853. //>>excludeEnd("ctx");
  23854. },
  23855. //>>excludeStart("ide", pragmas.excludeIdeData);
  23856. args: ["aTranscript"],
  23857. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  23858. referencedClasses: ["Transcript"],
  23859. //>>excludeEnd("ide");
  23860. messageSends: ["register:"]
  23861. }),
  23862. globals.Environment);
  23863. smalltalk.addMethod(
  23864. smalltalk.method({
  23865. selector: "removeClass:",
  23866. protocol: 'actions',
  23867. fn: function (aClass){
  23868. var self=this;
  23869. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23871. return smalltalk.withContext(function($ctx1) {
  23872. //>>excludeEnd("ctx");
  23873. _st($Smalltalk())._removeClass_(aClass);
  23874. return self;
  23875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23876. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.Environment)});
  23877. //>>excludeEnd("ctx");
  23878. },
  23879. //>>excludeStart("ide", pragmas.excludeIdeData);
  23880. args: ["aClass"],
  23881. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  23882. referencedClasses: ["Smalltalk"],
  23883. //>>excludeEnd("ide");
  23884. messageSends: ["removeClass:"]
  23885. }),
  23886. globals.Environment);
  23887. smalltalk.addMethod(
  23888. smalltalk.method({
  23889. selector: "removeMethod:",
  23890. protocol: 'actions',
  23891. fn: function (aMethod){
  23892. var self=this;
  23893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23894. return smalltalk.withContext(function($ctx1) {
  23895. //>>excludeEnd("ctx");
  23896. _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  23897. return self;
  23898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23899. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},globals.Environment)});
  23900. //>>excludeEnd("ctx");
  23901. },
  23902. //>>excludeStart("ide", pragmas.excludeIdeData);
  23903. args: ["aMethod"],
  23904. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  23905. referencedClasses: [],
  23906. //>>excludeEnd("ide");
  23907. messageSends: ["removeCompiledMethod:", "methodClass"]
  23908. }),
  23909. globals.Environment);
  23910. smalltalk.addMethod(
  23911. smalltalk.method({
  23912. selector: "removeProtocol:from:",
  23913. protocol: 'actions',
  23914. fn: function (aString,aClass){
  23915. var self=this;
  23916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23917. return smalltalk.withContext(function($ctx1) {
  23918. //>>excludeEnd("ctx");
  23919. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  23920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23921. return smalltalk.withContext(function($ctx2) {
  23922. //>>excludeEnd("ctx");
  23923. return _st(aClass)._removeCompiledMethod_(each);
  23924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23926. //>>excludeEnd("ctx");
  23927. }));
  23928. return self;
  23929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23930. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},globals.Environment)});
  23931. //>>excludeEnd("ctx");
  23932. },
  23933. //>>excludeStart("ide", pragmas.excludeIdeData);
  23934. args: ["aString", "aClass"],
  23935. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  23936. referencedClasses: [],
  23937. //>>excludeEnd("ide");
  23938. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  23939. }),
  23940. globals.Environment);
  23941. smalltalk.addMethod(
  23942. smalltalk.method({
  23943. selector: "renameClass:to:",
  23944. protocol: 'actions',
  23945. fn: function (aClass,aClassName){
  23946. var self=this;
  23947. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  23948. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  23949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23950. return smalltalk.withContext(function($ctx1) {
  23951. //>>excludeEnd("ctx");
  23952. var $1,$2,$receiver;
  23953. $1=_st(_st($Smalltalk())._globals())._at_(aClassName);
  23954. if(($receiver = $1) == null || $receiver.isNil){
  23955. $1;
  23956. } else {
  23957. $2=_st("A class named ".__comma(aClassName)).__comma(" already exists");
  23958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23959. $ctx1.sendIdx[","]=1;
  23960. //>>excludeEnd("ctx");
  23961. self._error_($2);
  23962. };
  23963. _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
  23964. return self;
  23965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23966. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},globals.Environment)});
  23967. //>>excludeEnd("ctx");
  23968. },
  23969. //>>excludeStart("ide", pragmas.excludeIdeData);
  23970. args: ["aClass", "aClassName"],
  23971. 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",
  23972. referencedClasses: ["Smalltalk", "ClassBuilder"],
  23973. //>>excludeEnd("ide");
  23974. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  23975. }),
  23976. globals.Environment);
  23977. smalltalk.addMethod(
  23978. smalltalk.method({
  23979. selector: "renameProtocol:to:in:",
  23980. protocol: 'actions',
  23981. fn: function (aString,anotherString,aClass){
  23982. var self=this;
  23983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23984. return smalltalk.withContext(function($ctx1) {
  23985. //>>excludeEnd("ctx");
  23986. _st(_st(aClass)._methodsInProtocol_(aString))._do_((function(each){
  23987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23988. return smalltalk.withContext(function($ctx2) {
  23989. //>>excludeEnd("ctx");
  23990. return _st(each)._protocol_(anotherString);
  23991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23992. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23993. //>>excludeEnd("ctx");
  23994. }));
  23995. return self;
  23996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23997. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},globals.Environment)});
  23998. //>>excludeEnd("ctx");
  23999. },
  24000. //>>excludeStart("ide", pragmas.excludeIdeData);
  24001. args: ["aString", "anotherString", "aClass"],
  24002. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  24003. referencedClasses: [],
  24004. //>>excludeEnd("ide");
  24005. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  24006. }),
  24007. globals.Environment);
  24008. smalltalk.addMethod(
  24009. smalltalk.method({
  24010. selector: "setClassCommentOf:to:",
  24011. protocol: 'actions',
  24012. fn: function (aClass,aString){
  24013. var self=this;
  24014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24015. return smalltalk.withContext(function($ctx1) {
  24016. //>>excludeEnd("ctx");
  24017. _st(aClass)._comment_(aString);
  24018. return self;
  24019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24020. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},globals.Environment)});
  24021. //>>excludeEnd("ctx");
  24022. },
  24023. //>>excludeStart("ide", pragmas.excludeIdeData);
  24024. args: ["aClass", "aString"],
  24025. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  24026. referencedClasses: [],
  24027. //>>excludeEnd("ide");
  24028. messageSends: ["comment:"]
  24029. }),
  24030. globals.Environment);
  24031. smalltalk.addMethod(
  24032. smalltalk.method({
  24033. selector: "systemAnnouncer",
  24034. protocol: 'accessing',
  24035. fn: function (){
  24036. var self=this;
  24037. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  24038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24039. return smalltalk.withContext(function($ctx1) {
  24040. //>>excludeEnd("ctx");
  24041. var $1;
  24042. $1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
  24043. return $1;
  24044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24045. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},globals.Environment)});
  24046. //>>excludeEnd("ctx");
  24047. },
  24048. //>>excludeStart("ide", pragmas.excludeIdeData);
  24049. args: [],
  24050. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  24051. referencedClasses: ["Smalltalk"],
  24052. //>>excludeEnd("ide");
  24053. messageSends: ["current", "at:", "globals"]
  24054. }),
  24055. globals.Environment);
  24056. smalltalk.addClass('JSObjectProxy', globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  24057. //>>excludeStart("ide", pragmas.excludeIdeData);
  24058. 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`.";
  24059. //>>excludeEnd("ide");
  24060. smalltalk.addMethod(
  24061. smalltalk.method({
  24062. selector: "=",
  24063. protocol: 'comparing',
  24064. fn: function (anObject){
  24065. var self=this;
  24066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24067. return smalltalk.withContext(function($ctx1) {
  24068. //>>excludeEnd("ctx");
  24069. var $2,$1,$3;
  24070. $2=_st(anObject)._class();
  24071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24072. $ctx1.sendIdx["class"]=1;
  24073. //>>excludeEnd("ctx");
  24074. $1=_st($2).__eq_eq(self._class());
  24075. if(! smalltalk.assert($1)){
  24076. return false;
  24077. };
  24078. $3=self._compareJSObjectWith_(_st(anObject)._jsObject());
  24079. return $3;
  24080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24081. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},globals.JSObjectProxy)});
  24082. //>>excludeEnd("ctx");
  24083. },
  24084. //>>excludeStart("ide", pragmas.excludeIdeData);
  24085. args: ["anObject"],
  24086. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ self compareJSObjectWith: anObject jsObject",
  24087. referencedClasses: [],
  24088. //>>excludeEnd("ide");
  24089. messageSends: ["ifFalse:", "==", "class", "compareJSObjectWith:", "jsObject"]
  24090. }),
  24091. globals.JSObjectProxy);
  24092. smalltalk.addMethod(
  24093. smalltalk.method({
  24094. selector: "addObjectVariablesTo:",
  24095. protocol: 'proxy',
  24096. fn: function (aDictionary){
  24097. var self=this;
  24098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24099. return smalltalk.withContext(function($ctx1) {
  24100. //>>excludeEnd("ctx");
  24101. for(var i in self['@jsObject']) {
  24102. aDictionary._at_put_(i, self['@jsObject'][i]);
  24103. }
  24104. ;
  24105. return self;
  24106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24107. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:",{aDictionary:aDictionary},globals.JSObjectProxy)});
  24108. //>>excludeEnd("ctx");
  24109. },
  24110. //>>excludeStart("ide", pragmas.excludeIdeData);
  24111. args: ["aDictionary"],
  24112. 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>",
  24113. referencedClasses: [],
  24114. //>>excludeEnd("ide");
  24115. messageSends: []
  24116. }),
  24117. globals.JSObjectProxy);
  24118. smalltalk.addMethod(
  24119. smalltalk.method({
  24120. selector: "asJSON",
  24121. protocol: 'enumerating',
  24122. fn: function (){
  24123. var self=this;
  24124. var $1;
  24125. $1=self["@jsObject"];
  24126. return $1;
  24127. },
  24128. //>>excludeStart("ide", pragmas.excludeIdeData);
  24129. args: [],
  24130. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  24131. referencedClasses: [],
  24132. //>>excludeEnd("ide");
  24133. messageSends: []
  24134. }),
  24135. globals.JSObjectProxy);
  24136. smalltalk.addMethod(
  24137. smalltalk.method({
  24138. selector: "at:",
  24139. protocol: 'accessing',
  24140. fn: function (aString){
  24141. var self=this;
  24142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24143. return smalltalk.withContext(function($ctx1) {
  24144. //>>excludeEnd("ctx");
  24145. return self['@jsObject'][aString];
  24146. return self;
  24147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24148. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.JSObjectProxy)});
  24149. //>>excludeEnd("ctx");
  24150. },
  24151. //>>excludeStart("ide", pragmas.excludeIdeData);
  24152. args: ["aString"],
  24153. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  24154. referencedClasses: [],
  24155. //>>excludeEnd("ide");
  24156. messageSends: []
  24157. }),
  24158. globals.JSObjectProxy);
  24159. smalltalk.addMethod(
  24160. smalltalk.method({
  24161. selector: "at:ifAbsent:",
  24162. protocol: 'accessing',
  24163. fn: function (aString,aBlock){
  24164. var self=this;
  24165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24166. return smalltalk.withContext(function($ctx1) {
  24167. //>>excludeEnd("ctx");
  24168. var obj = self['@jsObject'];
  24169. return aString in obj ? obj[aString] : aBlock._value();
  24170. ;
  24171. return self;
  24172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24173. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)});
  24174. //>>excludeEnd("ctx");
  24175. },
  24176. //>>excludeStart("ide", pragmas.excludeIdeData);
  24177. args: ["aString", "aBlock"],
  24178. 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>",
  24179. referencedClasses: [],
  24180. //>>excludeEnd("ide");
  24181. messageSends: []
  24182. }),
  24183. globals.JSObjectProxy);
  24184. smalltalk.addMethod(
  24185. smalltalk.method({
  24186. selector: "at:ifPresent:",
  24187. protocol: 'accessing',
  24188. fn: function (aString,aBlock){
  24189. var self=this;
  24190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24191. return smalltalk.withContext(function($ctx1) {
  24192. //>>excludeEnd("ctx");
  24193. var obj = self['@jsObject'];
  24194. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  24195. ;
  24196. return self;
  24197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24198. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},globals.JSObjectProxy)});
  24199. //>>excludeEnd("ctx");
  24200. },
  24201. //>>excludeStart("ide", pragmas.excludeIdeData);
  24202. args: ["aString", "aBlock"],
  24203. 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>",
  24204. referencedClasses: [],
  24205. //>>excludeEnd("ide");
  24206. messageSends: []
  24207. }),
  24208. globals.JSObjectProxy);
  24209. smalltalk.addMethod(
  24210. smalltalk.method({
  24211. selector: "at:ifPresent:ifAbsent:",
  24212. protocol: 'accessing',
  24213. fn: function (aString,aBlock,anotherBlock){
  24214. var self=this;
  24215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24216. return smalltalk.withContext(function($ctx1) {
  24217. //>>excludeEnd("ctx");
  24218. var obj = self['@jsObject'];
  24219. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  24220. ;
  24221. return self;
  24222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24223. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.JSObjectProxy)});
  24224. //>>excludeEnd("ctx");
  24225. },
  24226. //>>excludeStart("ide", pragmas.excludeIdeData);
  24227. args: ["aString", "aBlock", "anotherBlock"],
  24228. 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>",
  24229. referencedClasses: [],
  24230. //>>excludeEnd("ide");
  24231. messageSends: []
  24232. }),
  24233. globals.JSObjectProxy);
  24234. smalltalk.addMethod(
  24235. smalltalk.method({
  24236. selector: "at:put:",
  24237. protocol: 'accessing',
  24238. fn: function (aString,anObject){
  24239. var self=this;
  24240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24241. return smalltalk.withContext(function($ctx1) {
  24242. //>>excludeEnd("ctx");
  24243. return self['@jsObject'][aString] = anObject;
  24244. return self;
  24245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24246. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.JSObjectProxy)});
  24247. //>>excludeEnd("ctx");
  24248. },
  24249. //>>excludeStart("ide", pragmas.excludeIdeData);
  24250. args: ["aString", "anObject"],
  24251. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  24252. referencedClasses: [],
  24253. //>>excludeEnd("ide");
  24254. messageSends: []
  24255. }),
  24256. globals.JSObjectProxy);
  24257. smalltalk.addMethod(
  24258. smalltalk.method({
  24259. selector: "compareJSObjectWith:",
  24260. protocol: 'private',
  24261. fn: function (aJSObject){
  24262. var self=this;
  24263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24264. return smalltalk.withContext(function($ctx1) {
  24265. //>>excludeEnd("ctx");
  24266. return self["@jsObject"] === aJSObject;
  24267. return self;
  24268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24269. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectWith:",{aJSObject:aJSObject},globals.JSObjectProxy)});
  24270. //>>excludeEnd("ctx");
  24271. },
  24272. //>>excludeStart("ide", pragmas.excludeIdeData);
  24273. args: ["aJSObject"],
  24274. source: "compareJSObjectWith: aJSObject\x0a \x09<return self[\x22@jsObject\x22] === aJSObject>",
  24275. referencedClasses: [],
  24276. //>>excludeEnd("ide");
  24277. messageSends: []
  24278. }),
  24279. globals.JSObjectProxy);
  24280. smalltalk.addMethod(
  24281. smalltalk.method({
  24282. selector: "doesNotUnderstand:",
  24283. protocol: 'proxy',
  24284. fn: function (aMessage){
  24285. var self=this;
  24286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24287. return smalltalk.withContext(function($ctx1) {
  24288. //>>excludeEnd("ctx");
  24289. var $2,$1,$receiver;
  24290. $2=self._lookupProperty_(_st(_st(aMessage)._selector())._asJavaScriptPropertyName());
  24291. if(($receiver = $2) == null || $receiver.isNil){
  24292. $1=(
  24293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24294. $ctx1.supercall = true,
  24295. //>>excludeEnd("ctx");
  24296. globals.JSObjectProxy.superclass.fn.prototype._doesNotUnderstand_.apply(_st(self), [aMessage]));
  24297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24298. $ctx1.supercall = false;
  24299. //>>excludeEnd("ctx");;
  24300. } else {
  24301. var jsSelector;
  24302. jsSelector=$receiver;
  24303. $1=self._forwardMessage_withArguments_(jsSelector,_st(aMessage)._arguments());
  24304. };
  24305. return $1;
  24306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24307. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},globals.JSObjectProxy)});
  24308. //>>excludeEnd("ctx");
  24309. },
  24310. //>>excludeStart("ide", pragmas.excludeIdeData);
  24311. args: ["aMessage"],
  24312. source: "doesNotUnderstand: aMessage\x0a\x09^ (self lookupProperty: aMessage selector asJavaScriptPropertyName)\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 ]",
  24313. referencedClasses: [],
  24314. //>>excludeEnd("ide");
  24315. messageSends: ["ifNil:ifNotNil:", "lookupProperty:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:", "arguments"]
  24316. }),
  24317. globals.JSObjectProxy);
  24318. smalltalk.addMethod(
  24319. smalltalk.method({
  24320. selector: "forwardMessage:withArguments:",
  24321. protocol: 'proxy',
  24322. fn: function (aString,anArray){
  24323. var self=this;
  24324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24325. return smalltalk.withContext(function($ctx1) {
  24326. //>>excludeEnd("ctx");
  24327. return smalltalk.accessJavaScript(self._jsObject(), aString, anArray);
  24328. ;
  24329. return self;
  24330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24331. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:",{aString:aString,anArray:anArray},globals.JSObjectProxy)});
  24332. //>>excludeEnd("ctx");
  24333. },
  24334. //>>excludeStart("ide", pragmas.excludeIdeData);
  24335. args: ["aString", "anArray"],
  24336. source: "forwardMessage: aString withArguments: anArray\x0a\x09<\x0a\x09\x09return smalltalk.accessJavaScript(self._jsObject(), aString, anArray);\x0a\x09>",
  24337. referencedClasses: [],
  24338. //>>excludeEnd("ide");
  24339. messageSends: []
  24340. }),
  24341. globals.JSObjectProxy);
  24342. smalltalk.addMethod(
  24343. smalltalk.method({
  24344. selector: "inspectOn:",
  24345. protocol: 'proxy',
  24346. fn: function (anInspector){
  24347. var self=this;
  24348. var variables;
  24349. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  24350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24351. return smalltalk.withContext(function($ctx1) {
  24352. //>>excludeEnd("ctx");
  24353. variables=_st($Dictionary())._new();
  24354. _st(variables)._at_put_("#self",self._jsObject());
  24355. _st(anInspector)._setLabel_(self._printString());
  24356. self._addObjectVariablesTo_(variables);
  24357. _st(anInspector)._setVariables_(variables);
  24358. return self;
  24359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24360. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},globals.JSObjectProxy)});
  24361. //>>excludeEnd("ctx");
  24362. },
  24363. //>>excludeStart("ide", pragmas.excludeIdeData);
  24364. args: ["anInspector"],
  24365. 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",
  24366. referencedClasses: ["Dictionary"],
  24367. //>>excludeEnd("ide");
  24368. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:", "setVariables:"]
  24369. }),
  24370. globals.JSObjectProxy);
  24371. smalltalk.addMethod(
  24372. smalltalk.method({
  24373. selector: "jsObject",
  24374. protocol: 'accessing',
  24375. fn: function (){
  24376. var self=this;
  24377. var $1;
  24378. $1=self["@jsObject"];
  24379. return $1;
  24380. },
  24381. //>>excludeStart("ide", pragmas.excludeIdeData);
  24382. args: [],
  24383. source: "jsObject\x0a\x09^ jsObject",
  24384. referencedClasses: [],
  24385. //>>excludeEnd("ide");
  24386. messageSends: []
  24387. }),
  24388. globals.JSObjectProxy);
  24389. smalltalk.addMethod(
  24390. smalltalk.method({
  24391. selector: "jsObject:",
  24392. protocol: 'accessing',
  24393. fn: function (aJSObject){
  24394. var self=this;
  24395. self["@jsObject"]=aJSObject;
  24396. return self;
  24397. },
  24398. //>>excludeStart("ide", pragmas.excludeIdeData);
  24399. args: ["aJSObject"],
  24400. source: "jsObject: aJSObject\x0a\x09jsObject := aJSObject",
  24401. referencedClasses: [],
  24402. //>>excludeEnd("ide");
  24403. messageSends: []
  24404. }),
  24405. globals.JSObjectProxy);
  24406. smalltalk.addMethod(
  24407. smalltalk.method({
  24408. selector: "keysAndValuesDo:",
  24409. protocol: 'enumerating',
  24410. fn: function (aBlock){
  24411. var self=this;
  24412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24413. return smalltalk.withContext(function($ctx1) {
  24414. //>>excludeEnd("ctx");
  24415. var o = self['@jsObject'];
  24416. for(var i in o) {
  24417. aBlock._value_value_(i, o[i]);
  24418. }
  24419. ;
  24420. return self;
  24421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24422. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.JSObjectProxy)});
  24423. //>>excludeEnd("ctx");
  24424. },
  24425. //>>excludeStart("ide", pragmas.excludeIdeData);
  24426. args: ["aBlock"],
  24427. 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>",
  24428. referencedClasses: [],
  24429. //>>excludeEnd("ide");
  24430. messageSends: []
  24431. }),
  24432. globals.JSObjectProxy);
  24433. smalltalk.addMethod(
  24434. smalltalk.method({
  24435. selector: "lookupProperty:",
  24436. protocol: 'accessing',
  24437. fn: function (aString){
  24438. var self=this;
  24439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24440. return smalltalk.withContext(function($ctx1) {
  24441. //>>excludeEnd("ctx");
  24442. return aString in self._jsObject() ? aString : nil;
  24443. return self;
  24444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24445. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:",{aString:aString},globals.JSObjectProxy)});
  24446. //>>excludeEnd("ctx");
  24447. },
  24448. //>>excludeStart("ide", pragmas.excludeIdeData);
  24449. args: ["aString"],
  24450. 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>",
  24451. referencedClasses: [],
  24452. //>>excludeEnd("ide");
  24453. messageSends: []
  24454. }),
  24455. globals.JSObjectProxy);
  24456. smalltalk.addMethod(
  24457. smalltalk.method({
  24458. selector: "printOn:",
  24459. protocol: 'printing',
  24460. fn: function (aStream){
  24461. var self=this;
  24462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24463. return smalltalk.withContext(function($ctx1) {
  24464. //>>excludeEnd("ctx");
  24465. _st(aStream)._nextPutAll_(self._printString());
  24466. return self;
  24467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24468. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.JSObjectProxy)});
  24469. //>>excludeEnd("ctx");
  24470. },
  24471. //>>excludeStart("ide", pragmas.excludeIdeData);
  24472. args: ["aStream"],
  24473. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  24474. referencedClasses: [],
  24475. //>>excludeEnd("ide");
  24476. messageSends: ["nextPutAll:", "printString"]
  24477. }),
  24478. globals.JSObjectProxy);
  24479. smalltalk.addMethod(
  24480. smalltalk.method({
  24481. selector: "printString",
  24482. protocol: 'printing',
  24483. fn: function (){
  24484. var self=this;
  24485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24486. return smalltalk.withContext(function($ctx1) {
  24487. //>>excludeEnd("ctx");
  24488. var js = self['@jsObject'];
  24489. return js.toString
  24490. ? js.toString()
  24491. : Object.prototype.toString.call(js)
  24492. ;
  24493. return self;
  24494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24495. }, function($ctx1) {$ctx1.fill(self,"printString",{},globals.JSObjectProxy)});
  24496. //>>excludeEnd("ctx");
  24497. },
  24498. //>>excludeStart("ide", pragmas.excludeIdeData);
  24499. args: [],
  24500. 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>",
  24501. referencedClasses: [],
  24502. //>>excludeEnd("ide");
  24503. messageSends: []
  24504. }),
  24505. globals.JSObjectProxy);
  24506. smalltalk.addMethod(
  24507. smalltalk.method({
  24508. selector: "on:",
  24509. protocol: 'instance creation',
  24510. fn: function (aJSObject){
  24511. var self=this;
  24512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24513. return smalltalk.withContext(function($ctx1) {
  24514. //>>excludeEnd("ctx");
  24515. var $2,$3,$1;
  24516. $2=self._new();
  24517. _st($2)._jsObject_(aJSObject);
  24518. $3=_st($2)._yourself();
  24519. $1=$3;
  24520. return $1;
  24521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24522. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject},globals.JSObjectProxy.klass)});
  24523. //>>excludeEnd("ctx");
  24524. },
  24525. //>>excludeStart("ide", pragmas.excludeIdeData);
  24526. args: ["aJSObject"],
  24527. source: "on: aJSObject\x0a\x09^ self new\x0a\x09\x09jsObject: aJSObject;\x0a\x09\x09yourself",
  24528. referencedClasses: [],
  24529. //>>excludeEnd("ide");
  24530. messageSends: ["jsObject:", "new", "yourself"]
  24531. }),
  24532. globals.JSObjectProxy.klass);
  24533. smalltalk.addClass('NullProgressHandler', globals.Object, [], 'Kernel-Infrastructure');
  24534. //>>excludeStart("ide", pragmas.excludeIdeData);
  24535. globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  24536. //>>excludeEnd("ide");
  24537. smalltalk.addMethod(
  24538. smalltalk.method({
  24539. selector: "do:on:displaying:",
  24540. protocol: 'progress handling',
  24541. fn: function (aBlock,aCollection,aString){
  24542. var self=this;
  24543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24544. return smalltalk.withContext(function($ctx1) {
  24545. //>>excludeEnd("ctx");
  24546. _st(aCollection)._do_(aBlock);
  24547. return self;
  24548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24549. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.NullProgressHandler)});
  24550. //>>excludeEnd("ctx");
  24551. },
  24552. //>>excludeStart("ide", pragmas.excludeIdeData);
  24553. args: ["aBlock", "aCollection", "aString"],
  24554. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  24555. referencedClasses: [],
  24556. //>>excludeEnd("ide");
  24557. messageSends: ["do:"]
  24558. }),
  24559. globals.NullProgressHandler);
  24560. globals.NullProgressHandler.klass.iVarNames = ['current'];
  24561. smalltalk.addMethod(
  24562. smalltalk.method({
  24563. selector: "initialize",
  24564. protocol: 'initialization',
  24565. fn: function (){
  24566. var self=this;
  24567. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  24568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24569. return smalltalk.withContext(function($ctx1) {
  24570. //>>excludeEnd("ctx");
  24571. _st($ProgressHandler())._registerIfNone_(self._new());
  24572. return self;
  24573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24574. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.NullProgressHandler.klass)});
  24575. //>>excludeEnd("ctx");
  24576. },
  24577. //>>excludeStart("ide", pragmas.excludeIdeData);
  24578. args: [],
  24579. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  24580. referencedClasses: ["ProgressHandler"],
  24581. //>>excludeEnd("ide");
  24582. messageSends: ["registerIfNone:", "new"]
  24583. }),
  24584. globals.NullProgressHandler.klass);
  24585. smalltalk.addClass('Organizer', globals.Object, [], 'Kernel-Infrastructure');
  24586. //>>excludeStart("ide", pragmas.excludeIdeData);
  24587. globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  24588. //>>excludeEnd("ide");
  24589. smalltalk.addMethod(
  24590. smalltalk.method({
  24591. selector: "addElement:",
  24592. protocol: 'accessing',
  24593. fn: function (anObject){
  24594. var self=this;
  24595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24596. return smalltalk.withContext(function($ctx1) {
  24597. //>>excludeEnd("ctx");
  24598. self.elements.addElement(anObject);
  24599. return self;
  24600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24601. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},globals.Organizer)});
  24602. //>>excludeEnd("ctx");
  24603. },
  24604. //>>excludeStart("ide", pragmas.excludeIdeData);
  24605. args: ["anObject"],
  24606. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  24607. referencedClasses: [],
  24608. //>>excludeEnd("ide");
  24609. messageSends: []
  24610. }),
  24611. globals.Organizer);
  24612. smalltalk.addMethod(
  24613. smalltalk.method({
  24614. selector: "elements",
  24615. protocol: 'accessing',
  24616. fn: function (){
  24617. var self=this;
  24618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24619. return smalltalk.withContext(function($ctx1) {
  24620. //>>excludeEnd("ctx");
  24621. var $1;
  24622. $1=_st(self._basicAt_("elements"))._copy();
  24623. return $1;
  24624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24625. }, function($ctx1) {$ctx1.fill(self,"elements",{},globals.Organizer)});
  24626. //>>excludeEnd("ctx");
  24627. },
  24628. //>>excludeStart("ide", pragmas.excludeIdeData);
  24629. args: [],
  24630. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  24631. referencedClasses: [],
  24632. //>>excludeEnd("ide");
  24633. messageSends: ["copy", "basicAt:"]
  24634. }),
  24635. globals.Organizer);
  24636. smalltalk.addMethod(
  24637. smalltalk.method({
  24638. selector: "removeElement:",
  24639. protocol: 'accessing',
  24640. fn: function (anObject){
  24641. var self=this;
  24642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24643. return smalltalk.withContext(function($ctx1) {
  24644. //>>excludeEnd("ctx");
  24645. self.elements.removeElement(anObject);
  24646. return self;
  24647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24648. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},globals.Organizer)});
  24649. //>>excludeEnd("ctx");
  24650. },
  24651. //>>excludeStart("ide", pragmas.excludeIdeData);
  24652. args: ["anObject"],
  24653. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  24654. referencedClasses: [],
  24655. //>>excludeEnd("ide");
  24656. messageSends: []
  24657. }),
  24658. globals.Organizer);
  24659. smalltalk.addClass('ClassOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  24660. //>>excludeStart("ide", pragmas.excludeIdeData);
  24661. globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  24662. //>>excludeEnd("ide");
  24663. smalltalk.addMethod(
  24664. smalltalk.method({
  24665. selector: "addElement:",
  24666. protocol: 'accessing',
  24667. fn: function (aString){
  24668. var self=this;
  24669. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24670. function $ProtocolAdded(){return globals.ProtocolAdded||(typeof ProtocolAdded=="undefined"?nil:ProtocolAdded)}
  24671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24672. return smalltalk.withContext(function($ctx1) {
  24673. //>>excludeEnd("ctx");
  24674. var $1,$2;
  24675. (
  24676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24677. $ctx1.supercall = true,
  24678. //>>excludeEnd("ctx");
  24679. globals.ClassOrganizer.superclass.fn.prototype._addElement_.apply(_st(self), [aString]));
  24680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24681. $ctx1.supercall = false;
  24682. //>>excludeEnd("ctx");;
  24683. $1=_st($ProtocolAdded())._new();
  24684. _st($1)._protocol_(aString);
  24685. _st($1)._theClass_(self._theClass());
  24686. $2=_st($1)._yourself();
  24687. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24688. return self;
  24689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24690. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},globals.ClassOrganizer)});
  24691. //>>excludeEnd("ctx");
  24692. },
  24693. //>>excludeStart("ide", pragmas.excludeIdeData);
  24694. args: ["aString"],
  24695. 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)",
  24696. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  24697. //>>excludeEnd("ide");
  24698. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  24699. }),
  24700. globals.ClassOrganizer);
  24701. smalltalk.addMethod(
  24702. smalltalk.method({
  24703. selector: "removeElement:",
  24704. protocol: 'accessing',
  24705. fn: function (aString){
  24706. var self=this;
  24707. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24708. function $ProtocolRemoved(){return globals.ProtocolRemoved||(typeof ProtocolRemoved=="undefined"?nil:ProtocolRemoved)}
  24709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24710. return smalltalk.withContext(function($ctx1) {
  24711. //>>excludeEnd("ctx");
  24712. var $1,$2;
  24713. (
  24714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24715. $ctx1.supercall = true,
  24716. //>>excludeEnd("ctx");
  24717. globals.ClassOrganizer.superclass.fn.prototype._removeElement_.apply(_st(self), [aString]));
  24718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24719. $ctx1.supercall = false;
  24720. //>>excludeEnd("ctx");;
  24721. $1=_st($ProtocolRemoved())._new();
  24722. _st($1)._protocol_(aString);
  24723. _st($1)._theClass_(self._theClass());
  24724. $2=_st($1)._yourself();
  24725. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24726. return self;
  24727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24728. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},globals.ClassOrganizer)});
  24729. //>>excludeEnd("ctx");
  24730. },
  24731. //>>excludeStart("ide", pragmas.excludeIdeData);
  24732. args: ["aString"],
  24733. 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)",
  24734. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  24735. //>>excludeEnd("ide");
  24736. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  24737. }),
  24738. globals.ClassOrganizer);
  24739. smalltalk.addMethod(
  24740. smalltalk.method({
  24741. selector: "theClass",
  24742. protocol: 'accessing',
  24743. fn: function (){
  24744. var self=this;
  24745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24746. return smalltalk.withContext(function($ctx1) {
  24747. //>>excludeEnd("ctx");
  24748. return self.theClass ;
  24749. return self;
  24750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24751. }, function($ctx1) {$ctx1.fill(self,"theClass",{},globals.ClassOrganizer)});
  24752. //>>excludeEnd("ctx");
  24753. },
  24754. //>>excludeStart("ide", pragmas.excludeIdeData);
  24755. args: [],
  24756. source: "theClass\x0a\x09< return self.theClass >",
  24757. referencedClasses: [],
  24758. //>>excludeEnd("ide");
  24759. messageSends: []
  24760. }),
  24761. globals.ClassOrganizer);
  24762. smalltalk.addClass('PackageOrganizer', globals.Organizer, [], 'Kernel-Infrastructure');
  24763. //>>excludeStart("ide", pragmas.excludeIdeData);
  24764. globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  24765. //>>excludeEnd("ide");
  24766. smalltalk.addClass('Package', globals.Object, ['transport', 'dirty'], 'Kernel-Infrastructure');
  24767. //>>excludeStart("ide", pragmas.excludeIdeData);
  24768. 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'";
  24769. //>>excludeEnd("ide");
  24770. smalltalk.addMethod(
  24771. smalltalk.method({
  24772. selector: "basicName:",
  24773. protocol: 'private',
  24774. fn: function (aString){
  24775. var self=this;
  24776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24777. return smalltalk.withContext(function($ctx1) {
  24778. //>>excludeEnd("ctx");
  24779. self.pkgName = aString;
  24780. return self;
  24781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24782. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},globals.Package)});
  24783. //>>excludeEnd("ctx");
  24784. },
  24785. //>>excludeStart("ide", pragmas.excludeIdeData);
  24786. args: ["aString"],
  24787. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  24788. referencedClasses: [],
  24789. //>>excludeEnd("ide");
  24790. messageSends: []
  24791. }),
  24792. globals.Package);
  24793. smalltalk.addMethod(
  24794. smalltalk.method({
  24795. selector: "basicTransport",
  24796. protocol: 'private',
  24797. fn: function (){
  24798. var self=this;
  24799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24800. return smalltalk.withContext(function($ctx1) {
  24801. //>>excludeEnd("ctx");
  24802. return self.transport;
  24803. return self;
  24804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24805. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},globals.Package)});
  24806. //>>excludeEnd("ctx");
  24807. },
  24808. //>>excludeStart("ide", pragmas.excludeIdeData);
  24809. args: [],
  24810. 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>",
  24811. referencedClasses: [],
  24812. //>>excludeEnd("ide");
  24813. messageSends: []
  24814. }),
  24815. globals.Package);
  24816. smalltalk.addMethod(
  24817. smalltalk.method({
  24818. selector: "beClean",
  24819. protocol: 'accessing',
  24820. fn: function (){
  24821. var self=this;
  24822. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24823. function $PackageClean(){return globals.PackageClean||(typeof PackageClean=="undefined"?nil:PackageClean)}
  24824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24825. return smalltalk.withContext(function($ctx1) {
  24826. //>>excludeEnd("ctx");
  24827. var $1,$2;
  24828. self["@dirty"]=false;
  24829. $1=_st($PackageClean())._new();
  24830. _st($1)._package_(self);
  24831. $2=_st($1)._yourself();
  24832. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24833. return self;
  24834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24835. }, function($ctx1) {$ctx1.fill(self,"beClean",{},globals.Package)});
  24836. //>>excludeEnd("ctx");
  24837. },
  24838. //>>excludeStart("ide", pragmas.excludeIdeData);
  24839. args: [],
  24840. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  24841. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  24842. //>>excludeEnd("ide");
  24843. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  24844. }),
  24845. globals.Package);
  24846. smalltalk.addMethod(
  24847. smalltalk.method({
  24848. selector: "beDirty",
  24849. protocol: 'accessing',
  24850. fn: function (){
  24851. var self=this;
  24852. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  24853. function $PackageDirty(){return globals.PackageDirty||(typeof PackageDirty=="undefined"?nil:PackageDirty)}
  24854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24855. return smalltalk.withContext(function($ctx1) {
  24856. //>>excludeEnd("ctx");
  24857. var $1,$2;
  24858. self["@dirty"]=true;
  24859. $1=_st($PackageDirty())._new();
  24860. _st($1)._package_(self);
  24861. $2=_st($1)._yourself();
  24862. _st(_st($SystemAnnouncer())._current())._announce_($2);
  24863. return self;
  24864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24865. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},globals.Package)});
  24866. //>>excludeEnd("ctx");
  24867. },
  24868. //>>excludeStart("ide", pragmas.excludeIdeData);
  24869. args: [],
  24870. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  24871. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  24872. //>>excludeEnd("ide");
  24873. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  24874. }),
  24875. globals.Package);
  24876. smalltalk.addMethod(
  24877. smalltalk.method({
  24878. selector: "classTemplate",
  24879. protocol: 'accessing',
  24880. fn: function (){
  24881. var self=this;
  24882. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  24883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24884. return smalltalk.withContext(function($ctx1) {
  24885. //>>excludeEnd("ctx");
  24886. var $3,$4,$2,$5,$6,$7,$1;
  24887. $1=_st($String())._streamContents_((function(stream){
  24888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24889. return smalltalk.withContext(function($ctx2) {
  24890. //>>excludeEnd("ctx");
  24891. _st(stream)._nextPutAll_("Object");
  24892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24893. $ctx2.sendIdx["nextPutAll:"]=1;
  24894. //>>excludeEnd("ctx");
  24895. _st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  24896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24897. $ctx2.sendIdx["nextPutAll:"]=2;
  24898. //>>excludeEnd("ctx");
  24899. $3=_st($String())._lf();
  24900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24901. $ctx2.sendIdx["lf"]=1;
  24902. //>>excludeEnd("ctx");
  24903. $4=_st($String())._tab();
  24904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24905. $ctx2.sendIdx["tab"]=1;
  24906. //>>excludeEnd("ctx");
  24907. $2=_st($3).__comma($4);
  24908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24909. $ctx2.sendIdx[","]=1;
  24910. //>>excludeEnd("ctx");
  24911. _st(stream)._nextPutAll_($2);
  24912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24913. $ctx2.sendIdx["nextPutAll:"]=3;
  24914. //>>excludeEnd("ctx");
  24915. $5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
  24916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24917. $ctx2.sendIdx["nextPutAll:"]=4;
  24918. //>>excludeEnd("ctx");
  24919. $5;
  24920. $6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
  24921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24922. $ctx2.sendIdx[","]=2;
  24923. //>>excludeEnd("ctx");
  24924. _st(stream)._nextPutAll_($6);
  24925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24926. $ctx2.sendIdx["nextPutAll:"]=5;
  24927. //>>excludeEnd("ctx");
  24928. _st(stream)._nextPutAll_("package: '");
  24929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24930. $ctx2.sendIdx["nextPutAll:"]=6;
  24931. //>>excludeEnd("ctx");
  24932. _st(stream)._nextPutAll_(self._name());
  24933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24934. $ctx2.sendIdx["nextPutAll:"]=7;
  24935. //>>excludeEnd("ctx");
  24936. $7=_st(stream)._nextPutAll_("'");
  24937. return $7;
  24938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24939. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  24940. //>>excludeEnd("ctx");
  24941. }));
  24942. return $1;
  24943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24944. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)});
  24945. //>>excludeEnd("ctx");
  24946. },
  24947. //>>excludeStart("ide", pragmas.excludeIdeData);
  24948. args: [],
  24949. 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: '''' ]",
  24950. referencedClasses: ["String"],
  24951. //>>excludeEnd("ide");
  24952. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  24953. }),
  24954. globals.Package);
  24955. smalltalk.addMethod(
  24956. smalltalk.method({
  24957. selector: "classes",
  24958. protocol: 'classes',
  24959. fn: function (){
  24960. var self=this;
  24961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24962. return smalltalk.withContext(function($ctx1) {
  24963. //>>excludeEnd("ctx");
  24964. var $1;
  24965. $1=_st(self._organization())._elements();
  24966. return $1;
  24967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24968. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.Package)});
  24969. //>>excludeEnd("ctx");
  24970. },
  24971. //>>excludeStart("ide", pragmas.excludeIdeData);
  24972. args: [],
  24973. source: "classes\x0a\x09^ self organization elements",
  24974. referencedClasses: [],
  24975. //>>excludeEnd("ide");
  24976. messageSends: ["elements", "organization"]
  24977. }),
  24978. globals.Package);
  24979. smalltalk.addMethod(
  24980. smalltalk.method({
  24981. selector: "definition",
  24982. protocol: 'accessing',
  24983. fn: function (){
  24984. var self=this;
  24985. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  24986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24987. return smalltalk.withContext(function($ctx1) {
  24988. //>>excludeEnd("ctx");
  24989. var $2,$4,$5,$3,$7,$6,$8,$9,$1;
  24990. $1=_st($String())._streamContents_((function(stream){
  24991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24992. return smalltalk.withContext(function($ctx2) {
  24993. //>>excludeEnd("ctx");
  24994. $2=_st(self._class())._name();
  24995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24996. $ctx2.sendIdx["name"]=1;
  24997. //>>excludeEnd("ctx");
  24998. _st(stream)._nextPutAll_($2);
  24999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25000. $ctx2.sendIdx["nextPutAll:"]=1;
  25001. //>>excludeEnd("ctx");
  25002. $4=_st($String())._lf();
  25003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25004. $ctx2.sendIdx["lf"]=1;
  25005. //>>excludeEnd("ctx");
  25006. $5=_st($String())._tab();
  25007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25008. $ctx2.sendIdx["tab"]=1;
  25009. //>>excludeEnd("ctx");
  25010. $3=_st($4).__comma($5);
  25011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25012. $ctx2.sendIdx[","]=1;
  25013. //>>excludeEnd("ctx");
  25014. _st(stream)._nextPutAll_($3);
  25015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25016. $ctx2.sendIdx["nextPutAll:"]=2;
  25017. //>>excludeEnd("ctx");
  25018. _st(stream)._nextPutAll_(" named: ");
  25019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25020. $ctx2.sendIdx["nextPutAll:"]=3;
  25021. //>>excludeEnd("ctx");
  25022. $7="'".__comma(self._name());
  25023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25024. $ctx2.sendIdx[","]=3;
  25025. //>>excludeEnd("ctx");
  25026. $6=_st($7).__comma("'");
  25027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25028. $ctx2.sendIdx[","]=2;
  25029. //>>excludeEnd("ctx");
  25030. _st(stream)._nextPutAll_($6);
  25031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25032. $ctx2.sendIdx["nextPutAll:"]=4;
  25033. //>>excludeEnd("ctx");
  25034. $8=_st(_st($String())._lf()).__comma(_st($String())._tab());
  25035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25036. $ctx2.sendIdx[","]=4;
  25037. //>>excludeEnd("ctx");
  25038. _st(stream)._nextPutAll_($8);
  25039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25040. $ctx2.sendIdx["nextPutAll:"]=5;
  25041. //>>excludeEnd("ctx");
  25042. _st(stream)._nextPutAll_(" transport: (");
  25043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25044. $ctx2.sendIdx["nextPutAll:"]=6;
  25045. //>>excludeEnd("ctx");
  25046. $9=_st(stream)._nextPutAll_(_st(_st(self._transport())._definition()).__comma(")"));
  25047. return $9;
  25048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25049. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  25050. //>>excludeEnd("ctx");
  25051. }));
  25052. return $1;
  25053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25054. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.Package)});
  25055. //>>excludeEnd("ctx");
  25056. },
  25057. //>>excludeStart("ide", pragmas.excludeIdeData);
  25058. args: [],
  25059. 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, ')' ]",
  25060. referencedClasses: ["String"],
  25061. //>>excludeEnd("ide");
  25062. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "definition", "transport"]
  25063. }),
  25064. globals.Package);
  25065. smalltalk.addMethod(
  25066. smalltalk.method({
  25067. selector: "isDirty",
  25068. protocol: 'testing',
  25069. fn: function (){
  25070. var self=this;
  25071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25072. return smalltalk.withContext(function($ctx1) {
  25073. //>>excludeEnd("ctx");
  25074. var $2,$1,$receiver;
  25075. $2=self["@dirty"];
  25076. if(($receiver = $2) == null || $receiver.isNil){
  25077. $1=false;
  25078. } else {
  25079. $1=$2;
  25080. };
  25081. return $1;
  25082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25083. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},globals.Package)});
  25084. //>>excludeEnd("ctx");
  25085. },
  25086. //>>excludeStart("ide", pragmas.excludeIdeData);
  25087. args: [],
  25088. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  25089. referencedClasses: [],
  25090. //>>excludeEnd("ide");
  25091. messageSends: ["ifNil:"]
  25092. }),
  25093. globals.Package);
  25094. smalltalk.addMethod(
  25095. smalltalk.method({
  25096. selector: "isPackage",
  25097. protocol: 'testing',
  25098. fn: function (){
  25099. var self=this;
  25100. return true;
  25101. },
  25102. //>>excludeStart("ide", pragmas.excludeIdeData);
  25103. args: [],
  25104. source: "isPackage\x0a\x09^ true",
  25105. referencedClasses: [],
  25106. //>>excludeEnd("ide");
  25107. messageSends: []
  25108. }),
  25109. globals.Package);
  25110. smalltalk.addMethod(
  25111. smalltalk.method({
  25112. selector: "loadDependencies",
  25113. protocol: 'dependencies',
  25114. fn: function (){
  25115. var self=this;
  25116. var classes,packages;
  25117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25118. return smalltalk.withContext(function($ctx1) {
  25119. //>>excludeEnd("ctx");
  25120. var $2,$3,$1;
  25121. classes=self._loadDependencyClasses();
  25122. $2=_st(_st(classes)._collect_((function(each){
  25123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25124. return smalltalk.withContext(function($ctx2) {
  25125. //>>excludeEnd("ctx");
  25126. return _st(each)._package();
  25127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25129. //>>excludeEnd("ctx");
  25130. })))._asSet();
  25131. _st($2)._remove_ifAbsent_(self,(function(){
  25132. }));
  25133. $3=_st($2)._yourself();
  25134. $1=$3;
  25135. return $1;
  25136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25137. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},globals.Package)});
  25138. //>>excludeEnd("ctx");
  25139. },
  25140. //>>excludeStart("ide", pragmas.excludeIdeData);
  25141. args: [],
  25142. 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",
  25143. referencedClasses: [],
  25144. //>>excludeEnd("ide");
  25145. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  25146. }),
  25147. globals.Package);
  25148. smalltalk.addMethod(
  25149. smalltalk.method({
  25150. selector: "loadDependencyClasses",
  25151. protocol: 'dependencies',
  25152. fn: function (){
  25153. var self=this;
  25154. var starCategoryName;
  25155. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25157. return smalltalk.withContext(function($ctx1) {
  25158. //>>excludeEnd("ctx");
  25159. var $4,$3,$2,$6,$5,$7,$1;
  25160. starCategoryName="*".__comma(self._name());
  25161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25162. $ctx1.sendIdx[","]=1;
  25163. //>>excludeEnd("ctx");
  25164. $4=self._classes();
  25165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25166. $ctx1.sendIdx["classes"]=1;
  25167. //>>excludeEnd("ctx");
  25168. $3=_st($4)._collect_((function(each){
  25169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25170. return smalltalk.withContext(function($ctx2) {
  25171. //>>excludeEnd("ctx");
  25172. return _st(each)._superclass();
  25173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25175. //>>excludeEnd("ctx");
  25176. }));
  25177. $2=_st($3)._asSet();
  25178. _st($2)._remove_ifAbsent_(nil,(function(){
  25179. }));
  25180. _st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
  25181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25182. return smalltalk.withContext(function($ctx2) {
  25183. //>>excludeEnd("ctx");
  25184. $6=_st(each)._protocols();
  25185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25186. $ctx2.sendIdx["protocols"]=1;
  25187. //>>excludeEnd("ctx");
  25188. $5=_st($6).__comma(_st(_st(each)._class())._protocols());
  25189. return _st($5)._includes_(starCategoryName);
  25190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25191. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  25192. //>>excludeEnd("ctx");
  25193. })));
  25194. $7=_st($2)._yourself();
  25195. $1=$7;
  25196. return $1;
  25197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25198. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},globals.Package)});
  25199. //>>excludeEnd("ctx");
  25200. },
  25201. //>>excludeStart("ide", pragmas.excludeIdeData);
  25202. args: [],
  25203. 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",
  25204. referencedClasses: ["Smalltalk"],
  25205. //>>excludeEnd("ide");
  25206. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  25207. }),
  25208. globals.Package);
  25209. smalltalk.addMethod(
  25210. smalltalk.method({
  25211. selector: "name",
  25212. protocol: 'accessing',
  25213. fn: function (){
  25214. var self=this;
  25215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25216. return smalltalk.withContext(function($ctx1) {
  25217. //>>excludeEnd("ctx");
  25218. return self.pkgName;
  25219. return self;
  25220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25221. }, function($ctx1) {$ctx1.fill(self,"name",{},globals.Package)});
  25222. //>>excludeEnd("ctx");
  25223. },
  25224. //>>excludeStart("ide", pragmas.excludeIdeData);
  25225. args: [],
  25226. source: "name\x0a\x09<return self.pkgName>",
  25227. referencedClasses: [],
  25228. //>>excludeEnd("ide");
  25229. messageSends: []
  25230. }),
  25231. globals.Package);
  25232. smalltalk.addMethod(
  25233. smalltalk.method({
  25234. selector: "name:",
  25235. protocol: 'accessing',
  25236. fn: function (aString){
  25237. var self=this;
  25238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25239. return smalltalk.withContext(function($ctx1) {
  25240. //>>excludeEnd("ctx");
  25241. self._basicName_(aString);
  25242. self._beDirty();
  25243. return self;
  25244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25245. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},globals.Package)});
  25246. //>>excludeEnd("ctx");
  25247. },
  25248. //>>excludeStart("ide", pragmas.excludeIdeData);
  25249. args: ["aString"],
  25250. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  25251. referencedClasses: [],
  25252. //>>excludeEnd("ide");
  25253. messageSends: ["basicName:", "beDirty"]
  25254. }),
  25255. globals.Package);
  25256. smalltalk.addMethod(
  25257. smalltalk.method({
  25258. selector: "organization",
  25259. protocol: 'accessing',
  25260. fn: function (){
  25261. var self=this;
  25262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25263. return smalltalk.withContext(function($ctx1) {
  25264. //>>excludeEnd("ctx");
  25265. var $1;
  25266. $1=self._basicAt_("organization");
  25267. return $1;
  25268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25269. }, function($ctx1) {$ctx1.fill(self,"organization",{},globals.Package)});
  25270. //>>excludeEnd("ctx");
  25271. },
  25272. //>>excludeStart("ide", pragmas.excludeIdeData);
  25273. args: [],
  25274. source: "organization\x0a\x09^ self basicAt: 'organization'",
  25275. referencedClasses: [],
  25276. //>>excludeEnd("ide");
  25277. messageSends: ["basicAt:"]
  25278. }),
  25279. globals.Package);
  25280. smalltalk.addMethod(
  25281. smalltalk.method({
  25282. selector: "printOn:",
  25283. protocol: 'printing',
  25284. fn: function (aStream){
  25285. var self=this;
  25286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25287. return smalltalk.withContext(function($ctx1) {
  25288. //>>excludeEnd("ctx");
  25289. var $1;
  25290. (
  25291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25292. $ctx1.supercall = true,
  25293. //>>excludeEnd("ctx");
  25294. globals.Package.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  25295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25296. $ctx1.supercall = false;
  25297. //>>excludeEnd("ctx");;
  25298. _st(aStream)._nextPutAll_(" (");
  25299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25300. $ctx1.sendIdx["nextPutAll:"]=1;
  25301. //>>excludeEnd("ctx");
  25302. _st(aStream)._nextPutAll_(self._name());
  25303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25304. $ctx1.sendIdx["nextPutAll:"]=2;
  25305. //>>excludeEnd("ctx");
  25306. $1=_st(aStream)._nextPutAll_(")");
  25307. return self;
  25308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25309. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Package)});
  25310. //>>excludeEnd("ctx");
  25311. },
  25312. //>>excludeStart("ide", pragmas.excludeIdeData);
  25313. args: ["aStream"],
  25314. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  25315. referencedClasses: [],
  25316. //>>excludeEnd("ide");
  25317. messageSends: ["printOn:", "nextPutAll:", "name"]
  25318. }),
  25319. globals.Package);
  25320. smalltalk.addMethod(
  25321. smalltalk.method({
  25322. selector: "setupClasses",
  25323. protocol: 'classes',
  25324. fn: function (){
  25325. var self=this;
  25326. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  25327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25328. return smalltalk.withContext(function($ctx1) {
  25329. //>>excludeEnd("ctx");
  25330. var $1,$2;
  25331. $1=self._classes();
  25332. _st($1)._do_((function(each){
  25333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25334. return smalltalk.withContext(function($ctx2) {
  25335. //>>excludeEnd("ctx");
  25336. return _st(_st($ClassBuilder())._new())._setupClass_(each);
  25337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25338. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25339. //>>excludeEnd("ctx");
  25340. }));
  25341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25342. $ctx1.sendIdx["do:"]=1;
  25343. //>>excludeEnd("ctx");
  25344. $2=_st($1)._do_((function(each){
  25345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25346. return smalltalk.withContext(function($ctx2) {
  25347. //>>excludeEnd("ctx");
  25348. return _st(each)._initialize();
  25349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  25351. //>>excludeEnd("ctx");
  25352. }));
  25353. return self;
  25354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25355. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},globals.Package)});
  25356. //>>excludeEnd("ctx");
  25357. },
  25358. //>>excludeStart("ide", pragmas.excludeIdeData);
  25359. args: [],
  25360. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  25361. referencedClasses: ["ClassBuilder"],
  25362. //>>excludeEnd("ide");
  25363. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  25364. }),
  25365. globals.Package);
  25366. smalltalk.addMethod(
  25367. smalltalk.method({
  25368. selector: "sortedClasses",
  25369. protocol: 'classes',
  25370. fn: function (){
  25371. var self=this;
  25372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25373. return smalltalk.withContext(function($ctx1) {
  25374. //>>excludeEnd("ctx");
  25375. var $1;
  25376. $1=_st(self._class())._sortedClasses_(self._classes());
  25377. return $1;
  25378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25379. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},globals.Package)});
  25380. //>>excludeEnd("ctx");
  25381. },
  25382. //>>excludeStart("ide", pragmas.excludeIdeData);
  25383. args: [],
  25384. 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",
  25385. referencedClasses: [],
  25386. //>>excludeEnd("ide");
  25387. messageSends: ["sortedClasses:", "class", "classes"]
  25388. }),
  25389. globals.Package);
  25390. smalltalk.addMethod(
  25391. smalltalk.method({
  25392. selector: "transport",
  25393. protocol: 'accessing',
  25394. fn: function (){
  25395. var self=this;
  25396. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  25397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25398. return smalltalk.withContext(function($ctx1) {
  25399. //>>excludeEnd("ctx");
  25400. var $2,$3,$4,$1,$receiver;
  25401. $2=self["@transport"];
  25402. if(($receiver = $2) == null || $receiver.isNil){
  25403. $3=_st($PackageTransport())._fromJson_(self._basicTransport());
  25404. _st($3)._package_(self);
  25405. $4=_st($3)._yourself();
  25406. self["@transport"]=$4;
  25407. $1=self["@transport"];
  25408. } else {
  25409. $1=$2;
  25410. };
  25411. return $1;
  25412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25413. }, function($ctx1) {$ctx1.fill(self,"transport",{},globals.Package)});
  25414. //>>excludeEnd("ctx");
  25415. },
  25416. //>>excludeStart("ide", pragmas.excludeIdeData);
  25417. args: [],
  25418. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  25419. referencedClasses: ["PackageTransport"],
  25420. //>>excludeEnd("ide");
  25421. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  25422. }),
  25423. globals.Package);
  25424. smalltalk.addMethod(
  25425. smalltalk.method({
  25426. selector: "transport:",
  25427. protocol: 'accessing',
  25428. fn: function (aPackageTransport){
  25429. var self=this;
  25430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25431. return smalltalk.withContext(function($ctx1) {
  25432. //>>excludeEnd("ctx");
  25433. self["@transport"]=aPackageTransport;
  25434. _st(aPackageTransport)._package_(self);
  25435. return self;
  25436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25437. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},globals.Package)});
  25438. //>>excludeEnd("ctx");
  25439. },
  25440. //>>excludeStart("ide", pragmas.excludeIdeData);
  25441. args: ["aPackageTransport"],
  25442. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  25443. referencedClasses: [],
  25444. //>>excludeEnd("ide");
  25445. messageSends: ["package:"]
  25446. }),
  25447. globals.Package);
  25448. globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  25449. smalltalk.addMethod(
  25450. smalltalk.method({
  25451. selector: "named:",
  25452. protocol: 'accessing',
  25453. fn: function (aPackageName){
  25454. var self=this;
  25455. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25457. return smalltalk.withContext(function($ctx1) {
  25458. //>>excludeEnd("ctx");
  25459. var $1;
  25460. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
  25461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25462. return smalltalk.withContext(function($ctx2) {
  25463. //>>excludeEnd("ctx");
  25464. return _st($Smalltalk())._createPackage_(aPackageName);
  25465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25467. //>>excludeEnd("ctx");
  25468. }));
  25469. return $1;
  25470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25471. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},globals.Package.klass)});
  25472. //>>excludeEnd("ctx");
  25473. },
  25474. //>>excludeStart("ide", pragmas.excludeIdeData);
  25475. args: ["aPackageName"],
  25476. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  25477. referencedClasses: ["Smalltalk"],
  25478. //>>excludeEnd("ide");
  25479. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  25480. }),
  25481. globals.Package.klass);
  25482. smalltalk.addMethod(
  25483. smalltalk.method({
  25484. selector: "named:ifAbsent:",
  25485. protocol: 'accessing',
  25486. fn: function (aPackageName,aBlock){
  25487. var self=this;
  25488. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  25489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25490. return smalltalk.withContext(function($ctx1) {
  25491. //>>excludeEnd("ctx");
  25492. var $1;
  25493. $1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
  25494. return $1;
  25495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25496. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},globals.Package.klass)});
  25497. //>>excludeEnd("ctx");
  25498. },
  25499. //>>excludeStart("ide", pragmas.excludeIdeData);
  25500. args: ["aPackageName", "aBlock"],
  25501. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  25502. referencedClasses: ["Smalltalk"],
  25503. //>>excludeEnd("ide");
  25504. messageSends: ["packageAt:ifAbsent:"]
  25505. }),
  25506. globals.Package.klass);
  25507. smalltalk.addMethod(
  25508. smalltalk.method({
  25509. selector: "named:transport:",
  25510. protocol: 'accessing',
  25511. fn: function (aPackageName,aTransport){
  25512. var self=this;
  25513. var package_;
  25514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25515. return smalltalk.withContext(function($ctx1) {
  25516. //>>excludeEnd("ctx");
  25517. var $1;
  25518. package_=self._named_(aPackageName);
  25519. _st(package_)._transport_(aTransport);
  25520. $1=package_;
  25521. return $1;
  25522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25523. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},globals.Package.klass)});
  25524. //>>excludeEnd("ctx");
  25525. },
  25526. //>>excludeStart("ide", pragmas.excludeIdeData);
  25527. args: ["aPackageName", "aTransport"],
  25528. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  25529. referencedClasses: [],
  25530. //>>excludeEnd("ide");
  25531. messageSends: ["named:", "transport:"]
  25532. }),
  25533. globals.Package.klass);
  25534. smalltalk.addMethod(
  25535. smalltalk.method({
  25536. selector: "sortedClasses:",
  25537. protocol: 'sorting',
  25538. fn: function (classes){
  25539. var self=this;
  25540. var children,others,nodes,expandedClasses;
  25541. function $ClassSorterNode(){return globals.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  25542. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  25543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25544. return smalltalk.withContext(function($ctx1) {
  25545. //>>excludeEnd("ctx");
  25546. var $1,$3,$2,$4;
  25547. children=[];
  25548. others=[];
  25549. _st(classes)._do_((function(each){
  25550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25551. return smalltalk.withContext(function($ctx2) {
  25552. //>>excludeEnd("ctx");
  25553. $1=_st(classes)._includes_(_st(each)._superclass());
  25554. if(smalltalk.assert($1)){
  25555. return _st(others)._add_(each);
  25556. } else {
  25557. return _st(children)._add_(each);
  25558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25559. $ctx2.sendIdx["add:"]=1;
  25560. //>>excludeEnd("ctx");
  25561. };
  25562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25564. //>>excludeEnd("ctx");
  25565. }));
  25566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25567. $ctx1.sendIdx["do:"]=1;
  25568. //>>excludeEnd("ctx");
  25569. nodes=_st(children)._collect_((function(each){
  25570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25571. return smalltalk.withContext(function($ctx2) {
  25572. //>>excludeEnd("ctx");
  25573. return _st($ClassSorterNode())._on_classes_level_(each,others,(0));
  25574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25575. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  25576. //>>excludeEnd("ctx");
  25577. }));
  25578. nodes=_st(nodes)._sorted_((function(a,b){
  25579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25580. return smalltalk.withContext(function($ctx2) {
  25581. //>>excludeEnd("ctx");
  25582. $3=_st(a)._theClass();
  25583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25584. $ctx2.sendIdx["theClass"]=1;
  25585. //>>excludeEnd("ctx");
  25586. $2=_st($3)._name();
  25587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25588. $ctx2.sendIdx["name"]=1;
  25589. //>>excludeEnd("ctx");
  25590. return _st($2).__lt_eq(_st(_st(b)._theClass())._name());
  25591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25592. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  25593. //>>excludeEnd("ctx");
  25594. }));
  25595. expandedClasses=_st($Array())._new();
  25596. _st(nodes)._do_((function(aNode){
  25597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25598. return smalltalk.withContext(function($ctx2) {
  25599. //>>excludeEnd("ctx");
  25600. return _st(aNode)._traverseClassesWith_(expandedClasses);
  25601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25602. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  25603. //>>excludeEnd("ctx");
  25604. }));
  25605. $4=expandedClasses;
  25606. return $4;
  25607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25608. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},globals.Package.klass)});
  25609. //>>excludeEnd("ctx");
  25610. },
  25611. //>>excludeStart("ide", pragmas.excludeIdeData);
  25612. args: ["classes"],
  25613. 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",
  25614. referencedClasses: ["ClassSorterNode", "Array"],
  25615. //>>excludeEnd("ide");
  25616. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  25617. }),
  25618. globals.Package.klass);
  25619. smalltalk.addClass('PackageStateObserver', globals.Object, [], 'Kernel-Infrastructure');
  25620. //>>excludeStart("ide", pragmas.excludeIdeData);
  25621. globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  25622. //>>excludeEnd("ide");
  25623. smalltalk.addMethod(
  25624. smalltalk.method({
  25625. selector: "announcer",
  25626. protocol: 'accessing',
  25627. fn: function (){
  25628. var self=this;
  25629. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  25630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25631. return smalltalk.withContext(function($ctx1) {
  25632. //>>excludeEnd("ctx");
  25633. var $1;
  25634. $1=_st($SystemAnnouncer())._current();
  25635. return $1;
  25636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25637. }, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.PackageStateObserver)});
  25638. //>>excludeEnd("ctx");
  25639. },
  25640. //>>excludeStart("ide", pragmas.excludeIdeData);
  25641. args: [],
  25642. source: "announcer\x0a\x09^ SystemAnnouncer current",
  25643. referencedClasses: ["SystemAnnouncer"],
  25644. //>>excludeEnd("ide");
  25645. messageSends: ["current"]
  25646. }),
  25647. globals.PackageStateObserver);
  25648. smalltalk.addMethod(
  25649. smalltalk.method({
  25650. selector: "observeSystem",
  25651. protocol: 'actions',
  25652. fn: function (){
  25653. var self=this;
  25654. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  25655. function $ClassAnnouncement(){return globals.ClassAnnouncement||(typeof ClassAnnouncement=="undefined"?nil:ClassAnnouncement)}
  25656. function $MethodAnnouncement(){return globals.MethodAnnouncement||(typeof MethodAnnouncement=="undefined"?nil:MethodAnnouncement)}
  25657. function $ProtocolAnnouncement(){return globals.ProtocolAnnouncement||(typeof ProtocolAnnouncement=="undefined"?nil:ProtocolAnnouncement)}
  25658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25659. return smalltalk.withContext(function($ctx1) {
  25660. //>>excludeEnd("ctx");
  25661. var $1,$2;
  25662. $1=self._announcer();
  25663. _st($1)._on_send_to_($PackageAdded(),"onPackageAdded:",self);
  25664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25665. $ctx1.sendIdx["on:send:to:"]=1;
  25666. //>>excludeEnd("ctx");
  25667. _st($1)._on_send_to_($ClassAnnouncement(),"onClassModification:",self);
  25668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25669. $ctx1.sendIdx["on:send:to:"]=2;
  25670. //>>excludeEnd("ctx");
  25671. _st($1)._on_send_to_($MethodAnnouncement(),"onMethodModification:",self);
  25672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25673. $ctx1.sendIdx["on:send:to:"]=3;
  25674. //>>excludeEnd("ctx");
  25675. $2=_st($1)._on_send_to_($ProtocolAnnouncement(),"onProtocolModification:",self);
  25676. return self;
  25677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25678. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.PackageStateObserver)});
  25679. //>>excludeEnd("ctx");
  25680. },
  25681. //>>excludeStart("ide", pragmas.excludeIdeData);
  25682. args: [],
  25683. 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",
  25684. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  25685. //>>excludeEnd("ide");
  25686. messageSends: ["on:send:to:", "announcer"]
  25687. }),
  25688. globals.PackageStateObserver);
  25689. smalltalk.addMethod(
  25690. smalltalk.method({
  25691. selector: "onClassModification:",
  25692. protocol: 'reactions',
  25693. fn: function (anAnnouncement){
  25694. var self=this;
  25695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25696. return smalltalk.withContext(function($ctx1) {
  25697. //>>excludeEnd("ctx");
  25698. var $1,$receiver;
  25699. $1=_st(anAnnouncement)._theClass();
  25700. if(($receiver = $1) == null || $receiver.isNil){
  25701. $1;
  25702. } else {
  25703. var theClass;
  25704. theClass=$receiver;
  25705. _st(_st(theClass)._package())._beDirty();
  25706. };
  25707. return self;
  25708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25709. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25710. //>>excludeEnd("ctx");
  25711. },
  25712. //>>excludeStart("ide", pragmas.excludeIdeData);
  25713. args: ["anAnnouncement"],
  25714. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  25715. referencedClasses: [],
  25716. //>>excludeEnd("ide");
  25717. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  25718. }),
  25719. globals.PackageStateObserver);
  25720. smalltalk.addMethod(
  25721. smalltalk.method({
  25722. selector: "onMethodModification:",
  25723. protocol: 'reactions',
  25724. fn: function (anAnnouncement){
  25725. var self=this;
  25726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25727. return smalltalk.withContext(function($ctx1) {
  25728. //>>excludeEnd("ctx");
  25729. var $1,$receiver;
  25730. $1=_st(_st(anAnnouncement)._method())._package();
  25731. if(($receiver = $1) == null || $receiver.isNil){
  25732. $1;
  25733. } else {
  25734. var package_;
  25735. package_=$receiver;
  25736. _st(package_)._beDirty();
  25737. };
  25738. return self;
  25739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25740. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25741. //>>excludeEnd("ctx");
  25742. },
  25743. //>>excludeStart("ide", pragmas.excludeIdeData);
  25744. args: ["anAnnouncement"],
  25745. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  25746. referencedClasses: [],
  25747. //>>excludeEnd("ide");
  25748. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  25749. }),
  25750. globals.PackageStateObserver);
  25751. smalltalk.addMethod(
  25752. smalltalk.method({
  25753. selector: "onPackageAdded:",
  25754. protocol: 'reactions',
  25755. fn: function (anAnnouncement){
  25756. var self=this;
  25757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25758. return smalltalk.withContext(function($ctx1) {
  25759. //>>excludeEnd("ctx");
  25760. _st(_st(anAnnouncement)._package())._beDirty();
  25761. return self;
  25762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25763. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25764. //>>excludeEnd("ctx");
  25765. },
  25766. //>>excludeStart("ide", pragmas.excludeIdeData);
  25767. args: ["anAnnouncement"],
  25768. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  25769. referencedClasses: [],
  25770. //>>excludeEnd("ide");
  25771. messageSends: ["beDirty", "package"]
  25772. }),
  25773. globals.PackageStateObserver);
  25774. smalltalk.addMethod(
  25775. smalltalk.method({
  25776. selector: "onProtocolModification:",
  25777. protocol: 'reactions',
  25778. fn: function (anAnnouncement){
  25779. var self=this;
  25780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25781. return smalltalk.withContext(function($ctx1) {
  25782. //>>excludeEnd("ctx");
  25783. var $1,$receiver;
  25784. $1=_st(anAnnouncement)._package();
  25785. if(($receiver = $1) == null || $receiver.isNil){
  25786. $1;
  25787. } else {
  25788. var package_;
  25789. package_=$receiver;
  25790. _st(package_)._beDirty();
  25791. };
  25792. return self;
  25793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25794. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},globals.PackageStateObserver)});
  25795. //>>excludeEnd("ctx");
  25796. },
  25797. //>>excludeStart("ide", pragmas.excludeIdeData);
  25798. args: ["anAnnouncement"],
  25799. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  25800. referencedClasses: [],
  25801. //>>excludeEnd("ide");
  25802. messageSends: ["ifNotNil:", "package", "beDirty"]
  25803. }),
  25804. globals.PackageStateObserver);
  25805. globals.PackageStateObserver.klass.iVarNames = ['current'];
  25806. smalltalk.addMethod(
  25807. smalltalk.method({
  25808. selector: "current",
  25809. protocol: 'accessing',
  25810. fn: function (){
  25811. var self=this;
  25812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25813. return smalltalk.withContext(function($ctx1) {
  25814. //>>excludeEnd("ctx");
  25815. var $2,$1,$receiver;
  25816. $2=self["@current"];
  25817. if(($receiver = $2) == null || $receiver.isNil){
  25818. self["@current"]=self._new();
  25819. $1=self["@current"];
  25820. } else {
  25821. $1=$2;
  25822. };
  25823. return $1;
  25824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25825. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.PackageStateObserver.klass)});
  25826. //>>excludeEnd("ctx");
  25827. },
  25828. //>>excludeStart("ide", pragmas.excludeIdeData);
  25829. args: [],
  25830. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  25831. referencedClasses: [],
  25832. //>>excludeEnd("ide");
  25833. messageSends: ["ifNil:", "new"]
  25834. }),
  25835. globals.PackageStateObserver.klass);
  25836. smalltalk.addMethod(
  25837. smalltalk.method({
  25838. selector: "initialize",
  25839. protocol: 'initialization',
  25840. fn: function (){
  25841. var self=this;
  25842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25843. return smalltalk.withContext(function($ctx1) {
  25844. //>>excludeEnd("ctx");
  25845. _st(self._current())._observeSystem();
  25846. return self;
  25847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25848. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageStateObserver.klass)});
  25849. //>>excludeEnd("ctx");
  25850. },
  25851. //>>excludeStart("ide", pragmas.excludeIdeData);
  25852. args: [],
  25853. source: "initialize\x0a\x09self current observeSystem",
  25854. referencedClasses: [],
  25855. //>>excludeEnd("ide");
  25856. messageSends: ["observeSystem", "current"]
  25857. }),
  25858. globals.PackageStateObserver.klass);
  25859. smalltalk.addClass('PlatformInterface', globals.Object, [], 'Kernel-Infrastructure');
  25860. //>>excludeStart("ide", pragmas.excludeIdeData);
  25861. 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 }.";
  25862. //>>excludeEnd("ide");
  25863. globals.PlatformInterface.klass.iVarNames = ['worker'];
  25864. smalltalk.addMethod(
  25865. smalltalk.method({
  25866. selector: "ajax:",
  25867. protocol: 'actions',
  25868. fn: function (anObject){
  25869. var self=this;
  25870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25871. return smalltalk.withContext(function($ctx1) {
  25872. //>>excludeEnd("ctx");
  25873. var $2,$1,$receiver;
  25874. $2=self["@worker"];
  25875. if(($receiver = $2) == null || $receiver.isNil){
  25876. $1=self._error_("ajax: not available");
  25877. } else {
  25878. $1=_st(self["@worker"])._ajax_(anObject);
  25879. };
  25880. return $1;
  25881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25882. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},globals.PlatformInterface.klass)});
  25883. //>>excludeEnd("ctx");
  25884. },
  25885. //>>excludeStart("ide", pragmas.excludeIdeData);
  25886. args: ["anObject"],
  25887. source: "ajax: anObject\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'ajax: not available' ]",
  25888. referencedClasses: [],
  25889. //>>excludeEnd("ide");
  25890. messageSends: ["ifNotNil:ifNil:", "ajax:", "error:"]
  25891. }),
  25892. globals.PlatformInterface.klass);
  25893. smalltalk.addMethod(
  25894. smalltalk.method({
  25895. selector: "alert:",
  25896. protocol: 'actions',
  25897. fn: function (aString){
  25898. var self=this;
  25899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25900. return smalltalk.withContext(function($ctx1) {
  25901. //>>excludeEnd("ctx");
  25902. var $2,$1,$receiver;
  25903. $2=self["@worker"];
  25904. if(($receiver = $2) == null || $receiver.isNil){
  25905. $1=self._error_("alert: not available");
  25906. } else {
  25907. $1=_st(self["@worker"])._alert_(aString);
  25908. };
  25909. return $1;
  25910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25911. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},globals.PlatformInterface.klass)});
  25912. //>>excludeEnd("ctx");
  25913. },
  25914. //>>excludeStart("ide", pragmas.excludeIdeData);
  25915. args: ["aString"],
  25916. source: "alert: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker alert: aString ]\x0a\x09\x09ifNil: [ self error: 'alert: not available' ]",
  25917. referencedClasses: [],
  25918. //>>excludeEnd("ide");
  25919. messageSends: ["ifNotNil:ifNil:", "alert:", "error:"]
  25920. }),
  25921. globals.PlatformInterface.klass);
  25922. smalltalk.addMethod(
  25923. smalltalk.method({
  25924. selector: "confirm:",
  25925. protocol: 'actions',
  25926. fn: function (aString){
  25927. var self=this;
  25928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25929. return smalltalk.withContext(function($ctx1) {
  25930. //>>excludeEnd("ctx");
  25931. var $2,$1,$receiver;
  25932. $2=self["@worker"];
  25933. if(($receiver = $2) == null || $receiver.isNil){
  25934. $1=self._error_("confirm: not available");
  25935. } else {
  25936. $1=_st(self["@worker"])._confirm_(aString);
  25937. };
  25938. return $1;
  25939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25940. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},globals.PlatformInterface.klass)});
  25941. //>>excludeEnd("ctx");
  25942. },
  25943. //>>excludeStart("ide", pragmas.excludeIdeData);
  25944. args: ["aString"],
  25945. source: "confirm: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker confirm: aString ]\x0a\x09\x09ifNil: [ self error: 'confirm: not available' ]",
  25946. referencedClasses: [],
  25947. //>>excludeEnd("ide");
  25948. messageSends: ["ifNotNil:ifNil:", "confirm:", "error:"]
  25949. }),
  25950. globals.PlatformInterface.klass);
  25951. smalltalk.addMethod(
  25952. smalltalk.method({
  25953. selector: "existsGlobal:",
  25954. protocol: 'actions',
  25955. fn: function (aString){
  25956. var self=this;
  25957. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  25958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25959. return smalltalk.withContext(function($ctx1) {
  25960. //>>excludeEnd("ctx");
  25961. var $1;
  25962. $1=_st(_st($PlatformInterface())._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  25963. return true;
  25964. }),(function(){
  25965. return false;
  25966. }));
  25967. return $1;
  25968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25969. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},globals.PlatformInterface.klass)});
  25970. //>>excludeEnd("ctx");
  25971. },
  25972. //>>excludeStart("ide", pragmas.excludeIdeData);
  25973. args: ["aString"],
  25974. source: "existsGlobal: aString\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  25975. referencedClasses: ["PlatformInterface"],
  25976. //>>excludeEnd("ide");
  25977. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  25978. }),
  25979. globals.PlatformInterface.klass);
  25980. smalltalk.addMethod(
  25981. smalltalk.method({
  25982. selector: "globals",
  25983. protocol: 'accessing',
  25984. fn: function (){
  25985. var self=this;
  25986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25987. return smalltalk.withContext(function($ctx1) {
  25988. //>>excludeEnd("ctx");
  25989. return (new Function('return this'))();;
  25990. return self;
  25991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25992. }, function($ctx1) {$ctx1.fill(self,"globals",{},globals.PlatformInterface.klass)});
  25993. //>>excludeEnd("ctx");
  25994. },
  25995. //>>excludeStart("ide", pragmas.excludeIdeData);
  25996. args: [],
  25997. source: "globals\x0a\x09<return (new Function('return this'))();>",
  25998. referencedClasses: [],
  25999. //>>excludeEnd("ide");
  26000. messageSends: []
  26001. }),
  26002. globals.PlatformInterface.klass);
  26003. smalltalk.addMethod(
  26004. smalltalk.method({
  26005. selector: "initialize",
  26006. protocol: 'initialization',
  26007. fn: function (){
  26008. var self=this;
  26009. var candidate;
  26010. function $BrowserInterface(){return globals.BrowserInterface||(typeof BrowserInterface=="undefined"?nil:BrowserInterface)}
  26011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26012. return smalltalk.withContext(function($ctx1) {
  26013. //>>excludeEnd("ctx");
  26014. var $1,$receiver;
  26015. (
  26016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26017. $ctx1.supercall = true,
  26018. //>>excludeEnd("ctx");
  26019. globals.PlatformInterface.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  26020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26021. $ctx1.supercall = false;
  26022. //>>excludeEnd("ctx");;
  26023. if(($receiver = $BrowserInterface()) == null || $receiver.isNil){
  26024. $BrowserInterface();
  26025. } else {
  26026. candidate=_st($BrowserInterface())._new();
  26027. candidate;
  26028. $1=_st(candidate)._isAvailable();
  26029. if(smalltalk.assert($1)){
  26030. self._setWorker_(candidate);
  26031. return self;
  26032. };
  26033. };
  26034. return self;
  26035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26036. }, function($ctx1) {$ctx1.fill(self,"initialize",{candidate:candidate},globals.PlatformInterface.klass)});
  26037. //>>excludeEnd("ctx");
  26038. },
  26039. //>>excludeStart("ide", pragmas.excludeIdeData);
  26040. args: [],
  26041. 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]",
  26042. referencedClasses: ["BrowserInterface"],
  26043. //>>excludeEnd("ide");
  26044. messageSends: ["initialize", "ifNotNil:", "new", "ifTrue:", "isAvailable", "setWorker:"]
  26045. }),
  26046. globals.PlatformInterface.klass);
  26047. smalltalk.addMethod(
  26048. smalltalk.method({
  26049. selector: "prompt:",
  26050. protocol: 'actions',
  26051. fn: function (aString){
  26052. var self=this;
  26053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26054. return smalltalk.withContext(function($ctx1) {
  26055. //>>excludeEnd("ctx");
  26056. var $2,$1,$receiver;
  26057. $2=self["@worker"];
  26058. if(($receiver = $2) == null || $receiver.isNil){
  26059. $1=self._error_("prompt: not available");
  26060. } else {
  26061. $1=_st(self["@worker"])._prompt_(aString);
  26062. };
  26063. return $1;
  26064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26065. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},globals.PlatformInterface.klass)});
  26066. //>>excludeEnd("ctx");
  26067. },
  26068. //>>excludeStart("ide", pragmas.excludeIdeData);
  26069. args: ["aString"],
  26070. source: "prompt: aString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  26071. referencedClasses: [],
  26072. //>>excludeEnd("ide");
  26073. messageSends: ["ifNotNil:ifNil:", "prompt:", "error:"]
  26074. }),
  26075. globals.PlatformInterface.klass);
  26076. smalltalk.addMethod(
  26077. smalltalk.method({
  26078. selector: "prompt:default:",
  26079. protocol: 'actions',
  26080. fn: function (aString,defaultString){
  26081. var self=this;
  26082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26083. return smalltalk.withContext(function($ctx1) {
  26084. //>>excludeEnd("ctx");
  26085. var $2,$1,$receiver;
  26086. $2=self["@worker"];
  26087. if(($receiver = $2) == null || $receiver.isNil){
  26088. $1=self._error_("prompt: not available");
  26089. } else {
  26090. $1=_st(self["@worker"])._prompt_default_(aString,defaultString);
  26091. };
  26092. return $1;
  26093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26094. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},globals.PlatformInterface.klass)});
  26095. //>>excludeEnd("ctx");
  26096. },
  26097. //>>excludeStart("ide", pragmas.excludeIdeData);
  26098. args: ["aString", "defaultString"],
  26099. source: "prompt: aString default: defaultString\x0a\x09^ worker\x0a\x09\x09ifNotNil: [ worker prompt: aString default: defaultString ]\x0a\x09\x09ifNil: [ self error: 'prompt: not available' ]",
  26100. referencedClasses: [],
  26101. //>>excludeEnd("ide");
  26102. messageSends: ["ifNotNil:ifNil:", "prompt:default:", "error:"]
  26103. }),
  26104. globals.PlatformInterface.klass);
  26105. smalltalk.addMethod(
  26106. smalltalk.method({
  26107. selector: "setWorker:",
  26108. protocol: 'accessing',
  26109. fn: function (anObject){
  26110. var self=this;
  26111. self["@worker"]=anObject;
  26112. return self;
  26113. },
  26114. //>>excludeStart("ide", pragmas.excludeIdeData);
  26115. args: ["anObject"],
  26116. source: "setWorker: anObject\x0a\x09worker := anObject",
  26117. referencedClasses: [],
  26118. //>>excludeEnd("ide");
  26119. messageSends: []
  26120. }),
  26121. globals.PlatformInterface.klass);
  26122. smalltalk.addClass('Service', globals.Object, [], 'Kernel-Infrastructure');
  26123. //>>excludeStart("ide", pragmas.excludeIdeData);
  26124. 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.";
  26125. //>>excludeEnd("ide");
  26126. globals.Service.klass.iVarNames = ['current'];
  26127. smalltalk.addMethod(
  26128. smalltalk.method({
  26129. selector: "current",
  26130. protocol: 'accessing',
  26131. fn: function (){
  26132. var self=this;
  26133. var $1;
  26134. $1=self["@current"];
  26135. return $1;
  26136. },
  26137. //>>excludeStart("ide", pragmas.excludeIdeData);
  26138. args: [],
  26139. source: "current\x0a\x09^ current",
  26140. referencedClasses: [],
  26141. //>>excludeEnd("ide");
  26142. messageSends: []
  26143. }),
  26144. globals.Service.klass);
  26145. smalltalk.addMethod(
  26146. smalltalk.method({
  26147. selector: "new",
  26148. protocol: 'instance creation',
  26149. fn: function (){
  26150. var self=this;
  26151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26152. return smalltalk.withContext(function($ctx1) {
  26153. //>>excludeEnd("ctx");
  26154. self._shouldNotImplement();
  26155. return self;
  26156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26157. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Service.klass)});
  26158. //>>excludeEnd("ctx");
  26159. },
  26160. //>>excludeStart("ide", pragmas.excludeIdeData);
  26161. args: [],
  26162. source: "new\x0a\x09self shouldNotImplement",
  26163. referencedClasses: [],
  26164. //>>excludeEnd("ide");
  26165. messageSends: ["shouldNotImplement"]
  26166. }),
  26167. globals.Service.klass);
  26168. smalltalk.addMethod(
  26169. smalltalk.method({
  26170. selector: "register:",
  26171. protocol: 'registration',
  26172. fn: function (anObject){
  26173. var self=this;
  26174. self["@current"]=anObject;
  26175. return self;
  26176. },
  26177. //>>excludeStart("ide", pragmas.excludeIdeData);
  26178. args: ["anObject"],
  26179. source: "register: anObject\x0a\x09current := anObject",
  26180. referencedClasses: [],
  26181. //>>excludeEnd("ide");
  26182. messageSends: []
  26183. }),
  26184. globals.Service.klass);
  26185. smalltalk.addMethod(
  26186. smalltalk.method({
  26187. selector: "registerIfNone:",
  26188. protocol: 'registration',
  26189. fn: function (anObject){
  26190. var self=this;
  26191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26192. return smalltalk.withContext(function($ctx1) {
  26193. //>>excludeEnd("ctx");
  26194. var $1,$receiver;
  26195. $1=self._current();
  26196. if(($receiver = $1) == null || $receiver.isNil){
  26197. self._register_(anObject);
  26198. } else {
  26199. $1;
  26200. };
  26201. return self;
  26202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26203. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},globals.Service.klass)});
  26204. //>>excludeEnd("ctx");
  26205. },
  26206. //>>excludeStart("ide", pragmas.excludeIdeData);
  26207. args: ["anObject"],
  26208. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26209. referencedClasses: [],
  26210. //>>excludeEnd("ide");
  26211. messageSends: ["ifNil:", "current", "register:"]
  26212. }),
  26213. globals.Service.klass);
  26214. smalltalk.addClass('ErrorHandler', globals.Service, [], 'Kernel-Infrastructure');
  26215. //>>excludeStart("ide", pragmas.excludeIdeData);
  26216. 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.";
  26217. //>>excludeEnd("ide");
  26218. smalltalk.addMethod(
  26219. smalltalk.method({
  26220. selector: "handleError:",
  26221. protocol: 'error handling',
  26222. fn: function (anError){
  26223. var self=this;
  26224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26225. return smalltalk.withContext(function($ctx1) {
  26226. //>>excludeEnd("ctx");
  26227. self._handleUnhandledError_(anError);
  26228. return self;
  26229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26230. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.ErrorHandler.klass)});
  26231. //>>excludeEnd("ctx");
  26232. },
  26233. //>>excludeStart("ide", pragmas.excludeIdeData);
  26234. args: ["anError"],
  26235. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  26236. referencedClasses: [],
  26237. //>>excludeEnd("ide");
  26238. messageSends: ["handleUnhandledError:"]
  26239. }),
  26240. globals.ErrorHandler.klass);
  26241. smalltalk.addMethod(
  26242. smalltalk.method({
  26243. selector: "handleUnhandledError:",
  26244. protocol: 'error handling',
  26245. fn: function (anError){
  26246. var self=this;
  26247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26248. return smalltalk.withContext(function($ctx1) {
  26249. //>>excludeEnd("ctx");
  26250. var $1,$2;
  26251. $1=_st(anError)._wasHandled();
  26252. if(smalltalk.assert($1)){
  26253. return self;
  26254. };
  26255. $2=_st(self._current())._handleError_(anError);
  26256. return $2;
  26257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26258. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},globals.ErrorHandler.klass)});
  26259. //>>excludeEnd("ctx");
  26260. },
  26261. //>>excludeStart("ide", pragmas.excludeIdeData);
  26262. args: ["anError"],
  26263. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  26264. referencedClasses: [],
  26265. //>>excludeEnd("ide");
  26266. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  26267. }),
  26268. globals.ErrorHandler.klass);
  26269. smalltalk.addClass('Finder', globals.Service, [], 'Kernel-Infrastructure');
  26270. //>>excludeStart("ide", pragmas.excludeIdeData);
  26271. 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.";
  26272. //>>excludeEnd("ide");
  26273. smalltalk.addMethod(
  26274. smalltalk.method({
  26275. selector: "findClass:",
  26276. protocol: 'finding',
  26277. fn: function (aClass){
  26278. var self=this;
  26279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26280. return smalltalk.withContext(function($ctx1) {
  26281. //>>excludeEnd("ctx");
  26282. var $1;
  26283. $1=_st(self._current())._findClass_(aClass);
  26284. return $1;
  26285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26286. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},globals.Finder.klass)});
  26287. //>>excludeEnd("ctx");
  26288. },
  26289. //>>excludeStart("ide", pragmas.excludeIdeData);
  26290. args: ["aClass"],
  26291. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26292. referencedClasses: [],
  26293. //>>excludeEnd("ide");
  26294. messageSends: ["findClass:", "current"]
  26295. }),
  26296. globals.Finder.klass);
  26297. smalltalk.addMethod(
  26298. smalltalk.method({
  26299. selector: "findMethod:",
  26300. protocol: 'finding',
  26301. fn: function (aCompiledMethod){
  26302. var self=this;
  26303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26304. return smalltalk.withContext(function($ctx1) {
  26305. //>>excludeEnd("ctx");
  26306. var $1;
  26307. $1=_st(self._current())._findMethod_(aCompiledMethod);
  26308. return $1;
  26309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26310. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},globals.Finder.klass)});
  26311. //>>excludeEnd("ctx");
  26312. },
  26313. //>>excludeStart("ide", pragmas.excludeIdeData);
  26314. args: ["aCompiledMethod"],
  26315. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26316. referencedClasses: [],
  26317. //>>excludeEnd("ide");
  26318. messageSends: ["findMethod:", "current"]
  26319. }),
  26320. globals.Finder.klass);
  26321. smalltalk.addMethod(
  26322. smalltalk.method({
  26323. selector: "findString:",
  26324. protocol: 'finding',
  26325. fn: function (aString){
  26326. var self=this;
  26327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26328. return smalltalk.withContext(function($ctx1) {
  26329. //>>excludeEnd("ctx");
  26330. var $1;
  26331. $1=_st(self._current())._findString_(aString);
  26332. return $1;
  26333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26334. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},globals.Finder.klass)});
  26335. //>>excludeEnd("ctx");
  26336. },
  26337. //>>excludeStart("ide", pragmas.excludeIdeData);
  26338. args: ["aString"],
  26339. source: "findString: aString\x0a\x09^ self current findString: aString",
  26340. referencedClasses: [],
  26341. //>>excludeEnd("ide");
  26342. messageSends: ["findString:", "current"]
  26343. }),
  26344. globals.Finder.klass);
  26345. smalltalk.addClass('Inspector', globals.Service, [], 'Kernel-Infrastructure');
  26346. //>>excludeStart("ide", pragmas.excludeIdeData);
  26347. globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26348. //>>excludeEnd("ide");
  26349. smalltalk.addMethod(
  26350. smalltalk.method({
  26351. selector: "inspect:",
  26352. protocol: 'inspecting',
  26353. fn: function (anObject){
  26354. var self=this;
  26355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26356. return smalltalk.withContext(function($ctx1) {
  26357. //>>excludeEnd("ctx");
  26358. var $1;
  26359. $1=_st(self._current())._inspect_(anObject);
  26360. return $1;
  26361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26362. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Inspector.klass)});
  26363. //>>excludeEnd("ctx");
  26364. },
  26365. //>>excludeStart("ide", pragmas.excludeIdeData);
  26366. args: ["anObject"],
  26367. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26368. referencedClasses: [],
  26369. //>>excludeEnd("ide");
  26370. messageSends: ["inspect:", "current"]
  26371. }),
  26372. globals.Inspector.klass);
  26373. smalltalk.addClass('ProgressHandler', globals.Service, [], 'Kernel-Infrastructure');
  26374. //>>excludeStart("ide", pragmas.excludeIdeData);
  26375. 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`.";
  26376. //>>excludeEnd("ide");
  26377. smalltalk.addMethod(
  26378. smalltalk.method({
  26379. selector: "do:on:displaying:",
  26380. protocol: 'progress handling',
  26381. fn: function (aBlock,aCollection,aString){
  26382. var self=this;
  26383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26384. return smalltalk.withContext(function($ctx1) {
  26385. //>>excludeEnd("ctx");
  26386. _st(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26387. return self;
  26388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26389. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},globals.ProgressHandler.klass)});
  26390. //>>excludeEnd("ctx");
  26391. },
  26392. //>>excludeStart("ide", pragmas.excludeIdeData);
  26393. args: ["aBlock", "aCollection", "aString"],
  26394. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26395. referencedClasses: [],
  26396. //>>excludeEnd("ide");
  26397. messageSends: ["do:on:displaying:", "current"]
  26398. }),
  26399. globals.ProgressHandler.klass);
  26400. smalltalk.addClass('Transcript', globals.Service, [], 'Kernel-Infrastructure');
  26401. //>>excludeStart("ide", pragmas.excludeIdeData);
  26402. 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.";
  26403. //>>excludeEnd("ide");
  26404. smalltalk.addMethod(
  26405. smalltalk.method({
  26406. selector: "clear",
  26407. protocol: 'printing',
  26408. fn: function (){
  26409. var self=this;
  26410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26411. return smalltalk.withContext(function($ctx1) {
  26412. //>>excludeEnd("ctx");
  26413. _st(self._current())._clear();
  26414. return self;
  26415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26416. }, function($ctx1) {$ctx1.fill(self,"clear",{},globals.Transcript.klass)});
  26417. //>>excludeEnd("ctx");
  26418. },
  26419. //>>excludeStart("ide", pragmas.excludeIdeData);
  26420. args: [],
  26421. source: "clear\x0a\x09self current clear",
  26422. referencedClasses: [],
  26423. //>>excludeEnd("ide");
  26424. messageSends: ["clear", "current"]
  26425. }),
  26426. globals.Transcript.klass);
  26427. smalltalk.addMethod(
  26428. smalltalk.method({
  26429. selector: "cr",
  26430. protocol: 'printing',
  26431. fn: function (){
  26432. var self=this;
  26433. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  26434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26435. return smalltalk.withContext(function($ctx1) {
  26436. //>>excludeEnd("ctx");
  26437. _st(self._current())._show_(_st($String())._cr());
  26438. return self;
  26439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26440. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.Transcript.klass)});
  26441. //>>excludeEnd("ctx");
  26442. },
  26443. //>>excludeStart("ide", pragmas.excludeIdeData);
  26444. args: [],
  26445. source: "cr\x0a\x09self current show: String cr",
  26446. referencedClasses: ["String"],
  26447. //>>excludeEnd("ide");
  26448. messageSends: ["show:", "current", "cr"]
  26449. }),
  26450. globals.Transcript.klass);
  26451. smalltalk.addMethod(
  26452. smalltalk.method({
  26453. selector: "inspect:",
  26454. protocol: 'printing',
  26455. fn: function (anObject){
  26456. var self=this;
  26457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26458. return smalltalk.withContext(function($ctx1) {
  26459. //>>excludeEnd("ctx");
  26460. self._show_(anObject);
  26461. return self;
  26462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26463. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.Transcript.klass)});
  26464. //>>excludeEnd("ctx");
  26465. },
  26466. //>>excludeStart("ide", pragmas.excludeIdeData);
  26467. args: ["anObject"],
  26468. source: "inspect: anObject\x0a\x09self show: anObject",
  26469. referencedClasses: [],
  26470. //>>excludeEnd("ide");
  26471. messageSends: ["show:"]
  26472. }),
  26473. globals.Transcript.klass);
  26474. smalltalk.addMethod(
  26475. smalltalk.method({
  26476. selector: "open",
  26477. protocol: 'instance creation',
  26478. fn: function (){
  26479. var self=this;
  26480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26481. return smalltalk.withContext(function($ctx1) {
  26482. //>>excludeEnd("ctx");
  26483. _st(self._current())._open();
  26484. return self;
  26485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26486. }, function($ctx1) {$ctx1.fill(self,"open",{},globals.Transcript.klass)});
  26487. //>>excludeEnd("ctx");
  26488. },
  26489. //>>excludeStart("ide", pragmas.excludeIdeData);
  26490. args: [],
  26491. source: "open\x0a\x09self current open",
  26492. referencedClasses: [],
  26493. //>>excludeEnd("ide");
  26494. messageSends: ["open", "current"]
  26495. }),
  26496. globals.Transcript.klass);
  26497. smalltalk.addMethod(
  26498. smalltalk.method({
  26499. selector: "show:",
  26500. protocol: 'printing',
  26501. fn: function (anObject){
  26502. var self=this;
  26503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26504. return smalltalk.withContext(function($ctx1) {
  26505. //>>excludeEnd("ctx");
  26506. _st(self._current())._show_(anObject);
  26507. return self;
  26508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26509. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.Transcript.klass)});
  26510. //>>excludeEnd("ctx");
  26511. },
  26512. //>>excludeStart("ide", pragmas.excludeIdeData);
  26513. args: ["anObject"],
  26514. source: "show: anObject\x0a\x09self current show: anObject",
  26515. referencedClasses: [],
  26516. //>>excludeEnd("ide");
  26517. messageSends: ["show:", "current"]
  26518. }),
  26519. globals.Transcript.klass);
  26520. smalltalk.addClass('Setting', globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  26521. //>>excludeStart("ide", pragmas.excludeIdeData);
  26522. 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'`.";
  26523. //>>excludeEnd("ide");
  26524. smalltalk.addMethod(
  26525. smalltalk.method({
  26526. selector: "defaultValue",
  26527. protocol: 'accessing',
  26528. fn: function (){
  26529. var self=this;
  26530. var $1;
  26531. $1=self["@defaultValue"];
  26532. return $1;
  26533. },
  26534. //>>excludeStart("ide", pragmas.excludeIdeData);
  26535. args: [],
  26536. source: "defaultValue\x0a\x09^ defaultValue",
  26537. referencedClasses: [],
  26538. //>>excludeEnd("ide");
  26539. messageSends: []
  26540. }),
  26541. globals.Setting);
  26542. smalltalk.addMethod(
  26543. smalltalk.method({
  26544. selector: "defaultValue:",
  26545. protocol: 'accessing',
  26546. fn: function (anObject){
  26547. var self=this;
  26548. self["@defaultValue"]=anObject;
  26549. return self;
  26550. },
  26551. //>>excludeStart("ide", pragmas.excludeIdeData);
  26552. args: ["anObject"],
  26553. source: "defaultValue: anObject\x0a\x09defaultValue := anObject",
  26554. referencedClasses: [],
  26555. //>>excludeEnd("ide");
  26556. messageSends: []
  26557. }),
  26558. globals.Setting);
  26559. smalltalk.addMethod(
  26560. smalltalk.method({
  26561. selector: "key",
  26562. protocol: 'accessing',
  26563. fn: function (){
  26564. var self=this;
  26565. var $1;
  26566. $1=self["@key"];
  26567. return $1;
  26568. },
  26569. //>>excludeStart("ide", pragmas.excludeIdeData);
  26570. args: [],
  26571. source: "key\x0a\x09^ key",
  26572. referencedClasses: [],
  26573. //>>excludeEnd("ide");
  26574. messageSends: []
  26575. }),
  26576. globals.Setting);
  26577. smalltalk.addMethod(
  26578. smalltalk.method({
  26579. selector: "key:",
  26580. protocol: 'accessing',
  26581. fn: function (anObject){
  26582. var self=this;
  26583. self["@key"]=anObject;
  26584. return self;
  26585. },
  26586. //>>excludeStart("ide", pragmas.excludeIdeData);
  26587. args: ["anObject"],
  26588. source: "key: anObject\x0a\x09key := anObject",
  26589. referencedClasses: [],
  26590. //>>excludeEnd("ide");
  26591. messageSends: []
  26592. }),
  26593. globals.Setting);
  26594. smalltalk.addMethod(
  26595. smalltalk.method({
  26596. selector: "value",
  26597. protocol: 'accessing',
  26598. fn: function (){
  26599. var self=this;
  26600. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26602. return smalltalk.withContext(function($ctx1) {
  26603. //>>excludeEnd("ctx");
  26604. var $1;
  26605. $1=_st(_st($Smalltalk())._settings())._at_ifAbsent_(self._key(),(function(){
  26606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26607. return smalltalk.withContext(function($ctx2) {
  26608. //>>excludeEnd("ctx");
  26609. return self._defaultValue();
  26610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26611. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26612. //>>excludeEnd("ctx");
  26613. }));
  26614. return $1;
  26615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26616. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.Setting)});
  26617. //>>excludeEnd("ctx");
  26618. },
  26619. //>>excludeStart("ide", pragmas.excludeIdeData);
  26620. args: [],
  26621. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  26622. referencedClasses: ["Smalltalk"],
  26623. //>>excludeEnd("ide");
  26624. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  26625. }),
  26626. globals.Setting);
  26627. smalltalk.addMethod(
  26628. smalltalk.method({
  26629. selector: "value:",
  26630. protocol: 'accessing',
  26631. fn: function (aString){
  26632. var self=this;
  26633. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  26634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26635. return smalltalk.withContext(function($ctx1) {
  26636. //>>excludeEnd("ctx");
  26637. var $1;
  26638. $1=_st(_st($Smalltalk())._settings())._at_put_(self._key(),aString);
  26639. return $1;
  26640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26641. }, function($ctx1) {$ctx1.fill(self,"value:",{aString:aString},globals.Setting)});
  26642. //>>excludeEnd("ctx");
  26643. },
  26644. //>>excludeStart("ide", pragmas.excludeIdeData);
  26645. args: ["aString"],
  26646. source: "value: aString\x0a\x09^ Smalltalk settings at: self key put: aString",
  26647. referencedClasses: ["Smalltalk"],
  26648. //>>excludeEnd("ide");
  26649. messageSends: ["at:put:", "settings", "key"]
  26650. }),
  26651. globals.Setting);
  26652. smalltalk.addMethod(
  26653. smalltalk.method({
  26654. selector: "at:ifAbsent:",
  26655. protocol: 'instance creation',
  26656. fn: function (aString,anotherString){
  26657. var self=this;
  26658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26659. return smalltalk.withContext(function($ctx1) {
  26660. //>>excludeEnd("ctx");
  26661. var $2,$3,$1;
  26662. $2=(
  26663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26664. $ctx1.supercall = true,
  26665. //>>excludeEnd("ctx");
  26666. globals.Setting.klass.superclass.fn.prototype._new.apply(_st(self), []));
  26667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26668. $ctx1.supercall = false;
  26669. //>>excludeEnd("ctx");;
  26670. _st($2)._key_(aString);
  26671. _st($2)._defaultValue_(anotherString);
  26672. $3=_st($2)._yourself();
  26673. $1=$3;
  26674. return $1;
  26675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26676. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,anotherString:anotherString},globals.Setting.klass)});
  26677. //>>excludeEnd("ctx");
  26678. },
  26679. //>>excludeStart("ide", pragmas.excludeIdeData);
  26680. args: ["aString", "anotherString"],
  26681. source: "at: aString ifAbsent: anotherString\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: anotherString;\x0a\x09\x09yourself",
  26682. referencedClasses: [],
  26683. //>>excludeEnd("ide");
  26684. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  26685. }),
  26686. globals.Setting.klass);
  26687. smalltalk.addMethod(
  26688. smalltalk.method({
  26689. selector: "new",
  26690. protocol: 'instance creation',
  26691. fn: function (){
  26692. var self=this;
  26693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26694. return smalltalk.withContext(function($ctx1) {
  26695. //>>excludeEnd("ctx");
  26696. self._shouldNotImplement();
  26697. return self;
  26698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26699. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.Setting.klass)});
  26700. //>>excludeEnd("ctx");
  26701. },
  26702. //>>excludeStart("ide", pragmas.excludeIdeData);
  26703. args: [],
  26704. source: "new\x0a\x09self shouldNotImplement",
  26705. referencedClasses: [],
  26706. //>>excludeEnd("ide");
  26707. messageSends: ["shouldNotImplement"]
  26708. }),
  26709. globals.Setting.klass);
  26710. smalltalk.addClass('SmalltalkImage', globals.Object, [], 'Kernel-Infrastructure');
  26711. //>>excludeStart("ide", pragmas.excludeIdeData);
  26712. 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.";
  26713. //>>excludeEnd("ide");
  26714. smalltalk.addMethod(
  26715. smalltalk.method({
  26716. selector: "addGlobalJsVariable:",
  26717. protocol: 'globals',
  26718. fn: function (aString){
  26719. var self=this;
  26720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26721. return smalltalk.withContext(function($ctx1) {
  26722. //>>excludeEnd("ctx");
  26723. _st(self._globalJsVariables())._add_(aString);
  26724. return self;
  26725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26726. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)});
  26727. //>>excludeEnd("ctx");
  26728. },
  26729. //>>excludeStart("ide", pragmas.excludeIdeData);
  26730. args: ["aString"],
  26731. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  26732. referencedClasses: [],
  26733. //>>excludeEnd("ide");
  26734. messageSends: ["add:", "globalJsVariables"]
  26735. }),
  26736. globals.SmalltalkImage);
  26737. smalltalk.addMethod(
  26738. smalltalk.method({
  26739. selector: "amdRequire",
  26740. protocol: 'accessing amd',
  26741. fn: function (){
  26742. var self=this;
  26743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26744. return smalltalk.withContext(function($ctx1) {
  26745. //>>excludeEnd("ctx");
  26746. var $1;
  26747. $1=_st(self._vm())._at_("amdRequire");
  26748. return $1;
  26749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26750. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},globals.SmalltalkImage)});
  26751. //>>excludeEnd("ctx");
  26752. },
  26753. //>>excludeStart("ide", pragmas.excludeIdeData);
  26754. args: [],
  26755. source: "amdRequire\x0a\x09^ self vm at: 'amdRequire'",
  26756. referencedClasses: [],
  26757. //>>excludeEnd("ide");
  26758. messageSends: ["at:", "vm"]
  26759. }),
  26760. globals.SmalltalkImage);
  26761. smalltalk.addMethod(
  26762. smalltalk.method({
  26763. selector: "asSmalltalkException:",
  26764. protocol: 'error handling',
  26765. fn: function (anObject){
  26766. var self=this;
  26767. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  26768. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  26769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26770. return smalltalk.withContext(function($ctx1) {
  26771. //>>excludeEnd("ctx");
  26772. var $2,$1;
  26773. $2=_st(self._isSmalltalkObject_(anObject))._and_((function(){
  26774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26775. return smalltalk.withContext(function($ctx2) {
  26776. //>>excludeEnd("ctx");
  26777. return _st(anObject)._isKindOf_($Error());
  26778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26779. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26780. //>>excludeEnd("ctx");
  26781. }));
  26782. if(smalltalk.assert($2)){
  26783. $1=anObject;
  26784. } else {
  26785. $1=_st($JavaScriptException())._on_(anObject);
  26786. };
  26787. return $1;
  26788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26789. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},globals.SmalltalkImage)});
  26790. //>>excludeEnd("ctx");
  26791. },
  26792. //>>excludeStart("ide", pragmas.excludeIdeData);
  26793. args: ["anObject"],
  26794. 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 ]",
  26795. referencedClasses: ["Error", "JavaScriptException"],
  26796. //>>excludeEnd("ide");
  26797. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  26798. }),
  26799. globals.SmalltalkImage);
  26800. smalltalk.addMethod(
  26801. smalltalk.method({
  26802. selector: "at:",
  26803. protocol: 'accessing',
  26804. fn: function (aString){
  26805. var self=this;
  26806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26807. return smalltalk.withContext(function($ctx1) {
  26808. //>>excludeEnd("ctx");
  26809. var $1;
  26810. self._deprecatedAPI();
  26811. $1=_st(self._globals())._at_(aString);
  26812. return $1;
  26813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26814. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},globals.SmalltalkImage)});
  26815. //>>excludeEnd("ctx");
  26816. },
  26817. //>>excludeStart("ide", pragmas.excludeIdeData);
  26818. args: ["aString"],
  26819. source: "at: aString\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString",
  26820. referencedClasses: [],
  26821. //>>excludeEnd("ide");
  26822. messageSends: ["deprecatedAPI", "at:", "globals"]
  26823. }),
  26824. globals.SmalltalkImage);
  26825. smalltalk.addMethod(
  26826. smalltalk.method({
  26827. selector: "at:ifAbsent:",
  26828. protocol: 'accessing',
  26829. fn: function (aKey,aBlock){
  26830. var self=this;
  26831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26832. return smalltalk.withContext(function($ctx1) {
  26833. //>>excludeEnd("ctx");
  26834. var $1;
  26835. self._deprecatedAPI();
  26836. $1=_st(self._globals())._at_ifAbsent_(aKey,aBlock);
  26837. return $1;
  26838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26839. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.SmalltalkImage)});
  26840. //>>excludeEnd("ctx");
  26841. },
  26842. //>>excludeStart("ide", pragmas.excludeIdeData);
  26843. args: ["aKey", "aBlock"],
  26844. source: "at: aKey ifAbsent: aBlock\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aKey ifAbsent: aBlock",
  26845. referencedClasses: [],
  26846. //>>excludeEnd("ide");
  26847. messageSends: ["deprecatedAPI", "at:ifAbsent:", "globals"]
  26848. }),
  26849. globals.SmalltalkImage);
  26850. smalltalk.addMethod(
  26851. smalltalk.method({
  26852. selector: "at:put:",
  26853. protocol: 'accessing',
  26854. fn: function (aString,anObject){
  26855. var self=this;
  26856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26857. return smalltalk.withContext(function($ctx1) {
  26858. //>>excludeEnd("ctx");
  26859. var $1;
  26860. self._deprecatedAPI();
  26861. $1=_st(self._globals())._at_put_(aString,anObject);
  26862. return $1;
  26863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26864. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},globals.SmalltalkImage)});
  26865. //>>excludeEnd("ctx");
  26866. },
  26867. //>>excludeStart("ide", pragmas.excludeIdeData);
  26868. args: ["aString", "anObject"],
  26869. source: "at: aString put: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ self globals at: aString put: anObject",
  26870. referencedClasses: [],
  26871. //>>excludeEnd("ide");
  26872. messageSends: ["deprecatedAPI", "at:put:", "globals"]
  26873. }),
  26874. globals.SmalltalkImage);
  26875. smalltalk.addMethod(
  26876. smalltalk.method({
  26877. selector: "basicCreatePackage:",
  26878. protocol: 'private',
  26879. fn: function (packageName){
  26880. var self=this;
  26881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26882. return smalltalk.withContext(function($ctx1) {
  26883. //>>excludeEnd("ctx");
  26884. return smalltalk.addPackage(packageName);
  26885. return self;
  26886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26887. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},globals.SmalltalkImage)});
  26888. //>>excludeEnd("ctx");
  26889. },
  26890. //>>excludeStart("ide", pragmas.excludeIdeData);
  26891. args: ["packageName"],
  26892. 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)>",
  26893. referencedClasses: [],
  26894. //>>excludeEnd("ide");
  26895. messageSends: []
  26896. }),
  26897. globals.SmalltalkImage);
  26898. smalltalk.addMethod(
  26899. smalltalk.method({
  26900. selector: "basicParse:",
  26901. protocol: 'private',
  26902. fn: function (aString){
  26903. var self=this;
  26904. function $SmalltalkParser(){return globals.SmalltalkParser||(typeof SmalltalkParser=="undefined"?nil:SmalltalkParser)}
  26905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26906. return smalltalk.withContext(function($ctx1) {
  26907. //>>excludeEnd("ctx");
  26908. var $1;
  26909. $1=_st($SmalltalkParser())._parse_(aString);
  26910. return $1;
  26911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26912. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},globals.SmalltalkImage)});
  26913. //>>excludeEnd("ctx");
  26914. },
  26915. //>>excludeStart("ide", pragmas.excludeIdeData);
  26916. args: ["aString"],
  26917. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  26918. referencedClasses: ["SmalltalkParser"],
  26919. //>>excludeEnd("ide");
  26920. messageSends: ["parse:"]
  26921. }),
  26922. globals.SmalltalkImage);
  26923. smalltalk.addMethod(
  26924. smalltalk.method({
  26925. selector: "classes",
  26926. protocol: 'classes',
  26927. fn: function (){
  26928. var self=this;
  26929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26930. return smalltalk.withContext(function($ctx1) {
  26931. //>>excludeEnd("ctx");
  26932. return smalltalk.classes();
  26933. return self;
  26934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26935. }, function($ctx1) {$ctx1.fill(self,"classes",{},globals.SmalltalkImage)});
  26936. //>>excludeEnd("ctx");
  26937. },
  26938. //>>excludeStart("ide", pragmas.excludeIdeData);
  26939. args: [],
  26940. source: "classes\x0a\x09<return smalltalk.classes()>",
  26941. referencedClasses: [],
  26942. //>>excludeEnd("ide");
  26943. messageSends: []
  26944. }),
  26945. globals.SmalltalkImage);
  26946. smalltalk.addMethod(
  26947. smalltalk.method({
  26948. selector: "createPackage:",
  26949. protocol: 'packages',
  26950. fn: function (packageName){
  26951. var self=this;
  26952. var package_,announcement;
  26953. function $PackageAdded(){return globals.PackageAdded||(typeof PackageAdded=="undefined"?nil:PackageAdded)}
  26954. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  26955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26956. return smalltalk.withContext(function($ctx1) {
  26957. //>>excludeEnd("ctx");
  26958. var $1,$2,$3;
  26959. package_=self._basicCreatePackage_(packageName);
  26960. $1=_st($PackageAdded())._new();
  26961. _st($1)._package_(package_);
  26962. $2=_st($1)._yourself();
  26963. announcement=$2;
  26964. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  26965. $3=package_;
  26966. return $3;
  26967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26968. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},globals.SmalltalkImage)});
  26969. //>>excludeEnd("ctx");
  26970. },
  26971. //>>excludeStart("ide", pragmas.excludeIdeData);
  26972. args: ["packageName"],
  26973. 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",
  26974. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  26975. //>>excludeEnd("ide");
  26976. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  26977. }),
  26978. globals.SmalltalkImage);
  26979. smalltalk.addMethod(
  26980. smalltalk.method({
  26981. selector: "createPackage:properties:",
  26982. protocol: 'private',
  26983. fn: function (packageName,aDict){
  26984. var self=this;
  26985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26986. return smalltalk.withContext(function($ctx1) {
  26987. //>>excludeEnd("ctx");
  26988. var $1,$2;
  26989. self._deprecatedAPI();
  26990. $1=_st(aDict)._isEmpty();
  26991. if(! smalltalk.assert($1)){
  26992. self._error_("createPackage:properties: called with nonempty properties");
  26993. };
  26994. $2=self._createPackage_(packageName);
  26995. return $2;
  26996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26997. }, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},globals.SmalltalkImage)});
  26998. //>>excludeEnd("ctx");
  26999. },
  27000. //>>excludeStart("ide", pragmas.excludeIdeData);
  27001. args: ["packageName", "aDict"],
  27002. 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",
  27003. referencedClasses: [],
  27004. //>>excludeEnd("ide");
  27005. messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"]
  27006. }),
  27007. globals.SmalltalkImage);
  27008. smalltalk.addMethod(
  27009. smalltalk.method({
  27010. selector: "current",
  27011. protocol: 'accessing',
  27012. fn: function (){
  27013. var self=this;
  27014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27015. return smalltalk.withContext(function($ctx1) {
  27016. //>>excludeEnd("ctx");
  27017. self._deprecatedAPI();
  27018. return self;
  27019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27020. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage)});
  27021. //>>excludeEnd("ctx");
  27022. },
  27023. //>>excludeStart("ide", pragmas.excludeIdeData);
  27024. args: [],
  27025. source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
  27026. referencedClasses: [],
  27027. //>>excludeEnd("ide");
  27028. messageSends: ["deprecatedAPI"]
  27029. }),
  27030. globals.SmalltalkImage);
  27031. smalltalk.addMethod(
  27032. smalltalk.method({
  27033. selector: "defaultAmdNamespace",
  27034. protocol: 'accessing amd',
  27035. fn: function (){
  27036. var self=this;
  27037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27038. return smalltalk.withContext(function($ctx1) {
  27039. //>>excludeEnd("ctx");
  27040. var $1;
  27041. $1="transport.defaultAmdNamespace"._settingValue();
  27042. return $1;
  27043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27044. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},globals.SmalltalkImage)});
  27045. //>>excludeEnd("ctx");
  27046. },
  27047. //>>excludeStart("ide", pragmas.excludeIdeData);
  27048. args: [],
  27049. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  27050. referencedClasses: [],
  27051. //>>excludeEnd("ide");
  27052. messageSends: ["settingValue"]
  27053. }),
  27054. globals.SmalltalkImage);
  27055. smalltalk.addMethod(
  27056. smalltalk.method({
  27057. selector: "defaultAmdNamespace:",
  27058. protocol: 'accessing amd',
  27059. fn: function (aString){
  27060. var self=this;
  27061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27062. return smalltalk.withContext(function($ctx1) {
  27063. //>>excludeEnd("ctx");
  27064. "transport.defaultAmdNamespace"._settingValue_(aString);
  27065. return self;
  27066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27067. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},globals.SmalltalkImage)});
  27068. //>>excludeEnd("ctx");
  27069. },
  27070. //>>excludeStart("ide", pragmas.excludeIdeData);
  27071. args: ["aString"],
  27072. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  27073. referencedClasses: [],
  27074. //>>excludeEnd("ide");
  27075. messageSends: ["settingValue:"]
  27076. }),
  27077. globals.SmalltalkImage);
  27078. smalltalk.addMethod(
  27079. smalltalk.method({
  27080. selector: "deleteClass:",
  27081. protocol: 'private',
  27082. fn: function (aClass){
  27083. var self=this;
  27084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27085. return smalltalk.withContext(function($ctx1) {
  27086. //>>excludeEnd("ctx");
  27087. smalltalk.removeClass(aClass);
  27088. return self;
  27089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27090. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},globals.SmalltalkImage)});
  27091. //>>excludeEnd("ctx");
  27092. },
  27093. //>>excludeStart("ide", pragmas.excludeIdeData);
  27094. args: ["aClass"],
  27095. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
  27096. referencedClasses: [],
  27097. //>>excludeEnd("ide");
  27098. messageSends: []
  27099. }),
  27100. globals.SmalltalkImage);
  27101. smalltalk.addMethod(
  27102. smalltalk.method({
  27103. selector: "deleteGlobalJsVariable:",
  27104. protocol: 'globals',
  27105. fn: function (aString){
  27106. var self=this;
  27107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27108. return smalltalk.withContext(function($ctx1) {
  27109. //>>excludeEnd("ctx");
  27110. _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  27111. }));
  27112. return self;
  27113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27114. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},globals.SmalltalkImage)});
  27115. //>>excludeEnd("ctx");
  27116. },
  27117. //>>excludeStart("ide", pragmas.excludeIdeData);
  27118. args: ["aString"],
  27119. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  27120. referencedClasses: [],
  27121. //>>excludeEnd("ide");
  27122. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  27123. }),
  27124. globals.SmalltalkImage);
  27125. smalltalk.addMethod(
  27126. smalltalk.method({
  27127. selector: "deletePackage:",
  27128. protocol: 'private',
  27129. fn: function (packageName){
  27130. var self=this;
  27131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27132. return smalltalk.withContext(function($ctx1) {
  27133. //>>excludeEnd("ctx");
  27134. delete smalltalk.packages[packageName];
  27135. return self;
  27136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27137. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},globals.SmalltalkImage)});
  27138. //>>excludeEnd("ctx");
  27139. },
  27140. //>>excludeStart("ide", pragmas.excludeIdeData);
  27141. args: ["packageName"],
  27142. 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]>",
  27143. referencedClasses: [],
  27144. //>>excludeEnd("ide");
  27145. messageSends: []
  27146. }),
  27147. globals.SmalltalkImage);
  27148. smalltalk.addMethod(
  27149. smalltalk.method({
  27150. selector: "globalJsVariables",
  27151. protocol: 'globals',
  27152. fn: function (){
  27153. var self=this;
  27154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27155. return smalltalk.withContext(function($ctx1) {
  27156. //>>excludeEnd("ctx");
  27157. return smalltalk.globalJsVariables;
  27158. return self;
  27159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27160. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},globals.SmalltalkImage)});
  27161. //>>excludeEnd("ctx");
  27162. },
  27163. //>>excludeStart("ide", pragmas.excludeIdeData);
  27164. args: [],
  27165. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
  27166. referencedClasses: [],
  27167. //>>excludeEnd("ide");
  27168. messageSends: []
  27169. }),
  27170. globals.SmalltalkImage);
  27171. smalltalk.addMethod(
  27172. smalltalk.method({
  27173. selector: "globals",
  27174. protocol: 'accessing',
  27175. fn: function (){
  27176. var self=this;
  27177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27178. return smalltalk.withContext(function($ctx1) {
  27179. //>>excludeEnd("ctx");
  27180. return globals;
  27181. return self;
  27182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27183. }, function($ctx1) {$ctx1.fill(self,"globals",{},globals.SmalltalkImage)});
  27184. //>>excludeEnd("ctx");
  27185. },
  27186. //>>excludeStart("ide", pragmas.excludeIdeData);
  27187. args: [],
  27188. source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09<return globals>",
  27189. referencedClasses: [],
  27190. //>>excludeEnd("ide");
  27191. messageSends: []
  27192. }),
  27193. globals.SmalltalkImage);
  27194. smalltalk.addMethod(
  27195. smalltalk.method({
  27196. selector: "includesKey:",
  27197. protocol: 'accessing',
  27198. fn: function (aKey){
  27199. var self=this;
  27200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27201. return smalltalk.withContext(function($ctx1) {
  27202. //>>excludeEnd("ctx");
  27203. return smalltalk.hasOwnProperty(aKey);
  27204. return self;
  27205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27206. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.SmalltalkImage)});
  27207. //>>excludeEnd("ctx");
  27208. },
  27209. //>>excludeStart("ide", pragmas.excludeIdeData);
  27210. args: ["aKey"],
  27211. source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
  27212. referencedClasses: [],
  27213. //>>excludeEnd("ide");
  27214. messageSends: []
  27215. }),
  27216. globals.SmalltalkImage);
  27217. smalltalk.addMethod(
  27218. smalltalk.method({
  27219. selector: "isSmalltalkObject:",
  27220. protocol: 'testing',
  27221. fn: function (anObject){
  27222. var self=this;
  27223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27224. return smalltalk.withContext(function($ctx1) {
  27225. //>>excludeEnd("ctx");
  27226. return typeof anObject.klass !== 'undefined';
  27227. return self;
  27228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27229. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},globals.SmalltalkImage)});
  27230. //>>excludeEnd("ctx");
  27231. },
  27232. //>>excludeStart("ide", pragmas.excludeIdeData);
  27233. args: ["anObject"],
  27234. 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'>",
  27235. referencedClasses: [],
  27236. //>>excludeEnd("ide");
  27237. messageSends: []
  27238. }),
  27239. globals.SmalltalkImage);
  27240. smalltalk.addMethod(
  27241. smalltalk.method({
  27242. selector: "packageAt:",
  27243. protocol: 'packages',
  27244. fn: function (packageName){
  27245. var self=this;
  27246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27247. return smalltalk.withContext(function($ctx1) {
  27248. //>>excludeEnd("ctx");
  27249. return smalltalk.packages[packageName];
  27250. return self;
  27251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27252. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},globals.SmalltalkImage)});
  27253. //>>excludeEnd("ctx");
  27254. },
  27255. //>>excludeStart("ide", pragmas.excludeIdeData);
  27256. args: ["packageName"],
  27257. source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
  27258. referencedClasses: [],
  27259. //>>excludeEnd("ide");
  27260. messageSends: []
  27261. }),
  27262. globals.SmalltalkImage);
  27263. smalltalk.addMethod(
  27264. smalltalk.method({
  27265. selector: "packageAt:ifAbsent:",
  27266. protocol: 'packages',
  27267. fn: function (packageName,aBlock){
  27268. var self=this;
  27269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27270. return smalltalk.withContext(function($ctx1) {
  27271. //>>excludeEnd("ctx");
  27272. var $2,$1;
  27273. $2=self._packageAt_(packageName);
  27274. $1=_st($2)._ifNil_(aBlock);
  27275. return $1;
  27276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27277. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},globals.SmalltalkImage)});
  27278. //>>excludeEnd("ctx");
  27279. },
  27280. //>>excludeStart("ide", pragmas.excludeIdeData);
  27281. args: ["packageName", "aBlock"],
  27282. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  27283. referencedClasses: [],
  27284. //>>excludeEnd("ide");
  27285. messageSends: ["ifNil:", "packageAt:"]
  27286. }),
  27287. globals.SmalltalkImage);
  27288. smalltalk.addMethod(
  27289. smalltalk.method({
  27290. selector: "packages",
  27291. protocol: 'packages',
  27292. fn: function (){
  27293. var self=this;
  27294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27295. return smalltalk.withContext(function($ctx1) {
  27296. //>>excludeEnd("ctx");
  27297. return Object.keys(smalltalk.packages).map(function(k) {
  27298. return smalltalk.packages[k];
  27299. })
  27300. ;
  27301. return self;
  27302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27303. }, function($ctx1) {$ctx1.fill(self,"packages",{},globals.SmalltalkImage)});
  27304. //>>excludeEnd("ctx");
  27305. },
  27306. //>>excludeStart("ide", pragmas.excludeIdeData);
  27307. args: [],
  27308. 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>",
  27309. referencedClasses: [],
  27310. //>>excludeEnd("ide");
  27311. messageSends: []
  27312. }),
  27313. globals.SmalltalkImage);
  27314. smalltalk.addMethod(
  27315. smalltalk.method({
  27316. selector: "parse:",
  27317. protocol: 'accessing',
  27318. fn: function (aString){
  27319. var self=this;
  27320. var result;
  27321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27322. return smalltalk.withContext(function($ctx1) {
  27323. //>>excludeEnd("ctx");
  27324. var $2,$3,$1;
  27325. _st((function(){
  27326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27327. return smalltalk.withContext(function($ctx2) {
  27328. //>>excludeEnd("ctx");
  27329. result=self._basicParse_(aString);
  27330. return result;
  27331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27333. //>>excludeEnd("ctx");
  27334. }))._tryCatch_((function(ex){
  27335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27336. return smalltalk.withContext(function($ctx2) {
  27337. //>>excludeEnd("ctx");
  27338. return _st(self._parseError_parsing_(ex,aString))._signal();
  27339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  27341. //>>excludeEnd("ctx");
  27342. }));
  27343. $2=result;
  27344. _st($2)._source_(aString);
  27345. $3=_st($2)._yourself();
  27346. $1=$3;
  27347. return $1;
  27348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27349. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},globals.SmalltalkImage)});
  27350. //>>excludeEnd("ctx");
  27351. },
  27352. //>>excludeStart("ide", pragmas.excludeIdeData);
  27353. args: ["aString"],
  27354. 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",
  27355. referencedClasses: [],
  27356. //>>excludeEnd("ide");
  27357. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  27358. }),
  27359. globals.SmalltalkImage);
  27360. smalltalk.addMethod(
  27361. smalltalk.method({
  27362. selector: "parseError:parsing:",
  27363. protocol: 'error handling',
  27364. fn: function (anException,aString){
  27365. var self=this;
  27366. function $ParseError(){return globals.ParseError||(typeof ParseError=="undefined"?nil:ParseError)}
  27367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27368. return smalltalk.withContext(function($ctx1) {
  27369. //>>excludeEnd("ctx");
  27370. var $2,$8,$7,$6,$9,$5,$4,$3,$1;
  27371. $2=_st($ParseError())._new();
  27372. $8=_st(anException)._basicAt_("line");
  27373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27374. $ctx1.sendIdx["basicAt:"]=1;
  27375. //>>excludeEnd("ctx");
  27376. $7="Parse error on line ".__comma($8);
  27377. $6=_st($7).__comma(" column ");
  27378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27379. $ctx1.sendIdx[","]=4;
  27380. //>>excludeEnd("ctx");
  27381. $9=_st(anException)._basicAt_("column");
  27382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27383. $ctx1.sendIdx["basicAt:"]=2;
  27384. //>>excludeEnd("ctx");
  27385. $5=_st($6).__comma($9);
  27386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27387. $ctx1.sendIdx[","]=3;
  27388. //>>excludeEnd("ctx");
  27389. $4=_st($5).__comma(" : Unexpected character ");
  27390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27391. $ctx1.sendIdx[","]=2;
  27392. //>>excludeEnd("ctx");
  27393. $3=_st($4).__comma(_st(anException)._basicAt_("found"));
  27394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27395. $ctx1.sendIdx[","]=1;
  27396. //>>excludeEnd("ctx");
  27397. $1=_st($2)._messageText_($3);
  27398. return $1;
  27399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27400. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},globals.SmalltalkImage)});
  27401. //>>excludeEnd("ctx");
  27402. },
  27403. //>>excludeStart("ide", pragmas.excludeIdeData);
  27404. args: ["anException", "aString"],
  27405. 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')",
  27406. referencedClasses: ["ParseError"],
  27407. //>>excludeEnd("ide");
  27408. messageSends: ["messageText:", "new", ",", "basicAt:"]
  27409. }),
  27410. globals.SmalltalkImage);
  27411. smalltalk.addMethod(
  27412. smalltalk.method({
  27413. selector: "pseudoVariableNames",
  27414. protocol: 'accessing',
  27415. fn: function (){
  27416. var self=this;
  27417. var $1;
  27418. $1=["self", "super", "nil", "true", "false", "thisContext"];
  27419. return $1;
  27420. },
  27421. //>>excludeStart("ide", pragmas.excludeIdeData);
  27422. args: [],
  27423. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  27424. referencedClasses: [],
  27425. //>>excludeEnd("ide");
  27426. messageSends: []
  27427. }),
  27428. globals.SmalltalkImage);
  27429. smalltalk.addMethod(
  27430. smalltalk.method({
  27431. selector: "readJSObject:",
  27432. protocol: 'accessing',
  27433. fn: function (anObject){
  27434. var self=this;
  27435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27436. return smalltalk.withContext(function($ctx1) {
  27437. //>>excludeEnd("ctx");
  27438. return smalltalk.readJSObject(anObject);
  27439. return self;
  27440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27441. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},globals.SmalltalkImage)});
  27442. //>>excludeEnd("ctx");
  27443. },
  27444. //>>excludeStart("ide", pragmas.excludeIdeData);
  27445. args: ["anObject"],
  27446. source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
  27447. referencedClasses: [],
  27448. //>>excludeEnd("ide");
  27449. messageSends: []
  27450. }),
  27451. globals.SmalltalkImage);
  27452. smalltalk.addMethod(
  27453. smalltalk.method({
  27454. selector: "removeClass:",
  27455. protocol: 'classes',
  27456. fn: function (aClass){
  27457. var self=this;
  27458. function $SystemAnnouncer(){return globals.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  27459. function $ClassRemoved(){return globals.ClassRemoved||(typeof ClassRemoved=="undefined"?nil:ClassRemoved)}
  27460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27461. return smalltalk.withContext(function($ctx1) {
  27462. //>>excludeEnd("ctx");
  27463. var $1,$2,$3;
  27464. $1=_st(aClass)._isMetaclass();
  27465. if(smalltalk.assert($1)){
  27466. self._error_(_st(_st(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  27467. };
  27468. self._deleteClass_(aClass);
  27469. $2=_st($ClassRemoved())._new();
  27470. _st($2)._theClass_(aClass);
  27471. $3=_st($2)._yourself();
  27472. _st(_st($SystemAnnouncer())._current())._announce_($3);
  27473. return self;
  27474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27475. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},globals.SmalltalkImage)});
  27476. //>>excludeEnd("ctx");
  27477. },
  27478. //>>excludeStart("ide", pragmas.excludeIdeData);
  27479. args: ["aClass"],
  27480. 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)",
  27481. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  27482. //>>excludeEnd("ide");
  27483. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  27484. }),
  27485. globals.SmalltalkImage);
  27486. smalltalk.addMethod(
  27487. smalltalk.method({
  27488. selector: "removePackage:",
  27489. protocol: 'packages',
  27490. fn: function (packageName){
  27491. var self=this;
  27492. var pkg;
  27493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27494. return smalltalk.withContext(function($ctx1) {
  27495. //>>excludeEnd("ctx");
  27496. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  27497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27498. return smalltalk.withContext(function($ctx2) {
  27499. //>>excludeEnd("ctx");
  27500. return self._error_("Missing package: ".__comma(packageName));
  27501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27503. //>>excludeEnd("ctx");
  27504. }));
  27505. _st(_st(pkg)._classes())._do_((function(each){
  27506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27507. return smalltalk.withContext(function($ctx2) {
  27508. //>>excludeEnd("ctx");
  27509. return self._removeClass_(each);
  27510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27512. //>>excludeEnd("ctx");
  27513. }));
  27514. self._deletePackage_(packageName);
  27515. return self;
  27516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27517. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},globals.SmalltalkImage)});
  27518. //>>excludeEnd("ctx");
  27519. },
  27520. //>>excludeStart("ide", pragmas.excludeIdeData);
  27521. args: ["packageName"],
  27522. 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",
  27523. referencedClasses: [],
  27524. //>>excludeEnd("ide");
  27525. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  27526. }),
  27527. globals.SmalltalkImage);
  27528. smalltalk.addMethod(
  27529. smalltalk.method({
  27530. selector: "renamePackage:to:",
  27531. protocol: 'packages',
  27532. fn: function (packageName,newName){
  27533. var self=this;
  27534. var pkg;
  27535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27536. return smalltalk.withContext(function($ctx1) {
  27537. //>>excludeEnd("ctx");
  27538. var $1,$2,$receiver;
  27539. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  27540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27541. return smalltalk.withContext(function($ctx2) {
  27542. //>>excludeEnd("ctx");
  27543. $1="Missing package: ".__comma(packageName);
  27544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27545. $ctx2.sendIdx[","]=1;
  27546. //>>excludeEnd("ctx");
  27547. return self._error_($1);
  27548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27549. $ctx2.sendIdx["error:"]=1;
  27550. //>>excludeEnd("ctx");
  27551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27552. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  27553. //>>excludeEnd("ctx");
  27554. }));
  27555. $2=self._packageAt_(newName);
  27556. if(($receiver = $2) == null || $receiver.isNil){
  27557. $2;
  27558. } else {
  27559. self._error_("Already exists a package called: ".__comma(newName));
  27560. };
  27561. _st(self._at_("packages"))._at_put_(newName,pkg);
  27562. _st(pkg)._name_(newName);
  27563. self._deletePackage_(packageName);
  27564. return self;
  27565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27566. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},globals.SmalltalkImage)});
  27567. //>>excludeEnd("ctx");
  27568. },
  27569. //>>excludeStart("ide", pragmas.excludeIdeData);
  27570. args: ["packageName", "newName"],
  27571. 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.",
  27572. referencedClasses: [],
  27573. //>>excludeEnd("ide");
  27574. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"]
  27575. }),
  27576. globals.SmalltalkImage);
  27577. smalltalk.addMethod(
  27578. smalltalk.method({
  27579. selector: "reservedWords",
  27580. protocol: 'accessing',
  27581. fn: function (){
  27582. var self=this;
  27583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27584. return smalltalk.withContext(function($ctx1) {
  27585. //>>excludeEnd("ctx");
  27586. return smalltalk.reservedWords;
  27587. return self;
  27588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27589. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},globals.SmalltalkImage)});
  27590. //>>excludeEnd("ctx");
  27591. },
  27592. //>>excludeStart("ide", pragmas.excludeIdeData);
  27593. args: [],
  27594. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
  27595. referencedClasses: [],
  27596. //>>excludeEnd("ide");
  27597. messageSends: []
  27598. }),
  27599. globals.SmalltalkImage);
  27600. smalltalk.addMethod(
  27601. smalltalk.method({
  27602. selector: "settings",
  27603. protocol: 'accessing',
  27604. fn: function (){
  27605. var self=this;
  27606. function $SmalltalkSettings(){return globals.SmalltalkSettings||(typeof SmalltalkSettings=="undefined"?nil:SmalltalkSettings)}
  27607. return $SmalltalkSettings();
  27608. },
  27609. //>>excludeStart("ide", pragmas.excludeIdeData);
  27610. args: [],
  27611. source: "settings\x0a\x09^ SmalltalkSettings",
  27612. referencedClasses: ["SmalltalkSettings"],
  27613. //>>excludeEnd("ide");
  27614. messageSends: []
  27615. }),
  27616. globals.SmalltalkImage);
  27617. smalltalk.addMethod(
  27618. smalltalk.method({
  27619. selector: "version",
  27620. protocol: 'accessing',
  27621. fn: function (){
  27622. var self=this;
  27623. return "0.13.0-pre";
  27624. },
  27625. //>>excludeStart("ide", pragmas.excludeIdeData);
  27626. args: [],
  27627. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
  27628. referencedClasses: [],
  27629. //>>excludeEnd("ide");
  27630. messageSends: []
  27631. }),
  27632. globals.SmalltalkImage);
  27633. smalltalk.addMethod(
  27634. smalltalk.method({
  27635. selector: "vm",
  27636. protocol: 'accessing',
  27637. fn: function (){
  27638. var self=this;
  27639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27640. return smalltalk.withContext(function($ctx1) {
  27641. //>>excludeEnd("ctx");
  27642. return smalltalk;
  27643. return self;
  27644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27645. }, function($ctx1) {$ctx1.fill(self,"vm",{},globals.SmalltalkImage)});
  27646. //>>excludeEnd("ctx");
  27647. },
  27648. //>>excludeStart("ide", pragmas.excludeIdeData);
  27649. args: [],
  27650. source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
  27651. referencedClasses: [],
  27652. //>>excludeEnd("ide");
  27653. messageSends: []
  27654. }),
  27655. globals.SmalltalkImage);
  27656. globals.SmalltalkImage.klass.iVarNames = ['current'];
  27657. smalltalk.addMethod(
  27658. smalltalk.method({
  27659. selector: "current",
  27660. protocol: 'instance creation',
  27661. fn: function (){
  27662. var self=this;
  27663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27664. return smalltalk.withContext(function($ctx1) {
  27665. //>>excludeEnd("ctx");
  27666. var $2,$1,$receiver;
  27667. $2=self["@current"];
  27668. if(($receiver = $2) == null || $receiver.isNil){
  27669. self["@current"]=(
  27670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27671. $ctx1.supercall = true,
  27672. //>>excludeEnd("ctx");
  27673. globals.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []));
  27674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27675. $ctx1.supercall = false;
  27676. //>>excludeEnd("ctx");;
  27677. $1=self["@current"];
  27678. } else {
  27679. self._deprecatedAPI();
  27680. $1=self["@current"];
  27681. };
  27682. return $1;
  27683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27684. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SmalltalkImage.klass)});
  27685. //>>excludeEnd("ctx");
  27686. },
  27687. //>>excludeStart("ide", pragmas.excludeIdeData);
  27688. args: [],
  27689. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  27690. referencedClasses: [],
  27691. //>>excludeEnd("ide");
  27692. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  27693. }),
  27694. globals.SmalltalkImage.klass);
  27695. smalltalk.addMethod(
  27696. smalltalk.method({
  27697. selector: "initialize",
  27698. protocol: 'initialization',
  27699. fn: function (){
  27700. var self=this;
  27701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27702. return smalltalk.withContext(function($ctx1) {
  27703. //>>excludeEnd("ctx");
  27704. _st(globals)._at_put_("Smalltalk",self._current());
  27705. return self;
  27706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27707. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.SmalltalkImage.klass)});
  27708. //>>excludeEnd("ctx");
  27709. },
  27710. //>>excludeStart("ide", pragmas.excludeIdeData);
  27711. args: [],
  27712. source: "initialize\x0a\x09globals at: 'Smalltalk' put: self current",
  27713. referencedClasses: [],
  27714. //>>excludeEnd("ide");
  27715. messageSends: ["at:put:", "current"]
  27716. }),
  27717. globals.SmalltalkImage.klass);
  27718. smalltalk.addMethod(
  27719. smalltalk.method({
  27720. selector: "new",
  27721. protocol: 'instance creation',
  27722. fn: function (){
  27723. var self=this;
  27724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27725. return smalltalk.withContext(function($ctx1) {
  27726. //>>excludeEnd("ctx");
  27727. self._shouldNotImplement();
  27728. return self;
  27729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27730. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.SmalltalkImage.klass)});
  27731. //>>excludeEnd("ctx");
  27732. },
  27733. //>>excludeStart("ide", pragmas.excludeIdeData);
  27734. args: [],
  27735. source: "new\x0a\x09self shouldNotImplement",
  27736. referencedClasses: [],
  27737. //>>excludeEnd("ide");
  27738. messageSends: ["shouldNotImplement"]
  27739. }),
  27740. globals.SmalltalkImage.klass);
  27741. smalltalk.addMethod(
  27742. smalltalk.method({
  27743. selector: "do:displayingProgress:",
  27744. protocol: '*Kernel-Infrastructure',
  27745. fn: function (aBlock,aString){
  27746. var self=this;
  27747. function $ProgressHandler(){return globals.ProgressHandler||(typeof ProgressHandler=="undefined"?nil:ProgressHandler)}
  27748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27749. return smalltalk.withContext(function($ctx1) {
  27750. //>>excludeEnd("ctx");
  27751. _st($ProgressHandler())._do_on_displaying_(aBlock,self,aString);
  27752. return self;
  27753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27754. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},globals.SequenceableCollection)});
  27755. //>>excludeEnd("ctx");
  27756. },
  27757. //>>excludeStart("ide", pragmas.excludeIdeData);
  27758. args: ["aBlock", "aString"],
  27759. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  27760. referencedClasses: ["ProgressHandler"],
  27761. //>>excludeEnd("ide");
  27762. messageSends: ["do:on:displaying:"]
  27763. }),
  27764. globals.SequenceableCollection);
  27765. smalltalk.addMethod(
  27766. smalltalk.method({
  27767. selector: "asJavaScriptPropertyName",
  27768. protocol: '*Kernel-Infrastructure',
  27769. fn: function (){
  27770. var self=this;
  27771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27772. return smalltalk.withContext(function($ctx1) {
  27773. //>>excludeEnd("ctx");
  27774. return smalltalk.st2prop(self);
  27775. return self;
  27776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27777. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},globals.String)});
  27778. //>>excludeEnd("ctx");
  27779. },
  27780. //>>excludeStart("ide", pragmas.excludeIdeData);
  27781. args: [],
  27782. source: "asJavaScriptPropertyName\x0a<return smalltalk.st2prop(self)>",
  27783. referencedClasses: [],
  27784. //>>excludeEnd("ide");
  27785. messageSends: []
  27786. }),
  27787. globals.String);
  27788. smalltalk.addMethod(
  27789. smalltalk.method({
  27790. selector: "asJavaScriptSelector",
  27791. protocol: '*Kernel-Infrastructure',
  27792. fn: function (){
  27793. var self=this;
  27794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27795. return smalltalk.withContext(function($ctx1) {
  27796. //>>excludeEnd("ctx");
  27797. var $1;
  27798. $1=self._asJavaScriptPropertyName();
  27799. return $1;
  27800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27801. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{},globals.String)});
  27802. //>>excludeEnd("ctx");
  27803. },
  27804. //>>excludeStart("ide", pragmas.excludeIdeData);
  27805. args: [],
  27806. source: "asJavaScriptSelector\x0a\x09\x22Cannot add next line as it breaks commit:\x0a\x09self deprecatedAPI: 'Use #asJavaScriptPropertyName'.\x22\x0a\x0a\x09^ self asJavaScriptPropertyName",
  27807. referencedClasses: [],
  27808. //>>excludeEnd("ide");
  27809. messageSends: ["asJavaScriptPropertyName"]
  27810. }),
  27811. globals.String);
  27812. smalltalk.addMethod(
  27813. smalltalk.method({
  27814. selector: "asSetting",
  27815. protocol: '*Kernel-Infrastructure',
  27816. fn: function (){
  27817. var self=this;
  27818. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  27819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27820. return smalltalk.withContext(function($ctx1) {
  27821. //>>excludeEnd("ctx");
  27822. var $1;
  27823. $1=_st($Setting())._at_ifAbsent_(self,nil);
  27824. return $1;
  27825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27826. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},globals.String)});
  27827. //>>excludeEnd("ctx");
  27828. },
  27829. //>>excludeStart("ide", pragmas.excludeIdeData);
  27830. args: [],
  27831. source: "asSetting\x0a\x09^ Setting at: self ifAbsent: nil",
  27832. referencedClasses: ["Setting"],
  27833. //>>excludeEnd("ide");
  27834. messageSends: ["at:ifAbsent:"]
  27835. }),
  27836. globals.String);
  27837. smalltalk.addMethod(
  27838. smalltalk.method({
  27839. selector: "asSettingIfAbsent:",
  27840. protocol: '*Kernel-Infrastructure',
  27841. fn: function (aString){
  27842. var self=this;
  27843. function $Setting(){return globals.Setting||(typeof Setting=="undefined"?nil:Setting)}
  27844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27845. return smalltalk.withContext(function($ctx1) {
  27846. //>>excludeEnd("ctx");
  27847. var $1;
  27848. $1=_st($Setting())._at_ifAbsent_(self,aString);
  27849. return $1;
  27850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27851. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aString:aString},globals.String)});
  27852. //>>excludeEnd("ctx");
  27853. },
  27854. //>>excludeStart("ide", pragmas.excludeIdeData);
  27855. args: ["aString"],
  27856. source: "asSettingIfAbsent: aString\x0a\x09^ Setting at: self ifAbsent: aString",
  27857. referencedClasses: ["Setting"],
  27858. //>>excludeEnd("ide");
  27859. messageSends: ["at:ifAbsent:"]
  27860. }),
  27861. globals.String);
  27862. smalltalk.addMethod(
  27863. smalltalk.method({
  27864. selector: "settingValue",
  27865. protocol: '*Kernel-Infrastructure',
  27866. fn: function (){
  27867. var self=this;
  27868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27869. return smalltalk.withContext(function($ctx1) {
  27870. //>>excludeEnd("ctx");
  27871. var $1;
  27872. $1=_st(self._asSetting())._value();
  27873. return $1;
  27874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27875. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},globals.String)});
  27876. //>>excludeEnd("ctx");
  27877. },
  27878. //>>excludeStart("ide", pragmas.excludeIdeData);
  27879. args: [],
  27880. source: "settingValue\x0a\x09^ self asSetting value",
  27881. referencedClasses: [],
  27882. //>>excludeEnd("ide");
  27883. messageSends: ["value", "asSetting"]
  27884. }),
  27885. globals.String);
  27886. smalltalk.addMethod(
  27887. smalltalk.method({
  27888. selector: "settingValue:",
  27889. protocol: '*Kernel-Infrastructure',
  27890. fn: function (aString){
  27891. var self=this;
  27892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27893. return smalltalk.withContext(function($ctx1) {
  27894. //>>excludeEnd("ctx");
  27895. var $1;
  27896. $1=_st(self._asSetting())._value_(aString);
  27897. return $1;
  27898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27899. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aString:aString},globals.String)});
  27900. //>>excludeEnd("ctx");
  27901. },
  27902. //>>excludeStart("ide", pragmas.excludeIdeData);
  27903. args: ["aString"],
  27904. source: "settingValue: aString\x0a\x09^ self asSetting value: aString",
  27905. referencedClasses: [],
  27906. //>>excludeEnd("ide");
  27907. messageSends: ["value:", "asSetting"]
  27908. }),
  27909. globals.String);
  27910. smalltalk.addMethod(
  27911. smalltalk.method({
  27912. selector: "settingValueIfAbsent:",
  27913. protocol: '*Kernel-Infrastructure',
  27914. fn: function (aString){
  27915. var self=this;
  27916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27917. return smalltalk.withContext(function($ctx1) {
  27918. //>>excludeEnd("ctx");
  27919. var $1;
  27920. $1=_st(self._asSettingIfAbsent_(aString))._value();
  27921. return $1;
  27922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27923. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aString:aString},globals.String)});
  27924. //>>excludeEnd("ctx");
  27925. },
  27926. //>>excludeStart("ide", pragmas.excludeIdeData);
  27927. args: ["aString"],
  27928. source: "settingValueIfAbsent: aString\x0a\x09^ (self asSettingIfAbsent: aString) value",
  27929. referencedClasses: [],
  27930. //>>excludeEnd("ide");
  27931. messageSends: ["value", "asSettingIfAbsent:"]
  27932. }),
  27933. globals.String);
  27934. });
  27935. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  27936. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  27937. smalltalk.addPackage('Kernel-Exceptions');
  27938. smalltalk.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  27939. smalltalk.addClass('Error', globals.Object, ['messageText'], 'Kernel-Exceptions');
  27940. //>>excludeStart("ide", pragmas.excludeIdeData);
  27941. 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.";
  27942. //>>excludeEnd("ide");
  27943. smalltalk.addMethod(
  27944. smalltalk.method({
  27945. selector: "beHandled",
  27946. protocol: 'accessing',
  27947. fn: function (){
  27948. var self=this;
  27949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27950. return smalltalk.withContext(function($ctx1) {
  27951. //>>excludeEnd("ctx");
  27952. self.amberHandled = true;
  27953. return self;
  27954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27955. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},globals.Error)});
  27956. //>>excludeEnd("ctx");
  27957. },
  27958. //>>excludeStart("ide", pragmas.excludeIdeData);
  27959. args: [],
  27960. source: "beHandled\x0a\x09<self.amberHandled = true>",
  27961. referencedClasses: [],
  27962. //>>excludeEnd("ide");
  27963. messageSends: []
  27964. }),
  27965. globals.Error);
  27966. smalltalk.addMethod(
  27967. smalltalk.method({
  27968. selector: "beUnhandled",
  27969. protocol: 'accessing',
  27970. fn: function (){
  27971. var self=this;
  27972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27973. return smalltalk.withContext(function($ctx1) {
  27974. //>>excludeEnd("ctx");
  27975. self.amberHandled = false;
  27976. return self;
  27977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27978. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},globals.Error)});
  27979. //>>excludeEnd("ctx");
  27980. },
  27981. //>>excludeStart("ide", pragmas.excludeIdeData);
  27982. args: [],
  27983. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  27984. referencedClasses: [],
  27985. //>>excludeEnd("ide");
  27986. messageSends: []
  27987. }),
  27988. globals.Error);
  27989. smalltalk.addMethod(
  27990. smalltalk.method({
  27991. selector: "context",
  27992. protocol: 'accessing',
  27993. fn: function (){
  27994. var self=this;
  27995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27996. return smalltalk.withContext(function($ctx1) {
  27997. //>>excludeEnd("ctx");
  27998. return self.context;
  27999. return self;
  28000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28001. }, function($ctx1) {$ctx1.fill(self,"context",{},globals.Error)});
  28002. //>>excludeEnd("ctx");
  28003. },
  28004. //>>excludeStart("ide", pragmas.excludeIdeData);
  28005. args: [],
  28006. source: "context\x0a\x09<return self.context>",
  28007. referencedClasses: [],
  28008. //>>excludeEnd("ide");
  28009. messageSends: []
  28010. }),
  28011. globals.Error);
  28012. smalltalk.addMethod(
  28013. smalltalk.method({
  28014. selector: "initialize",
  28015. protocol: 'initialization',
  28016. fn: function (){
  28017. var self=this;
  28018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28019. return smalltalk.withContext(function($ctx1) {
  28020. //>>excludeEnd("ctx");
  28021. self._messageText_("Errorclass: ".__comma(_st(self._class())._name()));
  28022. return self;
  28023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28024. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Error)});
  28025. //>>excludeEnd("ctx");
  28026. },
  28027. //>>excludeStart("ide", pragmas.excludeIdeData);
  28028. args: [],
  28029. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  28030. referencedClasses: [],
  28031. //>>excludeEnd("ide");
  28032. messageSends: ["messageText:", ",", "name", "class"]
  28033. }),
  28034. globals.Error);
  28035. smalltalk.addMethod(
  28036. smalltalk.method({
  28037. selector: "isSmalltalkError",
  28038. protocol: 'testing',
  28039. fn: function (){
  28040. var self=this;
  28041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28042. return smalltalk.withContext(function($ctx1) {
  28043. //>>excludeEnd("ctx");
  28044. return self.smalltalkError === true;
  28045. return self;
  28046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28047. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},globals.Error)});
  28048. //>>excludeEnd("ctx");
  28049. },
  28050. //>>excludeStart("ide", pragmas.excludeIdeData);
  28051. args: [],
  28052. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  28053. referencedClasses: [],
  28054. //>>excludeEnd("ide");
  28055. messageSends: []
  28056. }),
  28057. globals.Error);
  28058. smalltalk.addMethod(
  28059. smalltalk.method({
  28060. selector: "jsStack",
  28061. protocol: 'accessing',
  28062. fn: function (){
  28063. var self=this;
  28064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28065. return smalltalk.withContext(function($ctx1) {
  28066. //>>excludeEnd("ctx");
  28067. return self.stack;
  28068. return self;
  28069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28070. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},globals.Error)});
  28071. //>>excludeEnd("ctx");
  28072. },
  28073. //>>excludeStart("ide", pragmas.excludeIdeData);
  28074. args: [],
  28075. source: "jsStack\x0a\x09<return self.stack>",
  28076. referencedClasses: [],
  28077. //>>excludeEnd("ide");
  28078. messageSends: []
  28079. }),
  28080. globals.Error);
  28081. smalltalk.addMethod(
  28082. smalltalk.method({
  28083. selector: "messageText",
  28084. protocol: 'accessing',
  28085. fn: function (){
  28086. var self=this;
  28087. var $1;
  28088. $1=self["@messageText"];
  28089. return $1;
  28090. },
  28091. //>>excludeStart("ide", pragmas.excludeIdeData);
  28092. args: [],
  28093. source: "messageText\x0a\x09^ messageText",
  28094. referencedClasses: [],
  28095. //>>excludeEnd("ide");
  28096. messageSends: []
  28097. }),
  28098. globals.Error);
  28099. smalltalk.addMethod(
  28100. smalltalk.method({
  28101. selector: "messageText:",
  28102. protocol: 'accessing',
  28103. fn: function (aString){
  28104. var self=this;
  28105. self["@messageText"]=aString;
  28106. return self;
  28107. },
  28108. //>>excludeStart("ide", pragmas.excludeIdeData);
  28109. args: ["aString"],
  28110. source: "messageText: aString\x0a\x09messageText := aString",
  28111. referencedClasses: [],
  28112. //>>excludeEnd("ide");
  28113. messageSends: []
  28114. }),
  28115. globals.Error);
  28116. smalltalk.addMethod(
  28117. smalltalk.method({
  28118. selector: "resignal",
  28119. protocol: 'signaling',
  28120. fn: function (){
  28121. var self=this;
  28122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28123. return smalltalk.withContext(function($ctx1) {
  28124. //>>excludeEnd("ctx");
  28125. self.amberHandled = false;
  28126. throw(self);
  28127. ;
  28128. return self;
  28129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28130. }, function($ctx1) {$ctx1.fill(self,"resignal",{},globals.Error)});
  28131. //>>excludeEnd("ctx");
  28132. },
  28133. //>>excludeStart("ide", pragmas.excludeIdeData);
  28134. args: [],
  28135. 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>",
  28136. referencedClasses: [],
  28137. //>>excludeEnd("ide");
  28138. messageSends: []
  28139. }),
  28140. globals.Error);
  28141. smalltalk.addMethod(
  28142. smalltalk.method({
  28143. selector: "signal",
  28144. protocol: 'signaling',
  28145. fn: function (){
  28146. var self=this;
  28147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28148. return smalltalk.withContext(function($ctx1) {
  28149. //>>excludeEnd("ctx");
  28150. self.amberHandled = false;
  28151. self.context = smalltalk.getThisContext();
  28152. self.smalltalkError = true; throw(self)
  28153. ;
  28154. return self;
  28155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28156. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error)});
  28157. //>>excludeEnd("ctx");
  28158. },
  28159. //>>excludeStart("ide", pragmas.excludeIdeData);
  28160. args: [],
  28161. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = smalltalk.getThisContext(); \x0a\x09\x09self.smalltalkError = true; throw(self)\x0a\x09>",
  28162. referencedClasses: [],
  28163. //>>excludeEnd("ide");
  28164. messageSends: []
  28165. }),
  28166. globals.Error);
  28167. smalltalk.addMethod(
  28168. smalltalk.method({
  28169. selector: "signal:",
  28170. protocol: 'signaling',
  28171. fn: function (aString){
  28172. var self=this;
  28173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28174. return smalltalk.withContext(function($ctx1) {
  28175. //>>excludeEnd("ctx");
  28176. self._messageText_(aString);
  28177. self._signal();
  28178. return self;
  28179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28180. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error)});
  28181. //>>excludeEnd("ctx");
  28182. },
  28183. //>>excludeStart("ide", pragmas.excludeIdeData);
  28184. args: ["aString"],
  28185. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  28186. referencedClasses: [],
  28187. //>>excludeEnd("ide");
  28188. messageSends: ["messageText:", "signal"]
  28189. }),
  28190. globals.Error);
  28191. smalltalk.addMethod(
  28192. smalltalk.method({
  28193. selector: "signalerContext",
  28194. protocol: 'accessing',
  28195. fn: function (){
  28196. var self=this;
  28197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28198. return smalltalk.withContext(function($ctx1) {
  28199. //>>excludeEnd("ctx");
  28200. var $1;
  28201. $1=self._signalerContextFrom_(self._context());
  28202. return $1;
  28203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28204. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},globals.Error)});
  28205. //>>excludeEnd("ctx");
  28206. },
  28207. //>>excludeStart("ide", pragmas.excludeIdeData);
  28208. args: [],
  28209. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  28210. referencedClasses: [],
  28211. //>>excludeEnd("ide");
  28212. messageSends: ["signalerContextFrom:", "context"]
  28213. }),
  28214. globals.Error);
  28215. smalltalk.addMethod(
  28216. smalltalk.method({
  28217. selector: "signalerContextFrom:",
  28218. protocol: 'accessing',
  28219. fn: function (aContext){
  28220. var self=this;
  28221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28222. return smalltalk.withContext(function($ctx1) {
  28223. //>>excludeEnd("ctx");
  28224. var $4,$3,$2,$1;
  28225. $1=_st(aContext)._findContextSuchThat_((function(context){
  28226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28227. return smalltalk.withContext(function($ctx2) {
  28228. //>>excludeEnd("ctx");
  28229. $4=_st(context)._receiver();
  28230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28231. $ctx2.sendIdx["receiver"]=1;
  28232. //>>excludeEnd("ctx");
  28233. $3=_st($4).__eq_eq(self);
  28234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28235. $ctx2.sendIdx["=="]=1;
  28236. //>>excludeEnd("ctx");
  28237. $2=_st($3)._or_((function(){
  28238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28239. return smalltalk.withContext(function($ctx3) {
  28240. //>>excludeEnd("ctx");
  28241. return _st(_st(context)._receiver()).__eq_eq(self._class());
  28242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28243. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28244. //>>excludeEnd("ctx");
  28245. }));
  28246. return _st($2)._not();
  28247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28248. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  28249. //>>excludeEnd("ctx");
  28250. }));
  28251. return $1;
  28252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28253. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Error)});
  28254. //>>excludeEnd("ctx");
  28255. },
  28256. //>>excludeStart("ide", pragmas.excludeIdeData);
  28257. args: ["aContext"],
  28258. 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 ]",
  28259. referencedClasses: [],
  28260. //>>excludeEnd("ide");
  28261. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  28262. }),
  28263. globals.Error);
  28264. smalltalk.addMethod(
  28265. smalltalk.method({
  28266. selector: "wasHandled",
  28267. protocol: 'testing',
  28268. fn: function (){
  28269. var self=this;
  28270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28271. return smalltalk.withContext(function($ctx1) {
  28272. //>>excludeEnd("ctx");
  28273. return self.amberHandled || false;
  28274. return self;
  28275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28276. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},globals.Error)});
  28277. //>>excludeEnd("ctx");
  28278. },
  28279. //>>excludeStart("ide", pragmas.excludeIdeData);
  28280. args: [],
  28281. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  28282. referencedClasses: [],
  28283. //>>excludeEnd("ide");
  28284. messageSends: []
  28285. }),
  28286. globals.Error);
  28287. smalltalk.addMethod(
  28288. smalltalk.method({
  28289. selector: "heliosClass",
  28290. protocol: 'helios',
  28291. fn: function (){
  28292. var self=this;
  28293. return "exception";
  28294. },
  28295. //>>excludeStart("ide", pragmas.excludeIdeData);
  28296. args: [],
  28297. source: "heliosClass\x0a\x09^ 'exception'",
  28298. referencedClasses: [],
  28299. //>>excludeEnd("ide");
  28300. messageSends: []
  28301. }),
  28302. globals.Error.klass);
  28303. smalltalk.addMethod(
  28304. smalltalk.method({
  28305. selector: "signal",
  28306. protocol: 'instance creation',
  28307. fn: function (){
  28308. var self=this;
  28309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28310. return smalltalk.withContext(function($ctx1) {
  28311. //>>excludeEnd("ctx");
  28312. var $1;
  28313. $1=_st(self._new())._signal();
  28314. return $1;
  28315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28316. }, function($ctx1) {$ctx1.fill(self,"signal",{},globals.Error.klass)});
  28317. //>>excludeEnd("ctx");
  28318. },
  28319. //>>excludeStart("ide", pragmas.excludeIdeData);
  28320. args: [],
  28321. source: "signal\x0a\x09^ self new signal",
  28322. referencedClasses: [],
  28323. //>>excludeEnd("ide");
  28324. messageSends: ["signal", "new"]
  28325. }),
  28326. globals.Error.klass);
  28327. smalltalk.addMethod(
  28328. smalltalk.method({
  28329. selector: "signal:",
  28330. protocol: 'instance creation',
  28331. fn: function (aString){
  28332. var self=this;
  28333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28334. return smalltalk.withContext(function($ctx1) {
  28335. //>>excludeEnd("ctx");
  28336. var $1;
  28337. $1=_st(self._new())._signal_(aString);
  28338. return $1;
  28339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28340. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},globals.Error.klass)});
  28341. //>>excludeEnd("ctx");
  28342. },
  28343. //>>excludeStart("ide", pragmas.excludeIdeData);
  28344. args: ["aString"],
  28345. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  28346. referencedClasses: [],
  28347. //>>excludeEnd("ide");
  28348. messageSends: ["signal:", "new"]
  28349. }),
  28350. globals.Error.klass);
  28351. smalltalk.addClass('Halt', globals.Error, [], 'Kernel-Exceptions');
  28352. //>>excludeStart("ide", pragmas.excludeIdeData);
  28353. globals.Halt.comment="I am provided to support `Object>>#halt`.";
  28354. //>>excludeEnd("ide");
  28355. smalltalk.addMethod(
  28356. smalltalk.method({
  28357. selector: "messageText",
  28358. protocol: 'accessing',
  28359. fn: function (){
  28360. var self=this;
  28361. return "Halt encountered";
  28362. },
  28363. //>>excludeStart("ide", pragmas.excludeIdeData);
  28364. args: [],
  28365. source: "messageText\x0a\x09^ 'Halt encountered'",
  28366. referencedClasses: [],
  28367. //>>excludeEnd("ide");
  28368. messageSends: []
  28369. }),
  28370. globals.Halt);
  28371. smalltalk.addMethod(
  28372. smalltalk.method({
  28373. selector: "signalerContextFrom:",
  28374. protocol: 'accessing',
  28375. fn: function (aContext){
  28376. var self=this;
  28377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28378. return smalltalk.withContext(function($ctx1) {
  28379. //>>excludeEnd("ctx");
  28380. var $4,$3,$2,$1;
  28381. $1=_st(aContext)._findContextSuchThat_((function(context){
  28382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28383. return smalltalk.withContext(function($ctx2) {
  28384. //>>excludeEnd("ctx");
  28385. $4=_st(context)._receiver();
  28386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28387. $ctx2.sendIdx["receiver"]=1;
  28388. //>>excludeEnd("ctx");
  28389. $3=_st($4).__eq_eq(self);
  28390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28391. $ctx2.sendIdx["=="]=1;
  28392. //>>excludeEnd("ctx");
  28393. $2=_st($3)._or_((function(){
  28394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28395. return smalltalk.withContext(function($ctx3) {
  28396. //>>excludeEnd("ctx");
  28397. return _st(_st(_st(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  28398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28399. return smalltalk.withContext(function($ctx4) {
  28400. //>>excludeEnd("ctx");
  28401. return _st(_st(_st(context)._method())._selector()).__eq("halt");
  28402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28403. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  28404. //>>excludeEnd("ctx");
  28405. }));
  28406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28407. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28408. //>>excludeEnd("ctx");
  28409. }));
  28410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28411. $ctx2.sendIdx["or:"]=1;
  28412. //>>excludeEnd("ctx");
  28413. return _st($2)._not();
  28414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28415. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  28416. //>>excludeEnd("ctx");
  28417. }));
  28418. return $1;
  28419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28420. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},globals.Halt)});
  28421. //>>excludeEnd("ctx");
  28422. },
  28423. //>>excludeStart("ide", pragmas.excludeIdeData);
  28424. args: ["aContext"],
  28425. 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 ]",
  28426. referencedClasses: [],
  28427. //>>excludeEnd("ide");
  28428. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  28429. }),
  28430. globals.Halt);
  28431. smalltalk.addClass('JavaScriptException', globals.Error, ['exception'], 'Kernel-Exceptions');
  28432. //>>excludeStart("ide", pragmas.excludeIdeData);
  28433. 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:`";
  28434. //>>excludeEnd("ide");
  28435. smalltalk.addMethod(
  28436. smalltalk.method({
  28437. selector: "context:",
  28438. protocol: 'accessing',
  28439. fn: function (aMethodContext){
  28440. var self=this;
  28441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28442. return smalltalk.withContext(function($ctx1) {
  28443. //>>excludeEnd("ctx");
  28444. self.context = aMethodContext;
  28445. return self;
  28446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28447. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},globals.JavaScriptException)});
  28448. //>>excludeEnd("ctx");
  28449. },
  28450. //>>excludeStart("ide", pragmas.excludeIdeData);
  28451. args: ["aMethodContext"],
  28452. 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>",
  28453. referencedClasses: [],
  28454. //>>excludeEnd("ide");
  28455. messageSends: []
  28456. }),
  28457. globals.JavaScriptException);
  28458. smalltalk.addMethod(
  28459. smalltalk.method({
  28460. selector: "exception",
  28461. protocol: 'accessing',
  28462. fn: function (){
  28463. var self=this;
  28464. var $1;
  28465. $1=self["@exception"];
  28466. return $1;
  28467. },
  28468. //>>excludeStart("ide", pragmas.excludeIdeData);
  28469. args: [],
  28470. source: "exception\x0a\x09^ exception",
  28471. referencedClasses: [],
  28472. //>>excludeEnd("ide");
  28473. messageSends: []
  28474. }),
  28475. globals.JavaScriptException);
  28476. smalltalk.addMethod(
  28477. smalltalk.method({
  28478. selector: "exception:",
  28479. protocol: 'accessing',
  28480. fn: function (anException){
  28481. var self=this;
  28482. self["@exception"]=anException;
  28483. return self;
  28484. },
  28485. //>>excludeStart("ide", pragmas.excludeIdeData);
  28486. args: ["anException"],
  28487. source: "exception: anException\x0a\x09exception := anException",
  28488. referencedClasses: [],
  28489. //>>excludeEnd("ide");
  28490. messageSends: []
  28491. }),
  28492. globals.JavaScriptException);
  28493. smalltalk.addMethod(
  28494. smalltalk.method({
  28495. selector: "messageText",
  28496. protocol: 'accessing',
  28497. fn: function (){
  28498. var self=this;
  28499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28500. return smalltalk.withContext(function($ctx1) {
  28501. //>>excludeEnd("ctx");
  28502. return 'JavaScript exception: ' + self["@exception"].toString();
  28503. return self;
  28504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28505. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.JavaScriptException)});
  28506. //>>excludeEnd("ctx");
  28507. },
  28508. //>>excludeStart("ide", pragmas.excludeIdeData);
  28509. args: [],
  28510. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  28511. referencedClasses: [],
  28512. //>>excludeEnd("ide");
  28513. messageSends: []
  28514. }),
  28515. globals.JavaScriptException);
  28516. smalltalk.addMethod(
  28517. smalltalk.method({
  28518. selector: "on:",
  28519. protocol: 'instance creation',
  28520. fn: function (anException){
  28521. var self=this;
  28522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28523. return smalltalk.withContext(function($ctx1) {
  28524. //>>excludeEnd("ctx");
  28525. var $2,$3,$1;
  28526. $2=self._new();
  28527. _st($2)._exception_(anException);
  28528. $3=_st($2)._yourself();
  28529. $1=$3;
  28530. return $1;
  28531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28532. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},globals.JavaScriptException.klass)});
  28533. //>>excludeEnd("ctx");
  28534. },
  28535. //>>excludeStart("ide", pragmas.excludeIdeData);
  28536. args: ["anException"],
  28537. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  28538. referencedClasses: [],
  28539. //>>excludeEnd("ide");
  28540. messageSends: ["exception:", "new", "yourself"]
  28541. }),
  28542. globals.JavaScriptException.klass);
  28543. smalltalk.addMethod(
  28544. smalltalk.method({
  28545. selector: "on:context:",
  28546. protocol: 'instance creation',
  28547. fn: function (anException,aMethodContext){
  28548. var self=this;
  28549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28550. return smalltalk.withContext(function($ctx1) {
  28551. //>>excludeEnd("ctx");
  28552. var $2,$3,$1;
  28553. $2=self._new();
  28554. _st($2)._exception_(anException);
  28555. _st($2)._context_(aMethodContext);
  28556. $3=_st($2)._yourself();
  28557. $1=$3;
  28558. return $1;
  28559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28560. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},globals.JavaScriptException.klass)});
  28561. //>>excludeEnd("ctx");
  28562. },
  28563. //>>excludeStart("ide", pragmas.excludeIdeData);
  28564. args: ["anException", "aMethodContext"],
  28565. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  28566. referencedClasses: [],
  28567. //>>excludeEnd("ide");
  28568. messageSends: ["exception:", "new", "context:", "yourself"]
  28569. }),
  28570. globals.JavaScriptException.klass);
  28571. smalltalk.addClass('MessageNotUnderstood', globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  28572. //>>excludeStart("ide", pragmas.excludeIdeData);
  28573. globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  28574. //>>excludeEnd("ide");
  28575. smalltalk.addMethod(
  28576. smalltalk.method({
  28577. selector: "message",
  28578. protocol: 'accessing',
  28579. fn: function (){
  28580. var self=this;
  28581. var $1;
  28582. $1=self["@message"];
  28583. return $1;
  28584. },
  28585. //>>excludeStart("ide", pragmas.excludeIdeData);
  28586. args: [],
  28587. source: "message\x0a\x09^ message",
  28588. referencedClasses: [],
  28589. //>>excludeEnd("ide");
  28590. messageSends: []
  28591. }),
  28592. globals.MessageNotUnderstood);
  28593. smalltalk.addMethod(
  28594. smalltalk.method({
  28595. selector: "message:",
  28596. protocol: 'accessing',
  28597. fn: function (aMessage){
  28598. var self=this;
  28599. self["@message"]=aMessage;
  28600. return self;
  28601. },
  28602. //>>excludeStart("ide", pragmas.excludeIdeData);
  28603. args: ["aMessage"],
  28604. source: "message: aMessage\x0a\x09message := aMessage",
  28605. referencedClasses: [],
  28606. //>>excludeEnd("ide");
  28607. messageSends: []
  28608. }),
  28609. globals.MessageNotUnderstood);
  28610. smalltalk.addMethod(
  28611. smalltalk.method({
  28612. selector: "messageText",
  28613. protocol: 'accessing',
  28614. fn: function (){
  28615. var self=this;
  28616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28617. return smalltalk.withContext(function($ctx1) {
  28618. //>>excludeEnd("ctx");
  28619. var $1;
  28620. $1=_st(_st(_st(self._receiver())._asString()).__comma(" does not understand #")).__comma(_st(self._message())._selector());
  28621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28622. $ctx1.sendIdx[","]=1;
  28623. //>>excludeEnd("ctx");
  28624. return $1;
  28625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28626. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.MessageNotUnderstood)});
  28627. //>>excludeEnd("ctx");
  28628. },
  28629. //>>excludeStart("ide", pragmas.excludeIdeData);
  28630. args: [],
  28631. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  28632. referencedClasses: [],
  28633. //>>excludeEnd("ide");
  28634. messageSends: [",", "asString", "receiver", "selector", "message"]
  28635. }),
  28636. globals.MessageNotUnderstood);
  28637. smalltalk.addMethod(
  28638. smalltalk.method({
  28639. selector: "receiver",
  28640. protocol: 'accessing',
  28641. fn: function (){
  28642. var self=this;
  28643. var $1;
  28644. $1=self["@receiver"];
  28645. return $1;
  28646. },
  28647. //>>excludeStart("ide", pragmas.excludeIdeData);
  28648. args: [],
  28649. source: "receiver\x0a\x09^ receiver",
  28650. referencedClasses: [],
  28651. //>>excludeEnd("ide");
  28652. messageSends: []
  28653. }),
  28654. globals.MessageNotUnderstood);
  28655. smalltalk.addMethod(
  28656. smalltalk.method({
  28657. selector: "receiver:",
  28658. protocol: 'accessing',
  28659. fn: function (anObject){
  28660. var self=this;
  28661. self["@receiver"]=anObject;
  28662. return self;
  28663. },
  28664. //>>excludeStart("ide", pragmas.excludeIdeData);
  28665. args: ["anObject"],
  28666. source: "receiver: anObject\x0a\x09receiver := anObject",
  28667. referencedClasses: [],
  28668. //>>excludeEnd("ide");
  28669. messageSends: []
  28670. }),
  28671. globals.MessageNotUnderstood);
  28672. smalltalk.addClass('NonBooleanReceiver', globals.Error, ['object'], 'Kernel-Exceptions');
  28673. //>>excludeStart("ide", pragmas.excludeIdeData);
  28674. globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  28675. //>>excludeEnd("ide");
  28676. smalltalk.addMethod(
  28677. smalltalk.method({
  28678. selector: "object",
  28679. protocol: 'accessing',
  28680. fn: function (){
  28681. var self=this;
  28682. var $1;
  28683. $1=self["@object"];
  28684. return $1;
  28685. },
  28686. //>>excludeStart("ide", pragmas.excludeIdeData);
  28687. args: [],
  28688. source: "object\x0a\x09^ object",
  28689. referencedClasses: [],
  28690. //>>excludeEnd("ide");
  28691. messageSends: []
  28692. }),
  28693. globals.NonBooleanReceiver);
  28694. smalltalk.addMethod(
  28695. smalltalk.method({
  28696. selector: "object:",
  28697. protocol: 'accessing',
  28698. fn: function (anObject){
  28699. var self=this;
  28700. self["@object"]=anObject;
  28701. return self;
  28702. },
  28703. //>>excludeStart("ide", pragmas.excludeIdeData);
  28704. args: ["anObject"],
  28705. source: "object: anObject\x0a\x09object := anObject",
  28706. referencedClasses: [],
  28707. //>>excludeEnd("ide");
  28708. messageSends: []
  28709. }),
  28710. globals.NonBooleanReceiver);
  28711. smalltalk.addClass('PackageCommitError', globals.Error, [], 'Kernel-Exceptions');
  28712. //>>excludeStart("ide", pragmas.excludeIdeData);
  28713. globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28714. //>>excludeEnd("ide");
  28715. });
  28716. define("amber_core/Kernel-Transcript", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  28717. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  28718. smalltalk.addPackage('Kernel-Transcript');
  28719. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28720. smalltalk.addClass('ConsoleTranscript', globals.Object, ['textarea'], 'Kernel-Transcript');
  28721. //>>excludeStart("ide", pragmas.excludeIdeData);
  28722. globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  28723. //>>excludeEnd("ide");
  28724. smalltalk.addMethod(
  28725. smalltalk.method({
  28726. selector: "clear",
  28727. protocol: 'printing',
  28728. fn: function (){
  28729. var self=this;
  28730. return self;
  28731. },
  28732. //>>excludeStart("ide", pragmas.excludeIdeData);
  28733. args: [],
  28734. source: "clear\x0a\x09\x22no op\x22",
  28735. referencedClasses: [],
  28736. //>>excludeEnd("ide");
  28737. messageSends: []
  28738. }),
  28739. globals.ConsoleTranscript);
  28740. smalltalk.addMethod(
  28741. smalltalk.method({
  28742. selector: "cr",
  28743. protocol: 'printing',
  28744. fn: function (){
  28745. var self=this;
  28746. return self;
  28747. },
  28748. //>>excludeStart("ide", pragmas.excludeIdeData);
  28749. args: [],
  28750. source: "cr\x0a\x09\x22no op\x22",
  28751. referencedClasses: [],
  28752. //>>excludeEnd("ide");
  28753. messageSends: []
  28754. }),
  28755. globals.ConsoleTranscript);
  28756. smalltalk.addMethod(
  28757. smalltalk.method({
  28758. selector: "open",
  28759. protocol: 'actions',
  28760. fn: function (){
  28761. var self=this;
  28762. return self;
  28763. },
  28764. //>>excludeStart("ide", pragmas.excludeIdeData);
  28765. args: [],
  28766. source: "open",
  28767. referencedClasses: [],
  28768. //>>excludeEnd("ide");
  28769. messageSends: []
  28770. }),
  28771. globals.ConsoleTranscript);
  28772. smalltalk.addMethod(
  28773. smalltalk.method({
  28774. selector: "show:",
  28775. protocol: 'printing',
  28776. fn: function (anObject){
  28777. var self=this;
  28778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28779. return smalltalk.withContext(function($ctx1) {
  28780. //>>excludeEnd("ctx");
  28781. console.log(String(_st(anObject)._asString()));
  28782. return self;
  28783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28784. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},globals.ConsoleTranscript)});
  28785. //>>excludeEnd("ctx");
  28786. },
  28787. //>>excludeStart("ide", pragmas.excludeIdeData);
  28788. args: ["anObject"],
  28789. 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()))>",
  28790. referencedClasses: [],
  28791. //>>excludeEnd("ide");
  28792. messageSends: []
  28793. }),
  28794. globals.ConsoleTranscript);
  28795. smalltalk.addMethod(
  28796. smalltalk.method({
  28797. selector: "initialize",
  28798. protocol: 'initialization',
  28799. fn: function (){
  28800. var self=this;
  28801. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  28802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28803. return smalltalk.withContext(function($ctx1) {
  28804. //>>excludeEnd("ctx");
  28805. _st($Transcript())._registerIfNone_(self._new());
  28806. return self;
  28807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28808. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ConsoleTranscript.klass)});
  28809. //>>excludeEnd("ctx");
  28810. },
  28811. //>>excludeStart("ide", pragmas.excludeIdeData);
  28812. args: [],
  28813. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  28814. referencedClasses: ["Transcript"],
  28815. //>>excludeEnd("ide");
  28816. messageSends: ["registerIfNone:", "new"]
  28817. }),
  28818. globals.ConsoleTranscript.klass);
  28819. });
  28820. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  28821. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  28822. smalltalk.addPackage('Kernel-Announcements');
  28823. smalltalk.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  28824. smalltalk.addClass('AnnouncementSubscription', globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  28825. //>>excludeStart("ide", pragmas.excludeIdeData);
  28826. globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  28827. //>>excludeEnd("ide");
  28828. smalltalk.addMethod(
  28829. smalltalk.method({
  28830. selector: "announcementClass",
  28831. protocol: 'accessing',
  28832. fn: function (){
  28833. var self=this;
  28834. var $1;
  28835. $1=self["@announcementClass"];
  28836. return $1;
  28837. },
  28838. //>>excludeStart("ide", pragmas.excludeIdeData);
  28839. args: [],
  28840. source: "announcementClass\x0a\x09^ announcementClass",
  28841. referencedClasses: [],
  28842. //>>excludeEnd("ide");
  28843. messageSends: []
  28844. }),
  28845. globals.AnnouncementSubscription);
  28846. smalltalk.addMethod(
  28847. smalltalk.method({
  28848. selector: "announcementClass:",
  28849. protocol: 'accessing',
  28850. fn: function (aClass){
  28851. var self=this;
  28852. self["@announcementClass"]=aClass;
  28853. return self;
  28854. },
  28855. //>>excludeStart("ide", pragmas.excludeIdeData);
  28856. args: ["aClass"],
  28857. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  28858. referencedClasses: [],
  28859. //>>excludeEnd("ide");
  28860. messageSends: []
  28861. }),
  28862. globals.AnnouncementSubscription);
  28863. smalltalk.addMethod(
  28864. smalltalk.method({
  28865. selector: "block",
  28866. protocol: 'accessing',
  28867. fn: function (){
  28868. var self=this;
  28869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28870. return smalltalk.withContext(function($ctx1) {
  28871. //>>excludeEnd("ctx");
  28872. var $1;
  28873. self._deprecatedAPI();
  28874. $1=self._valuable();
  28875. return $1;
  28876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28877. }, function($ctx1) {$ctx1.fill(self,"block",{},globals.AnnouncementSubscription)});
  28878. //>>excludeEnd("ctx");
  28879. },
  28880. //>>excludeStart("ide", pragmas.excludeIdeData);
  28881. args: [],
  28882. source: "block\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09^ self valuable",
  28883. referencedClasses: [],
  28884. //>>excludeEnd("ide");
  28885. messageSends: ["deprecatedAPI", "valuable"]
  28886. }),
  28887. globals.AnnouncementSubscription);
  28888. smalltalk.addMethod(
  28889. smalltalk.method({
  28890. selector: "block:",
  28891. protocol: 'accessing',
  28892. fn: function (aValuable){
  28893. var self=this;
  28894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28895. return smalltalk.withContext(function($ctx1) {
  28896. //>>excludeEnd("ctx");
  28897. self._deprecatedAPI();
  28898. self._valuable_(aValuable);
  28899. return self;
  28900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28901. }, function($ctx1) {$ctx1.fill(self,"block:",{aValuable:aValuable},globals.AnnouncementSubscription)});
  28902. //>>excludeEnd("ctx");
  28903. },
  28904. //>>excludeStart("ide", pragmas.excludeIdeData);
  28905. args: ["aValuable"],
  28906. source: "block: aValuable\x0a\x09\x22Use #valuable instead\x22\x0a\x09\x0a\x09self deprecatedAPI.\x0a\x09self valuable: aValuable",
  28907. referencedClasses: [],
  28908. //>>excludeEnd("ide");
  28909. messageSends: ["deprecatedAPI", "valuable:"]
  28910. }),
  28911. globals.AnnouncementSubscription);
  28912. smalltalk.addMethod(
  28913. smalltalk.method({
  28914. selector: "deliver:",
  28915. protocol: 'announcing',
  28916. fn: function (anAnnouncement){
  28917. var self=this;
  28918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28919. return smalltalk.withContext(function($ctx1) {
  28920. //>>excludeEnd("ctx");
  28921. var $1;
  28922. $1=self._handlesAnnouncement_(anAnnouncement);
  28923. if(smalltalk.assert($1)){
  28924. _st(self._valuable())._value_(anAnnouncement);
  28925. };
  28926. return self;
  28927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28928. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)});
  28929. //>>excludeEnd("ctx");
  28930. },
  28931. //>>excludeStart("ide", pragmas.excludeIdeData);
  28932. args: ["anAnnouncement"],
  28933. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  28934. referencedClasses: [],
  28935. //>>excludeEnd("ide");
  28936. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  28937. }),
  28938. globals.AnnouncementSubscription);
  28939. smalltalk.addMethod(
  28940. smalltalk.method({
  28941. selector: "handlesAnnouncement:",
  28942. protocol: 'announcing',
  28943. fn: function (anAnnouncement){
  28944. var self=this;
  28945. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  28946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28947. return smalltalk.withContext(function($ctx1) {
  28948. //>>excludeEnd("ctx");
  28949. var $3,$4,$2,$1,$receiver;
  28950. $3=_st($Smalltalk())._globals();
  28951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28952. $ctx1.sendIdx["globals"]=1;
  28953. //>>excludeEnd("ctx");
  28954. $4=_st(self._announcementClass())._name();
  28955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28956. $ctx1.sendIdx["name"]=1;
  28957. //>>excludeEnd("ctx");
  28958. $2=_st($3)._at_($4);
  28959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28960. $ctx1.sendIdx["at:"]=1;
  28961. //>>excludeEnd("ctx");
  28962. if(($receiver = $2) == null || $receiver.isNil){
  28963. return false;
  28964. } else {
  28965. var class_;
  28966. class_=$receiver;
  28967. $1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  28968. };
  28969. return $1;
  28970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28971. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},globals.AnnouncementSubscription)});
  28972. //>>excludeEnd("ctx");
  28973. },
  28974. //>>excludeStart("ide", pragmas.excludeIdeData);
  28975. args: ["anAnnouncement"],
  28976. 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 ]",
  28977. referencedClasses: ["Smalltalk"],
  28978. //>>excludeEnd("ide");
  28979. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  28980. }),
  28981. globals.AnnouncementSubscription);
  28982. smalltalk.addMethod(
  28983. smalltalk.method({
  28984. selector: "receiver",
  28985. protocol: 'accessing',
  28986. fn: function (){
  28987. var self=this;
  28988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28989. return smalltalk.withContext(function($ctx1) {
  28990. //>>excludeEnd("ctx");
  28991. var $1;
  28992. $1=_st(self._valuable())._receiver();
  28993. return $1;
  28994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28995. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.AnnouncementSubscription)});
  28996. //>>excludeEnd("ctx");
  28997. },
  28998. //>>excludeStart("ide", pragmas.excludeIdeData);
  28999. args: [],
  29000. source: "receiver\x0a\x09^ self valuable receiver",
  29001. referencedClasses: [],
  29002. //>>excludeEnd("ide");
  29003. messageSends: ["receiver", "valuable"]
  29004. }),
  29005. globals.AnnouncementSubscription);
  29006. smalltalk.addMethod(
  29007. smalltalk.method({
  29008. selector: "valuable",
  29009. protocol: 'accessing',
  29010. fn: function (){
  29011. var self=this;
  29012. var $1;
  29013. $1=self["@valuable"];
  29014. return $1;
  29015. },
  29016. //>>excludeStart("ide", pragmas.excludeIdeData);
  29017. args: [],
  29018. source: "valuable\x0a\x09^ valuable",
  29019. referencedClasses: [],
  29020. //>>excludeEnd("ide");
  29021. messageSends: []
  29022. }),
  29023. globals.AnnouncementSubscription);
  29024. smalltalk.addMethod(
  29025. smalltalk.method({
  29026. selector: "valuable:",
  29027. protocol: 'accessing',
  29028. fn: function (aValuable){
  29029. var self=this;
  29030. self["@valuable"]=aValuable;
  29031. return self;
  29032. },
  29033. //>>excludeStart("ide", pragmas.excludeIdeData);
  29034. args: ["aValuable"],
  29035. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  29036. referencedClasses: [],
  29037. //>>excludeEnd("ide");
  29038. messageSends: []
  29039. }),
  29040. globals.AnnouncementSubscription);
  29041. smalltalk.addClass('AnnouncementValuable', globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  29042. //>>excludeStart("ide", pragmas.excludeIdeData);
  29043. globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  29044. //>>excludeEnd("ide");
  29045. smalltalk.addMethod(
  29046. smalltalk.method({
  29047. selector: "receiver",
  29048. protocol: 'accessing',
  29049. fn: function (){
  29050. var self=this;
  29051. var $1;
  29052. $1=self["@receiver"];
  29053. return $1;
  29054. },
  29055. //>>excludeStart("ide", pragmas.excludeIdeData);
  29056. args: [],
  29057. source: "receiver\x0a\x09^ receiver",
  29058. referencedClasses: [],
  29059. //>>excludeEnd("ide");
  29060. messageSends: []
  29061. }),
  29062. globals.AnnouncementValuable);
  29063. smalltalk.addMethod(
  29064. smalltalk.method({
  29065. selector: "receiver:",
  29066. protocol: 'accessing',
  29067. fn: function (anObject){
  29068. var self=this;
  29069. self["@receiver"]=anObject;
  29070. return self;
  29071. },
  29072. //>>excludeStart("ide", pragmas.excludeIdeData);
  29073. args: ["anObject"],
  29074. source: "receiver: anObject\x0a\x09receiver := anObject",
  29075. referencedClasses: [],
  29076. //>>excludeEnd("ide");
  29077. messageSends: []
  29078. }),
  29079. globals.AnnouncementValuable);
  29080. smalltalk.addMethod(
  29081. smalltalk.method({
  29082. selector: "valuable",
  29083. protocol: 'accessing',
  29084. fn: function (){
  29085. var self=this;
  29086. var $1;
  29087. $1=self["@valuable"];
  29088. return $1;
  29089. },
  29090. //>>excludeStart("ide", pragmas.excludeIdeData);
  29091. args: [],
  29092. source: "valuable\x0a\x09^ valuable",
  29093. referencedClasses: [],
  29094. //>>excludeEnd("ide");
  29095. messageSends: []
  29096. }),
  29097. globals.AnnouncementValuable);
  29098. smalltalk.addMethod(
  29099. smalltalk.method({
  29100. selector: "valuable:",
  29101. protocol: 'accessing',
  29102. fn: function (anObject){
  29103. var self=this;
  29104. self["@valuable"]=anObject;
  29105. return self;
  29106. },
  29107. //>>excludeStart("ide", pragmas.excludeIdeData);
  29108. args: ["anObject"],
  29109. source: "valuable: anObject\x0a\x09valuable := anObject",
  29110. referencedClasses: [],
  29111. //>>excludeEnd("ide");
  29112. messageSends: []
  29113. }),
  29114. globals.AnnouncementValuable);
  29115. smalltalk.addMethod(
  29116. smalltalk.method({
  29117. selector: "value",
  29118. protocol: 'evaluating',
  29119. fn: function (){
  29120. var self=this;
  29121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29122. return smalltalk.withContext(function($ctx1) {
  29123. //>>excludeEnd("ctx");
  29124. var $1;
  29125. $1=_st(self._valuable())._value();
  29126. return $1;
  29127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29128. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AnnouncementValuable)});
  29129. //>>excludeEnd("ctx");
  29130. },
  29131. //>>excludeStart("ide", pragmas.excludeIdeData);
  29132. args: [],
  29133. source: "value\x0a\x09^ self valuable value",
  29134. referencedClasses: [],
  29135. //>>excludeEnd("ide");
  29136. messageSends: ["value", "valuable"]
  29137. }),
  29138. globals.AnnouncementValuable);
  29139. smalltalk.addMethod(
  29140. smalltalk.method({
  29141. selector: "value:",
  29142. protocol: 'evaluating',
  29143. fn: function (anObject){
  29144. var self=this;
  29145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29146. return smalltalk.withContext(function($ctx1) {
  29147. //>>excludeEnd("ctx");
  29148. var $1;
  29149. $1=_st(self._valuable())._value_(anObject);
  29150. return $1;
  29151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29152. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.AnnouncementValuable)});
  29153. //>>excludeEnd("ctx");
  29154. },
  29155. //>>excludeStart("ide", pragmas.excludeIdeData);
  29156. args: ["anObject"],
  29157. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  29158. referencedClasses: [],
  29159. //>>excludeEnd("ide");
  29160. messageSends: ["value:", "valuable"]
  29161. }),
  29162. globals.AnnouncementValuable);
  29163. smalltalk.addClass('Announcer', globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  29164. //>>excludeStart("ide", pragmas.excludeIdeData);
  29165. 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' ].";
  29166. //>>excludeEnd("ide");
  29167. smalltalk.addMethod(
  29168. smalltalk.method({
  29169. selector: "announce:",
  29170. protocol: 'announcing',
  29171. fn: function (anAnnouncement){
  29172. var self=this;
  29173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29174. return smalltalk.withContext(function($ctx1) {
  29175. //>>excludeEnd("ctx");
  29176. _st(self["@subscriptions"])._do_((function(each){
  29177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29178. return smalltalk.withContext(function($ctx2) {
  29179. //>>excludeEnd("ctx");
  29180. return _st(each)._deliver_(anAnnouncement);
  29181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29183. //>>excludeEnd("ctx");
  29184. }));
  29185. return self;
  29186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29187. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},globals.Announcer)});
  29188. //>>excludeEnd("ctx");
  29189. },
  29190. //>>excludeStart("ide", pragmas.excludeIdeData);
  29191. args: ["anAnnouncement"],
  29192. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  29193. referencedClasses: [],
  29194. //>>excludeEnd("ide");
  29195. messageSends: ["do:", "deliver:"]
  29196. }),
  29197. globals.Announcer);
  29198. smalltalk.addMethod(
  29199. smalltalk.method({
  29200. selector: "initialize",
  29201. protocol: 'initialization',
  29202. fn: function (){
  29203. var self=this;
  29204. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  29205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29206. return smalltalk.withContext(function($ctx1) {
  29207. //>>excludeEnd("ctx");
  29208. (
  29209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29210. $ctx1.supercall = true,
  29211. //>>excludeEnd("ctx");
  29212. globals.Announcer.superclass.fn.prototype._initialize.apply(_st(self), []));
  29213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29214. $ctx1.supercall = false;
  29215. //>>excludeEnd("ctx");;
  29216. self["@subscriptions"]=_st($OrderedCollection())._new();
  29217. return self;
  29218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29219. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Announcer)});
  29220. //>>excludeEnd("ctx");
  29221. },
  29222. //>>excludeStart("ide", pragmas.excludeIdeData);
  29223. args: [],
  29224. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  29225. referencedClasses: ["OrderedCollection"],
  29226. //>>excludeEnd("ide");
  29227. messageSends: ["initialize", "new"]
  29228. }),
  29229. globals.Announcer);
  29230. smalltalk.addMethod(
  29231. smalltalk.method({
  29232. selector: "on:do:",
  29233. protocol: 'subscribing',
  29234. fn: function (aClass,aBlock){
  29235. var self=this;
  29236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29237. return smalltalk.withContext(function($ctx1) {
  29238. //>>excludeEnd("ctx");
  29239. self._on_do_for_(aClass,aBlock,nil);
  29240. return self;
  29241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29242. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},globals.Announcer)});
  29243. //>>excludeEnd("ctx");
  29244. },
  29245. //>>excludeStart("ide", pragmas.excludeIdeData);
  29246. args: ["aClass", "aBlock"],
  29247. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  29248. referencedClasses: [],
  29249. //>>excludeEnd("ide");
  29250. messageSends: ["on:do:for:"]
  29251. }),
  29252. globals.Announcer);
  29253. smalltalk.addMethod(
  29254. smalltalk.method({
  29255. selector: "on:do:for:",
  29256. protocol: 'subscribing',
  29257. fn: function (aClass,aBlock,aReceiver){
  29258. var self=this;
  29259. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29260. function $AnnouncementValuable(){return globals.AnnouncementValuable||(typeof AnnouncementValuable=="undefined"?nil:AnnouncementValuable)}
  29261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29262. return smalltalk.withContext(function($ctx1) {
  29263. //>>excludeEnd("ctx");
  29264. var $1,$3,$4,$6,$7,$5,$8,$2;
  29265. $1=self["@subscriptions"];
  29266. $3=_st($AnnouncementSubscription())._new();
  29267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29268. $ctx1.sendIdx["new"]=1;
  29269. //>>excludeEnd("ctx");
  29270. $4=$3;
  29271. $6=_st($AnnouncementValuable())._new();
  29272. _st($6)._valuable_(aBlock);
  29273. _st($6)._receiver_(aReceiver);
  29274. $7=_st($6)._yourself();
  29275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29276. $ctx1.sendIdx["yourself"]=1;
  29277. //>>excludeEnd("ctx");
  29278. $5=$7;
  29279. _st($4)._valuable_($5);
  29280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29281. $ctx1.sendIdx["valuable:"]=1;
  29282. //>>excludeEnd("ctx");
  29283. _st($3)._announcementClass_(aClass);
  29284. $8=_st($3)._yourself();
  29285. $2=$8;
  29286. _st($1)._add_($2);
  29287. return self;
  29288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29289. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},globals.Announcer)});
  29290. //>>excludeEnd("ctx");
  29291. },
  29292. //>>excludeStart("ide", pragmas.excludeIdeData);
  29293. args: ["aClass", "aBlock", "aReceiver"],
  29294. 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)",
  29295. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  29296. //>>excludeEnd("ide");
  29297. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  29298. }),
  29299. globals.Announcer);
  29300. smalltalk.addMethod(
  29301. smalltalk.method({
  29302. selector: "on:doOnce:",
  29303. protocol: 'subscribing',
  29304. fn: function (aClass,aBlock){
  29305. var self=this;
  29306. var subscription;
  29307. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29309. return smalltalk.withContext(function($ctx1) {
  29310. //>>excludeEnd("ctx");
  29311. var $1,$2;
  29312. $1=_st($AnnouncementSubscription())._new();
  29313. _st($1)._announcementClass_(aClass);
  29314. $2=_st($1)._yourself();
  29315. subscription=$2;
  29316. _st(subscription)._valuable_((function(ann){
  29317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29318. return smalltalk.withContext(function($ctx2) {
  29319. //>>excludeEnd("ctx");
  29320. _st(self["@subscriptions"])._remove_(subscription);
  29321. return _st(aBlock)._value_(ann);
  29322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29323. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  29324. //>>excludeEnd("ctx");
  29325. }));
  29326. _st(self["@subscriptions"])._add_(subscription);
  29327. return self;
  29328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29329. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},globals.Announcer)});
  29330. //>>excludeEnd("ctx");
  29331. },
  29332. //>>excludeStart("ide", pragmas.excludeIdeData);
  29333. args: ["aClass", "aBlock"],
  29334. 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",
  29335. referencedClasses: ["AnnouncementSubscription"],
  29336. //>>excludeEnd("ide");
  29337. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  29338. }),
  29339. globals.Announcer);
  29340. smalltalk.addMethod(
  29341. smalltalk.method({
  29342. selector: "on:send:to:",
  29343. protocol: 'subscribing',
  29344. fn: function (aClass,aSelector,anObject){
  29345. var self=this;
  29346. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  29347. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  29348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29349. return smalltalk.withContext(function($ctx1) {
  29350. //>>excludeEnd("ctx");
  29351. var $1,$3,$4,$6,$7,$5,$8,$2;
  29352. $1=self["@subscriptions"];
  29353. $3=_st($AnnouncementSubscription())._new();
  29354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29355. $ctx1.sendIdx["new"]=1;
  29356. //>>excludeEnd("ctx");
  29357. $4=$3;
  29358. $6=_st($MessageSend())._new();
  29359. _st($6)._receiver_(anObject);
  29360. _st($6)._selector_(aSelector);
  29361. $7=_st($6)._yourself();
  29362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29363. $ctx1.sendIdx["yourself"]=1;
  29364. //>>excludeEnd("ctx");
  29365. $5=$7;
  29366. _st($4)._valuable_($5);
  29367. _st($3)._announcementClass_(aClass);
  29368. $8=_st($3)._yourself();
  29369. $2=$8;
  29370. _st($1)._add_($2);
  29371. return self;
  29372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29373. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},globals.Announcer)});
  29374. //>>excludeEnd("ctx");
  29375. },
  29376. //>>excludeStart("ide", pragmas.excludeIdeData);
  29377. args: ["aClass", "aSelector", "anObject"],
  29378. 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)",
  29379. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  29380. //>>excludeEnd("ide");
  29381. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  29382. }),
  29383. globals.Announcer);
  29384. smalltalk.addMethod(
  29385. smalltalk.method({
  29386. selector: "unsubscribe:",
  29387. protocol: 'subscribing',
  29388. fn: function (anObject){
  29389. var self=this;
  29390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29391. return smalltalk.withContext(function($ctx1) {
  29392. //>>excludeEnd("ctx");
  29393. self["@subscriptions"]=_st(self["@subscriptions"])._reject_((function(each){
  29394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29395. return smalltalk.withContext(function($ctx2) {
  29396. //>>excludeEnd("ctx");
  29397. return _st(_st(each)._receiver()).__eq(anObject);
  29398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  29400. //>>excludeEnd("ctx");
  29401. }));
  29402. return self;
  29403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29404. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},globals.Announcer)});
  29405. //>>excludeEnd("ctx");
  29406. },
  29407. //>>excludeStart("ide", pragmas.excludeIdeData);
  29408. args: ["anObject"],
  29409. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  29410. referencedClasses: [],
  29411. //>>excludeEnd("ide");
  29412. messageSends: ["reject:", "=", "receiver"]
  29413. }),
  29414. globals.Announcer);
  29415. smalltalk.addClass('SystemAnnouncer', globals.Announcer, [], 'Kernel-Announcements');
  29416. //>>excludeStart("ide", pragmas.excludeIdeData);
  29417. 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`";
  29418. //>>excludeEnd("ide");
  29419. globals.SystemAnnouncer.klass.iVarNames = ['current'];
  29420. smalltalk.addMethod(
  29421. smalltalk.method({
  29422. selector: "current",
  29423. protocol: 'accessing',
  29424. fn: function (){
  29425. var self=this;
  29426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29427. return smalltalk.withContext(function($ctx1) {
  29428. //>>excludeEnd("ctx");
  29429. var $2,$1,$receiver;
  29430. $2=self["@current"];
  29431. if(($receiver = $2) == null || $receiver.isNil){
  29432. self["@current"]=(
  29433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29434. $ctx1.supercall = true,
  29435. //>>excludeEnd("ctx");
  29436. globals.SystemAnnouncer.klass.superclass.fn.prototype._new.apply(_st(self), []));
  29437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29438. $ctx1.supercall = false;
  29439. //>>excludeEnd("ctx");;
  29440. $1=self["@current"];
  29441. } else {
  29442. $1=$2;
  29443. };
  29444. return $1;
  29445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29446. }, function($ctx1) {$ctx1.fill(self,"current",{},globals.SystemAnnouncer.klass)});
  29447. //>>excludeEnd("ctx");
  29448. },
  29449. //>>excludeStart("ide", pragmas.excludeIdeData);
  29450. args: [],
  29451. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  29452. referencedClasses: [],
  29453. //>>excludeEnd("ide");
  29454. messageSends: ["ifNil:", "new"]
  29455. }),
  29456. globals.SystemAnnouncer.klass);
  29457. smalltalk.addMethod(
  29458. smalltalk.method({
  29459. selector: "new",
  29460. protocol: 'instance creation',
  29461. fn: function (){
  29462. var self=this;
  29463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29464. return smalltalk.withContext(function($ctx1) {
  29465. //>>excludeEnd("ctx");
  29466. self._shouldNotImplement();
  29467. return self;
  29468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29469. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.SystemAnnouncer.klass)});
  29470. //>>excludeEnd("ctx");
  29471. },
  29472. //>>excludeStart("ide", pragmas.excludeIdeData);
  29473. args: [],
  29474. source: "new\x0a\x09self shouldNotImplement",
  29475. referencedClasses: [],
  29476. //>>excludeEnd("ide");
  29477. messageSends: ["shouldNotImplement"]
  29478. }),
  29479. globals.SystemAnnouncer.klass);
  29480. smalltalk.addClass('SystemAnnouncement', globals.Object, [], 'Kernel-Announcements');
  29481. //>>excludeStart("ide", pragmas.excludeIdeData);
  29482. globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  29483. //>>excludeEnd("ide");
  29484. smalltalk.addMethod(
  29485. smalltalk.method({
  29486. selector: "heliosClass",
  29487. protocol: 'helios',
  29488. fn: function (){
  29489. var self=this;
  29490. return "announcement";
  29491. },
  29492. //>>excludeStart("ide", pragmas.excludeIdeData);
  29493. args: [],
  29494. source: "heliosClass\x0a\x09^ 'announcement'",
  29495. referencedClasses: [],
  29496. //>>excludeEnd("ide");
  29497. messageSends: []
  29498. }),
  29499. globals.SystemAnnouncement.klass);
  29500. smalltalk.addClass('ClassAnnouncement', globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  29501. //>>excludeStart("ide", pragmas.excludeIdeData);
  29502. globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  29503. //>>excludeEnd("ide");
  29504. smalltalk.addMethod(
  29505. smalltalk.method({
  29506. selector: "theClass",
  29507. protocol: 'accessing',
  29508. fn: function (){
  29509. var self=this;
  29510. var $1;
  29511. $1=self["@theClass"];
  29512. return $1;
  29513. },
  29514. //>>excludeStart("ide", pragmas.excludeIdeData);
  29515. args: [],
  29516. source: "theClass\x0a\x09^ theClass",
  29517. referencedClasses: [],
  29518. //>>excludeEnd("ide");
  29519. messageSends: []
  29520. }),
  29521. globals.ClassAnnouncement);
  29522. smalltalk.addMethod(
  29523. smalltalk.method({
  29524. selector: "theClass:",
  29525. protocol: 'accessing',
  29526. fn: function (aClass){
  29527. var self=this;
  29528. self["@theClass"]=aClass;
  29529. return self;
  29530. },
  29531. //>>excludeStart("ide", pragmas.excludeIdeData);
  29532. args: ["aClass"],
  29533. source: "theClass: aClass\x0a\x09theClass := aClass",
  29534. referencedClasses: [],
  29535. //>>excludeEnd("ide");
  29536. messageSends: []
  29537. }),
  29538. globals.ClassAnnouncement);
  29539. smalltalk.addClass('ClassAdded', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29540. //>>excludeStart("ide", pragmas.excludeIdeData);
  29541. globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  29542. //>>excludeEnd("ide");
  29543. smalltalk.addClass('ClassCommentChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29544. //>>excludeStart("ide", pragmas.excludeIdeData);
  29545. globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  29546. //>>excludeEnd("ide");
  29547. smalltalk.addClass('ClassDefinitionChanged', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29548. //>>excludeStart("ide", pragmas.excludeIdeData);
  29549. globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  29550. //>>excludeEnd("ide");
  29551. smalltalk.addClass('ClassMigrated', globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  29552. //>>excludeStart("ide", pragmas.excludeIdeData);
  29553. globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  29554. //>>excludeEnd("ide");
  29555. smalltalk.addMethod(
  29556. smalltalk.method({
  29557. selector: "oldClass",
  29558. protocol: 'accessing',
  29559. fn: function (){
  29560. var self=this;
  29561. var $1;
  29562. $1=self["@oldClass"];
  29563. return $1;
  29564. },
  29565. //>>excludeStart("ide", pragmas.excludeIdeData);
  29566. args: [],
  29567. source: "oldClass\x0a\x09^ oldClass",
  29568. referencedClasses: [],
  29569. //>>excludeEnd("ide");
  29570. messageSends: []
  29571. }),
  29572. globals.ClassMigrated);
  29573. smalltalk.addMethod(
  29574. smalltalk.method({
  29575. selector: "oldClass:",
  29576. protocol: 'accessing',
  29577. fn: function (aClass){
  29578. var self=this;
  29579. self["@oldClass"]=aClass;
  29580. return self;
  29581. },
  29582. //>>excludeStart("ide", pragmas.excludeIdeData);
  29583. args: ["aClass"],
  29584. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  29585. referencedClasses: [],
  29586. //>>excludeEnd("ide");
  29587. messageSends: []
  29588. }),
  29589. globals.ClassMigrated);
  29590. smalltalk.addClass('ClassMoved', globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  29591. //>>excludeStart("ide", pragmas.excludeIdeData);
  29592. globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  29593. //>>excludeEnd("ide");
  29594. smalltalk.addMethod(
  29595. smalltalk.method({
  29596. selector: "oldPackage",
  29597. protocol: 'accessing',
  29598. fn: function (){
  29599. var self=this;
  29600. var $1;
  29601. $1=self["@oldPackage"];
  29602. return $1;
  29603. },
  29604. //>>excludeStart("ide", pragmas.excludeIdeData);
  29605. args: [],
  29606. source: "oldPackage\x0a\x09^ oldPackage",
  29607. referencedClasses: [],
  29608. //>>excludeEnd("ide");
  29609. messageSends: []
  29610. }),
  29611. globals.ClassMoved);
  29612. smalltalk.addMethod(
  29613. smalltalk.method({
  29614. selector: "oldPackage:",
  29615. protocol: 'accessing',
  29616. fn: function (aPackage){
  29617. var self=this;
  29618. self["@oldPackage"]=aPackage;
  29619. return self;
  29620. },
  29621. //>>excludeStart("ide", pragmas.excludeIdeData);
  29622. args: ["aPackage"],
  29623. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  29624. referencedClasses: [],
  29625. //>>excludeEnd("ide");
  29626. messageSends: []
  29627. }),
  29628. globals.ClassMoved);
  29629. smalltalk.addClass('ClassRemoved', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29630. //>>excludeStart("ide", pragmas.excludeIdeData);
  29631. globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  29632. //>>excludeEnd("ide");
  29633. smalltalk.addClass('ClassRenamed', globals.ClassAnnouncement, [], 'Kernel-Announcements');
  29634. //>>excludeStart("ide", pragmas.excludeIdeData);
  29635. globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  29636. //>>excludeEnd("ide");
  29637. smalltalk.addClass('MethodAnnouncement', globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  29638. //>>excludeStart("ide", pragmas.excludeIdeData);
  29639. globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  29640. //>>excludeEnd("ide");
  29641. smalltalk.addMethod(
  29642. smalltalk.method({
  29643. selector: "method",
  29644. protocol: 'accessing',
  29645. fn: function (){
  29646. var self=this;
  29647. var $1;
  29648. $1=self["@method"];
  29649. return $1;
  29650. },
  29651. //>>excludeStart("ide", pragmas.excludeIdeData);
  29652. args: [],
  29653. source: "method\x0a\x09^ method",
  29654. referencedClasses: [],
  29655. //>>excludeEnd("ide");
  29656. messageSends: []
  29657. }),
  29658. globals.MethodAnnouncement);
  29659. smalltalk.addMethod(
  29660. smalltalk.method({
  29661. selector: "method:",
  29662. protocol: 'accessing',
  29663. fn: function (aCompiledMethod){
  29664. var self=this;
  29665. self["@method"]=aCompiledMethod;
  29666. return self;
  29667. },
  29668. //>>excludeStart("ide", pragmas.excludeIdeData);
  29669. args: ["aCompiledMethod"],
  29670. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  29671. referencedClasses: [],
  29672. //>>excludeEnd("ide");
  29673. messageSends: []
  29674. }),
  29675. globals.MethodAnnouncement);
  29676. smalltalk.addClass('MethodAdded', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  29677. //>>excludeStart("ide", pragmas.excludeIdeData);
  29678. globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  29679. //>>excludeEnd("ide");
  29680. smalltalk.addClass('MethodModified', globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  29681. //>>excludeStart("ide", pragmas.excludeIdeData);
  29682. 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.";
  29683. //>>excludeEnd("ide");
  29684. smalltalk.addMethod(
  29685. smalltalk.method({
  29686. selector: "oldMethod",
  29687. protocol: 'accessing',
  29688. fn: function (){
  29689. var self=this;
  29690. var $1;
  29691. $1=self["@oldMethod"];
  29692. return $1;
  29693. },
  29694. //>>excludeStart("ide", pragmas.excludeIdeData);
  29695. args: [],
  29696. source: "oldMethod\x0a\x09^ oldMethod",
  29697. referencedClasses: [],
  29698. //>>excludeEnd("ide");
  29699. messageSends: []
  29700. }),
  29701. globals.MethodModified);
  29702. smalltalk.addMethod(
  29703. smalltalk.method({
  29704. selector: "oldMethod:",
  29705. protocol: 'accessing',
  29706. fn: function (aMethod){
  29707. var self=this;
  29708. self["@oldMethod"]=aMethod;
  29709. return self;
  29710. },
  29711. //>>excludeStart("ide", pragmas.excludeIdeData);
  29712. args: ["aMethod"],
  29713. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  29714. referencedClasses: [],
  29715. //>>excludeEnd("ide");
  29716. messageSends: []
  29717. }),
  29718. globals.MethodModified);
  29719. smalltalk.addClass('MethodMoved', globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  29720. //>>excludeStart("ide", pragmas.excludeIdeData);
  29721. 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.";
  29722. //>>excludeEnd("ide");
  29723. smalltalk.addMethod(
  29724. smalltalk.method({
  29725. selector: "oldProtocol",
  29726. protocol: 'accessing',
  29727. fn: function (){
  29728. var self=this;
  29729. var $1;
  29730. $1=self["@oldProtocol"];
  29731. return $1;
  29732. },
  29733. //>>excludeStart("ide", pragmas.excludeIdeData);
  29734. args: [],
  29735. source: "oldProtocol\x0a\x09^ oldProtocol",
  29736. referencedClasses: [],
  29737. //>>excludeEnd("ide");
  29738. messageSends: []
  29739. }),
  29740. globals.MethodMoved);
  29741. smalltalk.addMethod(
  29742. smalltalk.method({
  29743. selector: "oldProtocol:",
  29744. protocol: 'accessing',
  29745. fn: function (aString){
  29746. var self=this;
  29747. self["@oldProtocol"]=aString;
  29748. return self;
  29749. },
  29750. //>>excludeStart("ide", pragmas.excludeIdeData);
  29751. args: ["aString"],
  29752. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  29753. referencedClasses: [],
  29754. //>>excludeEnd("ide");
  29755. messageSends: []
  29756. }),
  29757. globals.MethodMoved);
  29758. smalltalk.addClass('MethodRemoved', globals.MethodAnnouncement, [], 'Kernel-Announcements');
  29759. //>>excludeStart("ide", pragmas.excludeIdeData);
  29760. globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  29761. //>>excludeEnd("ide");
  29762. smalltalk.addClass('PackageAnnouncement', globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  29763. //>>excludeStart("ide", pragmas.excludeIdeData);
  29764. globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  29765. //>>excludeEnd("ide");
  29766. smalltalk.addMethod(
  29767. smalltalk.method({
  29768. selector: "package",
  29769. protocol: 'accessing',
  29770. fn: function (){
  29771. var self=this;
  29772. var $1;
  29773. $1=self["@package"];
  29774. return $1;
  29775. },
  29776. //>>excludeStart("ide", pragmas.excludeIdeData);
  29777. args: [],
  29778. source: "package\x0a\x09^ package",
  29779. referencedClasses: [],
  29780. //>>excludeEnd("ide");
  29781. messageSends: []
  29782. }),
  29783. globals.PackageAnnouncement);
  29784. smalltalk.addMethod(
  29785. smalltalk.method({
  29786. selector: "package:",
  29787. protocol: 'accessing',
  29788. fn: function (aPackage){
  29789. var self=this;
  29790. self["@package"]=aPackage;
  29791. return self;
  29792. },
  29793. //>>excludeStart("ide", pragmas.excludeIdeData);
  29794. args: ["aPackage"],
  29795. source: "package: aPackage\x0a\x09package := aPackage",
  29796. referencedClasses: [],
  29797. //>>excludeEnd("ide");
  29798. messageSends: []
  29799. }),
  29800. globals.PackageAnnouncement);
  29801. smalltalk.addClass('PackageAdded', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29802. //>>excludeStart("ide", pragmas.excludeIdeData);
  29803. globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  29804. //>>excludeEnd("ide");
  29805. smalltalk.addClass('PackageClean', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29806. //>>excludeStart("ide", pragmas.excludeIdeData);
  29807. globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  29808. //>>excludeEnd("ide");
  29809. smalltalk.addClass('PackageDirty', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29810. //>>excludeStart("ide", pragmas.excludeIdeData);
  29811. globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  29812. //>>excludeEnd("ide");
  29813. smalltalk.addClass('PackageRemoved', globals.PackageAnnouncement, [], 'Kernel-Announcements');
  29814. //>>excludeStart("ide", pragmas.excludeIdeData);
  29815. globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  29816. //>>excludeEnd("ide");
  29817. smalltalk.addClass('ProtocolAnnouncement', globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  29818. //>>excludeStart("ide", pragmas.excludeIdeData);
  29819. globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  29820. //>>excludeEnd("ide");
  29821. smalltalk.addMethod(
  29822. smalltalk.method({
  29823. selector: "package",
  29824. protocol: 'accessing',
  29825. fn: function (){
  29826. var self=this;
  29827. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  29828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29829. return smalltalk.withContext(function($ctx1) {
  29830. //>>excludeEnd("ctx");
  29831. var $2,$1,$3,$4;
  29832. $2=self._protocol();
  29833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29834. $ctx1.sendIdx["protocol"]=1;
  29835. //>>excludeEnd("ctx");
  29836. $1=_st($2)._beginsWith_("*");
  29837. if(! smalltalk.assert($1)){
  29838. $3=_st(self._theClass())._package();
  29839. return $3;
  29840. };
  29841. $4=_st($Package())._named_ifAbsent_(_st(self._protocol())._allButFirst(),(function(){
  29842. return nil;
  29843. }));
  29844. return $4;
  29845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29846. }, function($ctx1) {$ctx1.fill(self,"package",{},globals.ProtocolAnnouncement)});
  29847. //>>excludeEnd("ctx");
  29848. },
  29849. //>>excludeStart("ide", pragmas.excludeIdeData);
  29850. args: [],
  29851. 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 ]",
  29852. referencedClasses: ["Package"],
  29853. //>>excludeEnd("ide");
  29854. messageSends: ["ifFalse:", "beginsWith:", "protocol", "package", "theClass", "named:ifAbsent:", "allButFirst"]
  29855. }),
  29856. globals.ProtocolAnnouncement);
  29857. smalltalk.addMethod(
  29858. smalltalk.method({
  29859. selector: "protocol",
  29860. protocol: 'accessing',
  29861. fn: function (){
  29862. var self=this;
  29863. var $1;
  29864. $1=self["@protocol"];
  29865. return $1;
  29866. },
  29867. //>>excludeStart("ide", pragmas.excludeIdeData);
  29868. args: [],
  29869. source: "protocol\x0a\x09^ protocol",
  29870. referencedClasses: [],
  29871. //>>excludeEnd("ide");
  29872. messageSends: []
  29873. }),
  29874. globals.ProtocolAnnouncement);
  29875. smalltalk.addMethod(
  29876. smalltalk.method({
  29877. selector: "protocol:",
  29878. protocol: 'accessing',
  29879. fn: function (aString){
  29880. var self=this;
  29881. self["@protocol"]=aString;
  29882. return self;
  29883. },
  29884. //>>excludeStart("ide", pragmas.excludeIdeData);
  29885. args: ["aString"],
  29886. source: "protocol: aString\x0a\x09protocol := aString",
  29887. referencedClasses: [],
  29888. //>>excludeEnd("ide");
  29889. messageSends: []
  29890. }),
  29891. globals.ProtocolAnnouncement);
  29892. smalltalk.addMethod(
  29893. smalltalk.method({
  29894. selector: "theClass",
  29895. protocol: 'accessing',
  29896. fn: function (){
  29897. var self=this;
  29898. var $1;
  29899. $1=self["@theClass"];
  29900. return $1;
  29901. },
  29902. //>>excludeStart("ide", pragmas.excludeIdeData);
  29903. args: [],
  29904. source: "theClass\x0a\x09^ theClass",
  29905. referencedClasses: [],
  29906. //>>excludeEnd("ide");
  29907. messageSends: []
  29908. }),
  29909. globals.ProtocolAnnouncement);
  29910. smalltalk.addMethod(
  29911. smalltalk.method({
  29912. selector: "theClass:",
  29913. protocol: 'accessing',
  29914. fn: function (aClass){
  29915. var self=this;
  29916. self["@theClass"]=aClass;
  29917. return self;
  29918. },
  29919. //>>excludeStart("ide", pragmas.excludeIdeData);
  29920. args: ["aClass"],
  29921. source: "theClass: aClass\x0a\x09theClass := aClass",
  29922. referencedClasses: [],
  29923. //>>excludeEnd("ide");
  29924. messageSends: []
  29925. }),
  29926. globals.ProtocolAnnouncement);
  29927. smalltalk.addClass('ProtocolAdded', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  29928. //>>excludeStart("ide", pragmas.excludeIdeData);
  29929. globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  29930. //>>excludeEnd("ide");
  29931. smalltalk.addClass('ProtocolRemoved', globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  29932. //>>excludeStart("ide", pragmas.excludeIdeData);
  29933. globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  29934. //>>excludeEnd("ide");
  29935. });
  29936. define("amber_core/Compiler-Exceptions", ["amber/boot", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){
  29937. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  29938. smalltalk.addPackage('Compiler-Exceptions');
  29939. smalltalk.packages["Compiler-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29940. smalltalk.addClass('CompilerError', globals.Error, [], 'Compiler-Exceptions');
  29941. //>>excludeStart("ide", pragmas.excludeIdeData);
  29942. globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  29943. //>>excludeEnd("ide");
  29944. smalltalk.addClass('ParseError', globals.CompilerError, [], 'Compiler-Exceptions');
  29945. //>>excludeStart("ide", pragmas.excludeIdeData);
  29946. globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  29947. //>>excludeEnd("ide");
  29948. smalltalk.addClass('SemanticError', globals.CompilerError, [], 'Compiler-Exceptions');
  29949. //>>excludeStart("ide", pragmas.excludeIdeData);
  29950. 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";
  29951. //>>excludeEnd("ide");
  29952. smalltalk.addClass('InliningError', globals.SemanticError, [], 'Compiler-Exceptions');
  29953. //>>excludeStart("ide", pragmas.excludeIdeData);
  29954. globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  29955. //>>excludeEnd("ide");
  29956. smalltalk.addClass('InvalidAssignmentError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  29957. //>>excludeStart("ide", pragmas.excludeIdeData);
  29958. globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  29959. //>>excludeEnd("ide");
  29960. smalltalk.addMethod(
  29961. smalltalk.method({
  29962. selector: "messageText",
  29963. protocol: 'accessing',
  29964. fn: function (){
  29965. var self=this;
  29966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29967. return smalltalk.withContext(function($ctx1) {
  29968. //>>excludeEnd("ctx");
  29969. var $1;
  29970. $1=" Invalid assignment to variable: ".__comma(self._variableName());
  29971. return $1;
  29972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29973. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.InvalidAssignmentError)});
  29974. //>>excludeEnd("ctx");
  29975. },
  29976. //>>excludeStart("ide", pragmas.excludeIdeData);
  29977. args: [],
  29978. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  29979. referencedClasses: [],
  29980. //>>excludeEnd("ide");
  29981. messageSends: [",", "variableName"]
  29982. }),
  29983. globals.InvalidAssignmentError);
  29984. smalltalk.addMethod(
  29985. smalltalk.method({
  29986. selector: "variableName",
  29987. protocol: 'accessing',
  29988. fn: function (){
  29989. var self=this;
  29990. var $1;
  29991. $1=self["@variableName"];
  29992. return $1;
  29993. },
  29994. //>>excludeStart("ide", pragmas.excludeIdeData);
  29995. args: [],
  29996. source: "variableName\x0a\x09^ variableName",
  29997. referencedClasses: [],
  29998. //>>excludeEnd("ide");
  29999. messageSends: []
  30000. }),
  30001. globals.InvalidAssignmentError);
  30002. smalltalk.addMethod(
  30003. smalltalk.method({
  30004. selector: "variableName:",
  30005. protocol: 'accessing',
  30006. fn: function (aString){
  30007. var self=this;
  30008. self["@variableName"]=aString;
  30009. return self;
  30010. },
  30011. //>>excludeStart("ide", pragmas.excludeIdeData);
  30012. args: ["aString"],
  30013. source: "variableName: aString\x0a\x09variableName := aString",
  30014. referencedClasses: [],
  30015. //>>excludeEnd("ide");
  30016. messageSends: []
  30017. }),
  30018. globals.InvalidAssignmentError);
  30019. smalltalk.addClass('ShadowingVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30020. //>>excludeStart("ide", pragmas.excludeIdeData);
  30021. 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.";
  30022. //>>excludeEnd("ide");
  30023. smalltalk.addMethod(
  30024. smalltalk.method({
  30025. selector: "messageText",
  30026. protocol: 'accessing',
  30027. fn: function (){
  30028. var self=this;
  30029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30030. return smalltalk.withContext(function($ctx1) {
  30031. //>>excludeEnd("ctx");
  30032. var $1;
  30033. $1=_st("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  30034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30035. $ctx1.sendIdx[","]=1;
  30036. //>>excludeEnd("ctx");
  30037. return $1;
  30038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30039. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.ShadowingVariableError)});
  30040. //>>excludeEnd("ctx");
  30041. },
  30042. //>>excludeStart("ide", pragmas.excludeIdeData);
  30043. args: [],
  30044. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  30045. referencedClasses: [],
  30046. //>>excludeEnd("ide");
  30047. messageSends: [",", "variableName"]
  30048. }),
  30049. globals.ShadowingVariableError);
  30050. smalltalk.addMethod(
  30051. smalltalk.method({
  30052. selector: "variableName",
  30053. protocol: 'accessing',
  30054. fn: function (){
  30055. var self=this;
  30056. var $1;
  30057. $1=self["@variableName"];
  30058. return $1;
  30059. },
  30060. //>>excludeStart("ide", pragmas.excludeIdeData);
  30061. args: [],
  30062. source: "variableName\x0a\x09^ variableName",
  30063. referencedClasses: [],
  30064. //>>excludeEnd("ide");
  30065. messageSends: []
  30066. }),
  30067. globals.ShadowingVariableError);
  30068. smalltalk.addMethod(
  30069. smalltalk.method({
  30070. selector: "variableName:",
  30071. protocol: 'accessing',
  30072. fn: function (aString){
  30073. var self=this;
  30074. self["@variableName"]=aString;
  30075. return self;
  30076. },
  30077. //>>excludeStart("ide", pragmas.excludeIdeData);
  30078. args: ["aString"],
  30079. source: "variableName: aString\x0a\x09variableName := aString",
  30080. referencedClasses: [],
  30081. //>>excludeEnd("ide");
  30082. messageSends: []
  30083. }),
  30084. globals.ShadowingVariableError);
  30085. smalltalk.addClass('UnknownVariableError', globals.SemanticError, ['variableName'], 'Compiler-Exceptions');
  30086. //>>excludeStart("ide", pragmas.excludeIdeData);
  30087. 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.";
  30088. //>>excludeEnd("ide");
  30089. smalltalk.addMethod(
  30090. smalltalk.method({
  30091. selector: "messageText",
  30092. protocol: 'accessing',
  30093. fn: function (){
  30094. var self=this;
  30095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30096. return smalltalk.withContext(function($ctx1) {
  30097. //>>excludeEnd("ctx");
  30098. var $1;
  30099. $1=_st("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  30100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30101. $ctx1.sendIdx[","]=1;
  30102. //>>excludeEnd("ctx");
  30103. return $1;
  30104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30105. }, function($ctx1) {$ctx1.fill(self,"messageText",{},globals.UnknownVariableError)});
  30106. //>>excludeEnd("ctx");
  30107. },
  30108. //>>excludeStart("ide", pragmas.excludeIdeData);
  30109. args: [],
  30110. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  30111. referencedClasses: [],
  30112. //>>excludeEnd("ide");
  30113. messageSends: [",", "variableName"]
  30114. }),
  30115. globals.UnknownVariableError);
  30116. smalltalk.addMethod(
  30117. smalltalk.method({
  30118. selector: "variableName",
  30119. protocol: 'accessing',
  30120. fn: function (){
  30121. var self=this;
  30122. var $1;
  30123. $1=self["@variableName"];
  30124. return $1;
  30125. },
  30126. //>>excludeStart("ide", pragmas.excludeIdeData);
  30127. args: [],
  30128. source: "variableName\x0a\x09^ variableName",
  30129. referencedClasses: [],
  30130. //>>excludeEnd("ide");
  30131. messageSends: []
  30132. }),
  30133. globals.UnknownVariableError);
  30134. smalltalk.addMethod(
  30135. smalltalk.method({
  30136. selector: "variableName:",
  30137. protocol: 'accessing',
  30138. fn: function (aString){
  30139. var self=this;
  30140. self["@variableName"]=aString;
  30141. return self;
  30142. },
  30143. //>>excludeStart("ide", pragmas.excludeIdeData);
  30144. args: ["aString"],
  30145. source: "variableName: aString\x0a\x09variableName := aString",
  30146. referencedClasses: [],
  30147. //>>excludeEnd("ide");
  30148. messageSends: []
  30149. }),
  30150. globals.UnknownVariableError);
  30151. smalltalk.addClass('RethrowErrorHandler', globals.Object, [], 'Compiler-Exceptions');
  30152. //>>excludeStart("ide", pragmas.excludeIdeData);
  30153. 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.";
  30154. //>>excludeEnd("ide");
  30155. smalltalk.addMethod(
  30156. smalltalk.method({
  30157. selector: "basicSignal:",
  30158. protocol: 'error handling',
  30159. fn: function (anError){
  30160. var self=this;
  30161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30162. return smalltalk.withContext(function($ctx1) {
  30163. //>>excludeEnd("ctx");
  30164. throw anError;
  30165. return self;
  30166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30167. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},globals.RethrowErrorHandler)});
  30168. //>>excludeEnd("ctx");
  30169. },
  30170. //>>excludeStart("ide", pragmas.excludeIdeData);
  30171. args: ["anError"],
  30172. source: "basicSignal: anError\x0a <throw anError>",
  30173. referencedClasses: [],
  30174. //>>excludeEnd("ide");
  30175. messageSends: []
  30176. }),
  30177. globals.RethrowErrorHandler);
  30178. smalltalk.addMethod(
  30179. smalltalk.method({
  30180. selector: "handleError:",
  30181. protocol: 'error handling',
  30182. fn: function (anError){
  30183. var self=this;
  30184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30185. return smalltalk.withContext(function($ctx1) {
  30186. //>>excludeEnd("ctx");
  30187. self._basicSignal_(anError);
  30188. return self;
  30189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30190. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},globals.RethrowErrorHandler)});
  30191. //>>excludeEnd("ctx");
  30192. },
  30193. //>>excludeStart("ide", pragmas.excludeIdeData);
  30194. args: ["anError"],
  30195. source: "handleError: anError\x0a self basicSignal: anError",
  30196. referencedClasses: [],
  30197. //>>excludeEnd("ide");
  30198. messageSends: ["basicSignal:"]
  30199. }),
  30200. globals.RethrowErrorHandler);
  30201. });
  30202. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Collections"], function($boot){
  30203. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  30204. smalltalk.addPackage('Compiler-Core');
  30205. smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30206. smalltalk.addClass('AbstractCodeGenerator', globals.Object, ['currentClass', 'source'], 'Compiler-Core');
  30207. //>>excludeStart("ide", pragmas.excludeIdeData);
  30208. globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  30209. //>>excludeEnd("ide");
  30210. smalltalk.addMethod(
  30211. smalltalk.method({
  30212. selector: "classNameFor:",
  30213. protocol: 'accessing',
  30214. fn: function (aClass){
  30215. var self=this;
  30216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30217. return smalltalk.withContext(function($ctx1) {
  30218. //>>excludeEnd("ctx");
  30219. var $2,$3,$4,$1;
  30220. $2=_st(aClass)._isMetaclass();
  30221. if(smalltalk.assert($2)){
  30222. $3=_st(_st(aClass)._instanceClass())._name();
  30223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30224. $ctx1.sendIdx["name"]=1;
  30225. //>>excludeEnd("ctx");
  30226. $1=_st($3).__comma(".klass");
  30227. } else {
  30228. $4=_st(aClass)._isNil();
  30229. if(smalltalk.assert($4)){
  30230. $1="nil";
  30231. } else {
  30232. $1=_st(aClass)._name();
  30233. };
  30234. };
  30235. return $1;
  30236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30237. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractCodeGenerator)});
  30238. //>>excludeEnd("ctx");
  30239. },
  30240. //>>excludeStart("ide", pragmas.excludeIdeData);
  30241. args: ["aClass"],
  30242. 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 ]]",
  30243. referencedClasses: [],
  30244. //>>excludeEnd("ide");
  30245. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  30246. }),
  30247. globals.AbstractCodeGenerator);
  30248. smalltalk.addMethod(
  30249. smalltalk.method({
  30250. selector: "compileNode:",
  30251. protocol: 'compiling',
  30252. fn: function (aNode){
  30253. var self=this;
  30254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30255. return smalltalk.withContext(function($ctx1) {
  30256. //>>excludeEnd("ctx");
  30257. self._subclassResponsibility();
  30258. return self;
  30259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30260. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},globals.AbstractCodeGenerator)});
  30261. //>>excludeEnd("ctx");
  30262. },
  30263. //>>excludeStart("ide", pragmas.excludeIdeData);
  30264. args: ["aNode"],
  30265. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  30266. referencedClasses: [],
  30267. //>>excludeEnd("ide");
  30268. messageSends: ["subclassResponsibility"]
  30269. }),
  30270. globals.AbstractCodeGenerator);
  30271. smalltalk.addMethod(
  30272. smalltalk.method({
  30273. selector: "currentClass",
  30274. protocol: 'accessing',
  30275. fn: function (){
  30276. var self=this;
  30277. var $1;
  30278. $1=self["@currentClass"];
  30279. return $1;
  30280. },
  30281. //>>excludeStart("ide", pragmas.excludeIdeData);
  30282. args: [],
  30283. source: "currentClass\x0a\x09^ currentClass",
  30284. referencedClasses: [],
  30285. //>>excludeEnd("ide");
  30286. messageSends: []
  30287. }),
  30288. globals.AbstractCodeGenerator);
  30289. smalltalk.addMethod(
  30290. smalltalk.method({
  30291. selector: "currentClass:",
  30292. protocol: 'accessing',
  30293. fn: function (aClass){
  30294. var self=this;
  30295. self["@currentClass"]=aClass;
  30296. return self;
  30297. },
  30298. //>>excludeStart("ide", pragmas.excludeIdeData);
  30299. args: ["aClass"],
  30300. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30301. referencedClasses: [],
  30302. //>>excludeEnd("ide");
  30303. messageSends: []
  30304. }),
  30305. globals.AbstractCodeGenerator);
  30306. smalltalk.addMethod(
  30307. smalltalk.method({
  30308. selector: "pseudoVariables",
  30309. protocol: 'accessing',
  30310. fn: function (){
  30311. var self=this;
  30312. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30314. return smalltalk.withContext(function($ctx1) {
  30315. //>>excludeEnd("ctx");
  30316. var $1;
  30317. $1=_st($Smalltalk())._pseudoVariableNames();
  30318. return $1;
  30319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30320. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},globals.AbstractCodeGenerator)});
  30321. //>>excludeEnd("ctx");
  30322. },
  30323. //>>excludeStart("ide", pragmas.excludeIdeData);
  30324. args: [],
  30325. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  30326. referencedClasses: ["Smalltalk"],
  30327. //>>excludeEnd("ide");
  30328. messageSends: ["pseudoVariableNames"]
  30329. }),
  30330. globals.AbstractCodeGenerator);
  30331. smalltalk.addMethod(
  30332. smalltalk.method({
  30333. selector: "source",
  30334. protocol: 'accessing',
  30335. fn: function (){
  30336. var self=this;
  30337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30338. return smalltalk.withContext(function($ctx1) {
  30339. //>>excludeEnd("ctx");
  30340. var $2,$1,$receiver;
  30341. $2=self["@source"];
  30342. if(($receiver = $2) == null || $receiver.isNil){
  30343. $1="";
  30344. } else {
  30345. $1=$2;
  30346. };
  30347. return $1;
  30348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30349. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.AbstractCodeGenerator)});
  30350. //>>excludeEnd("ctx");
  30351. },
  30352. //>>excludeStart("ide", pragmas.excludeIdeData);
  30353. args: [],
  30354. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30355. referencedClasses: [],
  30356. //>>excludeEnd("ide");
  30357. messageSends: ["ifNil:"]
  30358. }),
  30359. globals.AbstractCodeGenerator);
  30360. smalltalk.addMethod(
  30361. smalltalk.method({
  30362. selector: "source:",
  30363. protocol: 'accessing',
  30364. fn: function (aString){
  30365. var self=this;
  30366. self["@source"]=aString;
  30367. return self;
  30368. },
  30369. //>>excludeStart("ide", pragmas.excludeIdeData);
  30370. args: ["aString"],
  30371. source: "source: aString\x0a\x09source := aString",
  30372. referencedClasses: [],
  30373. //>>excludeEnd("ide");
  30374. messageSends: []
  30375. }),
  30376. globals.AbstractCodeGenerator);
  30377. smalltalk.addClass('CodeGenerator', globals.AbstractCodeGenerator, [], 'Compiler-Core');
  30378. //>>excludeStart("ide", pragmas.excludeIdeData);
  30379. 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.";
  30380. //>>excludeEnd("ide");
  30381. smalltalk.addMethod(
  30382. smalltalk.method({
  30383. selector: "compileNode:",
  30384. protocol: 'compiling',
  30385. fn: function (aNode){
  30386. var self=this;
  30387. var ir,stream;
  30388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30389. return smalltalk.withContext(function($ctx1) {
  30390. //>>excludeEnd("ctx");
  30391. var $2,$3,$1;
  30392. _st(self._semanticAnalyzer())._visit_(aNode);
  30393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30394. $ctx1.sendIdx["visit:"]=1;
  30395. //>>excludeEnd("ctx");
  30396. ir=_st(self._translator())._visit_(aNode);
  30397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30398. $ctx1.sendIdx["visit:"]=2;
  30399. //>>excludeEnd("ctx");
  30400. $2=self._irTranslator();
  30401. _st($2)._currentClass_(self._currentClass());
  30402. _st($2)._visit_(ir);
  30403. $3=_st($2)._contents();
  30404. $1=$3;
  30405. return $1;
  30406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30407. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.CodeGenerator)});
  30408. //>>excludeEnd("ctx");
  30409. },
  30410. //>>excludeStart("ide", pragmas.excludeIdeData);
  30411. args: ["aNode"],
  30412. 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",
  30413. referencedClasses: [],
  30414. //>>excludeEnd("ide");
  30415. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  30416. }),
  30417. globals.CodeGenerator);
  30418. smalltalk.addMethod(
  30419. smalltalk.method({
  30420. selector: "irTranslator",
  30421. protocol: 'compiling',
  30422. fn: function (){
  30423. var self=this;
  30424. function $IRJSTranslator(){return globals.IRJSTranslator||(typeof IRJSTranslator=="undefined"?nil:IRJSTranslator)}
  30425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30426. return smalltalk.withContext(function($ctx1) {
  30427. //>>excludeEnd("ctx");
  30428. var $1;
  30429. $1=_st($IRJSTranslator())._new();
  30430. return $1;
  30431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30432. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.CodeGenerator)});
  30433. //>>excludeEnd("ctx");
  30434. },
  30435. //>>excludeStart("ide", pragmas.excludeIdeData);
  30436. args: [],
  30437. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  30438. referencedClasses: ["IRJSTranslator"],
  30439. //>>excludeEnd("ide");
  30440. messageSends: ["new"]
  30441. }),
  30442. globals.CodeGenerator);
  30443. smalltalk.addMethod(
  30444. smalltalk.method({
  30445. selector: "semanticAnalyzer",
  30446. protocol: 'compiling',
  30447. fn: function (){
  30448. var self=this;
  30449. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  30450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30451. return smalltalk.withContext(function($ctx1) {
  30452. //>>excludeEnd("ctx");
  30453. var $1;
  30454. $1=_st($SemanticAnalyzer())._on_(self._currentClass());
  30455. return $1;
  30456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30457. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},globals.CodeGenerator)});
  30458. //>>excludeEnd("ctx");
  30459. },
  30460. //>>excludeStart("ide", pragmas.excludeIdeData);
  30461. args: [],
  30462. source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
  30463. referencedClasses: ["SemanticAnalyzer"],
  30464. //>>excludeEnd("ide");
  30465. messageSends: ["on:", "currentClass"]
  30466. }),
  30467. globals.CodeGenerator);
  30468. smalltalk.addMethod(
  30469. smalltalk.method({
  30470. selector: "translator",
  30471. protocol: 'compiling',
  30472. fn: function (){
  30473. var self=this;
  30474. function $IRASTTranslator(){return globals.IRASTTranslator||(typeof IRASTTranslator=="undefined"?nil:IRASTTranslator)}
  30475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30476. return smalltalk.withContext(function($ctx1) {
  30477. //>>excludeEnd("ctx");
  30478. var $2,$3,$1;
  30479. $2=_st($IRASTTranslator())._new();
  30480. _st($2)._source_(self._source());
  30481. _st($2)._theClass_(self._currentClass());
  30482. $3=_st($2)._yourself();
  30483. $1=$3;
  30484. return $1;
  30485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30486. }, function($ctx1) {$ctx1.fill(self,"translator",{},globals.CodeGenerator)});
  30487. //>>excludeEnd("ctx");
  30488. },
  30489. //>>excludeStart("ide", pragmas.excludeIdeData);
  30490. args: [],
  30491. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  30492. referencedClasses: ["IRASTTranslator"],
  30493. //>>excludeEnd("ide");
  30494. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  30495. }),
  30496. globals.CodeGenerator);
  30497. smalltalk.addClass('Compiler', globals.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  30498. //>>excludeStart("ide", pragmas.excludeIdeData);
  30499. 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`";
  30500. //>>excludeEnd("ide");
  30501. smalltalk.addMethod(
  30502. smalltalk.method({
  30503. selector: "codeGeneratorClass",
  30504. protocol: 'accessing',
  30505. fn: function (){
  30506. var self=this;
  30507. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  30508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30509. return smalltalk.withContext(function($ctx1) {
  30510. //>>excludeEnd("ctx");
  30511. var $2,$1,$receiver;
  30512. $2=self["@codeGeneratorClass"];
  30513. if(($receiver = $2) == null || $receiver.isNil){
  30514. $1=$InliningCodeGenerator();
  30515. } else {
  30516. $1=$2;
  30517. };
  30518. return $1;
  30519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30520. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},globals.Compiler)});
  30521. //>>excludeEnd("ctx");
  30522. },
  30523. //>>excludeStart("ide", pragmas.excludeIdeData);
  30524. args: [],
  30525. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  30526. referencedClasses: ["InliningCodeGenerator"],
  30527. //>>excludeEnd("ide");
  30528. messageSends: ["ifNil:"]
  30529. }),
  30530. globals.Compiler);
  30531. smalltalk.addMethod(
  30532. smalltalk.method({
  30533. selector: "codeGeneratorClass:",
  30534. protocol: 'accessing',
  30535. fn: function (aClass){
  30536. var self=this;
  30537. self["@codeGeneratorClass"]=aClass;
  30538. return self;
  30539. },
  30540. //>>excludeStart("ide", pragmas.excludeIdeData);
  30541. args: ["aClass"],
  30542. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30543. referencedClasses: [],
  30544. //>>excludeEnd("ide");
  30545. messageSends: []
  30546. }),
  30547. globals.Compiler);
  30548. smalltalk.addMethod(
  30549. smalltalk.method({
  30550. selector: "compile:",
  30551. protocol: 'compiling',
  30552. fn: function (aString){
  30553. var self=this;
  30554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30555. return smalltalk.withContext(function($ctx1) {
  30556. //>>excludeEnd("ctx");
  30557. var $1;
  30558. $1=self._compileNode_(self._parse_(aString));
  30559. return $1;
  30560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30561. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.Compiler)});
  30562. //>>excludeEnd("ctx");
  30563. },
  30564. //>>excludeStart("ide", pragmas.excludeIdeData);
  30565. args: ["aString"],
  30566. source: "compile: aString\x0a\x09^ self compileNode: (self parse: aString)",
  30567. referencedClasses: [],
  30568. //>>excludeEnd("ide");
  30569. messageSends: ["compileNode:", "parse:"]
  30570. }),
  30571. globals.Compiler);
  30572. smalltalk.addMethod(
  30573. smalltalk.method({
  30574. selector: "compile:forClass:",
  30575. protocol: 'compiling',
  30576. fn: function (aString,aClass){
  30577. var self=this;
  30578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30579. return smalltalk.withContext(function($ctx1) {
  30580. //>>excludeEnd("ctx");
  30581. var $1;
  30582. self._currentClass_(aClass);
  30583. self._source_(aString);
  30584. $1=self._compile_(aString);
  30585. return $1;
  30586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30587. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass},globals.Compiler)});
  30588. //>>excludeEnd("ctx");
  30589. },
  30590. //>>excludeStart("ide", pragmas.excludeIdeData);
  30591. args: ["aString", "aClass"],
  30592. source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^ self compile: aString",
  30593. referencedClasses: [],
  30594. //>>excludeEnd("ide");
  30595. messageSends: ["currentClass:", "source:", "compile:"]
  30596. }),
  30597. globals.Compiler);
  30598. smalltalk.addMethod(
  30599. smalltalk.method({
  30600. selector: "compileExpression:",
  30601. protocol: 'compiling',
  30602. fn: function (aString){
  30603. var self=this;
  30604. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30606. return smalltalk.withContext(function($ctx1) {
  30607. //>>excludeEnd("ctx");
  30608. var $1,$2;
  30609. self._currentClass_($DoIt());
  30610. $1=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30612. $ctx1.sendIdx[","]=1;
  30613. //>>excludeEnd("ctx");
  30614. self._source_($1);
  30615. $2=self._compileNode_(self._parse_(self._source()));
  30616. return $2;
  30617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30618. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString},globals.Compiler)});
  30619. //>>excludeEnd("ctx");
  30620. },
  30621. //>>excludeStart("ide", pragmas.excludeIdeData);
  30622. args: ["aString"],
  30623. source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  30624. referencedClasses: ["DoIt"],
  30625. //>>excludeEnd("ide");
  30626. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"]
  30627. }),
  30628. globals.Compiler);
  30629. smalltalk.addMethod(
  30630. smalltalk.method({
  30631. selector: "compileExpression:on:",
  30632. protocol: 'compiling',
  30633. fn: function (aString,anObject){
  30634. var self=this;
  30635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30636. return smalltalk.withContext(function($ctx1) {
  30637. //>>excludeEnd("ctx");
  30638. var $1,$2;
  30639. self._currentClass_(_st(anObject)._class());
  30640. $1=_st("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30642. $ctx1.sendIdx[","]=1;
  30643. //>>excludeEnd("ctx");
  30644. self._source_($1);
  30645. $2=self._compileNode_(self._parse_(self._source()));
  30646. return $2;
  30647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30648. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},globals.Compiler)});
  30649. //>>excludeEnd("ctx");
  30650. },
  30651. //>>excludeStart("ide", pragmas.excludeIdeData);
  30652. args: ["aString", "anObject"],
  30653. source: "compileExpression: aString on: anObject\x0a\x09self currentClass: anObject class.\x0a\x09self source: 'xxxDoIt ^ [ ', aString, ' ] value'.\x0a\x09^ self compileNode: (self parse: self source)",
  30654. referencedClasses: [],
  30655. //>>excludeEnd("ide");
  30656. messageSends: ["currentClass:", "class", "source:", ",", "compileNode:", "parse:", "source"]
  30657. }),
  30658. globals.Compiler);
  30659. smalltalk.addMethod(
  30660. smalltalk.method({
  30661. selector: "compileNode:",
  30662. protocol: 'compiling',
  30663. fn: function (aNode){
  30664. var self=this;
  30665. var generator,result;
  30666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30667. return smalltalk.withContext(function($ctx1) {
  30668. //>>excludeEnd("ctx");
  30669. var $1,$2,$3;
  30670. generator=_st(self._codeGeneratorClass())._new();
  30671. $1=generator;
  30672. _st($1)._source_(self._source());
  30673. $2=_st($1)._currentClass_(self._currentClass());
  30674. result=_st(generator)._compileNode_(aNode);
  30675. self._unknownVariables_([]);
  30676. $3=result;
  30677. return $3;
  30678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30679. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},globals.Compiler)});
  30680. //>>excludeEnd("ctx");
  30681. },
  30682. //>>excludeStart("ide", pragmas.excludeIdeData);
  30683. args: ["aNode"],
  30684. 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",
  30685. referencedClasses: [],
  30686. //>>excludeEnd("ide");
  30687. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"]
  30688. }),
  30689. globals.Compiler);
  30690. smalltalk.addMethod(
  30691. smalltalk.method({
  30692. selector: "currentClass",
  30693. protocol: 'accessing',
  30694. fn: function (){
  30695. var self=this;
  30696. var $1;
  30697. $1=self["@currentClass"];
  30698. return $1;
  30699. },
  30700. //>>excludeStart("ide", pragmas.excludeIdeData);
  30701. args: [],
  30702. source: "currentClass\x0a\x09^ currentClass",
  30703. referencedClasses: [],
  30704. //>>excludeEnd("ide");
  30705. messageSends: []
  30706. }),
  30707. globals.Compiler);
  30708. smalltalk.addMethod(
  30709. smalltalk.method({
  30710. selector: "currentClass:",
  30711. protocol: 'accessing',
  30712. fn: function (aClass){
  30713. var self=this;
  30714. self["@currentClass"]=aClass;
  30715. return self;
  30716. },
  30717. //>>excludeStart("ide", pragmas.excludeIdeData);
  30718. args: ["aClass"],
  30719. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30720. referencedClasses: [],
  30721. //>>excludeEnd("ide");
  30722. messageSends: []
  30723. }),
  30724. globals.Compiler);
  30725. smalltalk.addMethod(
  30726. smalltalk.method({
  30727. selector: "eval:",
  30728. protocol: 'compiling',
  30729. fn: function (aString){
  30730. var self=this;
  30731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30732. return smalltalk.withContext(function($ctx1) {
  30733. //>>excludeEnd("ctx");
  30734. return eval(aString);
  30735. return self;
  30736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30737. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},globals.Compiler)});
  30738. //>>excludeEnd("ctx");
  30739. },
  30740. //>>excludeStart("ide", pragmas.excludeIdeData);
  30741. args: ["aString"],
  30742. source: "eval: aString\x0a\x09<return eval(aString)>",
  30743. referencedClasses: [],
  30744. //>>excludeEnd("ide");
  30745. messageSends: []
  30746. }),
  30747. globals.Compiler);
  30748. smalltalk.addMethod(
  30749. smalltalk.method({
  30750. selector: "evaluateExpression:",
  30751. protocol: 'compiling',
  30752. fn: function (aString){
  30753. var self=this;
  30754. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  30755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30756. return smalltalk.withContext(function($ctx1) {
  30757. //>>excludeEnd("ctx");
  30758. var $1;
  30759. $1=self._evaluateExpression_on_(aString,_st($DoIt())._new());
  30760. return $1;
  30761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30762. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},globals.Compiler)});
  30763. //>>excludeEnd("ctx");
  30764. },
  30765. //>>excludeStart("ide", pragmas.excludeIdeData);
  30766. args: ["aString"],
  30767. 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",
  30768. referencedClasses: ["DoIt"],
  30769. //>>excludeEnd("ide");
  30770. messageSends: ["evaluateExpression:on:", "new"]
  30771. }),
  30772. globals.Compiler);
  30773. smalltalk.addMethod(
  30774. smalltalk.method({
  30775. selector: "evaluateExpression:on:",
  30776. protocol: 'compiling',
  30777. fn: function (aString,anObject){
  30778. var self=this;
  30779. var result,method;
  30780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30781. return smalltalk.withContext(function($ctx1) {
  30782. //>>excludeEnd("ctx");
  30783. var $1,$2;
  30784. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30785. _st(method)._protocol_("**xxxDoIt");
  30786. $1=_st(anObject)._class();
  30787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30788. $ctx1.sendIdx["class"]=1;
  30789. //>>excludeEnd("ctx");
  30790. _st($1)._addCompiledMethod_(method);
  30791. result=_st(anObject)._xxxDoIt();
  30792. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  30793. $2=result;
  30794. return $2;
  30795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30796. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},globals.Compiler)});
  30797. //>>excludeEnd("ctx");
  30798. },
  30799. //>>excludeStart("ide", pragmas.excludeIdeData);
  30800. args: ["aString", "anObject"],
  30801. 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",
  30802. referencedClasses: [],
  30803. //>>excludeEnd("ide");
  30804. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30805. }),
  30806. globals.Compiler);
  30807. smalltalk.addMethod(
  30808. smalltalk.method({
  30809. selector: "install:forClass:protocol:",
  30810. protocol: 'compiling',
  30811. fn: function (aString,aBehavior,anotherString){
  30812. var self=this;
  30813. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  30814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30815. return smalltalk.withContext(function($ctx1) {
  30816. //>>excludeEnd("ctx");
  30817. var $1;
  30818. $1=_st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(self._eval_(self._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  30819. return $1;
  30820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30821. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString},globals.Compiler)});
  30822. //>>excludeEnd("ctx");
  30823. },
  30824. //>>excludeStart("ide", pragmas.excludeIdeData);
  30825. args: ["aString", "aBehavior", "anotherString"],
  30826. 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",
  30827. referencedClasses: ["ClassBuilder"],
  30828. //>>excludeEnd("ide");
  30829. messageSends: ["installMethod:forClass:protocol:", "new", "eval:", "compile:forClass:"]
  30830. }),
  30831. globals.Compiler);
  30832. smalltalk.addMethod(
  30833. smalltalk.method({
  30834. selector: "parse:",
  30835. protocol: 'compiling',
  30836. fn: function (aString){
  30837. var self=this;
  30838. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30840. return smalltalk.withContext(function($ctx1) {
  30841. //>>excludeEnd("ctx");
  30842. var $1;
  30843. $1=_st($Smalltalk())._parse_(aString);
  30844. return $1;
  30845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30846. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.Compiler)});
  30847. //>>excludeEnd("ctx");
  30848. },
  30849. //>>excludeStart("ide", pragmas.excludeIdeData);
  30850. args: ["aString"],
  30851. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30852. referencedClasses: ["Smalltalk"],
  30853. //>>excludeEnd("ide");
  30854. messageSends: ["parse:"]
  30855. }),
  30856. globals.Compiler);
  30857. smalltalk.addMethod(
  30858. smalltalk.method({
  30859. selector: "parseExpression:",
  30860. protocol: 'compiling',
  30861. fn: function (aString){
  30862. var self=this;
  30863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30864. return smalltalk.withContext(function($ctx1) {
  30865. //>>excludeEnd("ctx");
  30866. var $2,$1;
  30867. $2=_st("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30869. $ctx1.sendIdx[","]=1;
  30870. //>>excludeEnd("ctx");
  30871. $1=self._parse_($2);
  30872. return $1;
  30873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30874. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},globals.Compiler)});
  30875. //>>excludeEnd("ctx");
  30876. },
  30877. //>>excludeStart("ide", pragmas.excludeIdeData);
  30878. args: ["aString"],
  30879. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30880. referencedClasses: [],
  30881. //>>excludeEnd("ide");
  30882. messageSends: ["parse:", ","]
  30883. }),
  30884. globals.Compiler);
  30885. smalltalk.addMethod(
  30886. smalltalk.method({
  30887. selector: "recompile:",
  30888. protocol: 'compiling',
  30889. fn: function (aClass){
  30890. var self=this;
  30891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30892. return smalltalk.withContext(function($ctx1) {
  30893. //>>excludeEnd("ctx");
  30894. var $1;
  30895. _st(_st(_st(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30897. return smalltalk.withContext(function($ctx2) {
  30898. //>>excludeEnd("ctx");
  30899. return self._install_forClass_protocol_(_st(each)._source(),aClass,_st(each)._protocol());
  30900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30902. //>>excludeEnd("ctx");
  30903. }),"Recompiling ".__comma(_st(aClass)._name()));
  30904. $1=_st(aClass)._isMetaclass();
  30905. if(! smalltalk.assert($1)){
  30906. self._recompile_(_st(aClass)._class());
  30907. };
  30908. return self;
  30909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30910. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler)});
  30911. //>>excludeEnd("ctx");
  30912. },
  30913. //>>excludeStart("ide", pragmas.excludeIdeData);
  30914. args: ["aClass"],
  30915. 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 ]",
  30916. referencedClasses: [],
  30917. //>>excludeEnd("ide");
  30918. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30919. }),
  30920. globals.Compiler);
  30921. smalltalk.addMethod(
  30922. smalltalk.method({
  30923. selector: "recompileAll",
  30924. protocol: 'compiling',
  30925. fn: function (){
  30926. var self=this;
  30927. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  30928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30929. return smalltalk.withContext(function($ctx1) {
  30930. //>>excludeEnd("ctx");
  30931. _st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
  30932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30933. return smalltalk.withContext(function($ctx2) {
  30934. //>>excludeEnd("ctx");
  30935. return self._recompile_(each);
  30936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30938. //>>excludeEnd("ctx");
  30939. }),"Compiling all classes...");
  30940. return self;
  30941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30942. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler)});
  30943. //>>excludeEnd("ctx");
  30944. },
  30945. //>>excludeStart("ide", pragmas.excludeIdeData);
  30946. args: [],
  30947. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30948. referencedClasses: ["Smalltalk"],
  30949. //>>excludeEnd("ide");
  30950. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30951. }),
  30952. globals.Compiler);
  30953. smalltalk.addMethod(
  30954. smalltalk.method({
  30955. selector: "source",
  30956. protocol: 'accessing',
  30957. fn: function (){
  30958. var self=this;
  30959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30960. return smalltalk.withContext(function($ctx1) {
  30961. //>>excludeEnd("ctx");
  30962. var $2,$1,$receiver;
  30963. $2=self["@source"];
  30964. if(($receiver = $2) == null || $receiver.isNil){
  30965. $1="";
  30966. } else {
  30967. $1=$2;
  30968. };
  30969. return $1;
  30970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30971. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Compiler)});
  30972. //>>excludeEnd("ctx");
  30973. },
  30974. //>>excludeStart("ide", pragmas.excludeIdeData);
  30975. args: [],
  30976. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30977. referencedClasses: [],
  30978. //>>excludeEnd("ide");
  30979. messageSends: ["ifNil:"]
  30980. }),
  30981. globals.Compiler);
  30982. smalltalk.addMethod(
  30983. smalltalk.method({
  30984. selector: "source:",
  30985. protocol: 'accessing',
  30986. fn: function (aString){
  30987. var self=this;
  30988. self["@source"]=aString;
  30989. return self;
  30990. },
  30991. //>>excludeStart("ide", pragmas.excludeIdeData);
  30992. args: ["aString"],
  30993. source: "source: aString\x0a\x09source := aString",
  30994. referencedClasses: [],
  30995. //>>excludeEnd("ide");
  30996. messageSends: []
  30997. }),
  30998. globals.Compiler);
  30999. smalltalk.addMethod(
  31000. smalltalk.method({
  31001. selector: "unknownVariables",
  31002. protocol: 'accessing',
  31003. fn: function (){
  31004. var self=this;
  31005. var $1;
  31006. $1=self["@unknownVariables"];
  31007. return $1;
  31008. },
  31009. //>>excludeStart("ide", pragmas.excludeIdeData);
  31010. args: [],
  31011. source: "unknownVariables\x0a\x09^ unknownVariables",
  31012. referencedClasses: [],
  31013. //>>excludeEnd("ide");
  31014. messageSends: []
  31015. }),
  31016. globals.Compiler);
  31017. smalltalk.addMethod(
  31018. smalltalk.method({
  31019. selector: "unknownVariables:",
  31020. protocol: 'accessing',
  31021. fn: function (aCollection){
  31022. var self=this;
  31023. self["@unknownVariables"]=aCollection;
  31024. return self;
  31025. },
  31026. //>>excludeStart("ide", pragmas.excludeIdeData);
  31027. args: ["aCollection"],
  31028. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  31029. referencedClasses: [],
  31030. //>>excludeEnd("ide");
  31031. messageSends: []
  31032. }),
  31033. globals.Compiler);
  31034. smalltalk.addMethod(
  31035. smalltalk.method({
  31036. selector: "recompile:",
  31037. protocol: 'compiling',
  31038. fn: function (aClass){
  31039. var self=this;
  31040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31041. return smalltalk.withContext(function($ctx1) {
  31042. //>>excludeEnd("ctx");
  31043. _st(self._new())._recompile_(aClass);
  31044. return self;
  31045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31046. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},globals.Compiler.klass)});
  31047. //>>excludeEnd("ctx");
  31048. },
  31049. //>>excludeStart("ide", pragmas.excludeIdeData);
  31050. args: ["aClass"],
  31051. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  31052. referencedClasses: [],
  31053. //>>excludeEnd("ide");
  31054. messageSends: ["recompile:", "new"]
  31055. }),
  31056. globals.Compiler.klass);
  31057. smalltalk.addMethod(
  31058. smalltalk.method({
  31059. selector: "recompileAll",
  31060. protocol: 'compiling',
  31061. fn: function (){
  31062. var self=this;
  31063. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31065. return smalltalk.withContext(function($ctx1) {
  31066. //>>excludeEnd("ctx");
  31067. _st(_st($Smalltalk())._classes())._do_((function(each){
  31068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31069. return smalltalk.withContext(function($ctx2) {
  31070. //>>excludeEnd("ctx");
  31071. return self._recompile_(each);
  31072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31074. //>>excludeEnd("ctx");
  31075. }));
  31076. return self;
  31077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31078. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},globals.Compiler.klass)});
  31079. //>>excludeEnd("ctx");
  31080. },
  31081. //>>excludeStart("ide", pragmas.excludeIdeData);
  31082. args: [],
  31083. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  31084. referencedClasses: ["Smalltalk"],
  31085. //>>excludeEnd("ide");
  31086. messageSends: ["do:", "classes", "recompile:"]
  31087. }),
  31088. globals.Compiler.klass);
  31089. smalltalk.addClass('DoIt', globals.Object, [], 'Compiler-Core');
  31090. //>>excludeStart("ide", pragmas.excludeIdeData);
  31091. globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  31092. //>>excludeEnd("ide");
  31093. smalltalk.addClass('Evaluator', globals.InterfacingObject, [], 'Compiler-Core');
  31094. //>>excludeStart("ide", pragmas.excludeIdeData);
  31095. globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  31096. //>>excludeEnd("ide");
  31097. smalltalk.addMethod(
  31098. smalltalk.method({
  31099. selector: "evaluate:context:",
  31100. protocol: 'evaluating',
  31101. fn: function (aString,aContext){
  31102. var self=this;
  31103. var compiler,ast;
  31104. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31105. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  31106. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  31107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31108. return smalltalk.withContext(function($ctx1) {
  31109. //>>excludeEnd("ctx");
  31110. var $1,$2,$3,$4;
  31111. var $early={};
  31112. try {
  31113. compiler=_st($Compiler())._new();
  31114. _st((function(){
  31115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31116. return smalltalk.withContext(function($ctx2) {
  31117. //>>excludeEnd("ctx");
  31118. ast=_st(compiler)._parseExpression_(aString);
  31119. return ast;
  31120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31122. //>>excludeEnd("ctx");
  31123. }))._on_do_($Error(),(function(ex){
  31124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31125. return smalltalk.withContext(function($ctx2) {
  31126. //>>excludeEnd("ctx");
  31127. $1=self._alert_(_st(ex)._messageText());
  31128. throw $early=[$1];
  31129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31130. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31131. //>>excludeEnd("ctx");
  31132. }));
  31133. $2=_st($AISemanticAnalyzer())._on_(_st(_st(aContext)._receiver())._class());
  31134. _st($2)._context_(aContext);
  31135. $3=_st($2)._visit_(ast);
  31136. $4=_st(aContext)._evaluateNode_(ast);
  31137. return $4;
  31138. }
  31139. catch(e) {if(e===$early)return e[0]; throw e}
  31140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31141. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},globals.Evaluator)});
  31142. //>>excludeEnd("ctx");
  31143. },
  31144. //>>excludeStart("ide", pragmas.excludeIdeData);
  31145. args: ["aString", "aContext"],
  31146. 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",
  31147. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  31148. //>>excludeEnd("ide");
  31149. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  31150. }),
  31151. globals.Evaluator);
  31152. smalltalk.addMethod(
  31153. smalltalk.method({
  31154. selector: "evaluate:for:",
  31155. protocol: 'evaluating',
  31156. fn: function (aString,anObject){
  31157. var self=this;
  31158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31159. return smalltalk.withContext(function($ctx1) {
  31160. //>>excludeEnd("ctx");
  31161. var $1;
  31162. $1=_st(anObject)._evaluate_on_(aString,self);
  31163. return $1;
  31164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31165. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator)});
  31166. //>>excludeEnd("ctx");
  31167. },
  31168. //>>excludeStart("ide", pragmas.excludeIdeData);
  31169. args: ["aString", "anObject"],
  31170. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  31171. referencedClasses: [],
  31172. //>>excludeEnd("ide");
  31173. messageSends: ["evaluate:on:"]
  31174. }),
  31175. globals.Evaluator);
  31176. smalltalk.addMethod(
  31177. smalltalk.method({
  31178. selector: "evaluate:receiver:",
  31179. protocol: 'evaluating',
  31180. fn: function (aString,anObject){
  31181. var self=this;
  31182. var compiler;
  31183. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  31184. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  31185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31186. return smalltalk.withContext(function($ctx1) {
  31187. //>>excludeEnd("ctx");
  31188. var $1,$2;
  31189. var $early={};
  31190. try {
  31191. compiler=_st($Compiler())._new();
  31192. _st((function(){
  31193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31194. return smalltalk.withContext(function($ctx2) {
  31195. //>>excludeEnd("ctx");
  31196. return _st(compiler)._parseExpression_(aString);
  31197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31199. //>>excludeEnd("ctx");
  31200. }))._on_do_($Error(),(function(ex){
  31201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31202. return smalltalk.withContext(function($ctx2) {
  31203. //>>excludeEnd("ctx");
  31204. $1=self._alert_(_st(ex)._messageText());
  31205. throw $early=[$1];
  31206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31207. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  31208. //>>excludeEnd("ctx");
  31209. }));
  31210. $2=_st(compiler)._evaluateExpression_on_(aString,anObject);
  31211. return $2;
  31212. }
  31213. catch(e) {if(e===$early)return e[0]; throw e}
  31214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31215. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},globals.Evaluator)});
  31216. //>>excludeEnd("ctx");
  31217. },
  31218. //>>excludeStart("ide", pragmas.excludeIdeData);
  31219. args: ["aString", "anObject"],
  31220. 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",
  31221. referencedClasses: ["Compiler", "Error"],
  31222. //>>excludeEnd("ide");
  31223. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  31224. }),
  31225. globals.Evaluator);
  31226. smalltalk.addMethod(
  31227. smalltalk.method({
  31228. selector: "evaluate:for:",
  31229. protocol: 'instance creation',
  31230. fn: function (aString,anObject){
  31231. var self=this;
  31232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31233. return smalltalk.withContext(function($ctx1) {
  31234. //>>excludeEnd("ctx");
  31235. var $1;
  31236. $1=_st(self._new())._evaluate_for_(aString,anObject);
  31237. return $1;
  31238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31239. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},globals.Evaluator.klass)});
  31240. //>>excludeEnd("ctx");
  31241. },
  31242. //>>excludeStart("ide", pragmas.excludeIdeData);
  31243. args: ["aString", "anObject"],
  31244. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  31245. referencedClasses: [],
  31246. //>>excludeEnd("ide");
  31247. messageSends: ["evaluate:for:", "new"]
  31248. }),
  31249. globals.Evaluator.klass);
  31250. smalltalk.addClass('NodeVisitor', globals.Object, [], 'Compiler-Core');
  31251. //>>excludeStart("ide", pragmas.excludeIdeData);
  31252. globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  31253. //>>excludeEnd("ide");
  31254. smalltalk.addMethod(
  31255. smalltalk.method({
  31256. selector: "visit:",
  31257. protocol: 'visiting',
  31258. fn: function (aNode){
  31259. var self=this;
  31260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31261. return smalltalk.withContext(function($ctx1) {
  31262. //>>excludeEnd("ctx");
  31263. var $1;
  31264. $1=_st(aNode)._accept_(self);
  31265. return $1;
  31266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31267. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.NodeVisitor)});
  31268. //>>excludeEnd("ctx");
  31269. },
  31270. //>>excludeStart("ide", pragmas.excludeIdeData);
  31271. args: ["aNode"],
  31272. source: "visit: aNode\x0a\x09^ aNode accept: self",
  31273. referencedClasses: [],
  31274. //>>excludeEnd("ide");
  31275. messageSends: ["accept:"]
  31276. }),
  31277. globals.NodeVisitor);
  31278. smalltalk.addMethod(
  31279. smalltalk.method({
  31280. selector: "visitAll:",
  31281. protocol: 'visiting',
  31282. fn: function (aCollection){
  31283. var self=this;
  31284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31285. return smalltalk.withContext(function($ctx1) {
  31286. //>>excludeEnd("ctx");
  31287. var $1;
  31288. $1=_st(aCollection)._collect_((function(each){
  31289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31290. return smalltalk.withContext(function($ctx2) {
  31291. //>>excludeEnd("ctx");
  31292. return self._visit_(each);
  31293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31295. //>>excludeEnd("ctx");
  31296. }));
  31297. return $1;
  31298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31299. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},globals.NodeVisitor)});
  31300. //>>excludeEnd("ctx");
  31301. },
  31302. //>>excludeStart("ide", pragmas.excludeIdeData);
  31303. args: ["aCollection"],
  31304. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  31305. referencedClasses: [],
  31306. //>>excludeEnd("ide");
  31307. messageSends: ["collect:", "visit:"]
  31308. }),
  31309. globals.NodeVisitor);
  31310. smalltalk.addMethod(
  31311. smalltalk.method({
  31312. selector: "visitAssignmentNode:",
  31313. protocol: 'visiting',
  31314. fn: function (aNode){
  31315. var self=this;
  31316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31317. return smalltalk.withContext(function($ctx1) {
  31318. //>>excludeEnd("ctx");
  31319. var $1;
  31320. $1=self._visitNode_(aNode);
  31321. return $1;
  31322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31323. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.NodeVisitor)});
  31324. //>>excludeEnd("ctx");
  31325. },
  31326. //>>excludeStart("ide", pragmas.excludeIdeData);
  31327. args: ["aNode"],
  31328. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  31329. referencedClasses: [],
  31330. //>>excludeEnd("ide");
  31331. messageSends: ["visitNode:"]
  31332. }),
  31333. globals.NodeVisitor);
  31334. smalltalk.addMethod(
  31335. smalltalk.method({
  31336. selector: "visitBlockNode:",
  31337. protocol: 'visiting',
  31338. fn: function (aNode){
  31339. var self=this;
  31340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31341. return smalltalk.withContext(function($ctx1) {
  31342. //>>excludeEnd("ctx");
  31343. var $1;
  31344. $1=self._visitNode_(aNode);
  31345. return $1;
  31346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31347. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.NodeVisitor)});
  31348. //>>excludeEnd("ctx");
  31349. },
  31350. //>>excludeStart("ide", pragmas.excludeIdeData);
  31351. args: ["aNode"],
  31352. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  31353. referencedClasses: [],
  31354. //>>excludeEnd("ide");
  31355. messageSends: ["visitNode:"]
  31356. }),
  31357. globals.NodeVisitor);
  31358. smalltalk.addMethod(
  31359. smalltalk.method({
  31360. selector: "visitBlockSequenceNode:",
  31361. protocol: 'visiting',
  31362. fn: function (aNode){
  31363. var self=this;
  31364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31365. return smalltalk.withContext(function($ctx1) {
  31366. //>>excludeEnd("ctx");
  31367. var $1;
  31368. $1=self._visitSequenceNode_(aNode);
  31369. return $1;
  31370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31371. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.NodeVisitor)});
  31372. //>>excludeEnd("ctx");
  31373. },
  31374. //>>excludeStart("ide", pragmas.excludeIdeData);
  31375. args: ["aNode"],
  31376. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  31377. referencedClasses: [],
  31378. //>>excludeEnd("ide");
  31379. messageSends: ["visitSequenceNode:"]
  31380. }),
  31381. globals.NodeVisitor);
  31382. smalltalk.addMethod(
  31383. smalltalk.method({
  31384. selector: "visitCascadeNode:",
  31385. protocol: 'visiting',
  31386. fn: function (aNode){
  31387. var self=this;
  31388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31389. return smalltalk.withContext(function($ctx1) {
  31390. //>>excludeEnd("ctx");
  31391. var $1;
  31392. $1=self._visitNode_(aNode);
  31393. return $1;
  31394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31395. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.NodeVisitor)});
  31396. //>>excludeEnd("ctx");
  31397. },
  31398. //>>excludeStart("ide", pragmas.excludeIdeData);
  31399. args: ["aNode"],
  31400. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  31401. referencedClasses: [],
  31402. //>>excludeEnd("ide");
  31403. messageSends: ["visitNode:"]
  31404. }),
  31405. globals.NodeVisitor);
  31406. smalltalk.addMethod(
  31407. smalltalk.method({
  31408. selector: "visitDynamicArrayNode:",
  31409. protocol: 'visiting',
  31410. fn: function (aNode){
  31411. var self=this;
  31412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31413. return smalltalk.withContext(function($ctx1) {
  31414. //>>excludeEnd("ctx");
  31415. var $1;
  31416. $1=self._visitNode_(aNode);
  31417. return $1;
  31418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31419. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},globals.NodeVisitor)});
  31420. //>>excludeEnd("ctx");
  31421. },
  31422. //>>excludeStart("ide", pragmas.excludeIdeData);
  31423. args: ["aNode"],
  31424. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  31425. referencedClasses: [],
  31426. //>>excludeEnd("ide");
  31427. messageSends: ["visitNode:"]
  31428. }),
  31429. globals.NodeVisitor);
  31430. smalltalk.addMethod(
  31431. smalltalk.method({
  31432. selector: "visitDynamicDictionaryNode:",
  31433. protocol: 'visiting',
  31434. fn: function (aNode){
  31435. var self=this;
  31436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31437. return smalltalk.withContext(function($ctx1) {
  31438. //>>excludeEnd("ctx");
  31439. var $1;
  31440. $1=self._visitNode_(aNode);
  31441. return $1;
  31442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31443. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},globals.NodeVisitor)});
  31444. //>>excludeEnd("ctx");
  31445. },
  31446. //>>excludeStart("ide", pragmas.excludeIdeData);
  31447. args: ["aNode"],
  31448. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  31449. referencedClasses: [],
  31450. //>>excludeEnd("ide");
  31451. messageSends: ["visitNode:"]
  31452. }),
  31453. globals.NodeVisitor);
  31454. smalltalk.addMethod(
  31455. smalltalk.method({
  31456. selector: "visitJSStatementNode:",
  31457. protocol: 'visiting',
  31458. fn: function (aNode){
  31459. var self=this;
  31460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31461. return smalltalk.withContext(function($ctx1) {
  31462. //>>excludeEnd("ctx");
  31463. var $1;
  31464. $1=self._visitNode_(aNode);
  31465. return $1;
  31466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31467. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.NodeVisitor)});
  31468. //>>excludeEnd("ctx");
  31469. },
  31470. //>>excludeStart("ide", pragmas.excludeIdeData);
  31471. args: ["aNode"],
  31472. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  31473. referencedClasses: [],
  31474. //>>excludeEnd("ide");
  31475. messageSends: ["visitNode:"]
  31476. }),
  31477. globals.NodeVisitor);
  31478. smalltalk.addMethod(
  31479. smalltalk.method({
  31480. selector: "visitMethodNode:",
  31481. protocol: 'visiting',
  31482. fn: function (aNode){
  31483. var self=this;
  31484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31485. return smalltalk.withContext(function($ctx1) {
  31486. //>>excludeEnd("ctx");
  31487. var $1;
  31488. $1=self._visitNode_(aNode);
  31489. return $1;
  31490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31491. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.NodeVisitor)});
  31492. //>>excludeEnd("ctx");
  31493. },
  31494. //>>excludeStart("ide", pragmas.excludeIdeData);
  31495. args: ["aNode"],
  31496. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  31497. referencedClasses: [],
  31498. //>>excludeEnd("ide");
  31499. messageSends: ["visitNode:"]
  31500. }),
  31501. globals.NodeVisitor);
  31502. smalltalk.addMethod(
  31503. smalltalk.method({
  31504. selector: "visitNode:",
  31505. protocol: 'visiting',
  31506. fn: function (aNode){
  31507. var self=this;
  31508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31509. return smalltalk.withContext(function($ctx1) {
  31510. //>>excludeEnd("ctx");
  31511. var $1;
  31512. $1=self._visitAll_(_st(aNode)._nodes());
  31513. return $1;
  31514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31515. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},globals.NodeVisitor)});
  31516. //>>excludeEnd("ctx");
  31517. },
  31518. //>>excludeStart("ide", pragmas.excludeIdeData);
  31519. args: ["aNode"],
  31520. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  31521. referencedClasses: [],
  31522. //>>excludeEnd("ide");
  31523. messageSends: ["visitAll:", "nodes"]
  31524. }),
  31525. globals.NodeVisitor);
  31526. smalltalk.addMethod(
  31527. smalltalk.method({
  31528. selector: "visitReturnNode:",
  31529. protocol: 'visiting',
  31530. fn: function (aNode){
  31531. var self=this;
  31532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31533. return smalltalk.withContext(function($ctx1) {
  31534. //>>excludeEnd("ctx");
  31535. var $1;
  31536. $1=self._visitNode_(aNode);
  31537. return $1;
  31538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31539. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.NodeVisitor)});
  31540. //>>excludeEnd("ctx");
  31541. },
  31542. //>>excludeStart("ide", pragmas.excludeIdeData);
  31543. args: ["aNode"],
  31544. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  31545. referencedClasses: [],
  31546. //>>excludeEnd("ide");
  31547. messageSends: ["visitNode:"]
  31548. }),
  31549. globals.NodeVisitor);
  31550. smalltalk.addMethod(
  31551. smalltalk.method({
  31552. selector: "visitSendNode:",
  31553. protocol: 'visiting',
  31554. fn: function (aNode){
  31555. var self=this;
  31556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31557. return smalltalk.withContext(function($ctx1) {
  31558. //>>excludeEnd("ctx");
  31559. var $1;
  31560. $1=self._visitNode_(aNode);
  31561. return $1;
  31562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31563. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.NodeVisitor)});
  31564. //>>excludeEnd("ctx");
  31565. },
  31566. //>>excludeStart("ide", pragmas.excludeIdeData);
  31567. args: ["aNode"],
  31568. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  31569. referencedClasses: [],
  31570. //>>excludeEnd("ide");
  31571. messageSends: ["visitNode:"]
  31572. }),
  31573. globals.NodeVisitor);
  31574. smalltalk.addMethod(
  31575. smalltalk.method({
  31576. selector: "visitSequenceNode:",
  31577. protocol: 'visiting',
  31578. fn: function (aNode){
  31579. var self=this;
  31580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31581. return smalltalk.withContext(function($ctx1) {
  31582. //>>excludeEnd("ctx");
  31583. var $1;
  31584. $1=self._visitNode_(aNode);
  31585. return $1;
  31586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31587. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.NodeVisitor)});
  31588. //>>excludeEnd("ctx");
  31589. },
  31590. //>>excludeStart("ide", pragmas.excludeIdeData);
  31591. args: ["aNode"],
  31592. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  31593. referencedClasses: [],
  31594. //>>excludeEnd("ide");
  31595. messageSends: ["visitNode:"]
  31596. }),
  31597. globals.NodeVisitor);
  31598. smalltalk.addMethod(
  31599. smalltalk.method({
  31600. selector: "visitValueNode:",
  31601. protocol: 'visiting',
  31602. fn: function (aNode){
  31603. var self=this;
  31604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31605. return smalltalk.withContext(function($ctx1) {
  31606. //>>excludeEnd("ctx");
  31607. var $1;
  31608. $1=self._visitNode_(aNode);
  31609. return $1;
  31610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31611. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.NodeVisitor)});
  31612. //>>excludeEnd("ctx");
  31613. },
  31614. //>>excludeStart("ide", pragmas.excludeIdeData);
  31615. args: ["aNode"],
  31616. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  31617. referencedClasses: [],
  31618. //>>excludeEnd("ide");
  31619. messageSends: ["visitNode:"]
  31620. }),
  31621. globals.NodeVisitor);
  31622. smalltalk.addMethod(
  31623. smalltalk.method({
  31624. selector: "visitVariableNode:",
  31625. protocol: 'visiting',
  31626. fn: function (aNode){
  31627. var self=this;
  31628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31629. return smalltalk.withContext(function($ctx1) {
  31630. //>>excludeEnd("ctx");
  31631. var $1;
  31632. $1=self._visitNode_(aNode);
  31633. return $1;
  31634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31635. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.NodeVisitor)});
  31636. //>>excludeEnd("ctx");
  31637. },
  31638. //>>excludeStart("ide", pragmas.excludeIdeData);
  31639. args: ["aNode"],
  31640. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  31641. referencedClasses: [],
  31642. //>>excludeEnd("ide");
  31643. messageSends: ["visitNode:"]
  31644. }),
  31645. globals.NodeVisitor);
  31646. smalltalk.addMethod(
  31647. smalltalk.method({
  31648. selector: "asVariableName",
  31649. protocol: '*Compiler-Core',
  31650. fn: function (){
  31651. var self=this;
  31652. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  31653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31654. return smalltalk.withContext(function($ctx1) {
  31655. //>>excludeEnd("ctx");
  31656. var $2,$1;
  31657. $2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
  31658. if(smalltalk.assert($2)){
  31659. $1=self.__comma("_");
  31660. } else {
  31661. $1=self;
  31662. };
  31663. return $1;
  31664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31665. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},globals.String)});
  31666. //>>excludeEnd("ctx");
  31667. },
  31668. //>>excludeStart("ide", pragmas.excludeIdeData);
  31669. args: [],
  31670. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  31671. referencedClasses: ["Smalltalk"],
  31672. //>>excludeEnd("ide");
  31673. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  31674. }),
  31675. globals.String);
  31676. });
  31677. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  31678. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  31679. smalltalk.addPackage('Compiler-AST');
  31680. smalltalk.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  31681. smalltalk.addClass('Node', globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  31682. //>>excludeStart("ide", pragmas.excludeIdeData);
  31683. 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.";
  31684. //>>excludeEnd("ide");
  31685. smalltalk.addMethod(
  31686. smalltalk.method({
  31687. selector: "accept:",
  31688. protocol: 'visiting',
  31689. fn: function (aVisitor){
  31690. var self=this;
  31691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31692. return smalltalk.withContext(function($ctx1) {
  31693. //>>excludeEnd("ctx");
  31694. var $1;
  31695. $1=_st(aVisitor)._visitNode_(self);
  31696. return $1;
  31697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31698. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.Node)});
  31699. //>>excludeEnd("ctx");
  31700. },
  31701. //>>excludeStart("ide", pragmas.excludeIdeData);
  31702. args: ["aVisitor"],
  31703. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  31704. referencedClasses: [],
  31705. //>>excludeEnd("ide");
  31706. messageSends: ["visitNode:"]
  31707. }),
  31708. globals.Node);
  31709. smalltalk.addMethod(
  31710. smalltalk.method({
  31711. selector: "addNode:",
  31712. protocol: 'accessing',
  31713. fn: function (aNode){
  31714. var self=this;
  31715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31716. return smalltalk.withContext(function($ctx1) {
  31717. //>>excludeEnd("ctx");
  31718. _st(self._nodes())._add_(aNode);
  31719. _st(aNode)._parent_(self);
  31720. return self;
  31721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31722. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},globals.Node)});
  31723. //>>excludeEnd("ctx");
  31724. },
  31725. //>>excludeStart("ide", pragmas.excludeIdeData);
  31726. args: ["aNode"],
  31727. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  31728. referencedClasses: [],
  31729. //>>excludeEnd("ide");
  31730. messageSends: ["add:", "nodes", "parent:"]
  31731. }),
  31732. globals.Node);
  31733. smalltalk.addMethod(
  31734. smalltalk.method({
  31735. selector: "allNodes",
  31736. protocol: 'accessing',
  31737. fn: function (){
  31738. var self=this;
  31739. var allNodes;
  31740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31741. return smalltalk.withContext(function($ctx1) {
  31742. //>>excludeEnd("ctx");
  31743. var $1,$2;
  31744. $1=self._nodes();
  31745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31746. $ctx1.sendIdx["nodes"]=1;
  31747. //>>excludeEnd("ctx");
  31748. allNodes=_st($1)._asSet();
  31749. _st(self._nodes())._do_((function(each){
  31750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31751. return smalltalk.withContext(function($ctx2) {
  31752. //>>excludeEnd("ctx");
  31753. return _st(allNodes)._addAll_(_st(each)._allNodes());
  31754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31755. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31756. //>>excludeEnd("ctx");
  31757. }));
  31758. $2=allNodes;
  31759. return $2;
  31760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31761. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},globals.Node)});
  31762. //>>excludeEnd("ctx");
  31763. },
  31764. //>>excludeStart("ide", pragmas.excludeIdeData);
  31765. args: [],
  31766. 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",
  31767. referencedClasses: [],
  31768. //>>excludeEnd("ide");
  31769. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  31770. }),
  31771. globals.Node);
  31772. smalltalk.addMethod(
  31773. smalltalk.method({
  31774. selector: "inPosition:",
  31775. protocol: 'testing',
  31776. fn: function (aPoint){
  31777. var self=this;
  31778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31779. return smalltalk.withContext(function($ctx1) {
  31780. //>>excludeEnd("ctx");
  31781. var $1;
  31782. $1=_st(_st(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  31783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31784. return smalltalk.withContext(function($ctx2) {
  31785. //>>excludeEnd("ctx");
  31786. return _st(self._positionEnd()).__gt_eq(aPoint);
  31787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31789. //>>excludeEnd("ctx");
  31790. }));
  31791. return $1;
  31792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31793. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},globals.Node)});
  31794. //>>excludeEnd("ctx");
  31795. },
  31796. //>>excludeStart("ide", pragmas.excludeIdeData);
  31797. args: ["aPoint"],
  31798. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  31799. referencedClasses: [],
  31800. //>>excludeEnd("ide");
  31801. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  31802. }),
  31803. globals.Node);
  31804. smalltalk.addMethod(
  31805. smalltalk.method({
  31806. selector: "isAssignmentNode",
  31807. protocol: 'testing',
  31808. fn: function (){
  31809. var self=this;
  31810. return false;
  31811. },
  31812. //>>excludeStart("ide", pragmas.excludeIdeData);
  31813. args: [],
  31814. source: "isAssignmentNode\x0a\x09^ false",
  31815. referencedClasses: [],
  31816. //>>excludeEnd("ide");
  31817. messageSends: []
  31818. }),
  31819. globals.Node);
  31820. smalltalk.addMethod(
  31821. smalltalk.method({
  31822. selector: "isBlockNode",
  31823. protocol: 'testing',
  31824. fn: function (){
  31825. var self=this;
  31826. return false;
  31827. },
  31828. //>>excludeStart("ide", pragmas.excludeIdeData);
  31829. args: [],
  31830. source: "isBlockNode\x0a\x09^ false",
  31831. referencedClasses: [],
  31832. //>>excludeEnd("ide");
  31833. messageSends: []
  31834. }),
  31835. globals.Node);
  31836. smalltalk.addMethod(
  31837. smalltalk.method({
  31838. selector: "isBlockSequenceNode",
  31839. protocol: 'testing',
  31840. fn: function (){
  31841. var self=this;
  31842. return false;
  31843. },
  31844. //>>excludeStart("ide", pragmas.excludeIdeData);
  31845. args: [],
  31846. source: "isBlockSequenceNode\x0a\x09^ false",
  31847. referencedClasses: [],
  31848. //>>excludeEnd("ide");
  31849. messageSends: []
  31850. }),
  31851. globals.Node);
  31852. smalltalk.addMethod(
  31853. smalltalk.method({
  31854. selector: "isCascadeNode",
  31855. protocol: 'testing',
  31856. fn: function (){
  31857. var self=this;
  31858. return false;
  31859. },
  31860. //>>excludeStart("ide", pragmas.excludeIdeData);
  31861. args: [],
  31862. source: "isCascadeNode\x0a\x09^ false",
  31863. referencedClasses: [],
  31864. //>>excludeEnd("ide");
  31865. messageSends: []
  31866. }),
  31867. globals.Node);
  31868. smalltalk.addMethod(
  31869. smalltalk.method({
  31870. selector: "isImmutable",
  31871. protocol: 'testing',
  31872. fn: function (){
  31873. var self=this;
  31874. return false;
  31875. },
  31876. //>>excludeStart("ide", pragmas.excludeIdeData);
  31877. args: [],
  31878. source: "isImmutable\x0a\x09^ false",
  31879. referencedClasses: [],
  31880. //>>excludeEnd("ide");
  31881. messageSends: []
  31882. }),
  31883. globals.Node);
  31884. smalltalk.addMethod(
  31885. smalltalk.method({
  31886. selector: "isJSStatementNode",
  31887. protocol: 'testing',
  31888. fn: function (){
  31889. var self=this;
  31890. return false;
  31891. },
  31892. //>>excludeStart("ide", pragmas.excludeIdeData);
  31893. args: [],
  31894. source: "isJSStatementNode\x0a\x09^ false",
  31895. referencedClasses: [],
  31896. //>>excludeEnd("ide");
  31897. messageSends: []
  31898. }),
  31899. globals.Node);
  31900. smalltalk.addMethod(
  31901. smalltalk.method({
  31902. selector: "isLastChild",
  31903. protocol: 'testing',
  31904. fn: function (){
  31905. var self=this;
  31906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31907. return smalltalk.withContext(function($ctx1) {
  31908. //>>excludeEnd("ctx");
  31909. var $1;
  31910. $1=_st(_st(_st(self._parent())._nodes())._last()).__eq(self);
  31911. return $1;
  31912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31913. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},globals.Node)});
  31914. //>>excludeEnd("ctx");
  31915. },
  31916. //>>excludeStart("ide", pragmas.excludeIdeData);
  31917. args: [],
  31918. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  31919. referencedClasses: [],
  31920. //>>excludeEnd("ide");
  31921. messageSends: ["=", "last", "nodes", "parent"]
  31922. }),
  31923. globals.Node);
  31924. smalltalk.addMethod(
  31925. smalltalk.method({
  31926. selector: "isNavigationNode",
  31927. protocol: 'testing',
  31928. fn: function (){
  31929. var self=this;
  31930. return false;
  31931. },
  31932. //>>excludeStart("ide", pragmas.excludeIdeData);
  31933. args: [],
  31934. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  31935. referencedClasses: [],
  31936. //>>excludeEnd("ide");
  31937. messageSends: []
  31938. }),
  31939. globals.Node);
  31940. smalltalk.addMethod(
  31941. smalltalk.method({
  31942. selector: "isNode",
  31943. protocol: 'testing',
  31944. fn: function (){
  31945. var self=this;
  31946. return true;
  31947. },
  31948. //>>excludeStart("ide", pragmas.excludeIdeData);
  31949. args: [],
  31950. source: "isNode\x0a\x09^ true",
  31951. referencedClasses: [],
  31952. //>>excludeEnd("ide");
  31953. messageSends: []
  31954. }),
  31955. globals.Node);
  31956. smalltalk.addMethod(
  31957. smalltalk.method({
  31958. selector: "isReferenced",
  31959. protocol: 'testing',
  31960. fn: function (){
  31961. var self=this;
  31962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31963. return smalltalk.withContext(function($ctx1) {
  31964. //>>excludeEnd("ctx");
  31965. var $4,$3,$2,$1;
  31966. $4=self._parent();
  31967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31968. $ctx1.sendIdx["parent"]=1;
  31969. //>>excludeEnd("ctx");
  31970. $3=_st($4)._isSequenceNode();
  31971. $2=_st($3)._or_((function(){
  31972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31973. return smalltalk.withContext(function($ctx2) {
  31974. //>>excludeEnd("ctx");
  31975. return _st(self._parent())._isAssignmentNode();
  31976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31978. //>>excludeEnd("ctx");
  31979. }));
  31980. $1=_st($2)._not();
  31981. return $1;
  31982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31983. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},globals.Node)});
  31984. //>>excludeEnd("ctx");
  31985. },
  31986. //>>excludeStart("ide", pragmas.excludeIdeData);
  31987. args: [],
  31988. 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",
  31989. referencedClasses: [],
  31990. //>>excludeEnd("ide");
  31991. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  31992. }),
  31993. globals.Node);
  31994. smalltalk.addMethod(
  31995. smalltalk.method({
  31996. selector: "isReturnNode",
  31997. protocol: 'testing',
  31998. fn: function (){
  31999. var self=this;
  32000. return false;
  32001. },
  32002. //>>excludeStart("ide", pragmas.excludeIdeData);
  32003. args: [],
  32004. source: "isReturnNode\x0a\x09^ false",
  32005. referencedClasses: [],
  32006. //>>excludeEnd("ide");
  32007. messageSends: []
  32008. }),
  32009. globals.Node);
  32010. smalltalk.addMethod(
  32011. smalltalk.method({
  32012. selector: "isSendNode",
  32013. protocol: 'testing',
  32014. fn: function (){
  32015. var self=this;
  32016. return false;
  32017. },
  32018. //>>excludeStart("ide", pragmas.excludeIdeData);
  32019. args: [],
  32020. source: "isSendNode\x0a\x09^ false",
  32021. referencedClasses: [],
  32022. //>>excludeEnd("ide");
  32023. messageSends: []
  32024. }),
  32025. globals.Node);
  32026. smalltalk.addMethod(
  32027. smalltalk.method({
  32028. selector: "isSequenceNode",
  32029. protocol: 'testing',
  32030. fn: function (){
  32031. var self=this;
  32032. return false;
  32033. },
  32034. //>>excludeStart("ide", pragmas.excludeIdeData);
  32035. args: [],
  32036. source: "isSequenceNode\x0a\x09^ false",
  32037. referencedClasses: [],
  32038. //>>excludeEnd("ide");
  32039. messageSends: []
  32040. }),
  32041. globals.Node);
  32042. smalltalk.addMethod(
  32043. smalltalk.method({
  32044. selector: "isValueNode",
  32045. protocol: 'testing',
  32046. fn: function (){
  32047. var self=this;
  32048. return false;
  32049. },
  32050. //>>excludeStart("ide", pragmas.excludeIdeData);
  32051. args: [],
  32052. source: "isValueNode\x0a\x09^ false",
  32053. referencedClasses: [],
  32054. //>>excludeEnd("ide");
  32055. messageSends: []
  32056. }),
  32057. globals.Node);
  32058. smalltalk.addMethod(
  32059. smalltalk.method({
  32060. selector: "isVariableNode",
  32061. protocol: 'testing',
  32062. fn: function (){
  32063. var self=this;
  32064. return false;
  32065. },
  32066. //>>excludeStart("ide", pragmas.excludeIdeData);
  32067. args: [],
  32068. source: "isVariableNode\x0a\x09^ false",
  32069. referencedClasses: [],
  32070. //>>excludeEnd("ide");
  32071. messageSends: []
  32072. }),
  32073. globals.Node);
  32074. smalltalk.addMethod(
  32075. smalltalk.method({
  32076. selector: "method",
  32077. protocol: 'accessing',
  32078. fn: function (){
  32079. var self=this;
  32080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32081. return smalltalk.withContext(function($ctx1) {
  32082. //>>excludeEnd("ctx");
  32083. var $2,$1,$receiver;
  32084. $2=self._parent();
  32085. if(($receiver = $2) == null || $receiver.isNil){
  32086. $1=$2;
  32087. } else {
  32088. var node;
  32089. node=$receiver;
  32090. $1=_st(node)._method();
  32091. };
  32092. return $1;
  32093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32094. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.Node)});
  32095. //>>excludeEnd("ctx");
  32096. },
  32097. //>>excludeStart("ide", pragmas.excludeIdeData);
  32098. args: [],
  32099. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  32100. referencedClasses: [],
  32101. //>>excludeEnd("ide");
  32102. messageSends: ["ifNotNil:", "parent", "method"]
  32103. }),
  32104. globals.Node);
  32105. smalltalk.addMethod(
  32106. smalltalk.method({
  32107. selector: "navigationNodeAt:ifAbsent:",
  32108. protocol: 'accessing',
  32109. fn: function (aPoint,aBlock){
  32110. var self=this;
  32111. var children;
  32112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32113. return smalltalk.withContext(function($ctx1) {
  32114. //>>excludeEnd("ctx");
  32115. var $1,$4,$3,$2;
  32116. var $early={};
  32117. try {
  32118. children=_st(self._allNodes())._select_((function(each){
  32119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32120. return smalltalk.withContext(function($ctx2) {
  32121. //>>excludeEnd("ctx");
  32122. return _st(_st(each)._isNavigationNode())._and_((function(){
  32123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32124. return smalltalk.withContext(function($ctx3) {
  32125. //>>excludeEnd("ctx");
  32126. return _st(each)._inPosition_(aPoint);
  32127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32128. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32129. //>>excludeEnd("ctx");
  32130. }));
  32131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32133. //>>excludeEnd("ctx");
  32134. }));
  32135. _st(children)._ifEmpty_((function(){
  32136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32137. return smalltalk.withContext(function($ctx2) {
  32138. //>>excludeEnd("ctx");
  32139. $1=_st(aBlock)._value();
  32140. throw $early=[$1];
  32141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  32143. //>>excludeEnd("ctx");
  32144. }));
  32145. $2=_st(_st(_st(children)._asArray())._sort_((function(a,b){
  32146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32147. return smalltalk.withContext(function($ctx2) {
  32148. //>>excludeEnd("ctx");
  32149. $4=_st(a)._positionStart();
  32150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32151. $ctx2.sendIdx["positionStart"]=1;
  32152. //>>excludeEnd("ctx");
  32153. $3=_st($4)._dist_(aPoint);
  32154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32155. $ctx2.sendIdx["dist:"]=1;
  32156. //>>excludeEnd("ctx");
  32157. return _st($3).__lt_eq(_st(_st(b)._positionStart())._dist_(aPoint));
  32158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32159. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  32160. //>>excludeEnd("ctx");
  32161. })))._first();
  32162. return $2;
  32163. }
  32164. catch(e) {if(e===$early)return e[0]; throw e}
  32165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32166. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},globals.Node)});
  32167. //>>excludeEnd("ctx");
  32168. },
  32169. //>>excludeStart("ide", pragmas.excludeIdeData);
  32170. args: ["aPoint", "aBlock"],
  32171. 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",
  32172. referencedClasses: [],
  32173. //>>excludeEnd("ide");
  32174. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  32175. }),
  32176. globals.Node);
  32177. smalltalk.addMethod(
  32178. smalltalk.method({
  32179. selector: "nextChild",
  32180. protocol: 'accessing',
  32181. fn: function (){
  32182. var self=this;
  32183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32184. return smalltalk.withContext(function($ctx1) {
  32185. //>>excludeEnd("ctx");
  32186. var $3,$2,$1;
  32187. $3=self._nodes();
  32188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32189. $ctx1.sendIdx["nodes"]=1;
  32190. //>>excludeEnd("ctx");
  32191. $2=_st($3)._isEmpty();
  32192. if(smalltalk.assert($2)){
  32193. $1=self;
  32194. } else {
  32195. $1=_st(_st(self._nodes())._first())._nextChild();
  32196. };
  32197. return $1;
  32198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32199. }, function($ctx1) {$ctx1.fill(self,"nextChild",{},globals.Node)});
  32200. //>>excludeEnd("ctx");
  32201. },
  32202. //>>excludeStart("ide", pragmas.excludeIdeData);
  32203. args: [],
  32204. 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 ]",
  32205. referencedClasses: [],
  32206. //>>excludeEnd("ide");
  32207. messageSends: ["ifTrue:ifFalse:", "isEmpty", "nodes", "nextChild", "first"]
  32208. }),
  32209. globals.Node);
  32210. smalltalk.addMethod(
  32211. smalltalk.method({
  32212. selector: "nextNode",
  32213. protocol: 'accessing',
  32214. fn: function (){
  32215. var self=this;
  32216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32217. return smalltalk.withContext(function($ctx1) {
  32218. //>>excludeEnd("ctx");
  32219. var $2,$1,$receiver;
  32220. $2=self._parent();
  32221. if(($receiver = $2) == null || $receiver.isNil){
  32222. $1=$2;
  32223. } else {
  32224. var node;
  32225. node=$receiver;
  32226. $1=_st(node)._nextNode_(self);
  32227. };
  32228. return $1;
  32229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32230. }, function($ctx1) {$ctx1.fill(self,"nextNode",{},globals.Node)});
  32231. //>>excludeEnd("ctx");
  32232. },
  32233. //>>excludeStart("ide", pragmas.excludeIdeData);
  32234. args: [],
  32235. source: "nextNode\x0a\x09^ self parent ifNotNil: [ :node |\x0a\x09\x09node nextNode: self ]",
  32236. referencedClasses: [],
  32237. //>>excludeEnd("ide");
  32238. messageSends: ["ifNotNil:", "parent", "nextNode:"]
  32239. }),
  32240. globals.Node);
  32241. smalltalk.addMethod(
  32242. smalltalk.method({
  32243. selector: "nextNode:",
  32244. protocol: 'accessing',
  32245. fn: function (aNode){
  32246. var self=this;
  32247. var next;
  32248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32249. return smalltalk.withContext(function($ctx1) {
  32250. //>>excludeEnd("ctx");
  32251. var $1,$2;
  32252. var $early={};
  32253. try {
  32254. $1=self._nodes();
  32255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32256. $ctx1.sendIdx["nodes"]=1;
  32257. //>>excludeEnd("ctx");
  32258. next=_st($1)._at_ifAbsent_(_st(_st(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  32259. throw $early=[self];
  32260. }));
  32261. $2=_st(next)._nextChild();
  32262. return $2;
  32263. }
  32264. catch(e) {if(e===$early)return e[0]; throw e}
  32265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32266. }, function($ctx1) {$ctx1.fill(self,"nextNode:",{aNode:aNode,next:next},globals.Node)});
  32267. //>>excludeEnd("ctx");
  32268. },
  32269. //>>excludeStart("ide", pragmas.excludeIdeData);
  32270. args: ["aNode"],
  32271. 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",
  32272. referencedClasses: [],
  32273. //>>excludeEnd("ide");
  32274. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:", "nextChild"]
  32275. }),
  32276. globals.Node);
  32277. smalltalk.addMethod(
  32278. smalltalk.method({
  32279. selector: "nodes",
  32280. protocol: 'accessing',
  32281. fn: function (){
  32282. var self=this;
  32283. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  32284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32285. return smalltalk.withContext(function($ctx1) {
  32286. //>>excludeEnd("ctx");
  32287. var $2,$1,$receiver;
  32288. $2=self["@nodes"];
  32289. if(($receiver = $2) == null || $receiver.isNil){
  32290. self["@nodes"]=_st($Array())._new();
  32291. $1=self["@nodes"];
  32292. } else {
  32293. $1=$2;
  32294. };
  32295. return $1;
  32296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32297. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.Node)});
  32298. //>>excludeEnd("ctx");
  32299. },
  32300. //>>excludeStart("ide", pragmas.excludeIdeData);
  32301. args: [],
  32302. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  32303. referencedClasses: ["Array"],
  32304. //>>excludeEnd("ide");
  32305. messageSends: ["ifNil:", "new"]
  32306. }),
  32307. globals.Node);
  32308. smalltalk.addMethod(
  32309. smalltalk.method({
  32310. selector: "nodes:",
  32311. protocol: 'building',
  32312. fn: function (aCollection){
  32313. var self=this;
  32314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32315. return smalltalk.withContext(function($ctx1) {
  32316. //>>excludeEnd("ctx");
  32317. self["@nodes"]=aCollection;
  32318. _st(aCollection)._do_((function(each){
  32319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32320. return smalltalk.withContext(function($ctx2) {
  32321. //>>excludeEnd("ctx");
  32322. return _st(each)._parent_(self);
  32323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32324. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32325. //>>excludeEnd("ctx");
  32326. }));
  32327. return self;
  32328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32329. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},globals.Node)});
  32330. //>>excludeEnd("ctx");
  32331. },
  32332. //>>excludeStart("ide", pragmas.excludeIdeData);
  32333. args: ["aCollection"],
  32334. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32335. referencedClasses: [],
  32336. //>>excludeEnd("ide");
  32337. messageSends: ["do:", "parent:"]
  32338. }),
  32339. globals.Node);
  32340. smalltalk.addMethod(
  32341. smalltalk.method({
  32342. selector: "parent",
  32343. protocol: 'accessing',
  32344. fn: function (){
  32345. var self=this;
  32346. var $1;
  32347. $1=self["@parent"];
  32348. return $1;
  32349. },
  32350. //>>excludeStart("ide", pragmas.excludeIdeData);
  32351. args: [],
  32352. source: "parent\x0a\x09^ parent",
  32353. referencedClasses: [],
  32354. //>>excludeEnd("ide");
  32355. messageSends: []
  32356. }),
  32357. globals.Node);
  32358. smalltalk.addMethod(
  32359. smalltalk.method({
  32360. selector: "parent:",
  32361. protocol: 'accessing',
  32362. fn: function (aNode){
  32363. var self=this;
  32364. self["@parent"]=aNode;
  32365. return self;
  32366. },
  32367. //>>excludeStart("ide", pragmas.excludeIdeData);
  32368. args: ["aNode"],
  32369. source: "parent: aNode\x0a\x09parent := aNode",
  32370. referencedClasses: [],
  32371. //>>excludeEnd("ide");
  32372. messageSends: []
  32373. }),
  32374. globals.Node);
  32375. smalltalk.addMethod(
  32376. smalltalk.method({
  32377. selector: "position",
  32378. protocol: 'accessing',
  32379. fn: function (){
  32380. var self=this;
  32381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32382. return smalltalk.withContext(function($ctx1) {
  32383. //>>excludeEnd("ctx");
  32384. var $2,$3,$1,$receiver;
  32385. $2=self["@position"];
  32386. if(($receiver = $2) == null || $receiver.isNil){
  32387. $3=self._parent();
  32388. if(($receiver = $3) == null || $receiver.isNil){
  32389. $1=$3;
  32390. } else {
  32391. var node;
  32392. node=$receiver;
  32393. $1=_st(node)._position();
  32394. };
  32395. } else {
  32396. $1=$2;
  32397. };
  32398. return $1;
  32399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32400. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Node)});
  32401. //>>excludeEnd("ctx");
  32402. },
  32403. //>>excludeStart("ide", pragmas.excludeIdeData);
  32404. args: [],
  32405. 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 ] ]",
  32406. referencedClasses: [],
  32407. //>>excludeEnd("ide");
  32408. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  32409. }),
  32410. globals.Node);
  32411. smalltalk.addMethod(
  32412. smalltalk.method({
  32413. selector: "position:",
  32414. protocol: 'accessing',
  32415. fn: function (aPosition){
  32416. var self=this;
  32417. self["@position"]=aPosition;
  32418. return self;
  32419. },
  32420. //>>excludeStart("ide", pragmas.excludeIdeData);
  32421. args: ["aPosition"],
  32422. source: "position: aPosition\x0a\x09position := aPosition",
  32423. referencedClasses: [],
  32424. //>>excludeEnd("ide");
  32425. messageSends: []
  32426. }),
  32427. globals.Node);
  32428. smalltalk.addMethod(
  32429. smalltalk.method({
  32430. selector: "positionEnd",
  32431. protocol: 'accessing',
  32432. fn: function (){
  32433. var self=this;
  32434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32435. return smalltalk.withContext(function($ctx1) {
  32436. //>>excludeEnd("ctx");
  32437. var $2,$7,$6,$5,$4,$3,$1;
  32438. $2=self._positionStart();
  32439. $7=self._source();
  32440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32441. $ctx1.sendIdx["source"]=1;
  32442. //>>excludeEnd("ctx");
  32443. $6=_st($7)._lines();
  32444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32445. $ctx1.sendIdx["lines"]=1;
  32446. //>>excludeEnd("ctx");
  32447. $5=_st($6)._size();
  32448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32449. $ctx1.sendIdx["size"]=1;
  32450. //>>excludeEnd("ctx");
  32451. $4=_st($5).__minus((1));
  32452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32453. $ctx1.sendIdx["-"]=1;
  32454. //>>excludeEnd("ctx");
  32455. $3=_st($4).__at(_st(_st(_st(_st(self._source())._lines())._last())._size()).__minus((1)));
  32456. $1=_st($2).__plus($3);
  32457. return $1;
  32458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32459. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},globals.Node)});
  32460. //>>excludeEnd("ctx");
  32461. },
  32462. //>>excludeStart("ide", pragmas.excludeIdeData);
  32463. args: [],
  32464. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  32465. referencedClasses: [],
  32466. //>>excludeEnd("ide");
  32467. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  32468. }),
  32469. globals.Node);
  32470. smalltalk.addMethod(
  32471. smalltalk.method({
  32472. selector: "positionStart",
  32473. protocol: 'accessing',
  32474. fn: function (){
  32475. var self=this;
  32476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32477. return smalltalk.withContext(function($ctx1) {
  32478. //>>excludeEnd("ctx");
  32479. var $1;
  32480. $1=self._position();
  32481. return $1;
  32482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32483. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},globals.Node)});
  32484. //>>excludeEnd("ctx");
  32485. },
  32486. //>>excludeStart("ide", pragmas.excludeIdeData);
  32487. args: [],
  32488. source: "positionStart\x0a\x09^ self position",
  32489. referencedClasses: [],
  32490. //>>excludeEnd("ide");
  32491. messageSends: ["position"]
  32492. }),
  32493. globals.Node);
  32494. smalltalk.addMethod(
  32495. smalltalk.method({
  32496. selector: "postCopy",
  32497. protocol: 'copying',
  32498. fn: function (){
  32499. var self=this;
  32500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32501. return smalltalk.withContext(function($ctx1) {
  32502. //>>excludeEnd("ctx");
  32503. (
  32504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32505. $ctx1.supercall = true,
  32506. //>>excludeEnd("ctx");
  32507. globals.Node.superclass.fn.prototype._postCopy.apply(_st(self), []));
  32508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32509. $ctx1.supercall = false;
  32510. //>>excludeEnd("ctx");;
  32511. _st(self._nodes())._do_((function(each){
  32512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32513. return smalltalk.withContext(function($ctx2) {
  32514. //>>excludeEnd("ctx");
  32515. return _st(each)._parent_(self);
  32516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32518. //>>excludeEnd("ctx");
  32519. }));
  32520. return self;
  32521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32522. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},globals.Node)});
  32523. //>>excludeEnd("ctx");
  32524. },
  32525. //>>excludeStart("ide", pragmas.excludeIdeData);
  32526. args: [],
  32527. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  32528. referencedClasses: [],
  32529. //>>excludeEnd("ide");
  32530. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  32531. }),
  32532. globals.Node);
  32533. smalltalk.addMethod(
  32534. smalltalk.method({
  32535. selector: "requiresSmalltalkContext",
  32536. protocol: 'testing',
  32537. fn: function (){
  32538. var self=this;
  32539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32540. return smalltalk.withContext(function($ctx1) {
  32541. //>>excludeEnd("ctx");
  32542. var $1;
  32543. $1=_st(_st(self._nodes())._detect_ifNone_((function(each){
  32544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32545. return smalltalk.withContext(function($ctx2) {
  32546. //>>excludeEnd("ctx");
  32547. return _st(each)._requiresSmalltalkContext();
  32548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32550. //>>excludeEnd("ctx");
  32551. }),(function(){
  32552. return nil;
  32553. })))._notNil();
  32554. return $1;
  32555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32556. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.Node)});
  32557. //>>excludeEnd("ctx");
  32558. },
  32559. //>>excludeStart("ide", pragmas.excludeIdeData);
  32560. args: [],
  32561. 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",
  32562. referencedClasses: [],
  32563. //>>excludeEnd("ide");
  32564. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  32565. }),
  32566. globals.Node);
  32567. smalltalk.addMethod(
  32568. smalltalk.method({
  32569. selector: "shouldBeAliased",
  32570. protocol: 'accessing',
  32571. fn: function (){
  32572. var self=this;
  32573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32574. return smalltalk.withContext(function($ctx1) {
  32575. //>>excludeEnd("ctx");
  32576. var $2,$1,$receiver;
  32577. $2=self["@shouldBeAliased"];
  32578. if(($receiver = $2) == null || $receiver.isNil){
  32579. $1=false;
  32580. } else {
  32581. $1=$2;
  32582. };
  32583. return $1;
  32584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32585. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.Node)});
  32586. //>>excludeEnd("ctx");
  32587. },
  32588. //>>excludeStart("ide", pragmas.excludeIdeData);
  32589. args: [],
  32590. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  32591. referencedClasses: [],
  32592. //>>excludeEnd("ide");
  32593. messageSends: ["ifNil:"]
  32594. }),
  32595. globals.Node);
  32596. smalltalk.addMethod(
  32597. smalltalk.method({
  32598. selector: "shouldBeAliased:",
  32599. protocol: 'accessing',
  32600. fn: function (aBoolean){
  32601. var self=this;
  32602. self["@shouldBeAliased"]=aBoolean;
  32603. return self;
  32604. },
  32605. //>>excludeStart("ide", pragmas.excludeIdeData);
  32606. args: ["aBoolean"],
  32607. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  32608. referencedClasses: [],
  32609. //>>excludeEnd("ide");
  32610. messageSends: []
  32611. }),
  32612. globals.Node);
  32613. smalltalk.addMethod(
  32614. smalltalk.method({
  32615. selector: "shouldBeInlined",
  32616. protocol: 'accessing',
  32617. fn: function (){
  32618. var self=this;
  32619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32620. return smalltalk.withContext(function($ctx1) {
  32621. //>>excludeEnd("ctx");
  32622. var $2,$1,$receiver;
  32623. $2=self["@shouldBeInlined"];
  32624. if(($receiver = $2) == null || $receiver.isNil){
  32625. $1=false;
  32626. } else {
  32627. $1=$2;
  32628. };
  32629. return $1;
  32630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32631. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},globals.Node)});
  32632. //>>excludeEnd("ctx");
  32633. },
  32634. //>>excludeStart("ide", pragmas.excludeIdeData);
  32635. args: [],
  32636. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  32637. referencedClasses: [],
  32638. //>>excludeEnd("ide");
  32639. messageSends: ["ifNil:"]
  32640. }),
  32641. globals.Node);
  32642. smalltalk.addMethod(
  32643. smalltalk.method({
  32644. selector: "shouldBeInlined:",
  32645. protocol: 'accessing',
  32646. fn: function (aBoolean){
  32647. var self=this;
  32648. self["@shouldBeInlined"]=aBoolean;
  32649. return self;
  32650. },
  32651. //>>excludeStart("ide", pragmas.excludeIdeData);
  32652. args: ["aBoolean"],
  32653. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  32654. referencedClasses: [],
  32655. //>>excludeEnd("ide");
  32656. messageSends: []
  32657. }),
  32658. globals.Node);
  32659. smalltalk.addMethod(
  32660. smalltalk.method({
  32661. selector: "size",
  32662. protocol: 'accessing',
  32663. fn: function (){
  32664. var self=this;
  32665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32666. return smalltalk.withContext(function($ctx1) {
  32667. //>>excludeEnd("ctx");
  32668. var $1;
  32669. $1=_st(self._source())._size();
  32670. return $1;
  32671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32672. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Node)});
  32673. //>>excludeEnd("ctx");
  32674. },
  32675. //>>excludeStart("ide", pragmas.excludeIdeData);
  32676. args: [],
  32677. source: "size\x0a\x09^ self source size",
  32678. referencedClasses: [],
  32679. //>>excludeEnd("ide");
  32680. messageSends: ["size", "source"]
  32681. }),
  32682. globals.Node);
  32683. smalltalk.addMethod(
  32684. smalltalk.method({
  32685. selector: "source",
  32686. protocol: 'accessing',
  32687. fn: function (){
  32688. var self=this;
  32689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32690. return smalltalk.withContext(function($ctx1) {
  32691. //>>excludeEnd("ctx");
  32692. var $2,$1,$receiver;
  32693. $2=self["@source"];
  32694. if(($receiver = $2) == null || $receiver.isNil){
  32695. $1="";
  32696. } else {
  32697. $1=$2;
  32698. };
  32699. return $1;
  32700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32701. }, function($ctx1) {$ctx1.fill(self,"source",{},globals.Node)});
  32702. //>>excludeEnd("ctx");
  32703. },
  32704. //>>excludeStart("ide", pragmas.excludeIdeData);
  32705. args: [],
  32706. source: "source\x0a\x09^ source ifNil: [ '' ]",
  32707. referencedClasses: [],
  32708. //>>excludeEnd("ide");
  32709. messageSends: ["ifNil:"]
  32710. }),
  32711. globals.Node);
  32712. smalltalk.addMethod(
  32713. smalltalk.method({
  32714. selector: "source:",
  32715. protocol: 'accessing',
  32716. fn: function (aString){
  32717. var self=this;
  32718. self["@source"]=aString;
  32719. return self;
  32720. },
  32721. //>>excludeStart("ide", pragmas.excludeIdeData);
  32722. args: ["aString"],
  32723. source: "source: aString\x0a\x09source := aString",
  32724. referencedClasses: [],
  32725. //>>excludeEnd("ide");
  32726. messageSends: []
  32727. }),
  32728. globals.Node);
  32729. smalltalk.addMethod(
  32730. smalltalk.method({
  32731. selector: "stopOnStepping",
  32732. protocol: 'testing',
  32733. fn: function (){
  32734. var self=this;
  32735. return false;
  32736. },
  32737. //>>excludeStart("ide", pragmas.excludeIdeData);
  32738. args: [],
  32739. source: "stopOnStepping\x0a\x09^ false",
  32740. referencedClasses: [],
  32741. //>>excludeEnd("ide");
  32742. messageSends: []
  32743. }),
  32744. globals.Node);
  32745. smalltalk.addMethod(
  32746. smalltalk.method({
  32747. selector: "subtreeNeedsAliasing",
  32748. protocol: 'testing',
  32749. fn: function (){
  32750. var self=this;
  32751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32752. return smalltalk.withContext(function($ctx1) {
  32753. //>>excludeEnd("ctx");
  32754. var $1;
  32755. $1=_st(_st(self._shouldBeAliased())._or_((function(){
  32756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32757. return smalltalk.withContext(function($ctx2) {
  32758. //>>excludeEnd("ctx");
  32759. return self._shouldBeInlined();
  32760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32761. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32762. //>>excludeEnd("ctx");
  32763. })))._or_((function(){
  32764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32765. return smalltalk.withContext(function($ctx2) {
  32766. //>>excludeEnd("ctx");
  32767. return _st(self._nodes())._anySatisfy_((function(each){
  32768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32769. return smalltalk.withContext(function($ctx3) {
  32770. //>>excludeEnd("ctx");
  32771. return _st(each)._subtreeNeedsAliasing();
  32772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32773. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  32774. //>>excludeEnd("ctx");
  32775. }));
  32776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  32778. //>>excludeEnd("ctx");
  32779. }));
  32780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32781. $ctx1.sendIdx["or:"]=1;
  32782. //>>excludeEnd("ctx");
  32783. return $1;
  32784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32785. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.Node)});
  32786. //>>excludeEnd("ctx");
  32787. },
  32788. //>>excludeStart("ide", pragmas.excludeIdeData);
  32789. args: [],
  32790. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  32791. referencedClasses: [],
  32792. //>>excludeEnd("ide");
  32793. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  32794. }),
  32795. globals.Node);
  32796. smalltalk.addClass('AssignmentNode', globals.Node, ['left', 'right'], 'Compiler-AST');
  32797. //>>excludeStart("ide", pragmas.excludeIdeData);
  32798. globals.AssignmentNode.comment="I represent an assignment node.";
  32799. //>>excludeEnd("ide");
  32800. smalltalk.addMethod(
  32801. smalltalk.method({
  32802. selector: "accept:",
  32803. protocol: 'visiting',
  32804. fn: function (aVisitor){
  32805. var self=this;
  32806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32807. return smalltalk.withContext(function($ctx1) {
  32808. //>>excludeEnd("ctx");
  32809. var $1;
  32810. $1=_st(aVisitor)._visitAssignmentNode_(self);
  32811. return $1;
  32812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32813. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.AssignmentNode)});
  32814. //>>excludeEnd("ctx");
  32815. },
  32816. //>>excludeStart("ide", pragmas.excludeIdeData);
  32817. args: ["aVisitor"],
  32818. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  32819. referencedClasses: [],
  32820. //>>excludeEnd("ide");
  32821. messageSends: ["visitAssignmentNode:"]
  32822. }),
  32823. globals.AssignmentNode);
  32824. smalltalk.addMethod(
  32825. smalltalk.method({
  32826. selector: "isAssignmentNode",
  32827. protocol: 'testing',
  32828. fn: function (){
  32829. var self=this;
  32830. return true;
  32831. },
  32832. //>>excludeStart("ide", pragmas.excludeIdeData);
  32833. args: [],
  32834. source: "isAssignmentNode\x0a\x09^ true",
  32835. referencedClasses: [],
  32836. //>>excludeEnd("ide");
  32837. messageSends: []
  32838. }),
  32839. globals.AssignmentNode);
  32840. smalltalk.addMethod(
  32841. smalltalk.method({
  32842. selector: "left",
  32843. protocol: 'accessing',
  32844. fn: function (){
  32845. var self=this;
  32846. var $1;
  32847. $1=self["@left"];
  32848. return $1;
  32849. },
  32850. //>>excludeStart("ide", pragmas.excludeIdeData);
  32851. args: [],
  32852. source: "left\x0a\x09^ left",
  32853. referencedClasses: [],
  32854. //>>excludeEnd("ide");
  32855. messageSends: []
  32856. }),
  32857. globals.AssignmentNode);
  32858. smalltalk.addMethod(
  32859. smalltalk.method({
  32860. selector: "left:",
  32861. protocol: 'accessing',
  32862. fn: function (aNode){
  32863. var self=this;
  32864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32865. return smalltalk.withContext(function($ctx1) {
  32866. //>>excludeEnd("ctx");
  32867. self["@left"]=aNode;
  32868. _st(aNode)._parent_(self);
  32869. return self;
  32870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32871. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},globals.AssignmentNode)});
  32872. //>>excludeEnd("ctx");
  32873. },
  32874. //>>excludeStart("ide", pragmas.excludeIdeData);
  32875. args: ["aNode"],
  32876. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  32877. referencedClasses: [],
  32878. //>>excludeEnd("ide");
  32879. messageSends: ["parent:"]
  32880. }),
  32881. globals.AssignmentNode);
  32882. smalltalk.addMethod(
  32883. smalltalk.method({
  32884. selector: "nodes",
  32885. protocol: 'accessing',
  32886. fn: function (){
  32887. var self=this;
  32888. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  32889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32890. return smalltalk.withContext(function($ctx1) {
  32891. //>>excludeEnd("ctx");
  32892. var $1;
  32893. $1=_st($Array())._with_with_(self._left(),self._right());
  32894. return $1;
  32895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32896. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.AssignmentNode)});
  32897. //>>excludeEnd("ctx");
  32898. },
  32899. //>>excludeStart("ide", pragmas.excludeIdeData);
  32900. args: [],
  32901. source: "nodes\x0a\x09^ Array with: self left with: self right",
  32902. referencedClasses: ["Array"],
  32903. //>>excludeEnd("ide");
  32904. messageSends: ["with:with:", "left", "right"]
  32905. }),
  32906. globals.AssignmentNode);
  32907. smalltalk.addMethod(
  32908. smalltalk.method({
  32909. selector: "right",
  32910. protocol: 'accessing',
  32911. fn: function (){
  32912. var self=this;
  32913. var $1;
  32914. $1=self["@right"];
  32915. return $1;
  32916. },
  32917. //>>excludeStart("ide", pragmas.excludeIdeData);
  32918. args: [],
  32919. source: "right\x0a\x09^ right",
  32920. referencedClasses: [],
  32921. //>>excludeEnd("ide");
  32922. messageSends: []
  32923. }),
  32924. globals.AssignmentNode);
  32925. smalltalk.addMethod(
  32926. smalltalk.method({
  32927. selector: "right:",
  32928. protocol: 'accessing',
  32929. fn: function (aNode){
  32930. var self=this;
  32931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32932. return smalltalk.withContext(function($ctx1) {
  32933. //>>excludeEnd("ctx");
  32934. self["@right"]=aNode;
  32935. _st(aNode)._parent_(self);
  32936. return self;
  32937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32938. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},globals.AssignmentNode)});
  32939. //>>excludeEnd("ctx");
  32940. },
  32941. //>>excludeStart("ide", pragmas.excludeIdeData);
  32942. args: ["aNode"],
  32943. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  32944. referencedClasses: [],
  32945. //>>excludeEnd("ide");
  32946. messageSends: ["parent:"]
  32947. }),
  32948. globals.AssignmentNode);
  32949. smalltalk.addMethod(
  32950. smalltalk.method({
  32951. selector: "shouldBeAliased",
  32952. protocol: 'testing',
  32953. fn: function (){
  32954. var self=this;
  32955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32956. return smalltalk.withContext(function($ctx1) {
  32957. //>>excludeEnd("ctx");
  32958. var $2,$1;
  32959. $2=(
  32960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32961. $ctx1.supercall = true,
  32962. //>>excludeEnd("ctx");
  32963. globals.AssignmentNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  32964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32965. $ctx1.supercall = false;
  32966. //>>excludeEnd("ctx");;
  32967. $1=_st($2)._or_((function(){
  32968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32969. return smalltalk.withContext(function($ctx2) {
  32970. //>>excludeEnd("ctx");
  32971. return self._isReferenced();
  32972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32974. //>>excludeEnd("ctx");
  32975. }));
  32976. return $1;
  32977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32978. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},globals.AssignmentNode)});
  32979. //>>excludeEnd("ctx");
  32980. },
  32981. //>>excludeStart("ide", pragmas.excludeIdeData);
  32982. args: [],
  32983. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  32984. referencedClasses: [],
  32985. //>>excludeEnd("ide");
  32986. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  32987. }),
  32988. globals.AssignmentNode);
  32989. smalltalk.addClass('BlockNode', globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  32990. //>>excludeStart("ide", pragmas.excludeIdeData);
  32991. globals.BlockNode.comment="I represent an block closure node.";
  32992. //>>excludeEnd("ide");
  32993. smalltalk.addMethod(
  32994. smalltalk.method({
  32995. selector: "accept:",
  32996. protocol: 'visiting',
  32997. fn: function (aVisitor){
  32998. var self=this;
  32999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33000. return smalltalk.withContext(function($ctx1) {
  33001. //>>excludeEnd("ctx");
  33002. var $1;
  33003. $1=_st(aVisitor)._visitBlockNode_(self);
  33004. return $1;
  33005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33006. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockNode)});
  33007. //>>excludeEnd("ctx");
  33008. },
  33009. //>>excludeStart("ide", pragmas.excludeIdeData);
  33010. args: ["aVisitor"],
  33011. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  33012. referencedClasses: [],
  33013. //>>excludeEnd("ide");
  33014. messageSends: ["visitBlockNode:"]
  33015. }),
  33016. globals.BlockNode);
  33017. smalltalk.addMethod(
  33018. smalltalk.method({
  33019. selector: "isBlockNode",
  33020. protocol: 'testing',
  33021. fn: function (){
  33022. var self=this;
  33023. return true;
  33024. },
  33025. //>>excludeStart("ide", pragmas.excludeIdeData);
  33026. args: [],
  33027. source: "isBlockNode\x0a\x09^ true",
  33028. referencedClasses: [],
  33029. //>>excludeEnd("ide");
  33030. messageSends: []
  33031. }),
  33032. globals.BlockNode);
  33033. smalltalk.addMethod(
  33034. smalltalk.method({
  33035. selector: "nextChild",
  33036. protocol: 'accessing',
  33037. fn: function (){
  33038. var self=this;
  33039. return self;
  33040. },
  33041. //>>excludeStart("ide", pragmas.excludeIdeData);
  33042. args: [],
  33043. source: "nextChild\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  33044. referencedClasses: [],
  33045. //>>excludeEnd("ide");
  33046. messageSends: []
  33047. }),
  33048. globals.BlockNode);
  33049. smalltalk.addMethod(
  33050. smalltalk.method({
  33051. selector: "nextNode:",
  33052. protocol: 'accessing',
  33053. fn: function (aNode){
  33054. var self=this;
  33055. return self;
  33056. },
  33057. //>>excludeStart("ide", pragmas.excludeIdeData);
  33058. args: ["aNode"],
  33059. source: "nextNode: aNode\x0a\x09\x22Answer the receiver as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ self",
  33060. referencedClasses: [],
  33061. //>>excludeEnd("ide");
  33062. messageSends: []
  33063. }),
  33064. globals.BlockNode);
  33065. smalltalk.addMethod(
  33066. smalltalk.method({
  33067. selector: "parameters",
  33068. protocol: 'accessing',
  33069. fn: function (){
  33070. var self=this;
  33071. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  33072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33073. return smalltalk.withContext(function($ctx1) {
  33074. //>>excludeEnd("ctx");
  33075. var $2,$1,$receiver;
  33076. $2=self["@parameters"];
  33077. if(($receiver = $2) == null || $receiver.isNil){
  33078. self["@parameters"]=_st($Array())._new();
  33079. $1=self["@parameters"];
  33080. } else {
  33081. $1=$2;
  33082. };
  33083. return $1;
  33084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33085. }, function($ctx1) {$ctx1.fill(self,"parameters",{},globals.BlockNode)});
  33086. //>>excludeEnd("ctx");
  33087. },
  33088. //>>excludeStart("ide", pragmas.excludeIdeData);
  33089. args: [],
  33090. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  33091. referencedClasses: ["Array"],
  33092. //>>excludeEnd("ide");
  33093. messageSends: ["ifNil:", "new"]
  33094. }),
  33095. globals.BlockNode);
  33096. smalltalk.addMethod(
  33097. smalltalk.method({
  33098. selector: "parameters:",
  33099. protocol: 'accessing',
  33100. fn: function (aCollection){
  33101. var self=this;
  33102. self["@parameters"]=aCollection;
  33103. return self;
  33104. },
  33105. //>>excludeStart("ide", pragmas.excludeIdeData);
  33106. args: ["aCollection"],
  33107. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  33108. referencedClasses: [],
  33109. //>>excludeEnd("ide");
  33110. messageSends: []
  33111. }),
  33112. globals.BlockNode);
  33113. smalltalk.addMethod(
  33114. smalltalk.method({
  33115. selector: "scope",
  33116. protocol: 'accessing',
  33117. fn: function (){
  33118. var self=this;
  33119. var $1;
  33120. $1=self["@scope"];
  33121. return $1;
  33122. },
  33123. //>>excludeStart("ide", pragmas.excludeIdeData);
  33124. args: [],
  33125. source: "scope\x0a\x09^ scope",
  33126. referencedClasses: [],
  33127. //>>excludeEnd("ide");
  33128. messageSends: []
  33129. }),
  33130. globals.BlockNode);
  33131. smalltalk.addMethod(
  33132. smalltalk.method({
  33133. selector: "scope:",
  33134. protocol: 'accessing',
  33135. fn: function (aLexicalScope){
  33136. var self=this;
  33137. self["@scope"]=aLexicalScope;
  33138. return self;
  33139. },
  33140. //>>excludeStart("ide", pragmas.excludeIdeData);
  33141. args: ["aLexicalScope"],
  33142. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33143. referencedClasses: [],
  33144. //>>excludeEnd("ide");
  33145. messageSends: []
  33146. }),
  33147. globals.BlockNode);
  33148. smalltalk.addMethod(
  33149. smalltalk.method({
  33150. selector: "subtreeNeedsAliasing",
  33151. protocol: 'testing',
  33152. fn: function (){
  33153. var self=this;
  33154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33155. return smalltalk.withContext(function($ctx1) {
  33156. //>>excludeEnd("ctx");
  33157. var $1;
  33158. $1=_st(self._shouldBeAliased())._or_((function(){
  33159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33160. return smalltalk.withContext(function($ctx2) {
  33161. //>>excludeEnd("ctx");
  33162. return self._shouldBeInlined();
  33163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33165. //>>excludeEnd("ctx");
  33166. }));
  33167. return $1;
  33168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33169. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},globals.BlockNode)});
  33170. //>>excludeEnd("ctx");
  33171. },
  33172. //>>excludeStart("ide", pragmas.excludeIdeData);
  33173. args: [],
  33174. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  33175. referencedClasses: [],
  33176. //>>excludeEnd("ide");
  33177. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  33178. }),
  33179. globals.BlockNode);
  33180. smalltalk.addClass('CascadeNode', globals.Node, ['receiver'], 'Compiler-AST');
  33181. //>>excludeStart("ide", pragmas.excludeIdeData);
  33182. globals.CascadeNode.comment="I represent an cascade node.";
  33183. //>>excludeEnd("ide");
  33184. smalltalk.addMethod(
  33185. smalltalk.method({
  33186. selector: "accept:",
  33187. protocol: 'visiting',
  33188. fn: function (aVisitor){
  33189. var self=this;
  33190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33191. return smalltalk.withContext(function($ctx1) {
  33192. //>>excludeEnd("ctx");
  33193. var $1;
  33194. $1=_st(aVisitor)._visitCascadeNode_(self);
  33195. return $1;
  33196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33197. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.CascadeNode)});
  33198. //>>excludeEnd("ctx");
  33199. },
  33200. //>>excludeStart("ide", pragmas.excludeIdeData);
  33201. args: ["aVisitor"],
  33202. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  33203. referencedClasses: [],
  33204. //>>excludeEnd("ide");
  33205. messageSends: ["visitCascadeNode:"]
  33206. }),
  33207. globals.CascadeNode);
  33208. smalltalk.addMethod(
  33209. smalltalk.method({
  33210. selector: "isCascadeNode",
  33211. protocol: 'testing',
  33212. fn: function (){
  33213. var self=this;
  33214. return true;
  33215. },
  33216. //>>excludeStart("ide", pragmas.excludeIdeData);
  33217. args: [],
  33218. source: "isCascadeNode\x0a\x09^ true",
  33219. referencedClasses: [],
  33220. //>>excludeEnd("ide");
  33221. messageSends: []
  33222. }),
  33223. globals.CascadeNode);
  33224. smalltalk.addMethod(
  33225. smalltalk.method({
  33226. selector: "receiver",
  33227. protocol: 'accessing',
  33228. fn: function (){
  33229. var self=this;
  33230. var $1;
  33231. $1=self["@receiver"];
  33232. return $1;
  33233. },
  33234. //>>excludeStart("ide", pragmas.excludeIdeData);
  33235. args: [],
  33236. source: "receiver\x0a\x09^ receiver",
  33237. referencedClasses: [],
  33238. //>>excludeEnd("ide");
  33239. messageSends: []
  33240. }),
  33241. globals.CascadeNode);
  33242. smalltalk.addMethod(
  33243. smalltalk.method({
  33244. selector: "receiver:",
  33245. protocol: 'accessing',
  33246. fn: function (aNode){
  33247. var self=this;
  33248. self["@receiver"]=aNode;
  33249. return self;
  33250. },
  33251. //>>excludeStart("ide", pragmas.excludeIdeData);
  33252. args: ["aNode"],
  33253. source: "receiver: aNode\x0a\x09receiver := aNode",
  33254. referencedClasses: [],
  33255. //>>excludeEnd("ide");
  33256. messageSends: []
  33257. }),
  33258. globals.CascadeNode);
  33259. smalltalk.addClass('DynamicArrayNode', globals.Node, [], 'Compiler-AST');
  33260. //>>excludeStart("ide", pragmas.excludeIdeData);
  33261. globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  33262. //>>excludeEnd("ide");
  33263. smalltalk.addMethod(
  33264. smalltalk.method({
  33265. selector: "accept:",
  33266. protocol: 'visiting',
  33267. fn: function (aVisitor){
  33268. var self=this;
  33269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33270. return smalltalk.withContext(function($ctx1) {
  33271. //>>excludeEnd("ctx");
  33272. var $1;
  33273. $1=_st(aVisitor)._visitDynamicArrayNode_(self);
  33274. return $1;
  33275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33276. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicArrayNode)});
  33277. //>>excludeEnd("ctx");
  33278. },
  33279. //>>excludeStart("ide", pragmas.excludeIdeData);
  33280. args: ["aVisitor"],
  33281. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  33282. referencedClasses: [],
  33283. //>>excludeEnd("ide");
  33284. messageSends: ["visitDynamicArrayNode:"]
  33285. }),
  33286. globals.DynamicArrayNode);
  33287. smalltalk.addClass('DynamicDictionaryNode', globals.Node, [], 'Compiler-AST');
  33288. //>>excludeStart("ide", pragmas.excludeIdeData);
  33289. globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  33290. //>>excludeEnd("ide");
  33291. smalltalk.addMethod(
  33292. smalltalk.method({
  33293. selector: "accept:",
  33294. protocol: 'visiting',
  33295. fn: function (aVisitor){
  33296. var self=this;
  33297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33298. return smalltalk.withContext(function($ctx1) {
  33299. //>>excludeEnd("ctx");
  33300. var $1;
  33301. $1=_st(aVisitor)._visitDynamicDictionaryNode_(self);
  33302. return $1;
  33303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33304. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.DynamicDictionaryNode)});
  33305. //>>excludeEnd("ctx");
  33306. },
  33307. //>>excludeStart("ide", pragmas.excludeIdeData);
  33308. args: ["aVisitor"],
  33309. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  33310. referencedClasses: [],
  33311. //>>excludeEnd("ide");
  33312. messageSends: ["visitDynamicDictionaryNode:"]
  33313. }),
  33314. globals.DynamicDictionaryNode);
  33315. smalltalk.addClass('JSStatementNode', globals.Node, [], 'Compiler-AST');
  33316. //>>excludeStart("ide", pragmas.excludeIdeData);
  33317. globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  33318. //>>excludeEnd("ide");
  33319. smalltalk.addMethod(
  33320. smalltalk.method({
  33321. selector: "accept:",
  33322. protocol: 'visiting',
  33323. fn: function (aVisitor){
  33324. var self=this;
  33325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33326. return smalltalk.withContext(function($ctx1) {
  33327. //>>excludeEnd("ctx");
  33328. var $1;
  33329. $1=_st(aVisitor)._visitJSStatementNode_(self);
  33330. return $1;
  33331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33332. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.JSStatementNode)});
  33333. //>>excludeEnd("ctx");
  33334. },
  33335. //>>excludeStart("ide", pragmas.excludeIdeData);
  33336. args: ["aVisitor"],
  33337. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  33338. referencedClasses: [],
  33339. //>>excludeEnd("ide");
  33340. messageSends: ["visitJSStatementNode:"]
  33341. }),
  33342. globals.JSStatementNode);
  33343. smalltalk.addMethod(
  33344. smalltalk.method({
  33345. selector: "isJSStatementNode",
  33346. protocol: 'testing',
  33347. fn: function (){
  33348. var self=this;
  33349. return true;
  33350. },
  33351. //>>excludeStart("ide", pragmas.excludeIdeData);
  33352. args: [],
  33353. source: "isJSStatementNode\x0a\x09^ true",
  33354. referencedClasses: [],
  33355. //>>excludeEnd("ide");
  33356. messageSends: []
  33357. }),
  33358. globals.JSStatementNode);
  33359. smalltalk.addMethod(
  33360. smalltalk.method({
  33361. selector: "requiresSmalltalkContext",
  33362. protocol: 'testing',
  33363. fn: function (){
  33364. var self=this;
  33365. return true;
  33366. },
  33367. //>>excludeStart("ide", pragmas.excludeIdeData);
  33368. args: [],
  33369. source: "requiresSmalltalkContext\x0a\x09^ true",
  33370. referencedClasses: [],
  33371. //>>excludeEnd("ide");
  33372. messageSends: []
  33373. }),
  33374. globals.JSStatementNode);
  33375. smalltalk.addClass('MethodNode', globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes', 'superSends'], 'Compiler-AST');
  33376. //>>excludeStart("ide", pragmas.excludeIdeData);
  33377. globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  33378. //>>excludeEnd("ide");
  33379. smalltalk.addMethod(
  33380. smalltalk.method({
  33381. selector: "accept:",
  33382. protocol: 'visiting',
  33383. fn: function (aVisitor){
  33384. var self=this;
  33385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33386. return smalltalk.withContext(function($ctx1) {
  33387. //>>excludeEnd("ctx");
  33388. var $1;
  33389. $1=_st(aVisitor)._visitMethodNode_(self);
  33390. return $1;
  33391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33392. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.MethodNode)});
  33393. //>>excludeEnd("ctx");
  33394. },
  33395. //>>excludeStart("ide", pragmas.excludeIdeData);
  33396. args: ["aVisitor"],
  33397. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  33398. referencedClasses: [],
  33399. //>>excludeEnd("ide");
  33400. messageSends: ["visitMethodNode:"]
  33401. }),
  33402. globals.MethodNode);
  33403. smalltalk.addMethod(
  33404. smalltalk.method({
  33405. selector: "arguments",
  33406. protocol: 'accessing',
  33407. fn: function (){
  33408. var self=this;
  33409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33410. return smalltalk.withContext(function($ctx1) {
  33411. //>>excludeEnd("ctx");
  33412. var $2,$1,$receiver;
  33413. $2=self["@arguments"];
  33414. if(($receiver = $2) == null || $receiver.isNil){
  33415. $1=[];
  33416. } else {
  33417. $1=$2;
  33418. };
  33419. return $1;
  33420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33421. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.MethodNode)});
  33422. //>>excludeEnd("ctx");
  33423. },
  33424. //>>excludeStart("ide", pragmas.excludeIdeData);
  33425. args: [],
  33426. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  33427. referencedClasses: [],
  33428. //>>excludeEnd("ide");
  33429. messageSends: ["ifNil:"]
  33430. }),
  33431. globals.MethodNode);
  33432. smalltalk.addMethod(
  33433. smalltalk.method({
  33434. selector: "arguments:",
  33435. protocol: 'accessing',
  33436. fn: function (aCollection){
  33437. var self=this;
  33438. self["@arguments"]=aCollection;
  33439. return self;
  33440. },
  33441. //>>excludeStart("ide", pragmas.excludeIdeData);
  33442. args: ["aCollection"],
  33443. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  33444. referencedClasses: [],
  33445. //>>excludeEnd("ide");
  33446. messageSends: []
  33447. }),
  33448. globals.MethodNode);
  33449. smalltalk.addMethod(
  33450. smalltalk.method({
  33451. selector: "classReferences",
  33452. protocol: 'accessing',
  33453. fn: function (){
  33454. var self=this;
  33455. var $1;
  33456. $1=self["@classReferences"];
  33457. return $1;
  33458. },
  33459. //>>excludeStart("ide", pragmas.excludeIdeData);
  33460. args: [],
  33461. source: "classReferences\x0a\x09^ classReferences",
  33462. referencedClasses: [],
  33463. //>>excludeEnd("ide");
  33464. messageSends: []
  33465. }),
  33466. globals.MethodNode);
  33467. smalltalk.addMethod(
  33468. smalltalk.method({
  33469. selector: "classReferences:",
  33470. protocol: 'accessing',
  33471. fn: function (aCollection){
  33472. var self=this;
  33473. self["@classReferences"]=aCollection;
  33474. return self;
  33475. },
  33476. //>>excludeStart("ide", pragmas.excludeIdeData);
  33477. args: ["aCollection"],
  33478. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  33479. referencedClasses: [],
  33480. //>>excludeEnd("ide");
  33481. messageSends: []
  33482. }),
  33483. globals.MethodNode);
  33484. smalltalk.addMethod(
  33485. smalltalk.method({
  33486. selector: "messageSends",
  33487. protocol: 'accessing',
  33488. fn: function (){
  33489. var self=this;
  33490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33491. return smalltalk.withContext(function($ctx1) {
  33492. //>>excludeEnd("ctx");
  33493. var $1;
  33494. $1=_st(self._sendIndexes())._keys();
  33495. return $1;
  33496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33497. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.MethodNode)});
  33498. //>>excludeEnd("ctx");
  33499. },
  33500. //>>excludeStart("ide", pragmas.excludeIdeData);
  33501. args: [],
  33502. source: "messageSends\x0a\x09^ self sendIndexes keys",
  33503. referencedClasses: [],
  33504. //>>excludeEnd("ide");
  33505. messageSends: ["keys", "sendIndexes"]
  33506. }),
  33507. globals.MethodNode);
  33508. smalltalk.addMethod(
  33509. smalltalk.method({
  33510. selector: "method",
  33511. protocol: 'accessing',
  33512. fn: function (){
  33513. var self=this;
  33514. return self;
  33515. },
  33516. //>>excludeStart("ide", pragmas.excludeIdeData);
  33517. args: [],
  33518. source: "method\x0a\x09^ self",
  33519. referencedClasses: [],
  33520. //>>excludeEnd("ide");
  33521. messageSends: []
  33522. }),
  33523. globals.MethodNode);
  33524. smalltalk.addMethod(
  33525. smalltalk.method({
  33526. selector: "scope",
  33527. protocol: 'accessing',
  33528. fn: function (){
  33529. var self=this;
  33530. var $1;
  33531. $1=self["@scope"];
  33532. return $1;
  33533. },
  33534. //>>excludeStart("ide", pragmas.excludeIdeData);
  33535. args: [],
  33536. source: "scope\x0a\x09^ scope",
  33537. referencedClasses: [],
  33538. //>>excludeEnd("ide");
  33539. messageSends: []
  33540. }),
  33541. globals.MethodNode);
  33542. smalltalk.addMethod(
  33543. smalltalk.method({
  33544. selector: "scope:",
  33545. protocol: 'accessing',
  33546. fn: function (aMethodScope){
  33547. var self=this;
  33548. self["@scope"]=aMethodScope;
  33549. return self;
  33550. },
  33551. //>>excludeStart("ide", pragmas.excludeIdeData);
  33552. args: ["aMethodScope"],
  33553. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  33554. referencedClasses: [],
  33555. //>>excludeEnd("ide");
  33556. messageSends: []
  33557. }),
  33558. globals.MethodNode);
  33559. smalltalk.addMethod(
  33560. smalltalk.method({
  33561. selector: "selector",
  33562. protocol: 'accessing',
  33563. fn: function (){
  33564. var self=this;
  33565. var $1;
  33566. $1=self["@selector"];
  33567. return $1;
  33568. },
  33569. //>>excludeStart("ide", pragmas.excludeIdeData);
  33570. args: [],
  33571. source: "selector\x0a\x09^ selector",
  33572. referencedClasses: [],
  33573. //>>excludeEnd("ide");
  33574. messageSends: []
  33575. }),
  33576. globals.MethodNode);
  33577. smalltalk.addMethod(
  33578. smalltalk.method({
  33579. selector: "selector:",
  33580. protocol: 'accessing',
  33581. fn: function (aString){
  33582. var self=this;
  33583. self["@selector"]=aString;
  33584. return self;
  33585. },
  33586. //>>excludeStart("ide", pragmas.excludeIdeData);
  33587. args: ["aString"],
  33588. source: "selector: aString\x0a\x09selector := aString",
  33589. referencedClasses: [],
  33590. //>>excludeEnd("ide");
  33591. messageSends: []
  33592. }),
  33593. globals.MethodNode);
  33594. smalltalk.addMethod(
  33595. smalltalk.method({
  33596. selector: "sendIndexes",
  33597. protocol: 'accessing',
  33598. fn: function (){
  33599. var self=this;
  33600. var $1;
  33601. $1=self["@sendIndexes"];
  33602. return $1;
  33603. },
  33604. //>>excludeStart("ide", pragmas.excludeIdeData);
  33605. args: [],
  33606. source: "sendIndexes\x0a\x09^ sendIndexes",
  33607. referencedClasses: [],
  33608. //>>excludeEnd("ide");
  33609. messageSends: []
  33610. }),
  33611. globals.MethodNode);
  33612. smalltalk.addMethod(
  33613. smalltalk.method({
  33614. selector: "sendIndexes:",
  33615. protocol: 'accessing',
  33616. fn: function (aDictionary){
  33617. var self=this;
  33618. self["@sendIndexes"]=aDictionary;
  33619. return self;
  33620. },
  33621. //>>excludeStart("ide", pragmas.excludeIdeData);
  33622. args: ["aDictionary"],
  33623. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  33624. referencedClasses: [],
  33625. //>>excludeEnd("ide");
  33626. messageSends: []
  33627. }),
  33628. globals.MethodNode);
  33629. smalltalk.addMethod(
  33630. smalltalk.method({
  33631. selector: "sequenceNode",
  33632. protocol: 'accessing',
  33633. fn: function (){
  33634. var self=this;
  33635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33636. return smalltalk.withContext(function($ctx1) {
  33637. //>>excludeEnd("ctx");
  33638. var $1;
  33639. var $early={};
  33640. try {
  33641. _st(self._nodes())._do_((function(each){
  33642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33643. return smalltalk.withContext(function($ctx2) {
  33644. //>>excludeEnd("ctx");
  33645. $1=_st(each)._isSequenceNode();
  33646. if(smalltalk.assert($1)){
  33647. throw $early=[each];
  33648. };
  33649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33651. //>>excludeEnd("ctx");
  33652. }));
  33653. return nil;
  33654. }
  33655. catch(e) {if(e===$early)return e[0]; throw e}
  33656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33657. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},globals.MethodNode)});
  33658. //>>excludeEnd("ctx");
  33659. },
  33660. //>>excludeStart("ide", pragmas.excludeIdeData);
  33661. args: [],
  33662. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  33663. referencedClasses: [],
  33664. //>>excludeEnd("ide");
  33665. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  33666. }),
  33667. globals.MethodNode);
  33668. smalltalk.addMethod(
  33669. smalltalk.method({
  33670. selector: "source",
  33671. protocol: 'accessing',
  33672. fn: function (){
  33673. var self=this;
  33674. var $1;
  33675. $1=self["@source"];
  33676. return $1;
  33677. },
  33678. //>>excludeStart("ide", pragmas.excludeIdeData);
  33679. args: [],
  33680. source: "source\x0a\x09^ source",
  33681. referencedClasses: [],
  33682. //>>excludeEnd("ide");
  33683. messageSends: []
  33684. }),
  33685. globals.MethodNode);
  33686. smalltalk.addMethod(
  33687. smalltalk.method({
  33688. selector: "source:",
  33689. protocol: 'accessing',
  33690. fn: function (aString){
  33691. var self=this;
  33692. self["@source"]=aString;
  33693. return self;
  33694. },
  33695. //>>excludeStart("ide", pragmas.excludeIdeData);
  33696. args: ["aString"],
  33697. source: "source: aString\x0a\x09source := aString",
  33698. referencedClasses: [],
  33699. //>>excludeEnd("ide");
  33700. messageSends: []
  33701. }),
  33702. globals.MethodNode);
  33703. smalltalk.addMethod(
  33704. smalltalk.method({
  33705. selector: "superSends",
  33706. protocol: 'accessing',
  33707. fn: function (){
  33708. var self=this;
  33709. var $1;
  33710. $1=self["@superSends"];
  33711. return $1;
  33712. },
  33713. //>>excludeStart("ide", pragmas.excludeIdeData);
  33714. args: [],
  33715. source: "superSends\x0a\x09^ superSends",
  33716. referencedClasses: [],
  33717. //>>excludeEnd("ide");
  33718. messageSends: []
  33719. }),
  33720. globals.MethodNode);
  33721. smalltalk.addMethod(
  33722. smalltalk.method({
  33723. selector: "superSends:",
  33724. protocol: 'accessing',
  33725. fn: function (aCollection){
  33726. var self=this;
  33727. self["@superSends"]=aCollection;
  33728. return self;
  33729. },
  33730. //>>excludeStart("ide", pragmas.excludeIdeData);
  33731. args: ["aCollection"],
  33732. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  33733. referencedClasses: [],
  33734. //>>excludeEnd("ide");
  33735. messageSends: []
  33736. }),
  33737. globals.MethodNode);
  33738. smalltalk.addClass('ReturnNode', globals.Node, ['scope'], 'Compiler-AST');
  33739. //>>excludeStart("ide", pragmas.excludeIdeData);
  33740. globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  33741. //>>excludeEnd("ide");
  33742. smalltalk.addMethod(
  33743. smalltalk.method({
  33744. selector: "accept:",
  33745. protocol: 'visiting',
  33746. fn: function (aVisitor){
  33747. var self=this;
  33748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33749. return smalltalk.withContext(function($ctx1) {
  33750. //>>excludeEnd("ctx");
  33751. var $1;
  33752. $1=_st(aVisitor)._visitReturnNode_(self);
  33753. return $1;
  33754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33755. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ReturnNode)});
  33756. //>>excludeEnd("ctx");
  33757. },
  33758. //>>excludeStart("ide", pragmas.excludeIdeData);
  33759. args: ["aVisitor"],
  33760. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  33761. referencedClasses: [],
  33762. //>>excludeEnd("ide");
  33763. messageSends: ["visitReturnNode:"]
  33764. }),
  33765. globals.ReturnNode);
  33766. smalltalk.addMethod(
  33767. smalltalk.method({
  33768. selector: "isReturnNode",
  33769. protocol: 'testing',
  33770. fn: function (){
  33771. var self=this;
  33772. return true;
  33773. },
  33774. //>>excludeStart("ide", pragmas.excludeIdeData);
  33775. args: [],
  33776. source: "isReturnNode\x0a\x09^ true",
  33777. referencedClasses: [],
  33778. //>>excludeEnd("ide");
  33779. messageSends: []
  33780. }),
  33781. globals.ReturnNode);
  33782. smalltalk.addMethod(
  33783. smalltalk.method({
  33784. selector: "nonLocalReturn",
  33785. protocol: 'testing',
  33786. fn: function (){
  33787. var self=this;
  33788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33789. return smalltalk.withContext(function($ctx1) {
  33790. //>>excludeEnd("ctx");
  33791. var $1;
  33792. $1=_st(_st(self._scope())._isMethodScope())._not();
  33793. return $1;
  33794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33795. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},globals.ReturnNode)});
  33796. //>>excludeEnd("ctx");
  33797. },
  33798. //>>excludeStart("ide", pragmas.excludeIdeData);
  33799. args: [],
  33800. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  33801. referencedClasses: [],
  33802. //>>excludeEnd("ide");
  33803. messageSends: ["not", "isMethodScope", "scope"]
  33804. }),
  33805. globals.ReturnNode);
  33806. smalltalk.addMethod(
  33807. smalltalk.method({
  33808. selector: "scope",
  33809. protocol: 'accessing',
  33810. fn: function (){
  33811. var self=this;
  33812. var $1;
  33813. $1=self["@scope"];
  33814. return $1;
  33815. },
  33816. //>>excludeStart("ide", pragmas.excludeIdeData);
  33817. args: [],
  33818. source: "scope\x0a\x09^ scope",
  33819. referencedClasses: [],
  33820. //>>excludeEnd("ide");
  33821. messageSends: []
  33822. }),
  33823. globals.ReturnNode);
  33824. smalltalk.addMethod(
  33825. smalltalk.method({
  33826. selector: "scope:",
  33827. protocol: 'accessing',
  33828. fn: function (aLexicalScope){
  33829. var self=this;
  33830. self["@scope"]=aLexicalScope;
  33831. return self;
  33832. },
  33833. //>>excludeStart("ide", pragmas.excludeIdeData);
  33834. args: ["aLexicalScope"],
  33835. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  33836. referencedClasses: [],
  33837. //>>excludeEnd("ide");
  33838. messageSends: []
  33839. }),
  33840. globals.ReturnNode);
  33841. smalltalk.addClass('SendNode', globals.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
  33842. //>>excludeStart("ide", pragmas.excludeIdeData);
  33843. globals.SendNode.comment="I represent an message send node.";
  33844. //>>excludeEnd("ide");
  33845. smalltalk.addMethod(
  33846. smalltalk.method({
  33847. selector: "accept:",
  33848. protocol: 'visiting',
  33849. fn: function (aVisitor){
  33850. var self=this;
  33851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33852. return smalltalk.withContext(function($ctx1) {
  33853. //>>excludeEnd("ctx");
  33854. var $1;
  33855. $1=_st(aVisitor)._visitSendNode_(self);
  33856. return $1;
  33857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33858. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SendNode)});
  33859. //>>excludeEnd("ctx");
  33860. },
  33861. //>>excludeStart("ide", pragmas.excludeIdeData);
  33862. args: ["aVisitor"],
  33863. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  33864. referencedClasses: [],
  33865. //>>excludeEnd("ide");
  33866. messageSends: ["visitSendNode:"]
  33867. }),
  33868. globals.SendNode);
  33869. smalltalk.addMethod(
  33870. smalltalk.method({
  33871. selector: "arguments",
  33872. protocol: 'accessing',
  33873. fn: function (){
  33874. var self=this;
  33875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33876. return smalltalk.withContext(function($ctx1) {
  33877. //>>excludeEnd("ctx");
  33878. var $2,$1,$receiver;
  33879. $2=self["@arguments"];
  33880. if(($receiver = $2) == null || $receiver.isNil){
  33881. self["@arguments"]=[];
  33882. $1=self["@arguments"];
  33883. } else {
  33884. $1=$2;
  33885. };
  33886. return $1;
  33887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33888. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.SendNode)});
  33889. //>>excludeEnd("ctx");
  33890. },
  33891. //>>excludeStart("ide", pragmas.excludeIdeData);
  33892. args: [],
  33893. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  33894. referencedClasses: [],
  33895. //>>excludeEnd("ide");
  33896. messageSends: ["ifNil:"]
  33897. }),
  33898. globals.SendNode);
  33899. smalltalk.addMethod(
  33900. smalltalk.method({
  33901. selector: "arguments:",
  33902. protocol: 'accessing',
  33903. fn: function (aCollection){
  33904. var self=this;
  33905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33906. return smalltalk.withContext(function($ctx1) {
  33907. //>>excludeEnd("ctx");
  33908. self["@arguments"]=aCollection;
  33909. _st(aCollection)._do_((function(each){
  33910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33911. return smalltalk.withContext(function($ctx2) {
  33912. //>>excludeEnd("ctx");
  33913. return _st(each)._parent_(self);
  33914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33916. //>>excludeEnd("ctx");
  33917. }));
  33918. return self;
  33919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33920. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},globals.SendNode)});
  33921. //>>excludeEnd("ctx");
  33922. },
  33923. //>>excludeStart("ide", pragmas.excludeIdeData);
  33924. args: ["aCollection"],
  33925. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  33926. referencedClasses: [],
  33927. //>>excludeEnd("ide");
  33928. messageSends: ["do:", "parent:"]
  33929. }),
  33930. globals.SendNode);
  33931. smalltalk.addMethod(
  33932. smalltalk.method({
  33933. selector: "cascadeNodeWithMessages:",
  33934. protocol: 'accessing',
  33935. fn: function (aCollection){
  33936. var self=this;
  33937. var first;
  33938. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  33939. function $CascadeNode(){return globals.CascadeNode||(typeof CascadeNode=="undefined"?nil:CascadeNode)}
  33940. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  33941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33942. return smalltalk.withContext(function($ctx1) {
  33943. //>>excludeEnd("ctx");
  33944. var $1,$2,$4,$5,$3;
  33945. $1=_st($SendNode())._new();
  33946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33947. $ctx1.sendIdx["new"]=1;
  33948. //>>excludeEnd("ctx");
  33949. _st($1)._selector_(self._selector());
  33950. _st($1)._arguments_(self._arguments());
  33951. $2=_st($1)._yourself();
  33952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33953. $ctx1.sendIdx["yourself"]=1;
  33954. //>>excludeEnd("ctx");
  33955. first=$2;
  33956. $4=_st($CascadeNode())._new();
  33957. _st($4)._receiver_(self._receiver());
  33958. _st($4)._nodes_(_st(_st($Array())._with_(first)).__comma(aCollection));
  33959. $5=_st($4)._yourself();
  33960. $3=$5;
  33961. return $3;
  33962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33963. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},globals.SendNode)});
  33964. //>>excludeEnd("ctx");
  33965. },
  33966. //>>excludeStart("ide", pragmas.excludeIdeData);
  33967. args: ["aCollection"],
  33968. 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",
  33969. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  33970. //>>excludeEnd("ide");
  33971. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  33972. }),
  33973. globals.SendNode);
  33974. smalltalk.addMethod(
  33975. smalltalk.method({
  33976. selector: "index",
  33977. protocol: 'accessing',
  33978. fn: function (){
  33979. var self=this;
  33980. var $1;
  33981. $1=self["@index"];
  33982. return $1;
  33983. },
  33984. //>>excludeStart("ide", pragmas.excludeIdeData);
  33985. args: [],
  33986. source: "index\x0a\x09^ index",
  33987. referencedClasses: [],
  33988. //>>excludeEnd("ide");
  33989. messageSends: []
  33990. }),
  33991. globals.SendNode);
  33992. smalltalk.addMethod(
  33993. smalltalk.method({
  33994. selector: "index:",
  33995. protocol: 'accessing',
  33996. fn: function (anInteger){
  33997. var self=this;
  33998. self["@index"]=anInteger;
  33999. return self;
  34000. },
  34001. //>>excludeStart("ide", pragmas.excludeIdeData);
  34002. args: ["anInteger"],
  34003. source: "index: anInteger\x0a\x09index := anInteger",
  34004. referencedClasses: [],
  34005. //>>excludeEnd("ide");
  34006. messageSends: []
  34007. }),
  34008. globals.SendNode);
  34009. smalltalk.addMethod(
  34010. smalltalk.method({
  34011. selector: "isCascadeSendNode",
  34012. protocol: 'testing',
  34013. fn: function (){
  34014. var self=this;
  34015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34016. return smalltalk.withContext(function($ctx1) {
  34017. //>>excludeEnd("ctx");
  34018. var $1;
  34019. $1=_st(self._parent())._isCascadeNode();
  34020. return $1;
  34021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34022. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},globals.SendNode)});
  34023. //>>excludeEnd("ctx");
  34024. },
  34025. //>>excludeStart("ide", pragmas.excludeIdeData);
  34026. args: [],
  34027. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  34028. referencedClasses: [],
  34029. //>>excludeEnd("ide");
  34030. messageSends: ["isCascadeNode", "parent"]
  34031. }),
  34032. globals.SendNode);
  34033. smalltalk.addMethod(
  34034. smalltalk.method({
  34035. selector: "isNavigationNode",
  34036. protocol: 'testing',
  34037. fn: function (){
  34038. var self=this;
  34039. return true;
  34040. },
  34041. //>>excludeStart("ide", pragmas.excludeIdeData);
  34042. args: [],
  34043. source: "isNavigationNode\x0a\x09^ true",
  34044. referencedClasses: [],
  34045. //>>excludeEnd("ide");
  34046. messageSends: []
  34047. }),
  34048. globals.SendNode);
  34049. smalltalk.addMethod(
  34050. smalltalk.method({
  34051. selector: "isSendNode",
  34052. protocol: 'testing',
  34053. fn: function (){
  34054. var self=this;
  34055. return true;
  34056. },
  34057. //>>excludeStart("ide", pragmas.excludeIdeData);
  34058. args: [],
  34059. source: "isSendNode\x0a\x09^ true",
  34060. referencedClasses: [],
  34061. //>>excludeEnd("ide");
  34062. messageSends: []
  34063. }),
  34064. globals.SendNode);
  34065. smalltalk.addMethod(
  34066. smalltalk.method({
  34067. selector: "navigationLink",
  34068. protocol: 'accessing',
  34069. fn: function (){
  34070. var self=this;
  34071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34072. return smalltalk.withContext(function($ctx1) {
  34073. //>>excludeEnd("ctx");
  34074. var $1;
  34075. $1=self._selector();
  34076. return $1;
  34077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34078. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.SendNode)});
  34079. //>>excludeEnd("ctx");
  34080. },
  34081. //>>excludeStart("ide", pragmas.excludeIdeData);
  34082. args: [],
  34083. source: "navigationLink\x0a\x09^ self selector",
  34084. referencedClasses: [],
  34085. //>>excludeEnd("ide");
  34086. messageSends: ["selector"]
  34087. }),
  34088. globals.SendNode);
  34089. smalltalk.addMethod(
  34090. smalltalk.method({
  34091. selector: "nodes",
  34092. protocol: 'accessing',
  34093. fn: function (){
  34094. var self=this;
  34095. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  34096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34097. return smalltalk.withContext(function($ctx1) {
  34098. //>>excludeEnd("ctx");
  34099. var $1,$3,$2,$5,$6,$4,$receiver;
  34100. $1=self._receiver();
  34101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34102. $ctx1.sendIdx["receiver"]=1;
  34103. //>>excludeEnd("ctx");
  34104. if(($receiver = $1) == null || $receiver.isNil){
  34105. $3=self._arguments();
  34106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34107. $ctx1.sendIdx["arguments"]=1;
  34108. //>>excludeEnd("ctx");
  34109. $2=_st($3)._copy();
  34110. return $2;
  34111. } else {
  34112. $1;
  34113. };
  34114. $5=_st($Array())._with_(self._receiver());
  34115. _st($5)._addAll_(self._arguments());
  34116. $6=_st($5)._yourself();
  34117. $4=$6;
  34118. return $4;
  34119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34120. }, function($ctx1) {$ctx1.fill(self,"nodes",{},globals.SendNode)});
  34121. //>>excludeEnd("ctx");
  34122. },
  34123. //>>excludeStart("ide", pragmas.excludeIdeData);
  34124. args: [],
  34125. 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",
  34126. referencedClasses: ["Array"],
  34127. //>>excludeEnd("ide");
  34128. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34129. }),
  34130. globals.SendNode);
  34131. smalltalk.addMethod(
  34132. smalltalk.method({
  34133. selector: "receiver",
  34134. protocol: 'accessing',
  34135. fn: function (){
  34136. var self=this;
  34137. var $1;
  34138. $1=self["@receiver"];
  34139. return $1;
  34140. },
  34141. //>>excludeStart("ide", pragmas.excludeIdeData);
  34142. args: [],
  34143. source: "receiver\x0a\x09^ receiver",
  34144. referencedClasses: [],
  34145. //>>excludeEnd("ide");
  34146. messageSends: []
  34147. }),
  34148. globals.SendNode);
  34149. smalltalk.addMethod(
  34150. smalltalk.method({
  34151. selector: "receiver:",
  34152. protocol: 'accessing',
  34153. fn: function (aNode){
  34154. var self=this;
  34155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34156. return smalltalk.withContext(function($ctx1) {
  34157. //>>excludeEnd("ctx");
  34158. var $1;
  34159. self["@receiver"]=aNode;
  34160. $1=_st(aNode)._isNode();
  34161. if(smalltalk.assert($1)){
  34162. _st(aNode)._parent_(self);
  34163. };
  34164. return self;
  34165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34166. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},globals.SendNode)});
  34167. //>>excludeEnd("ctx");
  34168. },
  34169. //>>excludeStart("ide", pragmas.excludeIdeData);
  34170. args: ["aNode"],
  34171. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  34172. referencedClasses: [],
  34173. //>>excludeEnd("ide");
  34174. messageSends: ["ifTrue:", "isNode", "parent:"]
  34175. }),
  34176. globals.SendNode);
  34177. smalltalk.addMethod(
  34178. smalltalk.method({
  34179. selector: "requiresSmalltalkContext",
  34180. protocol: 'testing',
  34181. fn: function (){
  34182. var self=this;
  34183. return true;
  34184. },
  34185. //>>excludeStart("ide", pragmas.excludeIdeData);
  34186. args: [],
  34187. source: "requiresSmalltalkContext\x0a\x09^ true",
  34188. referencedClasses: [],
  34189. //>>excludeEnd("ide");
  34190. messageSends: []
  34191. }),
  34192. globals.SendNode);
  34193. smalltalk.addMethod(
  34194. smalltalk.method({
  34195. selector: "selector",
  34196. protocol: 'accessing',
  34197. fn: function (){
  34198. var self=this;
  34199. var $1;
  34200. $1=self["@selector"];
  34201. return $1;
  34202. },
  34203. //>>excludeStart("ide", pragmas.excludeIdeData);
  34204. args: [],
  34205. source: "selector\x0a\x09^ selector",
  34206. referencedClasses: [],
  34207. //>>excludeEnd("ide");
  34208. messageSends: []
  34209. }),
  34210. globals.SendNode);
  34211. smalltalk.addMethod(
  34212. smalltalk.method({
  34213. selector: "selector:",
  34214. protocol: 'accessing',
  34215. fn: function (aString){
  34216. var self=this;
  34217. self["@selector"]=aString;
  34218. return self;
  34219. },
  34220. //>>excludeStart("ide", pragmas.excludeIdeData);
  34221. args: ["aString"],
  34222. source: "selector: aString\x0a\x09selector := aString",
  34223. referencedClasses: [],
  34224. //>>excludeEnd("ide");
  34225. messageSends: []
  34226. }),
  34227. globals.SendNode);
  34228. smalltalk.addMethod(
  34229. smalltalk.method({
  34230. selector: "shouldBeAliased",
  34231. protocol: 'testing',
  34232. fn: function (){
  34233. var self=this;
  34234. var sends;
  34235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34236. return smalltalk.withContext(function($ctx1) {
  34237. //>>excludeEnd("ctx");
  34238. var $2,$1;
  34239. sends=_st(_st(_st(self._method())._sendIndexes())._at_(self._selector()))._size();
  34240. $2=(
  34241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34242. $ctx1.supercall = true,
  34243. //>>excludeEnd("ctx");
  34244. globals.SendNode.superclass.fn.prototype._shouldBeAliased.apply(_st(self), []));
  34245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34246. $ctx1.supercall = false;
  34247. //>>excludeEnd("ctx");;
  34248. $1=_st($2)._or_((function(){
  34249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34250. return smalltalk.withContext(function($ctx2) {
  34251. //>>excludeEnd("ctx");
  34252. return _st(self._isReferenced())._and_((function(){
  34253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34254. return smalltalk.withContext(function($ctx3) {
  34255. //>>excludeEnd("ctx");
  34256. return _st(_st(_st(sends).__gt((1)))._and_((function(){
  34257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34258. return smalltalk.withContext(function($ctx4) {
  34259. //>>excludeEnd("ctx");
  34260. return _st(self._index()).__lt(sends);
  34261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34262. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  34263. //>>excludeEnd("ctx");
  34264. })))._or_((function(){
  34265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34266. return smalltalk.withContext(function($ctx4) {
  34267. //>>excludeEnd("ctx");
  34268. return self._superSend();
  34269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34270. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  34271. //>>excludeEnd("ctx");
  34272. }));
  34273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34274. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  34275. //>>excludeEnd("ctx");
  34276. }));
  34277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34278. $ctx2.sendIdx["and:"]=1;
  34279. //>>excludeEnd("ctx");
  34280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34282. //>>excludeEnd("ctx");
  34283. }));
  34284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34285. $ctx1.sendIdx["or:"]=1;
  34286. //>>excludeEnd("ctx");
  34287. return $1;
  34288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34289. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},globals.SendNode)});
  34290. //>>excludeEnd("ctx");
  34291. },
  34292. //>>excludeStart("ide", pragmas.excludeIdeData);
  34293. args: [],
  34294. 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 ] ] ])",
  34295. referencedClasses: [],
  34296. //>>excludeEnd("ide");
  34297. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  34298. }),
  34299. globals.SendNode);
  34300. smalltalk.addMethod(
  34301. smalltalk.method({
  34302. selector: "stopOnStepping",
  34303. protocol: 'testing',
  34304. fn: function (){
  34305. var self=this;
  34306. return true;
  34307. },
  34308. //>>excludeStart("ide", pragmas.excludeIdeData);
  34309. args: [],
  34310. source: "stopOnStepping\x0a\x09^ true",
  34311. referencedClasses: [],
  34312. //>>excludeEnd("ide");
  34313. messageSends: []
  34314. }),
  34315. globals.SendNode);
  34316. smalltalk.addMethod(
  34317. smalltalk.method({
  34318. selector: "superSend",
  34319. protocol: 'accessing',
  34320. fn: function (){
  34321. var self=this;
  34322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34323. return smalltalk.withContext(function($ctx1) {
  34324. //>>excludeEnd("ctx");
  34325. var $2,$1,$receiver;
  34326. $2=self["@superSend"];
  34327. if(($receiver = $2) == null || $receiver.isNil){
  34328. $1=false;
  34329. } else {
  34330. $1=$2;
  34331. };
  34332. return $1;
  34333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34334. }, function($ctx1) {$ctx1.fill(self,"superSend",{},globals.SendNode)});
  34335. //>>excludeEnd("ctx");
  34336. },
  34337. //>>excludeStart("ide", pragmas.excludeIdeData);
  34338. args: [],
  34339. source: "superSend\x0a\x09^ superSend ifNil: [ false ]",
  34340. referencedClasses: [],
  34341. //>>excludeEnd("ide");
  34342. messageSends: ["ifNil:"]
  34343. }),
  34344. globals.SendNode);
  34345. smalltalk.addMethod(
  34346. smalltalk.method({
  34347. selector: "superSend:",
  34348. protocol: 'accessing',
  34349. fn: function (aBoolean){
  34350. var self=this;
  34351. self["@superSend"]=aBoolean;
  34352. return self;
  34353. },
  34354. //>>excludeStart("ide", pragmas.excludeIdeData);
  34355. args: ["aBoolean"],
  34356. source: "superSend: aBoolean\x0a\x09superSend := aBoolean",
  34357. referencedClasses: [],
  34358. //>>excludeEnd("ide");
  34359. messageSends: []
  34360. }),
  34361. globals.SendNode);
  34362. smalltalk.addMethod(
  34363. smalltalk.method({
  34364. selector: "valueForReceiver:",
  34365. protocol: 'accessing',
  34366. fn: function (anObject){
  34367. var self=this;
  34368. function $SendNode(){return globals.SendNode||(typeof SendNode=="undefined"?nil:SendNode)}
  34369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34370. return smalltalk.withContext(function($ctx1) {
  34371. //>>excludeEnd("ctx");
  34372. var $2,$3,$5,$4,$6,$1,$receiver;
  34373. $2=_st($SendNode())._new();
  34374. _st($2)._position_(self._position());
  34375. _st($2)._source_(self._source());
  34376. $3=$2;
  34377. $5=self._receiver();
  34378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34379. $ctx1.sendIdx["receiver"]=1;
  34380. //>>excludeEnd("ctx");
  34381. if(($receiver = $5) == null || $receiver.isNil){
  34382. $4=anObject;
  34383. } else {
  34384. $4=_st(self._receiver())._valueForReceiver_(anObject);
  34385. };
  34386. _st($3)._receiver_($4);
  34387. _st($2)._selector_(self._selector());
  34388. _st($2)._arguments_(self._arguments());
  34389. $6=_st($2)._yourself();
  34390. $1=$6;
  34391. return $1;
  34392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34393. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},globals.SendNode)});
  34394. //>>excludeEnd("ctx");
  34395. },
  34396. //>>excludeStart("ide", pragmas.excludeIdeData);
  34397. args: ["anObject"],
  34398. 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",
  34399. referencedClasses: ["SendNode"],
  34400. //>>excludeEnd("ide");
  34401. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  34402. }),
  34403. globals.SendNode);
  34404. smalltalk.addClass('SequenceNode', globals.Node, ['temps', 'scope'], 'Compiler-AST');
  34405. //>>excludeStart("ide", pragmas.excludeIdeData);
  34406. 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).";
  34407. //>>excludeEnd("ide");
  34408. smalltalk.addMethod(
  34409. smalltalk.method({
  34410. selector: "accept:",
  34411. protocol: 'visiting',
  34412. fn: function (aVisitor){
  34413. var self=this;
  34414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34415. return smalltalk.withContext(function($ctx1) {
  34416. //>>excludeEnd("ctx");
  34417. var $1;
  34418. $1=_st(aVisitor)._visitSequenceNode_(self);
  34419. return $1;
  34420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34421. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.SequenceNode)});
  34422. //>>excludeEnd("ctx");
  34423. },
  34424. //>>excludeStart("ide", pragmas.excludeIdeData);
  34425. args: ["aVisitor"],
  34426. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34427. referencedClasses: [],
  34428. //>>excludeEnd("ide");
  34429. messageSends: ["visitSequenceNode:"]
  34430. }),
  34431. globals.SequenceNode);
  34432. smalltalk.addMethod(
  34433. smalltalk.method({
  34434. selector: "asBlockSequenceNode",
  34435. protocol: 'converting',
  34436. fn: function (){
  34437. var self=this;
  34438. function $BlockSequenceNode(){return globals.BlockSequenceNode||(typeof BlockSequenceNode=="undefined"?nil:BlockSequenceNode)}
  34439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34440. return smalltalk.withContext(function($ctx1) {
  34441. //>>excludeEnd("ctx");
  34442. var $2,$3,$1;
  34443. $2=_st($BlockSequenceNode())._new();
  34444. _st($2)._position_(self._position());
  34445. _st($2)._source_(self._source());
  34446. _st($2)._nodes_(self._nodes());
  34447. _st($2)._temps_(self._temps());
  34448. $3=_st($2)._yourself();
  34449. $1=$3;
  34450. return $1;
  34451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34452. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},globals.SequenceNode)});
  34453. //>>excludeEnd("ctx");
  34454. },
  34455. //>>excludeStart("ide", pragmas.excludeIdeData);
  34456. args: [],
  34457. 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",
  34458. referencedClasses: ["BlockSequenceNode"],
  34459. //>>excludeEnd("ide");
  34460. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  34461. }),
  34462. globals.SequenceNode);
  34463. smalltalk.addMethod(
  34464. smalltalk.method({
  34465. selector: "isSequenceNode",
  34466. protocol: 'testing',
  34467. fn: function (){
  34468. var self=this;
  34469. return true;
  34470. },
  34471. //>>excludeStart("ide", pragmas.excludeIdeData);
  34472. args: [],
  34473. source: "isSequenceNode\x0a\x09^ true",
  34474. referencedClasses: [],
  34475. //>>excludeEnd("ide");
  34476. messageSends: []
  34477. }),
  34478. globals.SequenceNode);
  34479. smalltalk.addMethod(
  34480. smalltalk.method({
  34481. selector: "scope",
  34482. protocol: 'accessing',
  34483. fn: function (){
  34484. var self=this;
  34485. var $1;
  34486. $1=self["@scope"];
  34487. return $1;
  34488. },
  34489. //>>excludeStart("ide", pragmas.excludeIdeData);
  34490. args: [],
  34491. source: "scope\x0a\x09^ scope",
  34492. referencedClasses: [],
  34493. //>>excludeEnd("ide");
  34494. messageSends: []
  34495. }),
  34496. globals.SequenceNode);
  34497. smalltalk.addMethod(
  34498. smalltalk.method({
  34499. selector: "scope:",
  34500. protocol: 'accessing',
  34501. fn: function (aLexicalScope){
  34502. var self=this;
  34503. self["@scope"]=aLexicalScope;
  34504. return self;
  34505. },
  34506. //>>excludeStart("ide", pragmas.excludeIdeData);
  34507. args: ["aLexicalScope"],
  34508. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34509. referencedClasses: [],
  34510. //>>excludeEnd("ide");
  34511. messageSends: []
  34512. }),
  34513. globals.SequenceNode);
  34514. smalltalk.addMethod(
  34515. smalltalk.method({
  34516. selector: "temps",
  34517. protocol: 'accessing',
  34518. fn: function (){
  34519. var self=this;
  34520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34521. return smalltalk.withContext(function($ctx1) {
  34522. //>>excludeEnd("ctx");
  34523. var $2,$1,$receiver;
  34524. $2=self["@temps"];
  34525. if(($receiver = $2) == null || $receiver.isNil){
  34526. $1=[];
  34527. } else {
  34528. $1=$2;
  34529. };
  34530. return $1;
  34531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34532. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.SequenceNode)});
  34533. //>>excludeEnd("ctx");
  34534. },
  34535. //>>excludeStart("ide", pragmas.excludeIdeData);
  34536. args: [],
  34537. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  34538. referencedClasses: [],
  34539. //>>excludeEnd("ide");
  34540. messageSends: ["ifNil:"]
  34541. }),
  34542. globals.SequenceNode);
  34543. smalltalk.addMethod(
  34544. smalltalk.method({
  34545. selector: "temps:",
  34546. protocol: 'accessing',
  34547. fn: function (aCollection){
  34548. var self=this;
  34549. self["@temps"]=aCollection;
  34550. return self;
  34551. },
  34552. //>>excludeStart("ide", pragmas.excludeIdeData);
  34553. args: ["aCollection"],
  34554. source: "temps: aCollection\x0a\x09temps := aCollection",
  34555. referencedClasses: [],
  34556. //>>excludeEnd("ide");
  34557. messageSends: []
  34558. }),
  34559. globals.SequenceNode);
  34560. smalltalk.addClass('BlockSequenceNode', globals.SequenceNode, [], 'Compiler-AST');
  34561. //>>excludeStart("ide", pragmas.excludeIdeData);
  34562. globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  34563. //>>excludeEnd("ide");
  34564. smalltalk.addMethod(
  34565. smalltalk.method({
  34566. selector: "accept:",
  34567. protocol: 'visiting',
  34568. fn: function (aVisitor){
  34569. var self=this;
  34570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34571. return smalltalk.withContext(function($ctx1) {
  34572. //>>excludeEnd("ctx");
  34573. var $1;
  34574. $1=_st(aVisitor)._visitBlockSequenceNode_(self);
  34575. return $1;
  34576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34577. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.BlockSequenceNode)});
  34578. //>>excludeEnd("ctx");
  34579. },
  34580. //>>excludeStart("ide", pragmas.excludeIdeData);
  34581. args: ["aVisitor"],
  34582. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  34583. referencedClasses: [],
  34584. //>>excludeEnd("ide");
  34585. messageSends: ["visitBlockSequenceNode:"]
  34586. }),
  34587. globals.BlockSequenceNode);
  34588. smalltalk.addMethod(
  34589. smalltalk.method({
  34590. selector: "isBlockSequenceNode",
  34591. protocol: 'testing',
  34592. fn: function (){
  34593. var self=this;
  34594. return true;
  34595. },
  34596. //>>excludeStart("ide", pragmas.excludeIdeData);
  34597. args: [],
  34598. source: "isBlockSequenceNode\x0a\x09^ true",
  34599. referencedClasses: [],
  34600. //>>excludeEnd("ide");
  34601. messageSends: []
  34602. }),
  34603. globals.BlockSequenceNode);
  34604. smalltalk.addClass('ValueNode', globals.Node, ['value'], 'Compiler-AST');
  34605. //>>excludeStart("ide", pragmas.excludeIdeData);
  34606. globals.ValueNode.comment="I represent a value node.";
  34607. //>>excludeEnd("ide");
  34608. smalltalk.addMethod(
  34609. smalltalk.method({
  34610. selector: "accept:",
  34611. protocol: 'visiting',
  34612. fn: function (aVisitor){
  34613. var self=this;
  34614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34615. return smalltalk.withContext(function($ctx1) {
  34616. //>>excludeEnd("ctx");
  34617. var $1;
  34618. $1=_st(aVisitor)._visitValueNode_(self);
  34619. return $1;
  34620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34621. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.ValueNode)});
  34622. //>>excludeEnd("ctx");
  34623. },
  34624. //>>excludeStart("ide", pragmas.excludeIdeData);
  34625. args: ["aVisitor"],
  34626. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  34627. referencedClasses: [],
  34628. //>>excludeEnd("ide");
  34629. messageSends: ["visitValueNode:"]
  34630. }),
  34631. globals.ValueNode);
  34632. smalltalk.addMethod(
  34633. smalltalk.method({
  34634. selector: "isImmutable",
  34635. protocol: 'testing',
  34636. fn: function (){
  34637. var self=this;
  34638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34639. return smalltalk.withContext(function($ctx1) {
  34640. //>>excludeEnd("ctx");
  34641. var $1;
  34642. $1=_st(self._value())._isImmutable();
  34643. return $1;
  34644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34645. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.ValueNode)});
  34646. //>>excludeEnd("ctx");
  34647. },
  34648. //>>excludeStart("ide", pragmas.excludeIdeData);
  34649. args: [],
  34650. source: "isImmutable\x0a\x09^ self value isImmutable",
  34651. referencedClasses: [],
  34652. //>>excludeEnd("ide");
  34653. messageSends: ["isImmutable", "value"]
  34654. }),
  34655. globals.ValueNode);
  34656. smalltalk.addMethod(
  34657. smalltalk.method({
  34658. selector: "isValueNode",
  34659. protocol: 'testing',
  34660. fn: function (){
  34661. var self=this;
  34662. return true;
  34663. },
  34664. //>>excludeStart("ide", pragmas.excludeIdeData);
  34665. args: [],
  34666. source: "isValueNode\x0a\x09^ true",
  34667. referencedClasses: [],
  34668. //>>excludeEnd("ide");
  34669. messageSends: []
  34670. }),
  34671. globals.ValueNode);
  34672. smalltalk.addMethod(
  34673. smalltalk.method({
  34674. selector: "value",
  34675. protocol: 'accessing',
  34676. fn: function (){
  34677. var self=this;
  34678. var $1;
  34679. $1=self["@value"];
  34680. return $1;
  34681. },
  34682. //>>excludeStart("ide", pragmas.excludeIdeData);
  34683. args: [],
  34684. source: "value\x0a\x09^ value",
  34685. referencedClasses: [],
  34686. //>>excludeEnd("ide");
  34687. messageSends: []
  34688. }),
  34689. globals.ValueNode);
  34690. smalltalk.addMethod(
  34691. smalltalk.method({
  34692. selector: "value:",
  34693. protocol: 'accessing',
  34694. fn: function (anObject){
  34695. var self=this;
  34696. self["@value"]=anObject;
  34697. return self;
  34698. },
  34699. //>>excludeStart("ide", pragmas.excludeIdeData);
  34700. args: ["anObject"],
  34701. source: "value: anObject\x0a\x09value := anObject",
  34702. referencedClasses: [],
  34703. //>>excludeEnd("ide");
  34704. messageSends: []
  34705. }),
  34706. globals.ValueNode);
  34707. smalltalk.addClass('VariableNode', globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  34708. //>>excludeStart("ide", pragmas.excludeIdeData);
  34709. globals.VariableNode.comment="I represent an variable node.";
  34710. //>>excludeEnd("ide");
  34711. smalltalk.addMethod(
  34712. smalltalk.method({
  34713. selector: "accept:",
  34714. protocol: 'visiting',
  34715. fn: function (aVisitor){
  34716. var self=this;
  34717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34718. return smalltalk.withContext(function($ctx1) {
  34719. //>>excludeEnd("ctx");
  34720. var $1;
  34721. $1=_st(aVisitor)._visitVariableNode_(self);
  34722. return $1;
  34723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34724. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.VariableNode)});
  34725. //>>excludeEnd("ctx");
  34726. },
  34727. //>>excludeStart("ide", pragmas.excludeIdeData);
  34728. args: ["aVisitor"],
  34729. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  34730. referencedClasses: [],
  34731. //>>excludeEnd("ide");
  34732. messageSends: ["visitVariableNode:"]
  34733. }),
  34734. globals.VariableNode);
  34735. smalltalk.addMethod(
  34736. smalltalk.method({
  34737. selector: "alias",
  34738. protocol: 'accessing',
  34739. fn: function (){
  34740. var self=this;
  34741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34742. return smalltalk.withContext(function($ctx1) {
  34743. //>>excludeEnd("ctx");
  34744. var $1;
  34745. $1=_st(self._binding())._alias();
  34746. return $1;
  34747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34748. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.VariableNode)});
  34749. //>>excludeEnd("ctx");
  34750. },
  34751. //>>excludeStart("ide", pragmas.excludeIdeData);
  34752. args: [],
  34753. source: "alias\x0a\x09^ self binding alias",
  34754. referencedClasses: [],
  34755. //>>excludeEnd("ide");
  34756. messageSends: ["alias", "binding"]
  34757. }),
  34758. globals.VariableNode);
  34759. smalltalk.addMethod(
  34760. smalltalk.method({
  34761. selector: "assigned",
  34762. protocol: 'accessing',
  34763. fn: function (){
  34764. var self=this;
  34765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34766. return smalltalk.withContext(function($ctx1) {
  34767. //>>excludeEnd("ctx");
  34768. var $2,$1,$receiver;
  34769. $2=self["@assigned"];
  34770. if(($receiver = $2) == null || $receiver.isNil){
  34771. $1=false;
  34772. } else {
  34773. $1=$2;
  34774. };
  34775. return $1;
  34776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34777. }, function($ctx1) {$ctx1.fill(self,"assigned",{},globals.VariableNode)});
  34778. //>>excludeEnd("ctx");
  34779. },
  34780. //>>excludeStart("ide", pragmas.excludeIdeData);
  34781. args: [],
  34782. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  34783. referencedClasses: [],
  34784. //>>excludeEnd("ide");
  34785. messageSends: ["ifNil:"]
  34786. }),
  34787. globals.VariableNode);
  34788. smalltalk.addMethod(
  34789. smalltalk.method({
  34790. selector: "assigned:",
  34791. protocol: 'accessing',
  34792. fn: function (aBoolean){
  34793. var self=this;
  34794. self["@assigned"]=aBoolean;
  34795. return self;
  34796. },
  34797. //>>excludeStart("ide", pragmas.excludeIdeData);
  34798. args: ["aBoolean"],
  34799. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  34800. referencedClasses: [],
  34801. //>>excludeEnd("ide");
  34802. messageSends: []
  34803. }),
  34804. globals.VariableNode);
  34805. smalltalk.addMethod(
  34806. smalltalk.method({
  34807. selector: "beAssigned",
  34808. protocol: 'accessing',
  34809. fn: function (){
  34810. var self=this;
  34811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34812. return smalltalk.withContext(function($ctx1) {
  34813. //>>excludeEnd("ctx");
  34814. _st(self._binding())._validateAssignment();
  34815. self["@assigned"]=true;
  34816. return self;
  34817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34818. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},globals.VariableNode)});
  34819. //>>excludeEnd("ctx");
  34820. },
  34821. //>>excludeStart("ide", pragmas.excludeIdeData);
  34822. args: [],
  34823. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  34824. referencedClasses: [],
  34825. //>>excludeEnd("ide");
  34826. messageSends: ["validateAssignment", "binding"]
  34827. }),
  34828. globals.VariableNode);
  34829. smalltalk.addMethod(
  34830. smalltalk.method({
  34831. selector: "binding",
  34832. protocol: 'accessing',
  34833. fn: function (){
  34834. var self=this;
  34835. var $1;
  34836. $1=self["@binding"];
  34837. return $1;
  34838. },
  34839. //>>excludeStart("ide", pragmas.excludeIdeData);
  34840. args: [],
  34841. source: "binding\x0a\x09^ binding",
  34842. referencedClasses: [],
  34843. //>>excludeEnd("ide");
  34844. messageSends: []
  34845. }),
  34846. globals.VariableNode);
  34847. smalltalk.addMethod(
  34848. smalltalk.method({
  34849. selector: "binding:",
  34850. protocol: 'accessing',
  34851. fn: function (aScopeVar){
  34852. var self=this;
  34853. self["@binding"]=aScopeVar;
  34854. return self;
  34855. },
  34856. //>>excludeStart("ide", pragmas.excludeIdeData);
  34857. args: ["aScopeVar"],
  34858. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  34859. referencedClasses: [],
  34860. //>>excludeEnd("ide");
  34861. messageSends: []
  34862. }),
  34863. globals.VariableNode);
  34864. smalltalk.addMethod(
  34865. smalltalk.method({
  34866. selector: "isArgument",
  34867. protocol: 'testing',
  34868. fn: function (){
  34869. var self=this;
  34870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34871. return smalltalk.withContext(function($ctx1) {
  34872. //>>excludeEnd("ctx");
  34873. var $1;
  34874. $1=_st(self._binding())._isArgVar();
  34875. return $1;
  34876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34877. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},globals.VariableNode)});
  34878. //>>excludeEnd("ctx");
  34879. },
  34880. //>>excludeStart("ide", pragmas.excludeIdeData);
  34881. args: [],
  34882. source: "isArgument\x0a\x09^ self binding isArgVar",
  34883. referencedClasses: [],
  34884. //>>excludeEnd("ide");
  34885. messageSends: ["isArgVar", "binding"]
  34886. }),
  34887. globals.VariableNode);
  34888. smalltalk.addMethod(
  34889. smalltalk.method({
  34890. selector: "isImmutable",
  34891. protocol: 'testing',
  34892. fn: function (){
  34893. var self=this;
  34894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34895. return smalltalk.withContext(function($ctx1) {
  34896. //>>excludeEnd("ctx");
  34897. var $1;
  34898. $1=_st(self._binding())._isImmutable();
  34899. return $1;
  34900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34901. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},globals.VariableNode)});
  34902. //>>excludeEnd("ctx");
  34903. },
  34904. //>>excludeStart("ide", pragmas.excludeIdeData);
  34905. args: [],
  34906. source: "isImmutable\x0a\x09^ self binding isImmutable",
  34907. referencedClasses: [],
  34908. //>>excludeEnd("ide");
  34909. messageSends: ["isImmutable", "binding"]
  34910. }),
  34911. globals.VariableNode);
  34912. smalltalk.addMethod(
  34913. smalltalk.method({
  34914. selector: "isNavigationNode",
  34915. protocol: 'testing',
  34916. fn: function (){
  34917. var self=this;
  34918. return true;
  34919. },
  34920. //>>excludeStart("ide", pragmas.excludeIdeData);
  34921. args: [],
  34922. source: "isNavigationNode\x0a\x09^ true",
  34923. referencedClasses: [],
  34924. //>>excludeEnd("ide");
  34925. messageSends: []
  34926. }),
  34927. globals.VariableNode);
  34928. smalltalk.addMethod(
  34929. smalltalk.method({
  34930. selector: "isVariableNode",
  34931. protocol: 'testing',
  34932. fn: function (){
  34933. var self=this;
  34934. return true;
  34935. },
  34936. //>>excludeStart("ide", pragmas.excludeIdeData);
  34937. args: [],
  34938. source: "isVariableNode\x0a\x09^ true",
  34939. referencedClasses: [],
  34940. //>>excludeEnd("ide");
  34941. messageSends: []
  34942. }),
  34943. globals.VariableNode);
  34944. smalltalk.addMethod(
  34945. smalltalk.method({
  34946. selector: "navigationLink",
  34947. protocol: 'accessing',
  34948. fn: function (){
  34949. var self=this;
  34950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34951. return smalltalk.withContext(function($ctx1) {
  34952. //>>excludeEnd("ctx");
  34953. var $1;
  34954. $1=self._value();
  34955. return $1;
  34956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34957. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},globals.VariableNode)});
  34958. //>>excludeEnd("ctx");
  34959. },
  34960. //>>excludeStart("ide", pragmas.excludeIdeData);
  34961. args: [],
  34962. source: "navigationLink\x0a\x09^ self value",
  34963. referencedClasses: [],
  34964. //>>excludeEnd("ide");
  34965. messageSends: ["value"]
  34966. }),
  34967. globals.VariableNode);
  34968. smalltalk.addMethod(
  34969. smalltalk.method({
  34970. selector: "ast",
  34971. protocol: '*Compiler-AST',
  34972. fn: function (){
  34973. var self=this;
  34974. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  34975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34976. return smalltalk.withContext(function($ctx1) {
  34977. //>>excludeEnd("ctx");
  34978. var $1,$2;
  34979. $1=self._source();
  34980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34981. $ctx1.sendIdx["source"]=1;
  34982. //>>excludeEnd("ctx");
  34983. _st($1)._ifEmpty_((function(){
  34984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34985. return smalltalk.withContext(function($ctx2) {
  34986. //>>excludeEnd("ctx");
  34987. return self._error_("Method source is empty");
  34988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34990. //>>excludeEnd("ctx");
  34991. }));
  34992. $2=_st($Smalltalk())._parse_(self._source());
  34993. return $2;
  34994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34995. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.CompiledMethod)});
  34996. //>>excludeEnd("ctx");
  34997. },
  34998. //>>excludeStart("ide", pragmas.excludeIdeData);
  34999. args: [],
  35000. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  35001. referencedClasses: ["Smalltalk"],
  35002. //>>excludeEnd("ide");
  35003. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  35004. }),
  35005. globals.CompiledMethod);
  35006. smalltalk.addMethod(
  35007. smalltalk.method({
  35008. selector: "isNode",
  35009. protocol: '*Compiler-AST',
  35010. fn: function (){
  35011. var self=this;
  35012. return false;
  35013. },
  35014. //>>excludeStart("ide", pragmas.excludeIdeData);
  35015. args: [],
  35016. source: "isNode\x0a\x09^ false",
  35017. referencedClasses: [],
  35018. //>>excludeEnd("ide");
  35019. messageSends: []
  35020. }),
  35021. globals.Object);
  35022. });
  35023. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){
  35024. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  35025. smalltalk.addPackage('Compiler-IR');
  35026. smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35027. smalltalk.addClass('IRASTTranslator', globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35028. //>>excludeStart("ide", pragmas.excludeIdeData);
  35029. globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35030. //>>excludeEnd("ide");
  35031. smalltalk.addMethod(
  35032. smalltalk.method({
  35033. selector: "alias:",
  35034. protocol: 'visiting',
  35035. fn: function (aNode){
  35036. var self=this;
  35037. var variable;
  35038. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35039. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  35040. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35042. return smalltalk.withContext(function($ctx1) {
  35043. //>>excludeEnd("ctx");
  35044. var $1,$2,$3,$4,$6,$5,$7,$8,$10,$11,$9,$12;
  35045. $1=_st(aNode)._isImmutable();
  35046. if(smalltalk.assert($1)){
  35047. $2=self._visit_(aNode);
  35048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35049. $ctx1.sendIdx["visit:"]=1;
  35050. //>>excludeEnd("ctx");
  35051. return $2;
  35052. };
  35053. $3=_st($IRVariable())._new();
  35054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35055. $ctx1.sendIdx["new"]=1;
  35056. //>>excludeEnd("ctx");
  35057. $4=$3;
  35058. $6=_st($AliasVar())._new();
  35059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35060. $ctx1.sendIdx["new"]=2;
  35061. //>>excludeEnd("ctx");
  35062. $5=_st($6)._name_("$".__comma(self._nextAlias()));
  35063. _st($4)._variable_($5);
  35064. $7=_st($3)._yourself();
  35065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35066. $ctx1.sendIdx["yourself"]=1;
  35067. //>>excludeEnd("ctx");
  35068. variable=$7;
  35069. $8=self._sequence();
  35070. $10=_st($IRAssignment())._new();
  35071. _st($10)._add_(variable);
  35072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35073. $ctx1.sendIdx["add:"]=2;
  35074. //>>excludeEnd("ctx");
  35075. _st($10)._add_(self._visit_(aNode));
  35076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35077. $ctx1.sendIdx["add:"]=3;
  35078. //>>excludeEnd("ctx");
  35079. $11=_st($10)._yourself();
  35080. $9=$11;
  35081. _st($8)._add_($9);
  35082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35083. $ctx1.sendIdx["add:"]=1;
  35084. //>>excludeEnd("ctx");
  35085. _st(_st(self._method())._internalVariables())._add_(variable);
  35086. $12=variable;
  35087. return $12;
  35088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35089. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},globals.IRASTTranslator)});
  35090. //>>excludeEnd("ctx");
  35091. },
  35092. //>>excludeStart("ide", pragmas.excludeIdeData);
  35093. args: ["aNode"],
  35094. 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",
  35095. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35096. //>>excludeEnd("ide");
  35097. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35098. }),
  35099. globals.IRASTTranslator);
  35100. smalltalk.addMethod(
  35101. smalltalk.method({
  35102. selector: "aliasTemporally:",
  35103. protocol: 'visiting',
  35104. fn: function (aCollection){
  35105. var self=this;
  35106. var threshold,result;
  35107. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  35108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35109. return smalltalk.withContext(function($ctx1) {
  35110. //>>excludeEnd("ctx");
  35111. var $1,$2,$4,$3,$5;
  35112. threshold=(0);
  35113. _st(aCollection)._withIndexDo_((function(each,i){
  35114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35115. return smalltalk.withContext(function($ctx2) {
  35116. //>>excludeEnd("ctx");
  35117. $1=_st(each)._subtreeNeedsAliasing();
  35118. if(smalltalk.assert($1)){
  35119. threshold=i;
  35120. return threshold;
  35121. };
  35122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35123. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35124. //>>excludeEnd("ctx");
  35125. }));
  35126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35127. $ctx1.sendIdx["withIndexDo:"]=1;
  35128. //>>excludeEnd("ctx");
  35129. result=_st($OrderedCollection())._new();
  35130. _st(aCollection)._withIndexDo_((function(each,i){
  35131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35132. return smalltalk.withContext(function($ctx2) {
  35133. //>>excludeEnd("ctx");
  35134. $2=result;
  35135. $4=_st(i).__lt_eq(threshold);
  35136. if(smalltalk.assert($4)){
  35137. $3=self._alias_(each);
  35138. } else {
  35139. $3=self._visit_(each);
  35140. };
  35141. return _st($2)._add_($3);
  35142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35143. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35144. //>>excludeEnd("ctx");
  35145. }));
  35146. $5=result;
  35147. return $5;
  35148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35149. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},globals.IRASTTranslator)});
  35150. //>>excludeEnd("ctx");
  35151. },
  35152. //>>excludeStart("ide", pragmas.excludeIdeData);
  35153. args: ["aCollection"],
  35154. 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",
  35155. referencedClasses: ["OrderedCollection"],
  35156. //>>excludeEnd("ide");
  35157. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35158. }),
  35159. globals.IRASTTranslator);
  35160. smalltalk.addMethod(
  35161. smalltalk.method({
  35162. selector: "method",
  35163. protocol: 'accessing',
  35164. fn: function (){
  35165. var self=this;
  35166. var $1;
  35167. $1=self["@method"];
  35168. return $1;
  35169. },
  35170. //>>excludeStart("ide", pragmas.excludeIdeData);
  35171. args: [],
  35172. source: "method\x0a\x09^ method",
  35173. referencedClasses: [],
  35174. //>>excludeEnd("ide");
  35175. messageSends: []
  35176. }),
  35177. globals.IRASTTranslator);
  35178. smalltalk.addMethod(
  35179. smalltalk.method({
  35180. selector: "method:",
  35181. protocol: 'accessing',
  35182. fn: function (anIRMethod){
  35183. var self=this;
  35184. self["@method"]=anIRMethod;
  35185. return self;
  35186. },
  35187. //>>excludeStart("ide", pragmas.excludeIdeData);
  35188. args: ["anIRMethod"],
  35189. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35190. referencedClasses: [],
  35191. //>>excludeEnd("ide");
  35192. messageSends: []
  35193. }),
  35194. globals.IRASTTranslator);
  35195. smalltalk.addMethod(
  35196. smalltalk.method({
  35197. selector: "nextAlias",
  35198. protocol: 'accessing',
  35199. fn: function (){
  35200. var self=this;
  35201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35202. return smalltalk.withContext(function($ctx1) {
  35203. //>>excludeEnd("ctx");
  35204. var $1,$2,$receiver;
  35205. $1=self["@nextAlias"];
  35206. if(($receiver = $1) == null || $receiver.isNil){
  35207. self["@nextAlias"]=(0);
  35208. self["@nextAlias"];
  35209. } else {
  35210. $1;
  35211. };
  35212. self["@nextAlias"]=_st(self["@nextAlias"]).__plus((1));
  35213. $2=_st(self["@nextAlias"])._asString();
  35214. return $2;
  35215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35216. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},globals.IRASTTranslator)});
  35217. //>>excludeEnd("ctx");
  35218. },
  35219. //>>excludeStart("ide", pragmas.excludeIdeData);
  35220. args: [],
  35221. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35222. referencedClasses: [],
  35223. //>>excludeEnd("ide");
  35224. messageSends: ["ifNil:", "+", "asString"]
  35225. }),
  35226. globals.IRASTTranslator);
  35227. smalltalk.addMethod(
  35228. smalltalk.method({
  35229. selector: "sequence",
  35230. protocol: 'accessing',
  35231. fn: function (){
  35232. var self=this;
  35233. var $1;
  35234. $1=self["@sequence"];
  35235. return $1;
  35236. },
  35237. //>>excludeStart("ide", pragmas.excludeIdeData);
  35238. args: [],
  35239. source: "sequence\x0a\x09^ sequence",
  35240. referencedClasses: [],
  35241. //>>excludeEnd("ide");
  35242. messageSends: []
  35243. }),
  35244. globals.IRASTTranslator);
  35245. smalltalk.addMethod(
  35246. smalltalk.method({
  35247. selector: "sequence:",
  35248. protocol: 'accessing',
  35249. fn: function (anIRSequence){
  35250. var self=this;
  35251. self["@sequence"]=anIRSequence;
  35252. return self;
  35253. },
  35254. //>>excludeStart("ide", pragmas.excludeIdeData);
  35255. args: ["anIRSequence"],
  35256. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35257. referencedClasses: [],
  35258. //>>excludeEnd("ide");
  35259. messageSends: []
  35260. }),
  35261. globals.IRASTTranslator);
  35262. smalltalk.addMethod(
  35263. smalltalk.method({
  35264. selector: "source",
  35265. protocol: 'accessing',
  35266. fn: function (){
  35267. var self=this;
  35268. var $1;
  35269. $1=self["@source"];
  35270. return $1;
  35271. },
  35272. //>>excludeStart("ide", pragmas.excludeIdeData);
  35273. args: [],
  35274. source: "source\x0a\x09^ source",
  35275. referencedClasses: [],
  35276. //>>excludeEnd("ide");
  35277. messageSends: []
  35278. }),
  35279. globals.IRASTTranslator);
  35280. smalltalk.addMethod(
  35281. smalltalk.method({
  35282. selector: "source:",
  35283. protocol: 'accessing',
  35284. fn: function (aString){
  35285. var self=this;
  35286. self["@source"]=aString;
  35287. return self;
  35288. },
  35289. //>>excludeStart("ide", pragmas.excludeIdeData);
  35290. args: ["aString"],
  35291. source: "source: aString\x0a\x09source := aString",
  35292. referencedClasses: [],
  35293. //>>excludeEnd("ide");
  35294. messageSends: []
  35295. }),
  35296. globals.IRASTTranslator);
  35297. smalltalk.addMethod(
  35298. smalltalk.method({
  35299. selector: "theClass",
  35300. protocol: 'accessing',
  35301. fn: function (){
  35302. var self=this;
  35303. var $1;
  35304. $1=self["@theClass"];
  35305. return $1;
  35306. },
  35307. //>>excludeStart("ide", pragmas.excludeIdeData);
  35308. args: [],
  35309. source: "theClass\x0a\x09^ theClass",
  35310. referencedClasses: [],
  35311. //>>excludeEnd("ide");
  35312. messageSends: []
  35313. }),
  35314. globals.IRASTTranslator);
  35315. smalltalk.addMethod(
  35316. smalltalk.method({
  35317. selector: "theClass:",
  35318. protocol: 'accessing',
  35319. fn: function (aClass){
  35320. var self=this;
  35321. self["@theClass"]=aClass;
  35322. return self;
  35323. },
  35324. //>>excludeStart("ide", pragmas.excludeIdeData);
  35325. args: ["aClass"],
  35326. source: "theClass: aClass\x0a\x09theClass := aClass",
  35327. referencedClasses: [],
  35328. //>>excludeEnd("ide");
  35329. messageSends: []
  35330. }),
  35331. globals.IRASTTranslator);
  35332. smalltalk.addMethod(
  35333. smalltalk.method({
  35334. selector: "visitAssignmentNode:",
  35335. protocol: 'visiting',
  35336. fn: function (aNode){
  35337. var self=this;
  35338. var left,right,assignment;
  35339. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  35340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35341. return smalltalk.withContext(function($ctx1) {
  35342. //>>excludeEnd("ctx");
  35343. var $1,$3,$4,$2,$5;
  35344. right=self._visit_(_st(aNode)._right());
  35345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35346. $ctx1.sendIdx["visit:"]=1;
  35347. //>>excludeEnd("ctx");
  35348. left=self._visit_(_st(aNode)._left());
  35349. $1=self._sequence();
  35350. $3=_st($IRAssignment())._new();
  35351. _st($3)._add_(left);
  35352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35353. $ctx1.sendIdx["add:"]=2;
  35354. //>>excludeEnd("ctx");
  35355. _st($3)._add_(right);
  35356. $4=_st($3)._yourself();
  35357. $2=$4;
  35358. _st($1)._add_($2);
  35359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35360. $ctx1.sendIdx["add:"]=1;
  35361. //>>excludeEnd("ctx");
  35362. $5=left;
  35363. return $5;
  35364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35365. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},globals.IRASTTranslator)});
  35366. //>>excludeEnd("ctx");
  35367. },
  35368. //>>excludeStart("ide", pragmas.excludeIdeData);
  35369. args: ["aNode"],
  35370. 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",
  35371. referencedClasses: ["IRAssignment"],
  35372. //>>excludeEnd("ide");
  35373. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35374. }),
  35375. globals.IRASTTranslator);
  35376. smalltalk.addMethod(
  35377. smalltalk.method({
  35378. selector: "visitBlockNode:",
  35379. protocol: 'visiting',
  35380. fn: function (aNode){
  35381. var self=this;
  35382. var closure;
  35383. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  35384. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  35385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35386. return smalltalk.withContext(function($ctx1) {
  35387. //>>excludeEnd("ctx");
  35388. var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  35389. $1=_st($IRClosure())._new();
  35390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35391. $ctx1.sendIdx["new"]=1;
  35392. //>>excludeEnd("ctx");
  35393. _st($1)._arguments_(_st(aNode)._parameters());
  35394. _st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  35395. $2=$1;
  35396. $3=_st(aNode)._scope();
  35397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35398. $ctx1.sendIdx["scope"]=1;
  35399. //>>excludeEnd("ctx");
  35400. _st($2)._scope_($3);
  35401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35402. $ctx1.sendIdx["scope:"]=1;
  35403. //>>excludeEnd("ctx");
  35404. $4=_st($1)._yourself();
  35405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35406. $ctx1.sendIdx["yourself"]=1;
  35407. //>>excludeEnd("ctx");
  35408. closure=$4;
  35409. $6=_st(aNode)._scope();
  35410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35411. $ctx1.sendIdx["scope"]=2;
  35412. //>>excludeEnd("ctx");
  35413. $5=_st($6)._temps();
  35414. _st($5)._do_((function(each){
  35415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35416. return smalltalk.withContext(function($ctx2) {
  35417. //>>excludeEnd("ctx");
  35418. $7=_st($IRTempDeclaration())._new();
  35419. _st($7)._name_(_st(each)._name());
  35420. _st($7)._scope_(_st(aNode)._scope());
  35421. $8=_st($7)._yourself();
  35422. return _st(closure)._add_($8);
  35423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35424. $ctx2.sendIdx["add:"]=1;
  35425. //>>excludeEnd("ctx");
  35426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35428. //>>excludeEnd("ctx");
  35429. }));
  35430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35431. $ctx1.sendIdx["do:"]=1;
  35432. //>>excludeEnd("ctx");
  35433. _st(_st(aNode)._nodes())._do_((function(each){
  35434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35435. return smalltalk.withContext(function($ctx2) {
  35436. //>>excludeEnd("ctx");
  35437. return _st(closure)._add_(self._visit_(each));
  35438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35440. //>>excludeEnd("ctx");
  35441. }));
  35442. $9=closure;
  35443. return $9;
  35444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35445. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)});
  35446. //>>excludeEnd("ctx");
  35447. },
  35448. //>>excludeStart("ide", pragmas.excludeIdeData);
  35449. args: ["aNode"],
  35450. 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",
  35451. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35452. //>>excludeEnd("ide");
  35453. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35454. }),
  35455. globals.IRASTTranslator);
  35456. smalltalk.addMethod(
  35457. smalltalk.method({
  35458. selector: "visitBlockSequenceNode:",
  35459. protocol: 'visiting',
  35460. fn: function (aNode){
  35461. var self=this;
  35462. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  35463. function $IRBlockReturn(){return globals.IRBlockReturn||(typeof IRBlockReturn=="undefined"?nil:IRBlockReturn)}
  35464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35465. return smalltalk.withContext(function($ctx1) {
  35466. //>>excludeEnd("ctx");
  35467. var $2,$3,$5,$4,$6,$7,$10,$9,$8,$11,$13,$14,$17,$16,$15,$18,$12,$1;
  35468. $2=_st($IRBlockSequence())._new();
  35469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35470. $ctx1.sendIdx["new"]=1;
  35471. //>>excludeEnd("ctx");
  35472. $1=self._withSequence_do_($2,(function(){
  35473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35474. return smalltalk.withContext(function($ctx2) {
  35475. //>>excludeEnd("ctx");
  35476. $3=_st(aNode)._nodes();
  35477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35478. $ctx2.sendIdx["nodes"]=1;
  35479. //>>excludeEnd("ctx");
  35480. return _st($3)._ifNotEmpty_((function(){
  35481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35482. return smalltalk.withContext(function($ctx3) {
  35483. //>>excludeEnd("ctx");
  35484. $5=_st(aNode)._nodes();
  35485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35486. $ctx3.sendIdx["nodes"]=2;
  35487. //>>excludeEnd("ctx");
  35488. $4=_st($5)._allButLast();
  35489. _st($4)._do_((function(each){
  35490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35491. return smalltalk.withContext(function($ctx4) {
  35492. //>>excludeEnd("ctx");
  35493. $6=self._sequence();
  35494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35495. $ctx4.sendIdx["sequence"]=1;
  35496. //>>excludeEnd("ctx");
  35497. $7=self._visitOrAlias_(each);
  35498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35499. $ctx4.sendIdx["visitOrAlias:"]=1;
  35500. //>>excludeEnd("ctx");
  35501. return _st($6)._add_($7);
  35502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35503. $ctx4.sendIdx["add:"]=1;
  35504. //>>excludeEnd("ctx");
  35505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35506. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35507. //>>excludeEnd("ctx");
  35508. }));
  35509. $10=_st(aNode)._nodes();
  35510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35511. $ctx3.sendIdx["nodes"]=3;
  35512. //>>excludeEnd("ctx");
  35513. $9=_st($10)._last();
  35514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35515. $ctx3.sendIdx["last"]=1;
  35516. //>>excludeEnd("ctx");
  35517. $8=_st($9)._isReturnNode();
  35518. if(smalltalk.assert($8)){
  35519. return _st(self._sequence())._add_(self._visitOrAlias_(_st(_st(aNode)._nodes())._last()));
  35520. } else {
  35521. $11=self._sequence();
  35522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35523. $ctx3.sendIdx["sequence"]=2;
  35524. //>>excludeEnd("ctx");
  35525. $13=_st($IRBlockReturn())._new();
  35526. $14=$13;
  35527. $17=_st(aNode)._nodes();
  35528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35529. $ctx3.sendIdx["nodes"]=4;
  35530. //>>excludeEnd("ctx");
  35531. $16=_st($17)._last();
  35532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35533. $ctx3.sendIdx["last"]=2;
  35534. //>>excludeEnd("ctx");
  35535. $15=self._visitOrAlias_($16);
  35536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35537. $ctx3.sendIdx["visitOrAlias:"]=2;
  35538. //>>excludeEnd("ctx");
  35539. _st($14)._add_($15);
  35540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35541. $ctx3.sendIdx["add:"]=3;
  35542. //>>excludeEnd("ctx");
  35543. $18=_st($13)._yourself();
  35544. $12=$18;
  35545. return _st($11)._add_($12);
  35546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35547. $ctx3.sendIdx["add:"]=2;
  35548. //>>excludeEnd("ctx");
  35549. };
  35550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35551. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35552. //>>excludeEnd("ctx");
  35553. }));
  35554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35556. //>>excludeEnd("ctx");
  35557. }));
  35558. return $1;
  35559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35560. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  35561. //>>excludeEnd("ctx");
  35562. },
  35563. //>>excludeStart("ide", pragmas.excludeIdeData);
  35564. args: ["aNode"],
  35565. 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) ] ]]",
  35566. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35567. //>>excludeEnd("ide");
  35568. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35569. }),
  35570. globals.IRASTTranslator);
  35571. smalltalk.addMethod(
  35572. smalltalk.method({
  35573. selector: "visitCascadeNode:",
  35574. protocol: 'visiting',
  35575. fn: function (aNode){
  35576. var self=this;
  35577. var alias,receiver;
  35578. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  35579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35580. return smalltalk.withContext(function($ctx1) {
  35581. //>>excludeEnd("ctx");
  35582. var $2,$1,$3,$5,$4,$6;
  35583. $2=_st(aNode)._receiver();
  35584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35585. $ctx1.sendIdx["receiver"]=1;
  35586. //>>excludeEnd("ctx");
  35587. $1=_st($2)._isImmutable();
  35588. if(smalltalk.assert($1)){
  35589. receiver=_st(aNode)._receiver();
  35590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35591. $ctx1.sendIdx["receiver"]=2;
  35592. //>>excludeEnd("ctx");
  35593. receiver;
  35594. } else {
  35595. alias=self._alias_(_st(aNode)._receiver());
  35596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35597. $ctx1.sendIdx["alias:"]=1;
  35598. //>>excludeEnd("ctx");
  35599. alias;
  35600. receiver=_st(_st($VariableNode())._new())._binding_(_st(alias)._variable());
  35601. receiver;
  35602. };
  35603. $3=_st(aNode)._nodes();
  35604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35605. $ctx1.sendIdx["nodes"]=1;
  35606. //>>excludeEnd("ctx");
  35607. _st($3)._do_((function(each){
  35608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35609. return smalltalk.withContext(function($ctx2) {
  35610. //>>excludeEnd("ctx");
  35611. return _st(each)._receiver_(receiver);
  35612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35614. //>>excludeEnd("ctx");
  35615. }));
  35616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35617. $ctx1.sendIdx["do:"]=1;
  35618. //>>excludeEnd("ctx");
  35619. $5=_st(aNode)._nodes();
  35620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35621. $ctx1.sendIdx["nodes"]=2;
  35622. //>>excludeEnd("ctx");
  35623. $4=_st($5)._allButLast();
  35624. _st($4)._do_((function(each){
  35625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35626. return smalltalk.withContext(function($ctx2) {
  35627. //>>excludeEnd("ctx");
  35628. return _st(self._sequence())._add_(self._visit_(each));
  35629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35631. //>>excludeEnd("ctx");
  35632. }));
  35633. $6=self._alias_(_st(_st(aNode)._nodes())._last());
  35634. return $6;
  35635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35636. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,alias:alias,receiver:receiver},globals.IRASTTranslator)});
  35637. //>>excludeEnd("ctx");
  35638. },
  35639. //>>excludeStart("ide", pragmas.excludeIdeData);
  35640. args: ["aNode"],
  35641. 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",
  35642. referencedClasses: ["VariableNode"],
  35643. //>>excludeEnd("ide");
  35644. messageSends: ["ifTrue:ifFalse:", "isImmutable", "receiver", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "last"]
  35645. }),
  35646. globals.IRASTTranslator);
  35647. smalltalk.addMethod(
  35648. smalltalk.method({
  35649. selector: "visitDynamicArrayNode:",
  35650. protocol: 'visiting',
  35651. fn: function (aNode){
  35652. var self=this;
  35653. var array;
  35654. function $IRDynamicArray(){return globals.IRDynamicArray||(typeof IRDynamicArray=="undefined"?nil:IRDynamicArray)}
  35655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35656. return smalltalk.withContext(function($ctx1) {
  35657. //>>excludeEnd("ctx");
  35658. var $1;
  35659. array=_st($IRDynamicArray())._new();
  35660. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  35661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35662. return smalltalk.withContext(function($ctx2) {
  35663. //>>excludeEnd("ctx");
  35664. return _st(array)._add_(each);
  35665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35667. //>>excludeEnd("ctx");
  35668. }));
  35669. $1=array;
  35670. return $1;
  35671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35672. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.IRASTTranslator)});
  35673. //>>excludeEnd("ctx");
  35674. },
  35675. //>>excludeStart("ide", pragmas.excludeIdeData);
  35676. args: ["aNode"],
  35677. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35678. referencedClasses: ["IRDynamicArray"],
  35679. //>>excludeEnd("ide");
  35680. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35681. }),
  35682. globals.IRASTTranslator);
  35683. smalltalk.addMethod(
  35684. smalltalk.method({
  35685. selector: "visitDynamicDictionaryNode:",
  35686. protocol: 'visiting',
  35687. fn: function (aNode){
  35688. var self=this;
  35689. var dictionary;
  35690. function $IRDynamicDictionary(){return globals.IRDynamicDictionary||(typeof IRDynamicDictionary=="undefined"?nil:IRDynamicDictionary)}
  35691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35692. return smalltalk.withContext(function($ctx1) {
  35693. //>>excludeEnd("ctx");
  35694. var $1;
  35695. dictionary=_st($IRDynamicDictionary())._new();
  35696. _st(self._aliasTemporally_(_st(aNode)._nodes()))._do_((function(each){
  35697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35698. return smalltalk.withContext(function($ctx2) {
  35699. //>>excludeEnd("ctx");
  35700. return _st(dictionary)._add_(each);
  35701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35703. //>>excludeEnd("ctx");
  35704. }));
  35705. $1=dictionary;
  35706. return $1;
  35707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35708. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},globals.IRASTTranslator)});
  35709. //>>excludeEnd("ctx");
  35710. },
  35711. //>>excludeStart("ide", pragmas.excludeIdeData);
  35712. args: ["aNode"],
  35713. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35714. referencedClasses: ["IRDynamicDictionary"],
  35715. //>>excludeEnd("ide");
  35716. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35717. }),
  35718. globals.IRASTTranslator);
  35719. smalltalk.addMethod(
  35720. smalltalk.method({
  35721. selector: "visitJSStatementNode:",
  35722. protocol: 'visiting',
  35723. fn: function (aNode){
  35724. var self=this;
  35725. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35727. return smalltalk.withContext(function($ctx1) {
  35728. //>>excludeEnd("ctx");
  35729. var $2,$3,$1;
  35730. $2=_st($IRVerbatim())._new();
  35731. _st($2)._source_(_st(_st(aNode)._source())._crlfSanitized());
  35732. $3=_st($2)._yourself();
  35733. $1=$3;
  35734. return $1;
  35735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35736. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.IRASTTranslator)});
  35737. //>>excludeEnd("ctx");
  35738. },
  35739. //>>excludeStart("ide", pragmas.excludeIdeData);
  35740. args: ["aNode"],
  35741. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35742. referencedClasses: ["IRVerbatim"],
  35743. //>>excludeEnd("ide");
  35744. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35745. }),
  35746. globals.IRASTTranslator);
  35747. smalltalk.addMethod(
  35748. smalltalk.method({
  35749. selector: "visitMethodNode:",
  35750. protocol: 'visiting',
  35751. fn: function (aNode){
  35752. var self=this;
  35753. function $IRMethod(){return globals.IRMethod||(typeof IRMethod=="undefined"?nil:IRMethod)}
  35754. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  35755. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35756. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  35757. function $IRVerbatim(){return globals.IRVerbatim||(typeof IRVerbatim=="undefined"?nil:IRVerbatim)}
  35758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35759. return smalltalk.withContext(function($ctx1) {
  35760. //>>excludeEnd("ctx");
  35761. var $2,$3,$4,$5,$1,$7,$6,$8,$10,$11,$12,$13,$9,$14,$16,$15,$17,$18,$20,$21,$23,$24,$22,$25,$19,$27,$28,$26,$29;
  35762. $2=_st($IRMethod())._new();
  35763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35764. $ctx1.sendIdx["new"]=1;
  35765. //>>excludeEnd("ctx");
  35766. _st($2)._source_(_st(self._source())._crlfSanitized());
  35767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35768. $ctx1.sendIdx["source:"]=1;
  35769. //>>excludeEnd("ctx");
  35770. _st($2)._theClass_(self._theClass());
  35771. _st($2)._arguments_(_st(aNode)._arguments());
  35772. _st($2)._selector_(_st(aNode)._selector());
  35773. _st($2)._sendIndexes_(_st(aNode)._sendIndexes());
  35774. _st($2)._superSends_(_st(aNode)._superSends());
  35775. _st($2)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
  35776. _st($2)._classReferences_(_st(aNode)._classReferences());
  35777. $3=$2;
  35778. $4=_st(aNode)._scope();
  35779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35780. $ctx1.sendIdx["scope"]=1;
  35781. //>>excludeEnd("ctx");
  35782. _st($3)._scope_($4);
  35783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35784. $ctx1.sendIdx["scope:"]=1;
  35785. //>>excludeEnd("ctx");
  35786. $5=_st($2)._yourself();
  35787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35788. $ctx1.sendIdx["yourself"]=1;
  35789. //>>excludeEnd("ctx");
  35790. $1=$5;
  35791. self._method_($1);
  35792. $7=_st(aNode)._scope();
  35793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35794. $ctx1.sendIdx["scope"]=2;
  35795. //>>excludeEnd("ctx");
  35796. $6=_st($7)._temps();
  35797. _st($6)._do_((function(each){
  35798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35799. return smalltalk.withContext(function($ctx2) {
  35800. //>>excludeEnd("ctx");
  35801. $8=self._method();
  35802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35803. $ctx2.sendIdx["method"]=1;
  35804. //>>excludeEnd("ctx");
  35805. $10=_st($IRTempDeclaration())._new();
  35806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35807. $ctx2.sendIdx["new"]=2;
  35808. //>>excludeEnd("ctx");
  35809. _st($10)._name_(_st(each)._name());
  35810. $11=$10;
  35811. $12=_st(aNode)._scope();
  35812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35813. $ctx2.sendIdx["scope"]=3;
  35814. //>>excludeEnd("ctx");
  35815. _st($11)._scope_($12);
  35816. $13=_st($10)._yourself();
  35817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35818. $ctx2.sendIdx["yourself"]=2;
  35819. //>>excludeEnd("ctx");
  35820. $9=$13;
  35821. return _st($8)._add_($9);
  35822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35823. $ctx2.sendIdx["add:"]=1;
  35824. //>>excludeEnd("ctx");
  35825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35827. //>>excludeEnd("ctx");
  35828. }));
  35829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35830. $ctx1.sendIdx["do:"]=1;
  35831. //>>excludeEnd("ctx");
  35832. _st(_st(aNode)._nodes())._do_((function(each){
  35833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35834. return smalltalk.withContext(function($ctx2) {
  35835. //>>excludeEnd("ctx");
  35836. $14=self._method();
  35837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35838. $ctx2.sendIdx["method"]=2;
  35839. //>>excludeEnd("ctx");
  35840. return _st($14)._add_(self._visit_(each));
  35841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35842. $ctx2.sendIdx["add:"]=2;
  35843. //>>excludeEnd("ctx");
  35844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35846. //>>excludeEnd("ctx");
  35847. }));
  35848. $16=_st(aNode)._scope();
  35849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35850. $ctx1.sendIdx["scope"]=4;
  35851. //>>excludeEnd("ctx");
  35852. $15=_st($16)._hasLocalReturn();
  35853. if(! smalltalk.assert($15)){
  35854. $17=self._method();
  35855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35856. $ctx1.sendIdx["method"]=3;
  35857. //>>excludeEnd("ctx");
  35858. $18=$17;
  35859. $20=_st($IRReturn())._new();
  35860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35861. $ctx1.sendIdx["new"]=3;
  35862. //>>excludeEnd("ctx");
  35863. $21=$20;
  35864. $23=_st($IRVariable())._new();
  35865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35866. $ctx1.sendIdx["new"]=4;
  35867. //>>excludeEnd("ctx");
  35868. _st($23)._variable_(_st(_st(_st(aNode)._scope())._pseudoVars())._at_("self"));
  35869. $24=_st($23)._yourself();
  35870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35871. $ctx1.sendIdx["yourself"]=3;
  35872. //>>excludeEnd("ctx");
  35873. $22=$24;
  35874. _st($21)._add_($22);
  35875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35876. $ctx1.sendIdx["add:"]=4;
  35877. //>>excludeEnd("ctx");
  35878. $25=_st($20)._yourself();
  35879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35880. $ctx1.sendIdx["yourself"]=4;
  35881. //>>excludeEnd("ctx");
  35882. $19=$25;
  35883. _st($18)._add_($19);
  35884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35885. $ctx1.sendIdx["add:"]=3;
  35886. //>>excludeEnd("ctx");
  35887. $27=_st($IRVerbatim())._new();
  35888. _st($27)._source_("");
  35889. $28=_st($27)._yourself();
  35890. $26=_st($17)._add_($28);
  35891. $26;
  35892. };
  35893. $29=self._method();
  35894. return $29;
  35895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35896. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.IRASTTranslator)});
  35897. //>>excludeEnd("ctx");
  35898. },
  35899. //>>excludeStart("ide", pragmas.excludeIdeData);
  35900. args: ["aNode"],
  35901. 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: [self method\x0a\x09\x09add: (IRReturn new\x0a\x09\x09\x09add: (IRVariable new\x0a\x09\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself);\x0a\x09\x09add: (IRVerbatim new source: ''; yourself) ].\x0a\x0a\x09^ self method",
  35902. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35903. //>>excludeEnd("ide");
  35904. 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"]
  35905. }),
  35906. globals.IRASTTranslator);
  35907. smalltalk.addMethod(
  35908. smalltalk.method({
  35909. selector: "visitOrAlias:",
  35910. protocol: 'visiting',
  35911. fn: function (aNode){
  35912. var self=this;
  35913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35914. return smalltalk.withContext(function($ctx1) {
  35915. //>>excludeEnd("ctx");
  35916. var $2,$1;
  35917. $2=_st(aNode)._shouldBeAliased();
  35918. if(smalltalk.assert($2)){
  35919. $1=self._alias_(aNode);
  35920. } else {
  35921. $1=self._visit_(aNode);
  35922. };
  35923. return $1;
  35924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35925. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},globals.IRASTTranslator)});
  35926. //>>excludeEnd("ctx");
  35927. },
  35928. //>>excludeStart("ide", pragmas.excludeIdeData);
  35929. args: ["aNode"],
  35930. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35931. referencedClasses: [],
  35932. //>>excludeEnd("ide");
  35933. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35934. }),
  35935. globals.IRASTTranslator);
  35936. smalltalk.addMethod(
  35937. smalltalk.method({
  35938. selector: "visitReturnNode:",
  35939. protocol: 'visiting',
  35940. fn: function (aNode){
  35941. var self=this;
  35942. var return_;
  35943. function $IRNonLocalReturn(){return globals.IRNonLocalReturn||(typeof IRNonLocalReturn=="undefined"?nil:IRNonLocalReturn)}
  35944. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  35945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35946. return smalltalk.withContext(function($ctx1) {
  35947. //>>excludeEnd("ctx");
  35948. var $1,$2;
  35949. $1=_st(aNode)._nonLocalReturn();
  35950. if(smalltalk.assert($1)){
  35951. return_=_st($IRNonLocalReturn())._new();
  35952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35953. $ctx1.sendIdx["new"]=1;
  35954. //>>excludeEnd("ctx");
  35955. } else {
  35956. return_=_st($IRReturn())._new();
  35957. };
  35958. _st(return_)._scope_(_st(aNode)._scope());
  35959. _st(_st(aNode)._nodes())._do_((function(each){
  35960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35961. return smalltalk.withContext(function($ctx2) {
  35962. //>>excludeEnd("ctx");
  35963. return _st(return_)._add_(self._alias_(each));
  35964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35966. //>>excludeEnd("ctx");
  35967. }));
  35968. $2=return_;
  35969. return $2;
  35970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35971. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},globals.IRASTTranslator)});
  35972. //>>excludeEnd("ctx");
  35973. },
  35974. //>>excludeStart("ide", pragmas.excludeIdeData);
  35975. args: ["aNode"],
  35976. 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",
  35977. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35978. //>>excludeEnd("ide");
  35979. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "alias:"]
  35980. }),
  35981. globals.IRASTTranslator);
  35982. smalltalk.addMethod(
  35983. smalltalk.method({
  35984. selector: "visitSendNode:",
  35985. protocol: 'visiting',
  35986. fn: function (aNode){
  35987. var self=this;
  35988. var send,all,receiver,arguments;
  35989. function $IRSend(){return globals.IRSend||(typeof IRSend=="undefined"?nil:IRSend)}
  35990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35991. return smalltalk.withContext(function($ctx1) {
  35992. //>>excludeEnd("ctx");
  35993. var $1,$2,$3,$4;
  35994. send=_st($IRSend())._new();
  35995. $1=send;
  35996. _st($1)._selector_(_st(aNode)._selector());
  35997. $2=_st($1)._index_(_st(aNode)._index());
  35998. $3=_st(aNode)._superSend();
  35999. if(smalltalk.assert($3)){
  36000. _st(send)._classSend_(_st(self._theClass())._superclass());
  36001. };
  36002. all=self._aliasTemporally_(_st([_st(aNode)._receiver()]).__comma(_st(aNode)._arguments()));
  36003. receiver=_st(all)._first();
  36004. arguments=_st(all)._allButFirst();
  36005. _st(send)._add_(receiver);
  36006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36007. $ctx1.sendIdx["add:"]=1;
  36008. //>>excludeEnd("ctx");
  36009. _st(arguments)._do_((function(each){
  36010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36011. return smalltalk.withContext(function($ctx2) {
  36012. //>>excludeEnd("ctx");
  36013. return _st(send)._add_(each);
  36014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  36016. //>>excludeEnd("ctx");
  36017. }));
  36018. $4=send;
  36019. return $4;
  36020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36021. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send,all:all,receiver:receiver,arguments:arguments},globals.IRASTTranslator)});
  36022. //>>excludeEnd("ctx");
  36023. },
  36024. //>>excludeStart("ide", pragmas.excludeIdeData);
  36025. args: ["aNode"],
  36026. 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",
  36027. referencedClasses: ["IRSend"],
  36028. //>>excludeEnd("ide");
  36029. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "superSend", "classSend:", "superclass", "theClass", "aliasTemporally:", ",", "receiver", "arguments", "first", "allButFirst", "add:", "do:"]
  36030. }),
  36031. globals.IRASTTranslator);
  36032. smalltalk.addMethod(
  36033. smalltalk.method({
  36034. selector: "visitSequenceNode:",
  36035. protocol: 'visiting',
  36036. fn: function (aNode){
  36037. var self=this;
  36038. function $IRSequence(){return globals.IRSequence||(typeof IRSequence=="undefined"?nil:IRSequence)}
  36039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36040. return smalltalk.withContext(function($ctx1) {
  36041. //>>excludeEnd("ctx");
  36042. var $2,$1;
  36043. $1=self._withSequence_do_(_st($IRSequence())._new(),(function(){
  36044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36045. return smalltalk.withContext(function($ctx2) {
  36046. //>>excludeEnd("ctx");
  36047. return _st(_st(aNode)._nodes())._do_((function(each){
  36048. var instruction;
  36049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36050. return smalltalk.withContext(function($ctx3) {
  36051. //>>excludeEnd("ctx");
  36052. instruction=self._visitOrAlias_(each);
  36053. instruction;
  36054. $2=_st(instruction)._isVariable();
  36055. if(! smalltalk.assert($2)){
  36056. return _st(self._sequence())._add_(instruction);
  36057. };
  36058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36059. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  36060. //>>excludeEnd("ctx");
  36061. }));
  36062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36064. //>>excludeEnd("ctx");
  36065. }));
  36066. return $1;
  36067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36068. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.IRASTTranslator)});
  36069. //>>excludeEnd("ctx");
  36070. },
  36071. //>>excludeStart("ide", pragmas.excludeIdeData);
  36072. args: ["aNode"],
  36073. 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 ] ]]",
  36074. referencedClasses: ["IRSequence"],
  36075. //>>excludeEnd("ide");
  36076. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  36077. }),
  36078. globals.IRASTTranslator);
  36079. smalltalk.addMethod(
  36080. smalltalk.method({
  36081. selector: "visitValueNode:",
  36082. protocol: 'visiting',
  36083. fn: function (aNode){
  36084. var self=this;
  36085. function $IRValue(){return globals.IRValue||(typeof IRValue=="undefined"?nil:IRValue)}
  36086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36087. return smalltalk.withContext(function($ctx1) {
  36088. //>>excludeEnd("ctx");
  36089. var $2,$3,$1;
  36090. $2=_st($IRValue())._new();
  36091. _st($2)._value_(_st(aNode)._value());
  36092. $3=_st($2)._yourself();
  36093. $1=$3;
  36094. return $1;
  36095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36096. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.IRASTTranslator)});
  36097. //>>excludeEnd("ctx");
  36098. },
  36099. //>>excludeStart("ide", pragmas.excludeIdeData);
  36100. args: ["aNode"],
  36101. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  36102. referencedClasses: ["IRValue"],
  36103. //>>excludeEnd("ide");
  36104. messageSends: ["value:", "new", "value", "yourself"]
  36105. }),
  36106. globals.IRASTTranslator);
  36107. smalltalk.addMethod(
  36108. smalltalk.method({
  36109. selector: "visitVariableNode:",
  36110. protocol: 'visiting',
  36111. fn: function (aNode){
  36112. var self=this;
  36113. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  36114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36115. return smalltalk.withContext(function($ctx1) {
  36116. //>>excludeEnd("ctx");
  36117. var $2,$3,$1;
  36118. $2=_st($IRVariable())._new();
  36119. _st($2)._variable_(_st(aNode)._binding());
  36120. $3=_st($2)._yourself();
  36121. $1=$3;
  36122. return $1;
  36123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36124. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.IRASTTranslator)});
  36125. //>>excludeEnd("ctx");
  36126. },
  36127. //>>excludeStart("ide", pragmas.excludeIdeData);
  36128. args: ["aNode"],
  36129. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  36130. referencedClasses: ["IRVariable"],
  36131. //>>excludeEnd("ide");
  36132. messageSends: ["variable:", "new", "binding", "yourself"]
  36133. }),
  36134. globals.IRASTTranslator);
  36135. smalltalk.addMethod(
  36136. smalltalk.method({
  36137. selector: "withSequence:do:",
  36138. protocol: 'accessing',
  36139. fn: function (aSequence,aBlock){
  36140. var self=this;
  36141. var outerSequence;
  36142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36143. return smalltalk.withContext(function($ctx1) {
  36144. //>>excludeEnd("ctx");
  36145. outerSequence=self._sequence();
  36146. self._sequence_(aSequence);
  36147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36148. $ctx1.sendIdx["sequence:"]=1;
  36149. //>>excludeEnd("ctx");
  36150. _st(aBlock)._value();
  36151. self._sequence_(outerSequence);
  36152. return aSequence;
  36153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36154. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},globals.IRASTTranslator)});
  36155. //>>excludeEnd("ctx");
  36156. },
  36157. //>>excludeStart("ide", pragmas.excludeIdeData);
  36158. args: ["aSequence", "aBlock"],
  36159. 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",
  36160. referencedClasses: [],
  36161. //>>excludeEnd("ide");
  36162. messageSends: ["sequence", "sequence:", "value"]
  36163. }),
  36164. globals.IRASTTranslator);
  36165. smalltalk.addClass('IRInstruction', globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  36166. //>>excludeStart("ide", pragmas.excludeIdeData);
  36167. 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.";
  36168. //>>excludeEnd("ide");
  36169. smalltalk.addMethod(
  36170. smalltalk.method({
  36171. selector: "accept:",
  36172. protocol: 'visiting',
  36173. fn: function (aVisitor){
  36174. var self=this;
  36175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36176. return smalltalk.withContext(function($ctx1) {
  36177. //>>excludeEnd("ctx");
  36178. var $1;
  36179. $1=_st(aVisitor)._visitIRInstruction_(self);
  36180. return $1;
  36181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36182. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInstruction)});
  36183. //>>excludeEnd("ctx");
  36184. },
  36185. //>>excludeStart("ide", pragmas.excludeIdeData);
  36186. args: ["aVisitor"],
  36187. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  36188. referencedClasses: [],
  36189. //>>excludeEnd("ide");
  36190. messageSends: ["visitIRInstruction:"]
  36191. }),
  36192. globals.IRInstruction);
  36193. smalltalk.addMethod(
  36194. smalltalk.method({
  36195. selector: "add:",
  36196. protocol: 'building',
  36197. fn: function (anObject){
  36198. var self=this;
  36199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36200. return smalltalk.withContext(function($ctx1) {
  36201. //>>excludeEnd("ctx");
  36202. var $1;
  36203. _st(anObject)._parent_(self);
  36204. $1=_st(self._instructions())._add_(anObject);
  36205. return $1;
  36206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36207. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.IRInstruction)});
  36208. //>>excludeEnd("ctx");
  36209. },
  36210. //>>excludeStart("ide", pragmas.excludeIdeData);
  36211. args: ["anObject"],
  36212. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  36213. referencedClasses: [],
  36214. //>>excludeEnd("ide");
  36215. messageSends: ["parent:", "add:", "instructions"]
  36216. }),
  36217. globals.IRInstruction);
  36218. smalltalk.addMethod(
  36219. smalltalk.method({
  36220. selector: "canBeAssigned",
  36221. protocol: 'testing',
  36222. fn: function (){
  36223. var self=this;
  36224. return true;
  36225. },
  36226. //>>excludeStart("ide", pragmas.excludeIdeData);
  36227. args: [],
  36228. source: "canBeAssigned\x0a\x09^ true",
  36229. referencedClasses: [],
  36230. //>>excludeEnd("ide");
  36231. messageSends: []
  36232. }),
  36233. globals.IRInstruction);
  36234. smalltalk.addMethod(
  36235. smalltalk.method({
  36236. selector: "instructions",
  36237. protocol: 'accessing',
  36238. fn: function (){
  36239. var self=this;
  36240. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  36241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36242. return smalltalk.withContext(function($ctx1) {
  36243. //>>excludeEnd("ctx");
  36244. var $2,$1,$receiver;
  36245. $2=self["@instructions"];
  36246. if(($receiver = $2) == null || $receiver.isNil){
  36247. self["@instructions"]=_st($OrderedCollection())._new();
  36248. $1=self["@instructions"];
  36249. } else {
  36250. $1=$2;
  36251. };
  36252. return $1;
  36253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36254. }, function($ctx1) {$ctx1.fill(self,"instructions",{},globals.IRInstruction)});
  36255. //>>excludeEnd("ctx");
  36256. },
  36257. //>>excludeStart("ide", pragmas.excludeIdeData);
  36258. args: [],
  36259. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36260. referencedClasses: ["OrderedCollection"],
  36261. //>>excludeEnd("ide");
  36262. messageSends: ["ifNil:", "new"]
  36263. }),
  36264. globals.IRInstruction);
  36265. smalltalk.addMethod(
  36266. smalltalk.method({
  36267. selector: "isClosure",
  36268. protocol: 'testing',
  36269. fn: function (){
  36270. var self=this;
  36271. return false;
  36272. },
  36273. //>>excludeStart("ide", pragmas.excludeIdeData);
  36274. args: [],
  36275. source: "isClosure\x0a\x09^ false",
  36276. referencedClasses: [],
  36277. //>>excludeEnd("ide");
  36278. messageSends: []
  36279. }),
  36280. globals.IRInstruction);
  36281. smalltalk.addMethod(
  36282. smalltalk.method({
  36283. selector: "isInlined",
  36284. protocol: 'testing',
  36285. fn: function (){
  36286. var self=this;
  36287. return false;
  36288. },
  36289. //>>excludeStart("ide", pragmas.excludeIdeData);
  36290. args: [],
  36291. source: "isInlined\x0a\x09^ false",
  36292. referencedClasses: [],
  36293. //>>excludeEnd("ide");
  36294. messageSends: []
  36295. }),
  36296. globals.IRInstruction);
  36297. smalltalk.addMethod(
  36298. smalltalk.method({
  36299. selector: "isLocalReturn",
  36300. protocol: 'testing',
  36301. fn: function (){
  36302. var self=this;
  36303. return false;
  36304. },
  36305. //>>excludeStart("ide", pragmas.excludeIdeData);
  36306. args: [],
  36307. source: "isLocalReturn\x0a\x09^ false",
  36308. referencedClasses: [],
  36309. //>>excludeEnd("ide");
  36310. messageSends: []
  36311. }),
  36312. globals.IRInstruction);
  36313. smalltalk.addMethod(
  36314. smalltalk.method({
  36315. selector: "isMethod",
  36316. protocol: 'testing',
  36317. fn: function (){
  36318. var self=this;
  36319. return false;
  36320. },
  36321. //>>excludeStart("ide", pragmas.excludeIdeData);
  36322. args: [],
  36323. source: "isMethod\x0a\x09^ false",
  36324. referencedClasses: [],
  36325. //>>excludeEnd("ide");
  36326. messageSends: []
  36327. }),
  36328. globals.IRInstruction);
  36329. smalltalk.addMethod(
  36330. smalltalk.method({
  36331. selector: "isReturn",
  36332. protocol: 'testing',
  36333. fn: function (){
  36334. var self=this;
  36335. return false;
  36336. },
  36337. //>>excludeStart("ide", pragmas.excludeIdeData);
  36338. args: [],
  36339. source: "isReturn\x0a\x09^ false",
  36340. referencedClasses: [],
  36341. //>>excludeEnd("ide");
  36342. messageSends: []
  36343. }),
  36344. globals.IRInstruction);
  36345. smalltalk.addMethod(
  36346. smalltalk.method({
  36347. selector: "isSend",
  36348. protocol: 'testing',
  36349. fn: function (){
  36350. var self=this;
  36351. return false;
  36352. },
  36353. //>>excludeStart("ide", pragmas.excludeIdeData);
  36354. args: [],
  36355. source: "isSend\x0a\x09^ false",
  36356. referencedClasses: [],
  36357. //>>excludeEnd("ide");
  36358. messageSends: []
  36359. }),
  36360. globals.IRInstruction);
  36361. smalltalk.addMethod(
  36362. smalltalk.method({
  36363. selector: "isSequence",
  36364. protocol: 'testing',
  36365. fn: function (){
  36366. var self=this;
  36367. return false;
  36368. },
  36369. //>>excludeStart("ide", pragmas.excludeIdeData);
  36370. args: [],
  36371. source: "isSequence\x0a\x09^ false",
  36372. referencedClasses: [],
  36373. //>>excludeEnd("ide");
  36374. messageSends: []
  36375. }),
  36376. globals.IRInstruction);
  36377. smalltalk.addMethod(
  36378. smalltalk.method({
  36379. selector: "isTempDeclaration",
  36380. protocol: 'testing',
  36381. fn: function (){
  36382. var self=this;
  36383. return false;
  36384. },
  36385. //>>excludeStart("ide", pragmas.excludeIdeData);
  36386. args: [],
  36387. source: "isTempDeclaration\x0a\x09^ false",
  36388. referencedClasses: [],
  36389. //>>excludeEnd("ide");
  36390. messageSends: []
  36391. }),
  36392. globals.IRInstruction);
  36393. smalltalk.addMethod(
  36394. smalltalk.method({
  36395. selector: "isVariable",
  36396. protocol: 'testing',
  36397. fn: function (){
  36398. var self=this;
  36399. return false;
  36400. },
  36401. //>>excludeStart("ide", pragmas.excludeIdeData);
  36402. args: [],
  36403. source: "isVariable\x0a\x09^ false",
  36404. referencedClasses: [],
  36405. //>>excludeEnd("ide");
  36406. messageSends: []
  36407. }),
  36408. globals.IRInstruction);
  36409. smalltalk.addMethod(
  36410. smalltalk.method({
  36411. selector: "method",
  36412. protocol: 'accessing',
  36413. fn: function (){
  36414. var self=this;
  36415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36416. return smalltalk.withContext(function($ctx1) {
  36417. //>>excludeEnd("ctx");
  36418. var $1;
  36419. $1=_st(self._parent())._method();
  36420. return $1;
  36421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36422. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.IRInstruction)});
  36423. //>>excludeEnd("ctx");
  36424. },
  36425. //>>excludeStart("ide", pragmas.excludeIdeData);
  36426. args: [],
  36427. source: "method\x0a\x09^ self parent method",
  36428. referencedClasses: [],
  36429. //>>excludeEnd("ide");
  36430. messageSends: ["method", "parent"]
  36431. }),
  36432. globals.IRInstruction);
  36433. smalltalk.addMethod(
  36434. smalltalk.method({
  36435. selector: "needsBoxingAsReceiver",
  36436. protocol: 'testing',
  36437. fn: function (){
  36438. var self=this;
  36439. return true;
  36440. },
  36441. //>>excludeStart("ide", pragmas.excludeIdeData);
  36442. args: [],
  36443. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36444. referencedClasses: [],
  36445. //>>excludeEnd("ide");
  36446. messageSends: []
  36447. }),
  36448. globals.IRInstruction);
  36449. smalltalk.addMethod(
  36450. smalltalk.method({
  36451. selector: "parent",
  36452. protocol: 'accessing',
  36453. fn: function (){
  36454. var self=this;
  36455. var $1;
  36456. $1=self["@parent"];
  36457. return $1;
  36458. },
  36459. //>>excludeStart("ide", pragmas.excludeIdeData);
  36460. args: [],
  36461. source: "parent\x0a\x09^ parent",
  36462. referencedClasses: [],
  36463. //>>excludeEnd("ide");
  36464. messageSends: []
  36465. }),
  36466. globals.IRInstruction);
  36467. smalltalk.addMethod(
  36468. smalltalk.method({
  36469. selector: "parent:",
  36470. protocol: 'accessing',
  36471. fn: function (anIRInstruction){
  36472. var self=this;
  36473. self["@parent"]=anIRInstruction;
  36474. return self;
  36475. },
  36476. //>>excludeStart("ide", pragmas.excludeIdeData);
  36477. args: ["anIRInstruction"],
  36478. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36479. referencedClasses: [],
  36480. //>>excludeEnd("ide");
  36481. messageSends: []
  36482. }),
  36483. globals.IRInstruction);
  36484. smalltalk.addMethod(
  36485. smalltalk.method({
  36486. selector: "remove",
  36487. protocol: 'building',
  36488. fn: function (){
  36489. var self=this;
  36490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36491. return smalltalk.withContext(function($ctx1) {
  36492. //>>excludeEnd("ctx");
  36493. _st(self._parent())._remove_(self);
  36494. return self;
  36495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36496. }, function($ctx1) {$ctx1.fill(self,"remove",{},globals.IRInstruction)});
  36497. //>>excludeEnd("ctx");
  36498. },
  36499. //>>excludeStart("ide", pragmas.excludeIdeData);
  36500. args: [],
  36501. source: "remove\x0a\x09self parent remove: self",
  36502. referencedClasses: [],
  36503. //>>excludeEnd("ide");
  36504. messageSends: ["remove:", "parent"]
  36505. }),
  36506. globals.IRInstruction);
  36507. smalltalk.addMethod(
  36508. smalltalk.method({
  36509. selector: "remove:",
  36510. protocol: 'building',
  36511. fn: function (anIRInstruction){
  36512. var self=this;
  36513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36514. return smalltalk.withContext(function($ctx1) {
  36515. //>>excludeEnd("ctx");
  36516. _st(self._instructions())._remove_(anIRInstruction);
  36517. return self;
  36518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36519. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  36520. //>>excludeEnd("ctx");
  36521. },
  36522. //>>excludeStart("ide", pragmas.excludeIdeData);
  36523. args: ["anIRInstruction"],
  36524. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36525. referencedClasses: [],
  36526. //>>excludeEnd("ide");
  36527. messageSends: ["remove:", "instructions"]
  36528. }),
  36529. globals.IRInstruction);
  36530. smalltalk.addMethod(
  36531. smalltalk.method({
  36532. selector: "replace:with:",
  36533. protocol: 'building',
  36534. fn: function (anIRInstruction,anotherIRInstruction){
  36535. var self=this;
  36536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36537. return smalltalk.withContext(function($ctx1) {
  36538. //>>excludeEnd("ctx");
  36539. var $1;
  36540. _st(anotherIRInstruction)._parent_(self);
  36541. $1=self._instructions();
  36542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36543. $ctx1.sendIdx["instructions"]=1;
  36544. //>>excludeEnd("ctx");
  36545. _st($1)._at_put_(_st(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36546. return self;
  36547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36548. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRInstruction)});
  36549. //>>excludeEnd("ctx");
  36550. },
  36551. //>>excludeStart("ide", pragmas.excludeIdeData);
  36552. args: ["anIRInstruction", "anotherIRInstruction"],
  36553. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36554. referencedClasses: [],
  36555. //>>excludeEnd("ide");
  36556. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36557. }),
  36558. globals.IRInstruction);
  36559. smalltalk.addMethod(
  36560. smalltalk.method({
  36561. selector: "replaceWith:",
  36562. protocol: 'building',
  36563. fn: function (anIRInstruction){
  36564. var self=this;
  36565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36566. return smalltalk.withContext(function($ctx1) {
  36567. //>>excludeEnd("ctx");
  36568. _st(self._parent())._replace_with_(self,anIRInstruction);
  36569. return self;
  36570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36571. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},globals.IRInstruction)});
  36572. //>>excludeEnd("ctx");
  36573. },
  36574. //>>excludeStart("ide", pragmas.excludeIdeData);
  36575. args: ["anIRInstruction"],
  36576. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36577. referencedClasses: [],
  36578. //>>excludeEnd("ide");
  36579. messageSends: ["replace:with:", "parent"]
  36580. }),
  36581. globals.IRInstruction);
  36582. smalltalk.addMethod(
  36583. smalltalk.method({
  36584. selector: "scope",
  36585. protocol: 'accessing',
  36586. fn: function (){
  36587. var self=this;
  36588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36589. return smalltalk.withContext(function($ctx1) {
  36590. //>>excludeEnd("ctx");
  36591. var $2,$1,$receiver;
  36592. $2=self._parent();
  36593. if(($receiver = $2) == null || $receiver.isNil){
  36594. $1=$2;
  36595. } else {
  36596. var node;
  36597. node=$receiver;
  36598. $1=_st(node)._scope();
  36599. };
  36600. return $1;
  36601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36602. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRInstruction)});
  36603. //>>excludeEnd("ctx");
  36604. },
  36605. //>>excludeStart("ide", pragmas.excludeIdeData);
  36606. args: [],
  36607. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36608. referencedClasses: [],
  36609. //>>excludeEnd("ide");
  36610. messageSends: ["ifNotNil:", "parent", "scope"]
  36611. }),
  36612. globals.IRInstruction);
  36613. smalltalk.addMethod(
  36614. smalltalk.method({
  36615. selector: "on:",
  36616. protocol: 'instance creation',
  36617. fn: function (aBuilder){
  36618. var self=this;
  36619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36620. return smalltalk.withContext(function($ctx1) {
  36621. //>>excludeEnd("ctx");
  36622. var $2,$3,$1;
  36623. $2=self._new();
  36624. _st($2)._builder_(aBuilder);
  36625. $3=_st($2)._yourself();
  36626. $1=$3;
  36627. return $1;
  36628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36629. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},globals.IRInstruction.klass)});
  36630. //>>excludeEnd("ctx");
  36631. },
  36632. //>>excludeStart("ide", pragmas.excludeIdeData);
  36633. args: ["aBuilder"],
  36634. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36635. referencedClasses: [],
  36636. //>>excludeEnd("ide");
  36637. messageSends: ["builder:", "new", "yourself"]
  36638. }),
  36639. globals.IRInstruction.klass);
  36640. smalltalk.addClass('IRAssignment', globals.IRInstruction, [], 'Compiler-IR');
  36641. smalltalk.addMethod(
  36642. smalltalk.method({
  36643. selector: "accept:",
  36644. protocol: 'visiting',
  36645. fn: function (aVisitor){
  36646. var self=this;
  36647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36648. return smalltalk.withContext(function($ctx1) {
  36649. //>>excludeEnd("ctx");
  36650. var $1;
  36651. $1=_st(aVisitor)._visitIRAssignment_(self);
  36652. return $1;
  36653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36654. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRAssignment)});
  36655. //>>excludeEnd("ctx");
  36656. },
  36657. //>>excludeStart("ide", pragmas.excludeIdeData);
  36658. args: ["aVisitor"],
  36659. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36660. referencedClasses: [],
  36661. //>>excludeEnd("ide");
  36662. messageSends: ["visitIRAssignment:"]
  36663. }),
  36664. globals.IRAssignment);
  36665. smalltalk.addClass('IRDynamicArray', globals.IRInstruction, [], 'Compiler-IR');
  36666. smalltalk.addMethod(
  36667. smalltalk.method({
  36668. selector: "accept:",
  36669. protocol: 'visiting',
  36670. fn: function (aVisitor){
  36671. var self=this;
  36672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36673. return smalltalk.withContext(function($ctx1) {
  36674. //>>excludeEnd("ctx");
  36675. var $1;
  36676. $1=_st(aVisitor)._visitIRDynamicArray_(self);
  36677. return $1;
  36678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36679. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicArray)});
  36680. //>>excludeEnd("ctx");
  36681. },
  36682. //>>excludeStart("ide", pragmas.excludeIdeData);
  36683. args: ["aVisitor"],
  36684. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36685. referencedClasses: [],
  36686. //>>excludeEnd("ide");
  36687. messageSends: ["visitIRDynamicArray:"]
  36688. }),
  36689. globals.IRDynamicArray);
  36690. smalltalk.addClass('IRDynamicDictionary', globals.IRInstruction, [], 'Compiler-IR');
  36691. smalltalk.addMethod(
  36692. smalltalk.method({
  36693. selector: "accept:",
  36694. protocol: 'visiting',
  36695. fn: function (aVisitor){
  36696. var self=this;
  36697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36698. return smalltalk.withContext(function($ctx1) {
  36699. //>>excludeEnd("ctx");
  36700. var $1;
  36701. $1=_st(aVisitor)._visitIRDynamicDictionary_(self);
  36702. return $1;
  36703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36704. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRDynamicDictionary)});
  36705. //>>excludeEnd("ctx");
  36706. },
  36707. //>>excludeStart("ide", pragmas.excludeIdeData);
  36708. args: ["aVisitor"],
  36709. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36710. referencedClasses: [],
  36711. //>>excludeEnd("ide");
  36712. messageSends: ["visitIRDynamicDictionary:"]
  36713. }),
  36714. globals.IRDynamicDictionary);
  36715. smalltalk.addClass('IRScopedInstruction', globals.IRInstruction, ['scope'], 'Compiler-IR');
  36716. smalltalk.addMethod(
  36717. smalltalk.method({
  36718. selector: "scope",
  36719. protocol: 'accessing',
  36720. fn: function (){
  36721. var self=this;
  36722. var $1;
  36723. $1=self["@scope"];
  36724. return $1;
  36725. },
  36726. //>>excludeStart("ide", pragmas.excludeIdeData);
  36727. args: [],
  36728. source: "scope\x0a\x09^ scope",
  36729. referencedClasses: [],
  36730. //>>excludeEnd("ide");
  36731. messageSends: []
  36732. }),
  36733. globals.IRScopedInstruction);
  36734. smalltalk.addMethod(
  36735. smalltalk.method({
  36736. selector: "scope:",
  36737. protocol: 'accessing',
  36738. fn: function (aScope){
  36739. var self=this;
  36740. self["@scope"]=aScope;
  36741. return self;
  36742. },
  36743. //>>excludeStart("ide", pragmas.excludeIdeData);
  36744. args: ["aScope"],
  36745. source: "scope: aScope\x0a\x09scope := aScope",
  36746. referencedClasses: [],
  36747. //>>excludeEnd("ide");
  36748. messageSends: []
  36749. }),
  36750. globals.IRScopedInstruction);
  36751. smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36752. smalltalk.addMethod(
  36753. smalltalk.method({
  36754. selector: "arguments",
  36755. protocol: 'accessing',
  36756. fn: function (){
  36757. var self=this;
  36758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36759. return smalltalk.withContext(function($ctx1) {
  36760. //>>excludeEnd("ctx");
  36761. var $2,$1,$receiver;
  36762. $2=self["@arguments"];
  36763. if(($receiver = $2) == null || $receiver.isNil){
  36764. $1=[];
  36765. } else {
  36766. $1=$2;
  36767. };
  36768. return $1;
  36769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36770. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.IRClosureInstruction)});
  36771. //>>excludeEnd("ctx");
  36772. },
  36773. //>>excludeStart("ide", pragmas.excludeIdeData);
  36774. args: [],
  36775. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36776. referencedClasses: [],
  36777. //>>excludeEnd("ide");
  36778. messageSends: ["ifNil:"]
  36779. }),
  36780. globals.IRClosureInstruction);
  36781. smalltalk.addMethod(
  36782. smalltalk.method({
  36783. selector: "arguments:",
  36784. protocol: 'accessing',
  36785. fn: function (aCollection){
  36786. var self=this;
  36787. self["@arguments"]=aCollection;
  36788. return self;
  36789. },
  36790. //>>excludeStart("ide", pragmas.excludeIdeData);
  36791. args: ["aCollection"],
  36792. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36793. referencedClasses: [],
  36794. //>>excludeEnd("ide");
  36795. messageSends: []
  36796. }),
  36797. globals.IRClosureInstruction);
  36798. smalltalk.addMethod(
  36799. smalltalk.method({
  36800. selector: "locals",
  36801. protocol: 'accessing',
  36802. fn: function (){
  36803. var self=this;
  36804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36805. return smalltalk.withContext(function($ctx1) {
  36806. //>>excludeEnd("ctx");
  36807. var $2,$3,$1;
  36808. $2=_st(self._arguments())._copy();
  36809. _st($2)._addAll_(_st(self._tempDeclarations())._collect_((function(each){
  36810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36811. return smalltalk.withContext(function($ctx2) {
  36812. //>>excludeEnd("ctx");
  36813. return _st(each)._name();
  36814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36816. //>>excludeEnd("ctx");
  36817. })));
  36818. $3=_st($2)._yourself();
  36819. $1=$3;
  36820. return $1;
  36821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36822. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.IRClosureInstruction)});
  36823. //>>excludeEnd("ctx");
  36824. },
  36825. //>>excludeStart("ide", pragmas.excludeIdeData);
  36826. args: [],
  36827. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36828. referencedClasses: [],
  36829. //>>excludeEnd("ide");
  36830. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36831. }),
  36832. globals.IRClosureInstruction);
  36833. smalltalk.addMethod(
  36834. smalltalk.method({
  36835. selector: "requiresSmalltalkContext",
  36836. protocol: 'accessing',
  36837. fn: function (){
  36838. var self=this;
  36839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36840. return smalltalk.withContext(function($ctx1) {
  36841. //>>excludeEnd("ctx");
  36842. var $2,$1,$receiver;
  36843. $2=self["@requiresSmalltalkContext"];
  36844. if(($receiver = $2) == null || $receiver.isNil){
  36845. $1=false;
  36846. } else {
  36847. $1=$2;
  36848. };
  36849. return $1;
  36850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36851. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)});
  36852. //>>excludeEnd("ctx");
  36853. },
  36854. //>>excludeStart("ide", pragmas.excludeIdeData);
  36855. args: [],
  36856. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36857. referencedClasses: [],
  36858. //>>excludeEnd("ide");
  36859. messageSends: ["ifNil:"]
  36860. }),
  36861. globals.IRClosureInstruction);
  36862. smalltalk.addMethod(
  36863. smalltalk.method({
  36864. selector: "requiresSmalltalkContext:",
  36865. protocol: 'accessing',
  36866. fn: function (anObject){
  36867. var self=this;
  36868. self["@requiresSmalltalkContext"]=anObject;
  36869. return self;
  36870. },
  36871. //>>excludeStart("ide", pragmas.excludeIdeData);
  36872. args: ["anObject"],
  36873. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36874. referencedClasses: [],
  36875. //>>excludeEnd("ide");
  36876. messageSends: []
  36877. }),
  36878. globals.IRClosureInstruction);
  36879. smalltalk.addMethod(
  36880. smalltalk.method({
  36881. selector: "scope:",
  36882. protocol: 'accessing',
  36883. fn: function (aScope){
  36884. var self=this;
  36885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36886. return smalltalk.withContext(function($ctx1) {
  36887. //>>excludeEnd("ctx");
  36888. (
  36889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36890. $ctx1.supercall = true,
  36891. //>>excludeEnd("ctx");
  36892. globals.IRClosureInstruction.superclass.fn.prototype._scope_.apply(_st(self), [aScope]));
  36893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36894. $ctx1.supercall = false;
  36895. //>>excludeEnd("ctx");;
  36896. _st(aScope)._instruction_(self);
  36897. return self;
  36898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36899. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},globals.IRClosureInstruction)});
  36900. //>>excludeEnd("ctx");
  36901. },
  36902. //>>excludeStart("ide", pragmas.excludeIdeData);
  36903. args: ["aScope"],
  36904. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36905. referencedClasses: [],
  36906. //>>excludeEnd("ide");
  36907. messageSends: ["scope:", "instruction:"]
  36908. }),
  36909. globals.IRClosureInstruction);
  36910. smalltalk.addMethod(
  36911. smalltalk.method({
  36912. selector: "tempDeclarations",
  36913. protocol: 'accessing',
  36914. fn: function (){
  36915. var self=this;
  36916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36917. return smalltalk.withContext(function($ctx1) {
  36918. //>>excludeEnd("ctx");
  36919. var $1;
  36920. $1=_st(self._instructions())._select_((function(each){
  36921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36922. return smalltalk.withContext(function($ctx2) {
  36923. //>>excludeEnd("ctx");
  36924. return _st(each)._isTempDeclaration();
  36925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36927. //>>excludeEnd("ctx");
  36928. }));
  36929. return $1;
  36930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36931. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},globals.IRClosureInstruction)});
  36932. //>>excludeEnd("ctx");
  36933. },
  36934. //>>excludeStart("ide", pragmas.excludeIdeData);
  36935. args: [],
  36936. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36937. referencedClasses: [],
  36938. //>>excludeEnd("ide");
  36939. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36940. }),
  36941. globals.IRClosureInstruction);
  36942. smalltalk.addClass('IRClosure', globals.IRClosureInstruction, [], 'Compiler-IR');
  36943. smalltalk.addMethod(
  36944. smalltalk.method({
  36945. selector: "accept:",
  36946. protocol: 'visiting',
  36947. fn: function (aVisitor){
  36948. var self=this;
  36949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36950. return smalltalk.withContext(function($ctx1) {
  36951. //>>excludeEnd("ctx");
  36952. var $1;
  36953. $1=_st(aVisitor)._visitIRClosure_(self);
  36954. return $1;
  36955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36956. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRClosure)});
  36957. //>>excludeEnd("ctx");
  36958. },
  36959. //>>excludeStart("ide", pragmas.excludeIdeData);
  36960. args: ["aVisitor"],
  36961. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36962. referencedClasses: [],
  36963. //>>excludeEnd("ide");
  36964. messageSends: ["visitIRClosure:"]
  36965. }),
  36966. globals.IRClosure);
  36967. smalltalk.addMethod(
  36968. smalltalk.method({
  36969. selector: "isClosure",
  36970. protocol: 'testing',
  36971. fn: function (){
  36972. var self=this;
  36973. return true;
  36974. },
  36975. //>>excludeStart("ide", pragmas.excludeIdeData);
  36976. args: [],
  36977. source: "isClosure\x0a\x09^ true",
  36978. referencedClasses: [],
  36979. //>>excludeEnd("ide");
  36980. messageSends: []
  36981. }),
  36982. globals.IRClosure);
  36983. smalltalk.addMethod(
  36984. smalltalk.method({
  36985. selector: "sequence",
  36986. protocol: 'accessing',
  36987. fn: function (){
  36988. var self=this;
  36989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36990. return smalltalk.withContext(function($ctx1) {
  36991. //>>excludeEnd("ctx");
  36992. var $1;
  36993. $1=_st(self._instructions())._last();
  36994. return $1;
  36995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36996. }, function($ctx1) {$ctx1.fill(self,"sequence",{},globals.IRClosure)});
  36997. //>>excludeEnd("ctx");
  36998. },
  36999. //>>excludeStart("ide", pragmas.excludeIdeData);
  37000. args: [],
  37001. source: "sequence\x0a\x09^ self instructions last",
  37002. referencedClasses: [],
  37003. //>>excludeEnd("ide");
  37004. messageSends: ["last", "instructions"]
  37005. }),
  37006. globals.IRClosure);
  37007. smalltalk.addClass('IRMethod', globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'superSends', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  37008. //>>excludeStart("ide", pragmas.excludeIdeData);
  37009. globals.IRMethod.comment="I am a method instruction";
  37010. //>>excludeEnd("ide");
  37011. smalltalk.addMethod(
  37012. smalltalk.method({
  37013. selector: "accept:",
  37014. protocol: 'visiting',
  37015. fn: function (aVisitor){
  37016. var self=this;
  37017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37018. return smalltalk.withContext(function($ctx1) {
  37019. //>>excludeEnd("ctx");
  37020. var $1;
  37021. $1=_st(aVisitor)._visitIRMethod_(self);
  37022. return $1;
  37023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37024. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRMethod)});
  37025. //>>excludeEnd("ctx");
  37026. },
  37027. //>>excludeStart("ide", pragmas.excludeIdeData);
  37028. args: ["aVisitor"],
  37029. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  37030. referencedClasses: [],
  37031. //>>excludeEnd("ide");
  37032. messageSends: ["visitIRMethod:"]
  37033. }),
  37034. globals.IRMethod);
  37035. smalltalk.addMethod(
  37036. smalltalk.method({
  37037. selector: "classReferences",
  37038. protocol: 'accessing',
  37039. fn: function (){
  37040. var self=this;
  37041. var $1;
  37042. $1=self["@classReferences"];
  37043. return $1;
  37044. },
  37045. //>>excludeStart("ide", pragmas.excludeIdeData);
  37046. args: [],
  37047. source: "classReferences\x0a\x09^ classReferences",
  37048. referencedClasses: [],
  37049. //>>excludeEnd("ide");
  37050. messageSends: []
  37051. }),
  37052. globals.IRMethod);
  37053. smalltalk.addMethod(
  37054. smalltalk.method({
  37055. selector: "classReferences:",
  37056. protocol: 'accessing',
  37057. fn: function (aCollection){
  37058. var self=this;
  37059. self["@classReferences"]=aCollection;
  37060. return self;
  37061. },
  37062. //>>excludeStart("ide", pragmas.excludeIdeData);
  37063. args: ["aCollection"],
  37064. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  37065. referencedClasses: [],
  37066. //>>excludeEnd("ide");
  37067. messageSends: []
  37068. }),
  37069. globals.IRMethod);
  37070. smalltalk.addMethod(
  37071. smalltalk.method({
  37072. selector: "internalVariables",
  37073. protocol: 'accessing',
  37074. fn: function (){
  37075. var self=this;
  37076. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  37077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37078. return smalltalk.withContext(function($ctx1) {
  37079. //>>excludeEnd("ctx");
  37080. var $2,$1,$receiver;
  37081. $2=self["@internalVariables"];
  37082. if(($receiver = $2) == null || $receiver.isNil){
  37083. self["@internalVariables"]=_st($Set())._new();
  37084. $1=self["@internalVariables"];
  37085. } else {
  37086. $1=$2;
  37087. };
  37088. return $1;
  37089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37090. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRMethod)});
  37091. //>>excludeEnd("ctx");
  37092. },
  37093. //>>excludeStart("ide", pragmas.excludeIdeData);
  37094. args: [],
  37095. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  37096. referencedClasses: ["Set"],
  37097. //>>excludeEnd("ide");
  37098. messageSends: ["ifNil:", "new"]
  37099. }),
  37100. globals.IRMethod);
  37101. smalltalk.addMethod(
  37102. smalltalk.method({
  37103. selector: "isMethod",
  37104. protocol: 'accessing',
  37105. fn: function (){
  37106. var self=this;
  37107. return true;
  37108. },
  37109. //>>excludeStart("ide", pragmas.excludeIdeData);
  37110. args: [],
  37111. source: "isMethod\x0a\x09^ true",
  37112. referencedClasses: [],
  37113. //>>excludeEnd("ide");
  37114. messageSends: []
  37115. }),
  37116. globals.IRMethod);
  37117. smalltalk.addMethod(
  37118. smalltalk.method({
  37119. selector: "messageSends",
  37120. protocol: 'accessing',
  37121. fn: function (){
  37122. var self=this;
  37123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37124. return smalltalk.withContext(function($ctx1) {
  37125. //>>excludeEnd("ctx");
  37126. var $1;
  37127. $1=_st(self._sendIndexes())._keys();
  37128. return $1;
  37129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37130. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.IRMethod)});
  37131. //>>excludeEnd("ctx");
  37132. },
  37133. //>>excludeStart("ide", pragmas.excludeIdeData);
  37134. args: [],
  37135. source: "messageSends\x0a\x09^ self sendIndexes keys",
  37136. referencedClasses: [],
  37137. //>>excludeEnd("ide");
  37138. messageSends: ["keys", "sendIndexes"]
  37139. }),
  37140. globals.IRMethod);
  37141. smalltalk.addMethod(
  37142. smalltalk.method({
  37143. selector: "method",
  37144. protocol: 'accessing',
  37145. fn: function (){
  37146. var self=this;
  37147. return self;
  37148. },
  37149. //>>excludeStart("ide", pragmas.excludeIdeData);
  37150. args: [],
  37151. source: "method\x0a\x09^ self",
  37152. referencedClasses: [],
  37153. //>>excludeEnd("ide");
  37154. messageSends: []
  37155. }),
  37156. globals.IRMethod);
  37157. smalltalk.addMethod(
  37158. smalltalk.method({
  37159. selector: "selector",
  37160. protocol: 'accessing',
  37161. fn: function (){
  37162. var self=this;
  37163. var $1;
  37164. $1=self["@selector"];
  37165. return $1;
  37166. },
  37167. //>>excludeStart("ide", pragmas.excludeIdeData);
  37168. args: [],
  37169. source: "selector\x0a\x09^ selector",
  37170. referencedClasses: [],
  37171. //>>excludeEnd("ide");
  37172. messageSends: []
  37173. }),
  37174. globals.IRMethod);
  37175. smalltalk.addMethod(
  37176. smalltalk.method({
  37177. selector: "selector:",
  37178. protocol: 'accessing',
  37179. fn: function (aString){
  37180. var self=this;
  37181. self["@selector"]=aString;
  37182. return self;
  37183. },
  37184. //>>excludeStart("ide", pragmas.excludeIdeData);
  37185. args: ["aString"],
  37186. source: "selector: aString\x0a\x09selector := aString",
  37187. referencedClasses: [],
  37188. //>>excludeEnd("ide");
  37189. messageSends: []
  37190. }),
  37191. globals.IRMethod);
  37192. smalltalk.addMethod(
  37193. smalltalk.method({
  37194. selector: "sendIndexes",
  37195. protocol: 'accessing',
  37196. fn: function (){
  37197. var self=this;
  37198. var $1;
  37199. $1=self["@sendIndexes"];
  37200. return $1;
  37201. },
  37202. //>>excludeStart("ide", pragmas.excludeIdeData);
  37203. args: [],
  37204. source: "sendIndexes\x0a\x09^ sendIndexes",
  37205. referencedClasses: [],
  37206. //>>excludeEnd("ide");
  37207. messageSends: []
  37208. }),
  37209. globals.IRMethod);
  37210. smalltalk.addMethod(
  37211. smalltalk.method({
  37212. selector: "sendIndexes:",
  37213. protocol: 'accessing',
  37214. fn: function (aDictionary){
  37215. var self=this;
  37216. self["@sendIndexes"]=aDictionary;
  37217. return self;
  37218. },
  37219. //>>excludeStart("ide", pragmas.excludeIdeData);
  37220. args: ["aDictionary"],
  37221. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  37222. referencedClasses: [],
  37223. //>>excludeEnd("ide");
  37224. messageSends: []
  37225. }),
  37226. globals.IRMethod);
  37227. smalltalk.addMethod(
  37228. smalltalk.method({
  37229. selector: "source",
  37230. protocol: 'accessing',
  37231. fn: function (){
  37232. var self=this;
  37233. var $1;
  37234. $1=self["@source"];
  37235. return $1;
  37236. },
  37237. //>>excludeStart("ide", pragmas.excludeIdeData);
  37238. args: [],
  37239. source: "source\x0a\x09^ source",
  37240. referencedClasses: [],
  37241. //>>excludeEnd("ide");
  37242. messageSends: []
  37243. }),
  37244. globals.IRMethod);
  37245. smalltalk.addMethod(
  37246. smalltalk.method({
  37247. selector: "source:",
  37248. protocol: 'accessing',
  37249. fn: function (aString){
  37250. var self=this;
  37251. self["@source"]=aString;
  37252. return self;
  37253. },
  37254. //>>excludeStart("ide", pragmas.excludeIdeData);
  37255. args: ["aString"],
  37256. source: "source: aString\x0a\x09source := aString",
  37257. referencedClasses: [],
  37258. //>>excludeEnd("ide");
  37259. messageSends: []
  37260. }),
  37261. globals.IRMethod);
  37262. smalltalk.addMethod(
  37263. smalltalk.method({
  37264. selector: "superSends",
  37265. protocol: 'accessing',
  37266. fn: function (){
  37267. var self=this;
  37268. var $1;
  37269. $1=self["@superSends"];
  37270. return $1;
  37271. },
  37272. //>>excludeStart("ide", pragmas.excludeIdeData);
  37273. args: [],
  37274. source: "superSends\x0a\x09^ superSends",
  37275. referencedClasses: [],
  37276. //>>excludeEnd("ide");
  37277. messageSends: []
  37278. }),
  37279. globals.IRMethod);
  37280. smalltalk.addMethod(
  37281. smalltalk.method({
  37282. selector: "superSends:",
  37283. protocol: 'accessing',
  37284. fn: function (aCollection){
  37285. var self=this;
  37286. self["@superSends"]=aCollection;
  37287. return self;
  37288. },
  37289. //>>excludeStart("ide", pragmas.excludeIdeData);
  37290. args: ["aCollection"],
  37291. source: "superSends: aCollection\x0a\x09superSends := aCollection",
  37292. referencedClasses: [],
  37293. //>>excludeEnd("ide");
  37294. messageSends: []
  37295. }),
  37296. globals.IRMethod);
  37297. smalltalk.addMethod(
  37298. smalltalk.method({
  37299. selector: "theClass",
  37300. protocol: 'accessing',
  37301. fn: function (){
  37302. var self=this;
  37303. var $1;
  37304. $1=self["@theClass"];
  37305. return $1;
  37306. },
  37307. //>>excludeStart("ide", pragmas.excludeIdeData);
  37308. args: [],
  37309. source: "theClass\x0a\x09^ theClass",
  37310. referencedClasses: [],
  37311. //>>excludeEnd("ide");
  37312. messageSends: []
  37313. }),
  37314. globals.IRMethod);
  37315. smalltalk.addMethod(
  37316. smalltalk.method({
  37317. selector: "theClass:",
  37318. protocol: 'accessing',
  37319. fn: function (aClass){
  37320. var self=this;
  37321. self["@theClass"]=aClass;
  37322. return self;
  37323. },
  37324. //>>excludeStart("ide", pragmas.excludeIdeData);
  37325. args: ["aClass"],
  37326. source: "theClass: aClass\x0a\x09theClass := aClass",
  37327. referencedClasses: [],
  37328. //>>excludeEnd("ide");
  37329. messageSends: []
  37330. }),
  37331. globals.IRMethod);
  37332. smalltalk.addClass('IRReturn', globals.IRScopedInstruction, [], 'Compiler-IR');
  37333. //>>excludeStart("ide", pragmas.excludeIdeData);
  37334. globals.IRReturn.comment="I am a local return instruction.";
  37335. //>>excludeEnd("ide");
  37336. smalltalk.addMethod(
  37337. smalltalk.method({
  37338. selector: "accept:",
  37339. protocol: 'visiting',
  37340. fn: function (aVisitor){
  37341. var self=this;
  37342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37343. return smalltalk.withContext(function($ctx1) {
  37344. //>>excludeEnd("ctx");
  37345. var $1;
  37346. $1=_st(aVisitor)._visitIRReturn_(self);
  37347. return $1;
  37348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37349. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRReturn)});
  37350. //>>excludeEnd("ctx");
  37351. },
  37352. //>>excludeStart("ide", pragmas.excludeIdeData);
  37353. args: ["aVisitor"],
  37354. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  37355. referencedClasses: [],
  37356. //>>excludeEnd("ide");
  37357. messageSends: ["visitIRReturn:"]
  37358. }),
  37359. globals.IRReturn);
  37360. smalltalk.addMethod(
  37361. smalltalk.method({
  37362. selector: "canBeAssigned",
  37363. protocol: 'testing',
  37364. fn: function (){
  37365. var self=this;
  37366. return false;
  37367. },
  37368. //>>excludeStart("ide", pragmas.excludeIdeData);
  37369. args: [],
  37370. source: "canBeAssigned\x0a\x09^ false",
  37371. referencedClasses: [],
  37372. //>>excludeEnd("ide");
  37373. messageSends: []
  37374. }),
  37375. globals.IRReturn);
  37376. smalltalk.addMethod(
  37377. smalltalk.method({
  37378. selector: "isBlockReturn",
  37379. protocol: 'testing',
  37380. fn: function (){
  37381. var self=this;
  37382. return false;
  37383. },
  37384. //>>excludeStart("ide", pragmas.excludeIdeData);
  37385. args: [],
  37386. source: "isBlockReturn\x0a\x09^ false",
  37387. referencedClasses: [],
  37388. //>>excludeEnd("ide");
  37389. messageSends: []
  37390. }),
  37391. globals.IRReturn);
  37392. smalltalk.addMethod(
  37393. smalltalk.method({
  37394. selector: "isLocalReturn",
  37395. protocol: 'testing',
  37396. fn: function (){
  37397. var self=this;
  37398. return true;
  37399. },
  37400. //>>excludeStart("ide", pragmas.excludeIdeData);
  37401. args: [],
  37402. source: "isLocalReturn\x0a\x09^ true",
  37403. referencedClasses: [],
  37404. //>>excludeEnd("ide");
  37405. messageSends: []
  37406. }),
  37407. globals.IRReturn);
  37408. smalltalk.addMethod(
  37409. smalltalk.method({
  37410. selector: "isNonLocalReturn",
  37411. protocol: 'testing',
  37412. fn: function (){
  37413. var self=this;
  37414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37415. return smalltalk.withContext(function($ctx1) {
  37416. //>>excludeEnd("ctx");
  37417. var $1;
  37418. $1=_st(self._isLocalReturn())._not();
  37419. return $1;
  37420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37421. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},globals.IRReturn)});
  37422. //>>excludeEnd("ctx");
  37423. },
  37424. //>>excludeStart("ide", pragmas.excludeIdeData);
  37425. args: [],
  37426. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  37427. referencedClasses: [],
  37428. //>>excludeEnd("ide");
  37429. messageSends: ["not", "isLocalReturn"]
  37430. }),
  37431. globals.IRReturn);
  37432. smalltalk.addMethod(
  37433. smalltalk.method({
  37434. selector: "isReturn",
  37435. protocol: 'testing',
  37436. fn: function (){
  37437. var self=this;
  37438. return true;
  37439. },
  37440. //>>excludeStart("ide", pragmas.excludeIdeData);
  37441. args: [],
  37442. source: "isReturn\x0a\x09^ true",
  37443. referencedClasses: [],
  37444. //>>excludeEnd("ide");
  37445. messageSends: []
  37446. }),
  37447. globals.IRReturn);
  37448. smalltalk.addMethod(
  37449. smalltalk.method({
  37450. selector: "scope",
  37451. protocol: 'accessing',
  37452. fn: function (){
  37453. var self=this;
  37454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37455. return smalltalk.withContext(function($ctx1) {
  37456. //>>excludeEnd("ctx");
  37457. var $2,$1,$receiver;
  37458. $2=self["@scope"];
  37459. if(($receiver = $2) == null || $receiver.isNil){
  37460. $1=_st(self._parent())._scope();
  37461. } else {
  37462. $1=$2;
  37463. };
  37464. return $1;
  37465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37466. }, function($ctx1) {$ctx1.fill(self,"scope",{},globals.IRReturn)});
  37467. //>>excludeEnd("ctx");
  37468. },
  37469. //>>excludeStart("ide", pragmas.excludeIdeData);
  37470. args: [],
  37471. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  37472. referencedClasses: [],
  37473. //>>excludeEnd("ide");
  37474. messageSends: ["ifNil:", "scope", "parent"]
  37475. }),
  37476. globals.IRReturn);
  37477. smalltalk.addClass('IRBlockReturn', globals.IRReturn, [], 'Compiler-IR');
  37478. //>>excludeStart("ide", pragmas.excludeIdeData);
  37479. globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  37480. //>>excludeEnd("ide");
  37481. smalltalk.addMethod(
  37482. smalltalk.method({
  37483. selector: "accept:",
  37484. protocol: 'visiting',
  37485. fn: function (aVisitor){
  37486. var self=this;
  37487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37488. return smalltalk.withContext(function($ctx1) {
  37489. //>>excludeEnd("ctx");
  37490. var $1;
  37491. $1=_st(aVisitor)._visitIRBlockReturn_(self);
  37492. return $1;
  37493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37494. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockReturn)});
  37495. //>>excludeEnd("ctx");
  37496. },
  37497. //>>excludeStart("ide", pragmas.excludeIdeData);
  37498. args: ["aVisitor"],
  37499. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37500. referencedClasses: [],
  37501. //>>excludeEnd("ide");
  37502. messageSends: ["visitIRBlockReturn:"]
  37503. }),
  37504. globals.IRBlockReturn);
  37505. smalltalk.addMethod(
  37506. smalltalk.method({
  37507. selector: "isBlockReturn",
  37508. protocol: 'testing',
  37509. fn: function (){
  37510. var self=this;
  37511. return true;
  37512. },
  37513. //>>excludeStart("ide", pragmas.excludeIdeData);
  37514. args: [],
  37515. source: "isBlockReturn\x0a\x09^ true",
  37516. referencedClasses: [],
  37517. //>>excludeEnd("ide");
  37518. messageSends: []
  37519. }),
  37520. globals.IRBlockReturn);
  37521. smalltalk.addClass('IRNonLocalReturn', globals.IRReturn, [], 'Compiler-IR');
  37522. //>>excludeStart("ide", pragmas.excludeIdeData);
  37523. 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.";
  37524. //>>excludeEnd("ide");
  37525. smalltalk.addMethod(
  37526. smalltalk.method({
  37527. selector: "accept:",
  37528. protocol: 'visiting',
  37529. fn: function (aVisitor){
  37530. var self=this;
  37531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37532. return smalltalk.withContext(function($ctx1) {
  37533. //>>excludeEnd("ctx");
  37534. var $1;
  37535. $1=_st(aVisitor)._visitIRNonLocalReturn_(self);
  37536. return $1;
  37537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37538. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRNonLocalReturn)});
  37539. //>>excludeEnd("ctx");
  37540. },
  37541. //>>excludeStart("ide", pragmas.excludeIdeData);
  37542. args: ["aVisitor"],
  37543. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37544. referencedClasses: [],
  37545. //>>excludeEnd("ide");
  37546. messageSends: ["visitIRNonLocalReturn:"]
  37547. }),
  37548. globals.IRNonLocalReturn);
  37549. smalltalk.addMethod(
  37550. smalltalk.method({
  37551. selector: "isLocalReturn",
  37552. protocol: 'testing',
  37553. fn: function (){
  37554. var self=this;
  37555. return false;
  37556. },
  37557. //>>excludeStart("ide", pragmas.excludeIdeData);
  37558. args: [],
  37559. source: "isLocalReturn\x0a\x09^ false",
  37560. referencedClasses: [],
  37561. //>>excludeEnd("ide");
  37562. messageSends: []
  37563. }),
  37564. globals.IRNonLocalReturn);
  37565. smalltalk.addClass('IRTempDeclaration', globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37566. smalltalk.addMethod(
  37567. smalltalk.method({
  37568. selector: "accept:",
  37569. protocol: 'visiting',
  37570. fn: function (aVisitor){
  37571. var self=this;
  37572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37573. return smalltalk.withContext(function($ctx1) {
  37574. //>>excludeEnd("ctx");
  37575. var $1;
  37576. $1=_st(aVisitor)._visitIRTempDeclaration_(self);
  37577. return $1;
  37578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37579. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRTempDeclaration)});
  37580. //>>excludeEnd("ctx");
  37581. },
  37582. //>>excludeStart("ide", pragmas.excludeIdeData);
  37583. args: ["aVisitor"],
  37584. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37585. referencedClasses: [],
  37586. //>>excludeEnd("ide");
  37587. messageSends: ["visitIRTempDeclaration:"]
  37588. }),
  37589. globals.IRTempDeclaration);
  37590. smalltalk.addMethod(
  37591. smalltalk.method({
  37592. selector: "isTempDeclaration",
  37593. protocol: 'testing',
  37594. fn: function (){
  37595. var self=this;
  37596. return true;
  37597. },
  37598. //>>excludeStart("ide", pragmas.excludeIdeData);
  37599. args: [],
  37600. source: "isTempDeclaration\x0a\x09^ true",
  37601. referencedClasses: [],
  37602. //>>excludeEnd("ide");
  37603. messageSends: []
  37604. }),
  37605. globals.IRTempDeclaration);
  37606. smalltalk.addMethod(
  37607. smalltalk.method({
  37608. selector: "name",
  37609. protocol: 'accessing',
  37610. fn: function (){
  37611. var self=this;
  37612. var $1;
  37613. $1=self["@name"];
  37614. return $1;
  37615. },
  37616. //>>excludeStart("ide", pragmas.excludeIdeData);
  37617. args: [],
  37618. source: "name\x0a\x09^ name",
  37619. referencedClasses: [],
  37620. //>>excludeEnd("ide");
  37621. messageSends: []
  37622. }),
  37623. globals.IRTempDeclaration);
  37624. smalltalk.addMethod(
  37625. smalltalk.method({
  37626. selector: "name:",
  37627. protocol: 'accessing',
  37628. fn: function (aString){
  37629. var self=this;
  37630. self["@name"]=aString;
  37631. return self;
  37632. },
  37633. //>>excludeStart("ide", pragmas.excludeIdeData);
  37634. args: ["aString"],
  37635. source: "name: aString\x0a\x09name := aString",
  37636. referencedClasses: [],
  37637. //>>excludeEnd("ide");
  37638. messageSends: []
  37639. }),
  37640. globals.IRTempDeclaration);
  37641. smalltalk.addClass('IRSend', globals.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  37642. //>>excludeStart("ide", pragmas.excludeIdeData);
  37643. globals.IRSend.comment="I am a message send instruction.";
  37644. //>>excludeEnd("ide");
  37645. smalltalk.addMethod(
  37646. smalltalk.method({
  37647. selector: "accept:",
  37648. protocol: 'visiting',
  37649. fn: function (aVisitor){
  37650. var self=this;
  37651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37652. return smalltalk.withContext(function($ctx1) {
  37653. //>>excludeEnd("ctx");
  37654. var $1;
  37655. $1=_st(aVisitor)._visitIRSend_(self);
  37656. return $1;
  37657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37658. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSend)});
  37659. //>>excludeEnd("ctx");
  37660. },
  37661. //>>excludeStart("ide", pragmas.excludeIdeData);
  37662. args: ["aVisitor"],
  37663. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37664. referencedClasses: [],
  37665. //>>excludeEnd("ide");
  37666. messageSends: ["visitIRSend:"]
  37667. }),
  37668. globals.IRSend);
  37669. smalltalk.addMethod(
  37670. smalltalk.method({
  37671. selector: "classSend",
  37672. protocol: 'accessing',
  37673. fn: function (){
  37674. var self=this;
  37675. var $1;
  37676. $1=self["@classSend"];
  37677. return $1;
  37678. },
  37679. //>>excludeStart("ide", pragmas.excludeIdeData);
  37680. args: [],
  37681. source: "classSend\x0a\x09^ classSend",
  37682. referencedClasses: [],
  37683. //>>excludeEnd("ide");
  37684. messageSends: []
  37685. }),
  37686. globals.IRSend);
  37687. smalltalk.addMethod(
  37688. smalltalk.method({
  37689. selector: "classSend:",
  37690. protocol: 'accessing',
  37691. fn: function (aClass){
  37692. var self=this;
  37693. self["@classSend"]=aClass;
  37694. return self;
  37695. },
  37696. //>>excludeStart("ide", pragmas.excludeIdeData);
  37697. args: ["aClass"],
  37698. source: "classSend: aClass\x0a\x09classSend := aClass",
  37699. referencedClasses: [],
  37700. //>>excludeEnd("ide");
  37701. messageSends: []
  37702. }),
  37703. globals.IRSend);
  37704. smalltalk.addMethod(
  37705. smalltalk.method({
  37706. selector: "index",
  37707. protocol: 'accessing',
  37708. fn: function (){
  37709. var self=this;
  37710. var $1;
  37711. $1=self["@index"];
  37712. return $1;
  37713. },
  37714. //>>excludeStart("ide", pragmas.excludeIdeData);
  37715. args: [],
  37716. source: "index\x0a\x09^ index",
  37717. referencedClasses: [],
  37718. //>>excludeEnd("ide");
  37719. messageSends: []
  37720. }),
  37721. globals.IRSend);
  37722. smalltalk.addMethod(
  37723. smalltalk.method({
  37724. selector: "index:",
  37725. protocol: 'accessing',
  37726. fn: function (anInteger){
  37727. var self=this;
  37728. self["@index"]=anInteger;
  37729. return self;
  37730. },
  37731. //>>excludeStart("ide", pragmas.excludeIdeData);
  37732. args: ["anInteger"],
  37733. source: "index: anInteger\x0a\x09index := anInteger",
  37734. referencedClasses: [],
  37735. //>>excludeEnd("ide");
  37736. messageSends: []
  37737. }),
  37738. globals.IRSend);
  37739. smalltalk.addMethod(
  37740. smalltalk.method({
  37741. selector: "isSend",
  37742. protocol: 'testing',
  37743. fn: function (){
  37744. var self=this;
  37745. return true;
  37746. },
  37747. //>>excludeStart("ide", pragmas.excludeIdeData);
  37748. args: [],
  37749. source: "isSend\x0a\x09^ true",
  37750. referencedClasses: [],
  37751. //>>excludeEnd("ide");
  37752. messageSends: []
  37753. }),
  37754. globals.IRSend);
  37755. smalltalk.addMethod(
  37756. smalltalk.method({
  37757. selector: "selector",
  37758. protocol: 'accessing',
  37759. fn: function (){
  37760. var self=this;
  37761. var $1;
  37762. $1=self["@selector"];
  37763. return $1;
  37764. },
  37765. //>>excludeStart("ide", pragmas.excludeIdeData);
  37766. args: [],
  37767. source: "selector\x0a\x09^ selector",
  37768. referencedClasses: [],
  37769. //>>excludeEnd("ide");
  37770. messageSends: []
  37771. }),
  37772. globals.IRSend);
  37773. smalltalk.addMethod(
  37774. smalltalk.method({
  37775. selector: "selector:",
  37776. protocol: 'accessing',
  37777. fn: function (aString){
  37778. var self=this;
  37779. self["@selector"]=aString;
  37780. return self;
  37781. },
  37782. //>>excludeStart("ide", pragmas.excludeIdeData);
  37783. args: ["aString"],
  37784. source: "selector: aString\x0a\x09selector := aString",
  37785. referencedClasses: [],
  37786. //>>excludeEnd("ide");
  37787. messageSends: []
  37788. }),
  37789. globals.IRSend);
  37790. smalltalk.addClass('IRSequence', globals.IRInstruction, [], 'Compiler-IR');
  37791. smalltalk.addMethod(
  37792. smalltalk.method({
  37793. selector: "accept:",
  37794. protocol: 'visiting',
  37795. fn: function (aVisitor){
  37796. var self=this;
  37797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37798. return smalltalk.withContext(function($ctx1) {
  37799. //>>excludeEnd("ctx");
  37800. var $1;
  37801. $1=_st(aVisitor)._visitIRSequence_(self);
  37802. return $1;
  37803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37804. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRSequence)});
  37805. //>>excludeEnd("ctx");
  37806. },
  37807. //>>excludeStart("ide", pragmas.excludeIdeData);
  37808. args: ["aVisitor"],
  37809. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37810. referencedClasses: [],
  37811. //>>excludeEnd("ide");
  37812. messageSends: ["visitIRSequence:"]
  37813. }),
  37814. globals.IRSequence);
  37815. smalltalk.addMethod(
  37816. smalltalk.method({
  37817. selector: "isSequence",
  37818. protocol: 'testing',
  37819. fn: function (){
  37820. var self=this;
  37821. return true;
  37822. },
  37823. //>>excludeStart("ide", pragmas.excludeIdeData);
  37824. args: [],
  37825. source: "isSequence\x0a\x09^ true",
  37826. referencedClasses: [],
  37827. //>>excludeEnd("ide");
  37828. messageSends: []
  37829. }),
  37830. globals.IRSequence);
  37831. smalltalk.addClass('IRBlockSequence', globals.IRSequence, [], 'Compiler-IR');
  37832. smalltalk.addMethod(
  37833. smalltalk.method({
  37834. selector: "accept:",
  37835. protocol: 'visiting',
  37836. fn: function (aVisitor){
  37837. var self=this;
  37838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37839. return smalltalk.withContext(function($ctx1) {
  37840. //>>excludeEnd("ctx");
  37841. var $1;
  37842. $1=_st(aVisitor)._visitIRBlockSequence_(self);
  37843. return $1;
  37844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37845. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRBlockSequence)});
  37846. //>>excludeEnd("ctx");
  37847. },
  37848. //>>excludeStart("ide", pragmas.excludeIdeData);
  37849. args: ["aVisitor"],
  37850. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37851. referencedClasses: [],
  37852. //>>excludeEnd("ide");
  37853. messageSends: ["visitIRBlockSequence:"]
  37854. }),
  37855. globals.IRBlockSequence);
  37856. smalltalk.addClass('IRValue', globals.IRInstruction, ['value'], 'Compiler-IR');
  37857. //>>excludeStart("ide", pragmas.excludeIdeData);
  37858. globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37859. //>>excludeEnd("ide");
  37860. smalltalk.addMethod(
  37861. smalltalk.method({
  37862. selector: "accept:",
  37863. protocol: 'visiting',
  37864. fn: function (aVisitor){
  37865. var self=this;
  37866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37867. return smalltalk.withContext(function($ctx1) {
  37868. //>>excludeEnd("ctx");
  37869. var $1;
  37870. $1=_st(aVisitor)._visitIRValue_(self);
  37871. return $1;
  37872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37873. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRValue)});
  37874. //>>excludeEnd("ctx");
  37875. },
  37876. //>>excludeStart("ide", pragmas.excludeIdeData);
  37877. args: ["aVisitor"],
  37878. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37879. referencedClasses: [],
  37880. //>>excludeEnd("ide");
  37881. messageSends: ["visitIRValue:"]
  37882. }),
  37883. globals.IRValue);
  37884. smalltalk.addMethod(
  37885. smalltalk.method({
  37886. selector: "needsBoxingAsReceiver",
  37887. protocol: 'testing',
  37888. fn: function (){
  37889. var self=this;
  37890. return false;
  37891. },
  37892. //>>excludeStart("ide", pragmas.excludeIdeData);
  37893. args: [],
  37894. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37895. referencedClasses: [],
  37896. //>>excludeEnd("ide");
  37897. messageSends: []
  37898. }),
  37899. globals.IRValue);
  37900. smalltalk.addMethod(
  37901. smalltalk.method({
  37902. selector: "value",
  37903. protocol: 'accessing',
  37904. fn: function (){
  37905. var self=this;
  37906. var $1;
  37907. $1=self["@value"];
  37908. return $1;
  37909. },
  37910. //>>excludeStart("ide", pragmas.excludeIdeData);
  37911. args: [],
  37912. source: "value\x0a\x09^ value",
  37913. referencedClasses: [],
  37914. //>>excludeEnd("ide");
  37915. messageSends: []
  37916. }),
  37917. globals.IRValue);
  37918. smalltalk.addMethod(
  37919. smalltalk.method({
  37920. selector: "value:",
  37921. protocol: 'accessing',
  37922. fn: function (aString){
  37923. var self=this;
  37924. self["@value"]=aString;
  37925. return self;
  37926. },
  37927. //>>excludeStart("ide", pragmas.excludeIdeData);
  37928. args: ["aString"],
  37929. source: "value: aString\x0a\x09value := aString",
  37930. referencedClasses: [],
  37931. //>>excludeEnd("ide");
  37932. messageSends: []
  37933. }),
  37934. globals.IRValue);
  37935. smalltalk.addClass('IRVariable', globals.IRInstruction, ['variable'], 'Compiler-IR');
  37936. //>>excludeStart("ide", pragmas.excludeIdeData);
  37937. globals.IRVariable.comment="I am a variable instruction.";
  37938. //>>excludeEnd("ide");
  37939. smalltalk.addMethod(
  37940. smalltalk.method({
  37941. selector: "accept:",
  37942. protocol: 'visiting',
  37943. fn: function (aVisitor){
  37944. var self=this;
  37945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37946. return smalltalk.withContext(function($ctx1) {
  37947. //>>excludeEnd("ctx");
  37948. var $1;
  37949. $1=_st(aVisitor)._visitIRVariable_(self);
  37950. return $1;
  37951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37952. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVariable)});
  37953. //>>excludeEnd("ctx");
  37954. },
  37955. //>>excludeStart("ide", pragmas.excludeIdeData);
  37956. args: ["aVisitor"],
  37957. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37958. referencedClasses: [],
  37959. //>>excludeEnd("ide");
  37960. messageSends: ["visitIRVariable:"]
  37961. }),
  37962. globals.IRVariable);
  37963. smalltalk.addMethod(
  37964. smalltalk.method({
  37965. selector: "isVariable",
  37966. protocol: 'testing',
  37967. fn: function (){
  37968. var self=this;
  37969. return true;
  37970. },
  37971. //>>excludeStart("ide", pragmas.excludeIdeData);
  37972. args: [],
  37973. source: "isVariable\x0a\x09^ true",
  37974. referencedClasses: [],
  37975. //>>excludeEnd("ide");
  37976. messageSends: []
  37977. }),
  37978. globals.IRVariable);
  37979. smalltalk.addMethod(
  37980. smalltalk.method({
  37981. selector: "needsBoxingAsReceiver",
  37982. protocol: 'testing',
  37983. fn: function (){
  37984. var self=this;
  37985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37986. return smalltalk.withContext(function($ctx1) {
  37987. //>>excludeEnd("ctx");
  37988. var $1;
  37989. $1=_st(_st(self._variable())._isPseudoVar())._not();
  37990. return $1;
  37991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37992. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},globals.IRVariable)});
  37993. //>>excludeEnd("ctx");
  37994. },
  37995. //>>excludeStart("ide", pragmas.excludeIdeData);
  37996. args: [],
  37997. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37998. referencedClasses: [],
  37999. //>>excludeEnd("ide");
  38000. messageSends: ["not", "isPseudoVar", "variable"]
  38001. }),
  38002. globals.IRVariable);
  38003. smalltalk.addMethod(
  38004. smalltalk.method({
  38005. selector: "variable",
  38006. protocol: 'accessing',
  38007. fn: function (){
  38008. var self=this;
  38009. var $1;
  38010. $1=self["@variable"];
  38011. return $1;
  38012. },
  38013. //>>excludeStart("ide", pragmas.excludeIdeData);
  38014. args: [],
  38015. source: "variable\x0a\x09^ variable",
  38016. referencedClasses: [],
  38017. //>>excludeEnd("ide");
  38018. messageSends: []
  38019. }),
  38020. globals.IRVariable);
  38021. smalltalk.addMethod(
  38022. smalltalk.method({
  38023. selector: "variable:",
  38024. protocol: 'accessing',
  38025. fn: function (aScopeVariable){
  38026. var self=this;
  38027. self["@variable"]=aScopeVariable;
  38028. return self;
  38029. },
  38030. //>>excludeStart("ide", pragmas.excludeIdeData);
  38031. args: ["aScopeVariable"],
  38032. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  38033. referencedClasses: [],
  38034. //>>excludeEnd("ide");
  38035. messageSends: []
  38036. }),
  38037. globals.IRVariable);
  38038. smalltalk.addClass('IRVerbatim', globals.IRInstruction, ['source'], 'Compiler-IR');
  38039. smalltalk.addMethod(
  38040. smalltalk.method({
  38041. selector: "accept:",
  38042. protocol: 'visiting',
  38043. fn: function (aVisitor){
  38044. var self=this;
  38045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38046. return smalltalk.withContext(function($ctx1) {
  38047. //>>excludeEnd("ctx");
  38048. var $1;
  38049. $1=_st(aVisitor)._visitIRVerbatim_(self);
  38050. return $1;
  38051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38052. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRVerbatim)});
  38053. //>>excludeEnd("ctx");
  38054. },
  38055. //>>excludeStart("ide", pragmas.excludeIdeData);
  38056. args: ["aVisitor"],
  38057. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  38058. referencedClasses: [],
  38059. //>>excludeEnd("ide");
  38060. messageSends: ["visitIRVerbatim:"]
  38061. }),
  38062. globals.IRVerbatim);
  38063. smalltalk.addMethod(
  38064. smalltalk.method({
  38065. selector: "source",
  38066. protocol: 'accessing',
  38067. fn: function (){
  38068. var self=this;
  38069. var $1;
  38070. $1=self["@source"];
  38071. return $1;
  38072. },
  38073. //>>excludeStart("ide", pragmas.excludeIdeData);
  38074. args: [],
  38075. source: "source\x0a\x09^ source",
  38076. referencedClasses: [],
  38077. //>>excludeEnd("ide");
  38078. messageSends: []
  38079. }),
  38080. globals.IRVerbatim);
  38081. smalltalk.addMethod(
  38082. smalltalk.method({
  38083. selector: "source:",
  38084. protocol: 'accessing',
  38085. fn: function (aString){
  38086. var self=this;
  38087. self["@source"]=aString;
  38088. return self;
  38089. },
  38090. //>>excludeStart("ide", pragmas.excludeIdeData);
  38091. args: ["aString"],
  38092. source: "source: aString\x0a\x09source := aString",
  38093. referencedClasses: [],
  38094. //>>excludeEnd("ide");
  38095. messageSends: []
  38096. }),
  38097. globals.IRVerbatim);
  38098. smalltalk.addClass('IRVisitor', globals.Object, [], 'Compiler-IR');
  38099. smalltalk.addMethod(
  38100. smalltalk.method({
  38101. selector: "visit:",
  38102. protocol: 'visiting',
  38103. fn: function (anIRInstruction){
  38104. var self=this;
  38105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38106. return smalltalk.withContext(function($ctx1) {
  38107. //>>excludeEnd("ctx");
  38108. var $1;
  38109. $1=_st(anIRInstruction)._accept_(self);
  38110. return $1;
  38111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38112. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  38113. //>>excludeEnd("ctx");
  38114. },
  38115. //>>excludeStart("ide", pragmas.excludeIdeData);
  38116. args: ["anIRInstruction"],
  38117. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  38118. referencedClasses: [],
  38119. //>>excludeEnd("ide");
  38120. messageSends: ["accept:"]
  38121. }),
  38122. globals.IRVisitor);
  38123. smalltalk.addMethod(
  38124. smalltalk.method({
  38125. selector: "visitIRAssignment:",
  38126. protocol: 'visiting',
  38127. fn: function (anIRAssignment){
  38128. var self=this;
  38129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38130. return smalltalk.withContext(function($ctx1) {
  38131. //>>excludeEnd("ctx");
  38132. var $1;
  38133. $1=self._visitIRInstruction_(anIRAssignment);
  38134. return $1;
  38135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38136. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRVisitor)});
  38137. //>>excludeEnd("ctx");
  38138. },
  38139. //>>excludeStart("ide", pragmas.excludeIdeData);
  38140. args: ["anIRAssignment"],
  38141. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  38142. referencedClasses: [],
  38143. //>>excludeEnd("ide");
  38144. messageSends: ["visitIRInstruction:"]
  38145. }),
  38146. globals.IRVisitor);
  38147. smalltalk.addMethod(
  38148. smalltalk.method({
  38149. selector: "visitIRBlockReturn:",
  38150. protocol: 'visiting',
  38151. fn: function (anIRBlockReturn){
  38152. var self=this;
  38153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38154. return smalltalk.withContext(function($ctx1) {
  38155. //>>excludeEnd("ctx");
  38156. var $1;
  38157. $1=self._visitIRReturn_(anIRBlockReturn);
  38158. return $1;
  38159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38160. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},globals.IRVisitor)});
  38161. //>>excludeEnd("ctx");
  38162. },
  38163. //>>excludeStart("ide", pragmas.excludeIdeData);
  38164. args: ["anIRBlockReturn"],
  38165. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  38166. referencedClasses: [],
  38167. //>>excludeEnd("ide");
  38168. messageSends: ["visitIRReturn:"]
  38169. }),
  38170. globals.IRVisitor);
  38171. smalltalk.addMethod(
  38172. smalltalk.method({
  38173. selector: "visitIRBlockSequence:",
  38174. protocol: 'visiting',
  38175. fn: function (anIRBlockSequence){
  38176. var self=this;
  38177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38178. return smalltalk.withContext(function($ctx1) {
  38179. //>>excludeEnd("ctx");
  38180. var $1;
  38181. $1=self._visitIRSequence_(anIRBlockSequence);
  38182. return $1;
  38183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38184. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},globals.IRVisitor)});
  38185. //>>excludeEnd("ctx");
  38186. },
  38187. //>>excludeStart("ide", pragmas.excludeIdeData);
  38188. args: ["anIRBlockSequence"],
  38189. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  38190. referencedClasses: [],
  38191. //>>excludeEnd("ide");
  38192. messageSends: ["visitIRSequence:"]
  38193. }),
  38194. globals.IRVisitor);
  38195. smalltalk.addMethod(
  38196. smalltalk.method({
  38197. selector: "visitIRClosure:",
  38198. protocol: 'visiting',
  38199. fn: function (anIRClosure){
  38200. var self=this;
  38201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38202. return smalltalk.withContext(function($ctx1) {
  38203. //>>excludeEnd("ctx");
  38204. var $1;
  38205. $1=self._visitIRInstruction_(anIRClosure);
  38206. return $1;
  38207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38208. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRVisitor)});
  38209. //>>excludeEnd("ctx");
  38210. },
  38211. //>>excludeStart("ide", pragmas.excludeIdeData);
  38212. args: ["anIRClosure"],
  38213. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  38214. referencedClasses: [],
  38215. //>>excludeEnd("ide");
  38216. messageSends: ["visitIRInstruction:"]
  38217. }),
  38218. globals.IRVisitor);
  38219. smalltalk.addMethod(
  38220. smalltalk.method({
  38221. selector: "visitIRDynamicArray:",
  38222. protocol: 'visiting',
  38223. fn: function (anIRDynamicArray){
  38224. var self=this;
  38225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38226. return smalltalk.withContext(function($ctx1) {
  38227. //>>excludeEnd("ctx");
  38228. var $1;
  38229. $1=self._visitIRInstruction_(anIRDynamicArray);
  38230. return $1;
  38231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38232. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRVisitor)});
  38233. //>>excludeEnd("ctx");
  38234. },
  38235. //>>excludeStart("ide", pragmas.excludeIdeData);
  38236. args: ["anIRDynamicArray"],
  38237. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  38238. referencedClasses: [],
  38239. //>>excludeEnd("ide");
  38240. messageSends: ["visitIRInstruction:"]
  38241. }),
  38242. globals.IRVisitor);
  38243. smalltalk.addMethod(
  38244. smalltalk.method({
  38245. selector: "visitIRDynamicDictionary:",
  38246. protocol: 'visiting',
  38247. fn: function (anIRDynamicDictionary){
  38248. var self=this;
  38249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38250. return smalltalk.withContext(function($ctx1) {
  38251. //>>excludeEnd("ctx");
  38252. var $1;
  38253. $1=self._visitIRInstruction_(anIRDynamicDictionary);
  38254. return $1;
  38255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38256. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRVisitor)});
  38257. //>>excludeEnd("ctx");
  38258. },
  38259. //>>excludeStart("ide", pragmas.excludeIdeData);
  38260. args: ["anIRDynamicDictionary"],
  38261. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  38262. referencedClasses: [],
  38263. //>>excludeEnd("ide");
  38264. messageSends: ["visitIRInstruction:"]
  38265. }),
  38266. globals.IRVisitor);
  38267. smalltalk.addMethod(
  38268. smalltalk.method({
  38269. selector: "visitIRInlinedClosure:",
  38270. protocol: 'visiting',
  38271. fn: function (anIRInlinedClosure){
  38272. var self=this;
  38273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38274. return smalltalk.withContext(function($ctx1) {
  38275. //>>excludeEnd("ctx");
  38276. var $1;
  38277. $1=self._visitIRClosure_(anIRInlinedClosure);
  38278. return $1;
  38279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38280. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRVisitor)});
  38281. //>>excludeEnd("ctx");
  38282. },
  38283. //>>excludeStart("ide", pragmas.excludeIdeData);
  38284. args: ["anIRInlinedClosure"],
  38285. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  38286. referencedClasses: [],
  38287. //>>excludeEnd("ide");
  38288. messageSends: ["visitIRClosure:"]
  38289. }),
  38290. globals.IRVisitor);
  38291. smalltalk.addMethod(
  38292. smalltalk.method({
  38293. selector: "visitIRInlinedSequence:",
  38294. protocol: 'visiting',
  38295. fn: function (anIRInlinedSequence){
  38296. var self=this;
  38297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38298. return smalltalk.withContext(function($ctx1) {
  38299. //>>excludeEnd("ctx");
  38300. var $1;
  38301. $1=self._visitIRSequence_(anIRInlinedSequence);
  38302. return $1;
  38303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38304. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRVisitor)});
  38305. //>>excludeEnd("ctx");
  38306. },
  38307. //>>excludeStart("ide", pragmas.excludeIdeData);
  38308. args: ["anIRInlinedSequence"],
  38309. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  38310. referencedClasses: [],
  38311. //>>excludeEnd("ide");
  38312. messageSends: ["visitIRSequence:"]
  38313. }),
  38314. globals.IRVisitor);
  38315. smalltalk.addMethod(
  38316. smalltalk.method({
  38317. selector: "visitIRInstruction:",
  38318. protocol: 'visiting',
  38319. fn: function (anIRInstruction){
  38320. var self=this;
  38321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38322. return smalltalk.withContext(function($ctx1) {
  38323. //>>excludeEnd("ctx");
  38324. _st(_st(anIRInstruction)._instructions())._do_((function(each){
  38325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38326. return smalltalk.withContext(function($ctx2) {
  38327. //>>excludeEnd("ctx");
  38328. return self._visit_(each);
  38329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38331. //>>excludeEnd("ctx");
  38332. }));
  38333. return anIRInstruction;
  38334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38335. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},globals.IRVisitor)});
  38336. //>>excludeEnd("ctx");
  38337. },
  38338. //>>excludeStart("ide", pragmas.excludeIdeData);
  38339. args: ["anIRInstruction"],
  38340. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  38341. referencedClasses: [],
  38342. //>>excludeEnd("ide");
  38343. messageSends: ["do:", "instructions", "visit:"]
  38344. }),
  38345. globals.IRVisitor);
  38346. smalltalk.addMethod(
  38347. smalltalk.method({
  38348. selector: "visitIRMethod:",
  38349. protocol: 'visiting',
  38350. fn: function (anIRMethod){
  38351. var self=this;
  38352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38353. return smalltalk.withContext(function($ctx1) {
  38354. //>>excludeEnd("ctx");
  38355. var $1;
  38356. $1=self._visitIRInstruction_(anIRMethod);
  38357. return $1;
  38358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38359. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRVisitor)});
  38360. //>>excludeEnd("ctx");
  38361. },
  38362. //>>excludeStart("ide", pragmas.excludeIdeData);
  38363. args: ["anIRMethod"],
  38364. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  38365. referencedClasses: [],
  38366. //>>excludeEnd("ide");
  38367. messageSends: ["visitIRInstruction:"]
  38368. }),
  38369. globals.IRVisitor);
  38370. smalltalk.addMethod(
  38371. smalltalk.method({
  38372. selector: "visitIRNonLocalReturn:",
  38373. protocol: 'visiting',
  38374. fn: function (anIRNonLocalReturn){
  38375. var self=this;
  38376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38377. return smalltalk.withContext(function($ctx1) {
  38378. //>>excludeEnd("ctx");
  38379. var $1;
  38380. $1=self._visitIRInstruction_(anIRNonLocalReturn);
  38381. return $1;
  38382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38383. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRVisitor)});
  38384. //>>excludeEnd("ctx");
  38385. },
  38386. //>>excludeStart("ide", pragmas.excludeIdeData);
  38387. args: ["anIRNonLocalReturn"],
  38388. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  38389. referencedClasses: [],
  38390. //>>excludeEnd("ide");
  38391. messageSends: ["visitIRInstruction:"]
  38392. }),
  38393. globals.IRVisitor);
  38394. smalltalk.addMethod(
  38395. smalltalk.method({
  38396. selector: "visitIRNonLocalReturnHandling:",
  38397. protocol: 'visiting',
  38398. fn: function (anIRNonLocalReturnHandling){
  38399. var self=this;
  38400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38401. return smalltalk.withContext(function($ctx1) {
  38402. //>>excludeEnd("ctx");
  38403. var $1;
  38404. $1=self._visitIRInstruction_(anIRNonLocalReturnHandling);
  38405. return $1;
  38406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38407. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},globals.IRVisitor)});
  38408. //>>excludeEnd("ctx");
  38409. },
  38410. //>>excludeStart("ide", pragmas.excludeIdeData);
  38411. args: ["anIRNonLocalReturnHandling"],
  38412. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  38413. referencedClasses: [],
  38414. //>>excludeEnd("ide");
  38415. messageSends: ["visitIRInstruction:"]
  38416. }),
  38417. globals.IRVisitor);
  38418. smalltalk.addMethod(
  38419. smalltalk.method({
  38420. selector: "visitIRReturn:",
  38421. protocol: 'visiting',
  38422. fn: function (anIRReturn){
  38423. var self=this;
  38424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38425. return smalltalk.withContext(function($ctx1) {
  38426. //>>excludeEnd("ctx");
  38427. var $1;
  38428. $1=self._visitIRInstruction_(anIRReturn);
  38429. return $1;
  38430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38431. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRVisitor)});
  38432. //>>excludeEnd("ctx");
  38433. },
  38434. //>>excludeStart("ide", pragmas.excludeIdeData);
  38435. args: ["anIRReturn"],
  38436. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  38437. referencedClasses: [],
  38438. //>>excludeEnd("ide");
  38439. messageSends: ["visitIRInstruction:"]
  38440. }),
  38441. globals.IRVisitor);
  38442. smalltalk.addMethod(
  38443. smalltalk.method({
  38444. selector: "visitIRSend:",
  38445. protocol: 'visiting',
  38446. fn: function (anIRSend){
  38447. var self=this;
  38448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38449. return smalltalk.withContext(function($ctx1) {
  38450. //>>excludeEnd("ctx");
  38451. var $1;
  38452. $1=self._visitIRInstruction_(anIRSend);
  38453. return $1;
  38454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38455. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRVisitor)});
  38456. //>>excludeEnd("ctx");
  38457. },
  38458. //>>excludeStart("ide", pragmas.excludeIdeData);
  38459. args: ["anIRSend"],
  38460. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  38461. referencedClasses: [],
  38462. //>>excludeEnd("ide");
  38463. messageSends: ["visitIRInstruction:"]
  38464. }),
  38465. globals.IRVisitor);
  38466. smalltalk.addMethod(
  38467. smalltalk.method({
  38468. selector: "visitIRSequence:",
  38469. protocol: 'visiting',
  38470. fn: function (anIRSequence){
  38471. var self=this;
  38472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38473. return smalltalk.withContext(function($ctx1) {
  38474. //>>excludeEnd("ctx");
  38475. var $1;
  38476. $1=self._visitIRInstruction_(anIRSequence);
  38477. return $1;
  38478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38479. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRVisitor)});
  38480. //>>excludeEnd("ctx");
  38481. },
  38482. //>>excludeStart("ide", pragmas.excludeIdeData);
  38483. args: ["anIRSequence"],
  38484. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  38485. referencedClasses: [],
  38486. //>>excludeEnd("ide");
  38487. messageSends: ["visitIRInstruction:"]
  38488. }),
  38489. globals.IRVisitor);
  38490. smalltalk.addMethod(
  38491. smalltalk.method({
  38492. selector: "visitIRTempDeclaration:",
  38493. protocol: 'visiting',
  38494. fn: function (anIRTempDeclaration){
  38495. var self=this;
  38496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38497. return smalltalk.withContext(function($ctx1) {
  38498. //>>excludeEnd("ctx");
  38499. var $1;
  38500. $1=self._visitIRInstruction_(anIRTempDeclaration);
  38501. return $1;
  38502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38503. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},globals.IRVisitor)});
  38504. //>>excludeEnd("ctx");
  38505. },
  38506. //>>excludeStart("ide", pragmas.excludeIdeData);
  38507. args: ["anIRTempDeclaration"],
  38508. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  38509. referencedClasses: [],
  38510. //>>excludeEnd("ide");
  38511. messageSends: ["visitIRInstruction:"]
  38512. }),
  38513. globals.IRVisitor);
  38514. smalltalk.addMethod(
  38515. smalltalk.method({
  38516. selector: "visitIRValue:",
  38517. protocol: 'visiting',
  38518. fn: function (anIRValue){
  38519. var self=this;
  38520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38521. return smalltalk.withContext(function($ctx1) {
  38522. //>>excludeEnd("ctx");
  38523. var $1;
  38524. $1=self._visitIRInstruction_(anIRValue);
  38525. return $1;
  38526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38527. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRVisitor)});
  38528. //>>excludeEnd("ctx");
  38529. },
  38530. //>>excludeStart("ide", pragmas.excludeIdeData);
  38531. args: ["anIRValue"],
  38532. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  38533. referencedClasses: [],
  38534. //>>excludeEnd("ide");
  38535. messageSends: ["visitIRInstruction:"]
  38536. }),
  38537. globals.IRVisitor);
  38538. smalltalk.addMethod(
  38539. smalltalk.method({
  38540. selector: "visitIRVariable:",
  38541. protocol: 'visiting',
  38542. fn: function (anIRVariable){
  38543. var self=this;
  38544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38545. return smalltalk.withContext(function($ctx1) {
  38546. //>>excludeEnd("ctx");
  38547. var $1;
  38548. $1=self._visitIRInstruction_(anIRVariable);
  38549. return $1;
  38550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38551. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRVisitor)});
  38552. //>>excludeEnd("ctx");
  38553. },
  38554. //>>excludeStart("ide", pragmas.excludeIdeData);
  38555. args: ["anIRVariable"],
  38556. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  38557. referencedClasses: [],
  38558. //>>excludeEnd("ide");
  38559. messageSends: ["visitIRInstruction:"]
  38560. }),
  38561. globals.IRVisitor);
  38562. smalltalk.addMethod(
  38563. smalltalk.method({
  38564. selector: "visitIRVerbatim:",
  38565. protocol: 'visiting',
  38566. fn: function (anIRVerbatim){
  38567. var self=this;
  38568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38569. return smalltalk.withContext(function($ctx1) {
  38570. //>>excludeEnd("ctx");
  38571. var $1;
  38572. $1=self._visitIRInstruction_(anIRVerbatim);
  38573. return $1;
  38574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38575. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRVisitor)});
  38576. //>>excludeEnd("ctx");
  38577. },
  38578. //>>excludeStart("ide", pragmas.excludeIdeData);
  38579. args: ["anIRVerbatim"],
  38580. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  38581. referencedClasses: [],
  38582. //>>excludeEnd("ide");
  38583. messageSends: ["visitIRInstruction:"]
  38584. }),
  38585. globals.IRVisitor);
  38586. smalltalk.addClass('IRJSTranslator', globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  38587. smalltalk.addMethod(
  38588. smalltalk.method({
  38589. selector: "contents",
  38590. protocol: 'accessing',
  38591. fn: function (){
  38592. var self=this;
  38593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38594. return smalltalk.withContext(function($ctx1) {
  38595. //>>excludeEnd("ctx");
  38596. var $1;
  38597. $1=_st(self._stream())._contents();
  38598. return $1;
  38599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38600. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.IRJSTranslator)});
  38601. //>>excludeEnd("ctx");
  38602. },
  38603. //>>excludeStart("ide", pragmas.excludeIdeData);
  38604. args: [],
  38605. source: "contents\x0a\x09^ self stream contents",
  38606. referencedClasses: [],
  38607. //>>excludeEnd("ide");
  38608. messageSends: ["contents", "stream"]
  38609. }),
  38610. globals.IRJSTranslator);
  38611. smalltalk.addMethod(
  38612. smalltalk.method({
  38613. selector: "currentClass",
  38614. protocol: 'accessing',
  38615. fn: function (){
  38616. var self=this;
  38617. var $1;
  38618. $1=self["@currentClass"];
  38619. return $1;
  38620. },
  38621. //>>excludeStart("ide", pragmas.excludeIdeData);
  38622. args: [],
  38623. source: "currentClass\x0a\x09^ currentClass",
  38624. referencedClasses: [],
  38625. //>>excludeEnd("ide");
  38626. messageSends: []
  38627. }),
  38628. globals.IRJSTranslator);
  38629. smalltalk.addMethod(
  38630. smalltalk.method({
  38631. selector: "currentClass:",
  38632. protocol: 'accessing',
  38633. fn: function (aClass){
  38634. var self=this;
  38635. self["@currentClass"]=aClass;
  38636. return self;
  38637. },
  38638. //>>excludeStart("ide", pragmas.excludeIdeData);
  38639. args: ["aClass"],
  38640. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  38641. referencedClasses: [],
  38642. //>>excludeEnd("ide");
  38643. messageSends: []
  38644. }),
  38645. globals.IRJSTranslator);
  38646. smalltalk.addMethod(
  38647. smalltalk.method({
  38648. selector: "initialize",
  38649. protocol: 'initialization',
  38650. fn: function (){
  38651. var self=this;
  38652. function $JSStream(){return globals.JSStream||(typeof JSStream=="undefined"?nil:JSStream)}
  38653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38654. return smalltalk.withContext(function($ctx1) {
  38655. //>>excludeEnd("ctx");
  38656. (
  38657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38658. $ctx1.supercall = true,
  38659. //>>excludeEnd("ctx");
  38660. globals.IRJSTranslator.superclass.fn.prototype._initialize.apply(_st(self), []));
  38661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38662. $ctx1.supercall = false;
  38663. //>>excludeEnd("ctx");;
  38664. self["@stream"]=_st($JSStream())._new();
  38665. return self;
  38666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38667. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.IRJSTranslator)});
  38668. //>>excludeEnd("ctx");
  38669. },
  38670. //>>excludeStart("ide", pragmas.excludeIdeData);
  38671. args: [],
  38672. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  38673. referencedClasses: ["JSStream"],
  38674. //>>excludeEnd("ide");
  38675. messageSends: ["initialize", "new"]
  38676. }),
  38677. globals.IRJSTranslator);
  38678. smalltalk.addMethod(
  38679. smalltalk.method({
  38680. selector: "stream",
  38681. protocol: 'accessing',
  38682. fn: function (){
  38683. var self=this;
  38684. var $1;
  38685. $1=self["@stream"];
  38686. return $1;
  38687. },
  38688. //>>excludeStart("ide", pragmas.excludeIdeData);
  38689. args: [],
  38690. source: "stream\x0a\x09^ stream",
  38691. referencedClasses: [],
  38692. //>>excludeEnd("ide");
  38693. messageSends: []
  38694. }),
  38695. globals.IRJSTranslator);
  38696. smalltalk.addMethod(
  38697. smalltalk.method({
  38698. selector: "stream:",
  38699. protocol: 'accessing',
  38700. fn: function (aStream){
  38701. var self=this;
  38702. self["@stream"]=aStream;
  38703. return self;
  38704. },
  38705. //>>excludeStart("ide", pragmas.excludeIdeData);
  38706. args: ["aStream"],
  38707. source: "stream: aStream\x0a\x09stream := aStream",
  38708. referencedClasses: [],
  38709. //>>excludeEnd("ide");
  38710. messageSends: []
  38711. }),
  38712. globals.IRJSTranslator);
  38713. smalltalk.addMethod(
  38714. smalltalk.method({
  38715. selector: "visitIRAssignment:",
  38716. protocol: 'visiting',
  38717. fn: function (anIRAssignment){
  38718. var self=this;
  38719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38720. return smalltalk.withContext(function($ctx1) {
  38721. //>>excludeEnd("ctx");
  38722. var $2,$1;
  38723. $2=_st(anIRAssignment)._instructions();
  38724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38725. $ctx1.sendIdx["instructions"]=1;
  38726. //>>excludeEnd("ctx");
  38727. $1=_st($2)._first();
  38728. self._visit_($1);
  38729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38730. $ctx1.sendIdx["visit:"]=1;
  38731. //>>excludeEnd("ctx");
  38732. _st(self._stream())._nextPutAssignment();
  38733. self._visit_(_st(_st(anIRAssignment)._instructions())._last());
  38734. return self;
  38735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38736. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRJSTranslator)});
  38737. //>>excludeEnd("ctx");
  38738. },
  38739. //>>excludeStart("ide", pragmas.excludeIdeData);
  38740. args: ["anIRAssignment"],
  38741. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  38742. referencedClasses: [],
  38743. //>>excludeEnd("ide");
  38744. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"]
  38745. }),
  38746. globals.IRJSTranslator);
  38747. smalltalk.addMethod(
  38748. smalltalk.method({
  38749. selector: "visitIRClosure:",
  38750. protocol: 'visiting',
  38751. fn: function (anIRClosure){
  38752. var self=this;
  38753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38754. return smalltalk.withContext(function($ctx1) {
  38755. //>>excludeEnd("ctx");
  38756. var $1,$2;
  38757. $1=self._stream();
  38758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38759. $ctx1.sendIdx["stream"]=1;
  38760. //>>excludeEnd("ctx");
  38761. _st($1)._nextPutClosureWith_arguments_((function(){
  38762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38763. return smalltalk.withContext(function($ctx2) {
  38764. //>>excludeEnd("ctx");
  38765. $2=self._stream();
  38766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38767. $ctx2.sendIdx["stream"]=2;
  38768. //>>excludeEnd("ctx");
  38769. _st($2)._nextPutVars_(_st(_st(anIRClosure)._tempDeclarations())._collect_((function(each){
  38770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38771. return smalltalk.withContext(function($ctx3) {
  38772. //>>excludeEnd("ctx");
  38773. return _st(_st(each)._name())._asVariableName();
  38774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38775. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38776. //>>excludeEnd("ctx");
  38777. })));
  38778. return _st(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  38779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38780. return smalltalk.withContext(function($ctx3) {
  38781. //>>excludeEnd("ctx");
  38782. return (
  38783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38784. $ctx3.supercall = true,
  38785. //>>excludeEnd("ctx");
  38786. globals.IRJSTranslator.superclass.fn.prototype._visitIRClosure_.apply(_st(self), [anIRClosure]));
  38787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38788. $ctx3.supercall = false;
  38789. //>>excludeEnd("ctx");;
  38790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38791. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  38792. //>>excludeEnd("ctx");
  38793. }));
  38794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38796. //>>excludeEnd("ctx");
  38797. }),_st(anIRClosure)._arguments());
  38798. return self;
  38799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38800. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},globals.IRJSTranslator)});
  38801. //>>excludeEnd("ctx");
  38802. },
  38803. //>>excludeStart("ide", pragmas.excludeIdeData);
  38804. args: ["anIRClosure"],
  38805. 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",
  38806. referencedClasses: [],
  38807. //>>excludeEnd("ide");
  38808. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  38809. }),
  38810. globals.IRJSTranslator);
  38811. smalltalk.addMethod(
  38812. smalltalk.method({
  38813. selector: "visitIRDynamicArray:",
  38814. protocol: 'visiting',
  38815. fn: function (anIRDynamicArray){
  38816. var self=this;
  38817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38818. return smalltalk.withContext(function($ctx1) {
  38819. //>>excludeEnd("ctx");
  38820. var $1;
  38821. $1=self._stream();
  38822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38823. $ctx1.sendIdx["stream"]=1;
  38824. //>>excludeEnd("ctx");
  38825. _st($1)._nextPutAll_("[");
  38826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38827. $ctx1.sendIdx["nextPutAll:"]=1;
  38828. //>>excludeEnd("ctx");
  38829. _st(_st(anIRDynamicArray)._instructions())._do_separatedBy_((function(each){
  38830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38831. return smalltalk.withContext(function($ctx2) {
  38832. //>>excludeEnd("ctx");
  38833. return self._visit_(each);
  38834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38835. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38836. //>>excludeEnd("ctx");
  38837. }),(function(){
  38838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38839. return smalltalk.withContext(function($ctx2) {
  38840. //>>excludeEnd("ctx");
  38841. return _st(self._stream())._nextPutAll_(",");
  38842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38843. $ctx2.sendIdx["nextPutAll:"]=2;
  38844. //>>excludeEnd("ctx");
  38845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38847. //>>excludeEnd("ctx");
  38848. }));
  38849. _st(self["@stream"])._nextPutAll_("]");
  38850. return self;
  38851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38852. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},globals.IRJSTranslator)});
  38853. //>>excludeEnd("ctx");
  38854. },
  38855. //>>excludeStart("ide", pragmas.excludeIdeData);
  38856. args: ["anIRDynamicArray"],
  38857. 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: ']'",
  38858. referencedClasses: [],
  38859. //>>excludeEnd("ide");
  38860. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38861. }),
  38862. globals.IRJSTranslator);
  38863. smalltalk.addMethod(
  38864. smalltalk.method({
  38865. selector: "visitIRDynamicDictionary:",
  38866. protocol: 'visiting',
  38867. fn: function (anIRDynamicDictionary){
  38868. var self=this;
  38869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38870. return smalltalk.withContext(function($ctx1) {
  38871. //>>excludeEnd("ctx");
  38872. var $1,$2;
  38873. $1=self._stream();
  38874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38875. $ctx1.sendIdx["stream"]=1;
  38876. //>>excludeEnd("ctx");
  38877. _st($1)._nextPutAll_("globals.HashedCollection._newFromPairs_([");
  38878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38879. $ctx1.sendIdx["nextPutAll:"]=1;
  38880. //>>excludeEnd("ctx");
  38881. _st(_st(anIRDynamicDictionary)._instructions())._do_separatedBy_((function(each){
  38882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38883. return smalltalk.withContext(function($ctx2) {
  38884. //>>excludeEnd("ctx");
  38885. return self._visit_(each);
  38886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38887. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38888. //>>excludeEnd("ctx");
  38889. }),(function(){
  38890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38891. return smalltalk.withContext(function($ctx2) {
  38892. //>>excludeEnd("ctx");
  38893. $2=self._stream();
  38894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38895. $ctx2.sendIdx["stream"]=2;
  38896. //>>excludeEnd("ctx");
  38897. return _st($2)._nextPutAll_(",");
  38898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38899. $ctx2.sendIdx["nextPutAll:"]=2;
  38900. //>>excludeEnd("ctx");
  38901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38903. //>>excludeEnd("ctx");
  38904. }));
  38905. _st(self._stream())._nextPutAll_("])");
  38906. return self;
  38907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38908. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},globals.IRJSTranslator)});
  38909. //>>excludeEnd("ctx");
  38910. },
  38911. //>>excludeStart("ide", pragmas.excludeIdeData);
  38912. args: ["anIRDynamicDictionary"],
  38913. 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: '])'",
  38914. referencedClasses: [],
  38915. //>>excludeEnd("ide");
  38916. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "instructions", "visit:"]
  38917. }),
  38918. globals.IRJSTranslator);
  38919. smalltalk.addMethod(
  38920. smalltalk.method({
  38921. selector: "visitIRMethod:",
  38922. protocol: 'visiting',
  38923. fn: function (anIRMethod){
  38924. var self=this;
  38925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38926. return smalltalk.withContext(function($ctx1) {
  38927. //>>excludeEnd("ctx");
  38928. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10;
  38929. $1=self._stream();
  38930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38931. $ctx1.sendIdx["stream"]=1;
  38932. //>>excludeEnd("ctx");
  38933. _st($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38935. return smalltalk.withContext(function($ctx2) {
  38936. //>>excludeEnd("ctx");
  38937. $2=self._stream();
  38938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38939. $ctx2.sendIdx["stream"]=2;
  38940. //>>excludeEnd("ctx");
  38941. return _st($2)._nextPutFunctionWith_arguments_((function(){
  38942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38943. return smalltalk.withContext(function($ctx3) {
  38944. //>>excludeEnd("ctx");
  38945. $3=self._stream();
  38946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38947. $ctx3.sendIdx["stream"]=3;
  38948. //>>excludeEnd("ctx");
  38949. $4=_st(_st(anIRMethod)._tempDeclarations())._collect_((function(each){
  38950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38951. return smalltalk.withContext(function($ctx4) {
  38952. //>>excludeEnd("ctx");
  38953. return _st(_st(each)._name())._asVariableName();
  38954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38955. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38956. //>>excludeEnd("ctx");
  38957. }));
  38958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38959. $ctx3.sendIdx["collect:"]=1;
  38960. //>>excludeEnd("ctx");
  38961. _st($3)._nextPutVars_($4);
  38962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38963. $ctx3.sendIdx["nextPutVars:"]=1;
  38964. //>>excludeEnd("ctx");
  38965. _st(_st(anIRMethod)._classReferences())._do_((function(each){
  38966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38967. return smalltalk.withContext(function($ctx4) {
  38968. //>>excludeEnd("ctx");
  38969. $5=self._stream();
  38970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38971. $ctx4.sendIdx["stream"]=4;
  38972. //>>excludeEnd("ctx");
  38973. return _st($5)._nextPutClassRefFunction_(each);
  38974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38975. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,4)});
  38976. //>>excludeEnd("ctx");
  38977. }));
  38978. $6=self._stream();
  38979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38980. $ctx3.sendIdx["stream"]=5;
  38981. //>>excludeEnd("ctx");
  38982. return _st($6)._nextPutContextFor_during_(anIRMethod,(function(){
  38983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38984. return smalltalk.withContext(function($ctx4) {
  38985. //>>excludeEnd("ctx");
  38986. $8=_st(anIRMethod)._internalVariables();
  38987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38988. $ctx4.sendIdx["internalVariables"]=1;
  38989. //>>excludeEnd("ctx");
  38990. $7=_st($8)._notEmpty();
  38991. if(smalltalk.assert($7)){
  38992. $9=self._stream();
  38993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38994. $ctx4.sendIdx["stream"]=6;
  38995. //>>excludeEnd("ctx");
  38996. _st($9)._nextPutVars_(_st(_st(_st(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  38997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38998. return smalltalk.withContext(function($ctx5) {
  38999. //>>excludeEnd("ctx");
  39000. return _st(_st(each)._variable())._alias();
  39001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39002. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,7)});
  39003. //>>excludeEnd("ctx");
  39004. })));
  39005. };
  39006. $10=_st(_st(anIRMethod)._scope())._hasNonLocalReturn();
  39007. if(smalltalk.assert($10)){
  39008. return _st(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  39009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39010. return smalltalk.withContext(function($ctx5) {
  39011. //>>excludeEnd("ctx");
  39012. return (
  39013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39014. $ctx5.supercall = true,
  39015. //>>excludeEnd("ctx");
  39016. globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  39017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39018. $ctx5.supercall = false;
  39019. //>>excludeEnd("ctx");;
  39020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39021. $ctx5.sendIdx["visitIRMethod:"]=1;
  39022. //>>excludeEnd("ctx");
  39023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39024. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,9)});
  39025. //>>excludeEnd("ctx");
  39026. }));
  39027. } else {
  39028. return (
  39029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39030. $ctx4.supercall = true,
  39031. //>>excludeEnd("ctx");
  39032. globals.IRJSTranslator.superclass.fn.prototype._visitIRMethod_.apply(_st(self), [anIRMethod]));
  39033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39034. $ctx4.supercall = false;
  39035. //>>excludeEnd("ctx");;
  39036. };
  39037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39038. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  39039. //>>excludeEnd("ctx");
  39040. }));
  39041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39042. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39043. //>>excludeEnd("ctx");
  39044. }),_st(anIRMethod)._arguments());
  39045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39047. //>>excludeEnd("ctx");
  39048. }));
  39049. return self;
  39050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39051. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},globals.IRJSTranslator)});
  39052. //>>excludeEnd("ctx");
  39053. },
  39054. //>>excludeStart("ide", pragmas.excludeIdeData);
  39055. args: ["anIRMethod"],
  39056. 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 ]",
  39057. referencedClasses: [],
  39058. //>>excludeEnd("ide");
  39059. 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"]
  39060. }),
  39061. globals.IRJSTranslator);
  39062. smalltalk.addMethod(
  39063. smalltalk.method({
  39064. selector: "visitIRNonLocalReturn:",
  39065. protocol: 'visiting',
  39066. fn: function (anIRNonLocalReturn){
  39067. var self=this;
  39068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39069. return smalltalk.withContext(function($ctx1) {
  39070. //>>excludeEnd("ctx");
  39071. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  39072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39073. return smalltalk.withContext(function($ctx2) {
  39074. //>>excludeEnd("ctx");
  39075. return (
  39076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39077. $ctx2.supercall = true,
  39078. //>>excludeEnd("ctx");
  39079. globals.IRJSTranslator.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  39080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39081. $ctx2.supercall = false;
  39082. //>>excludeEnd("ctx");;
  39083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39085. //>>excludeEnd("ctx");
  39086. }));
  39087. return self;
  39088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39089. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRJSTranslator)});
  39090. //>>excludeEnd("ctx");
  39091. },
  39092. //>>excludeStart("ide", pragmas.excludeIdeData);
  39093. args: ["anIRNonLocalReturn"],
  39094. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  39095. referencedClasses: [],
  39096. //>>excludeEnd("ide");
  39097. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  39098. }),
  39099. globals.IRJSTranslator);
  39100. smalltalk.addMethod(
  39101. smalltalk.method({
  39102. selector: "visitIRReturn:",
  39103. protocol: 'visiting',
  39104. fn: function (anIRReturn){
  39105. var self=this;
  39106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39107. return smalltalk.withContext(function($ctx1) {
  39108. //>>excludeEnd("ctx");
  39109. _st(self._stream())._nextPutReturnWith_((function(){
  39110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39111. return smalltalk.withContext(function($ctx2) {
  39112. //>>excludeEnd("ctx");
  39113. return (
  39114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39115. $ctx2.supercall = true,
  39116. //>>excludeEnd("ctx");
  39117. globals.IRJSTranslator.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  39118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39119. $ctx2.supercall = false;
  39120. //>>excludeEnd("ctx");;
  39121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39123. //>>excludeEnd("ctx");
  39124. }));
  39125. return self;
  39126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39127. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRJSTranslator)});
  39128. //>>excludeEnd("ctx");
  39129. },
  39130. //>>excludeStart("ide", pragmas.excludeIdeData);
  39131. args: ["anIRReturn"],
  39132. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  39133. referencedClasses: [],
  39134. //>>excludeEnd("ide");
  39135. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  39136. }),
  39137. globals.IRJSTranslator);
  39138. smalltalk.addMethod(
  39139. smalltalk.method({
  39140. selector: "visitIRSend:",
  39141. protocol: 'visiting',
  39142. fn: function (anIRSend){
  39143. var self=this;
  39144. var sends;
  39145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39146. return smalltalk.withContext(function($ctx1) {
  39147. //>>excludeEnd("ctx");
  39148. var $1,$2,$receiver;
  39149. sends=_st(_st(_st(_st(anIRSend)._method())._sendIndexes())._at_(_st(anIRSend)._selector()))._size();
  39150. $1=_st(anIRSend)._classSend();
  39151. if(($receiver = $1) == null || $receiver.isNil){
  39152. self._visitSend_(anIRSend);
  39153. } else {
  39154. self._visitSuperSend_(anIRSend);
  39155. };
  39156. $2=_st(_st(sends).__gt((1)))._and_((function(){
  39157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39158. return smalltalk.withContext(function($ctx2) {
  39159. //>>excludeEnd("ctx");
  39160. return _st(_st(anIRSend)._index()).__lt(sends);
  39161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39163. //>>excludeEnd("ctx");
  39164. }));
  39165. if(smalltalk.assert($2)){
  39166. _st(self._stream())._nextPutSendIndexFor_(anIRSend);
  39167. };
  39168. return self;
  39169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39170. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends},globals.IRJSTranslator)});
  39171. //>>excludeEnd("ctx");
  39172. },
  39173. //>>excludeStart("ide", pragmas.excludeIdeData);
  39174. args: ["anIRSend"],
  39175. 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 ]",
  39176. referencedClasses: [],
  39177. //>>excludeEnd("ide");
  39178. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifNil:ifNotNil:", "classSend", "visitSend:", "visitSuperSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  39179. }),
  39180. globals.IRJSTranslator);
  39181. smalltalk.addMethod(
  39182. smalltalk.method({
  39183. selector: "visitIRSequence:",
  39184. protocol: 'visiting',
  39185. fn: function (anIRSequence){
  39186. var self=this;
  39187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39188. return smalltalk.withContext(function($ctx1) {
  39189. //>>excludeEnd("ctx");
  39190. var $1;
  39191. $1=self._stream();
  39192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39193. $ctx1.sendIdx["stream"]=1;
  39194. //>>excludeEnd("ctx");
  39195. _st($1)._nextPutSequenceWith_((function(){
  39196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39197. return smalltalk.withContext(function($ctx2) {
  39198. //>>excludeEnd("ctx");
  39199. return _st(_st(anIRSequence)._instructions())._do_((function(each){
  39200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39201. return smalltalk.withContext(function($ctx3) {
  39202. //>>excludeEnd("ctx");
  39203. return _st(self._stream())._nextPutStatementWith_(self._visit_(each));
  39204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39205. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39206. //>>excludeEnd("ctx");
  39207. }));
  39208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39210. //>>excludeEnd("ctx");
  39211. }));
  39212. return self;
  39213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39214. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},globals.IRJSTranslator)});
  39215. //>>excludeEnd("ctx");
  39216. },
  39217. //>>excludeStart("ide", pragmas.excludeIdeData);
  39218. args: ["anIRSequence"],
  39219. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  39220. referencedClasses: [],
  39221. //>>excludeEnd("ide");
  39222. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  39223. }),
  39224. globals.IRJSTranslator);
  39225. smalltalk.addMethod(
  39226. smalltalk.method({
  39227. selector: "visitIRTempDeclaration:",
  39228. protocol: 'visiting',
  39229. fn: function (anIRTempDeclaration){
  39230. var self=this;
  39231. return self;
  39232. },
  39233. //>>excludeStart("ide", pragmas.excludeIdeData);
  39234. args: ["anIRTempDeclaration"],
  39235. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  39236. referencedClasses: [],
  39237. //>>excludeEnd("ide");
  39238. messageSends: []
  39239. }),
  39240. globals.IRJSTranslator);
  39241. smalltalk.addMethod(
  39242. smalltalk.method({
  39243. selector: "visitIRValue:",
  39244. protocol: 'visiting',
  39245. fn: function (anIRValue){
  39246. var self=this;
  39247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39248. return smalltalk.withContext(function($ctx1) {
  39249. //>>excludeEnd("ctx");
  39250. _st(self._stream())._nextPutAll_(_st(_st(anIRValue)._value())._asJavascript());
  39251. return self;
  39252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39253. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},globals.IRJSTranslator)});
  39254. //>>excludeEnd("ctx");
  39255. },
  39256. //>>excludeStart("ide", pragmas.excludeIdeData);
  39257. args: ["anIRValue"],
  39258. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  39259. referencedClasses: [],
  39260. //>>excludeEnd("ide");
  39261. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  39262. }),
  39263. globals.IRJSTranslator);
  39264. smalltalk.addMethod(
  39265. smalltalk.method({
  39266. selector: "visitIRVariable:",
  39267. protocol: 'visiting',
  39268. fn: function (anIRVariable){
  39269. var self=this;
  39270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39271. return smalltalk.withContext(function($ctx1) {
  39272. //>>excludeEnd("ctx");
  39273. var $3,$2,$1,$4;
  39274. $3=_st(anIRVariable)._variable();
  39275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39276. $ctx1.sendIdx["variable"]=1;
  39277. //>>excludeEnd("ctx");
  39278. $2=_st($3)._name();
  39279. $1=_st($2).__eq("thisContext");
  39280. if(smalltalk.assert($1)){
  39281. $4=self._stream();
  39282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39283. $ctx1.sendIdx["stream"]=1;
  39284. //>>excludeEnd("ctx");
  39285. _st($4)._nextPutAll_("smalltalk.getThisContext()");
  39286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39287. $ctx1.sendIdx["nextPutAll:"]=1;
  39288. //>>excludeEnd("ctx");
  39289. } else {
  39290. _st(self._stream())._nextPutAll_(_st(_st(anIRVariable)._variable())._alias());
  39291. };
  39292. return self;
  39293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39294. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},globals.IRJSTranslator)});
  39295. //>>excludeEnd("ctx");
  39296. },
  39297. //>>excludeStart("ide", pragmas.excludeIdeData);
  39298. args: ["anIRVariable"],
  39299. 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 ]",
  39300. referencedClasses: [],
  39301. //>>excludeEnd("ide");
  39302. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  39303. }),
  39304. globals.IRJSTranslator);
  39305. smalltalk.addMethod(
  39306. smalltalk.method({
  39307. selector: "visitIRVerbatim:",
  39308. protocol: 'visiting',
  39309. fn: function (anIRVerbatim){
  39310. var self=this;
  39311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39312. return smalltalk.withContext(function($ctx1) {
  39313. //>>excludeEnd("ctx");
  39314. var $1;
  39315. $1=self._stream();
  39316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39317. $ctx1.sendIdx["stream"]=1;
  39318. //>>excludeEnd("ctx");
  39319. _st($1)._nextPutStatementWith_((function(){
  39320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39321. return smalltalk.withContext(function($ctx2) {
  39322. //>>excludeEnd("ctx");
  39323. return _st(self._stream())._nextPutAll_(_st(anIRVerbatim)._source());
  39324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39326. //>>excludeEnd("ctx");
  39327. }));
  39328. return self;
  39329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39330. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},globals.IRJSTranslator)});
  39331. //>>excludeEnd("ctx");
  39332. },
  39333. //>>excludeStart("ide", pragmas.excludeIdeData);
  39334. args: ["anIRVerbatim"],
  39335. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  39336. referencedClasses: [],
  39337. //>>excludeEnd("ide");
  39338. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  39339. }),
  39340. globals.IRJSTranslator);
  39341. smalltalk.addMethod(
  39342. smalltalk.method({
  39343. selector: "visitReceiver:",
  39344. protocol: 'visiting',
  39345. fn: function (anIRInstruction){
  39346. var self=this;
  39347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39348. return smalltalk.withContext(function($ctx1) {
  39349. //>>excludeEnd("ctx");
  39350. var $1,$2,$3;
  39351. $1=_st(anIRInstruction)._needsBoxingAsReceiver();
  39352. if(! smalltalk.assert($1)){
  39353. $2=self._visit_(anIRInstruction);
  39354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39355. $ctx1.sendIdx["visit:"]=1;
  39356. //>>excludeEnd("ctx");
  39357. return $2;
  39358. };
  39359. $3=self._stream();
  39360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39361. $ctx1.sendIdx["stream"]=1;
  39362. //>>excludeEnd("ctx");
  39363. _st($3)._nextPutAll_("_st(");
  39364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39365. $ctx1.sendIdx["nextPutAll:"]=1;
  39366. //>>excludeEnd("ctx");
  39367. self._visit_(anIRInstruction);
  39368. _st(self._stream())._nextPutAll_(")");
  39369. return self;
  39370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39371. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},globals.IRJSTranslator)});
  39372. //>>excludeEnd("ctx");
  39373. },
  39374. //>>excludeStart("ide", pragmas.excludeIdeData);
  39375. args: ["anIRInstruction"],
  39376. 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: ')'",
  39377. referencedClasses: [],
  39378. //>>excludeEnd("ide");
  39379. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  39380. }),
  39381. globals.IRJSTranslator);
  39382. smalltalk.addMethod(
  39383. smalltalk.method({
  39384. selector: "visitSend:",
  39385. protocol: 'visiting',
  39386. fn: function (anIRSend){
  39387. var self=this;
  39388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39389. return smalltalk.withContext(function($ctx1) {
  39390. //>>excludeEnd("ctx");
  39391. var $2,$1,$3,$4,$5;
  39392. $2=_st(anIRSend)._instructions();
  39393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39394. $ctx1.sendIdx["instructions"]=1;
  39395. //>>excludeEnd("ctx");
  39396. $1=_st($2)._first();
  39397. self._visitReceiver_($1);
  39398. $3=self._stream();
  39399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39400. $ctx1.sendIdx["stream"]=1;
  39401. //>>excludeEnd("ctx");
  39402. $4=_st(".".__comma(_st(_st(anIRSend)._selector())._asJavaScriptMethodName())).__comma("(");
  39403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39404. $ctx1.sendIdx[","]=1;
  39405. //>>excludeEnd("ctx");
  39406. _st($3)._nextPutAll_($4);
  39407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39408. $ctx1.sendIdx["nextPutAll:"]=1;
  39409. //>>excludeEnd("ctx");
  39410. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39412. return smalltalk.withContext(function($ctx2) {
  39413. //>>excludeEnd("ctx");
  39414. return self._visit_(each);
  39415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39417. //>>excludeEnd("ctx");
  39418. }),(function(){
  39419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39420. return smalltalk.withContext(function($ctx2) {
  39421. //>>excludeEnd("ctx");
  39422. $5=self._stream();
  39423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39424. $ctx2.sendIdx["stream"]=2;
  39425. //>>excludeEnd("ctx");
  39426. return _st($5)._nextPutAll_(",");
  39427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39428. $ctx2.sendIdx["nextPutAll:"]=2;
  39429. //>>excludeEnd("ctx");
  39430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39432. //>>excludeEnd("ctx");
  39433. }));
  39434. _st(self._stream())._nextPutAll_(")");
  39435. return self;
  39436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39437. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  39438. //>>excludeEnd("ctx");
  39439. },
  39440. //>>excludeStart("ide", pragmas.excludeIdeData);
  39441. args: ["anIRSend"],
  39442. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName, '('.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ')'",
  39443. referencedClasses: [],
  39444. //>>excludeEnd("ide");
  39445. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "do:separatedBy:", "allButFirst", "visit:"]
  39446. }),
  39447. globals.IRJSTranslator);
  39448. smalltalk.addMethod(
  39449. smalltalk.method({
  39450. selector: "visitSuperSend:",
  39451. protocol: 'visiting',
  39452. fn: function (anIRSend){
  39453. var self=this;
  39454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39455. return smalltalk.withContext(function($ctx1) {
  39456. //>>excludeEnd("ctx");
  39457. var $1,$2,$5,$4,$3,$6,$7,$8,$10,$9,$11,$12,$13,$14;
  39458. $1=self._stream();
  39459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39460. $ctx1.sendIdx["stream"]=1;
  39461. //>>excludeEnd("ctx");
  39462. _st($1)._nextPutAll_("(");
  39463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39464. $ctx1.sendIdx["nextPutAll:"]=1;
  39465. //>>excludeEnd("ctx");
  39466. _st($1)._lf();
  39467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39468. $ctx1.sendIdx["lf"]=1;
  39469. //>>excludeEnd("ctx");
  39470. _st($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39472. $ctx1.sendIdx["nextPutAll:"]=2;
  39473. //>>excludeEnd("ctx");
  39474. _st($1)._lf();
  39475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39476. $ctx1.sendIdx["lf"]=2;
  39477. //>>excludeEnd("ctx");
  39478. $2=$1;
  39479. $5=_st(anIRSend)._scope();
  39480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39481. $ctx1.sendIdx["scope"]=1;
  39482. //>>excludeEnd("ctx");
  39483. $4=_st($5)._alias();
  39484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39485. $ctx1.sendIdx["alias"]=1;
  39486. //>>excludeEnd("ctx");
  39487. $3=_st($4).__comma(".supercall = true, ");
  39488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39489. $ctx1.sendIdx[","]=1;
  39490. //>>excludeEnd("ctx");
  39491. _st($2)._nextPutAll_($3);
  39492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39493. $ctx1.sendIdx["nextPutAll:"]=3;
  39494. //>>excludeEnd("ctx");
  39495. _st($1)._lf();
  39496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39497. $ctx1.sendIdx["lf"]=3;
  39498. //>>excludeEnd("ctx");
  39499. _st($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39501. $ctx1.sendIdx["nextPutAll:"]=4;
  39502. //>>excludeEnd("ctx");
  39503. _st($1)._lf();
  39504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39505. $ctx1.sendIdx["lf"]=4;
  39506. //>>excludeEnd("ctx");
  39507. _st($1)._nextPutAll_(_st(self._currentClass())._asJavascript());
  39508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39509. $ctx1.sendIdx["nextPutAll:"]=5;
  39510. //>>excludeEnd("ctx");
  39511. _st($1)._nextPutAll_(".superclass.fn.prototype.");
  39512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39513. $ctx1.sendIdx["nextPutAll:"]=6;
  39514. //>>excludeEnd("ctx");
  39515. $6=$1;
  39516. $7=_st(_st(_st(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  39517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39518. $ctx1.sendIdx[","]=2;
  39519. //>>excludeEnd("ctx");
  39520. _st($6)._nextPutAll_($7);
  39521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39522. $ctx1.sendIdx["nextPutAll:"]=7;
  39523. //>>excludeEnd("ctx");
  39524. $8=_st($1)._nextPutAll_("_st(");
  39525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39526. $ctx1.sendIdx["nextPutAll:"]=8;
  39527. //>>excludeEnd("ctx");
  39528. $10=_st(anIRSend)._instructions();
  39529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39530. $ctx1.sendIdx["instructions"]=1;
  39531. //>>excludeEnd("ctx");
  39532. $9=_st($10)._first();
  39533. self._visit_($9);
  39534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39535. $ctx1.sendIdx["visit:"]=1;
  39536. //>>excludeEnd("ctx");
  39537. $11=self._stream();
  39538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39539. $ctx1.sendIdx["stream"]=2;
  39540. //>>excludeEnd("ctx");
  39541. _st($11)._nextPutAll_("), [");
  39542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39543. $ctx1.sendIdx["nextPutAll:"]=9;
  39544. //>>excludeEnd("ctx");
  39545. _st(_st(_st(anIRSend)._instructions())._allButFirst())._do_separatedBy_((function(each){
  39546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39547. return smalltalk.withContext(function($ctx2) {
  39548. //>>excludeEnd("ctx");
  39549. return self._visit_(each);
  39550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39552. //>>excludeEnd("ctx");
  39553. }),(function(){
  39554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39555. return smalltalk.withContext(function($ctx2) {
  39556. //>>excludeEnd("ctx");
  39557. $12=self._stream();
  39558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39559. $ctx2.sendIdx["stream"]=3;
  39560. //>>excludeEnd("ctx");
  39561. return _st($12)._nextPutAll_(",");
  39562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39563. $ctx2.sendIdx["nextPutAll:"]=10;
  39564. //>>excludeEnd("ctx");
  39565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39567. //>>excludeEnd("ctx");
  39568. }));
  39569. $13=self._stream();
  39570. _st($13)._nextPutAll_("]));");
  39571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39572. $ctx1.sendIdx["nextPutAll:"]=11;
  39573. //>>excludeEnd("ctx");
  39574. _st($13)._lf();
  39575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39576. $ctx1.sendIdx["lf"]=5;
  39577. //>>excludeEnd("ctx");
  39578. _st($13)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39580. $ctx1.sendIdx["nextPutAll:"]=12;
  39581. //>>excludeEnd("ctx");
  39582. _st($13)._lf();
  39583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39584. $ctx1.sendIdx["lf"]=6;
  39585. //>>excludeEnd("ctx");
  39586. _st($13)._nextPutAll_(_st(_st(_st(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  39587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39588. $ctx1.sendIdx["nextPutAll:"]=13;
  39589. //>>excludeEnd("ctx");
  39590. _st($13)._lf();
  39591. $14=_st($13)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39592. return self;
  39593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39594. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},globals.IRJSTranslator)});
  39595. //>>excludeEnd("ctx");
  39596. },
  39597. //>>excludeStart("ide", pragmas.excludeIdeData);
  39598. args: ["anIRSend"],
  39599. source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true, '; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass.fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.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: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39600. referencedClasses: [],
  39601. //>>excludeEnd("ide");
  39602. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visit:", "first", "instructions", "do:separatedBy:", "allButFirst"]
  39603. }),
  39604. globals.IRJSTranslator);
  39605. smalltalk.addClass('JSStream', globals.Object, ['stream'], 'Compiler-IR');
  39606. smalltalk.addMethod(
  39607. smalltalk.method({
  39608. selector: "contents",
  39609. protocol: 'accessing',
  39610. fn: function (){
  39611. var self=this;
  39612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39613. return smalltalk.withContext(function($ctx1) {
  39614. //>>excludeEnd("ctx");
  39615. var $1;
  39616. $1=_st(self["@stream"])._contents();
  39617. return $1;
  39618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39619. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.JSStream)});
  39620. //>>excludeEnd("ctx");
  39621. },
  39622. //>>excludeStart("ide", pragmas.excludeIdeData);
  39623. args: [],
  39624. source: "contents\x0a\x09^ stream contents",
  39625. referencedClasses: [],
  39626. //>>excludeEnd("ide");
  39627. messageSends: ["contents"]
  39628. }),
  39629. globals.JSStream);
  39630. smalltalk.addMethod(
  39631. smalltalk.method({
  39632. selector: "initialize",
  39633. protocol: 'initialization',
  39634. fn: function (){
  39635. var self=this;
  39636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39637. return smalltalk.withContext(function($ctx1) {
  39638. //>>excludeEnd("ctx");
  39639. (
  39640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39641. $ctx1.supercall = true,
  39642. //>>excludeEnd("ctx");
  39643. globals.JSStream.superclass.fn.prototype._initialize.apply(_st(self), []));
  39644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39645. $ctx1.supercall = false;
  39646. //>>excludeEnd("ctx");;
  39647. self["@stream"]=""._writeStream();
  39648. return self;
  39649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39650. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.JSStream)});
  39651. //>>excludeEnd("ctx");
  39652. },
  39653. //>>excludeStart("ide", pragmas.excludeIdeData);
  39654. args: [],
  39655. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  39656. referencedClasses: [],
  39657. //>>excludeEnd("ide");
  39658. messageSends: ["initialize", "writeStream"]
  39659. }),
  39660. globals.JSStream);
  39661. smalltalk.addMethod(
  39662. smalltalk.method({
  39663. selector: "lf",
  39664. protocol: 'streaming',
  39665. fn: function (){
  39666. var self=this;
  39667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39668. return smalltalk.withContext(function($ctx1) {
  39669. //>>excludeEnd("ctx");
  39670. _st(self["@stream"])._lf();
  39671. return self;
  39672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39673. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.JSStream)});
  39674. //>>excludeEnd("ctx");
  39675. },
  39676. //>>excludeStart("ide", pragmas.excludeIdeData);
  39677. args: [],
  39678. source: "lf\x0a\x09stream lf",
  39679. referencedClasses: [],
  39680. //>>excludeEnd("ide");
  39681. messageSends: ["lf"]
  39682. }),
  39683. globals.JSStream);
  39684. smalltalk.addMethod(
  39685. smalltalk.method({
  39686. selector: "nextPut:",
  39687. protocol: 'streaming',
  39688. fn: function (aString){
  39689. var self=this;
  39690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39691. return smalltalk.withContext(function($ctx1) {
  39692. //>>excludeEnd("ctx");
  39693. _st(self["@stream"])._nextPut_(aString);
  39694. return self;
  39695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39696. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.JSStream)});
  39697. //>>excludeEnd("ctx");
  39698. },
  39699. //>>excludeStart("ide", pragmas.excludeIdeData);
  39700. args: ["aString"],
  39701. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  39702. referencedClasses: [],
  39703. //>>excludeEnd("ide");
  39704. messageSends: ["nextPut:"]
  39705. }),
  39706. globals.JSStream);
  39707. smalltalk.addMethod(
  39708. smalltalk.method({
  39709. selector: "nextPutAll:",
  39710. protocol: 'streaming',
  39711. fn: function (aString){
  39712. var self=this;
  39713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39714. return smalltalk.withContext(function($ctx1) {
  39715. //>>excludeEnd("ctx");
  39716. _st(self["@stream"])._nextPutAll_(aString);
  39717. return self;
  39718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39719. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},globals.JSStream)});
  39720. //>>excludeEnd("ctx");
  39721. },
  39722. //>>excludeStart("ide", pragmas.excludeIdeData);
  39723. args: ["aString"],
  39724. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  39725. referencedClasses: [],
  39726. //>>excludeEnd("ide");
  39727. messageSends: ["nextPutAll:"]
  39728. }),
  39729. globals.JSStream);
  39730. smalltalk.addMethod(
  39731. smalltalk.method({
  39732. selector: "nextPutAssignment",
  39733. protocol: 'streaming',
  39734. fn: function (){
  39735. var self=this;
  39736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39737. return smalltalk.withContext(function($ctx1) {
  39738. //>>excludeEnd("ctx");
  39739. _st(self["@stream"])._nextPutAll_("=");
  39740. return self;
  39741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39742. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignment",{},globals.JSStream)});
  39743. //>>excludeEnd("ctx");
  39744. },
  39745. //>>excludeStart("ide", pragmas.excludeIdeData);
  39746. args: [],
  39747. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  39748. referencedClasses: [],
  39749. //>>excludeEnd("ide");
  39750. messageSends: ["nextPutAll:"]
  39751. }),
  39752. globals.JSStream);
  39753. smalltalk.addMethod(
  39754. smalltalk.method({
  39755. selector: "nextPutBlockContextFor:during:",
  39756. protocol: 'streaming',
  39757. fn: function (anIRClosure,aBlock){
  39758. var self=this;
  39759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39760. return smalltalk.withContext(function($ctx1) {
  39761. //>>excludeEnd("ctx");
  39762. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18,$24;
  39763. $1=_st(anIRClosure)._requiresSmalltalkContext();
  39764. if(! smalltalk.assert($1)){
  39765. $2=_st(aBlock)._value();
  39766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39767. $ctx1.sendIdx["value"]=1;
  39768. //>>excludeEnd("ctx");
  39769. return $2;
  39770. };
  39771. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39773. $ctx1.sendIdx["nextPutAll:"]=1;
  39774. //>>excludeEnd("ctx");
  39775. self._lf();
  39776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39777. $ctx1.sendIdx["lf"]=1;
  39778. //>>excludeEnd("ctx");
  39779. $6=_st(anIRClosure)._scope();
  39780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39781. $ctx1.sendIdx["scope"]=1;
  39782. //>>excludeEnd("ctx");
  39783. $5=_st($6)._alias();
  39784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39785. $ctx1.sendIdx["alias"]=1;
  39786. //>>excludeEnd("ctx");
  39787. $4="return smalltalk.withContext(function(".__comma($5);
  39788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39789. $ctx1.sendIdx[","]=2;
  39790. //>>excludeEnd("ctx");
  39791. $3=_st($4).__comma(") {");
  39792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39793. $ctx1.sendIdx[","]=1;
  39794. //>>excludeEnd("ctx");
  39795. self._nextPutAll_($3);
  39796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39797. $ctx1.sendIdx["nextPutAll:"]=2;
  39798. //>>excludeEnd("ctx");
  39799. self._lf();
  39800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39801. $ctx1.sendIdx["lf"]=2;
  39802. //>>excludeEnd("ctx");
  39803. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39805. $ctx1.sendIdx["nextPutAll:"]=3;
  39806. //>>excludeEnd("ctx");
  39807. $7=self._lf();
  39808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39809. $ctx1.sendIdx["lf"]=3;
  39810. //>>excludeEnd("ctx");
  39811. _st(aBlock)._value();
  39812. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39814. $ctx1.sendIdx["nextPutAll:"]=4;
  39815. //>>excludeEnd("ctx");
  39816. self._lf();
  39817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39818. $ctx1.sendIdx["lf"]=4;
  39819. //>>excludeEnd("ctx");
  39820. $11=_st(anIRClosure)._scope();
  39821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39822. $ctx1.sendIdx["scope"]=2;
  39823. //>>excludeEnd("ctx");
  39824. $10=_st($11)._alias();
  39825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39826. $ctx1.sendIdx["alias"]=2;
  39827. //>>excludeEnd("ctx");
  39828. $9="}, function(".__comma($10);
  39829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39830. $ctx1.sendIdx[","]=4;
  39831. //>>excludeEnd("ctx");
  39832. $8=_st($9).__comma(") {");
  39833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39834. $ctx1.sendIdx[","]=3;
  39835. //>>excludeEnd("ctx");
  39836. self._nextPutAll_($8);
  39837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39838. $ctx1.sendIdx["nextPutAll:"]=5;
  39839. //>>excludeEnd("ctx");
  39840. $15=_st(anIRClosure)._scope();
  39841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39842. $ctx1.sendIdx["scope"]=3;
  39843. //>>excludeEnd("ctx");
  39844. $14=_st($15)._alias();
  39845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39846. $ctx1.sendIdx["alias"]=3;
  39847. //>>excludeEnd("ctx");
  39848. $13=_st($14).__comma(".fillBlock({");
  39849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39850. $ctx1.sendIdx[","]=5;
  39851. //>>excludeEnd("ctx");
  39852. $12=self._nextPutAll_($13);
  39853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39854. $ctx1.sendIdx["nextPutAll:"]=6;
  39855. //>>excludeEnd("ctx");
  39856. _st(_st(anIRClosure)._locals())._do_separatedBy_((function(each){
  39857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39858. return smalltalk.withContext(function($ctx2) {
  39859. //>>excludeEnd("ctx");
  39860. $16=_st(each)._asVariableName();
  39861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39862. $ctx2.sendIdx["asVariableName"]=1;
  39863. //>>excludeEnd("ctx");
  39864. self._nextPutAll_($16);
  39865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39866. $ctx2.sendIdx["nextPutAll:"]=7;
  39867. //>>excludeEnd("ctx");
  39868. self._nextPutAll_(":");
  39869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39870. $ctx2.sendIdx["nextPutAll:"]=8;
  39871. //>>excludeEnd("ctx");
  39872. $17=self._nextPutAll_(_st(each)._asVariableName());
  39873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39874. $ctx2.sendIdx["nextPutAll:"]=9;
  39875. //>>excludeEnd("ctx");
  39876. return $17;
  39877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39879. //>>excludeEnd("ctx");
  39880. }),(function(){
  39881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39882. return smalltalk.withContext(function($ctx2) {
  39883. //>>excludeEnd("ctx");
  39884. return self._nextPutAll_(",");
  39885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39886. $ctx2.sendIdx["nextPutAll:"]=10;
  39887. //>>excludeEnd("ctx");
  39888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39890. //>>excludeEnd("ctx");
  39891. }));
  39892. self._nextPutAll_("},");
  39893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39894. $ctx1.sendIdx["nextPutAll:"]=11;
  39895. //>>excludeEnd("ctx");
  39896. $23=_st(anIRClosure)._scope();
  39897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39898. $ctx1.sendIdx["scope"]=4;
  39899. //>>excludeEnd("ctx");
  39900. $22=_st($23)._outerScope();
  39901. $21=_st($22)._alias();
  39902. $20=_st($21).__comma(",");
  39903. $19=_st($20).__comma(_st(_st(_st(anIRClosure)._scope())._blockIndex())._asString());
  39904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39905. $ctx1.sendIdx[","]=7;
  39906. //>>excludeEnd("ctx");
  39907. $18=_st($19).__comma(")});");
  39908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39909. $ctx1.sendIdx[","]=6;
  39910. //>>excludeEnd("ctx");
  39911. self._nextPutAll_($18);
  39912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39913. $ctx1.sendIdx["nextPutAll:"]=12;
  39914. //>>excludeEnd("ctx");
  39915. self._lf();
  39916. $24=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  39917. return self;
  39918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39919. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},globals.JSStream)});
  39920. //>>excludeEnd("ctx");
  39921. },
  39922. //>>excludeStart("ide", pragmas.excludeIdeData);
  39923. args: ["anIRClosure", "aBlock"],
  39924. source: "nextPutBlockContextFor: anIRClosure during: aBlock\x0a\x09anIRClosure requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', anIRClosure scope alias, ') {';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x09\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\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, ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  39925. referencedClasses: [],
  39926. //>>excludeEnd("ide");
  39927. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  39928. }),
  39929. globals.JSStream);
  39930. smalltalk.addMethod(
  39931. smalltalk.method({
  39932. selector: "nextPutClassRefFunction:",
  39933. protocol: 'streaming',
  39934. fn: function (aString){
  39935. var self=this;
  39936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39937. return smalltalk.withContext(function($ctx1) {
  39938. //>>excludeEnd("ctx");
  39939. var $1,$2;
  39940. $1=self["@stream"];
  39941. _st($1)._nextPutAll_("function $");
  39942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39943. $ctx1.sendIdx["nextPutAll:"]=1;
  39944. //>>excludeEnd("ctx");
  39945. _st($1)._nextPutAll_(aString);
  39946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39947. $ctx1.sendIdx["nextPutAll:"]=2;
  39948. //>>excludeEnd("ctx");
  39949. _st($1)._nextPutAll_("(){return globals.");
  39950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39951. $ctx1.sendIdx["nextPutAll:"]=3;
  39952. //>>excludeEnd("ctx");
  39953. _st($1)._nextPutAll_(aString);
  39954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39955. $ctx1.sendIdx["nextPutAll:"]=4;
  39956. //>>excludeEnd("ctx");
  39957. _st($1)._nextPutAll_("||(typeof ");
  39958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39959. $ctx1.sendIdx["nextPutAll:"]=5;
  39960. //>>excludeEnd("ctx");
  39961. _st($1)._nextPutAll_(aString);
  39962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39963. $ctx1.sendIdx["nextPutAll:"]=6;
  39964. //>>excludeEnd("ctx");
  39965. _st($1)._nextPutAll_("==\x22undefined\x22?nil:");
  39966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39967. $ctx1.sendIdx["nextPutAll:"]=7;
  39968. //>>excludeEnd("ctx");
  39969. _st($1)._nextPutAll_(aString);
  39970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39971. $ctx1.sendIdx["nextPutAll:"]=8;
  39972. //>>excludeEnd("ctx");
  39973. _st($1)._nextPutAll_(")}");
  39974. $2=_st($1)._lf();
  39975. return self;
  39976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39977. }, function($ctx1) {$ctx1.fill(self,"nextPutClassRefFunction:",{aString:aString},globals.JSStream)});
  39978. //>>excludeEnd("ctx");
  39979. },
  39980. //>>excludeStart("ide", pragmas.excludeIdeData);
  39981. args: ["aString"],
  39982. 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",
  39983. referencedClasses: [],
  39984. //>>excludeEnd("ide");
  39985. messageSends: ["nextPutAll:", "lf"]
  39986. }),
  39987. globals.JSStream);
  39988. smalltalk.addMethod(
  39989. smalltalk.method({
  39990. selector: "nextPutClosureWith:arguments:",
  39991. protocol: 'streaming',
  39992. fn: function (aBlock,anArray){
  39993. var self=this;
  39994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39995. return smalltalk.withContext(function($ctx1) {
  39996. //>>excludeEnd("ctx");
  39997. var $1,$2,$3,$4;
  39998. _st(self["@stream"])._nextPutAll_("(function(");
  39999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40000. $ctx1.sendIdx["nextPutAll:"]=1;
  40001. //>>excludeEnd("ctx");
  40002. _st(anArray)._do_separatedBy_((function(each){
  40003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40004. return smalltalk.withContext(function($ctx2) {
  40005. //>>excludeEnd("ctx");
  40006. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  40007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40008. $ctx2.sendIdx["nextPutAll:"]=2;
  40009. //>>excludeEnd("ctx");
  40010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40012. //>>excludeEnd("ctx");
  40013. }),(function(){
  40014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40015. return smalltalk.withContext(function($ctx2) {
  40016. //>>excludeEnd("ctx");
  40017. return _st(self["@stream"])._nextPut_(",");
  40018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40020. //>>excludeEnd("ctx");
  40021. }));
  40022. $1=self["@stream"];
  40023. _st($1)._nextPutAll_("){");
  40024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40025. $ctx1.sendIdx["nextPutAll:"]=3;
  40026. //>>excludeEnd("ctx");
  40027. $2=_st($1)._lf();
  40028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40029. $ctx1.sendIdx["lf"]=1;
  40030. //>>excludeEnd("ctx");
  40031. _st(aBlock)._value();
  40032. $3=self["@stream"];
  40033. _st($3)._lf();
  40034. $4=_st($3)._nextPutAll_("})");
  40035. return self;
  40036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40037. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  40038. //>>excludeEnd("ctx");
  40039. },
  40040. //>>excludeStart("ide", pragmas.excludeIdeData);
  40041. args: ["aBlock", "anArray"],
  40042. 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 lf; nextPutAll: '})'",
  40043. referencedClasses: [],
  40044. //>>excludeEnd("ide");
  40045. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40046. }),
  40047. globals.JSStream);
  40048. smalltalk.addMethod(
  40049. smalltalk.method({
  40050. selector: "nextPutContextFor:during:",
  40051. protocol: 'streaming',
  40052. fn: function (aMethod,aBlock){
  40053. var self=this;
  40054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40055. return smalltalk.withContext(function($ctx1) {
  40056. //>>excludeEnd("ctx");
  40057. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18,$19;
  40058. $1=_st(aMethod)._requiresSmalltalkContext();
  40059. if(! smalltalk.assert($1)){
  40060. $2=_st(aBlock)._value();
  40061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40062. $ctx1.sendIdx["value"]=1;
  40063. //>>excludeEnd("ctx");
  40064. return $2;
  40065. };
  40066. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40068. $ctx1.sendIdx["nextPutAll:"]=1;
  40069. //>>excludeEnd("ctx");
  40070. self._lf();
  40071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40072. $ctx1.sendIdx["lf"]=1;
  40073. //>>excludeEnd("ctx");
  40074. $6=_st(aMethod)._scope();
  40075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40076. $ctx1.sendIdx["scope"]=1;
  40077. //>>excludeEnd("ctx");
  40078. $5=_st($6)._alias();
  40079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40080. $ctx1.sendIdx["alias"]=1;
  40081. //>>excludeEnd("ctx");
  40082. $4="return smalltalk.withContext(function(".__comma($5);
  40083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40084. $ctx1.sendIdx[","]=2;
  40085. //>>excludeEnd("ctx");
  40086. $3=_st($4).__comma(") { ");
  40087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40088. $ctx1.sendIdx[","]=1;
  40089. //>>excludeEnd("ctx");
  40090. self._nextPutAll_($3);
  40091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40092. $ctx1.sendIdx["nextPutAll:"]=2;
  40093. //>>excludeEnd("ctx");
  40094. self._lf();
  40095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40096. $ctx1.sendIdx["lf"]=2;
  40097. //>>excludeEnd("ctx");
  40098. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40100. $ctx1.sendIdx["nextPutAll:"]=3;
  40101. //>>excludeEnd("ctx");
  40102. $7=self._lf();
  40103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40104. $ctx1.sendIdx["lf"]=3;
  40105. //>>excludeEnd("ctx");
  40106. _st(aBlock)._value();
  40107. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40109. $ctx1.sendIdx["nextPutAll:"]=4;
  40110. //>>excludeEnd("ctx");
  40111. self._lf();
  40112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40113. $ctx1.sendIdx["lf"]=4;
  40114. //>>excludeEnd("ctx");
  40115. $12=_st(aMethod)._scope();
  40116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40117. $ctx1.sendIdx["scope"]=2;
  40118. //>>excludeEnd("ctx");
  40119. $11=_st($12)._alias();
  40120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40121. $ctx1.sendIdx["alias"]=2;
  40122. //>>excludeEnd("ctx");
  40123. $10="}, function(".__comma($11);
  40124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40125. $ctx1.sendIdx[","]=5;
  40126. //>>excludeEnd("ctx");
  40127. $9=_st($10).__comma(") {");
  40128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40129. $ctx1.sendIdx[","]=4;
  40130. //>>excludeEnd("ctx");
  40131. $8=_st($9).__comma(_st(_st(aMethod)._scope())._alias());
  40132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40133. $ctx1.sendIdx[","]=3;
  40134. //>>excludeEnd("ctx");
  40135. self._nextPutAll_($8);
  40136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40137. $ctx1.sendIdx["nextPutAll:"]=5;
  40138. //>>excludeEnd("ctx");
  40139. $16=_st(_st(aMethod)._selector())._asJavascript();
  40140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40141. $ctx1.sendIdx["asJavascript"]=1;
  40142. //>>excludeEnd("ctx");
  40143. $15=".fill(self,".__comma($16);
  40144. $14=_st($15).__comma(",{");
  40145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40146. $ctx1.sendIdx[","]=6;
  40147. //>>excludeEnd("ctx");
  40148. $13=self._nextPutAll_($14);
  40149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40150. $ctx1.sendIdx["nextPutAll:"]=6;
  40151. //>>excludeEnd("ctx");
  40152. _st(_st(aMethod)._locals())._do_separatedBy_((function(each){
  40153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40154. return smalltalk.withContext(function($ctx2) {
  40155. //>>excludeEnd("ctx");
  40156. $17=_st(each)._asVariableName();
  40157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40158. $ctx2.sendIdx["asVariableName"]=1;
  40159. //>>excludeEnd("ctx");
  40160. self._nextPutAll_($17);
  40161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40162. $ctx2.sendIdx["nextPutAll:"]=7;
  40163. //>>excludeEnd("ctx");
  40164. self._nextPutAll_(":");
  40165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40166. $ctx2.sendIdx["nextPutAll:"]=8;
  40167. //>>excludeEnd("ctx");
  40168. $18=self._nextPutAll_(_st(each)._asVariableName());
  40169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40170. $ctx2.sendIdx["nextPutAll:"]=9;
  40171. //>>excludeEnd("ctx");
  40172. return $18;
  40173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40175. //>>excludeEnd("ctx");
  40176. }),(function(){
  40177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40178. return smalltalk.withContext(function($ctx2) {
  40179. //>>excludeEnd("ctx");
  40180. return self._nextPutAll_(",");
  40181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40182. $ctx2.sendIdx["nextPutAll:"]=10;
  40183. //>>excludeEnd("ctx");
  40184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40186. //>>excludeEnd("ctx");
  40187. }));
  40188. self._nextPutAll_("},");
  40189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40190. $ctx1.sendIdx["nextPutAll:"]=11;
  40191. //>>excludeEnd("ctx");
  40192. self._nextPutAll_(_st(_st(aMethod)._theClass())._asJavascript());
  40193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40194. $ctx1.sendIdx["nextPutAll:"]=12;
  40195. //>>excludeEnd("ctx");
  40196. self._nextPutAll_(")});");
  40197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40198. $ctx1.sendIdx["nextPutAll:"]=13;
  40199. //>>excludeEnd("ctx");
  40200. self._lf();
  40201. $19=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  40202. return self;
  40203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40204. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  40205. //>>excludeEnd("ctx");
  40206. },
  40207. //>>excludeStart("ide", pragmas.excludeIdeData);
  40208. args: ["aMethod", "aBlock"],
  40209. source: "nextPutContextFor: aMethod during: aBlock\x0a\x09aMethod requiresSmalltalkContext ifFalse: [ ^ aBlock value ].\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'return smalltalk.withContext(function(', aMethod scope alias, ') { ';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);';\x0a\x09\x09lf.\x0a\x0a\x09aBlock value.\x0a\x09\x0a\x09self\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);';\x0a\x09\x09lf;\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: ')});';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
  40210. referencedClasses: [],
  40211. //>>excludeEnd("ide");
  40212. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  40213. }),
  40214. globals.JSStream);
  40215. smalltalk.addMethod(
  40216. smalltalk.method({
  40217. selector: "nextPutFunctionWith:arguments:",
  40218. protocol: 'streaming',
  40219. fn: function (aBlock,anArray){
  40220. var self=this;
  40221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40222. return smalltalk.withContext(function($ctx1) {
  40223. //>>excludeEnd("ctx");
  40224. var $1,$2,$3,$4,$5,$6;
  40225. _st(self["@stream"])._nextPutAll_("fn: function(");
  40226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40227. $ctx1.sendIdx["nextPutAll:"]=1;
  40228. //>>excludeEnd("ctx");
  40229. _st(anArray)._do_separatedBy_((function(each){
  40230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40231. return smalltalk.withContext(function($ctx2) {
  40232. //>>excludeEnd("ctx");
  40233. return _st(self["@stream"])._nextPutAll_(_st(each)._asVariableName());
  40234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40235. $ctx2.sendIdx["nextPutAll:"]=2;
  40236. //>>excludeEnd("ctx");
  40237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40239. //>>excludeEnd("ctx");
  40240. }),(function(){
  40241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40242. return smalltalk.withContext(function($ctx2) {
  40243. //>>excludeEnd("ctx");
  40244. return _st(self["@stream"])._nextPut_(",");
  40245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  40247. //>>excludeEnd("ctx");
  40248. }));
  40249. $1=self["@stream"];
  40250. _st($1)._nextPutAll_("){");
  40251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40252. $ctx1.sendIdx["nextPutAll:"]=3;
  40253. //>>excludeEnd("ctx");
  40254. $2=_st($1)._lf();
  40255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40256. $ctx1.sendIdx["lf"]=1;
  40257. //>>excludeEnd("ctx");
  40258. $3=self["@stream"];
  40259. _st($3)._nextPutAll_("var self=this;");
  40260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40261. $ctx1.sendIdx["nextPutAll:"]=4;
  40262. //>>excludeEnd("ctx");
  40263. $4=_st($3)._lf();
  40264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40265. $ctx1.sendIdx["lf"]=2;
  40266. //>>excludeEnd("ctx");
  40267. _st(aBlock)._value();
  40268. $5=self["@stream"];
  40269. _st($5)._lf();
  40270. $6=_st($5)._nextPutAll_("}");
  40271. return self;
  40272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40273. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},globals.JSStream)});
  40274. //>>excludeEnd("ctx");
  40275. },
  40276. //>>excludeStart("ide", pragmas.excludeIdeData);
  40277. args: ["aBlock", "anArray"],
  40278. 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 lf; nextPutAll: '}'",
  40279. referencedClasses: [],
  40280. //>>excludeEnd("ide");
  40281. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  40282. }),
  40283. globals.JSStream);
  40284. smalltalk.addMethod(
  40285. smalltalk.method({
  40286. selector: "nextPutIf:with:",
  40287. protocol: 'streaming',
  40288. fn: function (aBlock,anotherBlock){
  40289. var self=this;
  40290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40291. return smalltalk.withContext(function($ctx1) {
  40292. //>>excludeEnd("ctx");
  40293. var $1,$2;
  40294. _st(self["@stream"])._nextPutAll_("if(");
  40295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40296. $ctx1.sendIdx["nextPutAll:"]=1;
  40297. //>>excludeEnd("ctx");
  40298. _st(aBlock)._value();
  40299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40300. $ctx1.sendIdx["value"]=1;
  40301. //>>excludeEnd("ctx");
  40302. $1=self["@stream"];
  40303. _st($1)._nextPutAll_("){");
  40304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40305. $ctx1.sendIdx["nextPutAll:"]=2;
  40306. //>>excludeEnd("ctx");
  40307. $2=_st($1)._lf();
  40308. _st(anotherBlock)._value();
  40309. _st(self["@stream"])._nextPutAll_("}");
  40310. return self;
  40311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40312. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:with:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.JSStream)});
  40313. //>>excludeEnd("ctx");
  40314. },
  40315. //>>excludeStart("ide", pragmas.excludeIdeData);
  40316. args: ["aBlock", "anotherBlock"],
  40317. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  40318. referencedClasses: [],
  40319. //>>excludeEnd("ide");
  40320. messageSends: ["nextPutAll:", "value", "lf"]
  40321. }),
  40322. globals.JSStream);
  40323. smalltalk.addMethod(
  40324. smalltalk.method({
  40325. selector: "nextPutIfElse:with:with:",
  40326. protocol: 'streaming',
  40327. fn: function (aBlock,ifBlock,elseBlock){
  40328. var self=this;
  40329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40330. return smalltalk.withContext(function($ctx1) {
  40331. //>>excludeEnd("ctx");
  40332. var $1,$2,$3,$4;
  40333. _st(self["@stream"])._nextPutAll_("if(");
  40334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40335. $ctx1.sendIdx["nextPutAll:"]=1;
  40336. //>>excludeEnd("ctx");
  40337. _st(aBlock)._value();
  40338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40339. $ctx1.sendIdx["value"]=1;
  40340. //>>excludeEnd("ctx");
  40341. $1=self["@stream"];
  40342. _st($1)._nextPutAll_("){");
  40343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40344. $ctx1.sendIdx["nextPutAll:"]=2;
  40345. //>>excludeEnd("ctx");
  40346. $2=_st($1)._lf();
  40347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40348. $ctx1.sendIdx["lf"]=1;
  40349. //>>excludeEnd("ctx");
  40350. _st(ifBlock)._value();
  40351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40352. $ctx1.sendIdx["value"]=2;
  40353. //>>excludeEnd("ctx");
  40354. $3=self["@stream"];
  40355. _st($3)._nextPutAll_("} else {");
  40356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40357. $ctx1.sendIdx["nextPutAll:"]=3;
  40358. //>>excludeEnd("ctx");
  40359. $4=_st($3)._lf();
  40360. _st(elseBlock)._value();
  40361. _st(self["@stream"])._nextPutAll_("}");
  40362. return self;
  40363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40364. }, function($ctx1) {$ctx1.fill(self,"nextPutIfElse:with:with:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},globals.JSStream)});
  40365. //>>excludeEnd("ctx");
  40366. },
  40367. //>>excludeStart("ide", pragmas.excludeIdeData);
  40368. args: ["aBlock", "ifBlock", "elseBlock"],
  40369. 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: '}'",
  40370. referencedClasses: [],
  40371. //>>excludeEnd("ide");
  40372. messageSends: ["nextPutAll:", "value", "lf"]
  40373. }),
  40374. globals.JSStream);
  40375. smalltalk.addMethod(
  40376. smalltalk.method({
  40377. selector: "nextPutMethodDeclaration:with:",
  40378. protocol: 'streaming',
  40379. fn: function (aMethod,aBlock){
  40380. var self=this;
  40381. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  40382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40383. return smalltalk.withContext(function($ctx1) {
  40384. //>>excludeEnd("ctx");
  40385. 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;
  40386. $1=self["@stream"];
  40387. _st($1)._nextPutAll_("smalltalk.method({");
  40388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40389. $ctx1.sendIdx["nextPutAll:"]=1;
  40390. //>>excludeEnd("ctx");
  40391. _st($1)._lf();
  40392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40393. $ctx1.sendIdx["lf"]=1;
  40394. //>>excludeEnd("ctx");
  40395. $2=$1;
  40396. $5=_st(_st(aMethod)._selector())._asJavascript();
  40397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40398. $ctx1.sendIdx["asJavascript"]=1;
  40399. //>>excludeEnd("ctx");
  40400. $4="selector: ".__comma($5);
  40401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40402. $ctx1.sendIdx[","]=2;
  40403. //>>excludeEnd("ctx");
  40404. $3=_st($4).__comma(",");
  40405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40406. $ctx1.sendIdx[","]=1;
  40407. //>>excludeEnd("ctx");
  40408. _st($2)._nextPutAll_($3);
  40409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40410. $ctx1.sendIdx["nextPutAll:"]=2;
  40411. //>>excludeEnd("ctx");
  40412. _st($1)._lf();
  40413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40414. $ctx1.sendIdx["lf"]=2;
  40415. //>>excludeEnd("ctx");
  40416. $6=$1;
  40417. $9=_st(_st(aMethod)._source())._asJavascript();
  40418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40419. $ctx1.sendIdx["asJavascript"]=2;
  40420. //>>excludeEnd("ctx");
  40421. $8="source: ".__comma($9);
  40422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40423. $ctx1.sendIdx[","]=4;
  40424. //>>excludeEnd("ctx");
  40425. $7=_st($8).__comma(",");
  40426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40427. $ctx1.sendIdx[","]=3;
  40428. //>>excludeEnd("ctx");
  40429. _st($6)._nextPutAll_($7);
  40430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40431. $ctx1.sendIdx["nextPutAll:"]=3;
  40432. //>>excludeEnd("ctx");
  40433. $10=_st($1)._lf();
  40434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40435. $ctx1.sendIdx["lf"]=3;
  40436. //>>excludeEnd("ctx");
  40437. _st(aBlock)._value();
  40438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40439. $ctx1.sendIdx["value"]=1;
  40440. //>>excludeEnd("ctx");
  40441. $11=self["@stream"];
  40442. $12=$11;
  40443. $15=_st($String())._lf();
  40444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40445. $ctx1.sendIdx["lf"]=4;
  40446. //>>excludeEnd("ctx");
  40447. $14=",".__comma($15);
  40448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40449. $ctx1.sendIdx[","]=6;
  40450. //>>excludeEnd("ctx");
  40451. $13=_st($14).__comma("messageSends: ");
  40452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40453. $ctx1.sendIdx[","]=5;
  40454. //>>excludeEnd("ctx");
  40455. _st($12)._nextPutAll_($13);
  40456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40457. $ctx1.sendIdx["nextPutAll:"]=4;
  40458. //>>excludeEnd("ctx");
  40459. $16=$11;
  40460. $19=_st(_st(aMethod)._messageSends())._asArray();
  40461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40462. $ctx1.sendIdx["asArray"]=1;
  40463. //>>excludeEnd("ctx");
  40464. $18=_st($19)._asJavascript();
  40465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40466. $ctx1.sendIdx["asJavascript"]=3;
  40467. //>>excludeEnd("ctx");
  40468. $17=_st($18).__comma(",");
  40469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40470. $ctx1.sendIdx[","]=7;
  40471. //>>excludeEnd("ctx");
  40472. _st($16)._nextPutAll_($17);
  40473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40474. $ctx1.sendIdx["nextPutAll:"]=5;
  40475. //>>excludeEnd("ctx");
  40476. _st($11)._lf();
  40477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40478. $ctx1.sendIdx["lf"]=5;
  40479. //>>excludeEnd("ctx");
  40480. $20=$11;
  40481. $23=_st(_st(_st(_st(aMethod)._arguments())._collect_((function(each){
  40482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40483. return smalltalk.withContext(function($ctx2) {
  40484. //>>excludeEnd("ctx");
  40485. return _st(each)._value();
  40486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40487. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40488. //>>excludeEnd("ctx");
  40489. })))._asArray())._asJavascript();
  40490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40491. $ctx1.sendIdx["asJavascript"]=4;
  40492. //>>excludeEnd("ctx");
  40493. $22="args: ".__comma($23);
  40494. $21=_st($22).__comma(",");
  40495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40496. $ctx1.sendIdx[","]=8;
  40497. //>>excludeEnd("ctx");
  40498. _st($20)._nextPutAll_($21);
  40499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40500. $ctx1.sendIdx["nextPutAll:"]=6;
  40501. //>>excludeEnd("ctx");
  40502. _st($11)._lf();
  40503. $24=_st($11)._nextPutAll_("referencedClasses: [");
  40504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40505. $ctx1.sendIdx["nextPutAll:"]=7;
  40506. //>>excludeEnd("ctx");
  40507. _st(_st(aMethod)._classReferences())._do_separatedBy_((function(each){
  40508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40509. return smalltalk.withContext(function($ctx2) {
  40510. //>>excludeEnd("ctx");
  40511. return _st(self["@stream"])._nextPutAll_(_st(each)._asJavascript());
  40512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40513. $ctx2.sendIdx["nextPutAll:"]=8;
  40514. //>>excludeEnd("ctx");
  40515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40517. //>>excludeEnd("ctx");
  40518. }),(function(){
  40519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40520. return smalltalk.withContext(function($ctx2) {
  40521. //>>excludeEnd("ctx");
  40522. return _st(self["@stream"])._nextPutAll_(",");
  40523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40524. $ctx2.sendIdx["nextPutAll:"]=9;
  40525. //>>excludeEnd("ctx");
  40526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40528. //>>excludeEnd("ctx");
  40529. }));
  40530. $25=self["@stream"];
  40531. _st($25)._nextPutAll_("]");
  40532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40533. $ctx1.sendIdx["nextPutAll:"]=10;
  40534. //>>excludeEnd("ctx");
  40535. $26=_st($25)._nextPutAll_("})");
  40536. return self;
  40537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40538. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},globals.JSStream)});
  40539. //>>excludeEnd("ctx");
  40540. },
  40541. //>>excludeStart("ide", pragmas.excludeIdeData);
  40542. args: ["aMethod", "aBlock"],
  40543. 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: '})'",
  40544. referencedClasses: ["String"],
  40545. //>>excludeEnd("ide");
  40546. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  40547. }),
  40548. globals.JSStream);
  40549. smalltalk.addMethod(
  40550. smalltalk.method({
  40551. selector: "nextPutNonLocalReturnHandlingWith:",
  40552. protocol: 'streaming',
  40553. fn: function (aBlock){
  40554. var self=this;
  40555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40556. return smalltalk.withContext(function($ctx1) {
  40557. //>>excludeEnd("ctx");
  40558. var $1,$2,$3,$4;
  40559. $1=self["@stream"];
  40560. _st($1)._nextPutAll_("var $early={};");
  40561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40562. $ctx1.sendIdx["nextPutAll:"]=1;
  40563. //>>excludeEnd("ctx");
  40564. _st($1)._lf();
  40565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40566. $ctx1.sendIdx["lf"]=1;
  40567. //>>excludeEnd("ctx");
  40568. _st($1)._nextPutAll_("try {");
  40569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40570. $ctx1.sendIdx["nextPutAll:"]=2;
  40571. //>>excludeEnd("ctx");
  40572. $2=_st($1)._lf();
  40573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40574. $ctx1.sendIdx["lf"]=2;
  40575. //>>excludeEnd("ctx");
  40576. _st(aBlock)._value();
  40577. $3=self["@stream"];
  40578. _st($3)._nextPutAll_("}");
  40579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40580. $ctx1.sendIdx["nextPutAll:"]=3;
  40581. //>>excludeEnd("ctx");
  40582. _st($3)._lf();
  40583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40584. $ctx1.sendIdx["lf"]=3;
  40585. //>>excludeEnd("ctx");
  40586. _st($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  40587. $4=_st($3)._lf();
  40588. return self;
  40589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40590. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},globals.JSStream)});
  40591. //>>excludeEnd("ctx");
  40592. },
  40593. //>>excludeStart("ide", pragmas.excludeIdeData);
  40594. args: ["aBlock"],
  40595. 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",
  40596. referencedClasses: [],
  40597. //>>excludeEnd("ide");
  40598. messageSends: ["nextPutAll:", "lf", "value"]
  40599. }),
  40600. globals.JSStream);
  40601. smalltalk.addMethod(
  40602. smalltalk.method({
  40603. selector: "nextPutNonLocalReturnWith:",
  40604. protocol: 'streaming',
  40605. fn: function (aBlock){
  40606. var self=this;
  40607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40608. return smalltalk.withContext(function($ctx1) {
  40609. //>>excludeEnd("ctx");
  40610. _st(self["@stream"])._nextPutAll_("throw $early=[");
  40611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40612. $ctx1.sendIdx["nextPutAll:"]=1;
  40613. //>>excludeEnd("ctx");
  40614. _st(aBlock)._value();
  40615. _st(self["@stream"])._nextPutAll_("]");
  40616. return self;
  40617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40618. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},globals.JSStream)});
  40619. //>>excludeEnd("ctx");
  40620. },
  40621. //>>excludeStart("ide", pragmas.excludeIdeData);
  40622. args: ["aBlock"],
  40623. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  40624. referencedClasses: [],
  40625. //>>excludeEnd("ide");
  40626. messageSends: ["nextPutAll:", "value"]
  40627. }),
  40628. globals.JSStream);
  40629. smalltalk.addMethod(
  40630. smalltalk.method({
  40631. selector: "nextPutReturn",
  40632. protocol: 'streaming',
  40633. fn: function (){
  40634. var self=this;
  40635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40636. return smalltalk.withContext(function($ctx1) {
  40637. //>>excludeEnd("ctx");
  40638. _st(self["@stream"])._nextPutAll_("return ");
  40639. return self;
  40640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40641. }, function($ctx1) {$ctx1.fill(self,"nextPutReturn",{},globals.JSStream)});
  40642. //>>excludeEnd("ctx");
  40643. },
  40644. //>>excludeStart("ide", pragmas.excludeIdeData);
  40645. args: [],
  40646. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  40647. referencedClasses: [],
  40648. //>>excludeEnd("ide");
  40649. messageSends: ["nextPutAll:"]
  40650. }),
  40651. globals.JSStream);
  40652. smalltalk.addMethod(
  40653. smalltalk.method({
  40654. selector: "nextPutReturnWith:",
  40655. protocol: 'streaming',
  40656. fn: function (aBlock){
  40657. var self=this;
  40658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40659. return smalltalk.withContext(function($ctx1) {
  40660. //>>excludeEnd("ctx");
  40661. self._nextPutReturn();
  40662. _st(aBlock)._value();
  40663. return self;
  40664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40665. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},globals.JSStream)});
  40666. //>>excludeEnd("ctx");
  40667. },
  40668. //>>excludeStart("ide", pragmas.excludeIdeData);
  40669. args: ["aBlock"],
  40670. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  40671. referencedClasses: [],
  40672. //>>excludeEnd("ide");
  40673. messageSends: ["nextPutReturn", "value"]
  40674. }),
  40675. globals.JSStream);
  40676. smalltalk.addMethod(
  40677. smalltalk.method({
  40678. selector: "nextPutSendIndexFor:",
  40679. protocol: 'streaming',
  40680. fn: function (anIRSend){
  40681. var self=this;
  40682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40683. return smalltalk.withContext(function($ctx1) {
  40684. //>>excludeEnd("ctx");
  40685. var $1;
  40686. self._nextPutAll_(";");
  40687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40688. $ctx1.sendIdx["nextPutAll:"]=1;
  40689. //>>excludeEnd("ctx");
  40690. self._lf();
  40691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40692. $ctx1.sendIdx["lf"]=1;
  40693. //>>excludeEnd("ctx");
  40694. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  40695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40696. $ctx1.sendIdx["nextPutAll:"]=2;
  40697. //>>excludeEnd("ctx");
  40698. self._lf();
  40699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40700. $ctx1.sendIdx["lf"]=2;
  40701. //>>excludeEnd("ctx");
  40702. self._nextPutAll_(_st(_st(anIRSend)._scope())._alias());
  40703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40704. $ctx1.sendIdx["nextPutAll:"]=3;
  40705. //>>excludeEnd("ctx");
  40706. self._nextPutAll_(".sendIdx[");
  40707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40708. $ctx1.sendIdx["nextPutAll:"]=4;
  40709. //>>excludeEnd("ctx");
  40710. self._nextPutAll_(_st(_st(anIRSend)._selector())._asJavascript());
  40711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40712. $ctx1.sendIdx["nextPutAll:"]=5;
  40713. //>>excludeEnd("ctx");
  40714. self._nextPutAll_("]=");
  40715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40716. $ctx1.sendIdx["nextPutAll:"]=6;
  40717. //>>excludeEnd("ctx");
  40718. self._nextPutAll_(_st(_st(anIRSend)._index())._asString());
  40719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40720. $ctx1.sendIdx["nextPutAll:"]=7;
  40721. //>>excludeEnd("ctx");
  40722. self._nextPutAll_(";");
  40723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40724. $ctx1.sendIdx["nextPutAll:"]=8;
  40725. //>>excludeEnd("ctx");
  40726. self._lf();
  40727. $1=self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  40728. return self;
  40729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40730. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},globals.JSStream)});
  40731. //>>excludeEnd("ctx");
  40732. },
  40733. //>>excludeStart("ide", pragmas.excludeIdeData);
  40734. args: ["anIRSend"],
  40735. source: "nextPutSendIndexFor: anIRSend\x0a\x09self \x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; 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;\x0a\x09\x09nextPutAll: ';'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22)'",
  40736. referencedClasses: [],
  40737. //>>excludeEnd("ide");
  40738. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  40739. }),
  40740. globals.JSStream);
  40741. smalltalk.addMethod(
  40742. smalltalk.method({
  40743. selector: "nextPutSequenceWith:",
  40744. protocol: 'streaming',
  40745. fn: function (aBlock){
  40746. var self=this;
  40747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40748. return smalltalk.withContext(function($ctx1) {
  40749. //>>excludeEnd("ctx");
  40750. _st(aBlock)._value();
  40751. return self;
  40752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40753. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},globals.JSStream)});
  40754. //>>excludeEnd("ctx");
  40755. },
  40756. //>>excludeStart("ide", pragmas.excludeIdeData);
  40757. args: ["aBlock"],
  40758. 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",
  40759. referencedClasses: [],
  40760. //>>excludeEnd("ide");
  40761. messageSends: ["value"]
  40762. }),
  40763. globals.JSStream);
  40764. smalltalk.addMethod(
  40765. smalltalk.method({
  40766. selector: "nextPutStatementWith:",
  40767. protocol: 'streaming',
  40768. fn: function (aBlock){
  40769. var self=this;
  40770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40771. return smalltalk.withContext(function($ctx1) {
  40772. //>>excludeEnd("ctx");
  40773. var $1,$2;
  40774. _st(aBlock)._value();
  40775. $1=self["@stream"];
  40776. _st($1)._nextPutAll_(";");
  40777. $2=_st($1)._lf();
  40778. return self;
  40779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40780. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},globals.JSStream)});
  40781. //>>excludeEnd("ctx");
  40782. },
  40783. //>>excludeStart("ide", pragmas.excludeIdeData);
  40784. args: ["aBlock"],
  40785. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  40786. referencedClasses: [],
  40787. //>>excludeEnd("ide");
  40788. messageSends: ["value", "nextPutAll:", "lf"]
  40789. }),
  40790. globals.JSStream);
  40791. smalltalk.addMethod(
  40792. smalltalk.method({
  40793. selector: "nextPutVars:",
  40794. protocol: 'streaming',
  40795. fn: function (aCollection){
  40796. var self=this;
  40797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40798. return smalltalk.withContext(function($ctx1) {
  40799. //>>excludeEnd("ctx");
  40800. var $1,$2;
  40801. var $early={};
  40802. try {
  40803. _st(aCollection)._ifEmpty_((function(){
  40804. throw $early=[self];
  40805. }));
  40806. _st(self["@stream"])._nextPutAll_("var ");
  40807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40808. $ctx1.sendIdx["nextPutAll:"]=1;
  40809. //>>excludeEnd("ctx");
  40810. _st(aCollection)._do_separatedBy_((function(each){
  40811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40812. return smalltalk.withContext(function($ctx2) {
  40813. //>>excludeEnd("ctx");
  40814. return _st(self["@stream"])._nextPutAll_(each);
  40815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40816. $ctx2.sendIdx["nextPutAll:"]=2;
  40817. //>>excludeEnd("ctx");
  40818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40820. //>>excludeEnd("ctx");
  40821. }),(function(){
  40822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40823. return smalltalk.withContext(function($ctx2) {
  40824. //>>excludeEnd("ctx");
  40825. return _st(self["@stream"])._nextPutAll_(",");
  40826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40827. $ctx2.sendIdx["nextPutAll:"]=3;
  40828. //>>excludeEnd("ctx");
  40829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40831. //>>excludeEnd("ctx");
  40832. }));
  40833. $1=self["@stream"];
  40834. _st($1)._nextPutAll_(";");
  40835. $2=_st($1)._lf();
  40836. return self;
  40837. }
  40838. catch(e) {if(e===$early)return e[0]; throw e}
  40839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40840. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},globals.JSStream)});
  40841. //>>excludeEnd("ctx");
  40842. },
  40843. //>>excludeStart("ide", pragmas.excludeIdeData);
  40844. args: ["aCollection"],
  40845. 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",
  40846. referencedClasses: [],
  40847. //>>excludeEnd("ide");
  40848. messageSends: ["ifEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  40849. }),
  40850. globals.JSStream);
  40851. smalltalk.addMethod(
  40852. smalltalk.method({
  40853. selector: "appendToInstruction:",
  40854. protocol: '*Compiler-IR',
  40855. fn: function (anIRInstruction){
  40856. var self=this;
  40857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40858. return smalltalk.withContext(function($ctx1) {
  40859. //>>excludeEnd("ctx");
  40860. _st(anIRInstruction)._appendBlock_(self);
  40861. return self;
  40862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40863. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},globals.BlockClosure)});
  40864. //>>excludeEnd("ctx");
  40865. },
  40866. //>>excludeStart("ide", pragmas.excludeIdeData);
  40867. args: ["anIRInstruction"],
  40868. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  40869. referencedClasses: [],
  40870. //>>excludeEnd("ide");
  40871. messageSends: ["appendBlock:"]
  40872. }),
  40873. globals.BlockClosure);
  40874. });
  40875. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  40876. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  40877. smalltalk.addPackage('Compiler-Inlining');
  40878. smalltalk.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40879. smalltalk.addClass('IRInlinedAssignment', globals.IRAssignment, [], 'Compiler-Inlining');
  40880. //>>excludeStart("ide", pragmas.excludeIdeData);
  40881. globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  40882. //>>excludeEnd("ide");
  40883. smalltalk.addMethod(
  40884. smalltalk.method({
  40885. selector: "accept:",
  40886. protocol: 'visiting',
  40887. fn: function (aVisitor){
  40888. var self=this;
  40889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40890. return smalltalk.withContext(function($ctx1) {
  40891. //>>excludeEnd("ctx");
  40892. var $1;
  40893. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  40894. return $1;
  40895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40896. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)});
  40897. //>>excludeEnd("ctx");
  40898. },
  40899. //>>excludeStart("ide", pragmas.excludeIdeData);
  40900. args: ["aVisitor"],
  40901. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  40902. referencedClasses: [],
  40903. //>>excludeEnd("ide");
  40904. messageSends: ["visitIRInlinedAssignment:"]
  40905. }),
  40906. globals.IRInlinedAssignment);
  40907. smalltalk.addMethod(
  40908. smalltalk.method({
  40909. selector: "isInlined",
  40910. protocol: 'testing',
  40911. fn: function (){
  40912. var self=this;
  40913. return true;
  40914. },
  40915. //>>excludeStart("ide", pragmas.excludeIdeData);
  40916. args: [],
  40917. source: "isInlined\x0a\x09^ true",
  40918. referencedClasses: [],
  40919. //>>excludeEnd("ide");
  40920. messageSends: []
  40921. }),
  40922. globals.IRInlinedAssignment);
  40923. smalltalk.addClass('IRInlinedClosure', globals.IRClosure, [], 'Compiler-Inlining');
  40924. //>>excludeStart("ide", pragmas.excludeIdeData);
  40925. globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  40926. //>>excludeEnd("ide");
  40927. smalltalk.addMethod(
  40928. smalltalk.method({
  40929. selector: "accept:",
  40930. protocol: 'visiting',
  40931. fn: function (aVisitor){
  40932. var self=this;
  40933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40934. return smalltalk.withContext(function($ctx1) {
  40935. //>>excludeEnd("ctx");
  40936. _st(aVisitor)._visitIRInlinedClosure_(self);
  40937. return self;
  40938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40939. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)});
  40940. //>>excludeEnd("ctx");
  40941. },
  40942. //>>excludeStart("ide", pragmas.excludeIdeData);
  40943. args: ["aVisitor"],
  40944. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  40945. referencedClasses: [],
  40946. //>>excludeEnd("ide");
  40947. messageSends: ["visitIRInlinedClosure:"]
  40948. }),
  40949. globals.IRInlinedClosure);
  40950. smalltalk.addMethod(
  40951. smalltalk.method({
  40952. selector: "isInlined",
  40953. protocol: 'testing',
  40954. fn: function (){
  40955. var self=this;
  40956. return true;
  40957. },
  40958. //>>excludeStart("ide", pragmas.excludeIdeData);
  40959. args: [],
  40960. source: "isInlined\x0a\x09^ true",
  40961. referencedClasses: [],
  40962. //>>excludeEnd("ide");
  40963. messageSends: []
  40964. }),
  40965. globals.IRInlinedClosure);
  40966. smalltalk.addClass('IRInlinedReturn', globals.IRReturn, [], 'Compiler-Inlining');
  40967. //>>excludeStart("ide", pragmas.excludeIdeData);
  40968. globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  40969. //>>excludeEnd("ide");
  40970. smalltalk.addMethod(
  40971. smalltalk.method({
  40972. selector: "accept:",
  40973. protocol: 'visiting',
  40974. fn: function (aVisitor){
  40975. var self=this;
  40976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40977. return smalltalk.withContext(function($ctx1) {
  40978. //>>excludeEnd("ctx");
  40979. var $1;
  40980. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  40981. return $1;
  40982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40983. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)});
  40984. //>>excludeEnd("ctx");
  40985. },
  40986. //>>excludeStart("ide", pragmas.excludeIdeData);
  40987. args: ["aVisitor"],
  40988. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  40989. referencedClasses: [],
  40990. //>>excludeEnd("ide");
  40991. messageSends: ["visitIRInlinedReturn:"]
  40992. }),
  40993. globals.IRInlinedReturn);
  40994. smalltalk.addMethod(
  40995. smalltalk.method({
  40996. selector: "isInlined",
  40997. protocol: 'testing',
  40998. fn: function (){
  40999. var self=this;
  41000. return true;
  41001. },
  41002. //>>excludeStart("ide", pragmas.excludeIdeData);
  41003. args: [],
  41004. source: "isInlined\x0a\x09^ true",
  41005. referencedClasses: [],
  41006. //>>excludeEnd("ide");
  41007. messageSends: []
  41008. }),
  41009. globals.IRInlinedReturn);
  41010. smalltalk.addClass('IRInlinedSend', globals.IRSend, [], 'Compiler-Inlining');
  41011. //>>excludeStart("ide", pragmas.excludeIdeData);
  41012. globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  41013. //>>excludeEnd("ide");
  41014. smalltalk.addMethod(
  41015. smalltalk.method({
  41016. selector: "accept:",
  41017. protocol: 'visiting',
  41018. fn: function (aVisitor){
  41019. var self=this;
  41020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41021. return smalltalk.withContext(function($ctx1) {
  41022. //>>excludeEnd("ctx");
  41023. _st(aVisitor)._visitInlinedSend_(self);
  41024. return self;
  41025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41026. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)});
  41027. //>>excludeEnd("ctx");
  41028. },
  41029. //>>excludeStart("ide", pragmas.excludeIdeData);
  41030. args: ["aVisitor"],
  41031. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  41032. referencedClasses: [],
  41033. //>>excludeEnd("ide");
  41034. messageSends: ["visitInlinedSend:"]
  41035. }),
  41036. globals.IRInlinedSend);
  41037. smalltalk.addMethod(
  41038. smalltalk.method({
  41039. selector: "internalVariables",
  41040. protocol: 'accessing',
  41041. fn: function (){
  41042. var self=this;
  41043. var $1;
  41044. $1=[];
  41045. return $1;
  41046. },
  41047. //>>excludeStart("ide", pragmas.excludeIdeData);
  41048. args: [],
  41049. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  41050. referencedClasses: [],
  41051. //>>excludeEnd("ide");
  41052. messageSends: []
  41053. }),
  41054. globals.IRInlinedSend);
  41055. smalltalk.addMethod(
  41056. smalltalk.method({
  41057. selector: "isInlined",
  41058. protocol: 'testing',
  41059. fn: function (){
  41060. var self=this;
  41061. return true;
  41062. },
  41063. //>>excludeStart("ide", pragmas.excludeIdeData);
  41064. args: [],
  41065. source: "isInlined\x0a\x09^ true",
  41066. referencedClasses: [],
  41067. //>>excludeEnd("ide");
  41068. messageSends: []
  41069. }),
  41070. globals.IRInlinedSend);
  41071. smalltalk.addClass('IRInlinedIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41072. //>>excludeStart("ide", pragmas.excludeIdeData);
  41073. globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  41074. //>>excludeEnd("ide");
  41075. smalltalk.addMethod(
  41076. smalltalk.method({
  41077. selector: "accept:",
  41078. protocol: 'visiting',
  41079. fn: function (aVisitor){
  41080. var self=this;
  41081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41082. return smalltalk.withContext(function($ctx1) {
  41083. //>>excludeEnd("ctx");
  41084. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  41085. return self;
  41086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41087. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)});
  41088. //>>excludeEnd("ctx");
  41089. },
  41090. //>>excludeStart("ide", pragmas.excludeIdeData);
  41091. args: ["aVisitor"],
  41092. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  41093. referencedClasses: [],
  41094. //>>excludeEnd("ide");
  41095. messageSends: ["visitIRInlinedIfFalse:"]
  41096. }),
  41097. globals.IRInlinedIfFalse);
  41098. smalltalk.addClass('IRInlinedIfNilIfNotNil', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41099. //>>excludeStart("ide", pragmas.excludeIdeData);
  41100. globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  41101. //>>excludeEnd("ide");
  41102. smalltalk.addMethod(
  41103. smalltalk.method({
  41104. selector: "accept:",
  41105. protocol: 'visiting',
  41106. fn: function (aVisitor){
  41107. var self=this;
  41108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41109. return smalltalk.withContext(function($ctx1) {
  41110. //>>excludeEnd("ctx");
  41111. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  41112. return self;
  41113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41114. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)});
  41115. //>>excludeEnd("ctx");
  41116. },
  41117. //>>excludeStart("ide", pragmas.excludeIdeData);
  41118. args: ["aVisitor"],
  41119. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  41120. referencedClasses: [],
  41121. //>>excludeEnd("ide");
  41122. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  41123. }),
  41124. globals.IRInlinedIfNilIfNotNil);
  41125. smalltalk.addMethod(
  41126. smalltalk.method({
  41127. selector: "internalVariables",
  41128. protocol: 'accessing',
  41129. fn: function (){
  41130. var self=this;
  41131. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  41132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41133. return smalltalk.withContext(function($ctx1) {
  41134. //>>excludeEnd("ctx");
  41135. var $1;
  41136. $1=_st($Array())._with_(self._receiverInternalVariable());
  41137. return $1;
  41138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41139. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRInlinedIfNilIfNotNil)});
  41140. //>>excludeEnd("ctx");
  41141. },
  41142. //>>excludeStart("ide", pragmas.excludeIdeData);
  41143. args: [],
  41144. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  41145. referencedClasses: ["Array"],
  41146. //>>excludeEnd("ide");
  41147. messageSends: ["with:", "receiverInternalVariable"]
  41148. }),
  41149. globals.IRInlinedIfNilIfNotNil);
  41150. smalltalk.addMethod(
  41151. smalltalk.method({
  41152. selector: "receiverInternalVariable",
  41153. protocol: 'accessing',
  41154. fn: function (){
  41155. var self=this;
  41156. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  41157. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  41158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41159. return smalltalk.withContext(function($ctx1) {
  41160. //>>excludeEnd("ctx");
  41161. var $2,$3,$1;
  41162. $2=_st($IRVariable())._new();
  41163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41164. $ctx1.sendIdx["new"]=1;
  41165. //>>excludeEnd("ctx");
  41166. _st($2)._variable_(_st(_st($AliasVar())._new())._name_(self._receiverInternalVariableName()));
  41167. $3=_st($2)._yourself();
  41168. $1=$3;
  41169. return $1;
  41170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41171. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},globals.IRInlinedIfNilIfNotNil)});
  41172. //>>excludeEnd("ctx");
  41173. },
  41174. //>>excludeStart("ide", pragmas.excludeIdeData);
  41175. args: [],
  41176. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  41177. referencedClasses: ["IRVariable", "AliasVar"],
  41178. //>>excludeEnd("ide");
  41179. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  41180. }),
  41181. globals.IRInlinedIfNilIfNotNil);
  41182. smalltalk.addMethod(
  41183. smalltalk.method({
  41184. selector: "receiverInternalVariableName",
  41185. protocol: 'accessing',
  41186. fn: function (){
  41187. var self=this;
  41188. return "$receiver";
  41189. },
  41190. //>>excludeStart("ide", pragmas.excludeIdeData);
  41191. args: [],
  41192. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  41193. referencedClasses: [],
  41194. //>>excludeEnd("ide");
  41195. messageSends: []
  41196. }),
  41197. globals.IRInlinedIfNilIfNotNil);
  41198. smalltalk.addClass('IRInlinedIfTrue', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41199. //>>excludeStart("ide", pragmas.excludeIdeData);
  41200. globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  41201. //>>excludeEnd("ide");
  41202. smalltalk.addMethod(
  41203. smalltalk.method({
  41204. selector: "accept:",
  41205. protocol: 'visiting',
  41206. fn: function (aVisitor){
  41207. var self=this;
  41208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41209. return smalltalk.withContext(function($ctx1) {
  41210. //>>excludeEnd("ctx");
  41211. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  41212. return self;
  41213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41214. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)});
  41215. //>>excludeEnd("ctx");
  41216. },
  41217. //>>excludeStart("ide", pragmas.excludeIdeData);
  41218. args: ["aVisitor"],
  41219. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  41220. referencedClasses: [],
  41221. //>>excludeEnd("ide");
  41222. messageSends: ["visitIRInlinedIfTrue:"]
  41223. }),
  41224. globals.IRInlinedIfTrue);
  41225. smalltalk.addClass('IRInlinedIfTrueIfFalse', globals.IRInlinedSend, [], 'Compiler-Inlining');
  41226. //>>excludeStart("ide", pragmas.excludeIdeData);
  41227. globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  41228. //>>excludeEnd("ide");
  41229. smalltalk.addMethod(
  41230. smalltalk.method({
  41231. selector: "accept:",
  41232. protocol: 'visiting',
  41233. fn: function (aVisitor){
  41234. var self=this;
  41235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41236. return smalltalk.withContext(function($ctx1) {
  41237. //>>excludeEnd("ctx");
  41238. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  41239. return self;
  41240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41241. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)});
  41242. //>>excludeEnd("ctx");
  41243. },
  41244. //>>excludeStart("ide", pragmas.excludeIdeData);
  41245. args: ["aVisitor"],
  41246. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  41247. referencedClasses: [],
  41248. //>>excludeEnd("ide");
  41249. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  41250. }),
  41251. globals.IRInlinedIfTrueIfFalse);
  41252. smalltalk.addClass('IRInlinedSequence', globals.IRBlockSequence, [], 'Compiler-Inlining');
  41253. //>>excludeStart("ide", pragmas.excludeIdeData);
  41254. globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  41255. //>>excludeEnd("ide");
  41256. smalltalk.addMethod(
  41257. smalltalk.method({
  41258. selector: "accept:",
  41259. protocol: 'visiting',
  41260. fn: function (aVisitor){
  41261. var self=this;
  41262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41263. return smalltalk.withContext(function($ctx1) {
  41264. //>>excludeEnd("ctx");
  41265. _st(aVisitor)._visitIRInlinedSequence_(self);
  41266. return self;
  41267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41268. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)});
  41269. //>>excludeEnd("ctx");
  41270. },
  41271. //>>excludeStart("ide", pragmas.excludeIdeData);
  41272. args: ["aVisitor"],
  41273. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  41274. referencedClasses: [],
  41275. //>>excludeEnd("ide");
  41276. messageSends: ["visitIRInlinedSequence:"]
  41277. }),
  41278. globals.IRInlinedSequence);
  41279. smalltalk.addMethod(
  41280. smalltalk.method({
  41281. selector: "isInlined",
  41282. protocol: 'testing',
  41283. fn: function (){
  41284. var self=this;
  41285. return true;
  41286. },
  41287. //>>excludeStart("ide", pragmas.excludeIdeData);
  41288. args: [],
  41289. source: "isInlined\x0a\x09^ true",
  41290. referencedClasses: [],
  41291. //>>excludeEnd("ide");
  41292. messageSends: []
  41293. }),
  41294. globals.IRInlinedSequence);
  41295. smalltalk.addClass('IRInliner', globals.IRVisitor, [], 'Compiler-Inlining');
  41296. //>>excludeStart("ide", pragmas.excludeIdeData);
  41297. 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`";
  41298. //>>excludeEnd("ide");
  41299. smalltalk.addMethod(
  41300. smalltalk.method({
  41301. selector: "assignmentInliner",
  41302. protocol: 'factory',
  41303. fn: function (){
  41304. var self=this;
  41305. function $IRAssignmentInliner(){return globals.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  41306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41307. return smalltalk.withContext(function($ctx1) {
  41308. //>>excludeEnd("ctx");
  41309. var $2,$3,$1;
  41310. $2=_st($IRAssignmentInliner())._new();
  41311. _st($2)._translator_(self);
  41312. $3=_st($2)._yourself();
  41313. $1=$3;
  41314. return $1;
  41315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41316. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)});
  41317. //>>excludeEnd("ctx");
  41318. },
  41319. //>>excludeStart("ide", pragmas.excludeIdeData);
  41320. args: [],
  41321. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41322. referencedClasses: ["IRAssignmentInliner"],
  41323. //>>excludeEnd("ide");
  41324. messageSends: ["translator:", "new", "yourself"]
  41325. }),
  41326. globals.IRInliner);
  41327. smalltalk.addMethod(
  41328. smalltalk.method({
  41329. selector: "returnInliner",
  41330. protocol: 'factory',
  41331. fn: function (){
  41332. var self=this;
  41333. function $IRReturnInliner(){return globals.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  41334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41335. return smalltalk.withContext(function($ctx1) {
  41336. //>>excludeEnd("ctx");
  41337. var $2,$3,$1;
  41338. $2=_st($IRReturnInliner())._new();
  41339. _st($2)._translator_(self);
  41340. $3=_st($2)._yourself();
  41341. $1=$3;
  41342. return $1;
  41343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41344. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)});
  41345. //>>excludeEnd("ctx");
  41346. },
  41347. //>>excludeStart("ide", pragmas.excludeIdeData);
  41348. args: [],
  41349. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41350. referencedClasses: ["IRReturnInliner"],
  41351. //>>excludeEnd("ide");
  41352. messageSends: ["translator:", "new", "yourself"]
  41353. }),
  41354. globals.IRInliner);
  41355. smalltalk.addMethod(
  41356. smalltalk.method({
  41357. selector: "sendInliner",
  41358. protocol: 'factory',
  41359. fn: function (){
  41360. var self=this;
  41361. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  41362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41363. return smalltalk.withContext(function($ctx1) {
  41364. //>>excludeEnd("ctx");
  41365. var $2,$3,$1;
  41366. $2=_st($IRSendInliner())._new();
  41367. _st($2)._translator_(self);
  41368. $3=_st($2)._yourself();
  41369. $1=$3;
  41370. return $1;
  41371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41372. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)});
  41373. //>>excludeEnd("ctx");
  41374. },
  41375. //>>excludeStart("ide", pragmas.excludeIdeData);
  41376. args: [],
  41377. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  41378. referencedClasses: ["IRSendInliner"],
  41379. //>>excludeEnd("ide");
  41380. messageSends: ["translator:", "new", "yourself"]
  41381. }),
  41382. globals.IRInliner);
  41383. smalltalk.addMethod(
  41384. smalltalk.method({
  41385. selector: "shouldInlineAssignment:",
  41386. protocol: 'testing',
  41387. fn: function (anIRAssignment){
  41388. var self=this;
  41389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41390. return smalltalk.withContext(function($ctx1) {
  41391. //>>excludeEnd("ctx");
  41392. var $4,$3,$2,$1;
  41393. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  41394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41395. return smalltalk.withContext(function($ctx2) {
  41396. //>>excludeEnd("ctx");
  41397. $4=_st(anIRAssignment)._instructions();
  41398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41399. $ctx2.sendIdx["instructions"]=1;
  41400. //>>excludeEnd("ctx");
  41401. $3=_st($4)._last();
  41402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41403. $ctx2.sendIdx["last"]=1;
  41404. //>>excludeEnd("ctx");
  41405. $2=_st($3)._isSend();
  41406. return _st($2)._and_((function(){
  41407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41408. return smalltalk.withContext(function($ctx3) {
  41409. //>>excludeEnd("ctx");
  41410. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  41411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41412. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41413. //>>excludeEnd("ctx");
  41414. }));
  41415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41417. //>>excludeEnd("ctx");
  41418. }));
  41419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41420. $ctx1.sendIdx["and:"]=1;
  41421. //>>excludeEnd("ctx");
  41422. return $1;
  41423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41424. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)});
  41425. //>>excludeEnd("ctx");
  41426. },
  41427. //>>excludeStart("ide", pragmas.excludeIdeData);
  41428. args: ["anIRAssignment"],
  41429. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  41430. referencedClasses: [],
  41431. //>>excludeEnd("ide");
  41432. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  41433. }),
  41434. globals.IRInliner);
  41435. smalltalk.addMethod(
  41436. smalltalk.method({
  41437. selector: "shouldInlineReturn:",
  41438. protocol: 'testing',
  41439. fn: function (anIRReturn){
  41440. var self=this;
  41441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41442. return smalltalk.withContext(function($ctx1) {
  41443. //>>excludeEnd("ctx");
  41444. var $4,$3,$2,$1;
  41445. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  41446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41447. return smalltalk.withContext(function($ctx2) {
  41448. //>>excludeEnd("ctx");
  41449. $4=_st(anIRReturn)._instructions();
  41450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41451. $ctx2.sendIdx["instructions"]=1;
  41452. //>>excludeEnd("ctx");
  41453. $3=_st($4)._first();
  41454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41455. $ctx2.sendIdx["first"]=1;
  41456. //>>excludeEnd("ctx");
  41457. $2=_st($3)._isSend();
  41458. return _st($2)._and_((function(){
  41459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41460. return smalltalk.withContext(function($ctx3) {
  41461. //>>excludeEnd("ctx");
  41462. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  41463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41464. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41465. //>>excludeEnd("ctx");
  41466. }));
  41467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41469. //>>excludeEnd("ctx");
  41470. }));
  41471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41472. $ctx1.sendIdx["and:"]=1;
  41473. //>>excludeEnd("ctx");
  41474. return $1;
  41475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41476. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)});
  41477. //>>excludeEnd("ctx");
  41478. },
  41479. //>>excludeStart("ide", pragmas.excludeIdeData);
  41480. args: ["anIRReturn"],
  41481. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  41482. referencedClasses: [],
  41483. //>>excludeEnd("ide");
  41484. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  41485. }),
  41486. globals.IRInliner);
  41487. smalltalk.addMethod(
  41488. smalltalk.method({
  41489. selector: "shouldInlineSend:",
  41490. protocol: 'testing',
  41491. fn: function (anIRSend){
  41492. var self=this;
  41493. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  41494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41495. return smalltalk.withContext(function($ctx1) {
  41496. //>>excludeEnd("ctx");
  41497. var $1;
  41498. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  41499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41500. return smalltalk.withContext(function($ctx2) {
  41501. //>>excludeEnd("ctx");
  41502. return _st($IRSendInliner())._shouldInline_(anIRSend);
  41503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41505. //>>excludeEnd("ctx");
  41506. }));
  41507. return $1;
  41508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41509. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)});
  41510. //>>excludeEnd("ctx");
  41511. },
  41512. //>>excludeStart("ide", pragmas.excludeIdeData);
  41513. args: ["anIRSend"],
  41514. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  41515. referencedClasses: ["IRSendInliner"],
  41516. //>>excludeEnd("ide");
  41517. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  41518. }),
  41519. globals.IRInliner);
  41520. smalltalk.addMethod(
  41521. smalltalk.method({
  41522. selector: "transformNonLocalReturn:",
  41523. protocol: 'visiting',
  41524. fn: function (anIRNonLocalReturn){
  41525. var self=this;
  41526. var localReturn;
  41527. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  41528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41529. return smalltalk.withContext(function($ctx1) {
  41530. //>>excludeEnd("ctx");
  41531. var $2,$1,$4,$3,$5,$6,$7,$8,$9;
  41532. $2=_st(anIRNonLocalReturn)._scope();
  41533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41534. $ctx1.sendIdx["scope"]=1;
  41535. //>>excludeEnd("ctx");
  41536. $1=_st($2)._canInlineNonLocalReturns();
  41537. if(smalltalk.assert($1)){
  41538. $4=_st(anIRNonLocalReturn)._scope();
  41539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41540. $ctx1.sendIdx["scope"]=2;
  41541. //>>excludeEnd("ctx");
  41542. $3=_st($4)._methodScope();
  41543. $5=_st(anIRNonLocalReturn)._scope();
  41544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41545. $ctx1.sendIdx["scope"]=3;
  41546. //>>excludeEnd("ctx");
  41547. _st($3)._removeNonLocalReturn_($5);
  41548. $6=_st($IRReturn())._new();
  41549. _st($6)._scope_(_st(anIRNonLocalReturn)._scope());
  41550. $7=_st($6)._yourself();
  41551. localReturn=$7;
  41552. localReturn;
  41553. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  41554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41555. return smalltalk.withContext(function($ctx2) {
  41556. //>>excludeEnd("ctx");
  41557. return _st(localReturn)._add_(each);
  41558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41560. //>>excludeEnd("ctx");
  41561. }));
  41562. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  41563. $8=localReturn;
  41564. return $8;
  41565. };
  41566. $9=(
  41567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41568. $ctx1.supercall = true,
  41569. //>>excludeEnd("ctx");
  41570. globals.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]));
  41571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41572. $ctx1.supercall = false;
  41573. //>>excludeEnd("ctx");;
  41574. return $9;
  41575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41576. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)});
  41577. //>>excludeEnd("ctx");
  41578. },
  41579. //>>excludeStart("ide", pragmas.excludeIdeData);
  41580. args: ["anIRNonLocalReturn"],
  41581. 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",
  41582. referencedClasses: ["IRReturn"],
  41583. //>>excludeEnd("ide");
  41584. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  41585. }),
  41586. globals.IRInliner);
  41587. smalltalk.addMethod(
  41588. smalltalk.method({
  41589. selector: "visitIRAssignment:",
  41590. protocol: 'visiting',
  41591. fn: function (anIRAssignment){
  41592. var self=this;
  41593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41594. return smalltalk.withContext(function($ctx1) {
  41595. //>>excludeEnd("ctx");
  41596. var $2,$1;
  41597. $2=self._shouldInlineAssignment_(anIRAssignment);
  41598. if(smalltalk.assert($2)){
  41599. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  41600. } else {
  41601. $1=(
  41602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41603. $ctx1.supercall = true,
  41604. //>>excludeEnd("ctx");
  41605. globals.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]));
  41606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41607. $ctx1.supercall = false;
  41608. //>>excludeEnd("ctx");;
  41609. };
  41610. return $1;
  41611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41612. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)});
  41613. //>>excludeEnd("ctx");
  41614. },
  41615. //>>excludeStart("ide", pragmas.excludeIdeData);
  41616. args: ["anIRAssignment"],
  41617. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  41618. referencedClasses: [],
  41619. //>>excludeEnd("ide");
  41620. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  41621. }),
  41622. globals.IRInliner);
  41623. smalltalk.addMethod(
  41624. smalltalk.method({
  41625. selector: "visitIRNonLocalReturn:",
  41626. protocol: 'visiting',
  41627. fn: function (anIRNonLocalReturn){
  41628. var self=this;
  41629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41630. return smalltalk.withContext(function($ctx1) {
  41631. //>>excludeEnd("ctx");
  41632. var $1;
  41633. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  41634. return $1;
  41635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41636. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)});
  41637. //>>excludeEnd("ctx");
  41638. },
  41639. //>>excludeStart("ide", pragmas.excludeIdeData);
  41640. args: ["anIRNonLocalReturn"],
  41641. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  41642. referencedClasses: [],
  41643. //>>excludeEnd("ide");
  41644. messageSends: ["transformNonLocalReturn:"]
  41645. }),
  41646. globals.IRInliner);
  41647. smalltalk.addMethod(
  41648. smalltalk.method({
  41649. selector: "visitIRReturn:",
  41650. protocol: 'visiting',
  41651. fn: function (anIRReturn){
  41652. var self=this;
  41653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41654. return smalltalk.withContext(function($ctx1) {
  41655. //>>excludeEnd("ctx");
  41656. var $2,$1;
  41657. $2=self._shouldInlineReturn_(anIRReturn);
  41658. if(smalltalk.assert($2)){
  41659. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  41660. } else {
  41661. $1=(
  41662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41663. $ctx1.supercall = true,
  41664. //>>excludeEnd("ctx");
  41665. globals.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]));
  41666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41667. $ctx1.supercall = false;
  41668. //>>excludeEnd("ctx");;
  41669. };
  41670. return $1;
  41671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41672. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)});
  41673. //>>excludeEnd("ctx");
  41674. },
  41675. //>>excludeStart("ide", pragmas.excludeIdeData);
  41676. args: ["anIRReturn"],
  41677. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  41678. referencedClasses: [],
  41679. //>>excludeEnd("ide");
  41680. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  41681. }),
  41682. globals.IRInliner);
  41683. smalltalk.addMethod(
  41684. smalltalk.method({
  41685. selector: "visitIRSend:",
  41686. protocol: 'visiting',
  41687. fn: function (anIRSend){
  41688. var self=this;
  41689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41690. return smalltalk.withContext(function($ctx1) {
  41691. //>>excludeEnd("ctx");
  41692. var $2,$1;
  41693. $2=self._shouldInlineSend_(anIRSend);
  41694. if(smalltalk.assert($2)){
  41695. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  41696. } else {
  41697. $1=(
  41698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41699. $ctx1.supercall = true,
  41700. //>>excludeEnd("ctx");
  41701. globals.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]));
  41702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41703. $ctx1.supercall = false;
  41704. //>>excludeEnd("ctx");;
  41705. };
  41706. return $1;
  41707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41708. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)});
  41709. //>>excludeEnd("ctx");
  41710. },
  41711. //>>excludeStart("ide", pragmas.excludeIdeData);
  41712. args: ["anIRSend"],
  41713. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  41714. referencedClasses: [],
  41715. //>>excludeEnd("ide");
  41716. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  41717. }),
  41718. globals.IRInliner);
  41719. smalltalk.addClass('IRInliningJSTranslator', globals.IRJSTranslator, [], 'Compiler-Inlining');
  41720. //>>excludeStart("ide", pragmas.excludeIdeData);
  41721. globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  41722. //>>excludeEnd("ide");
  41723. smalltalk.addMethod(
  41724. smalltalk.method({
  41725. selector: "visitIRInlinedAssignment:",
  41726. protocol: 'visiting',
  41727. fn: function (anIRInlinedAssignment){
  41728. var self=this;
  41729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41730. return smalltalk.withContext(function($ctx1) {
  41731. //>>excludeEnd("ctx");
  41732. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  41733. return self;
  41734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41735. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)});
  41736. //>>excludeEnd("ctx");
  41737. },
  41738. //>>excludeStart("ide", pragmas.excludeIdeData);
  41739. args: ["anIRInlinedAssignment"],
  41740. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  41741. referencedClasses: [],
  41742. //>>excludeEnd("ide");
  41743. messageSends: ["visit:", "last", "instructions"]
  41744. }),
  41745. globals.IRInliningJSTranslator);
  41746. smalltalk.addMethod(
  41747. smalltalk.method({
  41748. selector: "visitIRInlinedClosure:",
  41749. protocol: 'visiting',
  41750. fn: function (anIRInlinedClosure){
  41751. var self=this;
  41752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41753. return smalltalk.withContext(function($ctx1) {
  41754. //>>excludeEnd("ctx");
  41755. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  41756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41757. return smalltalk.withContext(function($ctx2) {
  41758. //>>excludeEnd("ctx");
  41759. return _st(_st(each)._name())._asVariableName();
  41760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41761. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41762. //>>excludeEnd("ctx");
  41763. })));
  41764. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  41765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41766. return smalltalk.withContext(function($ctx2) {
  41767. //>>excludeEnd("ctx");
  41768. return self._visit_(each);
  41769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41771. //>>excludeEnd("ctx");
  41772. }));
  41773. return self;
  41774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41775. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)});
  41776. //>>excludeEnd("ctx");
  41777. },
  41778. //>>excludeStart("ide", pragmas.excludeIdeData);
  41779. args: ["anIRInlinedClosure"],
  41780. 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 ]",
  41781. referencedClasses: [],
  41782. //>>excludeEnd("ide");
  41783. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  41784. }),
  41785. globals.IRInliningJSTranslator);
  41786. smalltalk.addMethod(
  41787. smalltalk.method({
  41788. selector: "visitIRInlinedIfFalse:",
  41789. protocol: 'visiting',
  41790. fn: function (anIRInlinedIfFalse){
  41791. var self=this;
  41792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41793. return smalltalk.withContext(function($ctx1) {
  41794. //>>excludeEnd("ctx");
  41795. var $1,$2,$4,$3;
  41796. $1=self._stream();
  41797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41798. $ctx1.sendIdx["stream"]=1;
  41799. //>>excludeEnd("ctx");
  41800. _st($1)._nextPutIf_with_((function(){
  41801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41802. return smalltalk.withContext(function($ctx2) {
  41803. //>>excludeEnd("ctx");
  41804. $2=self._stream();
  41805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41806. $ctx2.sendIdx["stream"]=2;
  41807. //>>excludeEnd("ctx");
  41808. _st($2)._nextPutAll_("! smalltalk.assert(");
  41809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41810. $ctx2.sendIdx["nextPutAll:"]=1;
  41811. //>>excludeEnd("ctx");
  41812. $4=_st(anIRInlinedIfFalse)._instructions();
  41813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41814. $ctx2.sendIdx["instructions"]=1;
  41815. //>>excludeEnd("ctx");
  41816. $3=_st($4)._first();
  41817. self._visit_($3);
  41818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41819. $ctx2.sendIdx["visit:"]=1;
  41820. //>>excludeEnd("ctx");
  41821. return _st(self._stream())._nextPutAll_(")");
  41822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41824. //>>excludeEnd("ctx");
  41825. }),(function(){
  41826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41827. return smalltalk.withContext(function($ctx2) {
  41828. //>>excludeEnd("ctx");
  41829. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  41830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41831. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41832. //>>excludeEnd("ctx");
  41833. }));
  41834. return self;
  41835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41836. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)});
  41837. //>>excludeEnd("ctx");
  41838. },
  41839. //>>excludeStart("ide", pragmas.excludeIdeData);
  41840. args: ["anIRInlinedIfFalse"],
  41841. 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 ]",
  41842. referencedClasses: [],
  41843. //>>excludeEnd("ide");
  41844. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41845. }),
  41846. globals.IRInliningJSTranslator);
  41847. smalltalk.addMethod(
  41848. smalltalk.method({
  41849. selector: "visitIRInlinedIfNilIfNotNil:",
  41850. protocol: 'visiting',
  41851. fn: function (anIRInlinedIfNilIfNotNil){
  41852. var self=this;
  41853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41854. return smalltalk.withContext(function($ctx1) {
  41855. //>>excludeEnd("ctx");
  41856. var $1,$2,$3,$5,$4,$7,$6;
  41857. $1=self._stream();
  41858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41859. $ctx1.sendIdx["stream"]=1;
  41860. //>>excludeEnd("ctx");
  41861. _st($1)._nextPutIfElse_with_with_((function(){
  41862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41863. return smalltalk.withContext(function($ctx2) {
  41864. //>>excludeEnd("ctx");
  41865. $2=self._stream();
  41866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41867. $ctx2.sendIdx["stream"]=2;
  41868. //>>excludeEnd("ctx");
  41869. $3=_st("(".__comma(_st(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
  41870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41871. $ctx2.sendIdx[","]=1;
  41872. //>>excludeEnd("ctx");
  41873. _st($2)._nextPutAll_($3);
  41874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41875. $ctx2.sendIdx["nextPutAll:"]=1;
  41876. //>>excludeEnd("ctx");
  41877. $5=_st(anIRInlinedIfNilIfNotNil)._instructions();
  41878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41879. $ctx2.sendIdx["instructions"]=1;
  41880. //>>excludeEnd("ctx");
  41881. $4=_st($5)._first();
  41882. self._visit_($4);
  41883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41884. $ctx2.sendIdx["visit:"]=1;
  41885. //>>excludeEnd("ctx");
  41886. return _st(self._stream())._nextPutAll_(") == null || $receiver.isNil");
  41887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41889. //>>excludeEnd("ctx");
  41890. }),(function(){
  41891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41892. return smalltalk.withContext(function($ctx2) {
  41893. //>>excludeEnd("ctx");
  41894. $7=_st(anIRInlinedIfNilIfNotNil)._instructions();
  41895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41896. $ctx2.sendIdx["instructions"]=2;
  41897. //>>excludeEnd("ctx");
  41898. $6=_st($7)._second();
  41899. return self._visit_($6);
  41900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41901. $ctx2.sendIdx["visit:"]=2;
  41902. //>>excludeEnd("ctx");
  41903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41905. //>>excludeEnd("ctx");
  41906. }),(function(){
  41907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41908. return smalltalk.withContext(function($ctx2) {
  41909. //>>excludeEnd("ctx");
  41910. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  41911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  41913. //>>excludeEnd("ctx");
  41914. }));
  41915. return self;
  41916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41917. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)});
  41918. //>>excludeEnd("ctx");
  41919. },
  41920. //>>excludeStart("ide", pragmas.excludeIdeData);
  41921. args: ["anIRInlinedIfNilIfNotNil"],
  41922. 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 ]",
  41923. referencedClasses: [],
  41924. //>>excludeEnd("ide");
  41925. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third"]
  41926. }),
  41927. globals.IRInliningJSTranslator);
  41928. smalltalk.addMethod(
  41929. smalltalk.method({
  41930. selector: "visitIRInlinedIfTrue:",
  41931. protocol: 'visiting',
  41932. fn: function (anIRInlinedIfTrue){
  41933. var self=this;
  41934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41935. return smalltalk.withContext(function($ctx1) {
  41936. //>>excludeEnd("ctx");
  41937. var $1,$2,$4,$3;
  41938. $1=self._stream();
  41939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41940. $ctx1.sendIdx["stream"]=1;
  41941. //>>excludeEnd("ctx");
  41942. _st($1)._nextPutIf_with_((function(){
  41943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41944. return smalltalk.withContext(function($ctx2) {
  41945. //>>excludeEnd("ctx");
  41946. $2=self._stream();
  41947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41948. $ctx2.sendIdx["stream"]=2;
  41949. //>>excludeEnd("ctx");
  41950. _st($2)._nextPutAll_("smalltalk.assert(");
  41951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41952. $ctx2.sendIdx["nextPutAll:"]=1;
  41953. //>>excludeEnd("ctx");
  41954. $4=_st(anIRInlinedIfTrue)._instructions();
  41955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41956. $ctx2.sendIdx["instructions"]=1;
  41957. //>>excludeEnd("ctx");
  41958. $3=_st($4)._first();
  41959. self._visit_($3);
  41960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41961. $ctx2.sendIdx["visit:"]=1;
  41962. //>>excludeEnd("ctx");
  41963. return _st(self._stream())._nextPutAll_(")");
  41964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41966. //>>excludeEnd("ctx");
  41967. }),(function(){
  41968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41969. return smalltalk.withContext(function($ctx2) {
  41970. //>>excludeEnd("ctx");
  41971. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  41972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41974. //>>excludeEnd("ctx");
  41975. }));
  41976. return self;
  41977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41978. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)});
  41979. //>>excludeEnd("ctx");
  41980. },
  41981. //>>excludeStart("ide", pragmas.excludeIdeData);
  41982. args: ["anIRInlinedIfTrue"],
  41983. 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 ]",
  41984. referencedClasses: [],
  41985. //>>excludeEnd("ide");
  41986. messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  41987. }),
  41988. globals.IRInliningJSTranslator);
  41989. smalltalk.addMethod(
  41990. smalltalk.method({
  41991. selector: "visitIRInlinedIfTrueIfFalse:",
  41992. protocol: 'visiting',
  41993. fn: function (anIRInlinedIfTrueIfFalse){
  41994. var self=this;
  41995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41996. return smalltalk.withContext(function($ctx1) {
  41997. //>>excludeEnd("ctx");
  41998. var $1,$2,$4,$3,$6,$5;
  41999. $1=self._stream();
  42000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42001. $ctx1.sendIdx["stream"]=1;
  42002. //>>excludeEnd("ctx");
  42003. _st($1)._nextPutIfElse_with_with_((function(){
  42004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42005. return smalltalk.withContext(function($ctx2) {
  42006. //>>excludeEnd("ctx");
  42007. $2=self._stream();
  42008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42009. $ctx2.sendIdx["stream"]=2;
  42010. //>>excludeEnd("ctx");
  42011. _st($2)._nextPutAll_("smalltalk.assert(");
  42012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42013. $ctx2.sendIdx["nextPutAll:"]=1;
  42014. //>>excludeEnd("ctx");
  42015. $4=_st(anIRInlinedIfTrueIfFalse)._instructions();
  42016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42017. $ctx2.sendIdx["instructions"]=1;
  42018. //>>excludeEnd("ctx");
  42019. $3=_st($4)._first();
  42020. self._visit_($3);
  42021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42022. $ctx2.sendIdx["visit:"]=1;
  42023. //>>excludeEnd("ctx");
  42024. return _st(self._stream())._nextPutAll_(")");
  42025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42027. //>>excludeEnd("ctx");
  42028. }),(function(){
  42029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42030. return smalltalk.withContext(function($ctx2) {
  42031. //>>excludeEnd("ctx");
  42032. $6=_st(anIRInlinedIfTrueIfFalse)._instructions();
  42033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42034. $ctx2.sendIdx["instructions"]=2;
  42035. //>>excludeEnd("ctx");
  42036. $5=_st($6)._second();
  42037. return self._visit_($5);
  42038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42039. $ctx2.sendIdx["visit:"]=2;
  42040. //>>excludeEnd("ctx");
  42041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42043. //>>excludeEnd("ctx");
  42044. }),(function(){
  42045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42046. return smalltalk.withContext(function($ctx2) {
  42047. //>>excludeEnd("ctx");
  42048. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  42049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42051. //>>excludeEnd("ctx");
  42052. }));
  42053. return self;
  42054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42055. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)});
  42056. //>>excludeEnd("ctx");
  42057. },
  42058. //>>excludeStart("ide", pragmas.excludeIdeData);
  42059. args: ["anIRInlinedIfTrueIfFalse"],
  42060. 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 ]",
  42061. referencedClasses: [],
  42062. //>>excludeEnd("ide");
  42063. messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  42064. }),
  42065. globals.IRInliningJSTranslator);
  42066. smalltalk.addMethod(
  42067. smalltalk.method({
  42068. selector: "visitIRInlinedNonLocalReturn:",
  42069. protocol: 'visiting',
  42070. fn: function (anIRInlinedReturn){
  42071. var self=this;
  42072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42073. return smalltalk.withContext(function($ctx1) {
  42074. //>>excludeEnd("ctx");
  42075. var $1;
  42076. $1=self._stream();
  42077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42078. $ctx1.sendIdx["stream"]=1;
  42079. //>>excludeEnd("ctx");
  42080. _st($1)._nextPutStatementWith_((function(){
  42081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42082. return smalltalk.withContext(function($ctx2) {
  42083. //>>excludeEnd("ctx");
  42084. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  42085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42087. //>>excludeEnd("ctx");
  42088. }));
  42089. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  42090. }));
  42091. return self;
  42092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42093. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)});
  42094. //>>excludeEnd("ctx");
  42095. },
  42096. //>>excludeStart("ide", pragmas.excludeIdeData);
  42097. args: ["anIRInlinedReturn"],
  42098. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  42099. referencedClasses: [],
  42100. //>>excludeEnd("ide");
  42101. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  42102. }),
  42103. globals.IRInliningJSTranslator);
  42104. smalltalk.addMethod(
  42105. smalltalk.method({
  42106. selector: "visitIRInlinedReturn:",
  42107. protocol: 'visiting',
  42108. fn: function (anIRInlinedReturn){
  42109. var self=this;
  42110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42111. return smalltalk.withContext(function($ctx1) {
  42112. //>>excludeEnd("ctx");
  42113. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  42114. return self;
  42115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42116. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)});
  42117. //>>excludeEnd("ctx");
  42118. },
  42119. //>>excludeStart("ide", pragmas.excludeIdeData);
  42120. args: ["anIRInlinedReturn"],
  42121. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  42122. referencedClasses: [],
  42123. //>>excludeEnd("ide");
  42124. messageSends: ["visit:", "last", "instructions"]
  42125. }),
  42126. globals.IRInliningJSTranslator);
  42127. smalltalk.addMethod(
  42128. smalltalk.method({
  42129. selector: "visitIRInlinedSequence:",
  42130. protocol: 'visiting',
  42131. fn: function (anIRInlinedSequence){
  42132. var self=this;
  42133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42134. return smalltalk.withContext(function($ctx1) {
  42135. //>>excludeEnd("ctx");
  42136. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  42137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42138. return smalltalk.withContext(function($ctx2) {
  42139. //>>excludeEnd("ctx");
  42140. return _st(self._stream())._nextPutStatementWith_((function(){
  42141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42142. return smalltalk.withContext(function($ctx3) {
  42143. //>>excludeEnd("ctx");
  42144. return self._visit_(each);
  42145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42147. //>>excludeEnd("ctx");
  42148. }));
  42149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42151. //>>excludeEnd("ctx");
  42152. }));
  42153. return self;
  42154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42155. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)});
  42156. //>>excludeEnd("ctx");
  42157. },
  42158. //>>excludeStart("ide", pragmas.excludeIdeData);
  42159. args: ["anIRInlinedSequence"],
  42160. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  42161. referencedClasses: [],
  42162. //>>excludeEnd("ide");
  42163. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  42164. }),
  42165. globals.IRInliningJSTranslator);
  42166. smalltalk.addClass('IRSendInliner', globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  42167. //>>excludeStart("ide", pragmas.excludeIdeData);
  42168. globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  42169. //>>excludeEnd("ide");
  42170. smalltalk.addMethod(
  42171. smalltalk.method({
  42172. selector: "ifFalse:",
  42173. protocol: 'inlining',
  42174. fn: function (anIRInstruction){
  42175. var self=this;
  42176. function $IRInlinedIfFalse(){return globals.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  42177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42178. return smalltalk.withContext(function($ctx1) {
  42179. //>>excludeEnd("ctx");
  42180. var $1;
  42181. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  42182. return $1;
  42183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42184. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42185. //>>excludeEnd("ctx");
  42186. },
  42187. //>>excludeStart("ide", pragmas.excludeIdeData);
  42188. args: ["anIRInstruction"],
  42189. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
  42190. referencedClasses: ["IRInlinedIfFalse"],
  42191. //>>excludeEnd("ide");
  42192. messageSends: ["inlinedSend:with:", "new"]
  42193. }),
  42194. globals.IRSendInliner);
  42195. smalltalk.addMethod(
  42196. smalltalk.method({
  42197. selector: "ifFalse:ifTrue:",
  42198. protocol: 'inlining',
  42199. fn: function (anIRInstruction,anotherIRInstruction){
  42200. var self=this;
  42201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42202. return smalltalk.withContext(function($ctx1) {
  42203. //>>excludeEnd("ctx");
  42204. var $1;
  42205. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  42206. return $1;
  42207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42208. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42209. //>>excludeEnd("ctx");
  42210. },
  42211. //>>excludeStart("ide", pragmas.excludeIdeData);
  42212. args: ["anIRInstruction", "anotherIRInstruction"],
  42213. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  42214. referencedClasses: [],
  42215. //>>excludeEnd("ide");
  42216. messageSends: ["perform:withArguments:"]
  42217. }),
  42218. globals.IRSendInliner);
  42219. smalltalk.addMethod(
  42220. smalltalk.method({
  42221. selector: "ifNil:",
  42222. protocol: 'inlining',
  42223. fn: function (anIRInstruction){
  42224. var self=this;
  42225. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42226. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  42227. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  42228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42229. return smalltalk.withContext(function($ctx1) {
  42230. //>>excludeEnd("ctx");
  42231. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  42232. $2=_st($IRInlinedIfNilIfNotNil())._new();
  42233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42234. $ctx1.sendIdx["new"]=1;
  42235. //>>excludeEnd("ctx");
  42236. $4=_st($IRClosure())._new();
  42237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42238. $ctx1.sendIdx["new"]=2;
  42239. //>>excludeEnd("ctx");
  42240. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  42241. $5=$4;
  42242. $7=_st($IRBlockSequence())._new();
  42243. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  42244. $8=_st($7)._yourself();
  42245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42246. $ctx1.sendIdx["yourself"]=1;
  42247. //>>excludeEnd("ctx");
  42248. $6=$8;
  42249. _st($5)._add_($6);
  42250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42251. $ctx1.sendIdx["add:"]=1;
  42252. //>>excludeEnd("ctx");
  42253. $9=_st($4)._yourself();
  42254. $3=$9;
  42255. $1=self._inlinedSend_with_with_($2,anIRInstruction,$3);
  42256. return $1;
  42257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42258. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42259. //>>excludeEnd("ctx");
  42260. },
  42261. //>>excludeStart("ide", pragmas.excludeIdeData);
  42262. args: ["anIRInstruction"],
  42263. 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)",
  42264. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  42265. //>>excludeEnd("ide");
  42266. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  42267. }),
  42268. globals.IRSendInliner);
  42269. smalltalk.addMethod(
  42270. smalltalk.method({
  42271. selector: "ifNil:ifNotNil:",
  42272. protocol: 'inlining',
  42273. fn: function (anIRInstruction,anotherIRInstruction){
  42274. var self=this;
  42275. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42277. return smalltalk.withContext(function($ctx1) {
  42278. //>>excludeEnd("ctx");
  42279. var $1;
  42280. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  42281. return $1;
  42282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42283. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42284. //>>excludeEnd("ctx");
  42285. },
  42286. //>>excludeStart("ide", pragmas.excludeIdeData);
  42287. args: ["anIRInstruction", "anotherIRInstruction"],
  42288. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
  42289. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  42290. //>>excludeEnd("ide");
  42291. messageSends: ["inlinedSend:with:with:", "new"]
  42292. }),
  42293. globals.IRSendInliner);
  42294. smalltalk.addMethod(
  42295. smalltalk.method({
  42296. selector: "ifNotNil:",
  42297. protocol: 'inlining',
  42298. fn: function (anIRInstruction){
  42299. var self=this;
  42300. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42301. function $IRClosure(){return globals.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  42302. function $IRBlockSequence(){return globals.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  42303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42304. return smalltalk.withContext(function($ctx1) {
  42305. //>>excludeEnd("ctx");
  42306. var $2,$4,$5,$7,$8,$6,$9,$3,$1;
  42307. $2=_st($IRInlinedIfNilIfNotNil())._new();
  42308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42309. $ctx1.sendIdx["new"]=1;
  42310. //>>excludeEnd("ctx");
  42311. $4=_st($IRClosure())._new();
  42312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42313. $ctx1.sendIdx["new"]=2;
  42314. //>>excludeEnd("ctx");
  42315. _st($4)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  42316. $5=$4;
  42317. $7=_st($IRBlockSequence())._new();
  42318. _st($7)._add_(_st(_st(self._send())._instructions())._first());
  42319. $8=_st($7)._yourself();
  42320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42321. $ctx1.sendIdx["yourself"]=1;
  42322. //>>excludeEnd("ctx");
  42323. $6=$8;
  42324. _st($5)._add_($6);
  42325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42326. $ctx1.sendIdx["add:"]=1;
  42327. //>>excludeEnd("ctx");
  42328. $9=_st($4)._yourself();
  42329. $3=$9;
  42330. $1=self._inlinedSend_with_with_($2,$3,anIRInstruction);
  42331. return $1;
  42332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42333. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42334. //>>excludeEnd("ctx");
  42335. },
  42336. //>>excludeStart("ide", pragmas.excludeIdeData);
  42337. args: ["anIRInstruction"],
  42338. 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",
  42339. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  42340. //>>excludeEnd("ide");
  42341. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  42342. }),
  42343. globals.IRSendInliner);
  42344. smalltalk.addMethod(
  42345. smalltalk.method({
  42346. selector: "ifNotNil:ifNil:",
  42347. protocol: 'inlining',
  42348. fn: function (anIRInstruction,anotherIRInstruction){
  42349. var self=this;
  42350. function $IRInlinedIfNilIfNotNil(){return globals.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  42351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42352. return smalltalk.withContext(function($ctx1) {
  42353. //>>excludeEnd("ctx");
  42354. var $1;
  42355. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  42356. return $1;
  42357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42358. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42359. //>>excludeEnd("ctx");
  42360. },
  42361. //>>excludeStart("ide", pragmas.excludeIdeData);
  42362. args: ["anIRInstruction", "anotherIRInstruction"],
  42363. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
  42364. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  42365. //>>excludeEnd("ide");
  42366. messageSends: ["inlinedSend:with:with:", "new"]
  42367. }),
  42368. globals.IRSendInliner);
  42369. smalltalk.addMethod(
  42370. smalltalk.method({
  42371. selector: "ifTrue:",
  42372. protocol: 'inlining',
  42373. fn: function (anIRInstruction){
  42374. var self=this;
  42375. function $IRInlinedIfTrue(){return globals.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  42376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42377. return smalltalk.withContext(function($ctx1) {
  42378. //>>excludeEnd("ctx");
  42379. var $1;
  42380. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  42381. return $1;
  42382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42383. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)});
  42384. //>>excludeEnd("ctx");
  42385. },
  42386. //>>excludeStart("ide", pragmas.excludeIdeData);
  42387. args: ["anIRInstruction"],
  42388. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
  42389. referencedClasses: ["IRInlinedIfTrue"],
  42390. //>>excludeEnd("ide");
  42391. messageSends: ["inlinedSend:with:", "new"]
  42392. }),
  42393. globals.IRSendInliner);
  42394. smalltalk.addMethod(
  42395. smalltalk.method({
  42396. selector: "ifTrue:ifFalse:",
  42397. protocol: 'inlining',
  42398. fn: function (anIRInstruction,anotherIRInstruction){
  42399. var self=this;
  42400. function $IRInlinedIfTrueIfFalse(){return globals.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  42401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42402. return smalltalk.withContext(function($ctx1) {
  42403. //>>excludeEnd("ctx");
  42404. var $1;
  42405. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  42406. return $1;
  42407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42408. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)});
  42409. //>>excludeEnd("ctx");
  42410. },
  42411. //>>excludeStart("ide", pragmas.excludeIdeData);
  42412. args: ["anIRInstruction", "anotherIRInstruction"],
  42413. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
  42414. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  42415. //>>excludeEnd("ide");
  42416. messageSends: ["inlinedSend:with:with:", "new"]
  42417. }),
  42418. globals.IRSendInliner);
  42419. smalltalk.addMethod(
  42420. smalltalk.method({
  42421. selector: "inlineClosure:",
  42422. protocol: 'inlining',
  42423. fn: function (anIRClosure){
  42424. var self=this;
  42425. var inlinedClosure,sequence,statements;
  42426. function $IRTempDeclaration(){return globals.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  42427. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  42428. function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  42429. function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  42430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42431. return smalltalk.withContext(function($ctx1) {
  42432. //>>excludeEnd("ctx");
  42433. 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;
  42434. inlinedClosure=self._inlinedClosure();
  42435. $1=inlinedClosure;
  42436. $2=$1;
  42437. $3=_st(anIRClosure)._scope();
  42438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42439. $ctx1.sendIdx["scope"]=1;
  42440. //>>excludeEnd("ctx");
  42441. _st($2)._scope_($3);
  42442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42443. $ctx1.sendIdx["scope:"]=1;
  42444. //>>excludeEnd("ctx");
  42445. $4=_st($1)._parent_(_st(anIRClosure)._parent());
  42446. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  42447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42448. return smalltalk.withContext(function($ctx2) {
  42449. //>>excludeEnd("ctx");
  42450. return _st(inlinedClosure)._add_(each);
  42451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42452. $ctx2.sendIdx["add:"]=1;
  42453. //>>excludeEnd("ctx");
  42454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42456. //>>excludeEnd("ctx");
  42457. }));
  42458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42459. $ctx1.sendIdx["do:"]=1;
  42460. //>>excludeEnd("ctx");
  42461. sequence=self._inlinedSequence();
  42462. _st(_st(anIRClosure)._arguments())._do_((function(each){
  42463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42464. return smalltalk.withContext(function($ctx2) {
  42465. //>>excludeEnd("ctx");
  42466. $5=inlinedClosure;
  42467. $7=_st($IRTempDeclaration())._new();
  42468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42469. $ctx2.sendIdx["new"]=1;
  42470. //>>excludeEnd("ctx");
  42471. _st($7)._name_(each);
  42472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42473. $ctx2.sendIdx["name:"]=1;
  42474. //>>excludeEnd("ctx");
  42475. $8=_st($7)._yourself();
  42476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42477. $ctx2.sendIdx["yourself"]=1;
  42478. //>>excludeEnd("ctx");
  42479. $6=$8;
  42480. _st($5)._add_($6);
  42481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42482. $ctx2.sendIdx["add:"]=2;
  42483. //>>excludeEnd("ctx");
  42484. $9=sequence;
  42485. $11=_st($IRAssignment())._new();
  42486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42487. $ctx2.sendIdx["new"]=2;
  42488. //>>excludeEnd("ctx");
  42489. $12=$11;
  42490. $14=_st($IRVariable())._new();
  42491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42492. $ctx2.sendIdx["new"]=3;
  42493. //>>excludeEnd("ctx");
  42494. $16=_st($AliasVar())._new();
  42495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42496. $ctx2.sendIdx["new"]=4;
  42497. //>>excludeEnd("ctx");
  42498. $17=$16;
  42499. $18=_st(inlinedClosure)._scope();
  42500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42501. $ctx2.sendIdx["scope"]=2;
  42502. //>>excludeEnd("ctx");
  42503. _st($17)._scope_($18);
  42504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42505. $ctx2.sendIdx["scope:"]=2;
  42506. //>>excludeEnd("ctx");
  42507. _st($16)._name_(each);
  42508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42509. $ctx2.sendIdx["name:"]=2;
  42510. //>>excludeEnd("ctx");
  42511. $19=_st($16)._yourself();
  42512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42513. $ctx2.sendIdx["yourself"]=2;
  42514. //>>excludeEnd("ctx");
  42515. $15=$19;
  42516. $13=_st($14)._variable_($15);
  42517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42518. $ctx2.sendIdx["variable:"]=1;
  42519. //>>excludeEnd("ctx");
  42520. _st($12)._add_($13);
  42521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42522. $ctx2.sendIdx["add:"]=4;
  42523. //>>excludeEnd("ctx");
  42524. $20=$11;
  42525. $22=_st($IRVariable())._new();
  42526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42527. $ctx2.sendIdx["new"]=5;
  42528. //>>excludeEnd("ctx");
  42529. $24=_st($AliasVar())._new();
  42530. _st($24)._scope_(_st(inlinedClosure)._scope());
  42531. _st($24)._name_("$receiver");
  42532. $25=_st($24)._yourself();
  42533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42534. $ctx2.sendIdx["yourself"]=3;
  42535. //>>excludeEnd("ctx");
  42536. $23=$25;
  42537. $21=_st($22)._variable_($23);
  42538. _st($20)._add_($21);
  42539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42540. $ctx2.sendIdx["add:"]=5;
  42541. //>>excludeEnd("ctx");
  42542. $26=_st($11)._yourself();
  42543. $10=$26;
  42544. return _st($9)._add_($10);
  42545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42546. $ctx2.sendIdx["add:"]=3;
  42547. //>>excludeEnd("ctx");
  42548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42550. //>>excludeEnd("ctx");
  42551. }));
  42552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42553. $ctx1.sendIdx["do:"]=2;
  42554. //>>excludeEnd("ctx");
  42555. _st(inlinedClosure)._add_(sequence);
  42556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42557. $ctx1.sendIdx["add:"]=6;
  42558. //>>excludeEnd("ctx");
  42559. $28=_st(anIRClosure)._instructions();
  42560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42561. $ctx1.sendIdx["instructions"]=2;
  42562. //>>excludeEnd("ctx");
  42563. $27=_st($28)._last();
  42564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42565. $ctx1.sendIdx["last"]=1;
  42566. //>>excludeEnd("ctx");
  42567. statements=_st($27)._instructions();
  42568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42569. $ctx1.sendIdx["instructions"]=1;
  42570. //>>excludeEnd("ctx");
  42571. _st(statements)._ifNotEmpty_((function(){
  42572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42573. return smalltalk.withContext(function($ctx2) {
  42574. //>>excludeEnd("ctx");
  42575. _st(_st(statements)._allButLast())._do_((function(each){
  42576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42577. return smalltalk.withContext(function($ctx3) {
  42578. //>>excludeEnd("ctx");
  42579. return _st(sequence)._add_(each);
  42580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42581. $ctx3.sendIdx["add:"]=7;
  42582. //>>excludeEnd("ctx");
  42583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42584. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  42585. //>>excludeEnd("ctx");
  42586. }));
  42587. $31=_st(statements)._last();
  42588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42589. $ctx2.sendIdx["last"]=2;
  42590. //>>excludeEnd("ctx");
  42591. $30=_st($31)._isReturn();
  42592. $29=_st($30)._and_((function(){
  42593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42594. return smalltalk.withContext(function($ctx3) {
  42595. //>>excludeEnd("ctx");
  42596. $32=_st(statements)._last();
  42597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42598. $ctx3.sendIdx["last"]=3;
  42599. //>>excludeEnd("ctx");
  42600. return _st($32)._isBlockReturn();
  42601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42602. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  42603. //>>excludeEnd("ctx");
  42604. }));
  42605. if(smalltalk.assert($29)){
  42606. $33=sequence;
  42607. $36=_st(statements)._last();
  42608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42609. $ctx2.sendIdx["last"]=4;
  42610. //>>excludeEnd("ctx");
  42611. $35=_st($36)._instructions();
  42612. $34=_st($35)._first();
  42613. return _st($33)._add_($34);
  42614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42615. $ctx2.sendIdx["add:"]=8;
  42616. //>>excludeEnd("ctx");
  42617. } else {
  42618. return _st(sequence)._add_(_st(statements)._last());
  42619. };
  42620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42622. //>>excludeEnd("ctx");
  42623. }));
  42624. $37=inlinedClosure;
  42625. return $37;
  42626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42627. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)});
  42628. //>>excludeEnd("ctx");
  42629. },
  42630. //>>excludeStart("ide", pragmas.excludeIdeData);
  42631. args: ["anIRClosure"],
  42632. 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",
  42633. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  42634. //>>excludeEnd("ide");
  42635. 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"]
  42636. }),
  42637. globals.IRSendInliner);
  42638. smalltalk.addMethod(
  42639. smalltalk.method({
  42640. selector: "inlineSend:",
  42641. protocol: 'inlining',
  42642. fn: function (anIRSend){
  42643. var self=this;
  42644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42645. return smalltalk.withContext(function($ctx1) {
  42646. //>>excludeEnd("ctx");
  42647. var $3,$2,$1;
  42648. self._send_(anIRSend);
  42649. $3=self._send();
  42650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42651. $ctx1.sendIdx["send"]=1;
  42652. //>>excludeEnd("ctx");
  42653. $2=_st($3)._selector();
  42654. $1=self._perform_withArguments_($2,_st(_st(self._send())._instructions())._allButFirst());
  42655. return $1;
  42656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42657. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)});
  42658. //>>excludeEnd("ctx");
  42659. },
  42660. //>>excludeStart("ide", pragmas.excludeIdeData);
  42661. args: ["anIRSend"],
  42662. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  42663. referencedClasses: [],
  42664. //>>excludeEnd("ide");
  42665. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  42666. }),
  42667. globals.IRSendInliner);
  42668. smalltalk.addMethod(
  42669. smalltalk.method({
  42670. selector: "inlinedClosure",
  42671. protocol: 'factory',
  42672. fn: function (){
  42673. var self=this;
  42674. function $IRInlinedClosure(){return globals.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  42675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42676. return smalltalk.withContext(function($ctx1) {
  42677. //>>excludeEnd("ctx");
  42678. var $1;
  42679. $1=_st($IRInlinedClosure())._new();
  42680. return $1;
  42681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42682. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)});
  42683. //>>excludeEnd("ctx");
  42684. },
  42685. //>>excludeStart("ide", pragmas.excludeIdeData);
  42686. args: [],
  42687. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  42688. referencedClasses: ["IRInlinedClosure"],
  42689. //>>excludeEnd("ide");
  42690. messageSends: ["new"]
  42691. }),
  42692. globals.IRSendInliner);
  42693. smalltalk.addMethod(
  42694. smalltalk.method({
  42695. selector: "inlinedSend:with:",
  42696. protocol: 'inlining',
  42697. fn: function (inlinedSend,anIRInstruction){
  42698. var self=this;
  42699. var inlinedClosure;
  42700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42701. return smalltalk.withContext(function($ctx1) {
  42702. //>>excludeEnd("ctx");
  42703. var $1,$2,$5,$4,$3,$6,$7;
  42704. $1=_st(anIRInstruction)._isClosure();
  42705. if(! smalltalk.assert($1)){
  42706. self._inliningError_("Message argument should be a block");
  42707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42708. $ctx1.sendIdx["inliningError:"]=1;
  42709. //>>excludeEnd("ctx");
  42710. };
  42711. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  42712. if(! smalltalk.assert($2)){
  42713. self._inliningError_("Inlined block should have zero argument");
  42714. };
  42715. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  42716. $5=self._send();
  42717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42718. $ctx1.sendIdx["send"]=1;
  42719. //>>excludeEnd("ctx");
  42720. $4=_st($5)._instructions();
  42721. $3=_st($4)._first();
  42722. _st(inlinedSend)._add_($3);
  42723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42724. $ctx1.sendIdx["add:"]=1;
  42725. //>>excludeEnd("ctx");
  42726. $6=_st(inlinedSend)._add_(inlinedClosure);
  42727. _st(self._send())._replaceWith_(inlinedSend);
  42728. $7=_st(_st(inlinedSend)._method())._internalVariables();
  42729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42730. $ctx1.sendIdx["internalVariables"]=1;
  42731. //>>excludeEnd("ctx");
  42732. _st($7)._addAll_(_st(inlinedSend)._internalVariables());
  42733. return inlinedSend;
  42734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42735. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)});
  42736. //>>excludeEnd("ctx");
  42737. },
  42738. //>>excludeStart("ide", pragmas.excludeIdeData);
  42739. args: ["inlinedSend", "anIRInstruction"],
  42740. 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",
  42741. referencedClasses: [],
  42742. //>>excludeEnd("ide");
  42743. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42744. }),
  42745. globals.IRSendInliner);
  42746. smalltalk.addMethod(
  42747. smalltalk.method({
  42748. selector: "inlinedSend:with:with:",
  42749. protocol: 'inlining',
  42750. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  42751. var self=this;
  42752. var inlinedClosure1,inlinedClosure2;
  42753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42754. return smalltalk.withContext(function($ctx1) {
  42755. //>>excludeEnd("ctx");
  42756. var $1,$2,$3,$4,$7,$6,$5,$8,$9;
  42757. $1=_st(anIRInstruction)._isClosure();
  42758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42759. $ctx1.sendIdx["isClosure"]=1;
  42760. //>>excludeEnd("ctx");
  42761. if(! smalltalk.assert($1)){
  42762. self._inliningError_("Message argument should be a block");
  42763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42764. $ctx1.sendIdx["inliningError:"]=1;
  42765. //>>excludeEnd("ctx");
  42766. };
  42767. $2=_st(anotherIRInstruction)._isClosure();
  42768. if(! smalltalk.assert($2)){
  42769. self._inliningError_("Message argument should be a block");
  42770. };
  42771. $3=self._translator();
  42772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42773. $ctx1.sendIdx["translator"]=1;
  42774. //>>excludeEnd("ctx");
  42775. $4=self._inlineClosure_(anIRInstruction);
  42776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42777. $ctx1.sendIdx["inlineClosure:"]=1;
  42778. //>>excludeEnd("ctx");
  42779. inlinedClosure1=_st($3)._visit_($4);
  42780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42781. $ctx1.sendIdx["visit:"]=1;
  42782. //>>excludeEnd("ctx");
  42783. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  42784. $7=self._send();
  42785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42786. $ctx1.sendIdx["send"]=1;
  42787. //>>excludeEnd("ctx");
  42788. $6=_st($7)._instructions();
  42789. $5=_st($6)._first();
  42790. _st(inlinedSend)._add_($5);
  42791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42792. $ctx1.sendIdx["add:"]=1;
  42793. //>>excludeEnd("ctx");
  42794. _st(inlinedSend)._add_(inlinedClosure1);
  42795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42796. $ctx1.sendIdx["add:"]=2;
  42797. //>>excludeEnd("ctx");
  42798. $8=_st(inlinedSend)._add_(inlinedClosure2);
  42799. _st(self._send())._replaceWith_(inlinedSend);
  42800. $9=_st(_st(inlinedSend)._method())._internalVariables();
  42801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42802. $ctx1.sendIdx["internalVariables"]=1;
  42803. //>>excludeEnd("ctx");
  42804. _st($9)._addAll_(_st(inlinedSend)._internalVariables());
  42805. return inlinedSend;
  42806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42807. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)});
  42808. //>>excludeEnd("ctx");
  42809. },
  42810. //>>excludeStart("ide", pragmas.excludeIdeData);
  42811. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  42812. 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",
  42813. referencedClasses: [],
  42814. //>>excludeEnd("ide");
  42815. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  42816. }),
  42817. globals.IRSendInliner);
  42818. smalltalk.addMethod(
  42819. smalltalk.method({
  42820. selector: "inlinedSequence",
  42821. protocol: 'factory',
  42822. fn: function (){
  42823. var self=this;
  42824. function $IRInlinedSequence(){return globals.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  42825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42826. return smalltalk.withContext(function($ctx1) {
  42827. //>>excludeEnd("ctx");
  42828. var $1;
  42829. $1=_st($IRInlinedSequence())._new();
  42830. return $1;
  42831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42832. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)});
  42833. //>>excludeEnd("ctx");
  42834. },
  42835. //>>excludeStart("ide", pragmas.excludeIdeData);
  42836. args: [],
  42837. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  42838. referencedClasses: ["IRInlinedSequence"],
  42839. //>>excludeEnd("ide");
  42840. messageSends: ["new"]
  42841. }),
  42842. globals.IRSendInliner);
  42843. smalltalk.addMethod(
  42844. smalltalk.method({
  42845. selector: "inliningError:",
  42846. protocol: 'error handling',
  42847. fn: function (aString){
  42848. var self=this;
  42849. function $InliningError(){return globals.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  42850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42851. return smalltalk.withContext(function($ctx1) {
  42852. //>>excludeEnd("ctx");
  42853. _st($InliningError())._signal_(aString);
  42854. return self;
  42855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42856. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)});
  42857. //>>excludeEnd("ctx");
  42858. },
  42859. //>>excludeStart("ide", pragmas.excludeIdeData);
  42860. args: ["aString"],
  42861. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  42862. referencedClasses: ["InliningError"],
  42863. //>>excludeEnd("ide");
  42864. messageSends: ["signal:"]
  42865. }),
  42866. globals.IRSendInliner);
  42867. smalltalk.addMethod(
  42868. smalltalk.method({
  42869. selector: "send",
  42870. protocol: 'accessing',
  42871. fn: function (){
  42872. var self=this;
  42873. var $1;
  42874. $1=self["@send"];
  42875. return $1;
  42876. },
  42877. //>>excludeStart("ide", pragmas.excludeIdeData);
  42878. args: [],
  42879. source: "send\x0a\x09^ send",
  42880. referencedClasses: [],
  42881. //>>excludeEnd("ide");
  42882. messageSends: []
  42883. }),
  42884. globals.IRSendInliner);
  42885. smalltalk.addMethod(
  42886. smalltalk.method({
  42887. selector: "send:",
  42888. protocol: 'accessing',
  42889. fn: function (anIRSend){
  42890. var self=this;
  42891. self["@send"]=anIRSend;
  42892. return self;
  42893. },
  42894. //>>excludeStart("ide", pragmas.excludeIdeData);
  42895. args: ["anIRSend"],
  42896. source: "send: anIRSend\x0a\x09send := anIRSend",
  42897. referencedClasses: [],
  42898. //>>excludeEnd("ide");
  42899. messageSends: []
  42900. }),
  42901. globals.IRSendInliner);
  42902. smalltalk.addMethod(
  42903. smalltalk.method({
  42904. selector: "translator",
  42905. protocol: 'accessing',
  42906. fn: function (){
  42907. var self=this;
  42908. var $1;
  42909. $1=self["@translator"];
  42910. return $1;
  42911. },
  42912. //>>excludeStart("ide", pragmas.excludeIdeData);
  42913. args: [],
  42914. source: "translator\x0a\x09^ translator",
  42915. referencedClasses: [],
  42916. //>>excludeEnd("ide");
  42917. messageSends: []
  42918. }),
  42919. globals.IRSendInliner);
  42920. smalltalk.addMethod(
  42921. smalltalk.method({
  42922. selector: "translator:",
  42923. protocol: 'accessing',
  42924. fn: function (anASTTranslator){
  42925. var self=this;
  42926. self["@translator"]=anASTTranslator;
  42927. return self;
  42928. },
  42929. //>>excludeStart("ide", pragmas.excludeIdeData);
  42930. args: ["anASTTranslator"],
  42931. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  42932. referencedClasses: [],
  42933. //>>excludeEnd("ide");
  42934. messageSends: []
  42935. }),
  42936. globals.IRSendInliner);
  42937. smalltalk.addMethod(
  42938. smalltalk.method({
  42939. selector: "inlinedSelectors",
  42940. protocol: 'accessing',
  42941. fn: function (){
  42942. var self=this;
  42943. var $1;
  42944. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  42945. return $1;
  42946. },
  42947. //>>excludeStart("ide", pragmas.excludeIdeData);
  42948. args: [],
  42949. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  42950. referencedClasses: [],
  42951. //>>excludeEnd("ide");
  42952. messageSends: []
  42953. }),
  42954. globals.IRSendInliner.klass);
  42955. smalltalk.addMethod(
  42956. smalltalk.method({
  42957. selector: "shouldInline:",
  42958. protocol: 'accessing',
  42959. fn: function (anIRInstruction){
  42960. var self=this;
  42961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42962. return smalltalk.withContext(function($ctx1) {
  42963. //>>excludeEnd("ctx");
  42964. var $1,$2;
  42965. var $early={};
  42966. try {
  42967. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  42968. if(! smalltalk.assert($1)){
  42969. return false;
  42970. };
  42971. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  42972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42973. return smalltalk.withContext(function($ctx2) {
  42974. //>>excludeEnd("ctx");
  42975. $2=_st(each)._isClosure();
  42976. if(! smalltalk.assert($2)){
  42977. throw $early=[false];
  42978. };
  42979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42981. //>>excludeEnd("ctx");
  42982. }));
  42983. return true;
  42984. }
  42985. catch(e) {if(e===$early)return e[0]; throw e}
  42986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42987. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)});
  42988. //>>excludeEnd("ctx");
  42989. },
  42990. //>>excludeStart("ide", pragmas.excludeIdeData);
  42991. args: ["anIRInstruction"],
  42992. 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",
  42993. referencedClasses: [],
  42994. //>>excludeEnd("ide");
  42995. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"]
  42996. }),
  42997. globals.IRSendInliner.klass);
  42998. smalltalk.addClass('IRAssignmentInliner', globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  42999. //>>excludeStart("ide", pragmas.excludeIdeData);
  43000. 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};";
  43001. //>>excludeEnd("ide");
  43002. smalltalk.addMethod(
  43003. smalltalk.method({
  43004. selector: "assignment",
  43005. protocol: 'accessing',
  43006. fn: function (){
  43007. var self=this;
  43008. var $1;
  43009. $1=self["@assignment"];
  43010. return $1;
  43011. },
  43012. //>>excludeStart("ide", pragmas.excludeIdeData);
  43013. args: [],
  43014. source: "assignment\x0a\x09^ assignment",
  43015. referencedClasses: [],
  43016. //>>excludeEnd("ide");
  43017. messageSends: []
  43018. }),
  43019. globals.IRAssignmentInliner);
  43020. smalltalk.addMethod(
  43021. smalltalk.method({
  43022. selector: "assignment:",
  43023. protocol: 'accessing',
  43024. fn: function (aNode){
  43025. var self=this;
  43026. self["@assignment"]=aNode;
  43027. return self;
  43028. },
  43029. //>>excludeStart("ide", pragmas.excludeIdeData);
  43030. args: ["aNode"],
  43031. source: "assignment: aNode\x0a\x09assignment := aNode",
  43032. referencedClasses: [],
  43033. //>>excludeEnd("ide");
  43034. messageSends: []
  43035. }),
  43036. globals.IRAssignmentInliner);
  43037. smalltalk.addMethod(
  43038. smalltalk.method({
  43039. selector: "inlineAssignment:",
  43040. protocol: 'inlining',
  43041. fn: function (anIRAssignment){
  43042. var self=this;
  43043. var inlinedAssignment;
  43044. function $IRInlinedAssignment(){return globals.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  43045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43046. return smalltalk.withContext(function($ctx1) {
  43047. //>>excludeEnd("ctx");
  43048. var $1,$2;
  43049. self._assignment_(anIRAssignment);
  43050. inlinedAssignment=_st($IRInlinedAssignment())._new();
  43051. $1=_st(anIRAssignment)._instructions();
  43052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43053. $ctx1.sendIdx["instructions"]=1;
  43054. //>>excludeEnd("ctx");
  43055. _st($1)._do_((function(each){
  43056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43057. return smalltalk.withContext(function($ctx2) {
  43058. //>>excludeEnd("ctx");
  43059. return _st(inlinedAssignment)._add_(each);
  43060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43062. //>>excludeEnd("ctx");
  43063. }));
  43064. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  43065. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  43066. $2=inlinedAssignment;
  43067. return $2;
  43068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43069. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)});
  43070. //>>excludeEnd("ctx");
  43071. },
  43072. //>>excludeStart("ide", pragmas.excludeIdeData);
  43073. args: ["anIRAssignment"],
  43074. 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",
  43075. referencedClasses: ["IRInlinedAssignment"],
  43076. //>>excludeEnd("ide");
  43077. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  43078. }),
  43079. globals.IRAssignmentInliner);
  43080. smalltalk.addMethod(
  43081. smalltalk.method({
  43082. selector: "inlineClosure:",
  43083. protocol: 'inlining',
  43084. fn: function (anIRClosure){
  43085. var self=this;
  43086. var inlinedClosure,statements;
  43087. function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  43088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43089. return smalltalk.withContext(function($ctx1) {
  43090. //>>excludeEnd("ctx");
  43091. var $2,$1,$4,$3,$5,$7,$8,$6,$9;
  43092. inlinedClosure=(
  43093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43094. $ctx1.supercall = true,
  43095. //>>excludeEnd("ctx");
  43096. globals.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  43097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43098. $ctx1.supercall = false;
  43099. //>>excludeEnd("ctx");;
  43100. $2=_st(inlinedClosure)._instructions();
  43101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43102. $ctx1.sendIdx["instructions"]=2;
  43103. //>>excludeEnd("ctx");
  43104. $1=_st($2)._last();
  43105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43106. $ctx1.sendIdx["last"]=1;
  43107. //>>excludeEnd("ctx");
  43108. statements=_st($1)._instructions();
  43109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43110. $ctx1.sendIdx["instructions"]=1;
  43111. //>>excludeEnd("ctx");
  43112. _st(statements)._ifNotEmpty_((function(){
  43113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43114. return smalltalk.withContext(function($ctx2) {
  43115. //>>excludeEnd("ctx");
  43116. $4=_st(statements)._last();
  43117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43118. $ctx2.sendIdx["last"]=2;
  43119. //>>excludeEnd("ctx");
  43120. $3=_st($4)._canBeAssigned();
  43121. if(smalltalk.assert($3)){
  43122. $5=_st(statements)._last();
  43123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43124. $ctx2.sendIdx["last"]=3;
  43125. //>>excludeEnd("ctx");
  43126. $7=_st($IRAssignment())._new();
  43127. _st($7)._add_(_st(_st(self._assignment())._instructions())._first());
  43128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43129. $ctx2.sendIdx["add:"]=1;
  43130. //>>excludeEnd("ctx");
  43131. _st($7)._add_(_st(_st(statements)._last())._copy());
  43132. $8=_st($7)._yourself();
  43133. $6=$8;
  43134. return _st($5)._replaceWith_($6);
  43135. };
  43136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43138. //>>excludeEnd("ctx");
  43139. }));
  43140. $9=inlinedClosure;
  43141. return $9;
  43142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43143. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)});
  43144. //>>excludeEnd("ctx");
  43145. },
  43146. //>>excludeStart("ide", pragmas.excludeIdeData);
  43147. args: ["anIRClosure"],
  43148. 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",
  43149. referencedClasses: ["IRAssignment"],
  43150. //>>excludeEnd("ide");
  43151. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  43152. }),
  43153. globals.IRAssignmentInliner);
  43154. smalltalk.addClass('IRReturnInliner', globals.IRSendInliner, [], 'Compiler-Inlining');
  43155. //>>excludeStart("ide", pragmas.excludeIdeData);
  43156. globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  43157. //>>excludeEnd("ide");
  43158. smalltalk.addMethod(
  43159. smalltalk.method({
  43160. selector: "inlineClosure:",
  43161. protocol: 'inlining',
  43162. fn: function (anIRClosure){
  43163. var self=this;
  43164. var closure,statements;
  43165. function $IRReturn(){return globals.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  43166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43167. return smalltalk.withContext(function($ctx1) {
  43168. //>>excludeEnd("ctx");
  43169. var $1,$3,$2,$4,$5,$6,$7;
  43170. closure=(
  43171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43172. $ctx1.supercall = true,
  43173. //>>excludeEnd("ctx");
  43174. globals.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]));
  43175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43176. $ctx1.supercall = false;
  43177. //>>excludeEnd("ctx");;
  43178. $1=_st(_st(closure)._instructions())._last();
  43179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43180. $ctx1.sendIdx["last"]=1;
  43181. //>>excludeEnd("ctx");
  43182. statements=_st($1)._instructions();
  43183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43184. $ctx1.sendIdx["instructions"]=1;
  43185. //>>excludeEnd("ctx");
  43186. _st(statements)._ifNotEmpty_((function(){
  43187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43188. return smalltalk.withContext(function($ctx2) {
  43189. //>>excludeEnd("ctx");
  43190. $3=_st(statements)._last();
  43191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43192. $ctx2.sendIdx["last"]=2;
  43193. //>>excludeEnd("ctx");
  43194. $2=_st($3)._isReturn();
  43195. if(! smalltalk.assert($2)){
  43196. $4=_st(statements)._last();
  43197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43198. $ctx2.sendIdx["last"]=3;
  43199. //>>excludeEnd("ctx");
  43200. $5=_st($IRReturn())._new();
  43201. _st($5)._add_(_st(_st(statements)._last())._copy());
  43202. $6=_st($5)._yourself();
  43203. return _st($4)._replaceWith_($6);
  43204. };
  43205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43207. //>>excludeEnd("ctx");
  43208. }));
  43209. $7=closure;
  43210. return $7;
  43211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43212. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)});
  43213. //>>excludeEnd("ctx");
  43214. },
  43215. //>>excludeStart("ide", pragmas.excludeIdeData);
  43216. args: ["anIRClosure"],
  43217. 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",
  43218. referencedClasses: ["IRReturn"],
  43219. //>>excludeEnd("ide");
  43220. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  43221. }),
  43222. globals.IRReturnInliner);
  43223. smalltalk.addMethod(
  43224. smalltalk.method({
  43225. selector: "inlineReturn:",
  43226. protocol: 'inlining',
  43227. fn: function (anIRReturn){
  43228. var self=this;
  43229. var return_;
  43230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43231. return smalltalk.withContext(function($ctx1) {
  43232. //>>excludeEnd("ctx");
  43233. var $1,$2;
  43234. return_=self._inlinedReturn();
  43235. $1=_st(anIRReturn)._instructions();
  43236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43237. $ctx1.sendIdx["instructions"]=1;
  43238. //>>excludeEnd("ctx");
  43239. _st($1)._do_((function(each){
  43240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43241. return smalltalk.withContext(function($ctx2) {
  43242. //>>excludeEnd("ctx");
  43243. return _st(return_)._add_(each);
  43244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43246. //>>excludeEnd("ctx");
  43247. }));
  43248. _st(anIRReturn)._replaceWith_(return_);
  43249. self._inlineSend_(_st(_st(return_)._instructions())._last());
  43250. $2=return_;
  43251. return $2;
  43252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43253. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)});
  43254. //>>excludeEnd("ctx");
  43255. },
  43256. //>>excludeStart("ide", pragmas.excludeIdeData);
  43257. args: ["anIRReturn"],
  43258. 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",
  43259. referencedClasses: [],
  43260. //>>excludeEnd("ide");
  43261. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  43262. }),
  43263. globals.IRReturnInliner);
  43264. smalltalk.addMethod(
  43265. smalltalk.method({
  43266. selector: "inlinedReturn",
  43267. protocol: 'factory',
  43268. fn: function (){
  43269. var self=this;
  43270. function $IRInlinedReturn(){return globals.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  43271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43272. return smalltalk.withContext(function($ctx1) {
  43273. //>>excludeEnd("ctx");
  43274. var $1;
  43275. $1=_st($IRInlinedReturn())._new();
  43276. return $1;
  43277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43278. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)});
  43279. //>>excludeEnd("ctx");
  43280. },
  43281. //>>excludeStart("ide", pragmas.excludeIdeData);
  43282. args: [],
  43283. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  43284. referencedClasses: ["IRInlinedReturn"],
  43285. //>>excludeEnd("ide");
  43286. messageSends: ["new"]
  43287. }),
  43288. globals.IRReturnInliner);
  43289. smalltalk.addClass('InliningCodeGenerator', globals.CodeGenerator, [], 'Compiler-Inlining');
  43290. //>>excludeStart("ide", pragmas.excludeIdeData);
  43291. globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  43292. //>>excludeEnd("ide");
  43293. smalltalk.addMethod(
  43294. smalltalk.method({
  43295. selector: "compileNode:",
  43296. protocol: 'compiling',
  43297. fn: function (aNode){
  43298. var self=this;
  43299. var ir,stream;
  43300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43301. return smalltalk.withContext(function($ctx1) {
  43302. //>>excludeEnd("ctx");
  43303. var $2,$3,$1;
  43304. _st(self._semanticAnalyzer())._visit_(aNode);
  43305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43306. $ctx1.sendIdx["visit:"]=1;
  43307. //>>excludeEnd("ctx");
  43308. ir=_st(self._translator())._visit_(aNode);
  43309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43310. $ctx1.sendIdx["visit:"]=2;
  43311. //>>excludeEnd("ctx");
  43312. _st(self._inliner())._visit_(ir);
  43313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43314. $ctx1.sendIdx["visit:"]=3;
  43315. //>>excludeEnd("ctx");
  43316. $2=self._irTranslator();
  43317. _st($2)._currentClass_(self._currentClass());
  43318. _st($2)._visit_(ir);
  43319. $3=_st($2)._contents();
  43320. $1=$3;
  43321. return $1;
  43322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43323. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)});
  43324. //>>excludeEnd("ctx");
  43325. },
  43326. //>>excludeStart("ide", pragmas.excludeIdeData);
  43327. args: ["aNode"],
  43328. 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",
  43329. referencedClasses: [],
  43330. //>>excludeEnd("ide");
  43331. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  43332. }),
  43333. globals.InliningCodeGenerator);
  43334. smalltalk.addMethod(
  43335. smalltalk.method({
  43336. selector: "inliner",
  43337. protocol: 'compiling',
  43338. fn: function (){
  43339. var self=this;
  43340. function $IRInliner(){return globals.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  43341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43342. return smalltalk.withContext(function($ctx1) {
  43343. //>>excludeEnd("ctx");
  43344. var $1;
  43345. $1=_st($IRInliner())._new();
  43346. return $1;
  43347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43348. }, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)});
  43349. //>>excludeEnd("ctx");
  43350. },
  43351. //>>excludeStart("ide", pragmas.excludeIdeData);
  43352. args: [],
  43353. source: "inliner\x0a\x09^ IRInliner new",
  43354. referencedClasses: ["IRInliner"],
  43355. //>>excludeEnd("ide");
  43356. messageSends: ["new"]
  43357. }),
  43358. globals.InliningCodeGenerator);
  43359. smalltalk.addMethod(
  43360. smalltalk.method({
  43361. selector: "irTranslator",
  43362. protocol: 'compiling',
  43363. fn: function (){
  43364. var self=this;
  43365. function $IRInliningJSTranslator(){return globals.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  43366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43367. return smalltalk.withContext(function($ctx1) {
  43368. //>>excludeEnd("ctx");
  43369. var $1;
  43370. $1=_st($IRInliningJSTranslator())._new();
  43371. return $1;
  43372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43373. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)});
  43374. //>>excludeEnd("ctx");
  43375. },
  43376. //>>excludeStart("ide", pragmas.excludeIdeData);
  43377. args: [],
  43378. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  43379. referencedClasses: ["IRInliningJSTranslator"],
  43380. //>>excludeEnd("ide");
  43381. messageSends: ["new"]
  43382. }),
  43383. globals.InliningCodeGenerator);
  43384. });
  43385. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  43386. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  43387. smalltalk.addPackage('Compiler-Semantic');
  43388. smalltalk.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43389. smalltalk.addClass('LexicalScope', globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  43390. //>>excludeStart("ide", pragmas.excludeIdeData);
  43391. 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.";
  43392. //>>excludeEnd("ide");
  43393. smalltalk.addMethod(
  43394. smalltalk.method({
  43395. selector: "addArg:",
  43396. protocol: 'adding',
  43397. fn: function (aString){
  43398. var self=this;
  43399. function $ArgVar(){return globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  43400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43401. return smalltalk.withContext(function($ctx1) {
  43402. //>>excludeEnd("ctx");
  43403. var $1;
  43404. $1=self._args();
  43405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43406. $ctx1.sendIdx["args"]=1;
  43407. //>>excludeEnd("ctx");
  43408. _st($1)._at_put_(aString,_st($ArgVar())._on_(aString));
  43409. _st(_st(self._args())._at_(aString))._scope_(self);
  43410. return self;
  43411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43412. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},globals.LexicalScope)});
  43413. //>>excludeEnd("ctx");
  43414. },
  43415. //>>excludeStart("ide", pragmas.excludeIdeData);
  43416. args: ["aString"],
  43417. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  43418. referencedClasses: ["ArgVar"],
  43419. //>>excludeEnd("ide");
  43420. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  43421. }),
  43422. globals.LexicalScope);
  43423. smalltalk.addMethod(
  43424. smalltalk.method({
  43425. selector: "addTemp:",
  43426. protocol: 'adding',
  43427. fn: function (aString){
  43428. var self=this;
  43429. function $TempVar(){return globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  43430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43431. return smalltalk.withContext(function($ctx1) {
  43432. //>>excludeEnd("ctx");
  43433. var $1;
  43434. $1=self._temps();
  43435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43436. $ctx1.sendIdx["temps"]=1;
  43437. //>>excludeEnd("ctx");
  43438. _st($1)._at_put_(aString,_st($TempVar())._on_(aString));
  43439. _st(_st(self._temps())._at_(aString))._scope_(self);
  43440. return self;
  43441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43442. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},globals.LexicalScope)});
  43443. //>>excludeEnd("ctx");
  43444. },
  43445. //>>excludeStart("ide", pragmas.excludeIdeData);
  43446. args: ["aString"],
  43447. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  43448. referencedClasses: ["TempVar"],
  43449. //>>excludeEnd("ide");
  43450. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  43451. }),
  43452. globals.LexicalScope);
  43453. smalltalk.addMethod(
  43454. smalltalk.method({
  43455. selector: "alias",
  43456. protocol: 'accessing',
  43457. fn: function (){
  43458. var self=this;
  43459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43460. return smalltalk.withContext(function($ctx1) {
  43461. //>>excludeEnd("ctx");
  43462. var $1;
  43463. $1="$ctx".__comma(_st(self._scopeLevel())._asString());
  43464. return $1;
  43465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43466. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.LexicalScope)});
  43467. //>>excludeEnd("ctx");
  43468. },
  43469. //>>excludeStart("ide", pragmas.excludeIdeData);
  43470. args: [],
  43471. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  43472. referencedClasses: [],
  43473. //>>excludeEnd("ide");
  43474. messageSends: [",", "asString", "scopeLevel"]
  43475. }),
  43476. globals.LexicalScope);
  43477. smalltalk.addMethod(
  43478. smalltalk.method({
  43479. selector: "allVariableNames",
  43480. protocol: 'accessing',
  43481. fn: function (){
  43482. var self=this;
  43483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43484. return smalltalk.withContext(function($ctx1) {
  43485. //>>excludeEnd("ctx");
  43486. var $2,$1;
  43487. $2=_st(self._args())._keys();
  43488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43489. $ctx1.sendIdx["keys"]=1;
  43490. //>>excludeEnd("ctx");
  43491. $1=_st($2).__comma(_st(self._temps())._keys());
  43492. return $1;
  43493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43494. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.LexicalScope)});
  43495. //>>excludeEnd("ctx");
  43496. },
  43497. //>>excludeStart("ide", pragmas.excludeIdeData);
  43498. args: [],
  43499. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  43500. referencedClasses: [],
  43501. //>>excludeEnd("ide");
  43502. messageSends: [",", "keys", "args", "temps"]
  43503. }),
  43504. globals.LexicalScope);
  43505. smalltalk.addMethod(
  43506. smalltalk.method({
  43507. selector: "args",
  43508. protocol: 'accessing',
  43509. fn: function (){
  43510. var self=this;
  43511. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  43512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43513. return smalltalk.withContext(function($ctx1) {
  43514. //>>excludeEnd("ctx");
  43515. var $2,$1,$receiver;
  43516. $2=self["@args"];
  43517. if(($receiver = $2) == null || $receiver.isNil){
  43518. self["@args"]=_st($Dictionary())._new();
  43519. $1=self["@args"];
  43520. } else {
  43521. $1=$2;
  43522. };
  43523. return $1;
  43524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43525. }, function($ctx1) {$ctx1.fill(self,"args",{},globals.LexicalScope)});
  43526. //>>excludeEnd("ctx");
  43527. },
  43528. //>>excludeStart("ide", pragmas.excludeIdeData);
  43529. args: [],
  43530. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  43531. referencedClasses: ["Dictionary"],
  43532. //>>excludeEnd("ide");
  43533. messageSends: ["ifNil:", "new"]
  43534. }),
  43535. globals.LexicalScope);
  43536. smalltalk.addMethod(
  43537. smalltalk.method({
  43538. selector: "bindingFor:",
  43539. protocol: 'accessing',
  43540. fn: function (aStringOrNode){
  43541. var self=this;
  43542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43543. return smalltalk.withContext(function($ctx1) {
  43544. //>>excludeEnd("ctx");
  43545. var $2,$3,$4,$5,$1;
  43546. $2=self._pseudoVars();
  43547. $3=_st(aStringOrNode)._value();
  43548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43549. $ctx1.sendIdx["value"]=1;
  43550. //>>excludeEnd("ctx");
  43551. $1=_st($2)._at_ifAbsent_($3,(function(){
  43552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43553. return smalltalk.withContext(function($ctx2) {
  43554. //>>excludeEnd("ctx");
  43555. $4=self._args();
  43556. $5=_st(aStringOrNode)._value();
  43557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43558. $ctx2.sendIdx["value"]=2;
  43559. //>>excludeEnd("ctx");
  43560. return _st($4)._at_ifAbsent_($5,(function(){
  43561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43562. return smalltalk.withContext(function($ctx3) {
  43563. //>>excludeEnd("ctx");
  43564. return _st(self._temps())._at_ifAbsent_(_st(aStringOrNode)._value(),(function(){
  43565. return nil;
  43566. }));
  43567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43569. //>>excludeEnd("ctx");
  43570. }));
  43571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43572. $ctx2.sendIdx["at:ifAbsent:"]=2;
  43573. //>>excludeEnd("ctx");
  43574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43575. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43576. //>>excludeEnd("ctx");
  43577. }));
  43578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43579. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43580. //>>excludeEnd("ctx");
  43581. return $1;
  43582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43583. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},globals.LexicalScope)});
  43584. //>>excludeEnd("ctx");
  43585. },
  43586. //>>excludeStart("ide", pragmas.excludeIdeData);
  43587. args: ["aStringOrNode"],
  43588. 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 ]]]",
  43589. referencedClasses: [],
  43590. //>>excludeEnd("ide");
  43591. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  43592. }),
  43593. globals.LexicalScope);
  43594. smalltalk.addMethod(
  43595. smalltalk.method({
  43596. selector: "blockIndex",
  43597. protocol: 'accessing',
  43598. fn: function (){
  43599. var self=this;
  43600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43601. return smalltalk.withContext(function($ctx1) {
  43602. //>>excludeEnd("ctx");
  43603. var $2,$1,$receiver;
  43604. $2=self["@blockIndex"];
  43605. if(($receiver = $2) == null || $receiver.isNil){
  43606. $1=(0);
  43607. } else {
  43608. $1=$2;
  43609. };
  43610. return $1;
  43611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43612. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},globals.LexicalScope)});
  43613. //>>excludeEnd("ctx");
  43614. },
  43615. //>>excludeStart("ide", pragmas.excludeIdeData);
  43616. args: [],
  43617. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  43618. referencedClasses: [],
  43619. //>>excludeEnd("ide");
  43620. messageSends: ["ifNil:"]
  43621. }),
  43622. globals.LexicalScope);
  43623. smalltalk.addMethod(
  43624. smalltalk.method({
  43625. selector: "blockIndex:",
  43626. protocol: 'accessing',
  43627. fn: function (anInteger){
  43628. var self=this;
  43629. self["@blockIndex"]=anInteger;
  43630. return self;
  43631. },
  43632. //>>excludeStart("ide", pragmas.excludeIdeData);
  43633. args: ["anInteger"],
  43634. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  43635. referencedClasses: [],
  43636. //>>excludeEnd("ide");
  43637. messageSends: []
  43638. }),
  43639. globals.LexicalScope);
  43640. smalltalk.addMethod(
  43641. smalltalk.method({
  43642. selector: "canInlineNonLocalReturns",
  43643. protocol: 'testing',
  43644. fn: function (){
  43645. var self=this;
  43646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43647. return smalltalk.withContext(function($ctx1) {
  43648. //>>excludeEnd("ctx");
  43649. var $1;
  43650. $1=_st(self._isInlined())._and_((function(){
  43651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43652. return smalltalk.withContext(function($ctx2) {
  43653. //>>excludeEnd("ctx");
  43654. return _st(self._outerScope())._canInlineNonLocalReturns();
  43655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43657. //>>excludeEnd("ctx");
  43658. }));
  43659. return $1;
  43660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43661. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},globals.LexicalScope)});
  43662. //>>excludeEnd("ctx");
  43663. },
  43664. //>>excludeStart("ide", pragmas.excludeIdeData);
  43665. args: [],
  43666. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  43667. referencedClasses: [],
  43668. //>>excludeEnd("ide");
  43669. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  43670. }),
  43671. globals.LexicalScope);
  43672. smalltalk.addMethod(
  43673. smalltalk.method({
  43674. selector: "instruction",
  43675. protocol: 'accessing',
  43676. fn: function (){
  43677. var self=this;
  43678. var $1;
  43679. $1=self["@instruction"];
  43680. return $1;
  43681. },
  43682. //>>excludeStart("ide", pragmas.excludeIdeData);
  43683. args: [],
  43684. source: "instruction\x0a\x09^ instruction",
  43685. referencedClasses: [],
  43686. //>>excludeEnd("ide");
  43687. messageSends: []
  43688. }),
  43689. globals.LexicalScope);
  43690. smalltalk.addMethod(
  43691. smalltalk.method({
  43692. selector: "instruction:",
  43693. protocol: 'accessing',
  43694. fn: function (anIRInstruction){
  43695. var self=this;
  43696. self["@instruction"]=anIRInstruction;
  43697. return self;
  43698. },
  43699. //>>excludeStart("ide", pragmas.excludeIdeData);
  43700. args: ["anIRInstruction"],
  43701. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  43702. referencedClasses: [],
  43703. //>>excludeEnd("ide");
  43704. messageSends: []
  43705. }),
  43706. globals.LexicalScope);
  43707. smalltalk.addMethod(
  43708. smalltalk.method({
  43709. selector: "isBlockScope",
  43710. protocol: 'testing',
  43711. fn: function (){
  43712. var self=this;
  43713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43714. return smalltalk.withContext(function($ctx1) {
  43715. //>>excludeEnd("ctx");
  43716. var $1;
  43717. $1=_st(self._isMethodScope())._not();
  43718. return $1;
  43719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43720. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},globals.LexicalScope)});
  43721. //>>excludeEnd("ctx");
  43722. },
  43723. //>>excludeStart("ide", pragmas.excludeIdeData);
  43724. args: [],
  43725. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  43726. referencedClasses: [],
  43727. //>>excludeEnd("ide");
  43728. messageSends: ["not", "isMethodScope"]
  43729. }),
  43730. globals.LexicalScope);
  43731. smalltalk.addMethod(
  43732. smalltalk.method({
  43733. selector: "isInlined",
  43734. protocol: 'testing',
  43735. fn: function (){
  43736. var self=this;
  43737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43738. return smalltalk.withContext(function($ctx1) {
  43739. //>>excludeEnd("ctx");
  43740. var $3,$2,$1;
  43741. $3=self._instruction();
  43742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43743. $ctx1.sendIdx["instruction"]=1;
  43744. //>>excludeEnd("ctx");
  43745. $2=_st($3)._notNil();
  43746. $1=_st($2)._and_((function(){
  43747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43748. return smalltalk.withContext(function($ctx2) {
  43749. //>>excludeEnd("ctx");
  43750. return _st(self._instruction())._isInlined();
  43751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43753. //>>excludeEnd("ctx");
  43754. }));
  43755. return $1;
  43756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43757. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},globals.LexicalScope)});
  43758. //>>excludeEnd("ctx");
  43759. },
  43760. //>>excludeStart("ide", pragmas.excludeIdeData);
  43761. args: [],
  43762. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  43763. referencedClasses: [],
  43764. //>>excludeEnd("ide");
  43765. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  43766. }),
  43767. globals.LexicalScope);
  43768. smalltalk.addMethod(
  43769. smalltalk.method({
  43770. selector: "isMethodScope",
  43771. protocol: 'testing',
  43772. fn: function (){
  43773. var self=this;
  43774. return false;
  43775. },
  43776. //>>excludeStart("ide", pragmas.excludeIdeData);
  43777. args: [],
  43778. source: "isMethodScope\x0a\x09^ false",
  43779. referencedClasses: [],
  43780. //>>excludeEnd("ide");
  43781. messageSends: []
  43782. }),
  43783. globals.LexicalScope);
  43784. smalltalk.addMethod(
  43785. smalltalk.method({
  43786. selector: "lookupVariable:",
  43787. protocol: 'accessing',
  43788. fn: function (aNode){
  43789. var self=this;
  43790. var lookup;
  43791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43792. return smalltalk.withContext(function($ctx1) {
  43793. //>>excludeEnd("ctx");
  43794. var $1,$2,$3,$receiver;
  43795. lookup=self._bindingFor_(aNode);
  43796. $1=lookup;
  43797. if(($receiver = $1) == null || $receiver.isNil){
  43798. $2=self._outerScope();
  43799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43800. $ctx1.sendIdx["outerScope"]=1;
  43801. //>>excludeEnd("ctx");
  43802. if(($receiver = $2) == null || $receiver.isNil){
  43803. lookup=$2;
  43804. } else {
  43805. lookup=_st(self._outerScope())._lookupVariable_(aNode);
  43806. };
  43807. lookup;
  43808. } else {
  43809. $1;
  43810. };
  43811. $3=lookup;
  43812. return $3;
  43813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43814. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},globals.LexicalScope)});
  43815. //>>excludeEnd("ctx");
  43816. },
  43817. //>>excludeStart("ide", pragmas.excludeIdeData);
  43818. args: ["aNode"],
  43819. 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",
  43820. referencedClasses: [],
  43821. //>>excludeEnd("ide");
  43822. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  43823. }),
  43824. globals.LexicalScope);
  43825. smalltalk.addMethod(
  43826. smalltalk.method({
  43827. selector: "methodScope",
  43828. protocol: 'accessing',
  43829. fn: function (){
  43830. var self=this;
  43831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43832. return smalltalk.withContext(function($ctx1) {
  43833. //>>excludeEnd("ctx");
  43834. var $2,$1,$receiver;
  43835. $2=self._outerScope();
  43836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43837. $ctx1.sendIdx["outerScope"]=1;
  43838. //>>excludeEnd("ctx");
  43839. if(($receiver = $2) == null || $receiver.isNil){
  43840. $1=$2;
  43841. } else {
  43842. $1=_st(self._outerScope())._methodScope();
  43843. };
  43844. return $1;
  43845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43846. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},globals.LexicalScope)});
  43847. //>>excludeEnd("ctx");
  43848. },
  43849. //>>excludeStart("ide", pragmas.excludeIdeData);
  43850. args: [],
  43851. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  43852. referencedClasses: [],
  43853. //>>excludeEnd("ide");
  43854. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  43855. }),
  43856. globals.LexicalScope);
  43857. smalltalk.addMethod(
  43858. smalltalk.method({
  43859. selector: "node",
  43860. protocol: 'accessing',
  43861. fn: function (){
  43862. var self=this;
  43863. var $1;
  43864. $1=self["@node"];
  43865. return $1;
  43866. },
  43867. //>>excludeStart("ide", pragmas.excludeIdeData);
  43868. args: [],
  43869. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  43870. referencedClasses: [],
  43871. //>>excludeEnd("ide");
  43872. messageSends: []
  43873. }),
  43874. globals.LexicalScope);
  43875. smalltalk.addMethod(
  43876. smalltalk.method({
  43877. selector: "node:",
  43878. protocol: 'accessing',
  43879. fn: function (aNode){
  43880. var self=this;
  43881. self["@node"]=aNode;
  43882. return self;
  43883. },
  43884. //>>excludeStart("ide", pragmas.excludeIdeData);
  43885. args: ["aNode"],
  43886. source: "node: aNode\x0a\x09node := aNode",
  43887. referencedClasses: [],
  43888. //>>excludeEnd("ide");
  43889. messageSends: []
  43890. }),
  43891. globals.LexicalScope);
  43892. smalltalk.addMethod(
  43893. smalltalk.method({
  43894. selector: "outerScope",
  43895. protocol: 'accessing',
  43896. fn: function (){
  43897. var self=this;
  43898. var $1;
  43899. $1=self["@outerScope"];
  43900. return $1;
  43901. },
  43902. //>>excludeStart("ide", pragmas.excludeIdeData);
  43903. args: [],
  43904. source: "outerScope\x0a\x09^ outerScope",
  43905. referencedClasses: [],
  43906. //>>excludeEnd("ide");
  43907. messageSends: []
  43908. }),
  43909. globals.LexicalScope);
  43910. smalltalk.addMethod(
  43911. smalltalk.method({
  43912. selector: "outerScope:",
  43913. protocol: 'accessing',
  43914. fn: function (aLexicalScope){
  43915. var self=this;
  43916. self["@outerScope"]=aLexicalScope;
  43917. return self;
  43918. },
  43919. //>>excludeStart("ide", pragmas.excludeIdeData);
  43920. args: ["aLexicalScope"],
  43921. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  43922. referencedClasses: [],
  43923. //>>excludeEnd("ide");
  43924. messageSends: []
  43925. }),
  43926. globals.LexicalScope);
  43927. smalltalk.addMethod(
  43928. smalltalk.method({
  43929. selector: "pseudoVars",
  43930. protocol: 'accessing',
  43931. fn: function (){
  43932. var self=this;
  43933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43934. return smalltalk.withContext(function($ctx1) {
  43935. //>>excludeEnd("ctx");
  43936. var $1;
  43937. $1=_st(self._methodScope())._pseudoVars();
  43938. return $1;
  43939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43940. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.LexicalScope)});
  43941. //>>excludeEnd("ctx");
  43942. },
  43943. //>>excludeStart("ide", pragmas.excludeIdeData);
  43944. args: [],
  43945. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  43946. referencedClasses: [],
  43947. //>>excludeEnd("ide");
  43948. messageSends: ["pseudoVars", "methodScope"]
  43949. }),
  43950. globals.LexicalScope);
  43951. smalltalk.addMethod(
  43952. smalltalk.method({
  43953. selector: "scopeLevel",
  43954. protocol: 'accessing',
  43955. fn: function (){
  43956. var self=this;
  43957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43958. return smalltalk.withContext(function($ctx1) {
  43959. //>>excludeEnd("ctx");
  43960. var $1,$2,$4,$3,$5,$receiver;
  43961. $1=self._outerScope();
  43962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43963. $ctx1.sendIdx["outerScope"]=1;
  43964. //>>excludeEnd("ctx");
  43965. if(($receiver = $1) == null || $receiver.isNil){
  43966. return (1);
  43967. } else {
  43968. $1;
  43969. };
  43970. $2=self._isInlined();
  43971. if(smalltalk.assert($2)){
  43972. $4=self._outerScope();
  43973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43974. $ctx1.sendIdx["outerScope"]=2;
  43975. //>>excludeEnd("ctx");
  43976. $3=_st($4)._scopeLevel();
  43977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43978. $ctx1.sendIdx["scopeLevel"]=1;
  43979. //>>excludeEnd("ctx");
  43980. return $3;
  43981. };
  43982. $5=_st(_st(self._outerScope())._scopeLevel()).__plus((1));
  43983. return $5;
  43984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43985. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},globals.LexicalScope)});
  43986. //>>excludeEnd("ctx");
  43987. },
  43988. //>>excludeStart("ide", pragmas.excludeIdeData);
  43989. args: [],
  43990. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  43991. referencedClasses: [],
  43992. //>>excludeEnd("ide");
  43993. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  43994. }),
  43995. globals.LexicalScope);
  43996. smalltalk.addMethod(
  43997. smalltalk.method({
  43998. selector: "temps",
  43999. protocol: 'accessing',
  44000. fn: function (){
  44001. var self=this;
  44002. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44004. return smalltalk.withContext(function($ctx1) {
  44005. //>>excludeEnd("ctx");
  44006. var $2,$1,$receiver;
  44007. $2=self["@temps"];
  44008. if(($receiver = $2) == null || $receiver.isNil){
  44009. self["@temps"]=_st($Dictionary())._new();
  44010. $1=self["@temps"];
  44011. } else {
  44012. $1=$2;
  44013. };
  44014. return $1;
  44015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44016. }, function($ctx1) {$ctx1.fill(self,"temps",{},globals.LexicalScope)});
  44017. //>>excludeEnd("ctx");
  44018. },
  44019. //>>excludeStart("ide", pragmas.excludeIdeData);
  44020. args: [],
  44021. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  44022. referencedClasses: ["Dictionary"],
  44023. //>>excludeEnd("ide");
  44024. messageSends: ["ifNil:", "new"]
  44025. }),
  44026. globals.LexicalScope);
  44027. smalltalk.addClass('MethodLexicalScope', globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  44028. //>>excludeStart("ide", pragmas.excludeIdeData);
  44029. globals.MethodLexicalScope.comment="I represent a method scope.";
  44030. //>>excludeEnd("ide");
  44031. smalltalk.addMethod(
  44032. smalltalk.method({
  44033. selector: "addIVar:",
  44034. protocol: 'adding',
  44035. fn: function (aString){
  44036. var self=this;
  44037. function $InstanceVar(){return globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  44038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44039. return smalltalk.withContext(function($ctx1) {
  44040. //>>excludeEnd("ctx");
  44041. var $1;
  44042. $1=self._iVars();
  44043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44044. $ctx1.sendIdx["iVars"]=1;
  44045. //>>excludeEnd("ctx");
  44046. _st($1)._at_put_(aString,_st($InstanceVar())._on_(aString));
  44047. _st(_st(self._iVars())._at_(aString))._scope_(self);
  44048. return self;
  44049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44050. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},globals.MethodLexicalScope)});
  44051. //>>excludeEnd("ctx");
  44052. },
  44053. //>>excludeStart("ide", pragmas.excludeIdeData);
  44054. args: ["aString"],
  44055. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  44056. referencedClasses: ["InstanceVar"],
  44057. //>>excludeEnd("ide");
  44058. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  44059. }),
  44060. globals.MethodLexicalScope);
  44061. smalltalk.addMethod(
  44062. smalltalk.method({
  44063. selector: "addNonLocalReturn:",
  44064. protocol: 'adding',
  44065. fn: function (aScope){
  44066. var self=this;
  44067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44068. return smalltalk.withContext(function($ctx1) {
  44069. //>>excludeEnd("ctx");
  44070. _st(self._nonLocalReturns())._add_(aScope);
  44071. return self;
  44072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44073. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)});
  44074. //>>excludeEnd("ctx");
  44075. },
  44076. //>>excludeStart("ide", pragmas.excludeIdeData);
  44077. args: ["aScope"],
  44078. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  44079. referencedClasses: [],
  44080. //>>excludeEnd("ide");
  44081. messageSends: ["add:", "nonLocalReturns"]
  44082. }),
  44083. globals.MethodLexicalScope);
  44084. smalltalk.addMethod(
  44085. smalltalk.method({
  44086. selector: "allVariableNames",
  44087. protocol: 'accessing',
  44088. fn: function (){
  44089. var self=this;
  44090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44091. return smalltalk.withContext(function($ctx1) {
  44092. //>>excludeEnd("ctx");
  44093. var $2,$1;
  44094. $2=(
  44095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44096. $ctx1.supercall = true,
  44097. //>>excludeEnd("ctx");
  44098. globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply(_st(self), []));
  44099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44100. $ctx1.supercall = false;
  44101. //>>excludeEnd("ctx");;
  44102. $1=_st($2).__comma(_st(self._iVars())._keys());
  44103. return $1;
  44104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44105. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},globals.MethodLexicalScope)});
  44106. //>>excludeEnd("ctx");
  44107. },
  44108. //>>excludeStart("ide", pragmas.excludeIdeData);
  44109. args: [],
  44110. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  44111. referencedClasses: [],
  44112. //>>excludeEnd("ide");
  44113. messageSends: [",", "allVariableNames", "keys", "iVars"]
  44114. }),
  44115. globals.MethodLexicalScope);
  44116. smalltalk.addMethod(
  44117. smalltalk.method({
  44118. selector: "bindingFor:",
  44119. protocol: 'accessing',
  44120. fn: function (aNode){
  44121. var self=this;
  44122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44123. return smalltalk.withContext(function($ctx1) {
  44124. //>>excludeEnd("ctx");
  44125. var $2,$1,$receiver;
  44126. $2=(
  44127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44128. $ctx1.supercall = true,
  44129. //>>excludeEnd("ctx");
  44130. globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply(_st(self), [aNode]));
  44131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44132. $ctx1.supercall = false;
  44133. //>>excludeEnd("ctx");;
  44134. if(($receiver = $2) == null || $receiver.isNil){
  44135. $1=_st(self._iVars())._at_ifAbsent_(_st(aNode)._value(),(function(){
  44136. return nil;
  44137. }));
  44138. } else {
  44139. $1=$2;
  44140. };
  44141. return $1;
  44142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44143. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},globals.MethodLexicalScope)});
  44144. //>>excludeEnd("ctx");
  44145. },
  44146. //>>excludeStart("ide", pragmas.excludeIdeData);
  44147. args: ["aNode"],
  44148. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  44149. referencedClasses: [],
  44150. //>>excludeEnd("ide");
  44151. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  44152. }),
  44153. globals.MethodLexicalScope);
  44154. smalltalk.addMethod(
  44155. smalltalk.method({
  44156. selector: "canInlineNonLocalReturns",
  44157. protocol: 'testing',
  44158. fn: function (){
  44159. var self=this;
  44160. return true;
  44161. },
  44162. //>>excludeStart("ide", pragmas.excludeIdeData);
  44163. args: [],
  44164. source: "canInlineNonLocalReturns\x0a\x09^ true",
  44165. referencedClasses: [],
  44166. //>>excludeEnd("ide");
  44167. messageSends: []
  44168. }),
  44169. globals.MethodLexicalScope);
  44170. smalltalk.addMethod(
  44171. smalltalk.method({
  44172. selector: "hasLocalReturn",
  44173. protocol: 'testing',
  44174. fn: function (){
  44175. var self=this;
  44176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44177. return smalltalk.withContext(function($ctx1) {
  44178. //>>excludeEnd("ctx");
  44179. var $1;
  44180. $1=self._localReturn();
  44181. return $1;
  44182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44183. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},globals.MethodLexicalScope)});
  44184. //>>excludeEnd("ctx");
  44185. },
  44186. //>>excludeStart("ide", pragmas.excludeIdeData);
  44187. args: [],
  44188. source: "hasLocalReturn\x0a\x09^ self localReturn",
  44189. referencedClasses: [],
  44190. //>>excludeEnd("ide");
  44191. messageSends: ["localReturn"]
  44192. }),
  44193. globals.MethodLexicalScope);
  44194. smalltalk.addMethod(
  44195. smalltalk.method({
  44196. selector: "hasNonLocalReturn",
  44197. protocol: 'testing',
  44198. fn: function (){
  44199. var self=this;
  44200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44201. return smalltalk.withContext(function($ctx1) {
  44202. //>>excludeEnd("ctx");
  44203. var $1;
  44204. $1=_st(self._nonLocalReturns())._notEmpty();
  44205. return $1;
  44206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44207. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},globals.MethodLexicalScope)});
  44208. //>>excludeEnd("ctx");
  44209. },
  44210. //>>excludeStart("ide", pragmas.excludeIdeData);
  44211. args: [],
  44212. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  44213. referencedClasses: [],
  44214. //>>excludeEnd("ide");
  44215. messageSends: ["notEmpty", "nonLocalReturns"]
  44216. }),
  44217. globals.MethodLexicalScope);
  44218. smalltalk.addMethod(
  44219. smalltalk.method({
  44220. selector: "iVars",
  44221. protocol: 'accessing',
  44222. fn: function (){
  44223. var self=this;
  44224. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44226. return smalltalk.withContext(function($ctx1) {
  44227. //>>excludeEnd("ctx");
  44228. var $2,$1,$receiver;
  44229. $2=self["@iVars"];
  44230. if(($receiver = $2) == null || $receiver.isNil){
  44231. self["@iVars"]=_st($Dictionary())._new();
  44232. $1=self["@iVars"];
  44233. } else {
  44234. $1=$2;
  44235. };
  44236. return $1;
  44237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44238. }, function($ctx1) {$ctx1.fill(self,"iVars",{},globals.MethodLexicalScope)});
  44239. //>>excludeEnd("ctx");
  44240. },
  44241. //>>excludeStart("ide", pragmas.excludeIdeData);
  44242. args: [],
  44243. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  44244. referencedClasses: ["Dictionary"],
  44245. //>>excludeEnd("ide");
  44246. messageSends: ["ifNil:", "new"]
  44247. }),
  44248. globals.MethodLexicalScope);
  44249. smalltalk.addMethod(
  44250. smalltalk.method({
  44251. selector: "isMethodScope",
  44252. protocol: 'testing',
  44253. fn: function (){
  44254. var self=this;
  44255. return true;
  44256. },
  44257. //>>excludeStart("ide", pragmas.excludeIdeData);
  44258. args: [],
  44259. source: "isMethodScope\x0a\x09^ true",
  44260. referencedClasses: [],
  44261. //>>excludeEnd("ide");
  44262. messageSends: []
  44263. }),
  44264. globals.MethodLexicalScope);
  44265. smalltalk.addMethod(
  44266. smalltalk.method({
  44267. selector: "localReturn",
  44268. protocol: 'accessing',
  44269. fn: function (){
  44270. var self=this;
  44271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44272. return smalltalk.withContext(function($ctx1) {
  44273. //>>excludeEnd("ctx");
  44274. var $2,$1,$receiver;
  44275. $2=self["@localReturn"];
  44276. if(($receiver = $2) == null || $receiver.isNil){
  44277. $1=false;
  44278. } else {
  44279. $1=$2;
  44280. };
  44281. return $1;
  44282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44283. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},globals.MethodLexicalScope)});
  44284. //>>excludeEnd("ctx");
  44285. },
  44286. //>>excludeStart("ide", pragmas.excludeIdeData);
  44287. args: [],
  44288. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  44289. referencedClasses: [],
  44290. //>>excludeEnd("ide");
  44291. messageSends: ["ifNil:"]
  44292. }),
  44293. globals.MethodLexicalScope);
  44294. smalltalk.addMethod(
  44295. smalltalk.method({
  44296. selector: "localReturn:",
  44297. protocol: 'accessing',
  44298. fn: function (aBoolean){
  44299. var self=this;
  44300. self["@localReturn"]=aBoolean;
  44301. return self;
  44302. },
  44303. //>>excludeStart("ide", pragmas.excludeIdeData);
  44304. args: ["aBoolean"],
  44305. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  44306. referencedClasses: [],
  44307. //>>excludeEnd("ide");
  44308. messageSends: []
  44309. }),
  44310. globals.MethodLexicalScope);
  44311. smalltalk.addMethod(
  44312. smalltalk.method({
  44313. selector: "methodScope",
  44314. protocol: 'accessing',
  44315. fn: function (){
  44316. var self=this;
  44317. return self;
  44318. },
  44319. //>>excludeStart("ide", pragmas.excludeIdeData);
  44320. args: [],
  44321. source: "methodScope\x0a\x09^ self",
  44322. referencedClasses: [],
  44323. //>>excludeEnd("ide");
  44324. messageSends: []
  44325. }),
  44326. globals.MethodLexicalScope);
  44327. smalltalk.addMethod(
  44328. smalltalk.method({
  44329. selector: "nonLocalReturns",
  44330. protocol: 'accessing',
  44331. fn: function (){
  44332. var self=this;
  44333. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44335. return smalltalk.withContext(function($ctx1) {
  44336. //>>excludeEnd("ctx");
  44337. var $2,$1,$receiver;
  44338. $2=self["@nonLocalReturns"];
  44339. if(($receiver = $2) == null || $receiver.isNil){
  44340. self["@nonLocalReturns"]=_st($OrderedCollection())._new();
  44341. $1=self["@nonLocalReturns"];
  44342. } else {
  44343. $1=$2;
  44344. };
  44345. return $1;
  44346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44347. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},globals.MethodLexicalScope)});
  44348. //>>excludeEnd("ctx");
  44349. },
  44350. //>>excludeStart("ide", pragmas.excludeIdeData);
  44351. args: [],
  44352. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  44353. referencedClasses: ["OrderedCollection"],
  44354. //>>excludeEnd("ide");
  44355. messageSends: ["ifNil:", "new"]
  44356. }),
  44357. globals.MethodLexicalScope);
  44358. smalltalk.addMethod(
  44359. smalltalk.method({
  44360. selector: "pseudoVars",
  44361. protocol: 'accessing',
  44362. fn: function (){
  44363. var self=this;
  44364. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  44365. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  44366. function $PseudoVar(){return globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  44367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44368. return smalltalk.withContext(function($ctx1) {
  44369. //>>excludeEnd("ctx");
  44370. var $1,$2,$3,$4,$receiver;
  44371. $1=self["@pseudoVars"];
  44372. if(($receiver = $1) == null || $receiver.isNil){
  44373. self["@pseudoVars"]=_st($Dictionary())._new();
  44374. self["@pseudoVars"];
  44375. _st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
  44376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44377. return smalltalk.withContext(function($ctx2) {
  44378. //>>excludeEnd("ctx");
  44379. $2=_st($PseudoVar())._on_(each);
  44380. _st($2)._scope_(self._methodScope());
  44381. $3=_st($2)._yourself();
  44382. return _st(self["@pseudoVars"])._at_put_(each,$3);
  44383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44385. //>>excludeEnd("ctx");
  44386. }));
  44387. } else {
  44388. $1;
  44389. };
  44390. $4=self["@pseudoVars"];
  44391. return $4;
  44392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44393. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},globals.MethodLexicalScope)});
  44394. //>>excludeEnd("ctx");
  44395. },
  44396. //>>excludeStart("ide", pragmas.excludeIdeData);
  44397. args: [],
  44398. 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",
  44399. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  44400. //>>excludeEnd("ide");
  44401. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  44402. }),
  44403. globals.MethodLexicalScope);
  44404. smalltalk.addMethod(
  44405. smalltalk.method({
  44406. selector: "removeNonLocalReturn:",
  44407. protocol: 'adding',
  44408. fn: function (aScope){
  44409. var self=this;
  44410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44411. return smalltalk.withContext(function($ctx1) {
  44412. //>>excludeEnd("ctx");
  44413. _st(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  44414. }));
  44415. return self;
  44416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44417. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},globals.MethodLexicalScope)});
  44418. //>>excludeEnd("ctx");
  44419. },
  44420. //>>excludeStart("ide", pragmas.excludeIdeData);
  44421. args: ["aScope"],
  44422. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  44423. referencedClasses: [],
  44424. //>>excludeEnd("ide");
  44425. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  44426. }),
  44427. globals.MethodLexicalScope);
  44428. smalltalk.addMethod(
  44429. smalltalk.method({
  44430. selector: "unknownVariables",
  44431. protocol: 'accessing',
  44432. fn: function (){
  44433. var self=this;
  44434. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  44435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44436. return smalltalk.withContext(function($ctx1) {
  44437. //>>excludeEnd("ctx");
  44438. var $2,$1,$receiver;
  44439. $2=self["@unknownVariables"];
  44440. if(($receiver = $2) == null || $receiver.isNil){
  44441. self["@unknownVariables"]=_st($OrderedCollection())._new();
  44442. $1=self["@unknownVariables"];
  44443. } else {
  44444. $1=$2;
  44445. };
  44446. return $1;
  44447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44448. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},globals.MethodLexicalScope)});
  44449. //>>excludeEnd("ctx");
  44450. },
  44451. //>>excludeStart("ide", pragmas.excludeIdeData);
  44452. args: [],
  44453. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  44454. referencedClasses: ["OrderedCollection"],
  44455. //>>excludeEnd("ide");
  44456. messageSends: ["ifNil:", "new"]
  44457. }),
  44458. globals.MethodLexicalScope);
  44459. smalltalk.addClass('ScopeVar', globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  44460. //>>excludeStart("ide", pragmas.excludeIdeData);
  44461. 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.";
  44462. //>>excludeEnd("ide");
  44463. smalltalk.addMethod(
  44464. smalltalk.method({
  44465. selector: "alias",
  44466. protocol: 'accessing',
  44467. fn: function (){
  44468. var self=this;
  44469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44470. return smalltalk.withContext(function($ctx1) {
  44471. //>>excludeEnd("ctx");
  44472. var $1;
  44473. $1=_st(self._name())._asVariableName();
  44474. return $1;
  44475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44476. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ScopeVar)});
  44477. //>>excludeEnd("ctx");
  44478. },
  44479. //>>excludeStart("ide", pragmas.excludeIdeData);
  44480. args: [],
  44481. source: "alias\x0a\x09^ self name asVariableName",
  44482. referencedClasses: [],
  44483. //>>excludeEnd("ide");
  44484. messageSends: ["asVariableName", "name"]
  44485. }),
  44486. globals.ScopeVar);
  44487. smalltalk.addMethod(
  44488. smalltalk.method({
  44489. selector: "isArgVar",
  44490. protocol: 'testing',
  44491. fn: function (){
  44492. var self=this;
  44493. return false;
  44494. },
  44495. //>>excludeStart("ide", pragmas.excludeIdeData);
  44496. args: [],
  44497. source: "isArgVar\x0a\x09^ false",
  44498. referencedClasses: [],
  44499. //>>excludeEnd("ide");
  44500. messageSends: []
  44501. }),
  44502. globals.ScopeVar);
  44503. smalltalk.addMethod(
  44504. smalltalk.method({
  44505. selector: "isClassRefVar",
  44506. protocol: 'testing',
  44507. fn: function (){
  44508. var self=this;
  44509. return false;
  44510. },
  44511. //>>excludeStart("ide", pragmas.excludeIdeData);
  44512. args: [],
  44513. source: "isClassRefVar\x0a\x09^ false",
  44514. referencedClasses: [],
  44515. //>>excludeEnd("ide");
  44516. messageSends: []
  44517. }),
  44518. globals.ScopeVar);
  44519. smalltalk.addMethod(
  44520. smalltalk.method({
  44521. selector: "isImmutable",
  44522. protocol: 'testing',
  44523. fn: function (){
  44524. var self=this;
  44525. return false;
  44526. },
  44527. //>>excludeStart("ide", pragmas.excludeIdeData);
  44528. args: [],
  44529. source: "isImmutable\x0a\x09^ false",
  44530. referencedClasses: [],
  44531. //>>excludeEnd("ide");
  44532. messageSends: []
  44533. }),
  44534. globals.ScopeVar);
  44535. smalltalk.addMethod(
  44536. smalltalk.method({
  44537. selector: "isInstanceVar",
  44538. protocol: 'testing',
  44539. fn: function (){
  44540. var self=this;
  44541. return false;
  44542. },
  44543. //>>excludeStart("ide", pragmas.excludeIdeData);
  44544. args: [],
  44545. source: "isInstanceVar\x0a\x09^ false",
  44546. referencedClasses: [],
  44547. //>>excludeEnd("ide");
  44548. messageSends: []
  44549. }),
  44550. globals.ScopeVar);
  44551. smalltalk.addMethod(
  44552. smalltalk.method({
  44553. selector: "isPseudoVar",
  44554. protocol: 'testing',
  44555. fn: function (){
  44556. var self=this;
  44557. return false;
  44558. },
  44559. //>>excludeStart("ide", pragmas.excludeIdeData);
  44560. args: [],
  44561. source: "isPseudoVar\x0a\x09^ false",
  44562. referencedClasses: [],
  44563. //>>excludeEnd("ide");
  44564. messageSends: []
  44565. }),
  44566. globals.ScopeVar);
  44567. smalltalk.addMethod(
  44568. smalltalk.method({
  44569. selector: "isTempVar",
  44570. protocol: 'testing',
  44571. fn: function (){
  44572. var self=this;
  44573. return false;
  44574. },
  44575. //>>excludeStart("ide", pragmas.excludeIdeData);
  44576. args: [],
  44577. source: "isTempVar\x0a\x09^ false",
  44578. referencedClasses: [],
  44579. //>>excludeEnd("ide");
  44580. messageSends: []
  44581. }),
  44582. globals.ScopeVar);
  44583. smalltalk.addMethod(
  44584. smalltalk.method({
  44585. selector: "isUnknownVar",
  44586. protocol: 'testing',
  44587. fn: function (){
  44588. var self=this;
  44589. return false;
  44590. },
  44591. //>>excludeStart("ide", pragmas.excludeIdeData);
  44592. args: [],
  44593. source: "isUnknownVar\x0a\x09^ false",
  44594. referencedClasses: [],
  44595. //>>excludeEnd("ide");
  44596. messageSends: []
  44597. }),
  44598. globals.ScopeVar);
  44599. smalltalk.addMethod(
  44600. smalltalk.method({
  44601. selector: "name",
  44602. protocol: 'accessing',
  44603. fn: function (){
  44604. var self=this;
  44605. var $1;
  44606. $1=self["@name"];
  44607. return $1;
  44608. },
  44609. //>>excludeStart("ide", pragmas.excludeIdeData);
  44610. args: [],
  44611. source: "name\x0a\x09^ name",
  44612. referencedClasses: [],
  44613. //>>excludeEnd("ide");
  44614. messageSends: []
  44615. }),
  44616. globals.ScopeVar);
  44617. smalltalk.addMethod(
  44618. smalltalk.method({
  44619. selector: "name:",
  44620. protocol: 'accessing',
  44621. fn: function (aString){
  44622. var self=this;
  44623. self["@name"]=aString;
  44624. return self;
  44625. },
  44626. //>>excludeStart("ide", pragmas.excludeIdeData);
  44627. args: ["aString"],
  44628. source: "name: aString\x0a\x09name := aString",
  44629. referencedClasses: [],
  44630. //>>excludeEnd("ide");
  44631. messageSends: []
  44632. }),
  44633. globals.ScopeVar);
  44634. smalltalk.addMethod(
  44635. smalltalk.method({
  44636. selector: "scope",
  44637. protocol: 'accessing',
  44638. fn: function (){
  44639. var self=this;
  44640. var $1;
  44641. $1=self["@scope"];
  44642. return $1;
  44643. },
  44644. //>>excludeStart("ide", pragmas.excludeIdeData);
  44645. args: [],
  44646. source: "scope\x0a\x09^ scope",
  44647. referencedClasses: [],
  44648. //>>excludeEnd("ide");
  44649. messageSends: []
  44650. }),
  44651. globals.ScopeVar);
  44652. smalltalk.addMethod(
  44653. smalltalk.method({
  44654. selector: "scope:",
  44655. protocol: 'accessing',
  44656. fn: function (aScope){
  44657. var self=this;
  44658. self["@scope"]=aScope;
  44659. return self;
  44660. },
  44661. //>>excludeStart("ide", pragmas.excludeIdeData);
  44662. args: ["aScope"],
  44663. source: "scope: aScope\x0a\x09scope := aScope",
  44664. referencedClasses: [],
  44665. //>>excludeEnd("ide");
  44666. messageSends: []
  44667. }),
  44668. globals.ScopeVar);
  44669. smalltalk.addMethod(
  44670. smalltalk.method({
  44671. selector: "validateAssignment",
  44672. protocol: 'testing',
  44673. fn: function (){
  44674. var self=this;
  44675. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  44676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44677. return smalltalk.withContext(function($ctx1) {
  44678. //>>excludeEnd("ctx");
  44679. var $1,$2,$3;
  44680. $1=_st(self._isArgVar())._or_((function(){
  44681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44682. return smalltalk.withContext(function($ctx2) {
  44683. //>>excludeEnd("ctx");
  44684. return self._isPseudoVar();
  44685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44686. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44687. //>>excludeEnd("ctx");
  44688. }));
  44689. if(smalltalk.assert($1)){
  44690. $2=_st($InvalidAssignmentError())._new();
  44691. _st($2)._variableName_(self._name());
  44692. $3=_st($2)._signal();
  44693. $3;
  44694. };
  44695. return self;
  44696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44697. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},globals.ScopeVar)});
  44698. //>>excludeEnd("ctx");
  44699. },
  44700. //>>excludeStart("ide", pragmas.excludeIdeData);
  44701. args: [],
  44702. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  44703. referencedClasses: ["InvalidAssignmentError"],
  44704. //>>excludeEnd("ide");
  44705. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  44706. }),
  44707. globals.ScopeVar);
  44708. smalltalk.addMethod(
  44709. smalltalk.method({
  44710. selector: "on:",
  44711. protocol: 'instance creation',
  44712. fn: function (aString){
  44713. var self=this;
  44714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44715. return smalltalk.withContext(function($ctx1) {
  44716. //>>excludeEnd("ctx");
  44717. var $2,$3,$1;
  44718. $2=self._new();
  44719. _st($2)._name_(aString);
  44720. $3=_st($2)._yourself();
  44721. $1=$3;
  44722. return $1;
  44723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44724. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},globals.ScopeVar.klass)});
  44725. //>>excludeEnd("ctx");
  44726. },
  44727. //>>excludeStart("ide", pragmas.excludeIdeData);
  44728. args: ["aString"],
  44729. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  44730. referencedClasses: [],
  44731. //>>excludeEnd("ide");
  44732. messageSends: ["name:", "new", "yourself"]
  44733. }),
  44734. globals.ScopeVar.klass);
  44735. smalltalk.addClass('AliasVar', globals.ScopeVar, ['node'], 'Compiler-Semantic');
  44736. //>>excludeStart("ide", pragmas.excludeIdeData);
  44737. globals.AliasVar.comment="I am an internally defined variable by the compiler";
  44738. //>>excludeEnd("ide");
  44739. smalltalk.addMethod(
  44740. smalltalk.method({
  44741. selector: "node",
  44742. protocol: 'accessing',
  44743. fn: function (){
  44744. var self=this;
  44745. var $1;
  44746. $1=self["@node"];
  44747. return $1;
  44748. },
  44749. //>>excludeStart("ide", pragmas.excludeIdeData);
  44750. args: [],
  44751. source: "node\x0a\x09^ node",
  44752. referencedClasses: [],
  44753. //>>excludeEnd("ide");
  44754. messageSends: []
  44755. }),
  44756. globals.AliasVar);
  44757. smalltalk.addMethod(
  44758. smalltalk.method({
  44759. selector: "node:",
  44760. protocol: 'accessing',
  44761. fn: function (aNode){
  44762. var self=this;
  44763. self["@node"]=aNode;
  44764. return self;
  44765. },
  44766. //>>excludeStart("ide", pragmas.excludeIdeData);
  44767. args: ["aNode"],
  44768. source: "node: aNode\x0a\x09node := aNode",
  44769. referencedClasses: [],
  44770. //>>excludeEnd("ide");
  44771. messageSends: []
  44772. }),
  44773. globals.AliasVar);
  44774. smalltalk.addClass('ArgVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44775. //>>excludeStart("ide", pragmas.excludeIdeData);
  44776. globals.ArgVar.comment="I am an argument of a method or block.";
  44777. //>>excludeEnd("ide");
  44778. smalltalk.addMethod(
  44779. smalltalk.method({
  44780. selector: "isArgVar",
  44781. protocol: 'testing',
  44782. fn: function (){
  44783. var self=this;
  44784. return true;
  44785. },
  44786. //>>excludeStart("ide", pragmas.excludeIdeData);
  44787. args: [],
  44788. source: "isArgVar\x0a\x09^ true",
  44789. referencedClasses: [],
  44790. //>>excludeEnd("ide");
  44791. messageSends: []
  44792. }),
  44793. globals.ArgVar);
  44794. smalltalk.addMethod(
  44795. smalltalk.method({
  44796. selector: "isImmutable",
  44797. protocol: 'testing',
  44798. fn: function (){
  44799. var self=this;
  44800. return true;
  44801. },
  44802. //>>excludeStart("ide", pragmas.excludeIdeData);
  44803. args: [],
  44804. source: "isImmutable\x0a\x09^ true",
  44805. referencedClasses: [],
  44806. //>>excludeEnd("ide");
  44807. messageSends: []
  44808. }),
  44809. globals.ArgVar);
  44810. smalltalk.addClass('ClassRefVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44811. //>>excludeStart("ide", pragmas.excludeIdeData);
  44812. globals.ClassRefVar.comment="I am an class reference variable";
  44813. //>>excludeEnd("ide");
  44814. smalltalk.addMethod(
  44815. smalltalk.method({
  44816. selector: "alias",
  44817. protocol: 'accessing',
  44818. fn: function (){
  44819. var self=this;
  44820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44821. return smalltalk.withContext(function($ctx1) {
  44822. //>>excludeEnd("ctx");
  44823. var $1;
  44824. $1=_st("$".__comma(self._name())).__comma("()");
  44825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44826. $ctx1.sendIdx[","]=1;
  44827. //>>excludeEnd("ctx");
  44828. return $1;
  44829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44830. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.ClassRefVar)});
  44831. //>>excludeEnd("ctx");
  44832. },
  44833. //>>excludeStart("ide", pragmas.excludeIdeData);
  44834. args: [],
  44835. 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, '()'",
  44836. referencedClasses: [],
  44837. //>>excludeEnd("ide");
  44838. messageSends: [",", "name"]
  44839. }),
  44840. globals.ClassRefVar);
  44841. smalltalk.addMethod(
  44842. smalltalk.method({
  44843. selector: "isClassRefVar",
  44844. protocol: 'testing',
  44845. fn: function (){
  44846. var self=this;
  44847. return true;
  44848. },
  44849. //>>excludeStart("ide", pragmas.excludeIdeData);
  44850. args: [],
  44851. source: "isClassRefVar\x0a\x09^ true",
  44852. referencedClasses: [],
  44853. //>>excludeEnd("ide");
  44854. messageSends: []
  44855. }),
  44856. globals.ClassRefVar);
  44857. smalltalk.addMethod(
  44858. smalltalk.method({
  44859. selector: "isImmutable",
  44860. protocol: 'testing',
  44861. fn: function (){
  44862. var self=this;
  44863. return true;
  44864. },
  44865. //>>excludeStart("ide", pragmas.excludeIdeData);
  44866. args: [],
  44867. source: "isImmutable\x0a\x09^ true",
  44868. referencedClasses: [],
  44869. //>>excludeEnd("ide");
  44870. messageSends: []
  44871. }),
  44872. globals.ClassRefVar);
  44873. smalltalk.addClass('InstanceVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44874. //>>excludeStart("ide", pragmas.excludeIdeData);
  44875. globals.InstanceVar.comment="I am an instance variable of a method or block.";
  44876. //>>excludeEnd("ide");
  44877. smalltalk.addMethod(
  44878. smalltalk.method({
  44879. selector: "alias",
  44880. protocol: 'testing',
  44881. fn: function (){
  44882. var self=this;
  44883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44884. return smalltalk.withContext(function($ctx1) {
  44885. //>>excludeEnd("ctx");
  44886. var $1;
  44887. $1=_st("self[\x22@".__comma(self._name())).__comma("\x22]");
  44888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44889. $ctx1.sendIdx[","]=1;
  44890. //>>excludeEnd("ctx");
  44891. return $1;
  44892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44893. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.InstanceVar)});
  44894. //>>excludeEnd("ctx");
  44895. },
  44896. //>>excludeStart("ide", pragmas.excludeIdeData);
  44897. args: [],
  44898. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  44899. referencedClasses: [],
  44900. //>>excludeEnd("ide");
  44901. messageSends: [",", "name"]
  44902. }),
  44903. globals.InstanceVar);
  44904. smalltalk.addMethod(
  44905. smalltalk.method({
  44906. selector: "isInstanceVar",
  44907. protocol: 'testing',
  44908. fn: function (){
  44909. var self=this;
  44910. return true;
  44911. },
  44912. //>>excludeStart("ide", pragmas.excludeIdeData);
  44913. args: [],
  44914. source: "isInstanceVar\x0a\x09^ true",
  44915. referencedClasses: [],
  44916. //>>excludeEnd("ide");
  44917. messageSends: []
  44918. }),
  44919. globals.InstanceVar);
  44920. smalltalk.addClass('PseudoVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44921. //>>excludeStart("ide", pragmas.excludeIdeData);
  44922. globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  44923. //>>excludeEnd("ide");
  44924. smalltalk.addMethod(
  44925. smalltalk.method({
  44926. selector: "alias",
  44927. protocol: 'accessing',
  44928. fn: function (){
  44929. var self=this;
  44930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44931. return smalltalk.withContext(function($ctx1) {
  44932. //>>excludeEnd("ctx");
  44933. var $1;
  44934. $1=self._name();
  44935. return $1;
  44936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44937. }, function($ctx1) {$ctx1.fill(self,"alias",{},globals.PseudoVar)});
  44938. //>>excludeEnd("ctx");
  44939. },
  44940. //>>excludeStart("ide", pragmas.excludeIdeData);
  44941. args: [],
  44942. source: "alias\x0a\x09^ self name",
  44943. referencedClasses: [],
  44944. //>>excludeEnd("ide");
  44945. messageSends: ["name"]
  44946. }),
  44947. globals.PseudoVar);
  44948. smalltalk.addMethod(
  44949. smalltalk.method({
  44950. selector: "isImmutable",
  44951. protocol: 'testing',
  44952. fn: function (){
  44953. var self=this;
  44954. return true;
  44955. },
  44956. //>>excludeStart("ide", pragmas.excludeIdeData);
  44957. args: [],
  44958. source: "isImmutable\x0a\x09^ true",
  44959. referencedClasses: [],
  44960. //>>excludeEnd("ide");
  44961. messageSends: []
  44962. }),
  44963. globals.PseudoVar);
  44964. smalltalk.addMethod(
  44965. smalltalk.method({
  44966. selector: "isPseudoVar",
  44967. protocol: 'testing',
  44968. fn: function (){
  44969. var self=this;
  44970. return true;
  44971. },
  44972. //>>excludeStart("ide", pragmas.excludeIdeData);
  44973. args: [],
  44974. source: "isPseudoVar\x0a\x09^ true",
  44975. referencedClasses: [],
  44976. //>>excludeEnd("ide");
  44977. messageSends: []
  44978. }),
  44979. globals.PseudoVar);
  44980. smalltalk.addClass('TempVar', globals.ScopeVar, [], 'Compiler-Semantic');
  44981. //>>excludeStart("ide", pragmas.excludeIdeData);
  44982. globals.TempVar.comment="I am an temporary variable of a method or block.";
  44983. //>>excludeEnd("ide");
  44984. smalltalk.addMethod(
  44985. smalltalk.method({
  44986. selector: "isTempVar",
  44987. protocol: 'testing',
  44988. fn: function (){
  44989. var self=this;
  44990. return true;
  44991. },
  44992. //>>excludeStart("ide", pragmas.excludeIdeData);
  44993. args: [],
  44994. source: "isTempVar\x0a\x09^ true",
  44995. referencedClasses: [],
  44996. //>>excludeEnd("ide");
  44997. messageSends: []
  44998. }),
  44999. globals.TempVar);
  45000. smalltalk.addClass('UnknownVar', globals.ScopeVar, [], 'Compiler-Semantic');
  45001. //>>excludeStart("ide", pragmas.excludeIdeData);
  45002. globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  45003. //>>excludeEnd("ide");
  45004. smalltalk.addMethod(
  45005. smalltalk.method({
  45006. selector: "isUnknownVar",
  45007. protocol: 'testing',
  45008. fn: function (){
  45009. var self=this;
  45010. return true;
  45011. },
  45012. //>>excludeStart("ide", pragmas.excludeIdeData);
  45013. args: [],
  45014. source: "isUnknownVar\x0a\x09^ true",
  45015. referencedClasses: [],
  45016. //>>excludeEnd("ide");
  45017. messageSends: []
  45018. }),
  45019. globals.UnknownVar);
  45020. smalltalk.addClass('SemanticAnalyzer', globals.NodeVisitor, ['currentScope', 'blockIndex', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  45021. //>>excludeStart("ide", pragmas.excludeIdeData);
  45022. globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  45023. //>>excludeEnd("ide");
  45024. smalltalk.addMethod(
  45025. smalltalk.method({
  45026. selector: "classReferences",
  45027. protocol: 'accessing',
  45028. fn: function (){
  45029. var self=this;
  45030. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  45031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45032. return smalltalk.withContext(function($ctx1) {
  45033. //>>excludeEnd("ctx");
  45034. var $2,$1,$receiver;
  45035. $2=self["@classReferences"];
  45036. if(($receiver = $2) == null || $receiver.isNil){
  45037. self["@classReferences"]=_st($Set())._new();
  45038. $1=self["@classReferences"];
  45039. } else {
  45040. $1=$2;
  45041. };
  45042. return $1;
  45043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45044. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},globals.SemanticAnalyzer)});
  45045. //>>excludeEnd("ctx");
  45046. },
  45047. //>>excludeStart("ide", pragmas.excludeIdeData);
  45048. args: [],
  45049. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  45050. referencedClasses: ["Set"],
  45051. //>>excludeEnd("ide");
  45052. messageSends: ["ifNil:", "new"]
  45053. }),
  45054. globals.SemanticAnalyzer);
  45055. smalltalk.addMethod(
  45056. smalltalk.method({
  45057. selector: "errorShadowingVariable:",
  45058. protocol: 'error handling',
  45059. fn: function (aString){
  45060. var self=this;
  45061. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  45062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45063. return smalltalk.withContext(function($ctx1) {
  45064. //>>excludeEnd("ctx");
  45065. var $1,$2;
  45066. $1=_st($ShadowingVariableError())._new();
  45067. _st($1)._variableName_(aString);
  45068. $2=_st($1)._signal();
  45069. return self;
  45070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45071. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},globals.SemanticAnalyzer)});
  45072. //>>excludeEnd("ctx");
  45073. },
  45074. //>>excludeStart("ide", pragmas.excludeIdeData);
  45075. args: ["aString"],
  45076. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  45077. referencedClasses: ["ShadowingVariableError"],
  45078. //>>excludeEnd("ide");
  45079. messageSends: ["variableName:", "new", "signal"]
  45080. }),
  45081. globals.SemanticAnalyzer);
  45082. smalltalk.addMethod(
  45083. smalltalk.method({
  45084. selector: "errorUnknownVariable:",
  45085. protocol: 'error handling',
  45086. fn: function (aNode){
  45087. var self=this;
  45088. var identifier;
  45089. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  45090. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  45091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45092. return smalltalk.withContext(function($ctx1) {
  45093. //>>excludeEnd("ctx");
  45094. var $1,$2,$3,$4,$5;
  45095. identifier=_st(aNode)._value();
  45096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45097. $ctx1.sendIdx["value"]=1;
  45098. //>>excludeEnd("ctx");
  45099. $1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  45100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45101. return smalltalk.withContext(function($ctx2) {
  45102. //>>excludeEnd("ctx");
  45103. return self._isVariableGloballyUndefined_(identifier);
  45104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45106. //>>excludeEnd("ctx");
  45107. }));
  45108. if(smalltalk.assert($1)){
  45109. $2=_st($UnknownVariableError())._new();
  45110. $3=$2;
  45111. $4=_st(aNode)._value();
  45112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45113. $ctx1.sendIdx["value"]=2;
  45114. //>>excludeEnd("ctx");
  45115. _st($3)._variableName_($4);
  45116. $5=_st($2)._signal();
  45117. $5;
  45118. } else {
  45119. _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_st(aNode)._value());
  45120. };
  45121. return self;
  45122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45123. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},globals.SemanticAnalyzer)});
  45124. //>>excludeEnd("ctx");
  45125. },
  45126. //>>excludeStart("ide", pragmas.excludeIdeData);
  45127. args: ["aNode"],
  45128. 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 ]",
  45129. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  45130. //>>excludeEnd("ide");
  45131. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  45132. }),
  45133. globals.SemanticAnalyzer);
  45134. smalltalk.addMethod(
  45135. smalltalk.method({
  45136. selector: "isVariableGloballyUndefined:",
  45137. protocol: 'testing',
  45138. fn: function (aString){
  45139. var self=this;
  45140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45141. return smalltalk.withContext(function($ctx1) {
  45142. //>>excludeEnd("ctx");
  45143. return eval('typeof ' + aString + ' == "undefined"');
  45144. return self;
  45145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45146. }, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},globals.SemanticAnalyzer)});
  45147. //>>excludeEnd("ctx");
  45148. },
  45149. //>>excludeStart("ide", pragmas.excludeIdeData);
  45150. args: ["aString"],
  45151. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  45152. referencedClasses: [],
  45153. //>>excludeEnd("ide");
  45154. messageSends: []
  45155. }),
  45156. globals.SemanticAnalyzer);
  45157. smalltalk.addMethod(
  45158. smalltalk.method({
  45159. selector: "messageSends",
  45160. protocol: 'accessing',
  45161. fn: function (){
  45162. var self=this;
  45163. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45165. return smalltalk.withContext(function($ctx1) {
  45166. //>>excludeEnd("ctx");
  45167. var $2,$1,$receiver;
  45168. $2=self["@messageSends"];
  45169. if(($receiver = $2) == null || $receiver.isNil){
  45170. self["@messageSends"]=_st($Dictionary())._new();
  45171. $1=self["@messageSends"];
  45172. } else {
  45173. $1=$2;
  45174. };
  45175. return $1;
  45176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45177. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},globals.SemanticAnalyzer)});
  45178. //>>excludeEnd("ctx");
  45179. },
  45180. //>>excludeStart("ide", pragmas.excludeIdeData);
  45181. args: [],
  45182. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  45183. referencedClasses: ["Dictionary"],
  45184. //>>excludeEnd("ide");
  45185. messageSends: ["ifNil:", "new"]
  45186. }),
  45187. globals.SemanticAnalyzer);
  45188. smalltalk.addMethod(
  45189. smalltalk.method({
  45190. selector: "newBlockScope",
  45191. protocol: 'factory',
  45192. fn: function (){
  45193. var self=this;
  45194. function $LexicalScope(){return globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  45195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45196. return smalltalk.withContext(function($ctx1) {
  45197. //>>excludeEnd("ctx");
  45198. var $1;
  45199. $1=self._newScopeOfClass_($LexicalScope());
  45200. return $1;
  45201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45202. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},globals.SemanticAnalyzer)});
  45203. //>>excludeEnd("ctx");
  45204. },
  45205. //>>excludeStart("ide", pragmas.excludeIdeData);
  45206. args: [],
  45207. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  45208. referencedClasses: ["LexicalScope"],
  45209. //>>excludeEnd("ide");
  45210. messageSends: ["newScopeOfClass:"]
  45211. }),
  45212. globals.SemanticAnalyzer);
  45213. smalltalk.addMethod(
  45214. smalltalk.method({
  45215. selector: "newMethodScope",
  45216. protocol: 'factory',
  45217. fn: function (){
  45218. var self=this;
  45219. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  45220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45221. return smalltalk.withContext(function($ctx1) {
  45222. //>>excludeEnd("ctx");
  45223. var $1;
  45224. $1=self._newScopeOfClass_($MethodLexicalScope());
  45225. return $1;
  45226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45227. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},globals.SemanticAnalyzer)});
  45228. //>>excludeEnd("ctx");
  45229. },
  45230. //>>excludeStart("ide", pragmas.excludeIdeData);
  45231. args: [],
  45232. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  45233. referencedClasses: ["MethodLexicalScope"],
  45234. //>>excludeEnd("ide");
  45235. messageSends: ["newScopeOfClass:"]
  45236. }),
  45237. globals.SemanticAnalyzer);
  45238. smalltalk.addMethod(
  45239. smalltalk.method({
  45240. selector: "newScopeOfClass:",
  45241. protocol: 'factory',
  45242. fn: function (aLexicalScopeClass){
  45243. var self=this;
  45244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45245. return smalltalk.withContext(function($ctx1) {
  45246. //>>excludeEnd("ctx");
  45247. var $2,$3,$1;
  45248. $2=_st(aLexicalScopeClass)._new();
  45249. _st($2)._outerScope_(self["@currentScope"]);
  45250. $3=_st($2)._yourself();
  45251. $1=$3;
  45252. return $1;
  45253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45254. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},globals.SemanticAnalyzer)});
  45255. //>>excludeEnd("ctx");
  45256. },
  45257. //>>excludeStart("ide", pragmas.excludeIdeData);
  45258. args: ["aLexicalScopeClass"],
  45259. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  45260. referencedClasses: [],
  45261. //>>excludeEnd("ide");
  45262. messageSends: ["outerScope:", "new", "yourself"]
  45263. }),
  45264. globals.SemanticAnalyzer);
  45265. smalltalk.addMethod(
  45266. smalltalk.method({
  45267. selector: "nextBlockIndex",
  45268. protocol: 'private',
  45269. fn: function (){
  45270. var self=this;
  45271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45272. return smalltalk.withContext(function($ctx1) {
  45273. //>>excludeEnd("ctx");
  45274. var $1,$2,$receiver;
  45275. $1=self["@blockIndex"];
  45276. if(($receiver = $1) == null || $receiver.isNil){
  45277. self["@blockIndex"]=(0);
  45278. self["@blockIndex"];
  45279. } else {
  45280. $1;
  45281. };
  45282. self["@blockIndex"]=_st(self["@blockIndex"]).__plus((1));
  45283. $2=self["@blockIndex"];
  45284. return $2;
  45285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45286. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},globals.SemanticAnalyzer)});
  45287. //>>excludeEnd("ctx");
  45288. },
  45289. //>>excludeStart("ide", pragmas.excludeIdeData);
  45290. args: [],
  45291. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  45292. referencedClasses: [],
  45293. //>>excludeEnd("ide");
  45294. messageSends: ["ifNil:", "+"]
  45295. }),
  45296. globals.SemanticAnalyzer);
  45297. smalltalk.addMethod(
  45298. smalltalk.method({
  45299. selector: "popScope",
  45300. protocol: 'scope',
  45301. fn: function (){
  45302. var self=this;
  45303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45304. return smalltalk.withContext(function($ctx1) {
  45305. //>>excludeEnd("ctx");
  45306. var $1,$receiver;
  45307. $1=self["@currentScope"];
  45308. if(($receiver = $1) == null || $receiver.isNil){
  45309. $1;
  45310. } else {
  45311. self["@currentScope"]=_st(self["@currentScope"])._outerScope();
  45312. self["@currentScope"];
  45313. };
  45314. return self;
  45315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45316. }, function($ctx1) {$ctx1.fill(self,"popScope",{},globals.SemanticAnalyzer)});
  45317. //>>excludeEnd("ctx");
  45318. },
  45319. //>>excludeStart("ide", pragmas.excludeIdeData);
  45320. args: [],
  45321. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  45322. referencedClasses: [],
  45323. //>>excludeEnd("ide");
  45324. messageSends: ["ifNotNil:", "outerScope"]
  45325. }),
  45326. globals.SemanticAnalyzer);
  45327. smalltalk.addMethod(
  45328. smalltalk.method({
  45329. selector: "pushScope:",
  45330. protocol: 'scope',
  45331. fn: function (aScope){
  45332. var self=this;
  45333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45334. return smalltalk.withContext(function($ctx1) {
  45335. //>>excludeEnd("ctx");
  45336. _st(aScope)._outerScope_(self["@currentScope"]);
  45337. self["@currentScope"]=aScope;
  45338. return self;
  45339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45340. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},globals.SemanticAnalyzer)});
  45341. //>>excludeEnd("ctx");
  45342. },
  45343. //>>excludeStart("ide", pragmas.excludeIdeData);
  45344. args: ["aScope"],
  45345. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  45346. referencedClasses: [],
  45347. //>>excludeEnd("ide");
  45348. messageSends: ["outerScope:"]
  45349. }),
  45350. globals.SemanticAnalyzer);
  45351. smalltalk.addMethod(
  45352. smalltalk.method({
  45353. selector: "superSends",
  45354. protocol: 'accessing',
  45355. fn: function (){
  45356. var self=this;
  45357. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  45358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45359. return smalltalk.withContext(function($ctx1) {
  45360. //>>excludeEnd("ctx");
  45361. var $2,$1,$receiver;
  45362. $2=self["@superSends"];
  45363. if(($receiver = $2) == null || $receiver.isNil){
  45364. self["@superSends"]=_st($Dictionary())._new();
  45365. $1=self["@superSends"];
  45366. } else {
  45367. $1=$2;
  45368. };
  45369. return $1;
  45370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45371. }, function($ctx1) {$ctx1.fill(self,"superSends",{},globals.SemanticAnalyzer)});
  45372. //>>excludeEnd("ctx");
  45373. },
  45374. //>>excludeStart("ide", pragmas.excludeIdeData);
  45375. args: [],
  45376. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  45377. referencedClasses: ["Dictionary"],
  45378. //>>excludeEnd("ide");
  45379. messageSends: ["ifNil:", "new"]
  45380. }),
  45381. globals.SemanticAnalyzer);
  45382. smalltalk.addMethod(
  45383. smalltalk.method({
  45384. selector: "theClass",
  45385. protocol: 'accessing',
  45386. fn: function (){
  45387. var self=this;
  45388. var $1;
  45389. $1=self["@theClass"];
  45390. return $1;
  45391. },
  45392. //>>excludeStart("ide", pragmas.excludeIdeData);
  45393. args: [],
  45394. source: "theClass\x0a\x09^ theClass",
  45395. referencedClasses: [],
  45396. //>>excludeEnd("ide");
  45397. messageSends: []
  45398. }),
  45399. globals.SemanticAnalyzer);
  45400. smalltalk.addMethod(
  45401. smalltalk.method({
  45402. selector: "theClass:",
  45403. protocol: 'accessing',
  45404. fn: function (aClass){
  45405. var self=this;
  45406. self["@theClass"]=aClass;
  45407. return self;
  45408. },
  45409. //>>excludeStart("ide", pragmas.excludeIdeData);
  45410. args: ["aClass"],
  45411. source: "theClass: aClass\x0a\x09theClass := aClass",
  45412. referencedClasses: [],
  45413. //>>excludeEnd("ide");
  45414. messageSends: []
  45415. }),
  45416. globals.SemanticAnalyzer);
  45417. smalltalk.addMethod(
  45418. smalltalk.method({
  45419. selector: "validateVariableScope:",
  45420. protocol: 'scope',
  45421. fn: function (aString){
  45422. var self=this;
  45423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45424. return smalltalk.withContext(function($ctx1) {
  45425. //>>excludeEnd("ctx");
  45426. var $1,$receiver;
  45427. $1=_st(self["@currentScope"])._lookupVariable_(aString);
  45428. if(($receiver = $1) == null || $receiver.isNil){
  45429. $1;
  45430. } else {
  45431. self._errorShadowingVariable_(aString);
  45432. };
  45433. return self;
  45434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45435. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},globals.SemanticAnalyzer)});
  45436. //>>excludeEnd("ctx");
  45437. },
  45438. //>>excludeStart("ide", pragmas.excludeIdeData);
  45439. args: ["aString"],
  45440. 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 ]",
  45441. referencedClasses: [],
  45442. //>>excludeEnd("ide");
  45443. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  45444. }),
  45445. globals.SemanticAnalyzer);
  45446. smalltalk.addMethod(
  45447. smalltalk.method({
  45448. selector: "visitAssignmentNode:",
  45449. protocol: 'visiting',
  45450. fn: function (aNode){
  45451. var self=this;
  45452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45453. return smalltalk.withContext(function($ctx1) {
  45454. //>>excludeEnd("ctx");
  45455. (
  45456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45457. $ctx1.supercall = true,
  45458. //>>excludeEnd("ctx");
  45459. globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply(_st(self), [aNode]));
  45460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45461. $ctx1.supercall = false;
  45462. //>>excludeEnd("ctx");;
  45463. _st(_st(aNode)._left())._beAssigned();
  45464. return self;
  45465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45466. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45467. //>>excludeEnd("ctx");
  45468. },
  45469. //>>excludeStart("ide", pragmas.excludeIdeData);
  45470. args: ["aNode"],
  45471. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  45472. referencedClasses: [],
  45473. //>>excludeEnd("ide");
  45474. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  45475. }),
  45476. globals.SemanticAnalyzer);
  45477. smalltalk.addMethod(
  45478. smalltalk.method({
  45479. selector: "visitBlockNode:",
  45480. protocol: 'visiting',
  45481. fn: function (aNode){
  45482. var self=this;
  45483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45484. return smalltalk.withContext(function($ctx1) {
  45485. //>>excludeEnd("ctx");
  45486. self._pushScope_(self._newBlockScope());
  45487. _st(aNode)._scope_(self["@currentScope"]);
  45488. _st(self["@currentScope"])._node_(aNode);
  45489. _st(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  45490. _st(_st(aNode)._parameters())._do_((function(each){
  45491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45492. return smalltalk.withContext(function($ctx2) {
  45493. //>>excludeEnd("ctx");
  45494. self._validateVariableScope_(each);
  45495. return _st(self["@currentScope"])._addArg_(each);
  45496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45498. //>>excludeEnd("ctx");
  45499. }));
  45500. (
  45501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45502. $ctx1.supercall = true,
  45503. //>>excludeEnd("ctx");
  45504. globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply(_st(self), [aNode]));
  45505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45506. $ctx1.supercall = false;
  45507. //>>excludeEnd("ctx");;
  45508. self._popScope();
  45509. return self;
  45510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45511. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45512. //>>excludeEnd("ctx");
  45513. },
  45514. //>>excludeStart("ide", pragmas.excludeIdeData);
  45515. args: ["aNode"],
  45516. 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",
  45517. referencedClasses: [],
  45518. //>>excludeEnd("ide");
  45519. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  45520. }),
  45521. globals.SemanticAnalyzer);
  45522. smalltalk.addMethod(
  45523. smalltalk.method({
  45524. selector: "visitCascadeNode:",
  45525. protocol: 'visiting',
  45526. fn: function (aNode){
  45527. var self=this;
  45528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45529. return smalltalk.withContext(function($ctx1) {
  45530. //>>excludeEnd("ctx");
  45531. var $3,$2,$1;
  45532. (
  45533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45534. $ctx1.supercall = true,
  45535. //>>excludeEnd("ctx");
  45536. globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply(_st(self), [aNode]));
  45537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45538. $ctx1.supercall = false;
  45539. //>>excludeEnd("ctx");;
  45540. $3=_st(aNode)._nodes();
  45541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45542. $ctx1.sendIdx["nodes"]=1;
  45543. //>>excludeEnd("ctx");
  45544. $2=_st($3)._first();
  45545. $1=_st($2)._superSend();
  45546. if(smalltalk.assert($1)){
  45547. _st(_st(aNode)._nodes())._do_((function(each){
  45548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45549. return smalltalk.withContext(function($ctx2) {
  45550. //>>excludeEnd("ctx");
  45551. return _st(each)._superSend_(true);
  45552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45554. //>>excludeEnd("ctx");
  45555. }));
  45556. };
  45557. return self;
  45558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45559. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45560. //>>excludeEnd("ctx");
  45561. },
  45562. //>>excludeStart("ide", pragmas.excludeIdeData);
  45563. args: ["aNode"],
  45564. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  45565. referencedClasses: [],
  45566. //>>excludeEnd("ide");
  45567. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  45568. }),
  45569. globals.SemanticAnalyzer);
  45570. smalltalk.addMethod(
  45571. smalltalk.method({
  45572. selector: "visitMethodNode:",
  45573. protocol: 'visiting',
  45574. fn: function (aNode){
  45575. var self=this;
  45576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45577. return smalltalk.withContext(function($ctx1) {
  45578. //>>excludeEnd("ctx");
  45579. var $1;
  45580. self._pushScope_(self._newMethodScope());
  45581. _st(aNode)._scope_(self["@currentScope"]);
  45582. _st(self["@currentScope"])._node_(aNode);
  45583. _st(_st(self._theClass())._allInstanceVariableNames())._do_((function(each){
  45584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45585. return smalltalk.withContext(function($ctx2) {
  45586. //>>excludeEnd("ctx");
  45587. return _st(self["@currentScope"])._addIVar_(each);
  45588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45589. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45590. //>>excludeEnd("ctx");
  45591. }));
  45592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45593. $ctx1.sendIdx["do:"]=1;
  45594. //>>excludeEnd("ctx");
  45595. _st(_st(aNode)._arguments())._do_((function(each){
  45596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45597. return smalltalk.withContext(function($ctx2) {
  45598. //>>excludeEnd("ctx");
  45599. self._validateVariableScope_(each);
  45600. return _st(self["@currentScope"])._addArg_(each);
  45601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45602. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45603. //>>excludeEnd("ctx");
  45604. }));
  45605. (
  45606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45607. $ctx1.supercall = true,
  45608. //>>excludeEnd("ctx");
  45609. globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply(_st(self), [aNode]));
  45610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45611. $ctx1.supercall = false;
  45612. //>>excludeEnd("ctx");;
  45613. _st(aNode)._classReferences_(self._classReferences());
  45614. _st(aNode)._sendIndexes_(self._messageSends());
  45615. $1=_st(aNode)._superSends_(_st(self._superSends())._keys());
  45616. self._popScope();
  45617. return self;
  45618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45619. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45620. //>>excludeEnd("ctx");
  45621. },
  45622. //>>excludeStart("ide", pragmas.excludeIdeData);
  45623. args: ["aNode"],
  45624. 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",
  45625. referencedClasses: [],
  45626. //>>excludeEnd("ide");
  45627. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  45628. }),
  45629. globals.SemanticAnalyzer);
  45630. smalltalk.addMethod(
  45631. smalltalk.method({
  45632. selector: "visitReturnNode:",
  45633. protocol: 'visiting',
  45634. fn: function (aNode){
  45635. var self=this;
  45636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45637. return smalltalk.withContext(function($ctx1) {
  45638. //>>excludeEnd("ctx");
  45639. var $1;
  45640. _st(aNode)._scope_(self["@currentScope"]);
  45641. $1=_st(self["@currentScope"])._isMethodScope();
  45642. if(smalltalk.assert($1)){
  45643. _st(self["@currentScope"])._localReturn_(true);
  45644. } else {
  45645. _st(_st(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  45646. };
  45647. (
  45648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45649. $ctx1.supercall = true,
  45650. //>>excludeEnd("ctx");
  45651. globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply(_st(self), [aNode]));
  45652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45653. $ctx1.supercall = false;
  45654. //>>excludeEnd("ctx");;
  45655. return self;
  45656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45657. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45658. //>>excludeEnd("ctx");
  45659. },
  45660. //>>excludeStart("ide", pragmas.excludeIdeData);
  45661. args: ["aNode"],
  45662. 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",
  45663. referencedClasses: [],
  45664. //>>excludeEnd("ide");
  45665. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  45666. }),
  45667. globals.SemanticAnalyzer);
  45668. smalltalk.addMethod(
  45669. smalltalk.method({
  45670. selector: "visitSendNode:",
  45671. protocol: 'visiting',
  45672. fn: function (aNode){
  45673. var self=this;
  45674. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  45675. function $IRSendInliner(){return globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  45676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45677. return smalltalk.withContext(function($ctx1) {
  45678. //>>excludeEnd("ctx");
  45679. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  45680. $3=_st(aNode)._receiver();
  45681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45682. $ctx1.sendIdx["receiver"]=1;
  45683. //>>excludeEnd("ctx");
  45684. $2=_st($3)._value();
  45685. $1=_st($2).__eq("super");
  45686. if(smalltalk.assert($1)){
  45687. _st(aNode)._superSend_(true);
  45688. $4=_st(aNode)._receiver();
  45689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45690. $ctx1.sendIdx["receiver"]=2;
  45691. //>>excludeEnd("ctx");
  45692. _st($4)._value_("self");
  45693. $5=self._superSends();
  45694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45695. $ctx1.sendIdx["superSends"]=1;
  45696. //>>excludeEnd("ctx");
  45697. $6=_st(aNode)._selector();
  45698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45699. $ctx1.sendIdx["selector"]=1;
  45700. //>>excludeEnd("ctx");
  45701. _st($5)._at_ifAbsentPut_($6,(function(){
  45702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45703. return smalltalk.withContext(function($ctx2) {
  45704. //>>excludeEnd("ctx");
  45705. return _st($Set())._new();
  45706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45707. $ctx2.sendIdx["new"]=1;
  45708. //>>excludeEnd("ctx");
  45709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45711. //>>excludeEnd("ctx");
  45712. }));
  45713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45714. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  45715. //>>excludeEnd("ctx");
  45716. $8=self._superSends();
  45717. $9=_st(aNode)._selector();
  45718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45719. $ctx1.sendIdx["selector"]=2;
  45720. //>>excludeEnd("ctx");
  45721. $7=_st($8)._at_($9);
  45722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45723. $ctx1.sendIdx["at:"]=1;
  45724. //>>excludeEnd("ctx");
  45725. _st($7)._add_(aNode);
  45726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45727. $ctx1.sendIdx["add:"]=1;
  45728. //>>excludeEnd("ctx");
  45729. } else {
  45730. $11=_st($IRSendInliner())._inlinedSelectors();
  45731. $12=_st(aNode)._selector();
  45732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45733. $ctx1.sendIdx["selector"]=3;
  45734. //>>excludeEnd("ctx");
  45735. $10=_st($11)._includes_($12);
  45736. if(smalltalk.assert($10)){
  45737. _st(aNode)._shouldBeInlined_(true);
  45738. $13=_st(aNode)._receiver();
  45739. if(($receiver = $13) == null || $receiver.isNil){
  45740. $13;
  45741. } else {
  45742. var receiver;
  45743. receiver=$receiver;
  45744. _st(receiver)._shouldBeAliased_(true);
  45745. };
  45746. };
  45747. };
  45748. $14=self._messageSends();
  45749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45750. $ctx1.sendIdx["messageSends"]=1;
  45751. //>>excludeEnd("ctx");
  45752. $15=_st(aNode)._selector();
  45753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45754. $ctx1.sendIdx["selector"]=4;
  45755. //>>excludeEnd("ctx");
  45756. _st($14)._at_ifAbsentPut_($15,(function(){
  45757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45758. return smalltalk.withContext(function($ctx2) {
  45759. //>>excludeEnd("ctx");
  45760. return _st($Set())._new();
  45761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45762. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  45763. //>>excludeEnd("ctx");
  45764. }));
  45765. $17=self._messageSends();
  45766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45767. $ctx1.sendIdx["messageSends"]=2;
  45768. //>>excludeEnd("ctx");
  45769. $18=_st(aNode)._selector();
  45770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45771. $ctx1.sendIdx["selector"]=5;
  45772. //>>excludeEnd("ctx");
  45773. $16=_st($17)._at_($18);
  45774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45775. $ctx1.sendIdx["at:"]=2;
  45776. //>>excludeEnd("ctx");
  45777. _st($16)._add_(aNode);
  45778. _st(aNode)._index_(_st(_st(self._messageSends())._at_(_st(aNode)._selector()))._size());
  45779. (
  45780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45781. $ctx1.supercall = true,
  45782. //>>excludeEnd("ctx");
  45783. globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  45784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45785. $ctx1.supercall = false;
  45786. //>>excludeEnd("ctx");;
  45787. return self;
  45788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45789. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45790. //>>excludeEnd("ctx");
  45791. },
  45792. //>>excludeStart("ide", pragmas.excludeIdeData);
  45793. args: ["aNode"],
  45794. 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",
  45795. referencedClasses: ["Set", "IRSendInliner"],
  45796. //>>excludeEnd("ide");
  45797. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  45798. }),
  45799. globals.SemanticAnalyzer);
  45800. smalltalk.addMethod(
  45801. smalltalk.method({
  45802. selector: "visitSequenceNode:",
  45803. protocol: 'visiting',
  45804. fn: function (aNode){
  45805. var self=this;
  45806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45807. return smalltalk.withContext(function($ctx1) {
  45808. //>>excludeEnd("ctx");
  45809. _st(_st(aNode)._temps())._do_((function(each){
  45810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45811. return smalltalk.withContext(function($ctx2) {
  45812. //>>excludeEnd("ctx");
  45813. self._validateVariableScope_(each);
  45814. return _st(self["@currentScope"])._addTemp_(each);
  45815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45817. //>>excludeEnd("ctx");
  45818. }));
  45819. (
  45820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45821. $ctx1.supercall = true,
  45822. //>>excludeEnd("ctx");
  45823. globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply(_st(self), [aNode]));
  45824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45825. $ctx1.supercall = false;
  45826. //>>excludeEnd("ctx");;
  45827. return self;
  45828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45829. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.SemanticAnalyzer)});
  45830. //>>excludeEnd("ctx");
  45831. },
  45832. //>>excludeStart("ide", pragmas.excludeIdeData);
  45833. args: ["aNode"],
  45834. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  45835. referencedClasses: [],
  45836. //>>excludeEnd("ide");
  45837. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  45838. }),
  45839. globals.SemanticAnalyzer);
  45840. smalltalk.addMethod(
  45841. smalltalk.method({
  45842. selector: "visitVariableNode:",
  45843. protocol: 'visiting',
  45844. fn: function (aNode){
  45845. var self=this;
  45846. var binding;
  45847. function $ClassRefVar(){return globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  45848. function $UnknownVar(){return globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  45849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45850. return smalltalk.withContext(function($ctx1) {
  45851. //>>excludeEnd("ctx");
  45852. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  45853. binding=_st(self["@currentScope"])._lookupVariable_(aNode);
  45854. $1=binding;
  45855. if(($receiver = $1) == null || $receiver.isNil){
  45856. $3=_st(aNode)._value();
  45857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45858. $ctx1.sendIdx["value"]=1;
  45859. //>>excludeEnd("ctx");
  45860. $2=_st($3)._isCapitalized();
  45861. if(smalltalk.assert($2)){
  45862. $4=_st($ClassRefVar())._new();
  45863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45864. $ctx1.sendIdx["new"]=1;
  45865. //>>excludeEnd("ctx");
  45866. $5=$4;
  45867. $6=_st(aNode)._value();
  45868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45869. $ctx1.sendIdx["value"]=2;
  45870. //>>excludeEnd("ctx");
  45871. _st($5)._name_($6);
  45872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45873. $ctx1.sendIdx["name:"]=1;
  45874. //>>excludeEnd("ctx");
  45875. $7=_st($4)._yourself();
  45876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45877. $ctx1.sendIdx["yourself"]=1;
  45878. //>>excludeEnd("ctx");
  45879. binding=$7;
  45880. binding;
  45881. $8=self._classReferences();
  45882. $9=_st(aNode)._value();
  45883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45884. $ctx1.sendIdx["value"]=3;
  45885. //>>excludeEnd("ctx");
  45886. _st($8)._add_($9);
  45887. } else {
  45888. self._errorUnknownVariable_(aNode);
  45889. $10=_st($UnknownVar())._new();
  45890. _st($10)._name_(_st(aNode)._value());
  45891. $11=_st($10)._yourself();
  45892. binding=$11;
  45893. binding;
  45894. };
  45895. } else {
  45896. $1;
  45897. };
  45898. _st(aNode)._binding_(binding);
  45899. return self;
  45900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45901. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},globals.SemanticAnalyzer)});
  45902. //>>excludeEnd("ctx");
  45903. },
  45904. //>>excludeStart("ide", pragmas.excludeIdeData);
  45905. args: ["aNode"],
  45906. 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.",
  45907. referencedClasses: ["ClassRefVar", "UnknownVar"],
  45908. //>>excludeEnd("ide");
  45909. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  45910. }),
  45911. globals.SemanticAnalyzer);
  45912. smalltalk.addMethod(
  45913. smalltalk.method({
  45914. selector: "on:",
  45915. protocol: 'instance creation',
  45916. fn: function (aClass){
  45917. var self=this;
  45918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45919. return smalltalk.withContext(function($ctx1) {
  45920. //>>excludeEnd("ctx");
  45921. var $2,$3,$1;
  45922. $2=self._new();
  45923. _st($2)._theClass_(aClass);
  45924. $3=_st($2)._yourself();
  45925. $1=$3;
  45926. return $1;
  45927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45928. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},globals.SemanticAnalyzer.klass)});
  45929. //>>excludeEnd("ctx");
  45930. },
  45931. //>>excludeStart("ide", pragmas.excludeIdeData);
  45932. args: ["aClass"],
  45933. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  45934. referencedClasses: [],
  45935. //>>excludeEnd("ide");
  45936. messageSends: ["theClass:", "new", "yourself"]
  45937. }),
  45938. globals.SemanticAnalyzer.klass);
  45939. });
  45940. 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){
  45941. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  45942. smalltalk.addPackage('Compiler-Interpreter');
  45943. smalltalk.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  45944. smalltalk.addClass('AIBlockClosure', globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  45945. //>>excludeStart("ide", pragmas.excludeIdeData);
  45946. 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`).";
  45947. //>>excludeEnd("ide");
  45948. smalltalk.addMethod(
  45949. smalltalk.method({
  45950. selector: "applyTo:arguments:",
  45951. protocol: 'evaluating',
  45952. fn: function (anObject,aCollection){
  45953. var self=this;
  45954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45955. return smalltalk.withContext(function($ctx1) {
  45956. //>>excludeEnd("ctx");
  45957. self._interpreterError();
  45958. return self;
  45959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45960. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},globals.AIBlockClosure)});
  45961. //>>excludeEnd("ctx");
  45962. },
  45963. //>>excludeStart("ide", pragmas.excludeIdeData);
  45964. args: ["anObject", "aCollection"],
  45965. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  45966. referencedClasses: [],
  45967. //>>excludeEnd("ide");
  45968. messageSends: ["interpreterError"]
  45969. }),
  45970. globals.AIBlockClosure);
  45971. smalltalk.addMethod(
  45972. smalltalk.method({
  45973. selector: "compiledSource",
  45974. protocol: 'accessing',
  45975. fn: function (){
  45976. var self=this;
  45977. return "[ AST Block closure ]";
  45978. },
  45979. //>>excludeStart("ide", pragmas.excludeIdeData);
  45980. args: [],
  45981. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  45982. referencedClasses: [],
  45983. //>>excludeEnd("ide");
  45984. messageSends: []
  45985. }),
  45986. globals.AIBlockClosure);
  45987. smalltalk.addMethod(
  45988. smalltalk.method({
  45989. selector: "currySelf",
  45990. protocol: 'converting',
  45991. fn: function (){
  45992. var self=this;
  45993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45994. return smalltalk.withContext(function($ctx1) {
  45995. //>>excludeEnd("ctx");
  45996. self._interpreterError();
  45997. return self;
  45998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45999. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},globals.AIBlockClosure)});
  46000. //>>excludeEnd("ctx");
  46001. },
  46002. //>>excludeStart("ide", pragmas.excludeIdeData);
  46003. args: [],
  46004. source: "currySelf\x0a\x09self interpreterError",
  46005. referencedClasses: [],
  46006. //>>excludeEnd("ide");
  46007. messageSends: ["interpreterError"]
  46008. }),
  46009. globals.AIBlockClosure);
  46010. smalltalk.addMethod(
  46011. smalltalk.method({
  46012. selector: "initializeWithContext:node:",
  46013. protocol: 'initialization',
  46014. fn: function (aContext,aNode){
  46015. var self=this;
  46016. self["@node"]=aNode;
  46017. self["@outerContext"]=aContext;
  46018. return self;
  46019. },
  46020. //>>excludeStart("ide", pragmas.excludeIdeData);
  46021. args: ["aContext", "aNode"],
  46022. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  46023. referencedClasses: [],
  46024. //>>excludeEnd("ide");
  46025. messageSends: []
  46026. }),
  46027. globals.AIBlockClosure);
  46028. smalltalk.addMethod(
  46029. smalltalk.method({
  46030. selector: "interpreterError",
  46031. protocol: 'error handling',
  46032. fn: function (){
  46033. var self=this;
  46034. function $ASTInterpreterError(){return globals.ASTInterpreterError||(typeof ASTInterpreterError=="undefined"?nil:ASTInterpreterError)}
  46035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46036. return smalltalk.withContext(function($ctx1) {
  46037. //>>excludeEnd("ctx");
  46038. _st($ASTInterpreterError())._signal_("Method cannot be interpreted by the interpreter.");
  46039. return self;
  46040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46041. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},globals.AIBlockClosure)});
  46042. //>>excludeEnd("ctx");
  46043. },
  46044. //>>excludeStart("ide", pragmas.excludeIdeData);
  46045. args: [],
  46046. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  46047. referencedClasses: ["ASTInterpreterError"],
  46048. //>>excludeEnd("ide");
  46049. messageSends: ["signal:"]
  46050. }),
  46051. globals.AIBlockClosure);
  46052. smalltalk.addMethod(
  46053. smalltalk.method({
  46054. selector: "numArgs",
  46055. protocol: 'accessing',
  46056. fn: function (){
  46057. var self=this;
  46058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46059. return smalltalk.withContext(function($ctx1) {
  46060. //>>excludeEnd("ctx");
  46061. var $1;
  46062. $1=_st(_st(self["@node"])._temps())._size();
  46063. return $1;
  46064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46065. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},globals.AIBlockClosure)});
  46066. //>>excludeEnd("ctx");
  46067. },
  46068. //>>excludeStart("ide", pragmas.excludeIdeData);
  46069. args: [],
  46070. source: "numArgs\x0a\x09^ node temps size",
  46071. referencedClasses: [],
  46072. //>>excludeEnd("ide");
  46073. messageSends: ["size", "temps"]
  46074. }),
  46075. globals.AIBlockClosure);
  46076. smalltalk.addMethod(
  46077. smalltalk.method({
  46078. selector: "value",
  46079. protocol: 'evaluating',
  46080. fn: function (){
  46081. var self=this;
  46082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46083. return smalltalk.withContext(function($ctx1) {
  46084. //>>excludeEnd("ctx");
  46085. var $1;
  46086. $1=self._valueWithPossibleArguments_([]);
  46087. return $1;
  46088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46089. }, function($ctx1) {$ctx1.fill(self,"value",{},globals.AIBlockClosure)});
  46090. //>>excludeEnd("ctx");
  46091. },
  46092. //>>excludeStart("ide", pragmas.excludeIdeData);
  46093. args: [],
  46094. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  46095. referencedClasses: [],
  46096. //>>excludeEnd("ide");
  46097. messageSends: ["valueWithPossibleArguments:"]
  46098. }),
  46099. globals.AIBlockClosure);
  46100. smalltalk.addMethod(
  46101. smalltalk.method({
  46102. selector: "value:",
  46103. protocol: 'evaluating',
  46104. fn: function (anArgument){
  46105. var self=this;
  46106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46107. return smalltalk.withContext(function($ctx1) {
  46108. //>>excludeEnd("ctx");
  46109. var $1;
  46110. $1=self._valueWithPossibleArguments_([anArgument]);
  46111. return $1;
  46112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46113. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},globals.AIBlockClosure)});
  46114. //>>excludeEnd("ctx");
  46115. },
  46116. //>>excludeStart("ide", pragmas.excludeIdeData);
  46117. args: ["anArgument"],
  46118. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  46119. referencedClasses: [],
  46120. //>>excludeEnd("ide");
  46121. messageSends: ["valueWithPossibleArguments:"]
  46122. }),
  46123. globals.AIBlockClosure);
  46124. smalltalk.addMethod(
  46125. smalltalk.method({
  46126. selector: "value:value:",
  46127. protocol: 'evaluating',
  46128. fn: function (firstArgument,secondArgument){
  46129. var self=this;
  46130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46131. return smalltalk.withContext(function($ctx1) {
  46132. //>>excludeEnd("ctx");
  46133. var $1;
  46134. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  46135. return $1;
  46136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46137. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},globals.AIBlockClosure)});
  46138. //>>excludeEnd("ctx");
  46139. },
  46140. //>>excludeStart("ide", pragmas.excludeIdeData);
  46141. args: ["firstArgument", "secondArgument"],
  46142. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  46143. referencedClasses: [],
  46144. //>>excludeEnd("ide");
  46145. messageSends: ["valueWithPossibleArguments:"]
  46146. }),
  46147. globals.AIBlockClosure);
  46148. smalltalk.addMethod(
  46149. smalltalk.method({
  46150. selector: "value:value:value:",
  46151. protocol: 'evaluating',
  46152. fn: function (firstArgument,secondArgument,thirdArgument){
  46153. var self=this;
  46154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46155. return smalltalk.withContext(function($ctx1) {
  46156. //>>excludeEnd("ctx");
  46157. var $1;
  46158. $1=self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  46159. return $1;
  46160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46161. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},globals.AIBlockClosure)});
  46162. //>>excludeEnd("ctx");
  46163. },
  46164. //>>excludeStart("ide", pragmas.excludeIdeData);
  46165. args: ["firstArgument", "secondArgument", "thirdArgument"],
  46166. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  46167. referencedClasses: [],
  46168. //>>excludeEnd("ide");
  46169. messageSends: ["valueWithPossibleArguments:"]
  46170. }),
  46171. globals.AIBlockClosure);
  46172. smalltalk.addMethod(
  46173. smalltalk.method({
  46174. selector: "valueWithPossibleArguments:",
  46175. protocol: 'evaluating',
  46176. fn: function (aCollection){
  46177. var self=this;
  46178. var context,sequenceNode;
  46179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46180. return smalltalk.withContext(function($ctx1) {
  46181. //>>excludeEnd("ctx");
  46182. var $1,$2,$3,$4,$5,$6;
  46183. context=_st(self["@outerContext"])._newInnerContext();
  46184. $1=_st(_st(_st(self["@node"])._nodes())._first())._copy();
  46185. _st($1)._parent_(nil);
  46186. $2=_st($1)._yourself();
  46187. sequenceNode=$2;
  46188. _st(_st(sequenceNode)._temps())._do_((function(each){
  46189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46190. return smalltalk.withContext(function($ctx2) {
  46191. //>>excludeEnd("ctx");
  46192. return _st(context)._defineLocal_(each);
  46193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46194. $ctx2.sendIdx["defineLocal:"]=1;
  46195. //>>excludeEnd("ctx");
  46196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46197. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46198. //>>excludeEnd("ctx");
  46199. }));
  46200. _st(_st(self["@node"])._parameters())._withIndexDo_((function(each,index){
  46201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46202. return smalltalk.withContext(function($ctx2) {
  46203. //>>excludeEnd("ctx");
  46204. _st(context)._defineLocal_(each);
  46205. return _st(context)._localAt_put_(each,_st(aCollection)._at_ifAbsent_(index,(function(){
  46206. return nil;
  46207. })));
  46208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46209. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  46210. //>>excludeEnd("ctx");
  46211. }));
  46212. $3=_st(context)._interpreter();
  46213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46214. $ctx1.sendIdx["interpreter"]=1;
  46215. //>>excludeEnd("ctx");
  46216. _st($3)._node_(_st(sequenceNode)._nextChild());
  46217. $4=_st($3)._proceed();
  46218. $5=_st(self["@outerContext"])._interpreter();
  46219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46220. $ctx1.sendIdx["interpreter"]=2;
  46221. //>>excludeEnd("ctx");
  46222. _st($5)._setNonLocalReturnFromContext_(context);
  46223. $6=_st(_st(context)._interpreter())._pop();
  46224. return $6;
  46225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46226. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},globals.AIBlockClosure)});
  46227. //>>excludeEnd("ctx");
  46228. },
  46229. //>>excludeStart("ide", pragmas.excludeIdeData);
  46230. args: ["aCollection"],
  46231. 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",
  46232. referencedClasses: [],
  46233. //>>excludeEnd("ide");
  46234. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "nextChild", "proceed", "setNonLocalReturnFromContext:", "pop"]
  46235. }),
  46236. globals.AIBlockClosure);
  46237. smalltalk.addMethod(
  46238. smalltalk.method({
  46239. selector: "forContext:node:",
  46240. protocol: 'instance creation',
  46241. fn: function (aContext,aNode){
  46242. var self=this;
  46243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46244. return smalltalk.withContext(function($ctx1) {
  46245. //>>excludeEnd("ctx");
  46246. var $2,$3,$1;
  46247. $2=self._new();
  46248. _st($2)._initializeWithContext_node_(aContext,aNode);
  46249. $3=_st($2)._yourself();
  46250. $1=$3;
  46251. return $1;
  46252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46253. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},globals.AIBlockClosure.klass)});
  46254. //>>excludeEnd("ctx");
  46255. },
  46256. //>>excludeStart("ide", pragmas.excludeIdeData);
  46257. args: ["aContext", "aNode"],
  46258. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  46259. referencedClasses: [],
  46260. //>>excludeEnd("ide");
  46261. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  46262. }),
  46263. globals.AIBlockClosure.klass);
  46264. smalltalk.addClass('AIContext', globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  46265. //>>excludeStart("ide", pragmas.excludeIdeData);
  46266. 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)";
  46267. //>>excludeEnd("ide");
  46268. smalltalk.addMethod(
  46269. smalltalk.method({
  46270. selector: "arguments",
  46271. protocol: 'interpreting',
  46272. fn: function (){
  46273. var self=this;
  46274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46275. return smalltalk.withContext(function($ctx1) {
  46276. //>>excludeEnd("ctx");
  46277. var $1;
  46278. $1=_st(_st(self._ast())._arguments())._collect_((function(each){
  46279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46280. return smalltalk.withContext(function($ctx2) {
  46281. //>>excludeEnd("ctx");
  46282. return self._localAt_ifAbsent_(each,(function(){
  46283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46284. return smalltalk.withContext(function($ctx3) {
  46285. //>>excludeEnd("ctx");
  46286. return self._error_("Argument not in context");
  46287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46288. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46289. //>>excludeEnd("ctx");
  46290. }));
  46291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46292. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46293. //>>excludeEnd("ctx");
  46294. }));
  46295. return $1;
  46296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46297. }, function($ctx1) {$ctx1.fill(self,"arguments",{},globals.AIContext)});
  46298. //>>excludeEnd("ctx");
  46299. },
  46300. //>>excludeStart("ide", pragmas.excludeIdeData);
  46301. args: [],
  46302. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  46303. referencedClasses: [],
  46304. //>>excludeEnd("ide");
  46305. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  46306. }),
  46307. globals.AIContext);
  46308. smalltalk.addMethod(
  46309. smalltalk.method({
  46310. selector: "ast",
  46311. protocol: 'interpreting',
  46312. fn: function (){
  46313. var self=this;
  46314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46315. return smalltalk.withContext(function($ctx1) {
  46316. //>>excludeEnd("ctx");
  46317. var $1,$3,$2,$4,$5,$receiver;
  46318. $1=self._isBlockContext();
  46319. if(smalltalk.assert($1)){
  46320. $3=self._outerContext();
  46321. if(($receiver = $3) == null || $receiver.isNil){
  46322. $2=$3;
  46323. } else {
  46324. var context;
  46325. context=$receiver;
  46326. $2=_st(context)._ast();
  46327. };
  46328. return $2;
  46329. };
  46330. $4=self["@ast"];
  46331. if(($receiver = $4) == null || $receiver.isNil){
  46332. self._initializeAST();
  46333. } else {
  46334. $4;
  46335. };
  46336. $5=self["@ast"];
  46337. return $5;
  46338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46339. }, function($ctx1) {$ctx1.fill(self,"ast",{},globals.AIContext)});
  46340. //>>excludeEnd("ctx");
  46341. },
  46342. //>>excludeStart("ide", pragmas.excludeIdeData);
  46343. args: [],
  46344. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  46345. referencedClasses: [],
  46346. //>>excludeEnd("ide");
  46347. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  46348. }),
  46349. globals.AIContext);
  46350. smalltalk.addMethod(
  46351. smalltalk.method({
  46352. selector: "basicLocalAt:",
  46353. protocol: 'private',
  46354. fn: function (aString){
  46355. var self=this;
  46356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46357. return smalltalk.withContext(function($ctx1) {
  46358. //>>excludeEnd("ctx");
  46359. var $1;
  46360. $1=_st(self._locals())._at_(aString);
  46361. return $1;
  46362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46363. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},globals.AIContext)});
  46364. //>>excludeEnd("ctx");
  46365. },
  46366. //>>excludeStart("ide", pragmas.excludeIdeData);
  46367. args: ["aString"],
  46368. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  46369. referencedClasses: [],
  46370. //>>excludeEnd("ide");
  46371. messageSends: ["at:", "locals"]
  46372. }),
  46373. globals.AIContext);
  46374. smalltalk.addMethod(
  46375. smalltalk.method({
  46376. selector: "basicLocalAt:put:",
  46377. protocol: 'private',
  46378. fn: function (aString,anObject){
  46379. var self=this;
  46380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46381. return smalltalk.withContext(function($ctx1) {
  46382. //>>excludeEnd("ctx");
  46383. _st(self._locals())._at_put_(aString,anObject);
  46384. return self;
  46385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46386. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},globals.AIContext)});
  46387. //>>excludeEnd("ctx");
  46388. },
  46389. //>>excludeStart("ide", pragmas.excludeIdeData);
  46390. args: ["aString", "anObject"],
  46391. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  46392. referencedClasses: [],
  46393. //>>excludeEnd("ide");
  46394. messageSends: ["at:put:", "locals"]
  46395. }),
  46396. globals.AIContext);
  46397. smalltalk.addMethod(
  46398. smalltalk.method({
  46399. selector: "basicReceiver",
  46400. protocol: 'interpreting',
  46401. fn: function (){
  46402. var self=this;
  46403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46404. return smalltalk.withContext(function($ctx1) {
  46405. //>>excludeEnd("ctx");
  46406. var $1;
  46407. $1=self._localAt_("self");
  46408. return $1;
  46409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46410. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},globals.AIContext)});
  46411. //>>excludeEnd("ctx");
  46412. },
  46413. //>>excludeStart("ide", pragmas.excludeIdeData);
  46414. args: [],
  46415. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  46416. referencedClasses: [],
  46417. //>>excludeEnd("ide");
  46418. messageSends: ["localAt:"]
  46419. }),
  46420. globals.AIContext);
  46421. smalltalk.addMethod(
  46422. smalltalk.method({
  46423. selector: "defineLocal:",
  46424. protocol: 'accessing',
  46425. fn: function (aString){
  46426. var self=this;
  46427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46428. return smalltalk.withContext(function($ctx1) {
  46429. //>>excludeEnd("ctx");
  46430. _st(self._locals())._at_put_(aString,nil);
  46431. return self;
  46432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46433. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},globals.AIContext)});
  46434. //>>excludeEnd("ctx");
  46435. },
  46436. //>>excludeStart("ide", pragmas.excludeIdeData);
  46437. args: ["aString"],
  46438. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  46439. referencedClasses: [],
  46440. //>>excludeEnd("ide");
  46441. messageSends: ["at:put:", "locals"]
  46442. }),
  46443. globals.AIContext);
  46444. smalltalk.addMethod(
  46445. smalltalk.method({
  46446. selector: "evaluate:on:",
  46447. protocol: 'evaluating',
  46448. fn: function (aString,anEvaluator){
  46449. var self=this;
  46450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46451. return smalltalk.withContext(function($ctx1) {
  46452. //>>excludeEnd("ctx");
  46453. var $1;
  46454. $1=_st(anEvaluator)._evaluate_context_(aString,self);
  46455. return $1;
  46456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46457. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},globals.AIContext)});
  46458. //>>excludeEnd("ctx");
  46459. },
  46460. //>>excludeStart("ide", pragmas.excludeIdeData);
  46461. args: ["aString", "anEvaluator"],
  46462. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  46463. referencedClasses: [],
  46464. //>>excludeEnd("ide");
  46465. messageSends: ["evaluate:context:"]
  46466. }),
  46467. globals.AIContext);
  46468. smalltalk.addMethod(
  46469. smalltalk.method({
  46470. selector: "evaluateNode:",
  46471. protocol: 'evaluating',
  46472. fn: function (aNode){
  46473. var self=this;
  46474. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  46475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46476. return smalltalk.withContext(function($ctx1) {
  46477. //>>excludeEnd("ctx");
  46478. var $2,$3,$1;
  46479. $2=_st($ASTInterpreter())._new();
  46480. _st($2)._context_(self);
  46481. _st($2)._node_(_st(aNode)._nextChild());
  46482. _st($2)._proceed();
  46483. $3=_st($2)._result();
  46484. $1=$3;
  46485. return $1;
  46486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46487. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},globals.AIContext)});
  46488. //>>excludeEnd("ctx");
  46489. },
  46490. //>>excludeStart("ide", pragmas.excludeIdeData);
  46491. args: ["aNode"],
  46492. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode nextChild;\x0a\x09\x09proceed;\x0a\x09\x09result",
  46493. referencedClasses: ["ASTInterpreter"],
  46494. //>>excludeEnd("ide");
  46495. messageSends: ["context:", "new", "node:", "nextChild", "proceed", "result"]
  46496. }),
  46497. globals.AIContext);
  46498. smalltalk.addMethod(
  46499. smalltalk.method({
  46500. selector: "evaluatedSelector",
  46501. protocol: 'accessing',
  46502. fn: function (){
  46503. var self=this;
  46504. var $1;
  46505. $1=self["@evaluatedSelector"];
  46506. return $1;
  46507. },
  46508. //>>excludeStart("ide", pragmas.excludeIdeData);
  46509. args: [],
  46510. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  46511. referencedClasses: [],
  46512. //>>excludeEnd("ide");
  46513. messageSends: []
  46514. }),
  46515. globals.AIContext);
  46516. smalltalk.addMethod(
  46517. smalltalk.method({
  46518. selector: "evaluatedSelector:",
  46519. protocol: 'accessing',
  46520. fn: function (aString){
  46521. var self=this;
  46522. self["@evaluatedSelector"]=aString;
  46523. return self;
  46524. },
  46525. //>>excludeStart("ide", pragmas.excludeIdeData);
  46526. args: ["aString"],
  46527. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  46528. referencedClasses: [],
  46529. //>>excludeEnd("ide");
  46530. messageSends: []
  46531. }),
  46532. globals.AIContext);
  46533. smalltalk.addMethod(
  46534. smalltalk.method({
  46535. selector: "index",
  46536. protocol: 'accessing',
  46537. fn: function (){
  46538. var self=this;
  46539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46540. return smalltalk.withContext(function($ctx1) {
  46541. //>>excludeEnd("ctx");
  46542. var $2,$1,$receiver;
  46543. $2=self["@index"];
  46544. if(($receiver = $2) == null || $receiver.isNil){
  46545. $1=(0);
  46546. } else {
  46547. $1=$2;
  46548. };
  46549. return $1;
  46550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46551. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.AIContext)});
  46552. //>>excludeEnd("ctx");
  46553. },
  46554. //>>excludeStart("ide", pragmas.excludeIdeData);
  46555. args: [],
  46556. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  46557. referencedClasses: [],
  46558. //>>excludeEnd("ide");
  46559. messageSends: ["ifNil:"]
  46560. }),
  46561. globals.AIContext);
  46562. smalltalk.addMethod(
  46563. smalltalk.method({
  46564. selector: "index:",
  46565. protocol: 'accessing',
  46566. fn: function (anInteger){
  46567. var self=this;
  46568. self["@index"]=anInteger;
  46569. return self;
  46570. },
  46571. //>>excludeStart("ide", pragmas.excludeIdeData);
  46572. args: ["anInteger"],
  46573. source: "index: anInteger\x0a\x09index := anInteger",
  46574. referencedClasses: [],
  46575. //>>excludeEnd("ide");
  46576. messageSends: []
  46577. }),
  46578. globals.AIContext);
  46579. smalltalk.addMethod(
  46580. smalltalk.method({
  46581. selector: "initializeAST",
  46582. protocol: 'initialization',
  46583. fn: function (){
  46584. var self=this;
  46585. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  46586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46587. return smalltalk.withContext(function($ctx1) {
  46588. //>>excludeEnd("ctx");
  46589. var $1;
  46590. $1=self._method();
  46591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46592. $ctx1.sendIdx["method"]=1;
  46593. //>>excludeEnd("ctx");
  46594. self["@ast"]=_st($1)._ast();
  46595. _st(_st($SemanticAnalyzer())._on_(_st(self._method())._methodClass()))._visit_(self["@ast"]);
  46596. return self;
  46597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46598. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},globals.AIContext)});
  46599. //>>excludeEnd("ctx");
  46600. },
  46601. //>>excludeStart("ide", pragmas.excludeIdeData);
  46602. args: [],
  46603. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  46604. referencedClasses: ["SemanticAnalyzer"],
  46605. //>>excludeEnd("ide");
  46606. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  46607. }),
  46608. globals.AIContext);
  46609. smalltalk.addMethod(
  46610. smalltalk.method({
  46611. selector: "initializeFromMethodContext:",
  46612. protocol: 'initialization',
  46613. fn: function (aMethodContext){
  46614. var self=this;
  46615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46616. return smalltalk.withContext(function($ctx1) {
  46617. //>>excludeEnd("ctx");
  46618. var $1,$2,$3,$4,$receiver;
  46619. self._evaluatedSelector_(_st(aMethodContext)._evaluatedSelector());
  46620. self._index_(_st(aMethodContext)._index());
  46621. self._sendIndexes_(_st(aMethodContext)._sendIndexes());
  46622. self._receiver_(_st(aMethodContext)._receiver());
  46623. self._supercall_(_st(aMethodContext)._supercall());
  46624. $1=self._selector_(_st(aMethodContext)._selector());
  46625. $2=_st(aMethodContext)._outerContext();
  46626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46627. $ctx1.sendIdx["outerContext"]=1;
  46628. //>>excludeEnd("ctx");
  46629. if(($receiver = $2) == null || $receiver.isNil){
  46630. $2;
  46631. } else {
  46632. var outer;
  46633. outer=$receiver;
  46634. $3=_st(outer)._methodContext();
  46635. if(($receiver = $3) == null || $receiver.isNil){
  46636. $3;
  46637. } else {
  46638. self._outerContext_(_st(self._class())._fromMethodContext_(_st(aMethodContext)._outerContext()));
  46639. };
  46640. $4=_st(aMethodContext)._locals();
  46641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46642. $ctx1.sendIdx["locals"]=1;
  46643. //>>excludeEnd("ctx");
  46644. _st($4)._keysAndValuesDo_((function(key,value){
  46645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46646. return smalltalk.withContext(function($ctx2) {
  46647. //>>excludeEnd("ctx");
  46648. return _st(self._locals())._at_put_(key,value);
  46649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46650. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46651. //>>excludeEnd("ctx");
  46652. }));
  46653. };
  46654. return self;
  46655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46656. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext)});
  46657. //>>excludeEnd("ctx");
  46658. },
  46659. //>>excludeStart("ide", pragmas.excludeIdeData);
  46660. args: ["aMethodContext"],
  46661. 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 ] ]",
  46662. referencedClasses: [],
  46663. //>>excludeEnd("ide");
  46664. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  46665. }),
  46666. globals.AIContext);
  46667. smalltalk.addMethod(
  46668. smalltalk.method({
  46669. selector: "initializeInterpreter",
  46670. protocol: 'initialization',
  46671. fn: function (){
  46672. var self=this;
  46673. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  46674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46675. return smalltalk.withContext(function($ctx1) {
  46676. //>>excludeEnd("ctx");
  46677. var $1,$2,$3,$receiver;
  46678. $1=_st($ASTInterpreter())._new();
  46679. _st($1)._context_(self);
  46680. $2=_st($1)._yourself();
  46681. self["@interpreter"]=$2;
  46682. $3=self._innerContext();
  46683. if(($receiver = $3) == null || $receiver.isNil){
  46684. $3;
  46685. } else {
  46686. self._setupInterpreter_(self["@interpreter"]);
  46687. };
  46688. return self;
  46689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46690. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},globals.AIContext)});
  46691. //>>excludeEnd("ctx");
  46692. },
  46693. //>>excludeStart("ide", pragmas.excludeIdeData);
  46694. args: [],
  46695. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  46696. referencedClasses: ["ASTInterpreter"],
  46697. //>>excludeEnd("ide");
  46698. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  46699. }),
  46700. globals.AIContext);
  46701. smalltalk.addMethod(
  46702. smalltalk.method({
  46703. selector: "initializeLocals",
  46704. protocol: 'initialization',
  46705. fn: function (){
  46706. var self=this;
  46707. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  46708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46709. return smalltalk.withContext(function($ctx1) {
  46710. //>>excludeEnd("ctx");
  46711. self["@locals"]=_st($Dictionary())._new();
  46712. _st(self["@locals"])._at_put_("thisContext",self);
  46713. return self;
  46714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46715. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},globals.AIContext)});
  46716. //>>excludeEnd("ctx");
  46717. },
  46718. //>>excludeStart("ide", pragmas.excludeIdeData);
  46719. args: [],
  46720. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  46721. referencedClasses: ["Dictionary"],
  46722. //>>excludeEnd("ide");
  46723. messageSends: ["new", "at:put:"]
  46724. }),
  46725. globals.AIContext);
  46726. smalltalk.addMethod(
  46727. smalltalk.method({
  46728. selector: "innerContext",
  46729. protocol: 'accessing',
  46730. fn: function (){
  46731. var self=this;
  46732. var $1;
  46733. $1=self["@innerContext"];
  46734. return $1;
  46735. },
  46736. //>>excludeStart("ide", pragmas.excludeIdeData);
  46737. args: [],
  46738. source: "innerContext\x0a\x09^ innerContext",
  46739. referencedClasses: [],
  46740. //>>excludeEnd("ide");
  46741. messageSends: []
  46742. }),
  46743. globals.AIContext);
  46744. smalltalk.addMethod(
  46745. smalltalk.method({
  46746. selector: "innerContext:",
  46747. protocol: 'accessing',
  46748. fn: function (anAIContext){
  46749. var self=this;
  46750. self["@innerContext"]=anAIContext;
  46751. return self;
  46752. },
  46753. //>>excludeStart("ide", pragmas.excludeIdeData);
  46754. args: ["anAIContext"],
  46755. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  46756. referencedClasses: [],
  46757. //>>excludeEnd("ide");
  46758. messageSends: []
  46759. }),
  46760. globals.AIContext);
  46761. smalltalk.addMethod(
  46762. smalltalk.method({
  46763. selector: "interpreter",
  46764. protocol: 'interpreting',
  46765. fn: function (){
  46766. var self=this;
  46767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46768. return smalltalk.withContext(function($ctx1) {
  46769. //>>excludeEnd("ctx");
  46770. var $1,$2,$receiver;
  46771. $1=self["@interpreter"];
  46772. if(($receiver = $1) == null || $receiver.isNil){
  46773. self._initializeInterpreter();
  46774. } else {
  46775. $1;
  46776. };
  46777. $2=self["@interpreter"];
  46778. return $2;
  46779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46780. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.AIContext)});
  46781. //>>excludeEnd("ctx");
  46782. },
  46783. //>>excludeStart("ide", pragmas.excludeIdeData);
  46784. args: [],
  46785. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  46786. referencedClasses: [],
  46787. //>>excludeEnd("ide");
  46788. messageSends: ["ifNil:", "initializeInterpreter"]
  46789. }),
  46790. globals.AIContext);
  46791. smalltalk.addMethod(
  46792. smalltalk.method({
  46793. selector: "interpreter:",
  46794. protocol: 'interpreting',
  46795. fn: function (anInterpreter){
  46796. var self=this;
  46797. self["@interpreter"]=anInterpreter;
  46798. return self;
  46799. },
  46800. //>>excludeStart("ide", pragmas.excludeIdeData);
  46801. args: ["anInterpreter"],
  46802. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  46803. referencedClasses: [],
  46804. //>>excludeEnd("ide");
  46805. messageSends: []
  46806. }),
  46807. globals.AIContext);
  46808. smalltalk.addMethod(
  46809. smalltalk.method({
  46810. selector: "isTopContext",
  46811. protocol: 'testing',
  46812. fn: function (){
  46813. var self=this;
  46814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46815. return smalltalk.withContext(function($ctx1) {
  46816. //>>excludeEnd("ctx");
  46817. var $1;
  46818. $1=_st(self._innerContext())._isNil();
  46819. return $1;
  46820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46821. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},globals.AIContext)});
  46822. //>>excludeEnd("ctx");
  46823. },
  46824. //>>excludeStart("ide", pragmas.excludeIdeData);
  46825. args: [],
  46826. source: "isTopContext\x0a\x09^ self innerContext isNil",
  46827. referencedClasses: [],
  46828. //>>excludeEnd("ide");
  46829. messageSends: ["isNil", "innerContext"]
  46830. }),
  46831. globals.AIContext);
  46832. smalltalk.addMethod(
  46833. smalltalk.method({
  46834. selector: "localAt:",
  46835. protocol: 'accessing',
  46836. fn: function (aString){
  46837. var self=this;
  46838. var context;
  46839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46840. return smalltalk.withContext(function($ctx1) {
  46841. //>>excludeEnd("ctx");
  46842. var $1;
  46843. context=self._lookupContextForLocal_(aString);
  46844. $1=_st(context)._basicLocalAt_(aString);
  46845. return $1;
  46846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46847. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},globals.AIContext)});
  46848. //>>excludeEnd("ctx");
  46849. },
  46850. //>>excludeStart("ide", pragmas.excludeIdeData);
  46851. args: ["aString"],
  46852. 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",
  46853. referencedClasses: [],
  46854. //>>excludeEnd("ide");
  46855. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  46856. }),
  46857. globals.AIContext);
  46858. smalltalk.addMethod(
  46859. smalltalk.method({
  46860. selector: "localAt:ifAbsent:",
  46861. protocol: 'accessing',
  46862. fn: function (aString,aBlock){
  46863. var self=this;
  46864. var context;
  46865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46866. return smalltalk.withContext(function($ctx1) {
  46867. //>>excludeEnd("ctx");
  46868. var $1,$2;
  46869. var $early={};
  46870. try {
  46871. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  46872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46873. return smalltalk.withContext(function($ctx2) {
  46874. //>>excludeEnd("ctx");
  46875. $1=_st(aBlock)._value();
  46876. throw $early=[$1];
  46877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46879. //>>excludeEnd("ctx");
  46880. }));
  46881. $2=_st(context)._basicLocalAt_(aString);
  46882. return $2;
  46883. }
  46884. catch(e) {if(e===$early)return e[0]; throw e}
  46885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46886. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},globals.AIContext)});
  46887. //>>excludeEnd("ctx");
  46888. },
  46889. //>>excludeStart("ide", pragmas.excludeIdeData);
  46890. args: ["aString", "aBlock"],
  46891. 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",
  46892. referencedClasses: [],
  46893. //>>excludeEnd("ide");
  46894. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  46895. }),
  46896. globals.AIContext);
  46897. smalltalk.addMethod(
  46898. smalltalk.method({
  46899. selector: "localAt:put:",
  46900. protocol: 'accessing',
  46901. fn: function (aString,anObject){
  46902. var self=this;
  46903. var context;
  46904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46905. return smalltalk.withContext(function($ctx1) {
  46906. //>>excludeEnd("ctx");
  46907. context=self._lookupContextForLocal_(aString);
  46908. _st(context)._basicLocalAt_put_(aString,anObject);
  46909. return self;
  46910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46911. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},globals.AIContext)});
  46912. //>>excludeEnd("ctx");
  46913. },
  46914. //>>excludeStart("ide", pragmas.excludeIdeData);
  46915. args: ["aString", "anObject"],
  46916. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  46917. referencedClasses: [],
  46918. //>>excludeEnd("ide");
  46919. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  46920. }),
  46921. globals.AIContext);
  46922. smalltalk.addMethod(
  46923. smalltalk.method({
  46924. selector: "locals",
  46925. protocol: 'accessing',
  46926. fn: function (){
  46927. var self=this;
  46928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46929. return smalltalk.withContext(function($ctx1) {
  46930. //>>excludeEnd("ctx");
  46931. var $1,$2,$receiver;
  46932. $1=self["@locals"];
  46933. if(($receiver = $1) == null || $receiver.isNil){
  46934. self._initializeLocals();
  46935. } else {
  46936. $1;
  46937. };
  46938. $2=self["@locals"];
  46939. return $2;
  46940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46941. }, function($ctx1) {$ctx1.fill(self,"locals",{},globals.AIContext)});
  46942. //>>excludeEnd("ctx");
  46943. },
  46944. //>>excludeStart("ide", pragmas.excludeIdeData);
  46945. args: [],
  46946. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  46947. referencedClasses: [],
  46948. //>>excludeEnd("ide");
  46949. messageSends: ["ifNil:", "initializeLocals"]
  46950. }),
  46951. globals.AIContext);
  46952. smalltalk.addMethod(
  46953. smalltalk.method({
  46954. selector: "lookupContextForLocal:",
  46955. protocol: 'private',
  46956. fn: function (aString){
  46957. var self=this;
  46958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46959. return smalltalk.withContext(function($ctx1) {
  46960. //>>excludeEnd("ctx");
  46961. var $1;
  46962. $1=self._lookupContextForLocal_ifNone_(aString,(function(){
  46963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46964. return smalltalk.withContext(function($ctx2) {
  46965. //>>excludeEnd("ctx");
  46966. return self._variableNotFound();
  46967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46969. //>>excludeEnd("ctx");
  46970. }));
  46971. return $1;
  46972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46973. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},globals.AIContext)});
  46974. //>>excludeEnd("ctx");
  46975. },
  46976. //>>excludeStart("ide", pragmas.excludeIdeData);
  46977. args: ["aString"],
  46978. 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 ]",
  46979. referencedClasses: [],
  46980. //>>excludeEnd("ide");
  46981. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  46982. }),
  46983. globals.AIContext);
  46984. smalltalk.addMethod(
  46985. smalltalk.method({
  46986. selector: "lookupContextForLocal:ifNone:",
  46987. protocol: 'private',
  46988. fn: function (aString,aBlock){
  46989. var self=this;
  46990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46991. return smalltalk.withContext(function($ctx1) {
  46992. //>>excludeEnd("ctx");
  46993. var $2,$1;
  46994. $1=_st(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  46995. return self;
  46996. }),(function(){
  46997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46998. return smalltalk.withContext(function($ctx2) {
  46999. //>>excludeEnd("ctx");
  47000. $2=self._outerContext();
  47001. return _st($2)._ifNil_ifNotNil_(aBlock,(function(context){
  47002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47003. return smalltalk.withContext(function($ctx3) {
  47004. //>>excludeEnd("ctx");
  47005. return _st(context)._lookupContextForLocal_(aString);
  47006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47007. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  47008. //>>excludeEnd("ctx");
  47009. }));
  47010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47012. //>>excludeEnd("ctx");
  47013. }));
  47014. return $1;
  47015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47016. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},globals.AIContext)});
  47017. //>>excludeEnd("ctx");
  47018. },
  47019. //>>excludeStart("ide", pragmas.excludeIdeData);
  47020. args: ["aString", "aBlock"],
  47021. 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 ] ]",
  47022. referencedClasses: [],
  47023. //>>excludeEnd("ide");
  47024. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  47025. }),
  47026. globals.AIContext);
  47027. smalltalk.addMethod(
  47028. smalltalk.method({
  47029. selector: "newInnerContext",
  47030. protocol: 'factory',
  47031. fn: function (){
  47032. var self=this;
  47033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47034. return smalltalk.withContext(function($ctx1) {
  47035. //>>excludeEnd("ctx");
  47036. var $2,$3,$1;
  47037. $2=_st(self._class())._new();
  47038. _st($2)._outerContext_(self);
  47039. $3=_st($2)._yourself();
  47040. $1=$3;
  47041. return $1;
  47042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47043. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},globals.AIContext)});
  47044. //>>excludeEnd("ctx");
  47045. },
  47046. //>>excludeStart("ide", pragmas.excludeIdeData);
  47047. args: [],
  47048. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  47049. referencedClasses: [],
  47050. //>>excludeEnd("ide");
  47051. messageSends: ["outerContext:", "new", "class", "yourself"]
  47052. }),
  47053. globals.AIContext);
  47054. smalltalk.addMethod(
  47055. smalltalk.method({
  47056. selector: "outerContext",
  47057. protocol: 'accessing',
  47058. fn: function (){
  47059. var self=this;
  47060. var $1;
  47061. $1=self["@outerContext"];
  47062. return $1;
  47063. },
  47064. //>>excludeStart("ide", pragmas.excludeIdeData);
  47065. args: [],
  47066. source: "outerContext\x0a\x09^ outerContext",
  47067. referencedClasses: [],
  47068. //>>excludeEnd("ide");
  47069. messageSends: []
  47070. }),
  47071. globals.AIContext);
  47072. smalltalk.addMethod(
  47073. smalltalk.method({
  47074. selector: "outerContext:",
  47075. protocol: 'accessing',
  47076. fn: function (anAIContext){
  47077. var self=this;
  47078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47079. return smalltalk.withContext(function($ctx1) {
  47080. //>>excludeEnd("ctx");
  47081. var $1,$receiver;
  47082. self["@outerContext"]=anAIContext;
  47083. $1=self["@outerContext"];
  47084. if(($receiver = $1) == null || $receiver.isNil){
  47085. $1;
  47086. } else {
  47087. var context;
  47088. context=$receiver;
  47089. _st(context)._innerContext_(self);
  47090. };
  47091. return self;
  47092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47093. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},globals.AIContext)});
  47094. //>>excludeEnd("ctx");
  47095. },
  47096. //>>excludeStart("ide", pragmas.excludeIdeData);
  47097. args: ["anAIContext"],
  47098. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  47099. referencedClasses: [],
  47100. //>>excludeEnd("ide");
  47101. messageSends: ["ifNotNil:", "innerContext:"]
  47102. }),
  47103. globals.AIContext);
  47104. smalltalk.addMethod(
  47105. smalltalk.method({
  47106. selector: "receiver:",
  47107. protocol: 'interpreting',
  47108. fn: function (anObject){
  47109. var self=this;
  47110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47111. return smalltalk.withContext(function($ctx1) {
  47112. //>>excludeEnd("ctx");
  47113. _st(self._locals())._at_put_("self",anObject);
  47114. return self;
  47115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47116. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.AIContext)});
  47117. //>>excludeEnd("ctx");
  47118. },
  47119. //>>excludeStart("ide", pragmas.excludeIdeData);
  47120. args: ["anObject"],
  47121. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  47122. referencedClasses: [],
  47123. //>>excludeEnd("ide");
  47124. messageSends: ["at:put:", "locals"]
  47125. }),
  47126. globals.AIContext);
  47127. smalltalk.addMethod(
  47128. smalltalk.method({
  47129. selector: "selector",
  47130. protocol: 'accessing',
  47131. fn: function (){
  47132. var self=this;
  47133. var $1;
  47134. $1=self["@selector"];
  47135. return $1;
  47136. },
  47137. //>>excludeStart("ide", pragmas.excludeIdeData);
  47138. args: [],
  47139. source: "selector\x0a\x09^ selector",
  47140. referencedClasses: [],
  47141. //>>excludeEnd("ide");
  47142. messageSends: []
  47143. }),
  47144. globals.AIContext);
  47145. smalltalk.addMethod(
  47146. smalltalk.method({
  47147. selector: "selector:",
  47148. protocol: 'accessing',
  47149. fn: function (aString){
  47150. var self=this;
  47151. self["@selector"]=aString;
  47152. return self;
  47153. },
  47154. //>>excludeStart("ide", pragmas.excludeIdeData);
  47155. args: ["aString"],
  47156. source: "selector: aString\x0a\x09selector := aString",
  47157. referencedClasses: [],
  47158. //>>excludeEnd("ide");
  47159. messageSends: []
  47160. }),
  47161. globals.AIContext);
  47162. smalltalk.addMethod(
  47163. smalltalk.method({
  47164. selector: "sendIndexAt:",
  47165. protocol: 'accessing',
  47166. fn: function (aString){
  47167. var self=this;
  47168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47169. return smalltalk.withContext(function($ctx1) {
  47170. //>>excludeEnd("ctx");
  47171. var $1;
  47172. $1=_st(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  47173. return (0);
  47174. }));
  47175. return $1;
  47176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47177. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},globals.AIContext)});
  47178. //>>excludeEnd("ctx");
  47179. },
  47180. //>>excludeStart("ide", pragmas.excludeIdeData);
  47181. args: ["aString"],
  47182. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  47183. referencedClasses: [],
  47184. //>>excludeEnd("ide");
  47185. messageSends: ["at:ifAbsent:", "sendIndexes"]
  47186. }),
  47187. globals.AIContext);
  47188. smalltalk.addMethod(
  47189. smalltalk.method({
  47190. selector: "sendIndexes",
  47191. protocol: 'accessing',
  47192. fn: function (){
  47193. var self=this;
  47194. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  47195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47196. return smalltalk.withContext(function($ctx1) {
  47197. //>>excludeEnd("ctx");
  47198. var $2,$1,$receiver;
  47199. $2=self["@sendIndexes"];
  47200. if(($receiver = $2) == null || $receiver.isNil){
  47201. $1=_st($Dictionary())._new();
  47202. } else {
  47203. $1=$2;
  47204. };
  47205. return $1;
  47206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47207. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},globals.AIContext)});
  47208. //>>excludeEnd("ctx");
  47209. },
  47210. //>>excludeStart("ide", pragmas.excludeIdeData);
  47211. args: [],
  47212. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  47213. referencedClasses: ["Dictionary"],
  47214. //>>excludeEnd("ide");
  47215. messageSends: ["ifNil:", "new"]
  47216. }),
  47217. globals.AIContext);
  47218. smalltalk.addMethod(
  47219. smalltalk.method({
  47220. selector: "sendIndexes:",
  47221. protocol: 'accessing',
  47222. fn: function (aDictionary){
  47223. var self=this;
  47224. self["@sendIndexes"]=aDictionary;
  47225. return self;
  47226. },
  47227. //>>excludeStart("ide", pragmas.excludeIdeData);
  47228. args: ["aDictionary"],
  47229. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  47230. referencedClasses: [],
  47231. //>>excludeEnd("ide");
  47232. messageSends: []
  47233. }),
  47234. globals.AIContext);
  47235. smalltalk.addMethod(
  47236. smalltalk.method({
  47237. selector: "setupInterpreter:",
  47238. protocol: 'interpreting',
  47239. fn: function (anInterpreter){
  47240. var self=this;
  47241. var currentNode;
  47242. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  47243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47244. return smalltalk.withContext(function($ctx1) {
  47245. //>>excludeEnd("ctx");
  47246. var $1,$2,$3,$4,$5,$8,$7,$6,$receiver;
  47247. $1=_st($ASTPCNodeVisitor())._new();
  47248. _st($1)._selector_(self._evaluatedSelector());
  47249. _st($1)._context_(self);
  47250. $2=$1;
  47251. $3=self._ast();
  47252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47253. $ctx1.sendIdx["ast"]=1;
  47254. //>>excludeEnd("ctx");
  47255. _st($2)._visit_($3);
  47256. $4=_st($1)._currentNode();
  47257. currentNode=$4;
  47258. $5=_st(self._ast())._sequenceNode();
  47259. if(($receiver = $5) == null || $receiver.isNil){
  47260. $5;
  47261. } else {
  47262. var sequence;
  47263. sequence=$receiver;
  47264. _st(_st(sequence)._temps())._do_((function(each){
  47265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47266. return smalltalk.withContext(function($ctx2) {
  47267. //>>excludeEnd("ctx");
  47268. return self._defineLocal_(each);
  47269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  47271. //>>excludeEnd("ctx");
  47272. }));
  47273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47274. $ctx1.sendIdx["do:"]=1;
  47275. //>>excludeEnd("ctx");
  47276. };
  47277. _st(anInterpreter)._node_(currentNode);
  47278. $8=self._innerContext();
  47279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47280. $ctx1.sendIdx["innerContext"]=1;
  47281. //>>excludeEnd("ctx");
  47282. $7=_st($8)._arguments();
  47283. $6=_st($7)._reversed();
  47284. _st($6)._do_((function(each){
  47285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47286. return smalltalk.withContext(function($ctx2) {
  47287. //>>excludeEnd("ctx");
  47288. return _st(anInterpreter)._push_(each);
  47289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47290. $ctx2.sendIdx["push:"]=1;
  47291. //>>excludeEnd("ctx");
  47292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  47294. //>>excludeEnd("ctx");
  47295. }));
  47296. _st(anInterpreter)._push_(_st(self._innerContext())._receiver());
  47297. return self;
  47298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47299. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},globals.AIContext)});
  47300. //>>excludeEnd("ctx");
  47301. },
  47302. //>>excludeStart("ide", pragmas.excludeIdeData);
  47303. args: ["anInterpreter"],
  47304. 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)",
  47305. referencedClasses: ["ASTPCNodeVisitor"],
  47306. //>>excludeEnd("ide");
  47307. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  47308. }),
  47309. globals.AIContext);
  47310. smalltalk.addMethod(
  47311. smalltalk.method({
  47312. selector: "supercall",
  47313. protocol: 'interpreting',
  47314. fn: function (){
  47315. var self=this;
  47316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47317. return smalltalk.withContext(function($ctx1) {
  47318. //>>excludeEnd("ctx");
  47319. var $2,$1,$receiver;
  47320. $2=self["@supercall"];
  47321. if(($receiver = $2) == null || $receiver.isNil){
  47322. $1=false;
  47323. } else {
  47324. $1=$2;
  47325. };
  47326. return $1;
  47327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47328. }, function($ctx1) {$ctx1.fill(self,"supercall",{},globals.AIContext)});
  47329. //>>excludeEnd("ctx");
  47330. },
  47331. //>>excludeStart("ide", pragmas.excludeIdeData);
  47332. args: [],
  47333. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  47334. referencedClasses: [],
  47335. //>>excludeEnd("ide");
  47336. messageSends: ["ifNil:"]
  47337. }),
  47338. globals.AIContext);
  47339. smalltalk.addMethod(
  47340. smalltalk.method({
  47341. selector: "supercall:",
  47342. protocol: 'interpreting',
  47343. fn: function (aBoolean){
  47344. var self=this;
  47345. self["@supercall"]=aBoolean;
  47346. return self;
  47347. },
  47348. //>>excludeStart("ide", pragmas.excludeIdeData);
  47349. args: ["aBoolean"],
  47350. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  47351. referencedClasses: [],
  47352. //>>excludeEnd("ide");
  47353. messageSends: []
  47354. }),
  47355. globals.AIContext);
  47356. smalltalk.addMethod(
  47357. smalltalk.method({
  47358. selector: "variableNotFound",
  47359. protocol: 'error handling',
  47360. fn: function (){
  47361. var self=this;
  47362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47363. return smalltalk.withContext(function($ctx1) {
  47364. //>>excludeEnd("ctx");
  47365. self._error_("Variable missing");
  47366. return self;
  47367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47368. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},globals.AIContext)});
  47369. //>>excludeEnd("ctx");
  47370. },
  47371. //>>excludeStart("ide", pragmas.excludeIdeData);
  47372. args: [],
  47373. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  47374. referencedClasses: [],
  47375. //>>excludeEnd("ide");
  47376. messageSends: ["error:"]
  47377. }),
  47378. globals.AIContext);
  47379. smalltalk.addMethod(
  47380. smalltalk.method({
  47381. selector: "fromMethodContext:",
  47382. protocol: 'instance creation',
  47383. fn: function (aMethodContext){
  47384. var self=this;
  47385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47386. return smalltalk.withContext(function($ctx1) {
  47387. //>>excludeEnd("ctx");
  47388. var $2,$3,$1;
  47389. $2=self._new();
  47390. _st($2)._initializeFromMethodContext_(aMethodContext);
  47391. $3=_st($2)._yourself();
  47392. $1=$3;
  47393. return $1;
  47394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47395. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},globals.AIContext.klass)});
  47396. //>>excludeEnd("ctx");
  47397. },
  47398. //>>excludeStart("ide", pragmas.excludeIdeData);
  47399. args: ["aMethodContext"],
  47400. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  47401. referencedClasses: [],
  47402. //>>excludeEnd("ide");
  47403. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  47404. }),
  47405. globals.AIContext.klass);
  47406. smalltalk.addClass('AISemanticAnalyzer', globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  47407. //>>excludeStart("ide", pragmas.excludeIdeData);
  47408. 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.";
  47409. //>>excludeEnd("ide");
  47410. smalltalk.addMethod(
  47411. smalltalk.method({
  47412. selector: "context",
  47413. protocol: 'accessing',
  47414. fn: function (){
  47415. var self=this;
  47416. var $1;
  47417. $1=self["@context"];
  47418. return $1;
  47419. },
  47420. //>>excludeStart("ide", pragmas.excludeIdeData);
  47421. args: [],
  47422. source: "context\x0a\x09^ context",
  47423. referencedClasses: [],
  47424. //>>excludeEnd("ide");
  47425. messageSends: []
  47426. }),
  47427. globals.AISemanticAnalyzer);
  47428. smalltalk.addMethod(
  47429. smalltalk.method({
  47430. selector: "context:",
  47431. protocol: 'accessing',
  47432. fn: function (anAIContext){
  47433. var self=this;
  47434. self["@context"]=anAIContext;
  47435. return self;
  47436. },
  47437. //>>excludeStart("ide", pragmas.excludeIdeData);
  47438. args: ["anAIContext"],
  47439. source: "context: anAIContext\x0a\x09context := anAIContext",
  47440. referencedClasses: [],
  47441. //>>excludeEnd("ide");
  47442. messageSends: []
  47443. }),
  47444. globals.AISemanticAnalyzer);
  47445. smalltalk.addMethod(
  47446. smalltalk.method({
  47447. selector: "visitVariableNode:",
  47448. protocol: 'visiting',
  47449. fn: function (aNode){
  47450. var self=this;
  47451. function $ASTContextVar(){return globals.ASTContextVar||(typeof ASTContextVar=="undefined"?nil:ASTContextVar)}
  47452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47453. return smalltalk.withContext(function($ctx1) {
  47454. //>>excludeEnd("ctx");
  47455. var $1;
  47456. var $early={};
  47457. try {
  47458. _st(self._context())._localAt_ifAbsent_(_st(aNode)._value(),(function(){
  47459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47460. return smalltalk.withContext(function($ctx2) {
  47461. //>>excludeEnd("ctx");
  47462. $1=(
  47463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47464. $ctx2.supercall = true,
  47465. //>>excludeEnd("ctx");
  47466. globals.AISemanticAnalyzer.superclass.fn.prototype._visitVariableNode_.apply(_st(self), [aNode]));
  47467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47468. $ctx2.supercall = false;
  47469. //>>excludeEnd("ctx");;
  47470. throw $early=[$1];
  47471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47473. //>>excludeEnd("ctx");
  47474. }));
  47475. _st(aNode)._binding_(_st($ASTContextVar())._new());
  47476. return self;
  47477. }
  47478. catch(e) {if(e===$early)return e[0]; throw e}
  47479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47480. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.AISemanticAnalyzer)});
  47481. //>>excludeEnd("ctx");
  47482. },
  47483. //>>excludeStart("ide", pragmas.excludeIdeData);
  47484. args: ["aNode"],
  47485. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  47486. referencedClasses: ["ASTContextVar"],
  47487. //>>excludeEnd("ide");
  47488. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  47489. }),
  47490. globals.AISemanticAnalyzer);
  47491. smalltalk.addClass('ASTContextVar', globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  47492. //>>excludeStart("ide", pragmas.excludeIdeData);
  47493. globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  47494. //>>excludeEnd("ide");
  47495. smalltalk.addMethod(
  47496. smalltalk.method({
  47497. selector: "context",
  47498. protocol: 'accessing',
  47499. fn: function (){
  47500. var self=this;
  47501. var $1;
  47502. $1=self["@context"];
  47503. return $1;
  47504. },
  47505. //>>excludeStart("ide", pragmas.excludeIdeData);
  47506. args: [],
  47507. source: "context\x0a\x09^ context",
  47508. referencedClasses: [],
  47509. //>>excludeEnd("ide");
  47510. messageSends: []
  47511. }),
  47512. globals.ASTContextVar);
  47513. smalltalk.addMethod(
  47514. smalltalk.method({
  47515. selector: "context:",
  47516. protocol: 'accessing',
  47517. fn: function (anObject){
  47518. var self=this;
  47519. self["@context"]=anObject;
  47520. return self;
  47521. },
  47522. //>>excludeStart("ide", pragmas.excludeIdeData);
  47523. args: ["anObject"],
  47524. source: "context: anObject\x0a\x09context := anObject",
  47525. referencedClasses: [],
  47526. //>>excludeEnd("ide");
  47527. messageSends: []
  47528. }),
  47529. globals.ASTContextVar);
  47530. smalltalk.addClass('ASTDebugger', globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  47531. //>>excludeStart("ide", pragmas.excludeIdeData);
  47532. 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.";
  47533. //>>excludeEnd("ide");
  47534. smalltalk.addMethod(
  47535. smalltalk.method({
  47536. selector: "atEnd",
  47537. protocol: 'testing',
  47538. fn: function (){
  47539. var self=this;
  47540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47541. return smalltalk.withContext(function($ctx1) {
  47542. //>>excludeEnd("ctx");
  47543. var $1,$2,$receiver;
  47544. $1=self._context();
  47545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47546. $ctx1.sendIdx["context"]=1;
  47547. //>>excludeEnd("ctx");
  47548. if(($receiver = $1) == null || $receiver.isNil){
  47549. return true;
  47550. } else {
  47551. $1;
  47552. };
  47553. $2=_st(_st(self._interpreter())._atEnd())._and_((function(){
  47554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47555. return smalltalk.withContext(function($ctx2) {
  47556. //>>excludeEnd("ctx");
  47557. return _st(self._context())._isTopContext();
  47558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47560. //>>excludeEnd("ctx");
  47561. }));
  47562. return $2;
  47563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47564. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTDebugger)});
  47565. //>>excludeEnd("ctx");
  47566. },
  47567. //>>excludeStart("ide", pragmas.excludeIdeData);
  47568. args: [],
  47569. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  47570. referencedClasses: [],
  47571. //>>excludeEnd("ide");
  47572. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  47573. }),
  47574. globals.ASTDebugger);
  47575. smalltalk.addMethod(
  47576. smalltalk.method({
  47577. selector: "context",
  47578. protocol: 'accessing',
  47579. fn: function (){
  47580. var self=this;
  47581. var $1;
  47582. $1=self["@context"];
  47583. return $1;
  47584. },
  47585. //>>excludeStart("ide", pragmas.excludeIdeData);
  47586. args: [],
  47587. source: "context\x0a\x09^ context",
  47588. referencedClasses: [],
  47589. //>>excludeEnd("ide");
  47590. messageSends: []
  47591. }),
  47592. globals.ASTDebugger);
  47593. smalltalk.addMethod(
  47594. smalltalk.method({
  47595. selector: "context:",
  47596. protocol: 'accessing',
  47597. fn: function (aContext){
  47598. var self=this;
  47599. self["@context"]=aContext;
  47600. return self;
  47601. },
  47602. //>>excludeStart("ide", pragmas.excludeIdeData);
  47603. args: ["aContext"],
  47604. source: "context: aContext\x0a\x09context := aContext",
  47605. referencedClasses: [],
  47606. //>>excludeEnd("ide");
  47607. messageSends: []
  47608. }),
  47609. globals.ASTDebugger);
  47610. smalltalk.addMethod(
  47611. smalltalk.method({
  47612. selector: "flushInnerContexts",
  47613. protocol: 'actions',
  47614. fn: function (){
  47615. var self=this;
  47616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47617. return smalltalk.withContext(function($ctx1) {
  47618. //>>excludeEnd("ctx");
  47619. var $1,$receiver;
  47620. $1=self._context();
  47621. if(($receiver = $1) == null || $receiver.isNil){
  47622. $1;
  47623. } else {
  47624. var cxt;
  47625. cxt=$receiver;
  47626. _st(cxt)._innerContext_(nil);
  47627. };
  47628. return self;
  47629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47630. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},globals.ASTDebugger)});
  47631. //>>excludeEnd("ctx");
  47632. },
  47633. //>>excludeStart("ide", pragmas.excludeIdeData);
  47634. args: [],
  47635. 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 ]",
  47636. referencedClasses: [],
  47637. //>>excludeEnd("ide");
  47638. messageSends: ["ifNotNil:", "context", "innerContext:"]
  47639. }),
  47640. globals.ASTDebugger);
  47641. smalltalk.addMethod(
  47642. smalltalk.method({
  47643. selector: "interpreter",
  47644. protocol: 'accessing',
  47645. fn: function (){
  47646. var self=this;
  47647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47648. return smalltalk.withContext(function($ctx1) {
  47649. //>>excludeEnd("ctx");
  47650. var $2,$1,$receiver;
  47651. $2=self._context();
  47652. if(($receiver = $2) == null || $receiver.isNil){
  47653. $1=$2;
  47654. } else {
  47655. var ctx;
  47656. ctx=$receiver;
  47657. $1=_st(ctx)._interpreter();
  47658. };
  47659. return $1;
  47660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47661. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},globals.ASTDebugger)});
  47662. //>>excludeEnd("ctx");
  47663. },
  47664. //>>excludeStart("ide", pragmas.excludeIdeData);
  47665. args: [],
  47666. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  47667. referencedClasses: [],
  47668. //>>excludeEnd("ide");
  47669. messageSends: ["ifNotNil:", "context", "interpreter"]
  47670. }),
  47671. globals.ASTDebugger);
  47672. smalltalk.addMethod(
  47673. smalltalk.method({
  47674. selector: "method",
  47675. protocol: 'accessing',
  47676. fn: function (){
  47677. var self=this;
  47678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47679. return smalltalk.withContext(function($ctx1) {
  47680. //>>excludeEnd("ctx");
  47681. var $1;
  47682. $1=_st(self._context())._method();
  47683. return $1;
  47684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47685. }, function($ctx1) {$ctx1.fill(self,"method",{},globals.ASTDebugger)});
  47686. //>>excludeEnd("ctx");
  47687. },
  47688. //>>excludeStart("ide", pragmas.excludeIdeData);
  47689. args: [],
  47690. source: "method\x0a\x09^ self context method",
  47691. referencedClasses: [],
  47692. //>>excludeEnd("ide");
  47693. messageSends: ["method", "context"]
  47694. }),
  47695. globals.ASTDebugger);
  47696. smalltalk.addMethod(
  47697. smalltalk.method({
  47698. selector: "node",
  47699. protocol: 'accessing',
  47700. fn: function (){
  47701. var self=this;
  47702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47703. return smalltalk.withContext(function($ctx1) {
  47704. //>>excludeEnd("ctx");
  47705. var $2,$1,$receiver;
  47706. $2=self._interpreter();
  47707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47708. $ctx1.sendIdx["interpreter"]=1;
  47709. //>>excludeEnd("ctx");
  47710. if(($receiver = $2) == null || $receiver.isNil){
  47711. $1=$2;
  47712. } else {
  47713. $1=_st(self._interpreter())._node();
  47714. };
  47715. return $1;
  47716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47717. }, function($ctx1) {$ctx1.fill(self,"node",{},globals.ASTDebugger)});
  47718. //>>excludeEnd("ctx");
  47719. },
  47720. //>>excludeStart("ide", pragmas.excludeIdeData);
  47721. args: [],
  47722. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  47723. referencedClasses: [],
  47724. //>>excludeEnd("ide");
  47725. messageSends: ["ifNotNil:", "interpreter", "node"]
  47726. }),
  47727. globals.ASTDebugger);
  47728. smalltalk.addMethod(
  47729. smalltalk.method({
  47730. selector: "onStep",
  47731. protocol: 'private',
  47732. fn: function (){
  47733. var self=this;
  47734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47735. return smalltalk.withContext(function($ctx1) {
  47736. //>>excludeEnd("ctx");
  47737. var $1,$3,$2,$4,$6,$5,$receiver;
  47738. $1=self._interpreter();
  47739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47740. $ctx1.sendIdx["interpreter"]=1;
  47741. //>>excludeEnd("ctx");
  47742. self["@result"]=_st($1)._result();
  47743. $3=self._interpreter();
  47744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47745. $ctx1.sendIdx["interpreter"]=2;
  47746. //>>excludeEnd("ctx");
  47747. $2=_st($3)._atEnd();
  47748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47749. $ctx1.sendIdx["atEnd"]=1;
  47750. //>>excludeEnd("ctx");
  47751. if(smalltalk.assert($2)){
  47752. $4=_st(self._context())._outerContext();
  47753. if(($receiver = $4) == null || $receiver.isNil){
  47754. $4;
  47755. } else {
  47756. var outerContext;
  47757. outerContext=$receiver;
  47758. self._context_(outerContext);
  47759. };
  47760. $6=self._interpreter();
  47761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47762. $ctx1.sendIdx["interpreter"]=3;
  47763. //>>excludeEnd("ctx");
  47764. $5=_st($6)._atEnd();
  47765. if(! smalltalk.assert($5)){
  47766. _st(self._interpreter())._skip();
  47767. };
  47768. };
  47769. self._flushInnerContexts();
  47770. return self;
  47771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47772. }, function($ctx1) {$ctx1.fill(self,"onStep",{},globals.ASTDebugger)});
  47773. //>>excludeEnd("ctx");
  47774. },
  47775. //>>excludeStart("ide", pragmas.excludeIdeData);
  47776. args: [],
  47777. 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",
  47778. referencedClasses: [],
  47779. //>>excludeEnd("ide");
  47780. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  47781. }),
  47782. globals.ASTDebugger);
  47783. smalltalk.addMethod(
  47784. smalltalk.method({
  47785. selector: "proceed",
  47786. protocol: 'stepping',
  47787. fn: function (){
  47788. var self=this;
  47789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47790. return smalltalk.withContext(function($ctx1) {
  47791. //>>excludeEnd("ctx");
  47792. _st((function(){
  47793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47794. return smalltalk.withContext(function($ctx2) {
  47795. //>>excludeEnd("ctx");
  47796. return self._atEnd();
  47797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47799. //>>excludeEnd("ctx");
  47800. }))._whileFalse_((function(){
  47801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47802. return smalltalk.withContext(function($ctx2) {
  47803. //>>excludeEnd("ctx");
  47804. return self._stepOver();
  47805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47807. //>>excludeEnd("ctx");
  47808. }));
  47809. return self;
  47810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47811. }, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTDebugger)});
  47812. //>>excludeEnd("ctx");
  47813. },
  47814. //>>excludeStart("ide", pragmas.excludeIdeData);
  47815. args: [],
  47816. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  47817. referencedClasses: [],
  47818. //>>excludeEnd("ide");
  47819. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  47820. }),
  47821. globals.ASTDebugger);
  47822. smalltalk.addMethod(
  47823. smalltalk.method({
  47824. selector: "restart",
  47825. protocol: 'stepping',
  47826. fn: function (){
  47827. var self=this;
  47828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47829. return smalltalk.withContext(function($ctx1) {
  47830. //>>excludeEnd("ctx");
  47831. _st(self._interpreter())._restart();
  47832. self._flushInnerContexts();
  47833. return self;
  47834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47835. }, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTDebugger)});
  47836. //>>excludeEnd("ctx");
  47837. },
  47838. //>>excludeStart("ide", pragmas.excludeIdeData);
  47839. args: [],
  47840. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  47841. referencedClasses: [],
  47842. //>>excludeEnd("ide");
  47843. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  47844. }),
  47845. globals.ASTDebugger);
  47846. smalltalk.addMethod(
  47847. smalltalk.method({
  47848. selector: "result",
  47849. protocol: 'accessing',
  47850. fn: function (){
  47851. var self=this;
  47852. var $1;
  47853. $1=self["@result"];
  47854. return $1;
  47855. },
  47856. //>>excludeStart("ide", pragmas.excludeIdeData);
  47857. args: [],
  47858. source: "result\x0a\x09^ result",
  47859. referencedClasses: [],
  47860. //>>excludeEnd("ide");
  47861. messageSends: []
  47862. }),
  47863. globals.ASTDebugger);
  47864. smalltalk.addMethod(
  47865. smalltalk.method({
  47866. selector: "stepInto",
  47867. protocol: 'stepping',
  47868. fn: function (){
  47869. var self=this;
  47870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47871. return smalltalk.withContext(function($ctx1) {
  47872. //>>excludeEnd("ctx");
  47873. self._shouldBeImplemented();
  47874. return self;
  47875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47876. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},globals.ASTDebugger)});
  47877. //>>excludeEnd("ctx");
  47878. },
  47879. //>>excludeStart("ide", pragmas.excludeIdeData);
  47880. args: [],
  47881. source: "stepInto\x0a\x09self shouldBeImplemented",
  47882. referencedClasses: [],
  47883. //>>excludeEnd("ide");
  47884. messageSends: ["shouldBeImplemented"]
  47885. }),
  47886. globals.ASTDebugger);
  47887. smalltalk.addMethod(
  47888. smalltalk.method({
  47889. selector: "stepOver",
  47890. protocol: 'stepping',
  47891. fn: function (){
  47892. var self=this;
  47893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47894. return smalltalk.withContext(function($ctx1) {
  47895. //>>excludeEnd("ctx");
  47896. var $1,$2;
  47897. $1=_st(self._context())._isTopContext();
  47898. if(smalltalk.assert($1)){
  47899. _st(self._interpreter())._stepOver();
  47900. } else {
  47901. $2=self._interpreter();
  47902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47903. $ctx1.sendIdx["interpreter"]=1;
  47904. //>>excludeEnd("ctx");
  47905. _st($2)._skip();
  47906. };
  47907. self._onStep();
  47908. return self;
  47909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47910. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTDebugger)});
  47911. //>>excludeEnd("ctx");
  47912. },
  47913. //>>excludeStart("ide", pragmas.excludeIdeData);
  47914. args: [],
  47915. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  47916. referencedClasses: [],
  47917. //>>excludeEnd("ide");
  47918. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  47919. }),
  47920. globals.ASTDebugger);
  47921. smalltalk.addMethod(
  47922. smalltalk.method({
  47923. selector: "context:",
  47924. protocol: 'instance creation',
  47925. fn: function (aContext){
  47926. var self=this;
  47927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47928. return smalltalk.withContext(function($ctx1) {
  47929. //>>excludeEnd("ctx");
  47930. var $2,$3,$1;
  47931. $2=self._new();
  47932. _st($2)._context_(aContext);
  47933. $3=_st($2)._yourself();
  47934. $1=$3;
  47935. return $1;
  47936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47937. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},globals.ASTDebugger.klass)});
  47938. //>>excludeEnd("ctx");
  47939. },
  47940. //>>excludeStart("ide", pragmas.excludeIdeData);
  47941. args: ["aContext"],
  47942. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  47943. referencedClasses: [],
  47944. //>>excludeEnd("ide");
  47945. messageSends: ["context:", "new", "yourself"]
  47946. }),
  47947. globals.ASTDebugger.klass);
  47948. smalltalk.addClass('ASTInterpreter', globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  47949. //>>excludeStart("ide", pragmas.excludeIdeData);
  47950. 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";
  47951. //>>excludeEnd("ide");
  47952. smalltalk.addMethod(
  47953. smalltalk.method({
  47954. selector: "assign:to:",
  47955. protocol: 'private',
  47956. fn: function (aNode,anObject){
  47957. var self=this;
  47958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47959. return smalltalk.withContext(function($ctx1) {
  47960. //>>excludeEnd("ctx");
  47961. var $1,$3,$2,$4;
  47962. $1=_st(_st(aNode)._binding())._isInstanceVar();
  47963. if(smalltalk.assert($1)){
  47964. $3=self._context();
  47965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47966. $ctx1.sendIdx["context"]=1;
  47967. //>>excludeEnd("ctx");
  47968. $2=_st($3)._receiver();
  47969. $4=_st(aNode)._value();
  47970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47971. $ctx1.sendIdx["value"]=1;
  47972. //>>excludeEnd("ctx");
  47973. _st($2)._instVarAt_put_($4,anObject);
  47974. } else {
  47975. _st(self._context())._localAt_put_(_st(aNode)._value(),anObject);
  47976. };
  47977. return self;
  47978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47979. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},globals.ASTInterpreter)});
  47980. //>>excludeEnd("ctx");
  47981. },
  47982. //>>excludeStart("ide", pragmas.excludeIdeData);
  47983. args: ["aNode", "anObject"],
  47984. 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 ]",
  47985. referencedClasses: [],
  47986. //>>excludeEnd("ide");
  47987. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  47988. }),
  47989. globals.ASTInterpreter);
  47990. smalltalk.addMethod(
  47991. smalltalk.method({
  47992. selector: "atEnd",
  47993. protocol: 'testing',
  47994. fn: function (){
  47995. var self=this;
  47996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47997. return smalltalk.withContext(function($ctx1) {
  47998. //>>excludeEnd("ctx");
  47999. var $1,$2;
  48000. $1=self["@forceAtEnd"];
  48001. if(smalltalk.assert($1)){
  48002. return true;
  48003. };
  48004. $2=_st(self._hasReturned())._or_((function(){
  48005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48006. return smalltalk.withContext(function($ctx2) {
  48007. //>>excludeEnd("ctx");
  48008. return _st(self._node())._isNil();
  48009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48011. //>>excludeEnd("ctx");
  48012. }));
  48013. return $2;
  48014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48015. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.ASTInterpreter)});
  48016. //>>excludeEnd("ctx");
  48017. },
  48018. //>>excludeStart("ide", pragmas.excludeIdeData);
  48019. args: [],
  48020. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  48021. referencedClasses: [],
  48022. //>>excludeEnd("ide");
  48023. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  48024. }),
  48025. globals.ASTInterpreter);
  48026. smalltalk.addMethod(
  48027. smalltalk.method({
  48028. selector: "context",
  48029. protocol: 'accessing',
  48030. fn: function (){
  48031. var self=this;
  48032. var $1;
  48033. $1=self["@context"];
  48034. return $1;
  48035. },
  48036. //>>excludeStart("ide", pragmas.excludeIdeData);
  48037. args: [],
  48038. source: "context\x0a\x09^ context",
  48039. referencedClasses: [],
  48040. //>>excludeEnd("ide");
  48041. messageSends: []
  48042. }),
  48043. globals.ASTInterpreter);
  48044. smalltalk.addMethod(
  48045. smalltalk.method({
  48046. selector: "context:",
  48047. protocol: 'accessing',
  48048. fn: function (aContext){
  48049. var self=this;
  48050. self["@context"]=aContext;
  48051. return self;
  48052. },
  48053. //>>excludeStart("ide", pragmas.excludeIdeData);
  48054. args: ["aContext"],
  48055. source: "context: aContext\x0a\x09context := aContext",
  48056. referencedClasses: [],
  48057. //>>excludeEnd("ide");
  48058. messageSends: []
  48059. }),
  48060. globals.ASTInterpreter);
  48061. smalltalk.addMethod(
  48062. smalltalk.method({
  48063. selector: "eval:",
  48064. protocol: 'private',
  48065. fn: function (aString){
  48066. var self=this;
  48067. var source,function_;
  48068. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  48069. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  48070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48071. return smalltalk.withContext(function($ctx1) {
  48072. //>>excludeEnd("ctx");
  48073. var $3,$2,$1,$4,$5;
  48074. source=_st($String())._streamContents_((function(str){
  48075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48076. return smalltalk.withContext(function($ctx2) {
  48077. //>>excludeEnd("ctx");
  48078. _st(str)._nextPutAll_("(function(");
  48079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48080. $ctx2.sendIdx["nextPutAll:"]=1;
  48081. //>>excludeEnd("ctx");
  48082. $3=self._context();
  48083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48084. $ctx2.sendIdx["context"]=1;
  48085. //>>excludeEnd("ctx");
  48086. $2=_st($3)._locals();
  48087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48088. $ctx2.sendIdx["locals"]=1;
  48089. //>>excludeEnd("ctx");
  48090. $1=_st($2)._keys();
  48091. _st($1)._do_separatedBy_((function(each){
  48092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48093. return smalltalk.withContext(function($ctx3) {
  48094. //>>excludeEnd("ctx");
  48095. return _st(str)._nextPutAll_(each);
  48096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48097. $ctx3.sendIdx["nextPutAll:"]=2;
  48098. //>>excludeEnd("ctx");
  48099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48100. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  48101. //>>excludeEnd("ctx");
  48102. }),(function(){
  48103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48104. return smalltalk.withContext(function($ctx3) {
  48105. //>>excludeEnd("ctx");
  48106. return _st(str)._nextPutAll_(",");
  48107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48108. $ctx3.sendIdx["nextPutAll:"]=3;
  48109. //>>excludeEnd("ctx");
  48110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48111. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48112. //>>excludeEnd("ctx");
  48113. }));
  48114. _st(str)._nextPutAll_("){ return (function() {");
  48115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48116. $ctx2.sendIdx["nextPutAll:"]=4;
  48117. //>>excludeEnd("ctx");
  48118. _st(str)._nextPutAll_(aString);
  48119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48120. $ctx2.sendIdx["nextPutAll:"]=5;
  48121. //>>excludeEnd("ctx");
  48122. $4=_st(str)._nextPutAll_("})() })");
  48123. return $4;
  48124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48125. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  48126. //>>excludeEnd("ctx");
  48127. }));
  48128. function_=_st(_st($Compiler())._new())._eval_(source);
  48129. $5=_st(function_)._valueWithPossibleArguments_(_st(_st(self._context())._locals())._values());
  48130. return $5;
  48131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48132. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},globals.ASTInterpreter)});
  48133. //>>excludeEnd("ctx");
  48134. },
  48135. //>>excludeStart("ide", pragmas.excludeIdeData);
  48136. args: ["aString"],
  48137. 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",
  48138. referencedClasses: ["String", "Compiler"],
  48139. //>>excludeEnd("ide");
  48140. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  48141. }),
  48142. globals.ASTInterpreter);
  48143. smalltalk.addMethod(
  48144. smalltalk.method({
  48145. selector: "hasReturned",
  48146. protocol: 'testing',
  48147. fn: function (){
  48148. var self=this;
  48149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48150. return smalltalk.withContext(function($ctx1) {
  48151. //>>excludeEnd("ctx");
  48152. var $2,$1,$receiver;
  48153. $2=self["@returned"];
  48154. if(($receiver = $2) == null || $receiver.isNil){
  48155. $1=false;
  48156. } else {
  48157. $1=$2;
  48158. };
  48159. return $1;
  48160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48161. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},globals.ASTInterpreter)});
  48162. //>>excludeEnd("ctx");
  48163. },
  48164. //>>excludeStart("ide", pragmas.excludeIdeData);
  48165. args: [],
  48166. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  48167. referencedClasses: [],
  48168. //>>excludeEnd("ide");
  48169. messageSends: ["ifNil:"]
  48170. }),
  48171. globals.ASTInterpreter);
  48172. smalltalk.addMethod(
  48173. smalltalk.method({
  48174. selector: "initialize",
  48175. protocol: 'initialization',
  48176. fn: function (){
  48177. var self=this;
  48178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48179. return smalltalk.withContext(function($ctx1) {
  48180. //>>excludeEnd("ctx");
  48181. (
  48182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48183. $ctx1.supercall = true,
  48184. //>>excludeEnd("ctx");
  48185. globals.ASTInterpreter.superclass.fn.prototype._initialize.apply(_st(self), []));
  48186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48187. $ctx1.supercall = false;
  48188. //>>excludeEnd("ctx");;
  48189. self["@forceAtEnd"]=false;
  48190. return self;
  48191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48192. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.ASTInterpreter)});
  48193. //>>excludeEnd("ctx");
  48194. },
  48195. //>>excludeStart("ide", pragmas.excludeIdeData);
  48196. args: [],
  48197. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  48198. referencedClasses: [],
  48199. //>>excludeEnd("ide");
  48200. messageSends: ["initialize"]
  48201. }),
  48202. globals.ASTInterpreter);
  48203. smalltalk.addMethod(
  48204. smalltalk.method({
  48205. selector: "interpret",
  48206. protocol: 'interpreting',
  48207. fn: function (){
  48208. var self=this;
  48209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48210. return smalltalk.withContext(function($ctx1) {
  48211. //>>excludeEnd("ctx");
  48212. self._visit_(self._node());
  48213. return self;
  48214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48215. }, function($ctx1) {$ctx1.fill(self,"interpret",{},globals.ASTInterpreter)});
  48216. //>>excludeEnd("ctx");
  48217. },
  48218. //>>excludeStart("ide", pragmas.excludeIdeData);
  48219. args: [],
  48220. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  48221. referencedClasses: [],
  48222. //>>excludeEnd("ide");
  48223. messageSends: ["visit:", "node"]
  48224. }),
  48225. globals.ASTInterpreter);
  48226. smalltalk.addMethod(
  48227. smalltalk.method({
  48228. selector: "interpret:",
  48229. protocol: 'interpreting',
  48230. fn: function (aNode){
  48231. var self=this;
  48232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48233. return smalltalk.withContext(function($ctx1) {
  48234. //>>excludeEnd("ctx");
  48235. self._node_(aNode);
  48236. self._interpret();
  48237. return self;
  48238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48239. }, function($ctx1) {$ctx1.fill(self,"interpret:",{aNode:aNode},globals.ASTInterpreter)});
  48240. //>>excludeEnd("ctx");
  48241. },
  48242. //>>excludeStart("ide", pragmas.excludeIdeData);
  48243. args: ["aNode"],
  48244. source: "interpret: aNode\x0a\x09self node: aNode.\x0a\x09self interpret",
  48245. referencedClasses: [],
  48246. //>>excludeEnd("ide");
  48247. messageSends: ["node:", "interpret"]
  48248. }),
  48249. globals.ASTInterpreter);
  48250. smalltalk.addMethod(
  48251. smalltalk.method({
  48252. selector: "messageFromSendNode:arguments:",
  48253. protocol: 'private',
  48254. fn: function (aSendNode,aCollection){
  48255. var self=this;
  48256. function $Message(){return globals.Message||(typeof Message=="undefined"?nil:Message)}
  48257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48258. return smalltalk.withContext(function($ctx1) {
  48259. //>>excludeEnd("ctx");
  48260. var $2,$3,$1;
  48261. $2=_st($Message())._new();
  48262. _st($2)._selector_(_st(aSendNode)._selector());
  48263. _st($2)._arguments_(aCollection);
  48264. $3=_st($2)._yourself();
  48265. $1=$3;
  48266. return $1;
  48267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48268. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},globals.ASTInterpreter)});
  48269. //>>excludeEnd("ctx");
  48270. },
  48271. //>>excludeStart("ide", pragmas.excludeIdeData);
  48272. args: ["aSendNode", "aCollection"],
  48273. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  48274. referencedClasses: ["Message"],
  48275. //>>excludeEnd("ide");
  48276. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  48277. }),
  48278. globals.ASTInterpreter);
  48279. smalltalk.addMethod(
  48280. smalltalk.method({
  48281. selector: "messageNotUnderstood:receiver:",
  48282. protocol: 'private',
  48283. fn: function (aMessage,anObject){
  48284. var self=this;
  48285. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  48286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48287. return smalltalk.withContext(function($ctx1) {
  48288. //>>excludeEnd("ctx");
  48289. var $1,$2;
  48290. $1=_st($MessageNotUnderstood())._new();
  48291. _st($1)._meesage_(aMessage);
  48292. _st($1)._receiver_(anObject);
  48293. $2=_st($1)._signal();
  48294. return self;
  48295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48296. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},globals.ASTInterpreter)});
  48297. //>>excludeEnd("ctx");
  48298. },
  48299. //>>excludeStart("ide", pragmas.excludeIdeData);
  48300. args: ["aMessage", "anObject"],
  48301. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09meesage: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  48302. referencedClasses: ["MessageNotUnderstood"],
  48303. //>>excludeEnd("ide");
  48304. messageSends: ["meesage:", "new", "receiver:", "signal"]
  48305. }),
  48306. globals.ASTInterpreter);
  48307. smalltalk.addMethod(
  48308. smalltalk.method({
  48309. selector: "next",
  48310. protocol: 'interpreting',
  48311. fn: function (){
  48312. var self=this;
  48313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48314. return smalltalk.withContext(function($ctx1) {
  48315. //>>excludeEnd("ctx");
  48316. self._node_(_st(self._node())._nextNode());
  48317. return self;
  48318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48319. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.ASTInterpreter)});
  48320. //>>excludeEnd("ctx");
  48321. },
  48322. //>>excludeStart("ide", pragmas.excludeIdeData);
  48323. args: [],
  48324. source: "next\x0a\x09self node: self node nextNode",
  48325. referencedClasses: [],
  48326. //>>excludeEnd("ide");
  48327. messageSends: ["node:", "nextNode", "node"]
  48328. }),
  48329. globals.ASTInterpreter);
  48330. smalltalk.addMethod(
  48331. smalltalk.method({
  48332. selector: "node",
  48333. protocol: 'accessing',
  48334. fn: function (){
  48335. var self=this;
  48336. var $1;
  48337. $1=self["@node"];
  48338. return $1;
  48339. },
  48340. //>>excludeStart("ide", pragmas.excludeIdeData);
  48341. args: [],
  48342. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  48343. referencedClasses: [],
  48344. //>>excludeEnd("ide");
  48345. messageSends: []
  48346. }),
  48347. globals.ASTInterpreter);
  48348. smalltalk.addMethod(
  48349. smalltalk.method({
  48350. selector: "node:",
  48351. protocol: 'accessing',
  48352. fn: function (aNode){
  48353. var self=this;
  48354. self["@node"]=aNode;
  48355. return self;
  48356. },
  48357. //>>excludeStart("ide", pragmas.excludeIdeData);
  48358. args: ["aNode"],
  48359. source: "node: aNode\x0a\x09node := aNode",
  48360. referencedClasses: [],
  48361. //>>excludeEnd("ide");
  48362. messageSends: []
  48363. }),
  48364. globals.ASTInterpreter);
  48365. smalltalk.addMethod(
  48366. smalltalk.method({
  48367. selector: "peek",
  48368. protocol: 'stack',
  48369. fn: function (){
  48370. var self=this;
  48371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48372. return smalltalk.withContext(function($ctx1) {
  48373. //>>excludeEnd("ctx");
  48374. var $1,$2;
  48375. var $early={};
  48376. try {
  48377. $1=self._stack();
  48378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48379. $ctx1.sendIdx["stack"]=1;
  48380. //>>excludeEnd("ctx");
  48381. _st($1)._ifEmpty_((function(){
  48382. throw $early=[nil];
  48383. }));
  48384. $2=_st(self._stack())._last();
  48385. return $2;
  48386. }
  48387. catch(e) {if(e===$early)return e[0]; throw e}
  48388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48389. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.ASTInterpreter)});
  48390. //>>excludeEnd("ctx");
  48391. },
  48392. //>>excludeStart("ide", pragmas.excludeIdeData);
  48393. args: [],
  48394. 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",
  48395. referencedClasses: [],
  48396. //>>excludeEnd("ide");
  48397. messageSends: ["ifEmpty:", "stack", "last"]
  48398. }),
  48399. globals.ASTInterpreter);
  48400. smalltalk.addMethod(
  48401. smalltalk.method({
  48402. selector: "pop",
  48403. protocol: 'stack',
  48404. fn: function (){
  48405. var self=this;
  48406. var peekedValue;
  48407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48408. return smalltalk.withContext(function($ctx1) {
  48409. //>>excludeEnd("ctx");
  48410. var $1;
  48411. peekedValue=self._peek();
  48412. _st(self._stack())._removeLast();
  48413. $1=peekedValue;
  48414. return $1;
  48415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48416. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},globals.ASTInterpreter)});
  48417. //>>excludeEnd("ctx");
  48418. },
  48419. //>>excludeStart("ide", pragmas.excludeIdeData);
  48420. args: [],
  48421. 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",
  48422. referencedClasses: [],
  48423. //>>excludeEnd("ide");
  48424. messageSends: ["peek", "removeLast", "stack"]
  48425. }),
  48426. globals.ASTInterpreter);
  48427. smalltalk.addMethod(
  48428. smalltalk.method({
  48429. selector: "proceed",
  48430. protocol: 'interpreting',
  48431. fn: function (){
  48432. var self=this;
  48433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48434. return smalltalk.withContext(function($ctx1) {
  48435. //>>excludeEnd("ctx");
  48436. _st((function(){
  48437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48438. return smalltalk.withContext(function($ctx2) {
  48439. //>>excludeEnd("ctx");
  48440. return self._atEnd();
  48441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48443. //>>excludeEnd("ctx");
  48444. }))._whileFalse_((function(){
  48445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48446. return smalltalk.withContext(function($ctx2) {
  48447. //>>excludeEnd("ctx");
  48448. return self._step();
  48449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48451. //>>excludeEnd("ctx");
  48452. }));
  48453. return self;
  48454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48455. }, function($ctx1) {$ctx1.fill(self,"proceed",{},globals.ASTInterpreter)});
  48456. //>>excludeEnd("ctx");
  48457. },
  48458. //>>excludeStart("ide", pragmas.excludeIdeData);
  48459. args: [],
  48460. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  48461. referencedClasses: [],
  48462. //>>excludeEnd("ide");
  48463. messageSends: ["whileFalse:", "atEnd", "step"]
  48464. }),
  48465. globals.ASTInterpreter);
  48466. smalltalk.addMethod(
  48467. smalltalk.method({
  48468. selector: "push:",
  48469. protocol: 'stack',
  48470. fn: function (anObject){
  48471. var self=this;
  48472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48473. return smalltalk.withContext(function($ctx1) {
  48474. //>>excludeEnd("ctx");
  48475. var $1;
  48476. $1=_st(self._stack())._add_(anObject);
  48477. return $1;
  48478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48479. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},globals.ASTInterpreter)});
  48480. //>>excludeEnd("ctx");
  48481. },
  48482. //>>excludeStart("ide", pragmas.excludeIdeData);
  48483. args: ["anObject"],
  48484. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  48485. referencedClasses: [],
  48486. //>>excludeEnd("ide");
  48487. messageSends: ["add:", "stack"]
  48488. }),
  48489. globals.ASTInterpreter);
  48490. smalltalk.addMethod(
  48491. smalltalk.method({
  48492. selector: "restart",
  48493. protocol: 'interpreting',
  48494. fn: function (){
  48495. var self=this;
  48496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48497. return smalltalk.withContext(function($ctx1) {
  48498. //>>excludeEnd("ctx");
  48499. self._node_(_st(_st(self._context())._ast())._nextChild());
  48500. return self;
  48501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48502. }, function($ctx1) {$ctx1.fill(self,"restart",{},globals.ASTInterpreter)});
  48503. //>>excludeEnd("ctx");
  48504. },
  48505. //>>excludeStart("ide", pragmas.excludeIdeData);
  48506. args: [],
  48507. source: "restart\x0a\x09self node: self context ast nextChild",
  48508. referencedClasses: [],
  48509. //>>excludeEnd("ide");
  48510. messageSends: ["node:", "nextChild", "ast", "context"]
  48511. }),
  48512. globals.ASTInterpreter);
  48513. smalltalk.addMethod(
  48514. smalltalk.method({
  48515. selector: "result",
  48516. protocol: 'accessing',
  48517. fn: function (){
  48518. var self=this;
  48519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48520. return smalltalk.withContext(function($ctx1) {
  48521. //>>excludeEnd("ctx");
  48522. var $2,$1;
  48523. $2=self._hasReturned();
  48524. if(smalltalk.assert($2)){
  48525. $1=self._returnValue();
  48526. } else {
  48527. $1=_st(self._context())._receiver();
  48528. };
  48529. return $1;
  48530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48531. }, function($ctx1) {$ctx1.fill(self,"result",{},globals.ASTInterpreter)});
  48532. //>>excludeEnd("ctx");
  48533. },
  48534. //>>excludeStart("ide", pragmas.excludeIdeData);
  48535. args: [],
  48536. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  48537. referencedClasses: [],
  48538. //>>excludeEnd("ide");
  48539. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  48540. }),
  48541. globals.ASTInterpreter);
  48542. smalltalk.addMethod(
  48543. smalltalk.method({
  48544. selector: "returnValue",
  48545. protocol: 'accessing',
  48546. fn: function (){
  48547. var self=this;
  48548. var $1;
  48549. $1=self["@returnValue"];
  48550. return $1;
  48551. },
  48552. //>>excludeStart("ide", pragmas.excludeIdeData);
  48553. args: [],
  48554. source: "returnValue\x0a\x09^ returnValue",
  48555. referencedClasses: [],
  48556. //>>excludeEnd("ide");
  48557. messageSends: []
  48558. }),
  48559. globals.ASTInterpreter);
  48560. smalltalk.addMethod(
  48561. smalltalk.method({
  48562. selector: "returnValue:",
  48563. protocol: 'accessing',
  48564. fn: function (anObject){
  48565. var self=this;
  48566. self["@returnValue"]=anObject;
  48567. return self;
  48568. },
  48569. //>>excludeStart("ide", pragmas.excludeIdeData);
  48570. args: ["anObject"],
  48571. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  48572. referencedClasses: [],
  48573. //>>excludeEnd("ide");
  48574. messageSends: []
  48575. }),
  48576. globals.ASTInterpreter);
  48577. smalltalk.addMethod(
  48578. smalltalk.method({
  48579. selector: "sendMessage:to:superSend:",
  48580. protocol: 'private',
  48581. fn: function (aMessage,anObject,aBoolean){
  48582. var self=this;
  48583. var method;
  48584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48585. return smalltalk.withContext(function($ctx1) {
  48586. //>>excludeEnd("ctx");
  48587. var $1,$3,$2,$4,$5,$6,$receiver;
  48588. var $early={};
  48589. try {
  48590. if(! smalltalk.assert(aBoolean)){
  48591. $1=_st(aMessage)._sendTo_(anObject);
  48592. return $1;
  48593. };
  48594. $3=_st(anObject)._class();
  48595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48596. $ctx1.sendIdx["class"]=1;
  48597. //>>excludeEnd("ctx");
  48598. $2=_st($3)._superclass();
  48599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48600. $ctx1.sendIdx["superclass"]=1;
  48601. //>>excludeEnd("ctx");
  48602. if(($receiver = $2) == null || $receiver.isNil){
  48603. $4=self._messageNotUnderstood_receiver_(aMessage,anObject);
  48604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48605. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  48606. //>>excludeEnd("ctx");
  48607. return $4;
  48608. } else {
  48609. $2;
  48610. };
  48611. method=_st(_st(_st(_st(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_(_st(aMessage)._selector(),(function(){
  48612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48613. return smalltalk.withContext(function($ctx2) {
  48614. //>>excludeEnd("ctx");
  48615. $5=self._messageNotUnderstood_receiver_(aMessage,anObject);
  48616. throw $early=[$5];
  48617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48619. //>>excludeEnd("ctx");
  48620. }));
  48621. $6=_st(method)._sendTo_arguments_(anObject,_st(aMessage)._arguments());
  48622. return $6;
  48623. }
  48624. catch(e) {if(e===$early)return e[0]; throw e}
  48625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48626. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},globals.ASTInterpreter)});
  48627. //>>excludeEnd("ctx");
  48628. },
  48629. //>>excludeStart("ide", pragmas.excludeIdeData);
  48630. args: ["aMessage", "anObject", "aBoolean"],
  48631. 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",
  48632. referencedClasses: [],
  48633. //>>excludeEnd("ide");
  48634. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  48635. }),
  48636. globals.ASTInterpreter);
  48637. smalltalk.addMethod(
  48638. smalltalk.method({
  48639. selector: "setNonLocalReturnFromContext:",
  48640. protocol: 'interpreting',
  48641. fn: function (aContext){
  48642. var self=this;
  48643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48644. return smalltalk.withContext(function($ctx1) {
  48645. //>>excludeEnd("ctx");
  48646. var $2,$1;
  48647. $2=_st(aContext)._interpreter();
  48648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48649. $ctx1.sendIdx["interpreter"]=1;
  48650. //>>excludeEnd("ctx");
  48651. $1=_st($2)._hasReturned();
  48652. if(smalltalk.assert($1)){
  48653. self["@returned"]=true;
  48654. self["@returned"];
  48655. self._returnValue_(_st(_st(aContext)._interpreter())._returnValue());
  48656. };
  48657. return self;
  48658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48659. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},globals.ASTInterpreter)});
  48660. //>>excludeEnd("ctx");
  48661. },
  48662. //>>excludeStart("ide", pragmas.excludeIdeData);
  48663. args: ["aContext"],
  48664. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  48665. referencedClasses: [],
  48666. //>>excludeEnd("ide");
  48667. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  48668. }),
  48669. globals.ASTInterpreter);
  48670. smalltalk.addMethod(
  48671. smalltalk.method({
  48672. selector: "skip",
  48673. protocol: 'interpreting',
  48674. fn: function (){
  48675. var self=this;
  48676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48677. return smalltalk.withContext(function($ctx1) {
  48678. //>>excludeEnd("ctx");
  48679. self._next();
  48680. return self;
  48681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48682. }, function($ctx1) {$ctx1.fill(self,"skip",{},globals.ASTInterpreter)});
  48683. //>>excludeEnd("ctx");
  48684. },
  48685. //>>excludeStart("ide", pragmas.excludeIdeData);
  48686. args: [],
  48687. source: "skip\x0a\x09self next",
  48688. referencedClasses: [],
  48689. //>>excludeEnd("ide");
  48690. messageSends: ["next"]
  48691. }),
  48692. globals.ASTInterpreter);
  48693. smalltalk.addMethod(
  48694. smalltalk.method({
  48695. selector: "stack",
  48696. protocol: 'accessing',
  48697. fn: function (){
  48698. var self=this;
  48699. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  48700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48701. return smalltalk.withContext(function($ctx1) {
  48702. //>>excludeEnd("ctx");
  48703. var $2,$1,$receiver;
  48704. $2=self["@stack"];
  48705. if(($receiver = $2) == null || $receiver.isNil){
  48706. self["@stack"]=_st($OrderedCollection())._new();
  48707. $1=self["@stack"];
  48708. } else {
  48709. $1=$2;
  48710. };
  48711. return $1;
  48712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48713. }, function($ctx1) {$ctx1.fill(self,"stack",{},globals.ASTInterpreter)});
  48714. //>>excludeEnd("ctx");
  48715. },
  48716. //>>excludeStart("ide", pragmas.excludeIdeData);
  48717. args: [],
  48718. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  48719. referencedClasses: ["OrderedCollection"],
  48720. //>>excludeEnd("ide");
  48721. messageSends: ["ifNil:", "new"]
  48722. }),
  48723. globals.ASTInterpreter);
  48724. smalltalk.addMethod(
  48725. smalltalk.method({
  48726. selector: "step",
  48727. protocol: 'interpreting',
  48728. fn: function (){
  48729. var self=this;
  48730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48731. return smalltalk.withContext(function($ctx1) {
  48732. //>>excludeEnd("ctx");
  48733. var $1;
  48734. self._interpret();
  48735. $1=self._next();
  48736. return self;
  48737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48738. }, function($ctx1) {$ctx1.fill(self,"step",{},globals.ASTInterpreter)});
  48739. //>>excludeEnd("ctx");
  48740. },
  48741. //>>excludeStart("ide", pragmas.excludeIdeData);
  48742. args: [],
  48743. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  48744. referencedClasses: [],
  48745. //>>excludeEnd("ide");
  48746. messageSends: ["interpret", "next"]
  48747. }),
  48748. globals.ASTInterpreter);
  48749. smalltalk.addMethod(
  48750. smalltalk.method({
  48751. selector: "stepOver",
  48752. protocol: 'interpreting',
  48753. fn: function (){
  48754. var self=this;
  48755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48756. return smalltalk.withContext(function($ctx1) {
  48757. //>>excludeEnd("ctx");
  48758. var $2,$1;
  48759. self._step();
  48760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48761. $ctx1.sendIdx["step"]=1;
  48762. //>>excludeEnd("ctx");
  48763. _st((function(){
  48764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48765. return smalltalk.withContext(function($ctx2) {
  48766. //>>excludeEnd("ctx");
  48767. $2=self._node();
  48768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48769. $ctx2.sendIdx["node"]=1;
  48770. //>>excludeEnd("ctx");
  48771. $1=_st($2)._isNil();
  48772. return _st($1)._or_((function(){
  48773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48774. return smalltalk.withContext(function($ctx3) {
  48775. //>>excludeEnd("ctx");
  48776. return _st(self._node())._isSteppingNode();
  48777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48778. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48779. //>>excludeEnd("ctx");
  48780. }));
  48781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48783. //>>excludeEnd("ctx");
  48784. }))._whileFalse_((function(){
  48785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48786. return smalltalk.withContext(function($ctx2) {
  48787. //>>excludeEnd("ctx");
  48788. return self._step();
  48789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48791. //>>excludeEnd("ctx");
  48792. }));
  48793. return self;
  48794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48795. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},globals.ASTInterpreter)});
  48796. //>>excludeEnd("ctx");
  48797. },
  48798. //>>excludeStart("ide", pragmas.excludeIdeData);
  48799. args: [],
  48800. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  48801. referencedClasses: [],
  48802. //>>excludeEnd("ide");
  48803. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  48804. }),
  48805. globals.ASTInterpreter);
  48806. smalltalk.addMethod(
  48807. smalltalk.method({
  48808. selector: "visit:",
  48809. protocol: 'visiting',
  48810. fn: function (aNode){
  48811. var self=this;
  48812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48813. return smalltalk.withContext(function($ctx1) {
  48814. //>>excludeEnd("ctx");
  48815. var $1;
  48816. $1=self._hasReturned();
  48817. if(! smalltalk.assert($1)){
  48818. (
  48819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48820. $ctx1.supercall = true,
  48821. //>>excludeEnd("ctx");
  48822. globals.ASTInterpreter.superclass.fn.prototype._visit_.apply(_st(self), [aNode]));
  48823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48824. $ctx1.supercall = false;
  48825. //>>excludeEnd("ctx");;
  48826. };
  48827. return self;
  48828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48829. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},globals.ASTInterpreter)});
  48830. //>>excludeEnd("ctx");
  48831. },
  48832. //>>excludeStart("ide", pragmas.excludeIdeData);
  48833. args: ["aNode"],
  48834. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  48835. referencedClasses: [],
  48836. //>>excludeEnd("ide");
  48837. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  48838. }),
  48839. globals.ASTInterpreter);
  48840. smalltalk.addMethod(
  48841. smalltalk.method({
  48842. selector: "visitAssignmentNode:",
  48843. protocol: 'visiting',
  48844. fn: function (aNode){
  48845. var self=this;
  48846. var poppedValue;
  48847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48848. return smalltalk.withContext(function($ctx1) {
  48849. //>>excludeEnd("ctx");
  48850. poppedValue=self._pop();
  48851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48852. $ctx1.sendIdx["pop"]=1;
  48853. //>>excludeEnd("ctx");
  48854. self._pop();
  48855. self._push_(poppedValue);
  48856. self._assign_to_(_st(aNode)._left(),poppedValue);
  48857. return self;
  48858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48859. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},globals.ASTInterpreter)});
  48860. //>>excludeEnd("ctx");
  48861. },
  48862. //>>excludeStart("ide", pragmas.excludeIdeData);
  48863. args: ["aNode"],
  48864. 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",
  48865. referencedClasses: [],
  48866. //>>excludeEnd("ide");
  48867. messageSends: ["pop", "push:", "assign:to:", "left"]
  48868. }),
  48869. globals.ASTInterpreter);
  48870. smalltalk.addMethod(
  48871. smalltalk.method({
  48872. selector: "visitBlockNode:",
  48873. protocol: 'visiting',
  48874. fn: function (aNode){
  48875. var self=this;
  48876. var block;
  48877. function $AIBlockClosure(){return globals.AIBlockClosure||(typeof AIBlockClosure=="undefined"?nil:AIBlockClosure)}
  48878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48879. return smalltalk.withContext(function($ctx1) {
  48880. //>>excludeEnd("ctx");
  48881. block=_st($AIBlockClosure())._forContext_node_(self._context(),aNode);
  48882. self._push_(block);
  48883. return self;
  48884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48885. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},globals.ASTInterpreter)});
  48886. //>>excludeEnd("ctx");
  48887. },
  48888. //>>excludeStart("ide", pragmas.excludeIdeData);
  48889. args: ["aNode"],
  48890. 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",
  48891. referencedClasses: ["AIBlockClosure"],
  48892. //>>excludeEnd("ide");
  48893. messageSends: ["forContext:node:", "context", "push:"]
  48894. }),
  48895. globals.ASTInterpreter);
  48896. smalltalk.addMethod(
  48897. smalltalk.method({
  48898. selector: "visitBlockSequenceNode:",
  48899. protocol: 'visiting',
  48900. fn: function (aNode){
  48901. var self=this;
  48902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48903. return smalltalk.withContext(function($ctx1) {
  48904. //>>excludeEnd("ctx");
  48905. (
  48906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48907. $ctx1.supercall = true,
  48908. //>>excludeEnd("ctx");
  48909. globals.ASTInterpreter.superclass.fn.prototype._visitBlockSequenceNode_.apply(_st(self), [aNode]));
  48910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48911. $ctx1.supercall = false;
  48912. //>>excludeEnd("ctx");;
  48913. self["@forceAtEnd"]=true;
  48914. return self;
  48915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48916. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},globals.ASTInterpreter)});
  48917. //>>excludeEnd("ctx");
  48918. },
  48919. //>>excludeStart("ide", pragmas.excludeIdeData);
  48920. args: ["aNode"],
  48921. 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",
  48922. referencedClasses: [],
  48923. //>>excludeEnd("ide");
  48924. messageSends: ["visitBlockSequenceNode:"]
  48925. }),
  48926. globals.ASTInterpreter);
  48927. smalltalk.addMethod(
  48928. smalltalk.method({
  48929. selector: "visitDynamicArrayNode:",
  48930. protocol: 'visiting',
  48931. fn: function (aNode){
  48932. var self=this;
  48933. var array;
  48934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48935. return smalltalk.withContext(function($ctx1) {
  48936. //>>excludeEnd("ctx");
  48937. array=[];
  48938. _st(_st(aNode)._nodes())._do_((function(each){
  48939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48940. return smalltalk.withContext(function($ctx2) {
  48941. //>>excludeEnd("ctx");
  48942. return _st(array)._addFirst_(self._pop());
  48943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48945. //>>excludeEnd("ctx");
  48946. }));
  48947. self._push_(array);
  48948. return self;
  48949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48950. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},globals.ASTInterpreter)});
  48951. //>>excludeEnd("ctx");
  48952. },
  48953. //>>excludeStart("ide", pragmas.excludeIdeData);
  48954. args: ["aNode"],
  48955. 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",
  48956. referencedClasses: [],
  48957. //>>excludeEnd("ide");
  48958. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  48959. }),
  48960. globals.ASTInterpreter);
  48961. smalltalk.addMethod(
  48962. smalltalk.method({
  48963. selector: "visitDynamicDictionaryNode:",
  48964. protocol: 'visiting',
  48965. fn: function (aNode){
  48966. var self=this;
  48967. var keyValueList;
  48968. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  48969. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  48970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48971. return smalltalk.withContext(function($ctx1) {
  48972. //>>excludeEnd("ctx");
  48973. keyValueList=_st($OrderedCollection())._new();
  48974. _st(_st(aNode)._nodes())._do_((function(each){
  48975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48976. return smalltalk.withContext(function($ctx2) {
  48977. //>>excludeEnd("ctx");
  48978. return _st(keyValueList)._add_(self._pop());
  48979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48981. //>>excludeEnd("ctx");
  48982. }));
  48983. self._push_(_st($HashedCollection())._newFromPairs_(_st(keyValueList)._reversed()));
  48984. return self;
  48985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48986. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},globals.ASTInterpreter)});
  48987. //>>excludeEnd("ctx");
  48988. },
  48989. //>>excludeStart("ide", pragmas.excludeIdeData);
  48990. args: ["aNode"],
  48991. 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)",
  48992. referencedClasses: ["OrderedCollection", "HashedCollection"],
  48993. //>>excludeEnd("ide");
  48994. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  48995. }),
  48996. globals.ASTInterpreter);
  48997. smalltalk.addMethod(
  48998. smalltalk.method({
  48999. selector: "visitJSStatementNode:",
  49000. protocol: 'visiting',
  49001. fn: function (aNode){
  49002. var self=this;
  49003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49004. return smalltalk.withContext(function($ctx1) {
  49005. //>>excludeEnd("ctx");
  49006. self["@returned"]=true;
  49007. self._returnValue_(self._eval_(_st(aNode)._source()));
  49008. return self;
  49009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49010. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},globals.ASTInterpreter)});
  49011. //>>excludeEnd("ctx");
  49012. },
  49013. //>>excludeStart("ide", pragmas.excludeIdeData);
  49014. args: ["aNode"],
  49015. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  49016. referencedClasses: [],
  49017. //>>excludeEnd("ide");
  49018. messageSends: ["returnValue:", "eval:", "source"]
  49019. }),
  49020. globals.ASTInterpreter);
  49021. smalltalk.addMethod(
  49022. smalltalk.method({
  49023. selector: "visitNode:",
  49024. protocol: 'visiting',
  49025. fn: function (aNode){
  49026. var self=this;
  49027. return self;
  49028. },
  49029. //>>excludeStart("ide", pragmas.excludeIdeData);
  49030. args: ["aNode"],
  49031. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  49032. referencedClasses: [],
  49033. //>>excludeEnd("ide");
  49034. messageSends: []
  49035. }),
  49036. globals.ASTInterpreter);
  49037. smalltalk.addMethod(
  49038. smalltalk.method({
  49039. selector: "visitReturnNode:",
  49040. protocol: 'visiting',
  49041. fn: function (aNode){
  49042. var self=this;
  49043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49044. return smalltalk.withContext(function($ctx1) {
  49045. //>>excludeEnd("ctx");
  49046. self["@returned"]=true;
  49047. self._returnValue_(self._pop());
  49048. return self;
  49049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49050. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},globals.ASTInterpreter)});
  49051. //>>excludeEnd("ctx");
  49052. },
  49053. //>>excludeStart("ide", pragmas.excludeIdeData);
  49054. args: ["aNode"],
  49055. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  49056. referencedClasses: [],
  49057. //>>excludeEnd("ide");
  49058. messageSends: ["returnValue:", "pop"]
  49059. }),
  49060. globals.ASTInterpreter);
  49061. smalltalk.addMethod(
  49062. smalltalk.method({
  49063. selector: "visitSendNode:",
  49064. protocol: 'visiting',
  49065. fn: function (aNode){
  49066. var self=this;
  49067. var receiver,args,message,result;
  49068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49069. return smalltalk.withContext(function($ctx1) {
  49070. //>>excludeEnd("ctx");
  49071. var $1;
  49072. args=_st(_st(aNode)._arguments())._collect_((function(each){
  49073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49074. return smalltalk.withContext(function($ctx2) {
  49075. //>>excludeEnd("ctx");
  49076. return self._pop();
  49077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49078. $ctx2.sendIdx["pop"]=1;
  49079. //>>excludeEnd("ctx");
  49080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49081. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49082. //>>excludeEnd("ctx");
  49083. }));
  49084. receiver=self._pop();
  49085. message=self._messageFromSendNode_arguments_(aNode,_st(args)._reversed());
  49086. result=self._sendMessage_to_superSend_(message,receiver,_st(aNode)._superSend());
  49087. $1=_st(_st(aNode)._isCascadeSendNode())._and_((function(){
  49088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49089. return smalltalk.withContext(function($ctx2) {
  49090. //>>excludeEnd("ctx");
  49091. return _st(_st(aNode)._isLastChild())._not();
  49092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49094. //>>excludeEnd("ctx");
  49095. }));
  49096. if(smalltalk.assert($1)){
  49097. self._push_(receiver);
  49098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49099. $ctx1.sendIdx["push:"]=1;
  49100. //>>excludeEnd("ctx");
  49101. } else {
  49102. self._push_(result);
  49103. };
  49104. return self;
  49105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49106. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},globals.ASTInterpreter)});
  49107. //>>excludeEnd("ctx");
  49108. },
  49109. //>>excludeStart("ide", pragmas.excludeIdeData);
  49110. args: ["aNode"],
  49111. 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 ]",
  49112. referencedClasses: [],
  49113. //>>excludeEnd("ide");
  49114. messageSends: ["collect:", "arguments", "pop", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifTrue:ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  49115. }),
  49116. globals.ASTInterpreter);
  49117. smalltalk.addMethod(
  49118. smalltalk.method({
  49119. selector: "visitSequenceNode:",
  49120. protocol: 'visiting',
  49121. fn: function (aNode){
  49122. var self=this;
  49123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49124. return smalltalk.withContext(function($ctx1) {
  49125. //>>excludeEnd("ctx");
  49126. _st(_st(aNode)._temps())._do_((function(each){
  49127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49128. return smalltalk.withContext(function($ctx2) {
  49129. //>>excludeEnd("ctx");
  49130. return _st(self._context())._defineLocal_(each);
  49131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49133. //>>excludeEnd("ctx");
  49134. }));
  49135. return self;
  49136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49137. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},globals.ASTInterpreter)});
  49138. //>>excludeEnd("ctx");
  49139. },
  49140. //>>excludeStart("ide", pragmas.excludeIdeData);
  49141. args: ["aNode"],
  49142. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self context defineLocal: each ]",
  49143. referencedClasses: [],
  49144. //>>excludeEnd("ide");
  49145. messageSends: ["do:", "temps", "defineLocal:", "context"]
  49146. }),
  49147. globals.ASTInterpreter);
  49148. smalltalk.addMethod(
  49149. smalltalk.method({
  49150. selector: "visitValueNode:",
  49151. protocol: 'visiting',
  49152. fn: function (aNode){
  49153. var self=this;
  49154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49155. return smalltalk.withContext(function($ctx1) {
  49156. //>>excludeEnd("ctx");
  49157. self._push_(_st(aNode)._value());
  49158. return self;
  49159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49160. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},globals.ASTInterpreter)});
  49161. //>>excludeEnd("ctx");
  49162. },
  49163. //>>excludeStart("ide", pragmas.excludeIdeData);
  49164. args: ["aNode"],
  49165. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  49166. referencedClasses: [],
  49167. //>>excludeEnd("ide");
  49168. messageSends: ["push:", "value"]
  49169. }),
  49170. globals.ASTInterpreter);
  49171. smalltalk.addMethod(
  49172. smalltalk.method({
  49173. selector: "visitVariableNode:",
  49174. protocol: 'visiting',
  49175. fn: function (aNode){
  49176. var self=this;
  49177. function $PlatformInterface(){return globals.PlatformInterface||(typeof PlatformInterface=="undefined"?nil:PlatformInterface)}
  49178. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  49179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49180. return smalltalk.withContext(function($ctx1) {
  49181. //>>excludeEnd("ctx");
  49182. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  49183. $2=_st(aNode)._binding();
  49184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49185. $ctx1.sendIdx["binding"]=1;
  49186. //>>excludeEnd("ctx");
  49187. $1=_st($2)._isUnknownVar();
  49188. if(smalltalk.assert($1)){
  49189. $5=_st($PlatformInterface())._globals();
  49190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49191. $ctx1.sendIdx["globals"]=1;
  49192. //>>excludeEnd("ctx");
  49193. $6=_st(aNode)._value();
  49194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49195. $ctx1.sendIdx["value"]=1;
  49196. //>>excludeEnd("ctx");
  49197. $4=_st($5)._at_ifAbsent_($6,(function(){
  49198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49199. return smalltalk.withContext(function($ctx2) {
  49200. //>>excludeEnd("ctx");
  49201. return self._error_("Unknown variable");
  49202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49204. //>>excludeEnd("ctx");
  49205. }));
  49206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49207. $ctx1.sendIdx["at:ifAbsent:"]=1;
  49208. //>>excludeEnd("ctx");
  49209. $3=self._push_($4);
  49210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49211. $ctx1.sendIdx["push:"]=1;
  49212. //>>excludeEnd("ctx");
  49213. return $3;
  49214. };
  49215. $8=_st(_st(aNode)._binding())._isInstanceVar();
  49216. if(smalltalk.assert($8)){
  49217. $10=self._context();
  49218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49219. $ctx1.sendIdx["context"]=1;
  49220. //>>excludeEnd("ctx");
  49221. $9=_st($10)._receiver();
  49222. $11=_st(aNode)._value();
  49223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49224. $ctx1.sendIdx["value"]=2;
  49225. //>>excludeEnd("ctx");
  49226. $7=_st($9)._instVarAt_($11);
  49227. } else {
  49228. $12=self._context();
  49229. $13=_st(aNode)._value();
  49230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49231. $ctx1.sendIdx["value"]=3;
  49232. //>>excludeEnd("ctx");
  49233. $7=_st($12)._localAt_ifAbsent_($13,(function(){
  49234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49235. return smalltalk.withContext(function($ctx2) {
  49236. //>>excludeEnd("ctx");
  49237. $15=_st(aNode)._value();
  49238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49239. $ctx2.sendIdx["value"]=4;
  49240. //>>excludeEnd("ctx");
  49241. $14=_st($15)._isCapitalized();
  49242. if(smalltalk.assert($14)){
  49243. $16=_st($Smalltalk())._globals();
  49244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49245. $ctx2.sendIdx["globals"]=2;
  49246. //>>excludeEnd("ctx");
  49247. $17=_st(aNode)._value();
  49248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49249. $ctx2.sendIdx["value"]=5;
  49250. //>>excludeEnd("ctx");
  49251. return _st($16)._at_ifAbsent_($17,(function(){
  49252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49253. return smalltalk.withContext(function($ctx3) {
  49254. //>>excludeEnd("ctx");
  49255. return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
  49256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49257. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  49258. //>>excludeEnd("ctx");
  49259. }));
  49260. };
  49261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  49263. //>>excludeEnd("ctx");
  49264. }));
  49265. };
  49266. self._push_($7);
  49267. return self;
  49268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49269. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},globals.ASTInterpreter)});
  49270. //>>excludeEnd("ctx");
  49271. },
  49272. //>>excludeStart("ide", pragmas.excludeIdeData);
  49273. args: ["aNode"],
  49274. 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 ] ] ] ])",
  49275. referencedClasses: ["PlatformInterface", "Smalltalk"],
  49276. //>>excludeEnd("ide");
  49277. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  49278. }),
  49279. globals.ASTInterpreter);
  49280. smalltalk.addClass('ASTInterpreterError', globals.Error, [], 'Compiler-Interpreter');
  49281. //>>excludeStart("ide", pragmas.excludeIdeData);
  49282. globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  49283. //>>excludeEnd("ide");
  49284. smalltalk.addClass('ASTPCNodeVisitor', globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  49285. //>>excludeStart("ide", pragmas.excludeIdeData);
  49286. 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`";
  49287. //>>excludeEnd("ide");
  49288. smalltalk.addMethod(
  49289. smalltalk.method({
  49290. selector: "context",
  49291. protocol: 'accessing',
  49292. fn: function (){
  49293. var self=this;
  49294. var $1;
  49295. $1=self["@context"];
  49296. return $1;
  49297. },
  49298. //>>excludeStart("ide", pragmas.excludeIdeData);
  49299. args: [],
  49300. source: "context\x0a\x09^ context",
  49301. referencedClasses: [],
  49302. //>>excludeEnd("ide");
  49303. messageSends: []
  49304. }),
  49305. globals.ASTPCNodeVisitor);
  49306. smalltalk.addMethod(
  49307. smalltalk.method({
  49308. selector: "context:",
  49309. protocol: 'accessing',
  49310. fn: function (aContext){
  49311. var self=this;
  49312. self["@context"]=aContext;
  49313. return self;
  49314. },
  49315. //>>excludeStart("ide", pragmas.excludeIdeData);
  49316. args: ["aContext"],
  49317. source: "context: aContext\x0a\x09context := aContext",
  49318. referencedClasses: [],
  49319. //>>excludeEnd("ide");
  49320. messageSends: []
  49321. }),
  49322. globals.ASTPCNodeVisitor);
  49323. smalltalk.addMethod(
  49324. smalltalk.method({
  49325. selector: "currentNode",
  49326. protocol: 'accessing',
  49327. fn: function (){
  49328. var self=this;
  49329. var $1;
  49330. $1=self["@currentNode"];
  49331. return $1;
  49332. },
  49333. //>>excludeStart("ide", pragmas.excludeIdeData);
  49334. args: [],
  49335. source: "currentNode\x0a\x09^ currentNode",
  49336. referencedClasses: [],
  49337. //>>excludeEnd("ide");
  49338. messageSends: []
  49339. }),
  49340. globals.ASTPCNodeVisitor);
  49341. smalltalk.addMethod(
  49342. smalltalk.method({
  49343. selector: "increaseIndex",
  49344. protocol: 'accessing',
  49345. fn: function (){
  49346. var self=this;
  49347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49348. return smalltalk.withContext(function($ctx1) {
  49349. //>>excludeEnd("ctx");
  49350. self["@index"]=_st(self._index()).__plus((1));
  49351. return self;
  49352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49353. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},globals.ASTPCNodeVisitor)});
  49354. //>>excludeEnd("ctx");
  49355. },
  49356. //>>excludeStart("ide", pragmas.excludeIdeData);
  49357. args: [],
  49358. source: "increaseIndex\x0a\x09index := self index + 1",
  49359. referencedClasses: [],
  49360. //>>excludeEnd("ide");
  49361. messageSends: ["+", "index"]
  49362. }),
  49363. globals.ASTPCNodeVisitor);
  49364. smalltalk.addMethod(
  49365. smalltalk.method({
  49366. selector: "index",
  49367. protocol: 'accessing',
  49368. fn: function (){
  49369. var self=this;
  49370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49371. return smalltalk.withContext(function($ctx1) {
  49372. //>>excludeEnd("ctx");
  49373. var $2,$1,$receiver;
  49374. $2=self["@index"];
  49375. if(($receiver = $2) == null || $receiver.isNil){
  49376. self["@index"]=(0);
  49377. $1=self["@index"];
  49378. } else {
  49379. $1=$2;
  49380. };
  49381. return $1;
  49382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49383. }, function($ctx1) {$ctx1.fill(self,"index",{},globals.ASTPCNodeVisitor)});
  49384. //>>excludeEnd("ctx");
  49385. },
  49386. //>>excludeStart("ide", pragmas.excludeIdeData);
  49387. args: [],
  49388. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  49389. referencedClasses: [],
  49390. //>>excludeEnd("ide");
  49391. messageSends: ["ifNil:"]
  49392. }),
  49393. globals.ASTPCNodeVisitor);
  49394. smalltalk.addMethod(
  49395. smalltalk.method({
  49396. selector: "selector",
  49397. protocol: 'accessing',
  49398. fn: function (){
  49399. var self=this;
  49400. var $1;
  49401. $1=self["@selector"];
  49402. return $1;
  49403. },
  49404. //>>excludeStart("ide", pragmas.excludeIdeData);
  49405. args: [],
  49406. source: "selector\x0a\x09^ selector",
  49407. referencedClasses: [],
  49408. //>>excludeEnd("ide");
  49409. messageSends: []
  49410. }),
  49411. globals.ASTPCNodeVisitor);
  49412. smalltalk.addMethod(
  49413. smalltalk.method({
  49414. selector: "selector:",
  49415. protocol: 'accessing',
  49416. fn: function (aString){
  49417. var self=this;
  49418. self["@selector"]=aString;
  49419. return self;
  49420. },
  49421. //>>excludeStart("ide", pragmas.excludeIdeData);
  49422. args: ["aString"],
  49423. source: "selector: aString\x0a\x09selector := aString",
  49424. referencedClasses: [],
  49425. //>>excludeEnd("ide");
  49426. messageSends: []
  49427. }),
  49428. globals.ASTPCNodeVisitor);
  49429. smalltalk.addMethod(
  49430. smalltalk.method({
  49431. selector: "visitJSStatementNode:",
  49432. protocol: 'visiting',
  49433. fn: function (aNode){
  49434. var self=this;
  49435. self["@currentNode"]=aNode;
  49436. return self;
  49437. },
  49438. //>>excludeStart("ide", pragmas.excludeIdeData);
  49439. args: ["aNode"],
  49440. 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",
  49441. referencedClasses: [],
  49442. //>>excludeEnd("ide");
  49443. messageSends: []
  49444. }),
  49445. globals.ASTPCNodeVisitor);
  49446. smalltalk.addMethod(
  49447. smalltalk.method({
  49448. selector: "visitSendNode:",
  49449. protocol: 'visiting',
  49450. fn: function (aNode){
  49451. var self=this;
  49452. var sendIndex;
  49453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49454. return smalltalk.withContext(function($ctx1) {
  49455. //>>excludeEnd("ctx");
  49456. var $1,$2,$4,$3,$5;
  49457. $1=self._context();
  49458. $2=self._selector();
  49459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49460. $ctx1.sendIdx["selector"]=1;
  49461. //>>excludeEnd("ctx");
  49462. sendIndex=_st($1)._sendIndexAt_($2);
  49463. (
  49464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49465. $ctx1.supercall = true,
  49466. //>>excludeEnd("ctx");
  49467. globals.ASTPCNodeVisitor.superclass.fn.prototype._visitSendNode_.apply(_st(self), [aNode]));
  49468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49469. $ctx1.supercall = false;
  49470. //>>excludeEnd("ctx");;
  49471. $4=self._selector();
  49472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49473. $ctx1.sendIdx["selector"]=2;
  49474. //>>excludeEnd("ctx");
  49475. $3=_st($4).__eq(_st(aNode)._selector());
  49476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49477. $ctx1.sendIdx["="]=1;
  49478. //>>excludeEnd("ctx");
  49479. if(smalltalk.assert($3)){
  49480. $5=_st(self._index()).__eq(sendIndex);
  49481. if(smalltalk.assert($5)){
  49482. self["@currentNode"]=aNode;
  49483. self["@currentNode"];
  49484. };
  49485. self._increaseIndex();
  49486. };
  49487. return self;
  49488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49489. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},globals.ASTPCNodeVisitor)});
  49490. //>>excludeEnd("ctx");
  49491. },
  49492. //>>excludeStart("ide", pragmas.excludeIdeData);
  49493. args: ["aNode"],
  49494. 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 ]",
  49495. referencedClasses: [],
  49496. //>>excludeEnd("ide");
  49497. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  49498. }),
  49499. globals.ASTPCNodeVisitor);
  49500. smalltalk.addMethod(
  49501. smalltalk.method({
  49502. selector: "isSteppingNode",
  49503. protocol: '*Compiler-Interpreter',
  49504. fn: function (){
  49505. var self=this;
  49506. return true;
  49507. },
  49508. //>>excludeStart("ide", pragmas.excludeIdeData);
  49509. args: [],
  49510. source: "isSteppingNode\x0a\x09^ true",
  49511. referencedClasses: [],
  49512. //>>excludeEnd("ide");
  49513. messageSends: []
  49514. }),
  49515. globals.AssignmentNode);
  49516. smalltalk.addMethod(
  49517. smalltalk.method({
  49518. selector: "isSteppingNode",
  49519. protocol: '*Compiler-Interpreter',
  49520. fn: function (){
  49521. var self=this;
  49522. return true;
  49523. },
  49524. //>>excludeStart("ide", pragmas.excludeIdeData);
  49525. args: [],
  49526. source: "isSteppingNode\x0a\x09^ true",
  49527. referencedClasses: [],
  49528. //>>excludeEnd("ide");
  49529. messageSends: []
  49530. }),
  49531. globals.BlockNode);
  49532. smalltalk.addMethod(
  49533. smalltalk.method({
  49534. selector: "isSteppingNode",
  49535. protocol: '*Compiler-Interpreter',
  49536. fn: function (){
  49537. var self=this;
  49538. return true;
  49539. },
  49540. //>>excludeStart("ide", pragmas.excludeIdeData);
  49541. args: [],
  49542. source: "isSteppingNode\x0a\x09^ true",
  49543. referencedClasses: [],
  49544. //>>excludeEnd("ide");
  49545. messageSends: []
  49546. }),
  49547. globals.DynamicArrayNode);
  49548. smalltalk.addMethod(
  49549. smalltalk.method({
  49550. selector: "isSteppingNode",
  49551. protocol: '*Compiler-Interpreter',
  49552. fn: function (){
  49553. var self=this;
  49554. return true;
  49555. },
  49556. //>>excludeStart("ide", pragmas.excludeIdeData);
  49557. args: [],
  49558. source: "isSteppingNode\x0a\x09^ true",
  49559. referencedClasses: [],
  49560. //>>excludeEnd("ide");
  49561. messageSends: []
  49562. }),
  49563. globals.DynamicDictionaryNode);
  49564. smalltalk.addMethod(
  49565. smalltalk.method({
  49566. selector: "isSteppingNode",
  49567. protocol: '*Compiler-Interpreter',
  49568. fn: function (){
  49569. var self=this;
  49570. return true;
  49571. },
  49572. //>>excludeStart("ide", pragmas.excludeIdeData);
  49573. args: [],
  49574. source: "isSteppingNode\x0a\x09^ true",
  49575. referencedClasses: [],
  49576. //>>excludeEnd("ide");
  49577. messageSends: []
  49578. }),
  49579. globals.JSStatementNode);
  49580. smalltalk.addMethod(
  49581. smalltalk.method({
  49582. selector: "isSteppingNode",
  49583. protocol: '*Compiler-Interpreter',
  49584. fn: function (){
  49585. var self=this;
  49586. return false;
  49587. },
  49588. //>>excludeStart("ide", pragmas.excludeIdeData);
  49589. args: [],
  49590. source: "isSteppingNode\x0a\x09^ false",
  49591. referencedClasses: [],
  49592. //>>excludeEnd("ide");
  49593. messageSends: []
  49594. }),
  49595. globals.Node);
  49596. smalltalk.addMethod(
  49597. smalltalk.method({
  49598. selector: "isSteppingNode",
  49599. protocol: '*Compiler-Interpreter',
  49600. fn: function (){
  49601. var self=this;
  49602. return true;
  49603. },
  49604. //>>excludeStart("ide", pragmas.excludeIdeData);
  49605. args: [],
  49606. source: "isSteppingNode\x0a\x09^ true",
  49607. referencedClasses: [],
  49608. //>>excludeEnd("ide");
  49609. messageSends: []
  49610. }),
  49611. globals.SendNode);
  49612. });
  49613. define("amber/parser", ["./boot"], function(boot) {
  49614. var globals = boot.globals, nil = boot.nil;
  49615. globals.SmalltalkParser = (function() {
  49616. /*
  49617. * Generated by PEG.js 0.8.0.
  49618. *
  49619. * http://pegjs.majda.cz/
  49620. */
  49621. function peg$subclass(child, parent) {
  49622. function ctor() { this.constructor = child; }
  49623. ctor.prototype = parent.prototype;
  49624. child.prototype = new ctor();
  49625. }
  49626. function SyntaxError(message, expected, found, offset, line, column) {
  49627. this.message = message;
  49628. this.expected = expected;
  49629. this.found = found;
  49630. this.offset = offset;
  49631. this.line = line;
  49632. this.column = column;
  49633. this.name = "SyntaxError";
  49634. }
  49635. peg$subclass(SyntaxError, Error);
  49636. function parse(input) {
  49637. var options = arguments.length > 1 ? arguments[1] : {},
  49638. peg$FAILED = {},
  49639. peg$startRuleFunctions = { start: peg$parsestart },
  49640. peg$startRuleFunction = peg$parsestart,
  49641. peg$c0 = [],
  49642. peg$c1 = peg$FAILED,
  49643. peg$c2 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  49644. peg$c3 = { type: "class", value: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\x0B\\f\\xA0\\uFEFF\\n\\r\\u2028\\u2029]" },
  49645. peg$c4 = "\"",
  49646. peg$c5 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  49647. peg$c6 = /^[^"]/,
  49648. peg$c7 = { type: "class", value: "[^\"]", description: "[^\"]" },
  49649. peg$c8 = /^[a-zA-Z]/,
  49650. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  49651. peg$c10 = /^[a-zA-Z0-9]/,
  49652. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  49653. peg$c12 = function(first, others) {return first + others.join("");},
  49654. peg$c13 = ":",
  49655. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  49656. peg$c15 = function(first, last) {return first + last;},
  49657. peg$c16 = /^[a-zA-Z0-9:]/,
  49658. peg$c17 = { type: "class", value: "[a-zA-Z0-9:]", description: "[a-zA-Z0-9:]" },
  49659. peg$c18 = /^[A-Z]/,
  49660. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  49661. peg$c20 = "'",
  49662. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  49663. peg$c22 = "''",
  49664. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  49665. peg$c24 = function() {return "'";},
  49666. peg$c25 = /^[^']/,
  49667. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  49668. peg$c27 = function(val) {
  49669. return globals.ValueNode._new()
  49670. ._position_((line()).__at(column()))
  49671. ._source_(text())
  49672. ._value_(val.join(""));
  49673. },
  49674. peg$c28 = "$",
  49675. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  49676. peg$c30 = { type: "any", description: "any character" },
  49677. peg$c31 = function(char) {
  49678. return globals.ValueNode._new()
  49679. ._position_((line()).__at(column()))
  49680. ._source_(text())
  49681. ._value_(char);
  49682. },
  49683. peg$c32 = "#",
  49684. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  49685. peg$c34 = function(rest) {return rest;},
  49686. peg$c35 = function(node) {return node._value();},
  49687. peg$c36 = function(val) {
  49688. return globals.ValueNode._new()
  49689. ._position_((line()).__at(column()))
  49690. ._source_(text())
  49691. ._value_(val);
  49692. },
  49693. peg$c37 = function(n) {
  49694. return globals.ValueNode._new()
  49695. ._position_((line()).__at(column()))
  49696. ._source_(text())
  49697. ._value_(n);
  49698. },
  49699. peg$c38 = "e",
  49700. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  49701. peg$c40 = function(n) {return parseFloat(n.join(""));},
  49702. peg$c41 = null,
  49703. peg$c42 = "-",
  49704. peg$c43 = { type: "literal", value: "-", description: "\"-\"" },
  49705. peg$c44 = "16r",
  49706. peg$c45 = { type: "literal", value: "16r", description: "\"16r\"" },
  49707. peg$c46 = /^[0-9a-fA-F]/,
  49708. peg$c47 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  49709. peg$c48 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  49710. peg$c49 = /^[0-9]/,
  49711. peg$c50 = { type: "class", value: "[0-9]", description: "[0-9]" },
  49712. peg$c51 = ".",
  49713. peg$c52 = { type: "literal", value: ".", description: "\".\"" },
  49714. peg$c53 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  49715. peg$c54 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  49716. peg$c55 = "#(",
  49717. peg$c56 = { type: "literal", value: "#(", description: "\"#(\"" },
  49718. peg$c57 = "(",
  49719. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  49720. peg$c59 = function(lit) {return lit._value();},
  49721. peg$c60 = ")",
  49722. peg$c61 = { type: "literal", value: ")", description: "\")\"" },
  49723. peg$c62 = function(lits) {
  49724. return globals.ValueNode._new()
  49725. ._position_((line()).__at(column()))
  49726. ._source_(text())
  49727. ._value_(lits);
  49728. },
  49729. peg$c63 = "{",
  49730. peg$c64 = { type: "literal", value: "{", description: "\"{\"" },
  49731. peg$c65 = "}",
  49732. peg$c66 = { type: "literal", value: "}", description: "\"}\"" },
  49733. peg$c67 = function(expressions) {
  49734. return globals.DynamicArrayNode._new()
  49735. ._position_((line()).__at(column()))
  49736. ._source_(text())
  49737. ._nodes_(expressions || []);
  49738. },
  49739. peg$c68 = "#{",
  49740. peg$c69 = { type: "literal", value: "#{", description: "\"#{\"" },
  49741. peg$c70 = function(expressions) {
  49742. return globals.DynamicDictionaryNode._new()
  49743. ._position_((line()).__at(column()))
  49744. ._source_(text())
  49745. ._nodes_(expressions || []);
  49746. },
  49747. peg$c71 = "true",
  49748. peg$c72 = { type: "literal", value: "true", description: "\"true\"" },
  49749. peg$c73 = function() {return true;},
  49750. peg$c74 = "false",
  49751. peg$c75 = { type: "literal", value: "false", description: "\"false\"" },
  49752. peg$c76 = function() {return false;},
  49753. peg$c77 = "nil",
  49754. peg$c78 = { type: "literal", value: "nil", description: "\"nil\"" },
  49755. peg$c79 = function() {return nil;},
  49756. peg$c80 = function(val) {
  49757. return globals.ValueNode._new()
  49758. ._position_((line()).__at(column()))
  49759. ._source_(text())
  49760. ._value_(val);
  49761. },
  49762. peg$c81 = function(identifier) {
  49763. return globals.VariableNode._new()
  49764. ._position_((line()).__at(column()))
  49765. ._source_(text())
  49766. ._value_(identifier);
  49767. },
  49768. peg$c82 = function(key, arg) {return {key:key, arg:arg};},
  49769. peg$c83 = /^[\\+*\/=><,@%~|&\-]/,
  49770. peg$c84 = { type: "class", value: "[\\\\+*\\/=><,@%~|&\\-]", description: "[\\\\+*\\/=><,@%~|&\\-]" },
  49771. peg$c85 = function(bin) {return bin.join("");},
  49772. peg$c86 = function(pairs) {
  49773. var keywords = [];
  49774. var params = [];
  49775. var i = 0;
  49776. for(i = 0; i < pairs.length; i++){
  49777. keywords.push(pairs[i].key);
  49778. }
  49779. for(i = 0; i < pairs.length; i++){
  49780. params.push(pairs[i].arg);
  49781. }
  49782. return [keywords.join(""), params];
  49783. },
  49784. peg$c87 = function(selector, arg) {return [selector, [arg]];},
  49785. peg$c88 = function(selector) {return [selector, []];},
  49786. peg$c89 = function(expression) {return expression;},
  49787. peg$c90 = function(first, others) { return [first].concat(others); },
  49788. peg$c91 = ":=",
  49789. peg$c92 = { type: "literal", value: ":=", description: "\":=\"" },
  49790. peg$c93 = function(variable, expression) {
  49791. return globals.AssignmentNode._new()
  49792. ._position_((line()).__at(column()))
  49793. ._source_(text())
  49794. ._left_(variable)
  49795. ._right_(expression);
  49796. },
  49797. peg$c94 = "^",
  49798. peg$c95 = { type: "literal", value: "^", description: "\"^\"" },
  49799. peg$c96 = function(expression) {
  49800. return globals.ReturnNode._new()
  49801. ._position_((line()).__at(column()))
  49802. ._source_(text())
  49803. ._nodes_([expression]);
  49804. },
  49805. peg$c97 = "|",
  49806. peg$c98 = { type: "literal", value: "|", description: "\"|\"" },
  49807. peg$c99 = function(variable) {return variable;},
  49808. peg$c100 = function(vars) {return vars;},
  49809. peg$c101 = function(param) {return param;},
  49810. peg$c102 = function(params) {return params;},
  49811. peg$c103 = function(ret) {return [ret];},
  49812. peg$c104 = function(exps, ret) {
  49813. var expressions = exps;
  49814. expressions.push(ret);
  49815. return expressions;
  49816. },
  49817. peg$c105 = function(expressions) {
  49818. return expressions || [];
  49819. },
  49820. peg$c106 = function(temps, statements) {
  49821. return globals.SequenceNode._new()
  49822. ._position_((line()).__at(column()))
  49823. ._source_(text())
  49824. ._temps_(temps || [])
  49825. ._nodes_(statements || []);
  49826. },
  49827. peg$c107 = "[",
  49828. peg$c108 = { type: "literal", value: "[", description: "\"[\"" },
  49829. peg$c109 = "]",
  49830. peg$c110 = { type: "literal", value: "]", description: "\"]\"" },
  49831. peg$c111 = function(params, sequence) {
  49832. return globals.BlockNode._new()
  49833. ._position_((line()).__at(column()))
  49834. ._source_(text())
  49835. ._parameters_(params || [])
  49836. ._nodes_([sequence._asBlockSequenceNode()]);
  49837. },
  49838. peg$c112 = void 0,
  49839. peg$c113 = function(selector) {
  49840. return globals.SendNode._new()
  49841. ._position_((line()).__at(column()))
  49842. ._source_(text())
  49843. ._selector_(selector);
  49844. },
  49845. peg$c114 = function(message, tail) {
  49846. if(tail) {
  49847. return tail._valueForReceiver_(message);
  49848. }
  49849. else {
  49850. return message;
  49851. }
  49852. },
  49853. peg$c115 = function(receiver, tail) {
  49854. if(tail) {
  49855. return tail._valueForReceiver_(receiver);
  49856. }
  49857. else {
  49858. return receiver;
  49859. }
  49860. },
  49861. peg$c116 = function(selector, arg) {
  49862. return globals.SendNode._new()
  49863. ._position_((line()).__at(column()))
  49864. ._source_(text())
  49865. ._selector_(selector)
  49866. ._arguments_([arg]);
  49867. },
  49868. peg$c117 = function(message, tail) {
  49869. if(tail) {
  49870. return tail._valueForReceiver_(message);
  49871. }
  49872. else {
  49873. return message;
  49874. }
  49875. },
  49876. peg$c118 = function(pairs) {
  49877. var selector = [];
  49878. var args = [];
  49879. for(var i = 0; i < pairs.length; i++) {
  49880. selector.push(pairs[i].key);
  49881. args.push(pairs[i].arg);
  49882. }
  49883. return globals.SendNode._new()
  49884. ._position_((line()).__at(column()))
  49885. ._source_(text())
  49886. ._selector_(selector.join(""))
  49887. ._arguments_(args);
  49888. },
  49889. peg$c119 = function(receiver, tail) {
  49890. return tail._valueForReceiver_(receiver);
  49891. },
  49892. peg$c120 = ";",
  49893. peg$c121 = { type: "literal", value: ";", description: "\";\"" },
  49894. peg$c122 = function(mess) {return mess;},
  49895. peg$c123 = function(send, messages) {
  49896. var cascade = [];
  49897. cascade.push(send);
  49898. for(var i = 0; i < messages.length; i++) {
  49899. cascade.push(messages[i]);
  49900. }
  49901. return globals.CascadeNode._new()
  49902. ._position_((line()).__at(column()))
  49903. ._source_(text())
  49904. ._receiver_(send._receiver())
  49905. ._nodes_(cascade);
  49906. },
  49907. peg$c124 = "<",
  49908. peg$c125 = { type: "literal", value: "<", description: "\"<\"" },
  49909. peg$c126 = ">>",
  49910. peg$c127 = { type: "literal", value: ">>", description: "\">>\"" },
  49911. peg$c128 = function() {return ">";},
  49912. peg$c129 = /^[^>]/,
  49913. peg$c130 = { type: "class", value: "[^>]", description: "[^>]" },
  49914. peg$c131 = ">",
  49915. peg$c132 = { type: "literal", value: ">", description: "\">\"" },
  49916. peg$c133 = function(val) {
  49917. return globals.JSStatementNode._new()
  49918. ._position_((line()).__at(column()))
  49919. ._source_(val.join(""))
  49920. },
  49921. peg$c134 = function(pattern, sequence) {
  49922. return globals.MethodNode._new()
  49923. ._position_((line()).__at(column()))
  49924. ._source_(text())
  49925. ._selector_(pattern[0])
  49926. ._arguments_(pattern[1])
  49927. ._nodes_([sequence]);
  49928. },
  49929. peg$c135 = function(send) { return send._selector() === "->" },
  49930. peg$c136 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  49931. peg$c137 = function(first, others) { return first.concat.apply(first, others); },
  49932. peg$currPos = 0,
  49933. peg$reportedPos = 0,
  49934. peg$cachedPos = 0,
  49935. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
  49936. peg$maxFailPos = 0,
  49937. peg$maxFailExpected = [],
  49938. peg$silentFails = 0,
  49939. peg$cache = {},
  49940. peg$result;
  49941. if ("startRule" in options) {
  49942. if (!(options.startRule in peg$startRuleFunctions)) {
  49943. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  49944. }
  49945. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  49946. }
  49947. function text() {
  49948. return input.substring(peg$reportedPos, peg$currPos);
  49949. }
  49950. function offset() {
  49951. return peg$reportedPos;
  49952. }
  49953. function line() {
  49954. return peg$computePosDetails(peg$reportedPos).line;
  49955. }
  49956. function column() {
  49957. return peg$computePosDetails(peg$reportedPos).column;
  49958. }
  49959. function expected(description) {
  49960. throw peg$buildException(
  49961. null,
  49962. [{ type: "other", description: description }],
  49963. peg$reportedPos
  49964. );
  49965. }
  49966. function error(message) {
  49967. throw peg$buildException(message, null, peg$reportedPos);
  49968. }
  49969. function peg$computePosDetails(pos) {
  49970. function advance(details, startPos, endPos) {
  49971. var p, ch;
  49972. for (p = startPos; p < endPos; p++) {
  49973. ch = input.charAt(p);
  49974. if (ch === "\n") {
  49975. if (!details.seenCR) { details.line++; }
  49976. details.column = 1;
  49977. details.seenCR = false;
  49978. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  49979. details.line++;
  49980. details.column = 1;
  49981. details.seenCR = true;
  49982. } else {
  49983. details.column++;
  49984. details.seenCR = false;
  49985. }
  49986. }
  49987. }
  49988. if (peg$cachedPos !== pos) {
  49989. if (peg$cachedPos > pos) {
  49990. peg$cachedPos = 0;
  49991. peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
  49992. }
  49993. advance(peg$cachedPosDetails, peg$cachedPos, pos);
  49994. peg$cachedPos = pos;
  49995. }
  49996. return peg$cachedPosDetails;
  49997. }
  49998. function peg$fail(expected) {
  49999. if (peg$currPos < peg$maxFailPos) { return; }
  50000. if (peg$currPos > peg$maxFailPos) {
  50001. peg$maxFailPos = peg$currPos;
  50002. peg$maxFailExpected = [];
  50003. }
  50004. peg$maxFailExpected.push(expected);
  50005. }
  50006. function peg$buildException(message, expected, pos) {
  50007. function cleanupExpected(expected) {
  50008. var i = 1;
  50009. expected.sort(function(a, b) {
  50010. if (a.description < b.description) {
  50011. return -1;
  50012. } else if (a.description > b.description) {
  50013. return 1;
  50014. } else {
  50015. return 0;
  50016. }
  50017. });
  50018. while (i < expected.length) {
  50019. if (expected[i - 1] === expected[i]) {
  50020. expected.splice(i, 1);
  50021. } else {
  50022. i++;
  50023. }
  50024. }
  50025. }
  50026. function buildMessage(expected, found) {
  50027. function stringEscape(s) {
  50028. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  50029. return s
  50030. .replace(/\\/g, '\\\\')
  50031. .replace(/"/g, '\\"')
  50032. .replace(/\x08/g, '\\b')
  50033. .replace(/\t/g, '\\t')
  50034. .replace(/\n/g, '\\n')
  50035. .replace(/\f/g, '\\f')
  50036. .replace(/\r/g, '\\r')
  50037. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  50038. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  50039. .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  50040. .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  50041. }
  50042. var expectedDescs = new Array(expected.length),
  50043. expectedDesc, foundDesc, i;
  50044. for (i = 0; i < expected.length; i++) {
  50045. expectedDescs[i] = expected[i].description;
  50046. }
  50047. expectedDesc = expected.length > 1
  50048. ? expectedDescs.slice(0, -1).join(", ")
  50049. + " or "
  50050. + expectedDescs[expected.length - 1]
  50051. : expectedDescs[0];
  50052. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  50053. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  50054. }
  50055. var posDetails = peg$computePosDetails(pos),
  50056. found = pos < input.length ? input.charAt(pos) : null;
  50057. if (expected !== null) {
  50058. cleanupExpected(expected);
  50059. }
  50060. return new SyntaxError(
  50061. message !== null ? message : buildMessage(expected, found),
  50062. expected,
  50063. found,
  50064. pos,
  50065. posDetails.line,
  50066. posDetails.column
  50067. );
  50068. }
  50069. function peg$parsestart() {
  50070. var s0;
  50071. var key = peg$currPos * 60 + 0,
  50072. cached = peg$cache[key];
  50073. if (cached) {
  50074. peg$currPos = cached.nextPos;
  50075. return cached.result;
  50076. }
  50077. s0 = peg$parsemethod();
  50078. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50079. return s0;
  50080. }
  50081. function peg$parseseparator() {
  50082. var s0, s1;
  50083. var key = peg$currPos * 60 + 1,
  50084. cached = peg$cache[key];
  50085. if (cached) {
  50086. peg$currPos = cached.nextPos;
  50087. return cached.result;
  50088. }
  50089. s0 = [];
  50090. if (peg$c2.test(input.charAt(peg$currPos))) {
  50091. s1 = input.charAt(peg$currPos);
  50092. peg$currPos++;
  50093. } else {
  50094. s1 = peg$FAILED;
  50095. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  50096. }
  50097. if (s1 !== peg$FAILED) {
  50098. while (s1 !== peg$FAILED) {
  50099. s0.push(s1);
  50100. if (peg$c2.test(input.charAt(peg$currPos))) {
  50101. s1 = input.charAt(peg$currPos);
  50102. peg$currPos++;
  50103. } else {
  50104. s1 = peg$FAILED;
  50105. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  50106. }
  50107. }
  50108. } else {
  50109. s0 = peg$c1;
  50110. }
  50111. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50112. return s0;
  50113. }
  50114. function peg$parsecomments() {
  50115. var s0, s1, s2, s3, s4;
  50116. var key = peg$currPos * 60 + 2,
  50117. cached = peg$cache[key];
  50118. if (cached) {
  50119. peg$currPos = cached.nextPos;
  50120. return cached.result;
  50121. }
  50122. s0 = [];
  50123. s1 = peg$currPos;
  50124. if (input.charCodeAt(peg$currPos) === 34) {
  50125. s2 = peg$c4;
  50126. peg$currPos++;
  50127. } else {
  50128. s2 = peg$FAILED;
  50129. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50130. }
  50131. if (s2 !== peg$FAILED) {
  50132. s3 = [];
  50133. if (peg$c6.test(input.charAt(peg$currPos))) {
  50134. s4 = input.charAt(peg$currPos);
  50135. peg$currPos++;
  50136. } else {
  50137. s4 = peg$FAILED;
  50138. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50139. }
  50140. while (s4 !== peg$FAILED) {
  50141. s3.push(s4);
  50142. if (peg$c6.test(input.charAt(peg$currPos))) {
  50143. s4 = input.charAt(peg$currPos);
  50144. peg$currPos++;
  50145. } else {
  50146. s4 = peg$FAILED;
  50147. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50148. }
  50149. }
  50150. if (s3 !== peg$FAILED) {
  50151. if (input.charCodeAt(peg$currPos) === 34) {
  50152. s4 = peg$c4;
  50153. peg$currPos++;
  50154. } else {
  50155. s4 = peg$FAILED;
  50156. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50157. }
  50158. if (s4 !== peg$FAILED) {
  50159. s2 = [s2, s3, s4];
  50160. s1 = s2;
  50161. } else {
  50162. peg$currPos = s1;
  50163. s1 = peg$c1;
  50164. }
  50165. } else {
  50166. peg$currPos = s1;
  50167. s1 = peg$c1;
  50168. }
  50169. } else {
  50170. peg$currPos = s1;
  50171. s1 = peg$c1;
  50172. }
  50173. if (s1 !== peg$FAILED) {
  50174. while (s1 !== peg$FAILED) {
  50175. s0.push(s1);
  50176. s1 = peg$currPos;
  50177. if (input.charCodeAt(peg$currPos) === 34) {
  50178. s2 = peg$c4;
  50179. peg$currPos++;
  50180. } else {
  50181. s2 = peg$FAILED;
  50182. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50183. }
  50184. if (s2 !== peg$FAILED) {
  50185. s3 = [];
  50186. if (peg$c6.test(input.charAt(peg$currPos))) {
  50187. s4 = input.charAt(peg$currPos);
  50188. peg$currPos++;
  50189. } else {
  50190. s4 = peg$FAILED;
  50191. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50192. }
  50193. while (s4 !== peg$FAILED) {
  50194. s3.push(s4);
  50195. if (peg$c6.test(input.charAt(peg$currPos))) {
  50196. s4 = input.charAt(peg$currPos);
  50197. peg$currPos++;
  50198. } else {
  50199. s4 = peg$FAILED;
  50200. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  50201. }
  50202. }
  50203. if (s3 !== peg$FAILED) {
  50204. if (input.charCodeAt(peg$currPos) === 34) {
  50205. s4 = peg$c4;
  50206. peg$currPos++;
  50207. } else {
  50208. s4 = peg$FAILED;
  50209. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  50210. }
  50211. if (s4 !== peg$FAILED) {
  50212. s2 = [s2, s3, s4];
  50213. s1 = s2;
  50214. } else {
  50215. peg$currPos = s1;
  50216. s1 = peg$c1;
  50217. }
  50218. } else {
  50219. peg$currPos = s1;
  50220. s1 = peg$c1;
  50221. }
  50222. } else {
  50223. peg$currPos = s1;
  50224. s1 = peg$c1;
  50225. }
  50226. }
  50227. } else {
  50228. s0 = peg$c1;
  50229. }
  50230. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50231. return s0;
  50232. }
  50233. function peg$parsews() {
  50234. var s0, s1;
  50235. var key = peg$currPos * 60 + 3,
  50236. cached = peg$cache[key];
  50237. if (cached) {
  50238. peg$currPos = cached.nextPos;
  50239. return cached.result;
  50240. }
  50241. s0 = [];
  50242. s1 = peg$parseseparator();
  50243. if (s1 === peg$FAILED) {
  50244. s1 = peg$parsecomments();
  50245. }
  50246. while (s1 !== peg$FAILED) {
  50247. s0.push(s1);
  50248. s1 = peg$parseseparator();
  50249. if (s1 === peg$FAILED) {
  50250. s1 = peg$parsecomments();
  50251. }
  50252. }
  50253. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50254. return s0;
  50255. }
  50256. function peg$parseidentifier() {
  50257. var s0, s1, s2, s3;
  50258. var key = peg$currPos * 60 + 4,
  50259. cached = peg$cache[key];
  50260. if (cached) {
  50261. peg$currPos = cached.nextPos;
  50262. return cached.result;
  50263. }
  50264. s0 = peg$currPos;
  50265. if (peg$c8.test(input.charAt(peg$currPos))) {
  50266. s1 = input.charAt(peg$currPos);
  50267. peg$currPos++;
  50268. } else {
  50269. s1 = peg$FAILED;
  50270. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  50271. }
  50272. if (s1 !== peg$FAILED) {
  50273. s2 = [];
  50274. if (peg$c10.test(input.charAt(peg$currPos))) {
  50275. s3 = input.charAt(peg$currPos);
  50276. peg$currPos++;
  50277. } else {
  50278. s3 = peg$FAILED;
  50279. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50280. }
  50281. while (s3 !== peg$FAILED) {
  50282. s2.push(s3);
  50283. if (peg$c10.test(input.charAt(peg$currPos))) {
  50284. s3 = input.charAt(peg$currPos);
  50285. peg$currPos++;
  50286. } else {
  50287. s3 = peg$FAILED;
  50288. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50289. }
  50290. }
  50291. if (s2 !== peg$FAILED) {
  50292. peg$reportedPos = s0;
  50293. s1 = peg$c12(s1, s2);
  50294. s0 = s1;
  50295. } else {
  50296. peg$currPos = s0;
  50297. s0 = peg$c1;
  50298. }
  50299. } else {
  50300. peg$currPos = s0;
  50301. s0 = peg$c1;
  50302. }
  50303. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50304. return s0;
  50305. }
  50306. function peg$parsekeyword() {
  50307. var s0, s1, s2;
  50308. var key = peg$currPos * 60 + 5,
  50309. cached = peg$cache[key];
  50310. if (cached) {
  50311. peg$currPos = cached.nextPos;
  50312. return cached.result;
  50313. }
  50314. s0 = peg$currPos;
  50315. s1 = peg$parseidentifier();
  50316. if (s1 !== peg$FAILED) {
  50317. if (input.charCodeAt(peg$currPos) === 58) {
  50318. s2 = peg$c13;
  50319. peg$currPos++;
  50320. } else {
  50321. s2 = peg$FAILED;
  50322. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  50323. }
  50324. if (s2 !== peg$FAILED) {
  50325. peg$reportedPos = s0;
  50326. s1 = peg$c15(s1, s2);
  50327. s0 = s1;
  50328. } else {
  50329. peg$currPos = s0;
  50330. s0 = peg$c1;
  50331. }
  50332. } else {
  50333. peg$currPos = s0;
  50334. s0 = peg$c1;
  50335. }
  50336. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50337. return s0;
  50338. }
  50339. function peg$parseselector() {
  50340. var s0, s1, s2, s3;
  50341. var key = peg$currPos * 60 + 6,
  50342. cached = peg$cache[key];
  50343. if (cached) {
  50344. peg$currPos = cached.nextPos;
  50345. return cached.result;
  50346. }
  50347. s0 = peg$currPos;
  50348. if (peg$c8.test(input.charAt(peg$currPos))) {
  50349. s1 = input.charAt(peg$currPos);
  50350. peg$currPos++;
  50351. } else {
  50352. s1 = peg$FAILED;
  50353. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  50354. }
  50355. if (s1 !== peg$FAILED) {
  50356. s2 = [];
  50357. if (peg$c16.test(input.charAt(peg$currPos))) {
  50358. s3 = input.charAt(peg$currPos);
  50359. peg$currPos++;
  50360. } else {
  50361. s3 = peg$FAILED;
  50362. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  50363. }
  50364. while (s3 !== peg$FAILED) {
  50365. s2.push(s3);
  50366. if (peg$c16.test(input.charAt(peg$currPos))) {
  50367. s3 = input.charAt(peg$currPos);
  50368. peg$currPos++;
  50369. } else {
  50370. s3 = peg$FAILED;
  50371. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  50372. }
  50373. }
  50374. if (s2 !== peg$FAILED) {
  50375. peg$reportedPos = s0;
  50376. s1 = peg$c12(s1, s2);
  50377. s0 = s1;
  50378. } else {
  50379. peg$currPos = s0;
  50380. s0 = peg$c1;
  50381. }
  50382. } else {
  50383. peg$currPos = s0;
  50384. s0 = peg$c1;
  50385. }
  50386. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50387. return s0;
  50388. }
  50389. function peg$parseclassName() {
  50390. var s0, s1, s2, s3;
  50391. var key = peg$currPos * 60 + 7,
  50392. cached = peg$cache[key];
  50393. if (cached) {
  50394. peg$currPos = cached.nextPos;
  50395. return cached.result;
  50396. }
  50397. s0 = peg$currPos;
  50398. if (peg$c18.test(input.charAt(peg$currPos))) {
  50399. s1 = input.charAt(peg$currPos);
  50400. peg$currPos++;
  50401. } else {
  50402. s1 = peg$FAILED;
  50403. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  50404. }
  50405. if (s1 !== peg$FAILED) {
  50406. s2 = [];
  50407. if (peg$c10.test(input.charAt(peg$currPos))) {
  50408. s3 = input.charAt(peg$currPos);
  50409. peg$currPos++;
  50410. } else {
  50411. s3 = peg$FAILED;
  50412. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50413. }
  50414. while (s3 !== peg$FAILED) {
  50415. s2.push(s3);
  50416. if (peg$c10.test(input.charAt(peg$currPos))) {
  50417. s3 = input.charAt(peg$currPos);
  50418. peg$currPos++;
  50419. } else {
  50420. s3 = peg$FAILED;
  50421. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  50422. }
  50423. }
  50424. if (s2 !== peg$FAILED) {
  50425. peg$reportedPos = s0;
  50426. s1 = peg$c12(s1, s2);
  50427. s0 = s1;
  50428. } else {
  50429. peg$currPos = s0;
  50430. s0 = peg$c1;
  50431. }
  50432. } else {
  50433. peg$currPos = s0;
  50434. s0 = peg$c1;
  50435. }
  50436. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50437. return s0;
  50438. }
  50439. function peg$parsestring() {
  50440. var s0, s1, s2, s3, s4;
  50441. var key = peg$currPos * 60 + 8,
  50442. cached = peg$cache[key];
  50443. if (cached) {
  50444. peg$currPos = cached.nextPos;
  50445. return cached.result;
  50446. }
  50447. s0 = peg$currPos;
  50448. if (input.charCodeAt(peg$currPos) === 39) {
  50449. s1 = peg$c20;
  50450. peg$currPos++;
  50451. } else {
  50452. s1 = peg$FAILED;
  50453. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  50454. }
  50455. if (s1 !== peg$FAILED) {
  50456. s2 = [];
  50457. s3 = peg$currPos;
  50458. if (input.substr(peg$currPos, 2) === peg$c22) {
  50459. s4 = peg$c22;
  50460. peg$currPos += 2;
  50461. } else {
  50462. s4 = peg$FAILED;
  50463. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  50464. }
  50465. if (s4 !== peg$FAILED) {
  50466. peg$reportedPos = s3;
  50467. s4 = peg$c24();
  50468. }
  50469. s3 = s4;
  50470. if (s3 === peg$FAILED) {
  50471. if (peg$c25.test(input.charAt(peg$currPos))) {
  50472. s3 = input.charAt(peg$currPos);
  50473. peg$currPos++;
  50474. } else {
  50475. s3 = peg$FAILED;
  50476. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  50477. }
  50478. }
  50479. while (s3 !== peg$FAILED) {
  50480. s2.push(s3);
  50481. s3 = peg$currPos;
  50482. if (input.substr(peg$currPos, 2) === peg$c22) {
  50483. s4 = peg$c22;
  50484. peg$currPos += 2;
  50485. } else {
  50486. s4 = peg$FAILED;
  50487. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  50488. }
  50489. if (s4 !== peg$FAILED) {
  50490. peg$reportedPos = s3;
  50491. s4 = peg$c24();
  50492. }
  50493. s3 = s4;
  50494. if (s3 === peg$FAILED) {
  50495. if (peg$c25.test(input.charAt(peg$currPos))) {
  50496. s3 = input.charAt(peg$currPos);
  50497. peg$currPos++;
  50498. } else {
  50499. s3 = peg$FAILED;
  50500. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  50501. }
  50502. }
  50503. }
  50504. if (s2 !== peg$FAILED) {
  50505. if (input.charCodeAt(peg$currPos) === 39) {
  50506. s3 = peg$c20;
  50507. peg$currPos++;
  50508. } else {
  50509. s3 = peg$FAILED;
  50510. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  50511. }
  50512. if (s3 !== peg$FAILED) {
  50513. peg$reportedPos = s0;
  50514. s1 = peg$c27(s2);
  50515. s0 = s1;
  50516. } else {
  50517. peg$currPos = s0;
  50518. s0 = peg$c1;
  50519. }
  50520. } else {
  50521. peg$currPos = s0;
  50522. s0 = peg$c1;
  50523. }
  50524. } else {
  50525. peg$currPos = s0;
  50526. s0 = peg$c1;
  50527. }
  50528. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50529. return s0;
  50530. }
  50531. function peg$parsecharacter() {
  50532. var s0, s1, s2;
  50533. var key = peg$currPos * 60 + 9,
  50534. cached = peg$cache[key];
  50535. if (cached) {
  50536. peg$currPos = cached.nextPos;
  50537. return cached.result;
  50538. }
  50539. s0 = peg$currPos;
  50540. if (input.charCodeAt(peg$currPos) === 36) {
  50541. s1 = peg$c28;
  50542. peg$currPos++;
  50543. } else {
  50544. s1 = peg$FAILED;
  50545. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  50546. }
  50547. if (s1 !== peg$FAILED) {
  50548. if (input.length > peg$currPos) {
  50549. s2 = input.charAt(peg$currPos);
  50550. peg$currPos++;
  50551. } else {
  50552. s2 = peg$FAILED;
  50553. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  50554. }
  50555. if (s2 !== peg$FAILED) {
  50556. peg$reportedPos = s0;
  50557. s1 = peg$c31(s2);
  50558. s0 = s1;
  50559. } else {
  50560. peg$currPos = s0;
  50561. s0 = peg$c1;
  50562. }
  50563. } else {
  50564. peg$currPos = s0;
  50565. s0 = peg$c1;
  50566. }
  50567. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50568. return s0;
  50569. }
  50570. function peg$parsesymbol() {
  50571. var s0, s1, s2;
  50572. var key = peg$currPos * 60 + 10,
  50573. cached = peg$cache[key];
  50574. if (cached) {
  50575. peg$currPos = cached.nextPos;
  50576. return cached.result;
  50577. }
  50578. s0 = peg$currPos;
  50579. if (input.charCodeAt(peg$currPos) === 35) {
  50580. s1 = peg$c32;
  50581. peg$currPos++;
  50582. } else {
  50583. s1 = peg$FAILED;
  50584. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  50585. }
  50586. if (s1 !== peg$FAILED) {
  50587. s2 = peg$parsebareSymbol();
  50588. if (s2 !== peg$FAILED) {
  50589. peg$reportedPos = s0;
  50590. s1 = peg$c34(s2);
  50591. s0 = s1;
  50592. } else {
  50593. peg$currPos = s0;
  50594. s0 = peg$c1;
  50595. }
  50596. } else {
  50597. peg$currPos = s0;
  50598. s0 = peg$c1;
  50599. }
  50600. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50601. return s0;
  50602. }
  50603. function peg$parsebareSymbol() {
  50604. var s0, s1, s2;
  50605. var key = peg$currPos * 60 + 11,
  50606. cached = peg$cache[key];
  50607. if (cached) {
  50608. peg$currPos = cached.nextPos;
  50609. return cached.result;
  50610. }
  50611. s0 = peg$currPos;
  50612. s1 = peg$parseselector();
  50613. if (s1 === peg$FAILED) {
  50614. s1 = peg$parsebinarySelector();
  50615. if (s1 === peg$FAILED) {
  50616. s1 = peg$currPos;
  50617. s2 = peg$parsestring();
  50618. if (s2 !== peg$FAILED) {
  50619. peg$reportedPos = s1;
  50620. s2 = peg$c35(s2);
  50621. }
  50622. s1 = s2;
  50623. }
  50624. }
  50625. if (s1 !== peg$FAILED) {
  50626. peg$reportedPos = s0;
  50627. s1 = peg$c36(s1);
  50628. }
  50629. s0 = s1;
  50630. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50631. return s0;
  50632. }
  50633. function peg$parsenumber() {
  50634. var s0, s1;
  50635. var key = peg$currPos * 60 + 12,
  50636. cached = peg$cache[key];
  50637. if (cached) {
  50638. peg$currPos = cached.nextPos;
  50639. return cached.result;
  50640. }
  50641. s0 = peg$currPos;
  50642. s1 = peg$parsenumberExp();
  50643. if (s1 === peg$FAILED) {
  50644. s1 = peg$parsehex();
  50645. if (s1 === peg$FAILED) {
  50646. s1 = peg$parsefloat();
  50647. if (s1 === peg$FAILED) {
  50648. s1 = peg$parseinteger();
  50649. }
  50650. }
  50651. }
  50652. if (s1 !== peg$FAILED) {
  50653. peg$reportedPos = s0;
  50654. s1 = peg$c37(s1);
  50655. }
  50656. s0 = s1;
  50657. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50658. return s0;
  50659. }
  50660. function peg$parsenumberExp() {
  50661. var s0, s1, s2, s3, s4;
  50662. var key = peg$currPos * 60 + 13,
  50663. cached = peg$cache[key];
  50664. if (cached) {
  50665. peg$currPos = cached.nextPos;
  50666. return cached.result;
  50667. }
  50668. s0 = peg$currPos;
  50669. s1 = peg$currPos;
  50670. s2 = peg$parsefloat();
  50671. if (s2 === peg$FAILED) {
  50672. s2 = peg$parseinteger();
  50673. }
  50674. if (s2 !== peg$FAILED) {
  50675. if (input.charCodeAt(peg$currPos) === 101) {
  50676. s3 = peg$c38;
  50677. peg$currPos++;
  50678. } else {
  50679. s3 = peg$FAILED;
  50680. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  50681. }
  50682. if (s3 !== peg$FAILED) {
  50683. s4 = peg$parseinteger();
  50684. if (s4 !== peg$FAILED) {
  50685. s2 = [s2, s3, s4];
  50686. s1 = s2;
  50687. } else {
  50688. peg$currPos = s1;
  50689. s1 = peg$c1;
  50690. }
  50691. } else {
  50692. peg$currPos = s1;
  50693. s1 = peg$c1;
  50694. }
  50695. } else {
  50696. peg$currPos = s1;
  50697. s1 = peg$c1;
  50698. }
  50699. if (s1 !== peg$FAILED) {
  50700. peg$reportedPos = s0;
  50701. s1 = peg$c40(s1);
  50702. }
  50703. s0 = s1;
  50704. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50705. return s0;
  50706. }
  50707. function peg$parsehex() {
  50708. var s0, s1, s2, s3, s4;
  50709. var key = peg$currPos * 60 + 14,
  50710. cached = peg$cache[key];
  50711. if (cached) {
  50712. peg$currPos = cached.nextPos;
  50713. return cached.result;
  50714. }
  50715. s0 = peg$currPos;
  50716. if (input.charCodeAt(peg$currPos) === 45) {
  50717. s1 = peg$c42;
  50718. peg$currPos++;
  50719. } else {
  50720. s1 = peg$FAILED;
  50721. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50722. }
  50723. if (s1 === peg$FAILED) {
  50724. s1 = peg$c41;
  50725. }
  50726. if (s1 !== peg$FAILED) {
  50727. if (input.substr(peg$currPos, 3) === peg$c44) {
  50728. s2 = peg$c44;
  50729. peg$currPos += 3;
  50730. } else {
  50731. s2 = peg$FAILED;
  50732. if (peg$silentFails === 0) { peg$fail(peg$c45); }
  50733. }
  50734. if (s2 !== peg$FAILED) {
  50735. s3 = [];
  50736. if (peg$c46.test(input.charAt(peg$currPos))) {
  50737. s4 = input.charAt(peg$currPos);
  50738. peg$currPos++;
  50739. } else {
  50740. s4 = peg$FAILED;
  50741. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  50742. }
  50743. if (s4 !== peg$FAILED) {
  50744. while (s4 !== peg$FAILED) {
  50745. s3.push(s4);
  50746. if (peg$c46.test(input.charAt(peg$currPos))) {
  50747. s4 = input.charAt(peg$currPos);
  50748. peg$currPos++;
  50749. } else {
  50750. s4 = peg$FAILED;
  50751. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  50752. }
  50753. }
  50754. } else {
  50755. s3 = peg$c1;
  50756. }
  50757. if (s3 !== peg$FAILED) {
  50758. peg$reportedPos = s0;
  50759. s1 = peg$c48(s1, s3);
  50760. s0 = s1;
  50761. } else {
  50762. peg$currPos = s0;
  50763. s0 = peg$c1;
  50764. }
  50765. } else {
  50766. peg$currPos = s0;
  50767. s0 = peg$c1;
  50768. }
  50769. } else {
  50770. peg$currPos = s0;
  50771. s0 = peg$c1;
  50772. }
  50773. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50774. return s0;
  50775. }
  50776. function peg$parsefloat() {
  50777. var s0, s1, s2, s3, s4, s5;
  50778. var key = peg$currPos * 60 + 15,
  50779. cached = peg$cache[key];
  50780. if (cached) {
  50781. peg$currPos = cached.nextPos;
  50782. return cached.result;
  50783. }
  50784. s0 = peg$currPos;
  50785. if (input.charCodeAt(peg$currPos) === 45) {
  50786. s1 = peg$c42;
  50787. peg$currPos++;
  50788. } else {
  50789. s1 = peg$FAILED;
  50790. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50791. }
  50792. if (s1 === peg$FAILED) {
  50793. s1 = peg$c41;
  50794. }
  50795. if (s1 !== peg$FAILED) {
  50796. s2 = [];
  50797. if (peg$c49.test(input.charAt(peg$currPos))) {
  50798. s3 = input.charAt(peg$currPos);
  50799. peg$currPos++;
  50800. } else {
  50801. s3 = peg$FAILED;
  50802. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50803. }
  50804. if (s3 !== peg$FAILED) {
  50805. while (s3 !== peg$FAILED) {
  50806. s2.push(s3);
  50807. if (peg$c49.test(input.charAt(peg$currPos))) {
  50808. s3 = input.charAt(peg$currPos);
  50809. peg$currPos++;
  50810. } else {
  50811. s3 = peg$FAILED;
  50812. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50813. }
  50814. }
  50815. } else {
  50816. s2 = peg$c1;
  50817. }
  50818. if (s2 !== peg$FAILED) {
  50819. if (input.charCodeAt(peg$currPos) === 46) {
  50820. s3 = peg$c51;
  50821. peg$currPos++;
  50822. } else {
  50823. s3 = peg$FAILED;
  50824. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  50825. }
  50826. if (s3 !== peg$FAILED) {
  50827. s4 = [];
  50828. if (peg$c49.test(input.charAt(peg$currPos))) {
  50829. s5 = input.charAt(peg$currPos);
  50830. peg$currPos++;
  50831. } else {
  50832. s5 = peg$FAILED;
  50833. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50834. }
  50835. if (s5 !== peg$FAILED) {
  50836. while (s5 !== peg$FAILED) {
  50837. s4.push(s5);
  50838. if (peg$c49.test(input.charAt(peg$currPos))) {
  50839. s5 = input.charAt(peg$currPos);
  50840. peg$currPos++;
  50841. } else {
  50842. s5 = peg$FAILED;
  50843. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50844. }
  50845. }
  50846. } else {
  50847. s4 = peg$c1;
  50848. }
  50849. if (s4 !== peg$FAILED) {
  50850. peg$reportedPos = s0;
  50851. s1 = peg$c53(s1, s2, s4);
  50852. s0 = s1;
  50853. } else {
  50854. peg$currPos = s0;
  50855. s0 = peg$c1;
  50856. }
  50857. } else {
  50858. peg$currPos = s0;
  50859. s0 = peg$c1;
  50860. }
  50861. } else {
  50862. peg$currPos = s0;
  50863. s0 = peg$c1;
  50864. }
  50865. } else {
  50866. peg$currPos = s0;
  50867. s0 = peg$c1;
  50868. }
  50869. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50870. return s0;
  50871. }
  50872. function peg$parseinteger() {
  50873. var s0, s1, s2, s3;
  50874. var key = peg$currPos * 60 + 16,
  50875. cached = peg$cache[key];
  50876. if (cached) {
  50877. peg$currPos = cached.nextPos;
  50878. return cached.result;
  50879. }
  50880. s0 = peg$currPos;
  50881. if (input.charCodeAt(peg$currPos) === 45) {
  50882. s1 = peg$c42;
  50883. peg$currPos++;
  50884. } else {
  50885. s1 = peg$FAILED;
  50886. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  50887. }
  50888. if (s1 === peg$FAILED) {
  50889. s1 = peg$c41;
  50890. }
  50891. if (s1 !== peg$FAILED) {
  50892. s2 = [];
  50893. if (peg$c49.test(input.charAt(peg$currPos))) {
  50894. s3 = input.charAt(peg$currPos);
  50895. peg$currPos++;
  50896. } else {
  50897. s3 = peg$FAILED;
  50898. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50899. }
  50900. if (s3 !== peg$FAILED) {
  50901. while (s3 !== peg$FAILED) {
  50902. s2.push(s3);
  50903. if (peg$c49.test(input.charAt(peg$currPos))) {
  50904. s3 = input.charAt(peg$currPos);
  50905. peg$currPos++;
  50906. } else {
  50907. s3 = peg$FAILED;
  50908. if (peg$silentFails === 0) { peg$fail(peg$c50); }
  50909. }
  50910. }
  50911. } else {
  50912. s2 = peg$c1;
  50913. }
  50914. if (s2 !== peg$FAILED) {
  50915. peg$reportedPos = s0;
  50916. s1 = peg$c54(s1, s2);
  50917. s0 = s1;
  50918. } else {
  50919. peg$currPos = s0;
  50920. s0 = peg$c1;
  50921. }
  50922. } else {
  50923. peg$currPos = s0;
  50924. s0 = peg$c1;
  50925. }
  50926. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50927. return s0;
  50928. }
  50929. function peg$parseliteralArray() {
  50930. var s0, s1, s2;
  50931. var key = peg$currPos * 60 + 17,
  50932. cached = peg$cache[key];
  50933. if (cached) {
  50934. peg$currPos = cached.nextPos;
  50935. return cached.result;
  50936. }
  50937. s0 = peg$currPos;
  50938. if (input.substr(peg$currPos, 2) === peg$c55) {
  50939. s1 = peg$c55;
  50940. peg$currPos += 2;
  50941. } else {
  50942. s1 = peg$FAILED;
  50943. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  50944. }
  50945. if (s1 !== peg$FAILED) {
  50946. s2 = peg$parseliteralArrayRest();
  50947. if (s2 !== peg$FAILED) {
  50948. peg$reportedPos = s0;
  50949. s1 = peg$c34(s2);
  50950. s0 = s1;
  50951. } else {
  50952. peg$currPos = s0;
  50953. s0 = peg$c1;
  50954. }
  50955. } else {
  50956. peg$currPos = s0;
  50957. s0 = peg$c1;
  50958. }
  50959. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50960. return s0;
  50961. }
  50962. function peg$parsebareLiteralArray() {
  50963. var s0, s1, s2;
  50964. var key = peg$currPos * 60 + 18,
  50965. cached = peg$cache[key];
  50966. if (cached) {
  50967. peg$currPos = cached.nextPos;
  50968. return cached.result;
  50969. }
  50970. s0 = peg$currPos;
  50971. if (input.charCodeAt(peg$currPos) === 40) {
  50972. s1 = peg$c57;
  50973. peg$currPos++;
  50974. } else {
  50975. s1 = peg$FAILED;
  50976. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  50977. }
  50978. if (s1 !== peg$FAILED) {
  50979. s2 = peg$parseliteralArrayRest();
  50980. if (s2 !== peg$FAILED) {
  50981. peg$reportedPos = s0;
  50982. s1 = peg$c34(s2);
  50983. s0 = s1;
  50984. } else {
  50985. peg$currPos = s0;
  50986. s0 = peg$c1;
  50987. }
  50988. } else {
  50989. peg$currPos = s0;
  50990. s0 = peg$c1;
  50991. }
  50992. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  50993. return s0;
  50994. }
  50995. function peg$parseliteralArrayRest() {
  50996. var s0, s1, s2, s3, s4;
  50997. var key = peg$currPos * 60 + 19,
  50998. cached = peg$cache[key];
  50999. if (cached) {
  51000. peg$currPos = cached.nextPos;
  51001. return cached.result;
  51002. }
  51003. s0 = peg$currPos;
  51004. s1 = [];
  51005. s2 = peg$currPos;
  51006. s3 = peg$parsews();
  51007. if (s3 !== peg$FAILED) {
  51008. s4 = peg$parseparseTimeLiteral();
  51009. if (s4 === peg$FAILED) {
  51010. s4 = peg$parsebareLiteralArray();
  51011. if (s4 === peg$FAILED) {
  51012. s4 = peg$parsebareSymbol();
  51013. }
  51014. }
  51015. if (s4 !== peg$FAILED) {
  51016. peg$reportedPos = s2;
  51017. s3 = peg$c59(s4);
  51018. s2 = s3;
  51019. } else {
  51020. peg$currPos = s2;
  51021. s2 = peg$c1;
  51022. }
  51023. } else {
  51024. peg$currPos = s2;
  51025. s2 = peg$c1;
  51026. }
  51027. while (s2 !== peg$FAILED) {
  51028. s1.push(s2);
  51029. s2 = peg$currPos;
  51030. s3 = peg$parsews();
  51031. if (s3 !== peg$FAILED) {
  51032. s4 = peg$parseparseTimeLiteral();
  51033. if (s4 === peg$FAILED) {
  51034. s4 = peg$parsebareLiteralArray();
  51035. if (s4 === peg$FAILED) {
  51036. s4 = peg$parsebareSymbol();
  51037. }
  51038. }
  51039. if (s4 !== peg$FAILED) {
  51040. peg$reportedPos = s2;
  51041. s3 = peg$c59(s4);
  51042. s2 = s3;
  51043. } else {
  51044. peg$currPos = s2;
  51045. s2 = peg$c1;
  51046. }
  51047. } else {
  51048. peg$currPos = s2;
  51049. s2 = peg$c1;
  51050. }
  51051. }
  51052. if (s1 !== peg$FAILED) {
  51053. s2 = peg$parsews();
  51054. if (s2 !== peg$FAILED) {
  51055. if (input.charCodeAt(peg$currPos) === 41) {
  51056. s3 = peg$c60;
  51057. peg$currPos++;
  51058. } else {
  51059. s3 = peg$FAILED;
  51060. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  51061. }
  51062. if (s3 !== peg$FAILED) {
  51063. peg$reportedPos = s0;
  51064. s1 = peg$c62(s1);
  51065. s0 = s1;
  51066. } else {
  51067. peg$currPos = s0;
  51068. s0 = peg$c1;
  51069. }
  51070. } else {
  51071. peg$currPos = s0;
  51072. s0 = peg$c1;
  51073. }
  51074. } else {
  51075. peg$currPos = s0;
  51076. s0 = peg$c1;
  51077. }
  51078. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51079. return s0;
  51080. }
  51081. function peg$parsedynamicArray() {
  51082. var s0, s1, s2, s3, s4, s5, s6;
  51083. var key = peg$currPos * 60 + 20,
  51084. cached = peg$cache[key];
  51085. if (cached) {
  51086. peg$currPos = cached.nextPos;
  51087. return cached.result;
  51088. }
  51089. s0 = peg$currPos;
  51090. if (input.charCodeAt(peg$currPos) === 123) {
  51091. s1 = peg$c63;
  51092. peg$currPos++;
  51093. } else {
  51094. s1 = peg$FAILED;
  51095. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  51096. }
  51097. if (s1 !== peg$FAILED) {
  51098. s2 = peg$parsews();
  51099. if (s2 !== peg$FAILED) {
  51100. s3 = peg$parseexpressions();
  51101. if (s3 === peg$FAILED) {
  51102. s3 = peg$c41;
  51103. }
  51104. if (s3 !== peg$FAILED) {
  51105. s4 = peg$parsews();
  51106. if (s4 !== peg$FAILED) {
  51107. if (input.charCodeAt(peg$currPos) === 46) {
  51108. s5 = peg$c51;
  51109. peg$currPos++;
  51110. } else {
  51111. s5 = peg$FAILED;
  51112. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51113. }
  51114. if (s5 === peg$FAILED) {
  51115. s5 = peg$c41;
  51116. }
  51117. if (s5 !== peg$FAILED) {
  51118. if (input.charCodeAt(peg$currPos) === 125) {
  51119. s6 = peg$c65;
  51120. peg$currPos++;
  51121. } else {
  51122. s6 = peg$FAILED;
  51123. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  51124. }
  51125. if (s6 !== peg$FAILED) {
  51126. peg$reportedPos = s0;
  51127. s1 = peg$c67(s3);
  51128. s0 = s1;
  51129. } else {
  51130. peg$currPos = s0;
  51131. s0 = peg$c1;
  51132. }
  51133. } else {
  51134. peg$currPos = s0;
  51135. s0 = peg$c1;
  51136. }
  51137. } else {
  51138. peg$currPos = s0;
  51139. s0 = peg$c1;
  51140. }
  51141. } else {
  51142. peg$currPos = s0;
  51143. s0 = peg$c1;
  51144. }
  51145. } else {
  51146. peg$currPos = s0;
  51147. s0 = peg$c1;
  51148. }
  51149. } else {
  51150. peg$currPos = s0;
  51151. s0 = peg$c1;
  51152. }
  51153. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51154. return s0;
  51155. }
  51156. function peg$parsedynamicDictionary() {
  51157. var s0, s1, s2, s3, s4, s5;
  51158. var key = peg$currPos * 60 + 21,
  51159. cached = peg$cache[key];
  51160. if (cached) {
  51161. peg$currPos = cached.nextPos;
  51162. return cached.result;
  51163. }
  51164. s0 = peg$currPos;
  51165. if (input.substr(peg$currPos, 2) === peg$c68) {
  51166. s1 = peg$c68;
  51167. peg$currPos += 2;
  51168. } else {
  51169. s1 = peg$FAILED;
  51170. if (peg$silentFails === 0) { peg$fail(peg$c69); }
  51171. }
  51172. if (s1 !== peg$FAILED) {
  51173. s2 = peg$parsews();
  51174. if (s2 !== peg$FAILED) {
  51175. s3 = peg$parseassociations();
  51176. if (s3 === peg$FAILED) {
  51177. s3 = peg$c41;
  51178. }
  51179. if (s3 !== peg$FAILED) {
  51180. s4 = peg$parsews();
  51181. if (s4 !== peg$FAILED) {
  51182. if (input.charCodeAt(peg$currPos) === 125) {
  51183. s5 = peg$c65;
  51184. peg$currPos++;
  51185. } else {
  51186. s5 = peg$FAILED;
  51187. if (peg$silentFails === 0) { peg$fail(peg$c66); }
  51188. }
  51189. if (s5 !== peg$FAILED) {
  51190. peg$reportedPos = s0;
  51191. s1 = peg$c70(s3);
  51192. s0 = s1;
  51193. } else {
  51194. peg$currPos = s0;
  51195. s0 = peg$c1;
  51196. }
  51197. } else {
  51198. peg$currPos = s0;
  51199. s0 = peg$c1;
  51200. }
  51201. } else {
  51202. peg$currPos = s0;
  51203. s0 = peg$c1;
  51204. }
  51205. } else {
  51206. peg$currPos = s0;
  51207. s0 = peg$c1;
  51208. }
  51209. } else {
  51210. peg$currPos = s0;
  51211. s0 = peg$c1;
  51212. }
  51213. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51214. return s0;
  51215. }
  51216. function peg$parsepseudoVariable() {
  51217. var s0, s1, s2;
  51218. var key = peg$currPos * 60 + 22,
  51219. cached = peg$cache[key];
  51220. if (cached) {
  51221. peg$currPos = cached.nextPos;
  51222. return cached.result;
  51223. }
  51224. s0 = peg$currPos;
  51225. s1 = peg$currPos;
  51226. if (input.substr(peg$currPos, 4) === peg$c71) {
  51227. s2 = peg$c71;
  51228. peg$currPos += 4;
  51229. } else {
  51230. s2 = peg$FAILED;
  51231. if (peg$silentFails === 0) { peg$fail(peg$c72); }
  51232. }
  51233. if (s2 !== peg$FAILED) {
  51234. peg$reportedPos = s1;
  51235. s2 = peg$c73();
  51236. }
  51237. s1 = s2;
  51238. if (s1 === peg$FAILED) {
  51239. s1 = peg$currPos;
  51240. if (input.substr(peg$currPos, 5) === peg$c74) {
  51241. s2 = peg$c74;
  51242. peg$currPos += 5;
  51243. } else {
  51244. s2 = peg$FAILED;
  51245. if (peg$silentFails === 0) { peg$fail(peg$c75); }
  51246. }
  51247. if (s2 !== peg$FAILED) {
  51248. peg$reportedPos = s1;
  51249. s2 = peg$c76();
  51250. }
  51251. s1 = s2;
  51252. if (s1 === peg$FAILED) {
  51253. s1 = peg$currPos;
  51254. if (input.substr(peg$currPos, 3) === peg$c77) {
  51255. s2 = peg$c77;
  51256. peg$currPos += 3;
  51257. } else {
  51258. s2 = peg$FAILED;
  51259. if (peg$silentFails === 0) { peg$fail(peg$c78); }
  51260. }
  51261. if (s2 !== peg$FAILED) {
  51262. peg$reportedPos = s1;
  51263. s2 = peg$c79();
  51264. }
  51265. s1 = s2;
  51266. }
  51267. }
  51268. if (s1 !== peg$FAILED) {
  51269. peg$reportedPos = s0;
  51270. s1 = peg$c80(s1);
  51271. }
  51272. s0 = s1;
  51273. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51274. return s0;
  51275. }
  51276. function peg$parseparseTimeLiteral() {
  51277. var s0;
  51278. var key = peg$currPos * 60 + 23,
  51279. cached = peg$cache[key];
  51280. if (cached) {
  51281. peg$currPos = cached.nextPos;
  51282. return cached.result;
  51283. }
  51284. s0 = peg$parsepseudoVariable();
  51285. if (s0 === peg$FAILED) {
  51286. s0 = peg$parsenumber();
  51287. if (s0 === peg$FAILED) {
  51288. s0 = peg$parseliteralArray();
  51289. if (s0 === peg$FAILED) {
  51290. s0 = peg$parsestring();
  51291. if (s0 === peg$FAILED) {
  51292. s0 = peg$parsesymbol();
  51293. if (s0 === peg$FAILED) {
  51294. s0 = peg$parsecharacter();
  51295. }
  51296. }
  51297. }
  51298. }
  51299. }
  51300. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51301. return s0;
  51302. }
  51303. function peg$parseruntimeLiteral() {
  51304. var s0;
  51305. var key = peg$currPos * 60 + 24,
  51306. cached = peg$cache[key];
  51307. if (cached) {
  51308. peg$currPos = cached.nextPos;
  51309. return cached.result;
  51310. }
  51311. s0 = peg$parsedynamicDictionary();
  51312. if (s0 === peg$FAILED) {
  51313. s0 = peg$parsedynamicArray();
  51314. if (s0 === peg$FAILED) {
  51315. s0 = peg$parseblock();
  51316. }
  51317. }
  51318. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51319. return s0;
  51320. }
  51321. function peg$parseliteral() {
  51322. var s0;
  51323. var key = peg$currPos * 60 + 25,
  51324. cached = peg$cache[key];
  51325. if (cached) {
  51326. peg$currPos = cached.nextPos;
  51327. return cached.result;
  51328. }
  51329. s0 = peg$parseruntimeLiteral();
  51330. if (s0 === peg$FAILED) {
  51331. s0 = peg$parseparseTimeLiteral();
  51332. }
  51333. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51334. return s0;
  51335. }
  51336. function peg$parsevariable() {
  51337. var s0, s1;
  51338. var key = peg$currPos * 60 + 26,
  51339. cached = peg$cache[key];
  51340. if (cached) {
  51341. peg$currPos = cached.nextPos;
  51342. return cached.result;
  51343. }
  51344. s0 = peg$currPos;
  51345. s1 = peg$parseidentifier();
  51346. if (s1 !== peg$FAILED) {
  51347. peg$reportedPos = s0;
  51348. s1 = peg$c81(s1);
  51349. }
  51350. s0 = s1;
  51351. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51352. return s0;
  51353. }
  51354. function peg$parsekeywordPair() {
  51355. var s0, s1, s2, s3, s4;
  51356. var key = peg$currPos * 60 + 27,
  51357. cached = peg$cache[key];
  51358. if (cached) {
  51359. peg$currPos = cached.nextPos;
  51360. return cached.result;
  51361. }
  51362. s0 = peg$currPos;
  51363. s1 = peg$parsews();
  51364. if (s1 !== peg$FAILED) {
  51365. s2 = peg$parsekeyword();
  51366. if (s2 !== peg$FAILED) {
  51367. s3 = peg$parsews();
  51368. if (s3 !== peg$FAILED) {
  51369. s4 = peg$parsebinarySend();
  51370. if (s4 !== peg$FAILED) {
  51371. peg$reportedPos = s0;
  51372. s1 = peg$c82(s2, s4);
  51373. s0 = s1;
  51374. } else {
  51375. peg$currPos = s0;
  51376. s0 = peg$c1;
  51377. }
  51378. } else {
  51379. peg$currPos = s0;
  51380. s0 = peg$c1;
  51381. }
  51382. } else {
  51383. peg$currPos = s0;
  51384. s0 = peg$c1;
  51385. }
  51386. } else {
  51387. peg$currPos = s0;
  51388. s0 = peg$c1;
  51389. }
  51390. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51391. return s0;
  51392. }
  51393. function peg$parsebinarySelector() {
  51394. var s0, s1, s2;
  51395. var key = peg$currPos * 60 + 28,
  51396. cached = peg$cache[key];
  51397. if (cached) {
  51398. peg$currPos = cached.nextPos;
  51399. return cached.result;
  51400. }
  51401. s0 = peg$currPos;
  51402. s1 = [];
  51403. if (peg$c83.test(input.charAt(peg$currPos))) {
  51404. s2 = input.charAt(peg$currPos);
  51405. peg$currPos++;
  51406. } else {
  51407. s2 = peg$FAILED;
  51408. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  51409. }
  51410. if (s2 !== peg$FAILED) {
  51411. while (s2 !== peg$FAILED) {
  51412. s1.push(s2);
  51413. if (peg$c83.test(input.charAt(peg$currPos))) {
  51414. s2 = input.charAt(peg$currPos);
  51415. peg$currPos++;
  51416. } else {
  51417. s2 = peg$FAILED;
  51418. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  51419. }
  51420. }
  51421. } else {
  51422. s1 = peg$c1;
  51423. }
  51424. if (s1 !== peg$FAILED) {
  51425. peg$reportedPos = s0;
  51426. s1 = peg$c85(s1);
  51427. }
  51428. s0 = s1;
  51429. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51430. return s0;
  51431. }
  51432. function peg$parsekeywordPattern() {
  51433. var s0, s1, s2, s3, s4, s5, s6;
  51434. var key = peg$currPos * 60 + 29,
  51435. cached = peg$cache[key];
  51436. if (cached) {
  51437. peg$currPos = cached.nextPos;
  51438. return cached.result;
  51439. }
  51440. s0 = peg$currPos;
  51441. s1 = [];
  51442. s2 = peg$currPos;
  51443. s3 = peg$parsews();
  51444. if (s3 !== peg$FAILED) {
  51445. s4 = peg$parsekeyword();
  51446. if (s4 !== peg$FAILED) {
  51447. s5 = peg$parsews();
  51448. if (s5 !== peg$FAILED) {
  51449. s6 = peg$parseidentifier();
  51450. if (s6 !== peg$FAILED) {
  51451. peg$reportedPos = s2;
  51452. s3 = peg$c82(s4, s6);
  51453. s2 = s3;
  51454. } else {
  51455. peg$currPos = s2;
  51456. s2 = peg$c1;
  51457. }
  51458. } else {
  51459. peg$currPos = s2;
  51460. s2 = peg$c1;
  51461. }
  51462. } else {
  51463. peg$currPos = s2;
  51464. s2 = peg$c1;
  51465. }
  51466. } else {
  51467. peg$currPos = s2;
  51468. s2 = peg$c1;
  51469. }
  51470. if (s2 !== peg$FAILED) {
  51471. while (s2 !== peg$FAILED) {
  51472. s1.push(s2);
  51473. s2 = peg$currPos;
  51474. s3 = peg$parsews();
  51475. if (s3 !== peg$FAILED) {
  51476. s4 = peg$parsekeyword();
  51477. if (s4 !== peg$FAILED) {
  51478. s5 = peg$parsews();
  51479. if (s5 !== peg$FAILED) {
  51480. s6 = peg$parseidentifier();
  51481. if (s6 !== peg$FAILED) {
  51482. peg$reportedPos = s2;
  51483. s3 = peg$c82(s4, s6);
  51484. s2 = s3;
  51485. } else {
  51486. peg$currPos = s2;
  51487. s2 = peg$c1;
  51488. }
  51489. } else {
  51490. peg$currPos = s2;
  51491. s2 = peg$c1;
  51492. }
  51493. } else {
  51494. peg$currPos = s2;
  51495. s2 = peg$c1;
  51496. }
  51497. } else {
  51498. peg$currPos = s2;
  51499. s2 = peg$c1;
  51500. }
  51501. }
  51502. } else {
  51503. s1 = peg$c1;
  51504. }
  51505. if (s1 !== peg$FAILED) {
  51506. peg$reportedPos = s0;
  51507. s1 = peg$c86(s1);
  51508. }
  51509. s0 = s1;
  51510. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51511. return s0;
  51512. }
  51513. function peg$parsebinaryPattern() {
  51514. var s0, s1, s2, s3, s4;
  51515. var key = peg$currPos * 60 + 30,
  51516. cached = peg$cache[key];
  51517. if (cached) {
  51518. peg$currPos = cached.nextPos;
  51519. return cached.result;
  51520. }
  51521. s0 = peg$currPos;
  51522. s1 = peg$parsews();
  51523. if (s1 !== peg$FAILED) {
  51524. s2 = peg$parsebinarySelector();
  51525. if (s2 !== peg$FAILED) {
  51526. s3 = peg$parsews();
  51527. if (s3 !== peg$FAILED) {
  51528. s4 = peg$parseidentifier();
  51529. if (s4 !== peg$FAILED) {
  51530. peg$reportedPos = s0;
  51531. s1 = peg$c87(s2, s4);
  51532. s0 = s1;
  51533. } else {
  51534. peg$currPos = s0;
  51535. s0 = peg$c1;
  51536. }
  51537. } else {
  51538. peg$currPos = s0;
  51539. s0 = peg$c1;
  51540. }
  51541. } else {
  51542. peg$currPos = s0;
  51543. s0 = peg$c1;
  51544. }
  51545. } else {
  51546. peg$currPos = s0;
  51547. s0 = peg$c1;
  51548. }
  51549. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51550. return s0;
  51551. }
  51552. function peg$parseunaryPattern() {
  51553. var s0, s1, s2;
  51554. var key = peg$currPos * 60 + 31,
  51555. cached = peg$cache[key];
  51556. if (cached) {
  51557. peg$currPos = cached.nextPos;
  51558. return cached.result;
  51559. }
  51560. s0 = peg$currPos;
  51561. s1 = peg$parsews();
  51562. if (s1 !== peg$FAILED) {
  51563. s2 = peg$parseidentifier();
  51564. if (s2 !== peg$FAILED) {
  51565. peg$reportedPos = s0;
  51566. s1 = peg$c88(s2);
  51567. s0 = s1;
  51568. } else {
  51569. peg$currPos = s0;
  51570. s0 = peg$c1;
  51571. }
  51572. } else {
  51573. peg$currPos = s0;
  51574. s0 = peg$c1;
  51575. }
  51576. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51577. return s0;
  51578. }
  51579. function peg$parseexpression() {
  51580. var s0;
  51581. var key = peg$currPos * 60 + 32,
  51582. cached = peg$cache[key];
  51583. if (cached) {
  51584. peg$currPos = cached.nextPos;
  51585. return cached.result;
  51586. }
  51587. s0 = peg$parseassignment();
  51588. if (s0 === peg$FAILED) {
  51589. s0 = peg$parsecascade();
  51590. if (s0 === peg$FAILED) {
  51591. s0 = peg$parsekeywordSend();
  51592. if (s0 === peg$FAILED) {
  51593. s0 = peg$parsebinarySend();
  51594. }
  51595. }
  51596. }
  51597. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51598. return s0;
  51599. }
  51600. function peg$parseexpressionList() {
  51601. var s0, s1, s2, s3, s4;
  51602. var key = peg$currPos * 60 + 33,
  51603. cached = peg$cache[key];
  51604. if (cached) {
  51605. peg$currPos = cached.nextPos;
  51606. return cached.result;
  51607. }
  51608. s0 = peg$currPos;
  51609. s1 = peg$parsews();
  51610. if (s1 !== peg$FAILED) {
  51611. if (input.charCodeAt(peg$currPos) === 46) {
  51612. s2 = peg$c51;
  51613. peg$currPos++;
  51614. } else {
  51615. s2 = peg$FAILED;
  51616. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51617. }
  51618. if (s2 !== peg$FAILED) {
  51619. s3 = peg$parsews();
  51620. if (s3 !== peg$FAILED) {
  51621. s4 = peg$parseexpression();
  51622. if (s4 !== peg$FAILED) {
  51623. peg$reportedPos = s0;
  51624. s1 = peg$c89(s4);
  51625. s0 = s1;
  51626. } else {
  51627. peg$currPos = s0;
  51628. s0 = peg$c1;
  51629. }
  51630. } else {
  51631. peg$currPos = s0;
  51632. s0 = peg$c1;
  51633. }
  51634. } else {
  51635. peg$currPos = s0;
  51636. s0 = peg$c1;
  51637. }
  51638. } else {
  51639. peg$currPos = s0;
  51640. s0 = peg$c1;
  51641. }
  51642. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51643. return s0;
  51644. }
  51645. function peg$parseexpressions() {
  51646. var s0, s1, s2, s3;
  51647. var key = peg$currPos * 60 + 34,
  51648. cached = peg$cache[key];
  51649. if (cached) {
  51650. peg$currPos = cached.nextPos;
  51651. return cached.result;
  51652. }
  51653. s0 = peg$currPos;
  51654. s1 = peg$parseexpression();
  51655. if (s1 !== peg$FAILED) {
  51656. s2 = [];
  51657. s3 = peg$parseexpressionList();
  51658. while (s3 !== peg$FAILED) {
  51659. s2.push(s3);
  51660. s3 = peg$parseexpressionList();
  51661. }
  51662. if (s2 !== peg$FAILED) {
  51663. peg$reportedPos = s0;
  51664. s1 = peg$c90(s1, s2);
  51665. s0 = s1;
  51666. } else {
  51667. peg$currPos = s0;
  51668. s0 = peg$c1;
  51669. }
  51670. } else {
  51671. peg$currPos = s0;
  51672. s0 = peg$c1;
  51673. }
  51674. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51675. return s0;
  51676. }
  51677. function peg$parseassignment() {
  51678. var s0, s1, s2, s3, s4, s5;
  51679. var key = peg$currPos * 60 + 35,
  51680. cached = peg$cache[key];
  51681. if (cached) {
  51682. peg$currPos = cached.nextPos;
  51683. return cached.result;
  51684. }
  51685. s0 = peg$currPos;
  51686. s1 = peg$parsevariable();
  51687. if (s1 !== peg$FAILED) {
  51688. s2 = peg$parsews();
  51689. if (s2 !== peg$FAILED) {
  51690. if (input.substr(peg$currPos, 2) === peg$c91) {
  51691. s3 = peg$c91;
  51692. peg$currPos += 2;
  51693. } else {
  51694. s3 = peg$FAILED;
  51695. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  51696. }
  51697. if (s3 !== peg$FAILED) {
  51698. s4 = peg$parsews();
  51699. if (s4 !== peg$FAILED) {
  51700. s5 = peg$parseexpression();
  51701. if (s5 !== peg$FAILED) {
  51702. peg$reportedPos = s0;
  51703. s1 = peg$c93(s1, s5);
  51704. s0 = s1;
  51705. } else {
  51706. peg$currPos = s0;
  51707. s0 = peg$c1;
  51708. }
  51709. } else {
  51710. peg$currPos = s0;
  51711. s0 = peg$c1;
  51712. }
  51713. } else {
  51714. peg$currPos = s0;
  51715. s0 = peg$c1;
  51716. }
  51717. } else {
  51718. peg$currPos = s0;
  51719. s0 = peg$c1;
  51720. }
  51721. } else {
  51722. peg$currPos = s0;
  51723. s0 = peg$c1;
  51724. }
  51725. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51726. return s0;
  51727. }
  51728. function peg$parseret() {
  51729. var s0, s1, s2, s3, s4, s5;
  51730. var key = peg$currPos * 60 + 36,
  51731. cached = peg$cache[key];
  51732. if (cached) {
  51733. peg$currPos = cached.nextPos;
  51734. return cached.result;
  51735. }
  51736. s0 = peg$currPos;
  51737. if (input.charCodeAt(peg$currPos) === 94) {
  51738. s1 = peg$c94;
  51739. peg$currPos++;
  51740. } else {
  51741. s1 = peg$FAILED;
  51742. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  51743. }
  51744. if (s1 !== peg$FAILED) {
  51745. s2 = peg$parsews();
  51746. if (s2 !== peg$FAILED) {
  51747. s3 = peg$parseexpression();
  51748. if (s3 !== peg$FAILED) {
  51749. s4 = peg$parsews();
  51750. if (s4 !== peg$FAILED) {
  51751. if (input.charCodeAt(peg$currPos) === 46) {
  51752. s5 = peg$c51;
  51753. peg$currPos++;
  51754. } else {
  51755. s5 = peg$FAILED;
  51756. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  51757. }
  51758. if (s5 === peg$FAILED) {
  51759. s5 = peg$c41;
  51760. }
  51761. if (s5 !== peg$FAILED) {
  51762. peg$reportedPos = s0;
  51763. s1 = peg$c96(s3);
  51764. s0 = s1;
  51765. } else {
  51766. peg$currPos = s0;
  51767. s0 = peg$c1;
  51768. }
  51769. } else {
  51770. peg$currPos = s0;
  51771. s0 = peg$c1;
  51772. }
  51773. } else {
  51774. peg$currPos = s0;
  51775. s0 = peg$c1;
  51776. }
  51777. } else {
  51778. peg$currPos = s0;
  51779. s0 = peg$c1;
  51780. }
  51781. } else {
  51782. peg$currPos = s0;
  51783. s0 = peg$c1;
  51784. }
  51785. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51786. return s0;
  51787. }
  51788. function peg$parsetemps() {
  51789. var s0, s1, s2, s3, s4, s5;
  51790. var key = peg$currPos * 60 + 37,
  51791. cached = peg$cache[key];
  51792. if (cached) {
  51793. peg$currPos = cached.nextPos;
  51794. return cached.result;
  51795. }
  51796. s0 = peg$currPos;
  51797. if (input.charCodeAt(peg$currPos) === 124) {
  51798. s1 = peg$c97;
  51799. peg$currPos++;
  51800. } else {
  51801. s1 = peg$FAILED;
  51802. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51803. }
  51804. if (s1 !== peg$FAILED) {
  51805. s2 = [];
  51806. s3 = peg$currPos;
  51807. s4 = peg$parsews();
  51808. if (s4 !== peg$FAILED) {
  51809. s5 = peg$parseidentifier();
  51810. if (s5 !== peg$FAILED) {
  51811. peg$reportedPos = s3;
  51812. s4 = peg$c99(s5);
  51813. s3 = s4;
  51814. } else {
  51815. peg$currPos = s3;
  51816. s3 = peg$c1;
  51817. }
  51818. } else {
  51819. peg$currPos = s3;
  51820. s3 = peg$c1;
  51821. }
  51822. while (s3 !== peg$FAILED) {
  51823. s2.push(s3);
  51824. s3 = peg$currPos;
  51825. s4 = peg$parsews();
  51826. if (s4 !== peg$FAILED) {
  51827. s5 = peg$parseidentifier();
  51828. if (s5 !== peg$FAILED) {
  51829. peg$reportedPos = s3;
  51830. s4 = peg$c99(s5);
  51831. s3 = s4;
  51832. } else {
  51833. peg$currPos = s3;
  51834. s3 = peg$c1;
  51835. }
  51836. } else {
  51837. peg$currPos = s3;
  51838. s3 = peg$c1;
  51839. }
  51840. }
  51841. if (s2 !== peg$FAILED) {
  51842. s3 = peg$parsews();
  51843. if (s3 !== peg$FAILED) {
  51844. if (input.charCodeAt(peg$currPos) === 124) {
  51845. s4 = peg$c97;
  51846. peg$currPos++;
  51847. } else {
  51848. s4 = peg$FAILED;
  51849. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51850. }
  51851. if (s4 !== peg$FAILED) {
  51852. peg$reportedPos = s0;
  51853. s1 = peg$c100(s2);
  51854. s0 = s1;
  51855. } else {
  51856. peg$currPos = s0;
  51857. s0 = peg$c1;
  51858. }
  51859. } else {
  51860. peg$currPos = s0;
  51861. s0 = peg$c1;
  51862. }
  51863. } else {
  51864. peg$currPos = s0;
  51865. s0 = peg$c1;
  51866. }
  51867. } else {
  51868. peg$currPos = s0;
  51869. s0 = peg$c1;
  51870. }
  51871. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51872. return s0;
  51873. }
  51874. function peg$parseblockParamList() {
  51875. var s0, s1, s2, s3, s4, s5, s6;
  51876. var key = peg$currPos * 60 + 38,
  51877. cached = peg$cache[key];
  51878. if (cached) {
  51879. peg$currPos = cached.nextPos;
  51880. return cached.result;
  51881. }
  51882. s0 = peg$currPos;
  51883. s1 = [];
  51884. s2 = peg$currPos;
  51885. s3 = peg$parsews();
  51886. if (s3 !== peg$FAILED) {
  51887. if (input.charCodeAt(peg$currPos) === 58) {
  51888. s4 = peg$c13;
  51889. peg$currPos++;
  51890. } else {
  51891. s4 = peg$FAILED;
  51892. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  51893. }
  51894. if (s4 !== peg$FAILED) {
  51895. s5 = peg$parsews();
  51896. if (s5 !== peg$FAILED) {
  51897. s6 = peg$parseidentifier();
  51898. if (s6 !== peg$FAILED) {
  51899. peg$reportedPos = s2;
  51900. s3 = peg$c101(s6);
  51901. s2 = s3;
  51902. } else {
  51903. peg$currPos = s2;
  51904. s2 = peg$c1;
  51905. }
  51906. } else {
  51907. peg$currPos = s2;
  51908. s2 = peg$c1;
  51909. }
  51910. } else {
  51911. peg$currPos = s2;
  51912. s2 = peg$c1;
  51913. }
  51914. } else {
  51915. peg$currPos = s2;
  51916. s2 = peg$c1;
  51917. }
  51918. if (s2 !== peg$FAILED) {
  51919. while (s2 !== peg$FAILED) {
  51920. s1.push(s2);
  51921. s2 = peg$currPos;
  51922. s3 = peg$parsews();
  51923. if (s3 !== peg$FAILED) {
  51924. if (input.charCodeAt(peg$currPos) === 58) {
  51925. s4 = peg$c13;
  51926. peg$currPos++;
  51927. } else {
  51928. s4 = peg$FAILED;
  51929. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  51930. }
  51931. if (s4 !== peg$FAILED) {
  51932. s5 = peg$parsews();
  51933. if (s5 !== peg$FAILED) {
  51934. s6 = peg$parseidentifier();
  51935. if (s6 !== peg$FAILED) {
  51936. peg$reportedPos = s2;
  51937. s3 = peg$c101(s6);
  51938. s2 = s3;
  51939. } else {
  51940. peg$currPos = s2;
  51941. s2 = peg$c1;
  51942. }
  51943. } else {
  51944. peg$currPos = s2;
  51945. s2 = peg$c1;
  51946. }
  51947. } else {
  51948. peg$currPos = s2;
  51949. s2 = peg$c1;
  51950. }
  51951. } else {
  51952. peg$currPos = s2;
  51953. s2 = peg$c1;
  51954. }
  51955. }
  51956. } else {
  51957. s1 = peg$c1;
  51958. }
  51959. if (s1 !== peg$FAILED) {
  51960. s2 = peg$parsews();
  51961. if (s2 !== peg$FAILED) {
  51962. if (input.charCodeAt(peg$currPos) === 124) {
  51963. s3 = peg$c97;
  51964. peg$currPos++;
  51965. } else {
  51966. s3 = peg$FAILED;
  51967. if (peg$silentFails === 0) { peg$fail(peg$c98); }
  51968. }
  51969. if (s3 !== peg$FAILED) {
  51970. peg$reportedPos = s0;
  51971. s1 = peg$c102(s1);
  51972. s0 = s1;
  51973. } else {
  51974. peg$currPos = s0;
  51975. s0 = peg$c1;
  51976. }
  51977. } else {
  51978. peg$currPos = s0;
  51979. s0 = peg$c1;
  51980. }
  51981. } else {
  51982. peg$currPos = s0;
  51983. s0 = peg$c1;
  51984. }
  51985. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  51986. return s0;
  51987. }
  51988. function peg$parsesubexpression() {
  51989. var s0, s1, s2, s3, s4, s5;
  51990. var key = peg$currPos * 60 + 39,
  51991. cached = peg$cache[key];
  51992. if (cached) {
  51993. peg$currPos = cached.nextPos;
  51994. return cached.result;
  51995. }
  51996. s0 = peg$currPos;
  51997. if (input.charCodeAt(peg$currPos) === 40) {
  51998. s1 = peg$c57;
  51999. peg$currPos++;
  52000. } else {
  52001. s1 = peg$FAILED;
  52002. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  52003. }
  52004. if (s1 !== peg$FAILED) {
  52005. s2 = peg$parsews();
  52006. if (s2 !== peg$FAILED) {
  52007. s3 = peg$parseexpression();
  52008. if (s3 !== peg$FAILED) {
  52009. s4 = peg$parsews();
  52010. if (s4 !== peg$FAILED) {
  52011. if (input.charCodeAt(peg$currPos) === 41) {
  52012. s5 = peg$c60;
  52013. peg$currPos++;
  52014. } else {
  52015. s5 = peg$FAILED;
  52016. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  52017. }
  52018. if (s5 !== peg$FAILED) {
  52019. peg$reportedPos = s0;
  52020. s1 = peg$c89(s3);
  52021. s0 = s1;
  52022. } else {
  52023. peg$currPos = s0;
  52024. s0 = peg$c1;
  52025. }
  52026. } else {
  52027. peg$currPos = s0;
  52028. s0 = peg$c1;
  52029. }
  52030. } else {
  52031. peg$currPos = s0;
  52032. s0 = peg$c1;
  52033. }
  52034. } else {
  52035. peg$currPos = s0;
  52036. s0 = peg$c1;
  52037. }
  52038. } else {
  52039. peg$currPos = s0;
  52040. s0 = peg$c1;
  52041. }
  52042. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52043. return s0;
  52044. }
  52045. function peg$parsestatements() {
  52046. var s0, s1, s2, s3, s4, s5, s6, s7;
  52047. var key = peg$currPos * 60 + 40,
  52048. cached = peg$cache[key];
  52049. if (cached) {
  52050. peg$currPos = cached.nextPos;
  52051. return cached.result;
  52052. }
  52053. s0 = peg$currPos;
  52054. s1 = peg$parseret();
  52055. if (s1 !== peg$FAILED) {
  52056. s2 = [];
  52057. if (input.charCodeAt(peg$currPos) === 46) {
  52058. s3 = peg$c51;
  52059. peg$currPos++;
  52060. } else {
  52061. s3 = peg$FAILED;
  52062. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52063. }
  52064. while (s3 !== peg$FAILED) {
  52065. s2.push(s3);
  52066. if (input.charCodeAt(peg$currPos) === 46) {
  52067. s3 = peg$c51;
  52068. peg$currPos++;
  52069. } else {
  52070. s3 = peg$FAILED;
  52071. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52072. }
  52073. }
  52074. if (s2 !== peg$FAILED) {
  52075. peg$reportedPos = s0;
  52076. s1 = peg$c103(s1);
  52077. s0 = s1;
  52078. } else {
  52079. peg$currPos = s0;
  52080. s0 = peg$c1;
  52081. }
  52082. } else {
  52083. peg$currPos = s0;
  52084. s0 = peg$c1;
  52085. }
  52086. if (s0 === peg$FAILED) {
  52087. s0 = peg$currPos;
  52088. s1 = peg$parseexpressions();
  52089. if (s1 !== peg$FAILED) {
  52090. s2 = peg$parsews();
  52091. if (s2 !== peg$FAILED) {
  52092. s3 = [];
  52093. if (input.charCodeAt(peg$currPos) === 46) {
  52094. s4 = peg$c51;
  52095. peg$currPos++;
  52096. } else {
  52097. s4 = peg$FAILED;
  52098. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52099. }
  52100. if (s4 !== peg$FAILED) {
  52101. while (s4 !== peg$FAILED) {
  52102. s3.push(s4);
  52103. if (input.charCodeAt(peg$currPos) === 46) {
  52104. s4 = peg$c51;
  52105. peg$currPos++;
  52106. } else {
  52107. s4 = peg$FAILED;
  52108. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52109. }
  52110. }
  52111. } else {
  52112. s3 = peg$c1;
  52113. }
  52114. if (s3 !== peg$FAILED) {
  52115. s4 = peg$parsews();
  52116. if (s4 !== peg$FAILED) {
  52117. s5 = peg$parseret();
  52118. if (s5 !== peg$FAILED) {
  52119. s6 = [];
  52120. if (input.charCodeAt(peg$currPos) === 46) {
  52121. s7 = peg$c51;
  52122. peg$currPos++;
  52123. } else {
  52124. s7 = peg$FAILED;
  52125. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52126. }
  52127. while (s7 !== peg$FAILED) {
  52128. s6.push(s7);
  52129. if (input.charCodeAt(peg$currPos) === 46) {
  52130. s7 = peg$c51;
  52131. peg$currPos++;
  52132. } else {
  52133. s7 = peg$FAILED;
  52134. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52135. }
  52136. }
  52137. if (s6 !== peg$FAILED) {
  52138. peg$reportedPos = s0;
  52139. s1 = peg$c104(s1, s5);
  52140. s0 = s1;
  52141. } else {
  52142. peg$currPos = s0;
  52143. s0 = peg$c1;
  52144. }
  52145. } else {
  52146. peg$currPos = s0;
  52147. s0 = peg$c1;
  52148. }
  52149. } else {
  52150. peg$currPos = s0;
  52151. s0 = peg$c1;
  52152. }
  52153. } else {
  52154. peg$currPos = s0;
  52155. s0 = peg$c1;
  52156. }
  52157. } else {
  52158. peg$currPos = s0;
  52159. s0 = peg$c1;
  52160. }
  52161. } else {
  52162. peg$currPos = s0;
  52163. s0 = peg$c1;
  52164. }
  52165. if (s0 === peg$FAILED) {
  52166. s0 = peg$currPos;
  52167. s1 = peg$parseexpressions();
  52168. if (s1 === peg$FAILED) {
  52169. s1 = peg$c41;
  52170. }
  52171. if (s1 !== peg$FAILED) {
  52172. s2 = [];
  52173. if (input.charCodeAt(peg$currPos) === 46) {
  52174. s3 = peg$c51;
  52175. peg$currPos++;
  52176. } else {
  52177. s3 = peg$FAILED;
  52178. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52179. }
  52180. while (s3 !== peg$FAILED) {
  52181. s2.push(s3);
  52182. if (input.charCodeAt(peg$currPos) === 46) {
  52183. s3 = peg$c51;
  52184. peg$currPos++;
  52185. } else {
  52186. s3 = peg$FAILED;
  52187. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52188. }
  52189. }
  52190. if (s2 !== peg$FAILED) {
  52191. peg$reportedPos = s0;
  52192. s1 = peg$c105(s1);
  52193. s0 = s1;
  52194. } else {
  52195. peg$currPos = s0;
  52196. s0 = peg$c1;
  52197. }
  52198. } else {
  52199. peg$currPos = s0;
  52200. s0 = peg$c1;
  52201. }
  52202. }
  52203. }
  52204. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52205. return s0;
  52206. }
  52207. function peg$parsesequence() {
  52208. var s0;
  52209. var key = peg$currPos * 60 + 41,
  52210. cached = peg$cache[key];
  52211. if (cached) {
  52212. peg$currPos = cached.nextPos;
  52213. return cached.result;
  52214. }
  52215. s0 = peg$parsejsStatement();
  52216. if (s0 === peg$FAILED) {
  52217. s0 = peg$parsestSequence();
  52218. }
  52219. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52220. return s0;
  52221. }
  52222. function peg$parsestSequence() {
  52223. var s0, s1, s2, s3, s4;
  52224. var key = peg$currPos * 60 + 42,
  52225. cached = peg$cache[key];
  52226. if (cached) {
  52227. peg$currPos = cached.nextPos;
  52228. return cached.result;
  52229. }
  52230. s0 = peg$currPos;
  52231. s1 = peg$parsetemps();
  52232. if (s1 === peg$FAILED) {
  52233. s1 = peg$c41;
  52234. }
  52235. if (s1 !== peg$FAILED) {
  52236. s2 = peg$parsews();
  52237. if (s2 !== peg$FAILED) {
  52238. s3 = peg$parsestatements();
  52239. if (s3 === peg$FAILED) {
  52240. s3 = peg$c41;
  52241. }
  52242. if (s3 !== peg$FAILED) {
  52243. s4 = peg$parsews();
  52244. if (s4 !== peg$FAILED) {
  52245. peg$reportedPos = s0;
  52246. s1 = peg$c106(s1, s3);
  52247. s0 = s1;
  52248. } else {
  52249. peg$currPos = s0;
  52250. s0 = peg$c1;
  52251. }
  52252. } else {
  52253. peg$currPos = s0;
  52254. s0 = peg$c1;
  52255. }
  52256. } else {
  52257. peg$currPos = s0;
  52258. s0 = peg$c1;
  52259. }
  52260. } else {
  52261. peg$currPos = s0;
  52262. s0 = peg$c1;
  52263. }
  52264. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52265. return s0;
  52266. }
  52267. function peg$parseblock() {
  52268. var s0, s1, s2, s3, s4, s5, s6;
  52269. var key = peg$currPos * 60 + 43,
  52270. cached = peg$cache[key];
  52271. if (cached) {
  52272. peg$currPos = cached.nextPos;
  52273. return cached.result;
  52274. }
  52275. s0 = peg$currPos;
  52276. if (input.charCodeAt(peg$currPos) === 91) {
  52277. s1 = peg$c107;
  52278. peg$currPos++;
  52279. } else {
  52280. s1 = peg$FAILED;
  52281. if (peg$silentFails === 0) { peg$fail(peg$c108); }
  52282. }
  52283. if (s1 !== peg$FAILED) {
  52284. s2 = peg$parseblockParamList();
  52285. if (s2 === peg$FAILED) {
  52286. s2 = peg$c41;
  52287. }
  52288. if (s2 !== peg$FAILED) {
  52289. s3 = peg$parsews();
  52290. if (s3 !== peg$FAILED) {
  52291. s4 = peg$parsesequence();
  52292. if (s4 === peg$FAILED) {
  52293. s4 = peg$c41;
  52294. }
  52295. if (s4 !== peg$FAILED) {
  52296. s5 = peg$parsews();
  52297. if (s5 !== peg$FAILED) {
  52298. if (input.charCodeAt(peg$currPos) === 93) {
  52299. s6 = peg$c109;
  52300. peg$currPos++;
  52301. } else {
  52302. s6 = peg$FAILED;
  52303. if (peg$silentFails === 0) { peg$fail(peg$c110); }
  52304. }
  52305. if (s6 !== peg$FAILED) {
  52306. peg$reportedPos = s0;
  52307. s1 = peg$c111(s2, s4);
  52308. s0 = s1;
  52309. } else {
  52310. peg$currPos = s0;
  52311. s0 = peg$c1;
  52312. }
  52313. } else {
  52314. peg$currPos = s0;
  52315. s0 = peg$c1;
  52316. }
  52317. } else {
  52318. peg$currPos = s0;
  52319. s0 = peg$c1;
  52320. }
  52321. } else {
  52322. peg$currPos = s0;
  52323. s0 = peg$c1;
  52324. }
  52325. } else {
  52326. peg$currPos = s0;
  52327. s0 = peg$c1;
  52328. }
  52329. } else {
  52330. peg$currPos = s0;
  52331. s0 = peg$c1;
  52332. }
  52333. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52334. return s0;
  52335. }
  52336. function peg$parseoperand() {
  52337. var s0;
  52338. var key = peg$currPos * 60 + 44,
  52339. cached = peg$cache[key];
  52340. if (cached) {
  52341. peg$currPos = cached.nextPos;
  52342. return cached.result;
  52343. }
  52344. s0 = peg$parseliteral();
  52345. if (s0 === peg$FAILED) {
  52346. s0 = peg$parsevariable();
  52347. if (s0 === peg$FAILED) {
  52348. s0 = peg$parsesubexpression();
  52349. }
  52350. }
  52351. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52352. return s0;
  52353. }
  52354. function peg$parseunaryMessage() {
  52355. var s0, s1, s2, s3, s4;
  52356. var key = peg$currPos * 60 + 45,
  52357. cached = peg$cache[key];
  52358. if (cached) {
  52359. peg$currPos = cached.nextPos;
  52360. return cached.result;
  52361. }
  52362. s0 = peg$currPos;
  52363. s1 = peg$parsews();
  52364. if (s1 !== peg$FAILED) {
  52365. s2 = peg$parseidentifier();
  52366. if (s2 !== peg$FAILED) {
  52367. s3 = peg$currPos;
  52368. peg$silentFails++;
  52369. if (input.charCodeAt(peg$currPos) === 58) {
  52370. s4 = peg$c13;
  52371. peg$currPos++;
  52372. } else {
  52373. s4 = peg$FAILED;
  52374. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  52375. }
  52376. peg$silentFails--;
  52377. if (s4 === peg$FAILED) {
  52378. s3 = peg$c112;
  52379. } else {
  52380. peg$currPos = s3;
  52381. s3 = peg$c1;
  52382. }
  52383. if (s3 !== peg$FAILED) {
  52384. peg$reportedPos = s0;
  52385. s1 = peg$c113(s2);
  52386. s0 = s1;
  52387. } else {
  52388. peg$currPos = s0;
  52389. s0 = peg$c1;
  52390. }
  52391. } else {
  52392. peg$currPos = s0;
  52393. s0 = peg$c1;
  52394. }
  52395. } else {
  52396. peg$currPos = s0;
  52397. s0 = peg$c1;
  52398. }
  52399. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52400. return s0;
  52401. }
  52402. function peg$parseunaryTail() {
  52403. var s0, s1, s2, s3, s4;
  52404. var key = peg$currPos * 60 + 46,
  52405. cached = peg$cache[key];
  52406. if (cached) {
  52407. peg$currPos = cached.nextPos;
  52408. return cached.result;
  52409. }
  52410. s0 = peg$currPos;
  52411. s1 = peg$parseunaryMessage();
  52412. if (s1 !== peg$FAILED) {
  52413. s2 = peg$parsews();
  52414. if (s2 !== peg$FAILED) {
  52415. s3 = peg$parseunaryTail();
  52416. if (s3 === peg$FAILED) {
  52417. s3 = peg$c41;
  52418. }
  52419. if (s3 !== peg$FAILED) {
  52420. s4 = peg$parsews();
  52421. if (s4 !== peg$FAILED) {
  52422. peg$reportedPos = s0;
  52423. s1 = peg$c114(s1, s3);
  52424. s0 = s1;
  52425. } else {
  52426. peg$currPos = s0;
  52427. s0 = peg$c1;
  52428. }
  52429. } else {
  52430. peg$currPos = s0;
  52431. s0 = peg$c1;
  52432. }
  52433. } else {
  52434. peg$currPos = s0;
  52435. s0 = peg$c1;
  52436. }
  52437. } else {
  52438. peg$currPos = s0;
  52439. s0 = peg$c1;
  52440. }
  52441. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52442. return s0;
  52443. }
  52444. function peg$parseunarySend() {
  52445. var s0, s1, s2, s3;
  52446. var key = peg$currPos * 60 + 47,
  52447. cached = peg$cache[key];
  52448. if (cached) {
  52449. peg$currPos = cached.nextPos;
  52450. return cached.result;
  52451. }
  52452. s0 = peg$currPos;
  52453. s1 = peg$parseoperand();
  52454. if (s1 !== peg$FAILED) {
  52455. s2 = peg$parsews();
  52456. if (s2 !== peg$FAILED) {
  52457. s3 = peg$parseunaryTail();
  52458. if (s3 === peg$FAILED) {
  52459. s3 = peg$c41;
  52460. }
  52461. if (s3 !== peg$FAILED) {
  52462. peg$reportedPos = s0;
  52463. s1 = peg$c115(s1, s3);
  52464. s0 = s1;
  52465. } else {
  52466. peg$currPos = s0;
  52467. s0 = peg$c1;
  52468. }
  52469. } else {
  52470. peg$currPos = s0;
  52471. s0 = peg$c1;
  52472. }
  52473. } else {
  52474. peg$currPos = s0;
  52475. s0 = peg$c1;
  52476. }
  52477. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52478. return s0;
  52479. }
  52480. function peg$parsebinaryMessage() {
  52481. var s0, s1, s2, s3, s4;
  52482. var key = peg$currPos * 60 + 48,
  52483. cached = peg$cache[key];
  52484. if (cached) {
  52485. peg$currPos = cached.nextPos;
  52486. return cached.result;
  52487. }
  52488. s0 = peg$currPos;
  52489. s1 = peg$parsews();
  52490. if (s1 !== peg$FAILED) {
  52491. s2 = peg$parsebinarySelector();
  52492. if (s2 !== peg$FAILED) {
  52493. s3 = peg$parsews();
  52494. if (s3 !== peg$FAILED) {
  52495. s4 = peg$parseunarySend();
  52496. if (s4 === peg$FAILED) {
  52497. s4 = peg$parseoperand();
  52498. }
  52499. if (s4 !== peg$FAILED) {
  52500. peg$reportedPos = s0;
  52501. s1 = peg$c116(s2, s4);
  52502. s0 = s1;
  52503. } else {
  52504. peg$currPos = s0;
  52505. s0 = peg$c1;
  52506. }
  52507. } else {
  52508. peg$currPos = s0;
  52509. s0 = peg$c1;
  52510. }
  52511. } else {
  52512. peg$currPos = s0;
  52513. s0 = peg$c1;
  52514. }
  52515. } else {
  52516. peg$currPos = s0;
  52517. s0 = peg$c1;
  52518. }
  52519. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52520. return s0;
  52521. }
  52522. function peg$parsebinaryTail() {
  52523. var s0, s1, s2;
  52524. var key = peg$currPos * 60 + 49,
  52525. cached = peg$cache[key];
  52526. if (cached) {
  52527. peg$currPos = cached.nextPos;
  52528. return cached.result;
  52529. }
  52530. s0 = peg$currPos;
  52531. s1 = peg$parsebinaryMessage();
  52532. if (s1 !== peg$FAILED) {
  52533. s2 = peg$parsebinaryTail();
  52534. if (s2 === peg$FAILED) {
  52535. s2 = peg$c41;
  52536. }
  52537. if (s2 !== peg$FAILED) {
  52538. peg$reportedPos = s0;
  52539. s1 = peg$c117(s1, s2);
  52540. s0 = s1;
  52541. } else {
  52542. peg$currPos = s0;
  52543. s0 = peg$c1;
  52544. }
  52545. } else {
  52546. peg$currPos = s0;
  52547. s0 = peg$c1;
  52548. }
  52549. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52550. return s0;
  52551. }
  52552. function peg$parsebinarySend() {
  52553. var s0, s1, s2;
  52554. var key = peg$currPos * 60 + 50,
  52555. cached = peg$cache[key];
  52556. if (cached) {
  52557. peg$currPos = cached.nextPos;
  52558. return cached.result;
  52559. }
  52560. s0 = peg$currPos;
  52561. s1 = peg$parseunarySend();
  52562. if (s1 !== peg$FAILED) {
  52563. s2 = peg$parsebinaryTail();
  52564. if (s2 === peg$FAILED) {
  52565. s2 = peg$c41;
  52566. }
  52567. if (s2 !== peg$FAILED) {
  52568. peg$reportedPos = s0;
  52569. s1 = peg$c115(s1, s2);
  52570. s0 = s1;
  52571. } else {
  52572. peg$currPos = s0;
  52573. s0 = peg$c1;
  52574. }
  52575. } else {
  52576. peg$currPos = s0;
  52577. s0 = peg$c1;
  52578. }
  52579. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52580. return s0;
  52581. }
  52582. function peg$parsekeywordMessage() {
  52583. var s0, s1, s2;
  52584. var key = peg$currPos * 60 + 51,
  52585. cached = peg$cache[key];
  52586. if (cached) {
  52587. peg$currPos = cached.nextPos;
  52588. return cached.result;
  52589. }
  52590. s0 = peg$currPos;
  52591. s1 = [];
  52592. s2 = peg$parsekeywordPair();
  52593. if (s2 !== peg$FAILED) {
  52594. while (s2 !== peg$FAILED) {
  52595. s1.push(s2);
  52596. s2 = peg$parsekeywordPair();
  52597. }
  52598. } else {
  52599. s1 = peg$c1;
  52600. }
  52601. if (s1 !== peg$FAILED) {
  52602. peg$reportedPos = s0;
  52603. s1 = peg$c118(s1);
  52604. }
  52605. s0 = s1;
  52606. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52607. return s0;
  52608. }
  52609. function peg$parsekeywordSend() {
  52610. var s0, s1, s2;
  52611. var key = peg$currPos * 60 + 52,
  52612. cached = peg$cache[key];
  52613. if (cached) {
  52614. peg$currPos = cached.nextPos;
  52615. return cached.result;
  52616. }
  52617. s0 = peg$currPos;
  52618. s1 = peg$parsebinarySend();
  52619. if (s1 !== peg$FAILED) {
  52620. s2 = peg$parsekeywordMessage();
  52621. if (s2 !== peg$FAILED) {
  52622. peg$reportedPos = s0;
  52623. s1 = peg$c119(s1, s2);
  52624. s0 = s1;
  52625. } else {
  52626. peg$currPos = s0;
  52627. s0 = peg$c1;
  52628. }
  52629. } else {
  52630. peg$currPos = s0;
  52631. s0 = peg$c1;
  52632. }
  52633. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52634. return s0;
  52635. }
  52636. function peg$parsemessage() {
  52637. var s0;
  52638. var key = peg$currPos * 60 + 53,
  52639. cached = peg$cache[key];
  52640. if (cached) {
  52641. peg$currPos = cached.nextPos;
  52642. return cached.result;
  52643. }
  52644. s0 = peg$parsebinaryMessage();
  52645. if (s0 === peg$FAILED) {
  52646. s0 = peg$parseunaryMessage();
  52647. if (s0 === peg$FAILED) {
  52648. s0 = peg$parsekeywordMessage();
  52649. }
  52650. }
  52651. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52652. return s0;
  52653. }
  52654. function peg$parsecascade() {
  52655. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  52656. var key = peg$currPos * 60 + 54,
  52657. cached = peg$cache[key];
  52658. if (cached) {
  52659. peg$currPos = cached.nextPos;
  52660. return cached.result;
  52661. }
  52662. s0 = peg$currPos;
  52663. s1 = peg$parsews();
  52664. if (s1 !== peg$FAILED) {
  52665. s2 = peg$parsekeywordSend();
  52666. if (s2 === peg$FAILED) {
  52667. s2 = peg$parsebinarySend();
  52668. }
  52669. if (s2 !== peg$FAILED) {
  52670. s3 = [];
  52671. s4 = peg$currPos;
  52672. s5 = peg$parsews();
  52673. if (s5 !== peg$FAILED) {
  52674. if (input.charCodeAt(peg$currPos) === 59) {
  52675. s6 = peg$c120;
  52676. peg$currPos++;
  52677. } else {
  52678. s6 = peg$FAILED;
  52679. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  52680. }
  52681. if (s6 !== peg$FAILED) {
  52682. s7 = peg$parsews();
  52683. if (s7 !== peg$FAILED) {
  52684. s8 = peg$parsemessage();
  52685. if (s8 !== peg$FAILED) {
  52686. peg$reportedPos = s4;
  52687. s5 = peg$c122(s8);
  52688. s4 = s5;
  52689. } else {
  52690. peg$currPos = s4;
  52691. s4 = peg$c1;
  52692. }
  52693. } else {
  52694. peg$currPos = s4;
  52695. s4 = peg$c1;
  52696. }
  52697. } else {
  52698. peg$currPos = s4;
  52699. s4 = peg$c1;
  52700. }
  52701. } else {
  52702. peg$currPos = s4;
  52703. s4 = peg$c1;
  52704. }
  52705. if (s4 !== peg$FAILED) {
  52706. while (s4 !== peg$FAILED) {
  52707. s3.push(s4);
  52708. s4 = peg$currPos;
  52709. s5 = peg$parsews();
  52710. if (s5 !== peg$FAILED) {
  52711. if (input.charCodeAt(peg$currPos) === 59) {
  52712. s6 = peg$c120;
  52713. peg$currPos++;
  52714. } else {
  52715. s6 = peg$FAILED;
  52716. if (peg$silentFails === 0) { peg$fail(peg$c121); }
  52717. }
  52718. if (s6 !== peg$FAILED) {
  52719. s7 = peg$parsews();
  52720. if (s7 !== peg$FAILED) {
  52721. s8 = peg$parsemessage();
  52722. if (s8 !== peg$FAILED) {
  52723. peg$reportedPos = s4;
  52724. s5 = peg$c122(s8);
  52725. s4 = s5;
  52726. } else {
  52727. peg$currPos = s4;
  52728. s4 = peg$c1;
  52729. }
  52730. } else {
  52731. peg$currPos = s4;
  52732. s4 = peg$c1;
  52733. }
  52734. } else {
  52735. peg$currPos = s4;
  52736. s4 = peg$c1;
  52737. }
  52738. } else {
  52739. peg$currPos = s4;
  52740. s4 = peg$c1;
  52741. }
  52742. }
  52743. } else {
  52744. s3 = peg$c1;
  52745. }
  52746. if (s3 !== peg$FAILED) {
  52747. peg$reportedPos = s0;
  52748. s1 = peg$c123(s2, s3);
  52749. s0 = s1;
  52750. } else {
  52751. peg$currPos = s0;
  52752. s0 = peg$c1;
  52753. }
  52754. } else {
  52755. peg$currPos = s0;
  52756. s0 = peg$c1;
  52757. }
  52758. } else {
  52759. peg$currPos = s0;
  52760. s0 = peg$c1;
  52761. }
  52762. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52763. return s0;
  52764. }
  52765. function peg$parsejsStatement() {
  52766. var s0, s1, s2, s3, s4;
  52767. var key = peg$currPos * 60 + 55,
  52768. cached = peg$cache[key];
  52769. if (cached) {
  52770. peg$currPos = cached.nextPos;
  52771. return cached.result;
  52772. }
  52773. s0 = peg$currPos;
  52774. if (input.charCodeAt(peg$currPos) === 60) {
  52775. s1 = peg$c124;
  52776. peg$currPos++;
  52777. } else {
  52778. s1 = peg$FAILED;
  52779. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  52780. }
  52781. if (s1 !== peg$FAILED) {
  52782. s2 = [];
  52783. s3 = peg$currPos;
  52784. if (input.substr(peg$currPos, 2) === peg$c126) {
  52785. s4 = peg$c126;
  52786. peg$currPos += 2;
  52787. } else {
  52788. s4 = peg$FAILED;
  52789. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  52790. }
  52791. if (s4 !== peg$FAILED) {
  52792. peg$reportedPos = s3;
  52793. s4 = peg$c128();
  52794. }
  52795. s3 = s4;
  52796. if (s3 === peg$FAILED) {
  52797. if (peg$c129.test(input.charAt(peg$currPos))) {
  52798. s3 = input.charAt(peg$currPos);
  52799. peg$currPos++;
  52800. } else {
  52801. s3 = peg$FAILED;
  52802. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  52803. }
  52804. }
  52805. while (s3 !== peg$FAILED) {
  52806. s2.push(s3);
  52807. s3 = peg$currPos;
  52808. if (input.substr(peg$currPos, 2) === peg$c126) {
  52809. s4 = peg$c126;
  52810. peg$currPos += 2;
  52811. } else {
  52812. s4 = peg$FAILED;
  52813. if (peg$silentFails === 0) { peg$fail(peg$c127); }
  52814. }
  52815. if (s4 !== peg$FAILED) {
  52816. peg$reportedPos = s3;
  52817. s4 = peg$c128();
  52818. }
  52819. s3 = s4;
  52820. if (s3 === peg$FAILED) {
  52821. if (peg$c129.test(input.charAt(peg$currPos))) {
  52822. s3 = input.charAt(peg$currPos);
  52823. peg$currPos++;
  52824. } else {
  52825. s3 = peg$FAILED;
  52826. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  52827. }
  52828. }
  52829. }
  52830. if (s2 !== peg$FAILED) {
  52831. if (input.charCodeAt(peg$currPos) === 62) {
  52832. s3 = peg$c131;
  52833. peg$currPos++;
  52834. } else {
  52835. s3 = peg$FAILED;
  52836. if (peg$silentFails === 0) { peg$fail(peg$c132); }
  52837. }
  52838. if (s3 !== peg$FAILED) {
  52839. peg$reportedPos = s0;
  52840. s1 = peg$c133(s2);
  52841. s0 = s1;
  52842. } else {
  52843. peg$currPos = s0;
  52844. s0 = peg$c1;
  52845. }
  52846. } else {
  52847. peg$currPos = s0;
  52848. s0 = peg$c1;
  52849. }
  52850. } else {
  52851. peg$currPos = s0;
  52852. s0 = peg$c1;
  52853. }
  52854. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52855. return s0;
  52856. }
  52857. function peg$parsemethod() {
  52858. var s0, s1, s2, s3, s4;
  52859. var key = peg$currPos * 60 + 56,
  52860. cached = peg$cache[key];
  52861. if (cached) {
  52862. peg$currPos = cached.nextPos;
  52863. return cached.result;
  52864. }
  52865. s0 = peg$currPos;
  52866. s1 = peg$parsekeywordPattern();
  52867. if (s1 === peg$FAILED) {
  52868. s1 = peg$parsebinaryPattern();
  52869. if (s1 === peg$FAILED) {
  52870. s1 = peg$parseunaryPattern();
  52871. }
  52872. }
  52873. if (s1 !== peg$FAILED) {
  52874. s2 = peg$parsews();
  52875. if (s2 !== peg$FAILED) {
  52876. s3 = peg$parsesequence();
  52877. if (s3 === peg$FAILED) {
  52878. s3 = peg$c41;
  52879. }
  52880. if (s3 !== peg$FAILED) {
  52881. s4 = peg$parsews();
  52882. if (s4 !== peg$FAILED) {
  52883. peg$reportedPos = s0;
  52884. s1 = peg$c134(s1, s3);
  52885. s0 = s1;
  52886. } else {
  52887. peg$currPos = s0;
  52888. s0 = peg$c1;
  52889. }
  52890. } else {
  52891. peg$currPos = s0;
  52892. s0 = peg$c1;
  52893. }
  52894. } else {
  52895. peg$currPos = s0;
  52896. s0 = peg$c1;
  52897. }
  52898. } else {
  52899. peg$currPos = s0;
  52900. s0 = peg$c1;
  52901. }
  52902. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52903. return s0;
  52904. }
  52905. function peg$parseassociationSend() {
  52906. var s0, s1, s2;
  52907. var key = peg$currPos * 60 + 57,
  52908. cached = peg$cache[key];
  52909. if (cached) {
  52910. peg$currPos = cached.nextPos;
  52911. return cached.result;
  52912. }
  52913. s0 = peg$currPos;
  52914. s1 = peg$parsebinarySend();
  52915. if (s1 !== peg$FAILED) {
  52916. peg$reportedPos = peg$currPos;
  52917. s2 = peg$c135(s1);
  52918. if (s2) {
  52919. s2 = peg$c112;
  52920. } else {
  52921. s2 = peg$c1;
  52922. }
  52923. if (s2 !== peg$FAILED) {
  52924. peg$reportedPos = s0;
  52925. s1 = peg$c136(s1);
  52926. s0 = s1;
  52927. } else {
  52928. peg$currPos = s0;
  52929. s0 = peg$c1;
  52930. }
  52931. } else {
  52932. peg$currPos = s0;
  52933. s0 = peg$c1;
  52934. }
  52935. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52936. return s0;
  52937. }
  52938. function peg$parseassociationList() {
  52939. var s0, s1, s2, s3, s4;
  52940. var key = peg$currPos * 60 + 58,
  52941. cached = peg$cache[key];
  52942. if (cached) {
  52943. peg$currPos = cached.nextPos;
  52944. return cached.result;
  52945. }
  52946. s0 = peg$currPos;
  52947. s1 = peg$parsews();
  52948. if (s1 !== peg$FAILED) {
  52949. if (input.charCodeAt(peg$currPos) === 46) {
  52950. s2 = peg$c51;
  52951. peg$currPos++;
  52952. } else {
  52953. s2 = peg$FAILED;
  52954. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  52955. }
  52956. if (s2 !== peg$FAILED) {
  52957. s3 = peg$parsews();
  52958. if (s3 !== peg$FAILED) {
  52959. s4 = peg$parseassociationSend();
  52960. if (s4 !== peg$FAILED) {
  52961. peg$reportedPos = s0;
  52962. s1 = peg$c89(s4);
  52963. s0 = s1;
  52964. } else {
  52965. peg$currPos = s0;
  52966. s0 = peg$c1;
  52967. }
  52968. } else {
  52969. peg$currPos = s0;
  52970. s0 = peg$c1;
  52971. }
  52972. } else {
  52973. peg$currPos = s0;
  52974. s0 = peg$c1;
  52975. }
  52976. } else {
  52977. peg$currPos = s0;
  52978. s0 = peg$c1;
  52979. }
  52980. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  52981. return s0;
  52982. }
  52983. function peg$parseassociations() {
  52984. var s0, s1, s2, s3;
  52985. var key = peg$currPos * 60 + 59,
  52986. cached = peg$cache[key];
  52987. if (cached) {
  52988. peg$currPos = cached.nextPos;
  52989. return cached.result;
  52990. }
  52991. s0 = peg$currPos;
  52992. s1 = peg$parseassociationSend();
  52993. if (s1 !== peg$FAILED) {
  52994. s2 = [];
  52995. s3 = peg$parseassociationList();
  52996. while (s3 !== peg$FAILED) {
  52997. s2.push(s3);
  52998. s3 = peg$parseassociationList();
  52999. }
  53000. if (s2 !== peg$FAILED) {
  53001. peg$reportedPos = s0;
  53002. s1 = peg$c137(s1, s2);
  53003. s0 = s1;
  53004. } else {
  53005. peg$currPos = s0;
  53006. s0 = peg$c1;
  53007. }
  53008. } else {
  53009. peg$currPos = s0;
  53010. s0 = peg$c1;
  53011. }
  53012. peg$cache[key] = { nextPos: peg$currPos, result: s0 };
  53013. return s0;
  53014. }
  53015. peg$result = peg$startRuleFunction();
  53016. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  53017. return peg$result;
  53018. } else {
  53019. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  53020. peg$fail({ type: "end", description: "end of input" });
  53021. }
  53022. throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
  53023. }
  53024. }
  53025. return {
  53026. SyntaxError: SyntaxError,
  53027. parse: parse
  53028. };
  53029. })();
  53030. });
  53031. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Classes", "amber_core/Kernel-Infrastructure"], function($boot){
  53032. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  53033. smalltalk.addPackage('SUnit');
  53034. smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  53035. smalltalk.addClass('ResultAnnouncement', globals.Object, ['result'], 'SUnit');
  53036. //>>excludeStart("ide", pragmas.excludeIdeData);
  53037. 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.";
  53038. //>>excludeEnd("ide");
  53039. smalltalk.addMethod(
  53040. smalltalk.method({
  53041. selector: "result",
  53042. protocol: 'accessing',
  53043. fn: function (){
  53044. var self=this;
  53045. var $1;
  53046. $1=self["@result"];
  53047. return $1;
  53048. },
  53049. //>>excludeStart("ide", pragmas.excludeIdeData);
  53050. args: [],
  53051. source: "result\x0a\x09^ result",
  53052. referencedClasses: [],
  53053. //>>excludeEnd("ide");
  53054. messageSends: []
  53055. }),
  53056. globals.ResultAnnouncement);
  53057. smalltalk.addMethod(
  53058. smalltalk.method({
  53059. selector: "result:",
  53060. protocol: 'accessing',
  53061. fn: function (aTestResult){
  53062. var self=this;
  53063. self["@result"]=aTestResult;
  53064. return self;
  53065. },
  53066. //>>excludeStart("ide", pragmas.excludeIdeData);
  53067. args: ["aTestResult"],
  53068. source: "result: aTestResult\x0a\x09result := aTestResult",
  53069. referencedClasses: [],
  53070. //>>excludeEnd("ide");
  53071. messageSends: []
  53072. }),
  53073. globals.ResultAnnouncement);
  53074. smalltalk.addClass('TestCase', globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  53075. //>>excludeStart("ide", pragmas.excludeIdeData);
  53076. 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.";
  53077. //>>excludeEnd("ide");
  53078. smalltalk.addMethod(
  53079. smalltalk.method({
  53080. selector: "assert:",
  53081. protocol: 'testing',
  53082. fn: function (aBoolean){
  53083. var self=this;
  53084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53085. return smalltalk.withContext(function($ctx1) {
  53086. //>>excludeEnd("ctx");
  53087. self._assert_description_(aBoolean,"Assertion failed");
  53088. return self;
  53089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53090. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},globals.TestCase)});
  53091. //>>excludeEnd("ctx");
  53092. },
  53093. //>>excludeStart("ide", pragmas.excludeIdeData);
  53094. args: ["aBoolean"],
  53095. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  53096. referencedClasses: [],
  53097. //>>excludeEnd("ide");
  53098. messageSends: ["assert:description:"]
  53099. }),
  53100. globals.TestCase);
  53101. smalltalk.addMethod(
  53102. smalltalk.method({
  53103. selector: "assert:description:",
  53104. protocol: 'testing',
  53105. fn: function (aBoolean,aString){
  53106. var self=this;
  53107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53108. return smalltalk.withContext(function($ctx1) {
  53109. //>>excludeEnd("ctx");
  53110. if(! smalltalk.assert(aBoolean)){
  53111. self._signalFailure_(aString);
  53112. };
  53113. return self;
  53114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53115. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},globals.TestCase)});
  53116. //>>excludeEnd("ctx");
  53117. },
  53118. //>>excludeStart("ide", pragmas.excludeIdeData);
  53119. args: ["aBoolean", "aString"],
  53120. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  53121. referencedClasses: [],
  53122. //>>excludeEnd("ide");
  53123. messageSends: ["ifFalse:", "signalFailure:"]
  53124. }),
  53125. globals.TestCase);
  53126. smalltalk.addMethod(
  53127. smalltalk.method({
  53128. selector: "assert:equals:",
  53129. protocol: 'testing',
  53130. fn: function (actual,expected){
  53131. var self=this;
  53132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53133. return smalltalk.withContext(function($ctx1) {
  53134. //>>excludeEnd("ctx");
  53135. var $2,$6,$5,$4,$3,$1;
  53136. $2=_st(actual).__eq(expected);
  53137. $6=_st(expected)._printString();
  53138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53139. $ctx1.sendIdx["printString"]=1;
  53140. //>>excludeEnd("ctx");
  53141. $5="Expected: ".__comma($6);
  53142. $4=_st($5).__comma(" but was: ");
  53143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53144. $ctx1.sendIdx[","]=2;
  53145. //>>excludeEnd("ctx");
  53146. $3=_st($4).__comma(_st(actual)._printString());
  53147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53148. $ctx1.sendIdx[","]=1;
  53149. //>>excludeEnd("ctx");
  53150. $1=self._assert_description_($2,$3);
  53151. return $1;
  53152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53153. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},globals.TestCase)});
  53154. //>>excludeEnd("ctx");
  53155. },
  53156. //>>excludeStart("ide", pragmas.excludeIdeData);
  53157. args: ["actual", "expected"],
  53158. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  53159. referencedClasses: [],
  53160. //>>excludeEnd("ide");
  53161. messageSends: ["assert:description:", "=", ",", "printString"]
  53162. }),
  53163. globals.TestCase);
  53164. smalltalk.addMethod(
  53165. smalltalk.method({
  53166. selector: "async:",
  53167. protocol: 'async',
  53168. fn: function (aBlock){
  53169. var self=this;
  53170. var c;
  53171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53172. return smalltalk.withContext(function($ctx1) {
  53173. //>>excludeEnd("ctx");
  53174. var $2,$1;
  53175. self._errorIfNotAsync_("#async");
  53176. c=self["@context"];
  53177. $1=(function(){
  53178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53179. return smalltalk.withContext(function($ctx2) {
  53180. //>>excludeEnd("ctx");
  53181. $2=self._isAsync();
  53182. if(smalltalk.assert($2)){
  53183. return _st(c)._execute_(aBlock);
  53184. };
  53185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53187. //>>excludeEnd("ctx");
  53188. });
  53189. return $1;
  53190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53191. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},globals.TestCase)});
  53192. //>>excludeEnd("ctx");
  53193. },
  53194. //>>excludeStart("ide", pragmas.excludeIdeData);
  53195. args: ["aBlock"],
  53196. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  53197. referencedClasses: [],
  53198. //>>excludeEnd("ide");
  53199. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  53200. }),
  53201. globals.TestCase);
  53202. smalltalk.addMethod(
  53203. smalltalk.method({
  53204. selector: "context:",
  53205. protocol: 'accessing',
  53206. fn: function (aRunningTestContext){
  53207. var self=this;
  53208. self["@context"]=aRunningTestContext;
  53209. return self;
  53210. },
  53211. //>>excludeStart("ide", pragmas.excludeIdeData);
  53212. args: ["aRunningTestContext"],
  53213. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  53214. referencedClasses: [],
  53215. //>>excludeEnd("ide");
  53216. messageSends: []
  53217. }),
  53218. globals.TestCase);
  53219. smalltalk.addMethod(
  53220. smalltalk.method({
  53221. selector: "deny:",
  53222. protocol: 'testing',
  53223. fn: function (aBoolean){
  53224. var self=this;
  53225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53226. return smalltalk.withContext(function($ctx1) {
  53227. //>>excludeEnd("ctx");
  53228. self._assert_(_st(aBoolean)._not());
  53229. return self;
  53230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53231. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},globals.TestCase)});
  53232. //>>excludeEnd("ctx");
  53233. },
  53234. //>>excludeStart("ide", pragmas.excludeIdeData);
  53235. args: ["aBoolean"],
  53236. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  53237. referencedClasses: [],
  53238. //>>excludeEnd("ide");
  53239. messageSends: ["assert:", "not"]
  53240. }),
  53241. globals.TestCase);
  53242. smalltalk.addMethod(
  53243. smalltalk.method({
  53244. selector: "errorIfNotAsync:",
  53245. protocol: 'error handling',
  53246. fn: function (aString){
  53247. var self=this;
  53248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53249. return smalltalk.withContext(function($ctx1) {
  53250. //>>excludeEnd("ctx");
  53251. var $1;
  53252. $1=self._isAsync();
  53253. if(! smalltalk.assert($1)){
  53254. self._error_(_st(aString).__comma(" used without prior #timeout:"));
  53255. };
  53256. return self;
  53257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53258. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},globals.TestCase)});
  53259. //>>excludeEnd("ctx");
  53260. },
  53261. //>>excludeStart("ide", pragmas.excludeIdeData);
  53262. args: ["aString"],
  53263. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  53264. referencedClasses: [],
  53265. //>>excludeEnd("ide");
  53266. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  53267. }),
  53268. globals.TestCase);
  53269. smalltalk.addMethod(
  53270. smalltalk.method({
  53271. selector: "finished",
  53272. protocol: 'async',
  53273. fn: function (){
  53274. var self=this;
  53275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53276. return smalltalk.withContext(function($ctx1) {
  53277. //>>excludeEnd("ctx");
  53278. self._errorIfNotAsync_("#finished");
  53279. self["@asyncTimeout"]=nil;
  53280. return self;
  53281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53282. }, function($ctx1) {$ctx1.fill(self,"finished",{},globals.TestCase)});
  53283. //>>excludeEnd("ctx");
  53284. },
  53285. //>>excludeStart("ide", pragmas.excludeIdeData);
  53286. args: [],
  53287. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  53288. referencedClasses: [],
  53289. //>>excludeEnd("ide");
  53290. messageSends: ["errorIfNotAsync:"]
  53291. }),
  53292. globals.TestCase);
  53293. smalltalk.addMethod(
  53294. smalltalk.method({
  53295. selector: "isAsync",
  53296. protocol: 'testing',
  53297. fn: function (){
  53298. var self=this;
  53299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53300. return smalltalk.withContext(function($ctx1) {
  53301. //>>excludeEnd("ctx");
  53302. var $1;
  53303. $1=_st(self["@asyncTimeout"])._notNil();
  53304. return $1;
  53305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53306. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},globals.TestCase)});
  53307. //>>excludeEnd("ctx");
  53308. },
  53309. //>>excludeStart("ide", pragmas.excludeIdeData);
  53310. args: [],
  53311. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  53312. referencedClasses: [],
  53313. //>>excludeEnd("ide");
  53314. messageSends: ["notNil"]
  53315. }),
  53316. globals.TestCase);
  53317. smalltalk.addMethod(
  53318. smalltalk.method({
  53319. selector: "performTest",
  53320. protocol: 'running',
  53321. fn: function (){
  53322. var self=this;
  53323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53324. return smalltalk.withContext(function($ctx1) {
  53325. //>>excludeEnd("ctx");
  53326. self["@asyncTimeout"]=nil;
  53327. self._perform_(self._selector());
  53328. return self;
  53329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53330. }, function($ctx1) {$ctx1.fill(self,"performTest",{},globals.TestCase)});
  53331. //>>excludeEnd("ctx");
  53332. },
  53333. //>>excludeStart("ide", pragmas.excludeIdeData);
  53334. args: [],
  53335. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  53336. referencedClasses: [],
  53337. //>>excludeEnd("ide");
  53338. messageSends: ["perform:", "selector"]
  53339. }),
  53340. globals.TestCase);
  53341. smalltalk.addMethod(
  53342. smalltalk.method({
  53343. selector: "runCase",
  53344. protocol: 'running',
  53345. fn: function (){
  53346. var self=this;
  53347. function $TestContext(){return globals.TestContext||(typeof TestContext=="undefined"?nil:TestContext)}
  53348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53349. return smalltalk.withContext(function($ctx1) {
  53350. //>>excludeEnd("ctx");
  53351. _st(_st($TestContext())._testCase_(self))._start();
  53352. return self;
  53353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53354. }, function($ctx1) {$ctx1.fill(self,"runCase",{},globals.TestCase)});
  53355. //>>excludeEnd("ctx");
  53356. },
  53357. //>>excludeStart("ide", pragmas.excludeIdeData);
  53358. args: [],
  53359. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  53360. referencedClasses: ["TestContext"],
  53361. //>>excludeEnd("ide");
  53362. messageSends: ["start", "testCase:"]
  53363. }),
  53364. globals.TestCase);
  53365. smalltalk.addMethod(
  53366. smalltalk.method({
  53367. selector: "selector",
  53368. protocol: 'accessing',
  53369. fn: function (){
  53370. var self=this;
  53371. var $1;
  53372. $1=self["@testSelector"];
  53373. return $1;
  53374. },
  53375. //>>excludeStart("ide", pragmas.excludeIdeData);
  53376. args: [],
  53377. source: "selector\x0a\x09^ testSelector",
  53378. referencedClasses: [],
  53379. //>>excludeEnd("ide");
  53380. messageSends: []
  53381. }),
  53382. globals.TestCase);
  53383. smalltalk.addMethod(
  53384. smalltalk.method({
  53385. selector: "setTestSelector:",
  53386. protocol: 'accessing',
  53387. fn: function (aSelector){
  53388. var self=this;
  53389. self["@testSelector"]=aSelector;
  53390. return self;
  53391. },
  53392. //>>excludeStart("ide", pragmas.excludeIdeData);
  53393. args: ["aSelector"],
  53394. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  53395. referencedClasses: [],
  53396. //>>excludeEnd("ide");
  53397. messageSends: []
  53398. }),
  53399. globals.TestCase);
  53400. smalltalk.addMethod(
  53401. smalltalk.method({
  53402. selector: "setUp",
  53403. protocol: 'running',
  53404. fn: function (){
  53405. var self=this;
  53406. return self;
  53407. },
  53408. //>>excludeStart("ide", pragmas.excludeIdeData);
  53409. args: [],
  53410. source: "setUp",
  53411. referencedClasses: [],
  53412. //>>excludeEnd("ide");
  53413. messageSends: []
  53414. }),
  53415. globals.TestCase);
  53416. smalltalk.addMethod(
  53417. smalltalk.method({
  53418. selector: "should:",
  53419. protocol: 'testing',
  53420. fn: function (aBlock){
  53421. var self=this;
  53422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53423. return smalltalk.withContext(function($ctx1) {
  53424. //>>excludeEnd("ctx");
  53425. self._assert_(_st(aBlock)._value());
  53426. return self;
  53427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53428. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},globals.TestCase)});
  53429. //>>excludeEnd("ctx");
  53430. },
  53431. //>>excludeStart("ide", pragmas.excludeIdeData);
  53432. args: ["aBlock"],
  53433. source: "should: aBlock\x0a\x09self assert: aBlock value",
  53434. referencedClasses: [],
  53435. //>>excludeEnd("ide");
  53436. messageSends: ["assert:", "value"]
  53437. }),
  53438. globals.TestCase);
  53439. smalltalk.addMethod(
  53440. smalltalk.method({
  53441. selector: "should:raise:",
  53442. protocol: 'testing',
  53443. fn: function (aBlock,anExceptionClass){
  53444. var self=this;
  53445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53446. return smalltalk.withContext(function($ctx1) {
  53447. //>>excludeEnd("ctx");
  53448. self._assert_(_st((function(){
  53449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53450. return smalltalk.withContext(function($ctx2) {
  53451. //>>excludeEnd("ctx");
  53452. _st(aBlock)._value();
  53453. return false;
  53454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53456. //>>excludeEnd("ctx");
  53457. }))._on_do_(anExceptionClass,(function(ex){
  53458. return true;
  53459. })));
  53460. return self;
  53461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53462. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)});
  53463. //>>excludeEnd("ctx");
  53464. },
  53465. //>>excludeStart("ide", pragmas.excludeIdeData);
  53466. args: ["aBlock", "anExceptionClass"],
  53467. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  53468. referencedClasses: [],
  53469. //>>excludeEnd("ide");
  53470. messageSends: ["assert:", "on:do:", "value"]
  53471. }),
  53472. globals.TestCase);
  53473. smalltalk.addMethod(
  53474. smalltalk.method({
  53475. selector: "shouldnt:raise:",
  53476. protocol: 'testing',
  53477. fn: function (aBlock,anExceptionClass){
  53478. var self=this;
  53479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53480. return smalltalk.withContext(function($ctx1) {
  53481. //>>excludeEnd("ctx");
  53482. self._assert_(_st((function(){
  53483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53484. return smalltalk.withContext(function($ctx2) {
  53485. //>>excludeEnd("ctx");
  53486. _st(aBlock)._value();
  53487. return true;
  53488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53490. //>>excludeEnd("ctx");
  53491. }))._on_do_(anExceptionClass,(function(ex){
  53492. return false;
  53493. })));
  53494. return self;
  53495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53496. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},globals.TestCase)});
  53497. //>>excludeEnd("ctx");
  53498. },
  53499. //>>excludeStart("ide", pragmas.excludeIdeData);
  53500. args: ["aBlock", "anExceptionClass"],
  53501. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  53502. referencedClasses: [],
  53503. //>>excludeEnd("ide");
  53504. messageSends: ["assert:", "on:do:", "value"]
  53505. }),
  53506. globals.TestCase);
  53507. smalltalk.addMethod(
  53508. smalltalk.method({
  53509. selector: "signalFailure:",
  53510. protocol: 'private',
  53511. fn: function (aString){
  53512. var self=this;
  53513. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  53514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53515. return smalltalk.withContext(function($ctx1) {
  53516. //>>excludeEnd("ctx");
  53517. var $1,$2;
  53518. $1=_st($TestFailure())._new();
  53519. _st($1)._messageText_(aString);
  53520. $2=_st($1)._signal();
  53521. return self;
  53522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53523. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},globals.TestCase)});
  53524. //>>excludeEnd("ctx");
  53525. },
  53526. //>>excludeStart("ide", pragmas.excludeIdeData);
  53527. args: ["aString"],
  53528. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  53529. referencedClasses: ["TestFailure"],
  53530. //>>excludeEnd("ide");
  53531. messageSends: ["messageText:", "new", "signal"]
  53532. }),
  53533. globals.TestCase);
  53534. smalltalk.addMethod(
  53535. smalltalk.method({
  53536. selector: "tearDown",
  53537. protocol: 'running',
  53538. fn: function (){
  53539. var self=this;
  53540. return self;
  53541. },
  53542. //>>excludeStart("ide", pragmas.excludeIdeData);
  53543. args: [],
  53544. source: "tearDown",
  53545. referencedClasses: [],
  53546. //>>excludeEnd("ide");
  53547. messageSends: []
  53548. }),
  53549. globals.TestCase);
  53550. smalltalk.addMethod(
  53551. smalltalk.method({
  53552. selector: "timeout:",
  53553. protocol: 'async',
  53554. fn: function (aNumber){
  53555. var self=this;
  53556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53557. return smalltalk.withContext(function($ctx1) {
  53558. //>>excludeEnd("ctx");
  53559. var $1,$receiver;
  53560. $1=self["@asyncTimeout"];
  53561. if(($receiver = $1) == null || $receiver.isNil){
  53562. $1;
  53563. } else {
  53564. _st(self["@asyncTimeout"])._clearTimeout();
  53565. };
  53566. self["@asyncTimeout"]=(0);
  53567. self["@asyncTimeout"]=_st(self._async_((function(){
  53568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53569. return smalltalk.withContext(function($ctx2) {
  53570. //>>excludeEnd("ctx");
  53571. return self._assert_description_(false,"SUnit grace time exhausted");
  53572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53573. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53574. //>>excludeEnd("ctx");
  53575. })))._valueWithTimeout_(aNumber);
  53576. return self;
  53577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53578. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},globals.TestCase)});
  53579. //>>excludeEnd("ctx");
  53580. },
  53581. //>>excludeStart("ide", pragmas.excludeIdeData);
  53582. args: ["aNumber"],
  53583. 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",
  53584. referencedClasses: [],
  53585. //>>excludeEnd("ide");
  53586. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  53587. }),
  53588. globals.TestCase);
  53589. smalltalk.addMethod(
  53590. smalltalk.method({
  53591. selector: "allTestSelectors",
  53592. protocol: 'accessing',
  53593. fn: function (){
  53594. var self=this;
  53595. var selectors;
  53596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53597. return smalltalk.withContext(function($ctx1) {
  53598. //>>excludeEnd("ctx");
  53599. var $1,$2;
  53600. selectors=self._testSelectors();
  53601. $1=self._shouldInheritSelectors();
  53602. if(smalltalk.assert($1)){
  53603. _st(selectors)._addAll_(_st(self._superclass())._allTestSelectors());
  53604. };
  53605. $2=selectors;
  53606. return $2;
  53607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53608. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},globals.TestCase.klass)});
  53609. //>>excludeEnd("ctx");
  53610. },
  53611. //>>excludeStart("ide", pragmas.excludeIdeData);
  53612. args: [],
  53613. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  53614. referencedClasses: [],
  53615. //>>excludeEnd("ide");
  53616. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  53617. }),
  53618. globals.TestCase.klass);
  53619. smalltalk.addMethod(
  53620. smalltalk.method({
  53621. selector: "buildSuite",
  53622. protocol: 'accessing',
  53623. fn: function (){
  53624. var self=this;
  53625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53626. return smalltalk.withContext(function($ctx1) {
  53627. //>>excludeEnd("ctx");
  53628. var $1;
  53629. $1=_st(self._allTestSelectors())._collect_((function(each){
  53630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53631. return smalltalk.withContext(function($ctx2) {
  53632. //>>excludeEnd("ctx");
  53633. return self._selector_(each);
  53634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53636. //>>excludeEnd("ctx");
  53637. }));
  53638. return $1;
  53639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53640. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},globals.TestCase.klass)});
  53641. //>>excludeEnd("ctx");
  53642. },
  53643. //>>excludeStart("ide", pragmas.excludeIdeData);
  53644. args: [],
  53645. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  53646. referencedClasses: [],
  53647. //>>excludeEnd("ide");
  53648. messageSends: ["collect:", "allTestSelectors", "selector:"]
  53649. }),
  53650. globals.TestCase.klass);
  53651. smalltalk.addMethod(
  53652. smalltalk.method({
  53653. selector: "heliosClass",
  53654. protocol: 'helios',
  53655. fn: function (){
  53656. var self=this;
  53657. return "test";
  53658. },
  53659. //>>excludeStart("ide", pragmas.excludeIdeData);
  53660. args: [],
  53661. source: "heliosClass\x0a\x09^ 'test'",
  53662. referencedClasses: [],
  53663. //>>excludeEnd("ide");
  53664. messageSends: []
  53665. }),
  53666. globals.TestCase.klass);
  53667. smalltalk.addMethod(
  53668. smalltalk.method({
  53669. selector: "isAbstract",
  53670. protocol: 'testing',
  53671. fn: function (){
  53672. var self=this;
  53673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53674. return smalltalk.withContext(function($ctx1) {
  53675. //>>excludeEnd("ctx");
  53676. var $1;
  53677. $1=_st(self._name()).__eq("TestCase");
  53678. return $1;
  53679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53680. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.TestCase.klass)});
  53681. //>>excludeEnd("ctx");
  53682. },
  53683. //>>excludeStart("ide", pragmas.excludeIdeData);
  53684. args: [],
  53685. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  53686. referencedClasses: [],
  53687. //>>excludeEnd("ide");
  53688. messageSends: ["=", "name"]
  53689. }),
  53690. globals.TestCase.klass);
  53691. smalltalk.addMethod(
  53692. smalltalk.method({
  53693. selector: "lookupHierarchyRoot",
  53694. protocol: 'accessing',
  53695. fn: function (){
  53696. var self=this;
  53697. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  53698. return $TestCase();
  53699. },
  53700. //>>excludeStart("ide", pragmas.excludeIdeData);
  53701. args: [],
  53702. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  53703. referencedClasses: ["TestCase"],
  53704. //>>excludeEnd("ide");
  53705. messageSends: []
  53706. }),
  53707. globals.TestCase.klass);
  53708. smalltalk.addMethod(
  53709. smalltalk.method({
  53710. selector: "selector:",
  53711. protocol: 'accessing',
  53712. fn: function (aSelector){
  53713. var self=this;
  53714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53715. return smalltalk.withContext(function($ctx1) {
  53716. //>>excludeEnd("ctx");
  53717. var $2,$3,$1;
  53718. $2=self._new();
  53719. _st($2)._setTestSelector_(aSelector);
  53720. $3=_st($2)._yourself();
  53721. $1=$3;
  53722. return $1;
  53723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53724. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},globals.TestCase.klass)});
  53725. //>>excludeEnd("ctx");
  53726. },
  53727. //>>excludeStart("ide", pragmas.excludeIdeData);
  53728. args: ["aSelector"],
  53729. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  53730. referencedClasses: [],
  53731. //>>excludeEnd("ide");
  53732. messageSends: ["setTestSelector:", "new", "yourself"]
  53733. }),
  53734. globals.TestCase.klass);
  53735. smalltalk.addMethod(
  53736. smalltalk.method({
  53737. selector: "shouldInheritSelectors",
  53738. protocol: 'testing',
  53739. fn: function (){
  53740. var self=this;
  53741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53742. return smalltalk.withContext(function($ctx1) {
  53743. //>>excludeEnd("ctx");
  53744. var $1;
  53745. $1=self.__tild_eq(self._lookupHierarchyRoot());
  53746. return $1;
  53747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53748. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},globals.TestCase.klass)});
  53749. //>>excludeEnd("ctx");
  53750. },
  53751. //>>excludeStart("ide", pragmas.excludeIdeData);
  53752. args: [],
  53753. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  53754. referencedClasses: [],
  53755. //>>excludeEnd("ide");
  53756. messageSends: ["~=", "lookupHierarchyRoot"]
  53757. }),
  53758. globals.TestCase.klass);
  53759. smalltalk.addMethod(
  53760. smalltalk.method({
  53761. selector: "testSelectors",
  53762. protocol: 'accessing',
  53763. fn: function (){
  53764. var self=this;
  53765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53766. return smalltalk.withContext(function($ctx1) {
  53767. //>>excludeEnd("ctx");
  53768. var $1;
  53769. $1=_st(_st(self._methodDictionary())._keys())._select_((function(each){
  53770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53771. return smalltalk.withContext(function($ctx2) {
  53772. //>>excludeEnd("ctx");
  53773. return _st(each)._match_("^test");
  53774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53776. //>>excludeEnd("ctx");
  53777. }));
  53778. return $1;
  53779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53780. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},globals.TestCase.klass)});
  53781. //>>excludeEnd("ctx");
  53782. },
  53783. //>>excludeStart("ide", pragmas.excludeIdeData);
  53784. args: [],
  53785. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  53786. referencedClasses: [],
  53787. //>>excludeEnd("ide");
  53788. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  53789. }),
  53790. globals.TestCase.klass);
  53791. smalltalk.addClass('TestContext', globals.Object, ['testCase'], 'SUnit');
  53792. //>>excludeStart("ide", pragmas.excludeIdeData);
  53793. 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).";
  53794. //>>excludeEnd("ide");
  53795. smalltalk.addMethod(
  53796. smalltalk.method({
  53797. selector: "execute:",
  53798. protocol: 'running',
  53799. fn: function (aBlock){
  53800. var self=this;
  53801. var failed;
  53802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53803. return smalltalk.withContext(function($ctx1) {
  53804. //>>excludeEnd("ctx");
  53805. var $1,$2;
  53806. _st(self["@testCase"])._context_(self);
  53807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53808. $ctx1.sendIdx["context:"]=1;
  53809. //>>excludeEnd("ctx");
  53810. _st((function(){
  53811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53812. return smalltalk.withContext(function($ctx2) {
  53813. //>>excludeEnd("ctx");
  53814. failed=true;
  53815. failed;
  53816. _st(aBlock)._value();
  53817. failed=false;
  53818. return failed;
  53819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53821. //>>excludeEnd("ctx");
  53822. }))._ensure_((function(){
  53823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53824. return smalltalk.withContext(function($ctx2) {
  53825. //>>excludeEnd("ctx");
  53826. _st(self["@testCase"])._context_(nil);
  53827. $1=_st(failed)._and_((function(){
  53828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53829. return smalltalk.withContext(function($ctx3) {
  53830. //>>excludeEnd("ctx");
  53831. return _st(self["@testCase"])._isAsync();
  53832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53833. $ctx3.sendIdx["isAsync"]=1;
  53834. //>>excludeEnd("ctx");
  53835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53836. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  53837. //>>excludeEnd("ctx");
  53838. }));
  53839. if(smalltalk.assert($1)){
  53840. _st(self["@testCase"])._finished();
  53841. };
  53842. $2=_st(self["@testCase"])._isAsync();
  53843. if(! smalltalk.assert($2)){
  53844. return _st(self["@testCase"])._tearDown();
  53845. };
  53846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53848. //>>excludeEnd("ctx");
  53849. }));
  53850. return self;
  53851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53852. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},globals.TestContext)});
  53853. //>>excludeEnd("ctx");
  53854. },
  53855. //>>excludeStart("ide", pragmas.excludeIdeData);
  53856. args: ["aBlock"],
  53857. 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 ] ]",
  53858. referencedClasses: [],
  53859. //>>excludeEnd("ide");
  53860. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  53861. }),
  53862. globals.TestContext);
  53863. smalltalk.addMethod(
  53864. smalltalk.method({
  53865. selector: "start",
  53866. protocol: 'running',
  53867. fn: function (){
  53868. var self=this;
  53869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53870. return smalltalk.withContext(function($ctx1) {
  53871. //>>excludeEnd("ctx");
  53872. self._execute_((function(){
  53873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53874. return smalltalk.withContext(function($ctx2) {
  53875. //>>excludeEnd("ctx");
  53876. _st(self["@testCase"])._setUp();
  53877. return _st(self["@testCase"])._performTest();
  53878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53880. //>>excludeEnd("ctx");
  53881. }));
  53882. return self;
  53883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53884. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.TestContext)});
  53885. //>>excludeEnd("ctx");
  53886. },
  53887. //>>excludeStart("ide", pragmas.excludeIdeData);
  53888. args: [],
  53889. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  53890. referencedClasses: [],
  53891. //>>excludeEnd("ide");
  53892. messageSends: ["execute:", "setUp", "performTest"]
  53893. }),
  53894. globals.TestContext);
  53895. smalltalk.addMethod(
  53896. smalltalk.method({
  53897. selector: "testCase:",
  53898. protocol: 'accessing',
  53899. fn: function (aTestCase){
  53900. var self=this;
  53901. self["@testCase"]=aTestCase;
  53902. return self;
  53903. },
  53904. //>>excludeStart("ide", pragmas.excludeIdeData);
  53905. args: ["aTestCase"],
  53906. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  53907. referencedClasses: [],
  53908. //>>excludeEnd("ide");
  53909. messageSends: []
  53910. }),
  53911. globals.TestContext);
  53912. smalltalk.addMethod(
  53913. smalltalk.method({
  53914. selector: "testCase:",
  53915. protocol: 'instance creation',
  53916. fn: function (aTestCase){
  53917. var self=this;
  53918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53919. return smalltalk.withContext(function($ctx1) {
  53920. //>>excludeEnd("ctx");
  53921. var $2,$3,$1;
  53922. $2=self._new();
  53923. _st($2)._testCase_(aTestCase);
  53924. $3=_st($2)._yourself();
  53925. $1=$3;
  53926. return $1;
  53927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53928. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},globals.TestContext.klass)});
  53929. //>>excludeEnd("ctx");
  53930. },
  53931. //>>excludeStart("ide", pragmas.excludeIdeData);
  53932. args: ["aTestCase"],
  53933. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  53934. referencedClasses: [],
  53935. //>>excludeEnd("ide");
  53936. messageSends: ["testCase:", "new", "yourself"]
  53937. }),
  53938. globals.TestContext.klass);
  53939. smalltalk.addClass('ReportingTestContext', globals.TestContext, ['finished', 'result'], 'SUnit');
  53940. //>>excludeStart("ide", pragmas.excludeIdeData);
  53941. 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`.";
  53942. //>>excludeEnd("ide");
  53943. smalltalk.addMethod(
  53944. smalltalk.method({
  53945. selector: "execute:",
  53946. protocol: 'running',
  53947. fn: function (aBlock){
  53948. var self=this;
  53949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53950. return smalltalk.withContext(function($ctx1) {
  53951. //>>excludeEnd("ctx");
  53952. var $1;
  53953. _st((function(){
  53954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53955. return smalltalk.withContext(function($ctx2) {
  53956. //>>excludeEnd("ctx");
  53957. return self._withErrorReporting_((function(){
  53958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53959. return smalltalk.withContext(function($ctx3) {
  53960. //>>excludeEnd("ctx");
  53961. return (
  53962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53963. $ctx3.supercall = true,
  53964. //>>excludeEnd("ctx");
  53965. globals.ReportingTestContext.superclass.fn.prototype._execute_.apply(_st(self), [aBlock]));
  53966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53967. $ctx3.supercall = false;
  53968. //>>excludeEnd("ctx");;
  53969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53971. //>>excludeEnd("ctx");
  53972. }));
  53973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53975. //>>excludeEnd("ctx");
  53976. }))._ensure_((function(){
  53977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53978. return smalltalk.withContext(function($ctx2) {
  53979. //>>excludeEnd("ctx");
  53980. $1=_st(self["@testCase"])._isAsync();
  53981. if(! smalltalk.assert($1)){
  53982. _st(self["@result"])._increaseRuns();
  53983. return _st(self["@finished"])._value();
  53984. };
  53985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53987. //>>excludeEnd("ctx");
  53988. }));
  53989. return self;
  53990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53991. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},globals.ReportingTestContext)});
  53992. //>>excludeEnd("ctx");
  53993. },
  53994. //>>excludeStart("ide", pragmas.excludeIdeData);
  53995. args: ["aBlock"],
  53996. 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 ] ]",
  53997. referencedClasses: [],
  53998. //>>excludeEnd("ide");
  53999. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  54000. }),
  54001. globals.ReportingTestContext);
  54002. smalltalk.addMethod(
  54003. smalltalk.method({
  54004. selector: "finished:",
  54005. protocol: 'accessing',
  54006. fn: function (aBlock){
  54007. var self=this;
  54008. self["@finished"]=aBlock;
  54009. return self;
  54010. },
  54011. //>>excludeStart("ide", pragmas.excludeIdeData);
  54012. args: ["aBlock"],
  54013. source: "finished: aBlock\x0a\x09finished := aBlock",
  54014. referencedClasses: [],
  54015. //>>excludeEnd("ide");
  54016. messageSends: []
  54017. }),
  54018. globals.ReportingTestContext);
  54019. smalltalk.addMethod(
  54020. smalltalk.method({
  54021. selector: "result:",
  54022. protocol: 'accessing',
  54023. fn: function (aTestResult){
  54024. var self=this;
  54025. self["@result"]=aTestResult;
  54026. return self;
  54027. },
  54028. //>>excludeStart("ide", pragmas.excludeIdeData);
  54029. args: ["aTestResult"],
  54030. source: "result: aTestResult\x0a\x09result := aTestResult",
  54031. referencedClasses: [],
  54032. //>>excludeEnd("ide");
  54033. messageSends: []
  54034. }),
  54035. globals.ReportingTestContext);
  54036. smalltalk.addMethod(
  54037. smalltalk.method({
  54038. selector: "withErrorReporting:",
  54039. protocol: 'private',
  54040. fn: function (aBlock){
  54041. var self=this;
  54042. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  54043. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  54044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54045. return smalltalk.withContext(function($ctx1) {
  54046. //>>excludeEnd("ctx");
  54047. _st((function(){
  54048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54049. return smalltalk.withContext(function($ctx2) {
  54050. //>>excludeEnd("ctx");
  54051. return _st(aBlock)._on_do_($TestFailure(),(function(ex){
  54052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54053. return smalltalk.withContext(function($ctx3) {
  54054. //>>excludeEnd("ctx");
  54055. return _st(self["@result"])._addFailure_(self["@testCase"]);
  54056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54057. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  54058. //>>excludeEnd("ctx");
  54059. }));
  54060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54062. //>>excludeEnd("ctx");
  54063. }))._on_do_($Error(),(function(ex){
  54064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54065. return smalltalk.withContext(function($ctx2) {
  54066. //>>excludeEnd("ctx");
  54067. return _st(self["@result"])._addError_(self["@testCase"]);
  54068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54069. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  54070. //>>excludeEnd("ctx");
  54071. }));
  54072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54073. $ctx1.sendIdx["on:do:"]=1;
  54074. //>>excludeEnd("ctx");
  54075. return self;
  54076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54077. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},globals.ReportingTestContext)});
  54078. //>>excludeEnd("ctx");
  54079. },
  54080. //>>excludeStart("ide", pragmas.excludeIdeData);
  54081. args: ["aBlock"],
  54082. 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 ]",
  54083. referencedClasses: ["TestFailure", "Error"],
  54084. //>>excludeEnd("ide");
  54085. messageSends: ["on:do:", "addFailure:", "addError:"]
  54086. }),
  54087. globals.ReportingTestContext);
  54088. smalltalk.addMethod(
  54089. smalltalk.method({
  54090. selector: "testCase:result:finished:",
  54091. protocol: 'instance creation',
  54092. fn: function (aTestCase,aTestResult,aBlock){
  54093. var self=this;
  54094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54095. return smalltalk.withContext(function($ctx1) {
  54096. //>>excludeEnd("ctx");
  54097. var $2,$3,$1;
  54098. $2=(
  54099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54100. $ctx1.supercall = true,
  54101. //>>excludeEnd("ctx");
  54102. globals.ReportingTestContext.klass.superclass.fn.prototype._testCase_.apply(_st(self), [aTestCase]));
  54103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54104. $ctx1.supercall = false;
  54105. //>>excludeEnd("ctx");;
  54106. _st($2)._result_(aTestResult);
  54107. _st($2)._finished_(aBlock);
  54108. $3=_st($2)._yourself();
  54109. $1=$3;
  54110. return $1;
  54111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54112. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},globals.ReportingTestContext.klass)});
  54113. //>>excludeEnd("ctx");
  54114. },
  54115. //>>excludeStart("ide", pragmas.excludeIdeData);
  54116. args: ["aTestCase", "aTestResult", "aBlock"],
  54117. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  54118. referencedClasses: [],
  54119. //>>excludeEnd("ide");
  54120. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  54121. }),
  54122. globals.ReportingTestContext.klass);
  54123. smalltalk.addClass('TestFailure', globals.Error, [], 'SUnit');
  54124. //>>excludeStart("ide", pragmas.excludeIdeData);
  54125. 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.";
  54126. //>>excludeEnd("ide");
  54127. smalltalk.addClass('TestResult', globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  54128. //>>excludeStart("ide", pragmas.excludeIdeData);
  54129. 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";
  54130. //>>excludeEnd("ide");
  54131. smalltalk.addMethod(
  54132. smalltalk.method({
  54133. selector: "addError:",
  54134. protocol: 'accessing',
  54135. fn: function (anError){
  54136. var self=this;
  54137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54138. return smalltalk.withContext(function($ctx1) {
  54139. //>>excludeEnd("ctx");
  54140. _st(self._errors())._add_(anError);
  54141. return self;
  54142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54143. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},globals.TestResult)});
  54144. //>>excludeEnd("ctx");
  54145. },
  54146. //>>excludeStart("ide", pragmas.excludeIdeData);
  54147. args: ["anError"],
  54148. source: "addError: anError\x0a\x09self errors add: anError",
  54149. referencedClasses: [],
  54150. //>>excludeEnd("ide");
  54151. messageSends: ["add:", "errors"]
  54152. }),
  54153. globals.TestResult);
  54154. smalltalk.addMethod(
  54155. smalltalk.method({
  54156. selector: "addFailure:",
  54157. protocol: 'accessing',
  54158. fn: function (aFailure){
  54159. var self=this;
  54160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54161. return smalltalk.withContext(function($ctx1) {
  54162. //>>excludeEnd("ctx");
  54163. _st(self._failures())._add_(aFailure);
  54164. return self;
  54165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54166. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},globals.TestResult)});
  54167. //>>excludeEnd("ctx");
  54168. },
  54169. //>>excludeStart("ide", pragmas.excludeIdeData);
  54170. args: ["aFailure"],
  54171. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  54172. referencedClasses: [],
  54173. //>>excludeEnd("ide");
  54174. messageSends: ["add:", "failures"]
  54175. }),
  54176. globals.TestResult);
  54177. smalltalk.addMethod(
  54178. smalltalk.method({
  54179. selector: "errors",
  54180. protocol: 'accessing',
  54181. fn: function (){
  54182. var self=this;
  54183. var $1;
  54184. $1=self["@errors"];
  54185. return $1;
  54186. },
  54187. //>>excludeStart("ide", pragmas.excludeIdeData);
  54188. args: [],
  54189. source: "errors\x0a\x09^ errors",
  54190. referencedClasses: [],
  54191. //>>excludeEnd("ide");
  54192. messageSends: []
  54193. }),
  54194. globals.TestResult);
  54195. smalltalk.addMethod(
  54196. smalltalk.method({
  54197. selector: "failures",
  54198. protocol: 'accessing',
  54199. fn: function (){
  54200. var self=this;
  54201. var $1;
  54202. $1=self["@failures"];
  54203. return $1;
  54204. },
  54205. //>>excludeStart("ide", pragmas.excludeIdeData);
  54206. args: [],
  54207. source: "failures\x0a\x09^ failures",
  54208. referencedClasses: [],
  54209. //>>excludeEnd("ide");
  54210. messageSends: []
  54211. }),
  54212. globals.TestResult);
  54213. smalltalk.addMethod(
  54214. smalltalk.method({
  54215. selector: "increaseRuns",
  54216. protocol: 'accessing',
  54217. fn: function (){
  54218. var self=this;
  54219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54220. return smalltalk.withContext(function($ctx1) {
  54221. //>>excludeEnd("ctx");
  54222. self["@runs"]=_st(self["@runs"]).__plus((1));
  54223. return self;
  54224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54225. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},globals.TestResult)});
  54226. //>>excludeEnd("ctx");
  54227. },
  54228. //>>excludeStart("ide", pragmas.excludeIdeData);
  54229. args: [],
  54230. source: "increaseRuns\x0a\x09runs := runs + 1",
  54231. referencedClasses: [],
  54232. //>>excludeEnd("ide");
  54233. messageSends: ["+"]
  54234. }),
  54235. globals.TestResult);
  54236. smalltalk.addMethod(
  54237. smalltalk.method({
  54238. selector: "initialize",
  54239. protocol: 'initialization',
  54240. fn: function (){
  54241. var self=this;
  54242. function $Date(){return globals.Date||(typeof Date=="undefined"?nil:Date)}
  54243. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  54244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54245. return smalltalk.withContext(function($ctx1) {
  54246. //>>excludeEnd("ctx");
  54247. (
  54248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54249. $ctx1.supercall = true,
  54250. //>>excludeEnd("ctx");
  54251. globals.TestResult.superclass.fn.prototype._initialize.apply(_st(self), []));
  54252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54253. $ctx1.supercall = false;
  54254. //>>excludeEnd("ctx");;
  54255. self["@timestamp"]=_st($Date())._now();
  54256. self["@runs"]=(0);
  54257. self["@errors"]=_st($Array())._new();
  54258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54259. $ctx1.sendIdx["new"]=1;
  54260. //>>excludeEnd("ctx");
  54261. self["@failures"]=_st($Array())._new();
  54262. self["@total"]=(0);
  54263. return self;
  54264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54265. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestResult)});
  54266. //>>excludeEnd("ctx");
  54267. },
  54268. //>>excludeStart("ide", pragmas.excludeIdeData);
  54269. args: [],
  54270. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  54271. referencedClasses: ["Date", "Array"],
  54272. //>>excludeEnd("ide");
  54273. messageSends: ["initialize", "now", "new"]
  54274. }),
  54275. globals.TestResult);
  54276. smalltalk.addMethod(
  54277. smalltalk.method({
  54278. selector: "nextRunDo:",
  54279. protocol: 'running',
  54280. fn: function (aBlock){
  54281. var self=this;
  54282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54283. return smalltalk.withContext(function($ctx1) {
  54284. //>>excludeEnd("ctx");
  54285. var $3,$2,$1;
  54286. $3=self._runs();
  54287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54288. $ctx1.sendIdx["runs"]=1;
  54289. //>>excludeEnd("ctx");
  54290. $2=_st($3).__eq_eq(self._total());
  54291. if(! smalltalk.assert($2)){
  54292. $1=_st(aBlock)._value_(_st(self._runs()).__plus((1)));
  54293. };
  54294. return $1;
  54295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54296. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},globals.TestResult)});
  54297. //>>excludeEnd("ctx");
  54298. },
  54299. //>>excludeStart("ide", pragmas.excludeIdeData);
  54300. args: ["aBlock"],
  54301. 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 ]",
  54302. referencedClasses: [],
  54303. //>>excludeEnd("ide");
  54304. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  54305. }),
  54306. globals.TestResult);
  54307. smalltalk.addMethod(
  54308. smalltalk.method({
  54309. selector: "runCase:",
  54310. protocol: 'running',
  54311. fn: function (aTestCase){
  54312. var self=this;
  54313. function $TestFailure(){return globals.TestFailure||(typeof TestFailure=="undefined"?nil:TestFailure)}
  54314. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  54315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54316. return smalltalk.withContext(function($ctx1) {
  54317. //>>excludeEnd("ctx");
  54318. _st((function(){
  54319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54320. return smalltalk.withContext(function($ctx2) {
  54321. //>>excludeEnd("ctx");
  54322. return _st((function(){
  54323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54324. return smalltalk.withContext(function($ctx3) {
  54325. //>>excludeEnd("ctx");
  54326. self._increaseRuns();
  54327. return _st(aTestCase)._runCase();
  54328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54329. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54330. //>>excludeEnd("ctx");
  54331. }))._on_do_($TestFailure(),(function(ex){
  54332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54333. return smalltalk.withContext(function($ctx3) {
  54334. //>>excludeEnd("ctx");
  54335. return self._addFailure_(aTestCase);
  54336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54337. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  54338. //>>excludeEnd("ctx");
  54339. }));
  54340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54342. //>>excludeEnd("ctx");
  54343. }))._on_do_($Error(),(function(ex){
  54344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54345. return smalltalk.withContext(function($ctx2) {
  54346. //>>excludeEnd("ctx");
  54347. return self._addError_(aTestCase);
  54348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54349. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  54350. //>>excludeEnd("ctx");
  54351. }));
  54352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54353. $ctx1.sendIdx["on:do:"]=1;
  54354. //>>excludeEnd("ctx");
  54355. return self;
  54356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54357. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},globals.TestResult)});
  54358. //>>excludeEnd("ctx");
  54359. },
  54360. //>>excludeStart("ide", pragmas.excludeIdeData);
  54361. args: ["aTestCase"],
  54362. 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 ]",
  54363. referencedClasses: ["TestFailure", "Error"],
  54364. //>>excludeEnd("ide");
  54365. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  54366. }),
  54367. globals.TestResult);
  54368. smalltalk.addMethod(
  54369. smalltalk.method({
  54370. selector: "runs",
  54371. protocol: 'accessing',
  54372. fn: function (){
  54373. var self=this;
  54374. var $1;
  54375. $1=self["@runs"];
  54376. return $1;
  54377. },
  54378. //>>excludeStart("ide", pragmas.excludeIdeData);
  54379. args: [],
  54380. source: "runs\x0a\x09^ runs",
  54381. referencedClasses: [],
  54382. //>>excludeEnd("ide");
  54383. messageSends: []
  54384. }),
  54385. globals.TestResult);
  54386. smalltalk.addMethod(
  54387. smalltalk.method({
  54388. selector: "status",
  54389. protocol: 'accessing',
  54390. fn: function (){
  54391. var self=this;
  54392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54393. return smalltalk.withContext(function($ctx1) {
  54394. //>>excludeEnd("ctx");
  54395. var $2,$3,$1;
  54396. $2=_st(self._errors())._isEmpty();
  54397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54398. $ctx1.sendIdx["isEmpty"]=1;
  54399. //>>excludeEnd("ctx");
  54400. if(smalltalk.assert($2)){
  54401. $3=_st(self._failures())._isEmpty();
  54402. if(smalltalk.assert($3)){
  54403. $1="success";
  54404. } else {
  54405. $1="failure";
  54406. };
  54407. } else {
  54408. $1="error";
  54409. };
  54410. return $1;
  54411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54412. }, function($ctx1) {$ctx1.fill(self,"status",{},globals.TestResult)});
  54413. //>>excludeEnd("ctx");
  54414. },
  54415. //>>excludeStart("ide", pragmas.excludeIdeData);
  54416. args: [],
  54417. 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' ]",
  54418. referencedClasses: [],
  54419. //>>excludeEnd("ide");
  54420. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  54421. }),
  54422. globals.TestResult);
  54423. smalltalk.addMethod(
  54424. smalltalk.method({
  54425. selector: "timestamp",
  54426. protocol: 'accessing',
  54427. fn: function (){
  54428. var self=this;
  54429. var $1;
  54430. $1=self["@timestamp"];
  54431. return $1;
  54432. },
  54433. //>>excludeStart("ide", pragmas.excludeIdeData);
  54434. args: [],
  54435. source: "timestamp\x0a\x09^ timestamp",
  54436. referencedClasses: [],
  54437. //>>excludeEnd("ide");
  54438. messageSends: []
  54439. }),
  54440. globals.TestResult);
  54441. smalltalk.addMethod(
  54442. smalltalk.method({
  54443. selector: "total",
  54444. protocol: 'accessing',
  54445. fn: function (){
  54446. var self=this;
  54447. var $1;
  54448. $1=self["@total"];
  54449. return $1;
  54450. },
  54451. //>>excludeStart("ide", pragmas.excludeIdeData);
  54452. args: [],
  54453. source: "total\x0a\x09^ total",
  54454. referencedClasses: [],
  54455. //>>excludeEnd("ide");
  54456. messageSends: []
  54457. }),
  54458. globals.TestResult);
  54459. smalltalk.addMethod(
  54460. smalltalk.method({
  54461. selector: "total:",
  54462. protocol: 'accessing',
  54463. fn: function (aNumber){
  54464. var self=this;
  54465. self["@total"]=aNumber;
  54466. return self;
  54467. },
  54468. //>>excludeStart("ide", pragmas.excludeIdeData);
  54469. args: ["aNumber"],
  54470. source: "total: aNumber\x0a\x09total := aNumber",
  54471. referencedClasses: [],
  54472. //>>excludeEnd("ide");
  54473. messageSends: []
  54474. }),
  54475. globals.TestResult);
  54476. smalltalk.addClass('TestSuiteRunner', globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  54477. //>>excludeStart("ide", pragmas.excludeIdeData);
  54478. 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`.";
  54479. //>>excludeEnd("ide");
  54480. smalltalk.addMethod(
  54481. smalltalk.method({
  54482. selector: "announcer",
  54483. protocol: 'accessing',
  54484. fn: function (){
  54485. var self=this;
  54486. var $1;
  54487. $1=self["@announcer"];
  54488. return $1;
  54489. },
  54490. //>>excludeStart("ide", pragmas.excludeIdeData);
  54491. args: [],
  54492. source: "announcer\x0a\x09^ announcer",
  54493. referencedClasses: [],
  54494. //>>excludeEnd("ide");
  54495. messageSends: []
  54496. }),
  54497. globals.TestSuiteRunner);
  54498. smalltalk.addMethod(
  54499. smalltalk.method({
  54500. selector: "contextOf:",
  54501. protocol: 'private',
  54502. fn: function (anInteger){
  54503. var self=this;
  54504. function $ReportingTestContext(){return globals.ReportingTestContext||(typeof ReportingTestContext=="undefined"?nil:ReportingTestContext)}
  54505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54506. return smalltalk.withContext(function($ctx1) {
  54507. //>>excludeEnd("ctx");
  54508. var $1;
  54509. $1=_st($ReportingTestContext())._testCase_result_finished_(_st(self["@suite"])._at_(anInteger),self["@result"],(function(){
  54510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54511. return smalltalk.withContext(function($ctx2) {
  54512. //>>excludeEnd("ctx");
  54513. return self._resume();
  54514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54516. //>>excludeEnd("ctx");
  54517. }));
  54518. return $1;
  54519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54520. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},globals.TestSuiteRunner)});
  54521. //>>excludeEnd("ctx");
  54522. },
  54523. //>>excludeStart("ide", pragmas.excludeIdeData);
  54524. args: ["anInteger"],
  54525. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  54526. referencedClasses: ["ReportingTestContext"],
  54527. //>>excludeEnd("ide");
  54528. messageSends: ["testCase:result:finished:", "at:", "resume"]
  54529. }),
  54530. globals.TestSuiteRunner);
  54531. smalltalk.addMethod(
  54532. smalltalk.method({
  54533. selector: "initialize",
  54534. protocol: 'initialization',
  54535. fn: function (){
  54536. var self=this;
  54537. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  54538. function $TestResult(){return globals.TestResult||(typeof TestResult=="undefined"?nil:TestResult)}
  54539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54540. return smalltalk.withContext(function($ctx1) {
  54541. //>>excludeEnd("ctx");
  54542. var $1;
  54543. (
  54544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54545. $ctx1.supercall = true,
  54546. //>>excludeEnd("ctx");
  54547. globals.TestSuiteRunner.superclass.fn.prototype._initialize.apply(_st(self), []));
  54548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54549. $ctx1.supercall = false;
  54550. //>>excludeEnd("ctx");;
  54551. self["@announcer"]=_st($Announcer())._new();
  54552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54553. $ctx1.sendIdx["new"]=1;
  54554. //>>excludeEnd("ctx");
  54555. self["@result"]=_st($TestResult())._new();
  54556. self["@runNextTest"]=(function(){
  54557. var runs;
  54558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54559. return smalltalk.withContext(function($ctx2) {
  54560. //>>excludeEnd("ctx");
  54561. runs=_st(self["@result"])._runs();
  54562. runs;
  54563. $1=_st(runs).__lt(_st(self["@result"])._total());
  54564. if(smalltalk.assert($1)){
  54565. return _st(self._contextOf_(_st(runs).__plus((1))))._start();
  54566. };
  54567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54568. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  54569. //>>excludeEnd("ctx");
  54570. });
  54571. return self;
  54572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54573. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.TestSuiteRunner)});
  54574. //>>excludeEnd("ctx");
  54575. },
  54576. //>>excludeStart("ide", pragmas.excludeIdeData);
  54577. args: [],
  54578. 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 ] ].",
  54579. referencedClasses: ["Announcer", "TestResult"],
  54580. //>>excludeEnd("ide");
  54581. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  54582. }),
  54583. globals.TestSuiteRunner);
  54584. smalltalk.addMethod(
  54585. smalltalk.method({
  54586. selector: "result",
  54587. protocol: 'accessing',
  54588. fn: function (){
  54589. var self=this;
  54590. var $1;
  54591. $1=self["@result"];
  54592. return $1;
  54593. },
  54594. //>>excludeStart("ide", pragmas.excludeIdeData);
  54595. args: [],
  54596. source: "result\x0a\x09^ result",
  54597. referencedClasses: [],
  54598. //>>excludeEnd("ide");
  54599. messageSends: []
  54600. }),
  54601. globals.TestSuiteRunner);
  54602. smalltalk.addMethod(
  54603. smalltalk.method({
  54604. selector: "resume",
  54605. protocol: 'actions',
  54606. fn: function (){
  54607. var self=this;
  54608. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  54609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54610. return smalltalk.withContext(function($ctx1) {
  54611. //>>excludeEnd("ctx");
  54612. _st(self["@runNextTest"])._fork();
  54613. _st(self["@announcer"])._announce_(_st(_st($ResultAnnouncement())._new())._result_(self["@result"]));
  54614. return self;
  54615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54616. }, function($ctx1) {$ctx1.fill(self,"resume",{},globals.TestSuiteRunner)});
  54617. //>>excludeEnd("ctx");
  54618. },
  54619. //>>excludeStart("ide", pragmas.excludeIdeData);
  54620. args: [],
  54621. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  54622. referencedClasses: ["ResultAnnouncement"],
  54623. //>>excludeEnd("ide");
  54624. messageSends: ["fork", "announce:", "result:", "new"]
  54625. }),
  54626. globals.TestSuiteRunner);
  54627. smalltalk.addMethod(
  54628. smalltalk.method({
  54629. selector: "run",
  54630. protocol: 'actions',
  54631. fn: function (){
  54632. var self=this;
  54633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54634. return smalltalk.withContext(function($ctx1) {
  54635. //>>excludeEnd("ctx");
  54636. _st(self["@result"])._total_(_st(self["@suite"])._size());
  54637. self._resume();
  54638. return self;
  54639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54640. }, function($ctx1) {$ctx1.fill(self,"run",{},globals.TestSuiteRunner)});
  54641. //>>excludeEnd("ctx");
  54642. },
  54643. //>>excludeStart("ide", pragmas.excludeIdeData);
  54644. args: [],
  54645. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  54646. referencedClasses: [],
  54647. //>>excludeEnd("ide");
  54648. messageSends: ["total:", "size", "resume"]
  54649. }),
  54650. globals.TestSuiteRunner);
  54651. smalltalk.addMethod(
  54652. smalltalk.method({
  54653. selector: "suite:",
  54654. protocol: 'accessing',
  54655. fn: function (aCollection){
  54656. var self=this;
  54657. self["@suite"]=aCollection;
  54658. return self;
  54659. },
  54660. //>>excludeStart("ide", pragmas.excludeIdeData);
  54661. args: ["aCollection"],
  54662. source: "suite: aCollection\x0a\x09suite := aCollection",
  54663. referencedClasses: [],
  54664. //>>excludeEnd("ide");
  54665. messageSends: []
  54666. }),
  54667. globals.TestSuiteRunner);
  54668. smalltalk.addMethod(
  54669. smalltalk.method({
  54670. selector: "new",
  54671. protocol: 'instance creation',
  54672. fn: function (){
  54673. var self=this;
  54674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54675. return smalltalk.withContext(function($ctx1) {
  54676. //>>excludeEnd("ctx");
  54677. self._shouldNotImplement();
  54678. return self;
  54679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54680. }, function($ctx1) {$ctx1.fill(self,"new",{},globals.TestSuiteRunner.klass)});
  54681. //>>excludeEnd("ctx");
  54682. },
  54683. //>>excludeStart("ide", pragmas.excludeIdeData);
  54684. args: [],
  54685. source: "new\x0a\x09self shouldNotImplement",
  54686. referencedClasses: [],
  54687. //>>excludeEnd("ide");
  54688. messageSends: ["shouldNotImplement"]
  54689. }),
  54690. globals.TestSuiteRunner.klass);
  54691. smalltalk.addMethod(
  54692. smalltalk.method({
  54693. selector: "on:",
  54694. protocol: 'instance creation',
  54695. fn: function (aCollection){
  54696. var self=this;
  54697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54698. return smalltalk.withContext(function($ctx1) {
  54699. //>>excludeEnd("ctx");
  54700. var $2,$1;
  54701. $2=(
  54702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54703. $ctx1.supercall = true,
  54704. //>>excludeEnd("ctx");
  54705. globals.TestSuiteRunner.klass.superclass.fn.prototype._new.apply(_st(self), []));
  54706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54707. $ctx1.supercall = false;
  54708. //>>excludeEnd("ctx");;
  54709. $1=_st($2)._suite_(aCollection);
  54710. return $1;
  54711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54712. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.TestSuiteRunner.klass)});
  54713. //>>excludeEnd("ctx");
  54714. },
  54715. //>>excludeStart("ide", pragmas.excludeIdeData);
  54716. args: ["aCollection"],
  54717. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  54718. referencedClasses: [],
  54719. //>>excludeEnd("ide");
  54720. messageSends: ["suite:", "new"]
  54721. }),
  54722. globals.TestSuiteRunner.klass);
  54723. smalltalk.addMethod(
  54724. smalltalk.method({
  54725. selector: "isTestClass",
  54726. protocol: '*SUnit',
  54727. fn: function (){
  54728. var self=this;
  54729. function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
  54730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54731. return smalltalk.withContext(function($ctx1) {
  54732. //>>excludeEnd("ctx");
  54733. var $1;
  54734. $1=_st(self._includesBehavior_($TestCase()))._and_((function(){
  54735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54736. return smalltalk.withContext(function($ctx2) {
  54737. //>>excludeEnd("ctx");
  54738. return _st(self._isAbstract())._not();
  54739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54741. //>>excludeEnd("ctx");
  54742. }));
  54743. return $1;
  54744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54745. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},globals.Behavior)});
  54746. //>>excludeEnd("ctx");
  54747. },
  54748. //>>excludeStart("ide", pragmas.excludeIdeData);
  54749. args: [],
  54750. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  54751. referencedClasses: ["TestCase"],
  54752. //>>excludeEnd("ide");
  54753. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  54754. }),
  54755. globals.Behavior);
  54756. smalltalk.addMethod(
  54757. smalltalk.method({
  54758. selector: "isTestPackage",
  54759. protocol: '*SUnit',
  54760. fn: function (){
  54761. var self=this;
  54762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54763. return smalltalk.withContext(function($ctx1) {
  54764. //>>excludeEnd("ctx");
  54765. var $1;
  54766. $1=_st(self._classes())._anySatisfy_((function(each){
  54767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54768. return smalltalk.withContext(function($ctx2) {
  54769. //>>excludeEnd("ctx");
  54770. return _st(each)._isTestClass();
  54771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54773. //>>excludeEnd("ctx");
  54774. }));
  54775. return $1;
  54776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54777. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},globals.Package)});
  54778. //>>excludeEnd("ctx");
  54779. },
  54780. //>>excludeStart("ide", pragmas.excludeIdeData);
  54781. args: [],
  54782. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  54783. referencedClasses: [],
  54784. //>>excludeEnd("ide");
  54785. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  54786. }),
  54787. globals.Package);
  54788. });
  54789. define("amber_core/Kernel-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){
  54790. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  54791. smalltalk.addPackage('Kernel-ImportExport');
  54792. smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  54793. smalltalk.addClass('AbstractExporter', globals.Object, [], 'Kernel-ImportExport');
  54794. //>>excludeStart("ide", pragmas.excludeIdeData);
  54795. 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.";
  54796. //>>excludeEnd("ide");
  54797. smalltalk.addMethod(
  54798. smalltalk.method({
  54799. selector: "chunkEscape:",
  54800. protocol: 'convenience',
  54801. fn: function (aString){
  54802. var self=this;
  54803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54804. return smalltalk.withContext(function($ctx1) {
  54805. //>>excludeEnd("ctx");
  54806. var $1;
  54807. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  54808. return $1;
  54809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54810. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},globals.AbstractExporter)});
  54811. //>>excludeEnd("ctx");
  54812. },
  54813. //>>excludeStart("ide", pragmas.excludeIdeData);
  54814. args: ["aString"],
  54815. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  54816. referencedClasses: [],
  54817. //>>excludeEnd("ide");
  54818. messageSends: ["trimBoth", "replace:with:"]
  54819. }),
  54820. globals.AbstractExporter);
  54821. smalltalk.addMethod(
  54822. smalltalk.method({
  54823. selector: "classNameFor:",
  54824. protocol: 'convenience',
  54825. fn: function (aClass){
  54826. var self=this;
  54827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54828. return smalltalk.withContext(function($ctx1) {
  54829. //>>excludeEnd("ctx");
  54830. var $2,$3,$4,$1;
  54831. $2=_st(aClass)._isMetaclass();
  54832. if(smalltalk.assert($2)){
  54833. $3=_st(_st(aClass)._instanceClass())._name();
  54834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54835. $ctx1.sendIdx["name"]=1;
  54836. //>>excludeEnd("ctx");
  54837. $1=_st($3).__comma(" class");
  54838. } else {
  54839. $4=_st(aClass)._isNil();
  54840. if(smalltalk.assert($4)){
  54841. $1="nil";
  54842. } else {
  54843. $1=_st(aClass)._name();
  54844. };
  54845. };
  54846. return $1;
  54847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54848. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},globals.AbstractExporter)});
  54849. //>>excludeEnd("ctx");
  54850. },
  54851. //>>excludeStart("ide", pragmas.excludeIdeData);
  54852. args: ["aClass"],
  54853. 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 ] ]",
  54854. referencedClasses: [],
  54855. //>>excludeEnd("ide");
  54856. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  54857. }),
  54858. globals.AbstractExporter);
  54859. smalltalk.addMethod(
  54860. smalltalk.method({
  54861. selector: "exportPackage:on:",
  54862. protocol: 'output',
  54863. fn: function (aPackage,aStream){
  54864. var self=this;
  54865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54866. return smalltalk.withContext(function($ctx1) {
  54867. //>>excludeEnd("ctx");
  54868. self._subclassResponsibility();
  54869. return self;
  54870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54871. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.AbstractExporter)});
  54872. //>>excludeEnd("ctx");
  54873. },
  54874. //>>excludeStart("ide", pragmas.excludeIdeData);
  54875. args: ["aPackage", "aStream"],
  54876. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  54877. referencedClasses: [],
  54878. //>>excludeEnd("ide");
  54879. messageSends: ["subclassResponsibility"]
  54880. }),
  54881. globals.AbstractExporter);
  54882. smalltalk.addMethod(
  54883. smalltalk.method({
  54884. selector: "extensionMethodsOfPackage:",
  54885. protocol: 'accessing',
  54886. fn: function (aPackage){
  54887. var self=this;
  54888. var result;
  54889. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  54890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54891. return smalltalk.withContext(function($ctx1) {
  54892. //>>excludeEnd("ctx");
  54893. var $1;
  54894. result=_st($OrderedCollection())._new();
  54895. _st(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  54896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54897. return smalltalk.withContext(function($ctx2) {
  54898. //>>excludeEnd("ctx");
  54899. return _st(result)._addAll_(_st(each)._methods());
  54900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54901. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54902. //>>excludeEnd("ctx");
  54903. }));
  54904. $1=result;
  54905. return $1;
  54906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54907. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},globals.AbstractExporter)});
  54908. //>>excludeEnd("ctx");
  54909. },
  54910. //>>excludeStart("ide", pragmas.excludeIdeData);
  54911. args: ["aPackage"],
  54912. 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",
  54913. referencedClasses: ["OrderedCollection"],
  54914. //>>excludeEnd("ide");
  54915. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  54916. }),
  54917. globals.AbstractExporter);
  54918. smalltalk.addMethod(
  54919. smalltalk.method({
  54920. selector: "extensionProtocolsOfPackage:",
  54921. protocol: 'accessing',
  54922. fn: function (aPackage){
  54923. var self=this;
  54924. var extensionName,result;
  54925. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  54926. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  54927. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  54928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54929. return smalltalk.withContext(function($ctx1) {
  54930. //>>excludeEnd("ctx");
  54931. var $1,$2,$3,$4;
  54932. $1=_st(aPackage)._name();
  54933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54934. $ctx1.sendIdx["name"]=1;
  54935. //>>excludeEnd("ctx");
  54936. extensionName="*".__comma($1);
  54937. result=_st($OrderedCollection())._new();
  54938. _st(_st(_st(_st($Smalltalk())._classes())._asArray())._sorted_((function(a,b){
  54939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54940. return smalltalk.withContext(function($ctx2) {
  54941. //>>excludeEnd("ctx");
  54942. $2=_st(a)._name();
  54943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54944. $ctx2.sendIdx["name"]=2;
  54945. //>>excludeEnd("ctx");
  54946. return _st($2).__lt(_st(b)._name());
  54947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54948. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  54949. //>>excludeEnd("ctx");
  54950. })))._do_((function(each){
  54951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54952. return smalltalk.withContext(function($ctx2) {
  54953. //>>excludeEnd("ctx");
  54954. return _st([each,_st(each)._class()])._do_((function(behavior){
  54955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54956. return smalltalk.withContext(function($ctx3) {
  54957. //>>excludeEnd("ctx");
  54958. $3=_st(_st(behavior)._protocols())._includes_(extensionName);
  54959. if(smalltalk.assert($3)){
  54960. return _st(result)._add_(_st($ExportMethodProtocol())._name_theClass_(extensionName,behavior));
  54961. };
  54962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54963. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  54964. //>>excludeEnd("ctx");
  54965. }));
  54966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54967. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  54968. //>>excludeEnd("ctx");
  54969. }));
  54970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54971. $ctx1.sendIdx["do:"]=1;
  54972. //>>excludeEnd("ctx");
  54973. $4=result;
  54974. return $4;
  54975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54976. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},globals.AbstractExporter)});
  54977. //>>excludeEnd("ctx");
  54978. },
  54979. //>>excludeStart("ide", pragmas.excludeIdeData);
  54980. args: ["aPackage"],
  54981. 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",
  54982. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  54983. //>>excludeEnd("ide");
  54984. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  54985. }),
  54986. globals.AbstractExporter);
  54987. smalltalk.addClass('ChunkExporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  54988. //>>excludeStart("ide", pragmas.excludeIdeData);
  54989. 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.";
  54990. //>>excludeEnd("ide");
  54991. smalltalk.addMethod(
  54992. smalltalk.method({
  54993. selector: "exportCategoryEpilogueOf:on:",
  54994. protocol: 'output',
  54995. fn: function (aCategory,aStream){
  54996. var self=this;
  54997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54998. return smalltalk.withContext(function($ctx1) {
  54999. //>>excludeEnd("ctx");
  55000. var $1;
  55001. _st(aStream)._nextPutAll_(" !");
  55002. _st(aStream)._lf();
  55003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55004. $ctx1.sendIdx["lf"]=1;
  55005. //>>excludeEnd("ctx");
  55006. $1=_st(aStream)._lf();
  55007. return self;
  55008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55009. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)});
  55010. //>>excludeEnd("ctx");
  55011. },
  55012. //>>excludeStart("ide", pragmas.excludeIdeData);
  55013. args: ["aCategory", "aStream"],
  55014. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  55015. referencedClasses: [],
  55016. //>>excludeEnd("ide");
  55017. messageSends: ["nextPutAll:", "lf"]
  55018. }),
  55019. globals.ChunkExporter);
  55020. smalltalk.addMethod(
  55021. smalltalk.method({
  55022. selector: "exportCategoryPrologueOf:on:",
  55023. protocol: 'output',
  55024. fn: function (aCategory,aStream){
  55025. var self=this;
  55026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55027. return smalltalk.withContext(function($ctx1) {
  55028. //>>excludeEnd("ctx");
  55029. var $1,$3,$2;
  55030. $1="!".__comma(self._classNameFor_(_st(aCategory)._theClass()));
  55031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55032. $ctx1.sendIdx[","]=1;
  55033. //>>excludeEnd("ctx");
  55034. _st(aStream)._nextPutAll_($1);
  55035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55036. $ctx1.sendIdx["nextPutAll:"]=1;
  55037. //>>excludeEnd("ctx");
  55038. $3=_st(" methodsFor: '".__comma(_st(aCategory)._name())).__comma("'!");
  55039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55040. $ctx1.sendIdx[","]=2;
  55041. //>>excludeEnd("ctx");
  55042. $2=_st(aStream)._nextPutAll_($3);
  55043. return self;
  55044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55045. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},globals.ChunkExporter)});
  55046. //>>excludeEnd("ctx");
  55047. },
  55048. //>>excludeStart("ide", pragmas.excludeIdeData);
  55049. args: ["aCategory", "aStream"],
  55050. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  55051. referencedClasses: [],
  55052. //>>excludeEnd("ide");
  55053. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  55054. }),
  55055. globals.ChunkExporter);
  55056. smalltalk.addMethod(
  55057. smalltalk.method({
  55058. selector: "exportDefinitionOf:on:",
  55059. protocol: 'output',
  55060. fn: function (aClass,aStream){
  55061. var self=this;
  55062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55063. return smalltalk.withContext(function($ctx1) {
  55064. //>>excludeEnd("ctx");
  55065. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  55066. $1=self._classNameFor_(_st(aClass)._superclass());
  55067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55068. $ctx1.sendIdx["classNameFor:"]=1;
  55069. //>>excludeEnd("ctx");
  55070. _st(aStream)._nextPutAll_($1);
  55071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55072. $ctx1.sendIdx["nextPutAll:"]=1;
  55073. //>>excludeEnd("ctx");
  55074. $3=self._classNameFor_(aClass);
  55075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55076. $ctx1.sendIdx["classNameFor:"]=2;
  55077. //>>excludeEnd("ctx");
  55078. $2=" subclass: #".__comma($3);
  55079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55080. $ctx1.sendIdx[","]=1;
  55081. //>>excludeEnd("ctx");
  55082. _st(aStream)._nextPutAll_($2);
  55083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55084. $ctx1.sendIdx["nextPutAll:"]=2;
  55085. //>>excludeEnd("ctx");
  55086. _st(aStream)._lf();
  55087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55088. $ctx1.sendIdx["lf"]=1;
  55089. //>>excludeEnd("ctx");
  55090. _st(aStream)._tab();
  55091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55092. $ctx1.sendIdx["tab"]=1;
  55093. //>>excludeEnd("ctx");
  55094. $4=_st(aStream)._nextPutAll_("instanceVariableNames: '");
  55095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55096. $ctx1.sendIdx["nextPutAll:"]=3;
  55097. //>>excludeEnd("ctx");
  55098. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  55099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55100. return smalltalk.withContext(function($ctx2) {
  55101. //>>excludeEnd("ctx");
  55102. return _st(aStream)._nextPutAll_(each);
  55103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55104. $ctx2.sendIdx["nextPutAll:"]=4;
  55105. //>>excludeEnd("ctx");
  55106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55107. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55108. //>>excludeEnd("ctx");
  55109. }),(function(){
  55110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55111. return smalltalk.withContext(function($ctx2) {
  55112. //>>excludeEnd("ctx");
  55113. return _st(aStream)._nextPutAll_(" ");
  55114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55115. $ctx2.sendIdx["nextPutAll:"]=5;
  55116. //>>excludeEnd("ctx");
  55117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55119. //>>excludeEnd("ctx");
  55120. }));
  55121. _st(aStream)._nextPutAll_("'");
  55122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55123. $ctx1.sendIdx["nextPutAll:"]=6;
  55124. //>>excludeEnd("ctx");
  55125. _st(aStream)._lf();
  55126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55127. $ctx1.sendIdx["lf"]=2;
  55128. //>>excludeEnd("ctx");
  55129. _st(aStream)._tab();
  55130. $6="package: '".__comma(_st(aClass)._category());
  55131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55132. $ctx1.sendIdx[","]=3;
  55133. //>>excludeEnd("ctx");
  55134. $5=_st($6).__comma("'!");
  55135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55136. $ctx1.sendIdx[","]=2;
  55137. //>>excludeEnd("ctx");
  55138. _st(aStream)._nextPutAll_($5);
  55139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55140. $ctx1.sendIdx["nextPutAll:"]=7;
  55141. //>>excludeEnd("ctx");
  55142. $7=_st(aStream)._lf();
  55143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55144. $ctx1.sendIdx["lf"]=3;
  55145. //>>excludeEnd("ctx");
  55146. $9=_st(aClass)._comment();
  55147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55148. $ctx1.sendIdx["comment"]=1;
  55149. //>>excludeEnd("ctx");
  55150. $8=_st($9)._notEmpty();
  55151. if(smalltalk.assert($8)){
  55152. $11="!".__comma(self._classNameFor_(aClass));
  55153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55154. $ctx1.sendIdx[","]=5;
  55155. //>>excludeEnd("ctx");
  55156. $10=_st($11).__comma(" commentStamp!");
  55157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55158. $ctx1.sendIdx[","]=4;
  55159. //>>excludeEnd("ctx");
  55160. _st(aStream)._nextPutAll_($10);
  55161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55162. $ctx1.sendIdx["nextPutAll:"]=8;
  55163. //>>excludeEnd("ctx");
  55164. _st(aStream)._lf();
  55165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55166. $ctx1.sendIdx["lf"]=4;
  55167. //>>excludeEnd("ctx");
  55168. _st(aStream)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  55169. $12=_st(aStream)._lf();
  55170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55171. $ctx1.sendIdx["lf"]=5;
  55172. //>>excludeEnd("ctx");
  55173. $12;
  55174. };
  55175. _st(aStream)._lf();
  55176. return self;
  55177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55178. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)});
  55179. //>>excludeEnd("ctx");
  55180. },
  55181. //>>excludeStart("ide", pragmas.excludeIdeData);
  55182. args: ["aClass", "aStream"],
  55183. 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",
  55184. referencedClasses: [],
  55185. //>>excludeEnd("ide");
  55186. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  55187. }),
  55188. globals.ChunkExporter);
  55189. smalltalk.addMethod(
  55190. smalltalk.method({
  55191. selector: "exportMetaDefinitionOf:on:",
  55192. protocol: 'output',
  55193. fn: function (aClass,aStream){
  55194. var self=this;
  55195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55196. return smalltalk.withContext(function($ctx1) {
  55197. //>>excludeEnd("ctx");
  55198. var $3,$2,$1,$5,$4,$6,$7;
  55199. $3=_st(aClass)._class();
  55200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55201. $ctx1.sendIdx["class"]=1;
  55202. //>>excludeEnd("ctx");
  55203. $2=_st($3)._instanceVariableNames();
  55204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55205. $ctx1.sendIdx["instanceVariableNames"]=1;
  55206. //>>excludeEnd("ctx");
  55207. $1=_st($2)._isEmpty();
  55208. if(! smalltalk.assert($1)){
  55209. $5=_st(aClass)._class();
  55210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55211. $ctx1.sendIdx["class"]=2;
  55212. //>>excludeEnd("ctx");
  55213. $4=self._classNameFor_($5);
  55214. _st(aStream)._nextPutAll_($4);
  55215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55216. $ctx1.sendIdx["nextPutAll:"]=1;
  55217. //>>excludeEnd("ctx");
  55218. $6=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
  55219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55220. $ctx1.sendIdx["nextPutAll:"]=2;
  55221. //>>excludeEnd("ctx");
  55222. $6;
  55223. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  55224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55225. return smalltalk.withContext(function($ctx2) {
  55226. //>>excludeEnd("ctx");
  55227. return _st(aStream)._nextPutAll_(each);
  55228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55229. $ctx2.sendIdx["nextPutAll:"]=3;
  55230. //>>excludeEnd("ctx");
  55231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55233. //>>excludeEnd("ctx");
  55234. }),(function(){
  55235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55236. return smalltalk.withContext(function($ctx2) {
  55237. //>>excludeEnd("ctx");
  55238. return _st(aStream)._nextPutAll_(" ");
  55239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55240. $ctx2.sendIdx["nextPutAll:"]=4;
  55241. //>>excludeEnd("ctx");
  55242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55244. //>>excludeEnd("ctx");
  55245. }));
  55246. _st(aStream)._nextPutAll_("'!");
  55247. _st(aStream)._lf();
  55248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55249. $ctx1.sendIdx["lf"]=1;
  55250. //>>excludeEnd("ctx");
  55251. $7=_st(aStream)._lf();
  55252. $7;
  55253. };
  55254. return self;
  55255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55256. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.ChunkExporter)});
  55257. //>>excludeEnd("ctx");
  55258. },
  55259. //>>excludeStart("ide", pragmas.excludeIdeData);
  55260. args: ["aClass", "aStream"],
  55261. 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 ]",
  55262. referencedClasses: [],
  55263. //>>excludeEnd("ide");
  55264. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  55265. }),
  55266. globals.ChunkExporter);
  55267. smalltalk.addMethod(
  55268. smalltalk.method({
  55269. selector: "exportMethod:on:",
  55270. protocol: 'output',
  55271. fn: function (aMethod,aStream){
  55272. var self=this;
  55273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55274. return smalltalk.withContext(function($ctx1) {
  55275. //>>excludeEnd("ctx");
  55276. var $1;
  55277. _st(aStream)._lf();
  55278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55279. $ctx1.sendIdx["lf"]=1;
  55280. //>>excludeEnd("ctx");
  55281. _st(aStream)._lf();
  55282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55283. $ctx1.sendIdx["lf"]=2;
  55284. //>>excludeEnd("ctx");
  55285. _st(aStream)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  55286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55287. $ctx1.sendIdx["nextPutAll:"]=1;
  55288. //>>excludeEnd("ctx");
  55289. _st(aStream)._lf();
  55290. $1=_st(aStream)._nextPutAll_("!");
  55291. return self;
  55292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55293. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.ChunkExporter)});
  55294. //>>excludeEnd("ctx");
  55295. },
  55296. //>>excludeStart("ide", pragmas.excludeIdeData);
  55297. args: ["aMethod", "aStream"],
  55298. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  55299. referencedClasses: [],
  55300. //>>excludeEnd("ide");
  55301. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  55302. }),
  55303. globals.ChunkExporter);
  55304. smalltalk.addMethod(
  55305. smalltalk.method({
  55306. selector: "exportPackage:on:",
  55307. protocol: 'output',
  55308. fn: function (aPackage,aStream){
  55309. var self=this;
  55310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55311. return smalltalk.withContext(function($ctx1) {
  55312. //>>excludeEnd("ctx");
  55313. var $1;
  55314. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  55315. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  55316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55317. return smalltalk.withContext(function($ctx2) {
  55318. //>>excludeEnd("ctx");
  55319. self._exportDefinitionOf_on_(each,aStream);
  55320. $1=self._ownMethodProtocolsOfClass_(each);
  55321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55322. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  55323. //>>excludeEnd("ctx");
  55324. self._exportProtocols_on_($1,aStream);
  55325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55326. $ctx2.sendIdx["exportProtocols:on:"]=1;
  55327. //>>excludeEnd("ctx");
  55328. self._exportMetaDefinitionOf_on_(each,aStream);
  55329. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_(_st(each)._class()),aStream);
  55330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55331. $ctx2.sendIdx["exportProtocols:on:"]=2;
  55332. //>>excludeEnd("ctx");
  55333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55334. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55335. //>>excludeEnd("ctx");
  55336. }));
  55337. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  55338. return self;
  55339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55340. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)});
  55341. //>>excludeEnd("ctx");
  55342. },
  55343. //>>excludeStart("ide", pragmas.excludeIdeData);
  55344. args: ["aPackage", "aStream"],
  55345. 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",
  55346. referencedClasses: [],
  55347. //>>excludeEnd("ide");
  55348. messageSends: ["exportPackageDefinitionOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  55349. }),
  55350. globals.ChunkExporter);
  55351. smalltalk.addMethod(
  55352. smalltalk.method({
  55353. selector: "exportPackageDefinitionOf:on:",
  55354. protocol: 'output',
  55355. fn: function (aPackage,aStream){
  55356. var self=this;
  55357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55358. return smalltalk.withContext(function($ctx1) {
  55359. //>>excludeEnd("ctx");
  55360. var $1,$2;
  55361. $1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
  55362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55363. $ctx1.sendIdx[","]=1;
  55364. //>>excludeEnd("ctx");
  55365. _st(aStream)._nextPutAll_($1);
  55366. $2=_st(aStream)._lf();
  55367. return self;
  55368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55369. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.ChunkExporter)});
  55370. //>>excludeEnd("ctx");
  55371. },
  55372. //>>excludeStart("ide", pragmas.excludeIdeData);
  55373. args: ["aPackage", "aStream"],
  55374. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  55375. referencedClasses: [],
  55376. //>>excludeEnd("ide");
  55377. messageSends: ["nextPutAll:", ",", "name", "lf"]
  55378. }),
  55379. globals.ChunkExporter);
  55380. smalltalk.addMethod(
  55381. smalltalk.method({
  55382. selector: "exportProtocol:on:",
  55383. protocol: 'output',
  55384. fn: function (aProtocol,aStream){
  55385. var self=this;
  55386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55387. return smalltalk.withContext(function($ctx1) {
  55388. //>>excludeEnd("ctx");
  55389. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  55390. _st(_st(aProtocol)._methods())._do_((function(method){
  55391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55392. return smalltalk.withContext(function($ctx2) {
  55393. //>>excludeEnd("ctx");
  55394. return self._exportMethod_on_(method,aStream);
  55395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55396. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  55397. //>>excludeEnd("ctx");
  55398. }));
  55399. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  55400. return self;
  55401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55402. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55403. //>>excludeEnd("ctx");
  55404. },
  55405. //>>excludeStart("ide", pragmas.excludeIdeData);
  55406. args: ["aProtocol", "aStream"],
  55407. 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",
  55408. referencedClasses: [],
  55409. //>>excludeEnd("ide");
  55410. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  55411. }),
  55412. globals.ChunkExporter);
  55413. smalltalk.addMethod(
  55414. smalltalk.method({
  55415. selector: "exportProtocolEpilogueOf:on:",
  55416. protocol: 'output',
  55417. fn: function (aProtocol,aStream){
  55418. var self=this;
  55419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55420. return smalltalk.withContext(function($ctx1) {
  55421. //>>excludeEnd("ctx");
  55422. var $1;
  55423. _st(aStream)._nextPutAll_(" !");
  55424. _st(aStream)._lf();
  55425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55426. $ctx1.sendIdx["lf"]=1;
  55427. //>>excludeEnd("ctx");
  55428. $1=_st(aStream)._lf();
  55429. return self;
  55430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55431. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55432. //>>excludeEnd("ctx");
  55433. },
  55434. //>>excludeStart("ide", pragmas.excludeIdeData);
  55435. args: ["aProtocol", "aStream"],
  55436. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  55437. referencedClasses: [],
  55438. //>>excludeEnd("ide");
  55439. messageSends: ["nextPutAll:", "lf"]
  55440. }),
  55441. globals.ChunkExporter);
  55442. smalltalk.addMethod(
  55443. smalltalk.method({
  55444. selector: "exportProtocolPrologueOf:on:",
  55445. protocol: 'output',
  55446. fn: function (aProtocol,aStream){
  55447. var self=this;
  55448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55449. return smalltalk.withContext(function($ctx1) {
  55450. //>>excludeEnd("ctx");
  55451. var $1,$3,$2;
  55452. $1="!".__comma(self._classNameFor_(_st(aProtocol)._theClass()));
  55453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55454. $ctx1.sendIdx[","]=1;
  55455. //>>excludeEnd("ctx");
  55456. _st(aStream)._nextPutAll_($1);
  55457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55458. $ctx1.sendIdx["nextPutAll:"]=1;
  55459. //>>excludeEnd("ctx");
  55460. $3=_st(" methodsFor: '".__comma(_st(aProtocol)._name())).__comma("'!");
  55461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55462. $ctx1.sendIdx[","]=2;
  55463. //>>excludeEnd("ctx");
  55464. $2=_st(aStream)._nextPutAll_($3);
  55465. return self;
  55466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55467. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},globals.ChunkExporter)});
  55468. //>>excludeEnd("ctx");
  55469. },
  55470. //>>excludeStart("ide", pragmas.excludeIdeData);
  55471. args: ["aProtocol", "aStream"],
  55472. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  55473. referencedClasses: [],
  55474. //>>excludeEnd("ide");
  55475. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  55476. }),
  55477. globals.ChunkExporter);
  55478. smalltalk.addMethod(
  55479. smalltalk.method({
  55480. selector: "exportProtocols:on:",
  55481. protocol: 'output',
  55482. fn: function (aCollection,aStream){
  55483. var self=this;
  55484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55485. return smalltalk.withContext(function($ctx1) {
  55486. //>>excludeEnd("ctx");
  55487. _st(aCollection)._do_((function(each){
  55488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55489. return smalltalk.withContext(function($ctx2) {
  55490. //>>excludeEnd("ctx");
  55491. return self._exportProtocol_on_(each,aStream);
  55492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55494. //>>excludeEnd("ctx");
  55495. }));
  55496. return self;
  55497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55498. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},globals.ChunkExporter)});
  55499. //>>excludeEnd("ctx");
  55500. },
  55501. //>>excludeStart("ide", pragmas.excludeIdeData);
  55502. args: ["aCollection", "aStream"],
  55503. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  55504. referencedClasses: [],
  55505. //>>excludeEnd("ide");
  55506. messageSends: ["do:", "exportProtocol:on:"]
  55507. }),
  55508. globals.ChunkExporter);
  55509. smalltalk.addMethod(
  55510. smalltalk.method({
  55511. selector: "extensionCategoriesOfPackage:",
  55512. protocol: 'accessing',
  55513. fn: function (aPackage){
  55514. var self=this;
  55515. var name,map,result;
  55516. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  55517. function $Package(){return globals.Package||(typeof Package=="undefined"?nil:Package)}
  55518. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  55519. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  55520. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  55521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55522. return smalltalk.withContext(function($ctx1) {
  55523. //>>excludeEnd("ctx");
  55524. var $1,$2;
  55525. name=_st(aPackage)._name();
  55526. result=_st($OrderedCollection())._new();
  55527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55528. $ctx1.sendIdx["new"]=1;
  55529. //>>excludeEnd("ctx");
  55530. _st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
  55531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55532. return smalltalk.withContext(function($ctx2) {
  55533. //>>excludeEnd("ctx");
  55534. return _st([each,_st(each)._class()])._do_((function(aClass){
  55535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55536. return smalltalk.withContext(function($ctx3) {
  55537. //>>excludeEnd("ctx");
  55538. map=_st($Dictionary())._new();
  55539. map;
  55540. _st(aClass)._protocolsDo_((function(category,methods){
  55541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55542. return smalltalk.withContext(function($ctx4) {
  55543. //>>excludeEnd("ctx");
  55544. $1=_st(category).__eq("*".__comma(name));
  55545. if(smalltalk.assert($1)){
  55546. return _st(map)._at_put_(category,methods);
  55547. };
  55548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55549. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  55550. //>>excludeEnd("ctx");
  55551. }));
  55552. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  55553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55554. return smalltalk.withContext(function($ctx4) {
  55555. //>>excludeEnd("ctx");
  55556. return _st(a).__lt_eq(b);
  55557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55558. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  55559. //>>excludeEnd("ctx");
  55560. })))._collect_((function(category){
  55561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55562. return smalltalk.withContext(function($ctx4) {
  55563. //>>excludeEnd("ctx");
  55564. return _st($MethodCategory())._name_theClass_methods_(category,aClass,_st(map)._at_(category));
  55565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55566. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  55567. //>>excludeEnd("ctx");
  55568. })));
  55569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55570. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  55571. //>>excludeEnd("ctx");
  55572. }));
  55573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55575. //>>excludeEnd("ctx");
  55576. }));
  55577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55578. $ctx1.sendIdx["do:"]=1;
  55579. //>>excludeEnd("ctx");
  55580. $2=result;
  55581. return $2;
  55582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55583. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},globals.ChunkExporter)});
  55584. //>>excludeEnd("ctx");
  55585. },
  55586. //>>excludeStart("ide", pragmas.excludeIdeData);
  55587. args: ["aPackage"],
  55588. 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",
  55589. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  55590. //>>excludeEnd("ide");
  55591. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  55592. }),
  55593. globals.ChunkExporter);
  55594. smalltalk.addMethod(
  55595. smalltalk.method({
  55596. selector: "ownCategoriesOfClass:",
  55597. protocol: 'accessing',
  55598. fn: function (aClass){
  55599. var self=this;
  55600. var map;
  55601. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  55602. function $MethodCategory(){return globals.MethodCategory||(typeof MethodCategory=="undefined"?nil:MethodCategory)}
  55603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55604. return smalltalk.withContext(function($ctx1) {
  55605. //>>excludeEnd("ctx");
  55606. var $1,$2;
  55607. map=_st($Dictionary())._new();
  55608. _st(aClass)._protocolsDo_((function(each,methods){
  55609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55610. return smalltalk.withContext(function($ctx2) {
  55611. //>>excludeEnd("ctx");
  55612. $1=_st(each)._match_("^\x5c*");
  55613. if(! smalltalk.assert($1)){
  55614. return _st(map)._at_put_(each,methods);
  55615. };
  55616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55617. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  55618. //>>excludeEnd("ctx");
  55619. }));
  55620. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  55621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55622. return smalltalk.withContext(function($ctx2) {
  55623. //>>excludeEnd("ctx");
  55624. return _st(a).__lt_eq(b);
  55625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55626. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  55627. //>>excludeEnd("ctx");
  55628. })))._collect_((function(each){
  55629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55630. return smalltalk.withContext(function($ctx2) {
  55631. //>>excludeEnd("ctx");
  55632. return _st($MethodCategory())._name_theClass_methods_(each,aClass,_st(map)._at_(each));
  55633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  55635. //>>excludeEnd("ctx");
  55636. }));
  55637. return $2;
  55638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55639. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},globals.ChunkExporter)});
  55640. //>>excludeEnd("ctx");
  55641. },
  55642. //>>excludeStart("ide", pragmas.excludeIdeData);
  55643. args: ["aClass"],
  55644. 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) ]",
  55645. referencedClasses: ["Dictionary", "MethodCategory"],
  55646. //>>excludeEnd("ide");
  55647. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  55648. }),
  55649. globals.ChunkExporter);
  55650. smalltalk.addMethod(
  55651. smalltalk.method({
  55652. selector: "ownCategoriesOfMetaClass:",
  55653. protocol: 'accessing',
  55654. fn: function (aClass){
  55655. var self=this;
  55656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55657. return smalltalk.withContext(function($ctx1) {
  55658. //>>excludeEnd("ctx");
  55659. var $1;
  55660. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  55661. return $1;
  55662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55663. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},globals.ChunkExporter)});
  55664. //>>excludeEnd("ctx");
  55665. },
  55666. //>>excludeStart("ide", pragmas.excludeIdeData);
  55667. args: ["aClass"],
  55668. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  55669. referencedClasses: [],
  55670. //>>excludeEnd("ide");
  55671. messageSends: ["ownCategoriesOfClass:", "class"]
  55672. }),
  55673. globals.ChunkExporter);
  55674. smalltalk.addMethod(
  55675. smalltalk.method({
  55676. selector: "ownMethodProtocolsOfClass:",
  55677. protocol: 'accessing',
  55678. fn: function (aClass){
  55679. var self=this;
  55680. function $ExportMethodProtocol(){return globals.ExportMethodProtocol||(typeof ExportMethodProtocol=="undefined"?nil:ExportMethodProtocol)}
  55681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55682. return smalltalk.withContext(function($ctx1) {
  55683. //>>excludeEnd("ctx");
  55684. var $1;
  55685. $1=_st(_st(aClass)._ownProtocols())._collect_((function(each){
  55686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55687. return smalltalk.withContext(function($ctx2) {
  55688. //>>excludeEnd("ctx");
  55689. return _st($ExportMethodProtocol())._name_theClass_(each,aClass);
  55690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55692. //>>excludeEnd("ctx");
  55693. }));
  55694. return $1;
  55695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55696. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},globals.ChunkExporter)});
  55697. //>>excludeEnd("ctx");
  55698. },
  55699. //>>excludeStart("ide", pragmas.excludeIdeData);
  55700. args: ["aClass"],
  55701. 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 ]",
  55702. referencedClasses: ["ExportMethodProtocol"],
  55703. //>>excludeEnd("ide");
  55704. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  55705. }),
  55706. globals.ChunkExporter);
  55707. smalltalk.addClass('Exporter', globals.AbstractExporter, [], 'Kernel-ImportExport');
  55708. //>>excludeStart("ide", pragmas.excludeIdeData);
  55709. 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.).";
  55710. //>>excludeEnd("ide");
  55711. smalltalk.addMethod(
  55712. smalltalk.method({
  55713. selector: "exportDefinitionOf:on:",
  55714. protocol: 'output',
  55715. fn: function (aClass,aStream){
  55716. var self=this;
  55717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55718. return smalltalk.withContext(function($ctx1) {
  55719. //>>excludeEnd("ctx");
  55720. var $2,$1,$3,$4,$6,$5,$7,$9,$8,$10;
  55721. _st(aStream)._lf();
  55722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55723. $ctx1.sendIdx["lf"]=1;
  55724. //>>excludeEnd("ctx");
  55725. _st(aStream)._nextPutAll_("smalltalk.addClass(");
  55726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55727. $ctx1.sendIdx["nextPutAll:"]=1;
  55728. //>>excludeEnd("ctx");
  55729. $2="'".__comma(self._classNameFor_(aClass));
  55730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55731. $ctx1.sendIdx[","]=2;
  55732. //>>excludeEnd("ctx");
  55733. $1=_st($2).__comma("', ");
  55734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55735. $ctx1.sendIdx[","]=1;
  55736. //>>excludeEnd("ctx");
  55737. _st(aStream)._nextPutAll_($1);
  55738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55739. $ctx1.sendIdx["nextPutAll:"]=2;
  55740. //>>excludeEnd("ctx");
  55741. $3=self._jsClassNameFor_(_st(aClass)._superclass());
  55742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55743. $ctx1.sendIdx["jsClassNameFor:"]=1;
  55744. //>>excludeEnd("ctx");
  55745. _st(aStream)._nextPutAll_($3);
  55746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55747. $ctx1.sendIdx["nextPutAll:"]=3;
  55748. //>>excludeEnd("ctx");
  55749. $4=_st(aStream)._nextPutAll_(", [");
  55750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55751. $ctx1.sendIdx["nextPutAll:"]=4;
  55752. //>>excludeEnd("ctx");
  55753. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  55754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55755. return smalltalk.withContext(function($ctx2) {
  55756. //>>excludeEnd("ctx");
  55757. $6="'".__comma(each);
  55758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55759. $ctx2.sendIdx[","]=4;
  55760. //>>excludeEnd("ctx");
  55761. $5=_st($6).__comma("'");
  55762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55763. $ctx2.sendIdx[","]=3;
  55764. //>>excludeEnd("ctx");
  55765. return _st(aStream)._nextPutAll_($5);
  55766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55767. $ctx2.sendIdx["nextPutAll:"]=5;
  55768. //>>excludeEnd("ctx");
  55769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  55771. //>>excludeEnd("ctx");
  55772. }),(function(){
  55773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55774. return smalltalk.withContext(function($ctx2) {
  55775. //>>excludeEnd("ctx");
  55776. return _st(aStream)._nextPutAll_(", ");
  55777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55778. $ctx2.sendIdx["nextPutAll:"]=6;
  55779. //>>excludeEnd("ctx");
  55780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55782. //>>excludeEnd("ctx");
  55783. }));
  55784. _st(aStream)._nextPutAll_("], '");
  55785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55786. $ctx1.sendIdx["nextPutAll:"]=7;
  55787. //>>excludeEnd("ctx");
  55788. _st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  55789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55790. $ctx1.sendIdx["nextPutAll:"]=8;
  55791. //>>excludeEnd("ctx");
  55792. $7=_st(aStream)._nextPutAll_(");");
  55793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55794. $ctx1.sendIdx["nextPutAll:"]=9;
  55795. //>>excludeEnd("ctx");
  55796. $9=_st(aClass)._comment();
  55797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55798. $ctx1.sendIdx["comment"]=1;
  55799. //>>excludeEnd("ctx");
  55800. $8=_st($9)._notEmpty();
  55801. if(smalltalk.assert($8)){
  55802. _st(aStream)._lf();
  55803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55804. $ctx1.sendIdx["lf"]=2;
  55805. //>>excludeEnd("ctx");
  55806. _st(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  55807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55808. $ctx1.sendIdx["nextPutAll:"]=10;
  55809. //>>excludeEnd("ctx");
  55810. _st(aStream)._lf();
  55811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55812. $ctx1.sendIdx["lf"]=3;
  55813. //>>excludeEnd("ctx");
  55814. _st(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  55815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55816. $ctx1.sendIdx["nextPutAll:"]=11;
  55817. //>>excludeEnd("ctx");
  55818. _st(aStream)._nextPutAll_(".comment=");
  55819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55820. $ctx1.sendIdx["nextPutAll:"]=12;
  55821. //>>excludeEnd("ctx");
  55822. _st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  55823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55824. $ctx1.sendIdx["nextPutAll:"]=13;
  55825. //>>excludeEnd("ctx");
  55826. _st(aStream)._nextPutAll_(";");
  55827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55828. $ctx1.sendIdx["nextPutAll:"]=14;
  55829. //>>excludeEnd("ctx");
  55830. _st(aStream)._lf();
  55831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55832. $ctx1.sendIdx["lf"]=4;
  55833. //>>excludeEnd("ctx");
  55834. $10=_st(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  55835. $10;
  55836. };
  55837. _st(aStream)._lf();
  55838. return self;
  55839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55840. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)});
  55841. //>>excludeEnd("ctx");
  55842. },
  55843. //>>excludeStart("ide", pragmas.excludeIdeData);
  55844. args: ["aClass", "aStream"],
  55845. 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\x09\x09nextPutAll: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: (self jsClassNameFor: aClass);\x0a\x09\x09\x09nextPutAll: '.comment=';\x0a\x09\x09\x09nextPutAll: aClass comment asJavascript;\x0a\x09\x09\x09nextPutAll: ';';\x0a\x09\x09\x09lf;\x0a\x09\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);' ].\x0a\x09aStream lf",
  55846. referencedClasses: [],
  55847. //>>excludeEnd("ide");
  55848. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript"]
  55849. }),
  55850. globals.Exporter);
  55851. smalltalk.addMethod(
  55852. smalltalk.method({
  55853. selector: "exportMetaDefinitionOf:on:",
  55854. protocol: 'output',
  55855. fn: function (aClass,aStream){
  55856. var self=this;
  55857. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  55858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55859. return smalltalk.withContext(function($ctx1) {
  55860. //>>excludeEnd("ctx");
  55861. var $3,$2,$1,$5,$4,$6,$8,$7;
  55862. _st(aStream)._lf();
  55863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55864. $ctx1.sendIdx["lf"]=1;
  55865. //>>excludeEnd("ctx");
  55866. $3=_st(aClass)._class();
  55867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55868. $ctx1.sendIdx["class"]=1;
  55869. //>>excludeEnd("ctx");
  55870. $2=_st($3)._instanceVariableNames();
  55871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55872. $ctx1.sendIdx["instanceVariableNames"]=1;
  55873. //>>excludeEnd("ctx");
  55874. $1=_st($2)._isEmpty();
  55875. if(! smalltalk.assert($1)){
  55876. $5=_st(aClass)._class();
  55877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55878. $ctx1.sendIdx["class"]=2;
  55879. //>>excludeEnd("ctx");
  55880. $4=self._jsClassNameFor_($5);
  55881. _st(aStream)._nextPutAll_($4);
  55882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55883. $ctx1.sendIdx["nextPutAll:"]=1;
  55884. //>>excludeEnd("ctx");
  55885. $6=_st(aStream)._nextPutAll_(".iVarNames = [");
  55886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55887. $ctx1.sendIdx["nextPutAll:"]=2;
  55888. //>>excludeEnd("ctx");
  55889. $6;
  55890. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  55891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55892. return smalltalk.withContext(function($ctx2) {
  55893. //>>excludeEnd("ctx");
  55894. $8="'".__comma(each);
  55895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55896. $ctx2.sendIdx[","]=2;
  55897. //>>excludeEnd("ctx");
  55898. $7=_st($8).__comma("'");
  55899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55900. $ctx2.sendIdx[","]=1;
  55901. //>>excludeEnd("ctx");
  55902. return _st(aStream)._nextPutAll_($7);
  55903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55904. $ctx2.sendIdx["nextPutAll:"]=3;
  55905. //>>excludeEnd("ctx");
  55906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  55908. //>>excludeEnd("ctx");
  55909. }),(function(){
  55910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55911. return smalltalk.withContext(function($ctx2) {
  55912. //>>excludeEnd("ctx");
  55913. return _st(aStream)._nextPutAll_(",");
  55914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55915. $ctx2.sendIdx["nextPutAll:"]=4;
  55916. //>>excludeEnd("ctx");
  55917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  55919. //>>excludeEnd("ctx");
  55920. }));
  55921. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  55922. };
  55923. return self;
  55924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55925. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},globals.Exporter)});
  55926. //>>excludeEnd("ctx");
  55927. },
  55928. //>>excludeStart("ide", pragmas.excludeIdeData);
  55929. args: ["aClass", "aStream"],
  55930. 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 ]",
  55931. referencedClasses: ["String"],
  55932. //>>excludeEnd("ide");
  55933. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  55934. }),
  55935. globals.Exporter);
  55936. smalltalk.addMethod(
  55937. smalltalk.method({
  55938. selector: "exportMethod:on:",
  55939. protocol: 'output',
  55940. fn: function (aMethod,aStream){
  55941. var self=this;
  55942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55943. return smalltalk.withContext(function($ctx1) {
  55944. //>>excludeEnd("ctx");
  55945. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14,$17;
  55946. _st(aStream)._nextPutAll_("smalltalk.addMethod(");
  55947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55948. $ctx1.sendIdx["nextPutAll:"]=1;
  55949. //>>excludeEnd("ctx");
  55950. _st(aStream)._lf();
  55951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55952. $ctx1.sendIdx["lf"]=1;
  55953. //>>excludeEnd("ctx");
  55954. _st(aStream)._nextPutAll_("smalltalk.method({");
  55955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55956. $ctx1.sendIdx["nextPutAll:"]=2;
  55957. //>>excludeEnd("ctx");
  55958. _st(aStream)._lf();
  55959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55960. $ctx1.sendIdx["lf"]=2;
  55961. //>>excludeEnd("ctx");
  55962. $3=_st(_st(aMethod)._selector())._asJavascript();
  55963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55964. $ctx1.sendIdx["asJavascript"]=1;
  55965. //>>excludeEnd("ctx");
  55966. $2="selector: ".__comma($3);
  55967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55968. $ctx1.sendIdx[","]=2;
  55969. //>>excludeEnd("ctx");
  55970. $1=_st($2).__comma(",");
  55971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55972. $ctx1.sendIdx[","]=1;
  55973. //>>excludeEnd("ctx");
  55974. _st(aStream)._nextPutAll_($1);
  55975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55976. $ctx1.sendIdx["nextPutAll:"]=3;
  55977. //>>excludeEnd("ctx");
  55978. _st(aStream)._lf();
  55979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55980. $ctx1.sendIdx["lf"]=3;
  55981. //>>excludeEnd("ctx");
  55982. $5="protocol: '".__comma(_st(aMethod)._protocol());
  55983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55984. $ctx1.sendIdx[","]=4;
  55985. //>>excludeEnd("ctx");
  55986. $4=_st($5).__comma("',");
  55987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55988. $ctx1.sendIdx[","]=3;
  55989. //>>excludeEnd("ctx");
  55990. _st(aStream)._nextPutAll_($4);
  55991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55992. $ctx1.sendIdx["nextPutAll:"]=4;
  55993. //>>excludeEnd("ctx");
  55994. _st(aStream)._lf();
  55995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55996. $ctx1.sendIdx["lf"]=4;
  55997. //>>excludeEnd("ctx");
  55998. $7="fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource());
  55999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56000. $ctx1.sendIdx[","]=6;
  56001. //>>excludeEnd("ctx");
  56002. $6=_st($7).__comma(",");
  56003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56004. $ctx1.sendIdx[","]=5;
  56005. //>>excludeEnd("ctx");
  56006. _st(aStream)._nextPutAll_($6);
  56007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56008. $ctx1.sendIdx["nextPutAll:"]=5;
  56009. //>>excludeEnd("ctx");
  56010. _st(aStream)._lf();
  56011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56012. $ctx1.sendIdx["lf"]=5;
  56013. //>>excludeEnd("ctx");
  56014. _st(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  56015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56016. $ctx1.sendIdx["nextPutAll:"]=6;
  56017. //>>excludeEnd("ctx");
  56018. _st(aStream)._lf();
  56019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56020. $ctx1.sendIdx["lf"]=6;
  56021. //>>excludeEnd("ctx");
  56022. $10=_st(_st(aMethod)._arguments())._asJavascript();
  56023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56024. $ctx1.sendIdx["asJavascript"]=2;
  56025. //>>excludeEnd("ctx");
  56026. $9="args: ".__comma($10);
  56027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56028. $ctx1.sendIdx[","]=8;
  56029. //>>excludeEnd("ctx");
  56030. $8=_st($9).__comma(",");
  56031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56032. $ctx1.sendIdx[","]=7;
  56033. //>>excludeEnd("ctx");
  56034. _st(aStream)._nextPutAll_($8);
  56035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56036. $ctx1.sendIdx["nextPutAll:"]=7;
  56037. //>>excludeEnd("ctx");
  56038. _st(aStream)._lf();
  56039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56040. $ctx1.sendIdx["lf"]=7;
  56041. //>>excludeEnd("ctx");
  56042. $13=_st(_st(aMethod)._source())._asJavascript();
  56043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56044. $ctx1.sendIdx["asJavascript"]=3;
  56045. //>>excludeEnd("ctx");
  56046. $12="source: ".__comma($13);
  56047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56048. $ctx1.sendIdx[","]=10;
  56049. //>>excludeEnd("ctx");
  56050. $11=_st($12).__comma(",");
  56051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56052. $ctx1.sendIdx[","]=9;
  56053. //>>excludeEnd("ctx");
  56054. _st(aStream)._nextPutAll_($11);
  56055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56056. $ctx1.sendIdx["nextPutAll:"]=8;
  56057. //>>excludeEnd("ctx");
  56058. _st(aStream)._lf();
  56059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56060. $ctx1.sendIdx["lf"]=8;
  56061. //>>excludeEnd("ctx");
  56062. $16=_st(_st(aMethod)._referencedClasses())._asJavascript();
  56063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56064. $ctx1.sendIdx["asJavascript"]=4;
  56065. //>>excludeEnd("ctx");
  56066. $15="referencedClasses: ".__comma($16);
  56067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56068. $ctx1.sendIdx[","]=12;
  56069. //>>excludeEnd("ctx");
  56070. $14=_st($15).__comma(",");
  56071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56072. $ctx1.sendIdx[","]=11;
  56073. //>>excludeEnd("ctx");
  56074. _st(aStream)._nextPutAll_($14);
  56075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56076. $ctx1.sendIdx["nextPutAll:"]=9;
  56077. //>>excludeEnd("ctx");
  56078. _st(aStream)._lf();
  56079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56080. $ctx1.sendIdx["lf"]=9;
  56081. //>>excludeEnd("ctx");
  56082. _st(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  56083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56084. $ctx1.sendIdx["nextPutAll:"]=10;
  56085. //>>excludeEnd("ctx");
  56086. _st(aStream)._lf();
  56087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56088. $ctx1.sendIdx["lf"]=10;
  56089. //>>excludeEnd("ctx");
  56090. _st(aStream)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  56091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56092. $ctx1.sendIdx["nextPutAll:"]=11;
  56093. //>>excludeEnd("ctx");
  56094. _st(aStream)._lf();
  56095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56096. $ctx1.sendIdx["lf"]=11;
  56097. //>>excludeEnd("ctx");
  56098. _st(aStream)._nextPutAll_("}),");
  56099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56100. $ctx1.sendIdx["nextPutAll:"]=12;
  56101. //>>excludeEnd("ctx");
  56102. _st(aStream)._lf();
  56103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56104. $ctx1.sendIdx["lf"]=12;
  56105. //>>excludeEnd("ctx");
  56106. _st(aStream)._nextPutAll_(self._jsClassNameFor_(_st(aMethod)._methodClass()));
  56107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56108. $ctx1.sendIdx["nextPutAll:"]=13;
  56109. //>>excludeEnd("ctx");
  56110. _st(aStream)._nextPutAll_(");");
  56111. _st(aStream)._lf();
  56112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56113. $ctx1.sendIdx["lf"]=13;
  56114. //>>excludeEnd("ctx");
  56115. $17=_st(aStream)._lf();
  56116. return self;
  56117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56118. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},globals.Exporter)});
  56119. //>>excludeEnd("ctx");
  56120. },
  56121. //>>excludeStart("ide", pragmas.excludeIdeData);
  56122. args: ["aMethod", "aStream"],
  56123. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\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: '//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript, ',';lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ide\x22);';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: (self jsClassNameFor: aMethod methodClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
  56124. referencedClasses: [],
  56125. //>>excludeEnd("ide");
  56126. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  56127. }),
  56128. globals.Exporter);
  56129. smalltalk.addMethod(
  56130. smalltalk.method({
  56131. selector: "exportPackage:on:",
  56132. protocol: 'output',
  56133. fn: function (aPackage,aStream){
  56134. var self=this;
  56135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56136. return smalltalk.withContext(function($ctx1) {
  56137. //>>excludeEnd("ctx");
  56138. var $1,$2;
  56139. self._exportPackagePrologueOf_on_(aPackage,aStream);
  56140. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  56141. $1=self._exportPackageTransportOf_on_(aPackage,aStream);
  56142. _st(_st(aPackage)._sortedClasses())._do_((function(each){
  56143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56144. return smalltalk.withContext(function($ctx2) {
  56145. //>>excludeEnd("ctx");
  56146. self._exportDefinitionOf_on_(each,aStream);
  56147. $2=_st(each)._ownMethods();
  56148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56149. $ctx2.sendIdx["ownMethods"]=1;
  56150. //>>excludeEnd("ctx");
  56151. _st($2)._do_((function(method){
  56152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56153. return smalltalk.withContext(function($ctx3) {
  56154. //>>excludeEnd("ctx");
  56155. return self._exportMethod_on_(method,aStream);
  56156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56157. $ctx3.sendIdx["exportMethod:on:"]=1;
  56158. //>>excludeEnd("ctx");
  56159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56160. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  56161. //>>excludeEnd("ctx");
  56162. }));
  56163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56164. $ctx2.sendIdx["do:"]=2;
  56165. //>>excludeEnd("ctx");
  56166. self._exportMetaDefinitionOf_on_(each,aStream);
  56167. return _st(_st(_st(each)._class())._ownMethods())._do_((function(method){
  56168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56169. return smalltalk.withContext(function($ctx3) {
  56170. //>>excludeEnd("ctx");
  56171. return self._exportMethod_on_(method,aStream);
  56172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56173. $ctx3.sendIdx["exportMethod:on:"]=2;
  56174. //>>excludeEnd("ctx");
  56175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56176. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  56177. //>>excludeEnd("ctx");
  56178. }));
  56179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56180. $ctx2.sendIdx["do:"]=3;
  56181. //>>excludeEnd("ctx");
  56182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56184. //>>excludeEnd("ctx");
  56185. }));
  56186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56187. $ctx1.sendIdx["do:"]=1;
  56188. //>>excludeEnd("ctx");
  56189. _st(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  56190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56191. return smalltalk.withContext(function($ctx2) {
  56192. //>>excludeEnd("ctx");
  56193. return self._exportMethod_on_(each,aStream);
  56194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56195. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  56196. //>>excludeEnd("ctx");
  56197. }));
  56198. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  56199. return self;
  56200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56201. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56202. //>>excludeEnd("ctx");
  56203. },
  56204. //>>excludeStart("ide", pragmas.excludeIdeData);
  56205. args: ["aPackage", "aStream"],
  56206. 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",
  56207. referencedClasses: [],
  56208. //>>excludeEnd("ide");
  56209. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  56210. }),
  56211. globals.Exporter);
  56212. smalltalk.addMethod(
  56213. smalltalk.method({
  56214. selector: "exportPackageDefinitionOf:on:",
  56215. protocol: 'output',
  56216. fn: function (aPackage,aStream){
  56217. var self=this;
  56218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56219. return smalltalk.withContext(function($ctx1) {
  56220. //>>excludeEnd("ctx");
  56221. var $1,$2;
  56222. _st(aStream)._nextPutAll_("smalltalk.addPackage(");
  56223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56224. $ctx1.sendIdx["nextPutAll:"]=1;
  56225. //>>excludeEnd("ctx");
  56226. $1=_st("'".__comma(_st(aPackage)._name())).__comma("');");
  56227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56228. $ctx1.sendIdx[","]=1;
  56229. //>>excludeEnd("ctx");
  56230. _st(aStream)._nextPutAll_($1);
  56231. $2=_st(aStream)._lf();
  56232. return self;
  56233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56234. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56235. //>>excludeEnd("ctx");
  56236. },
  56237. //>>excludeStart("ide", pragmas.excludeIdeData);
  56238. args: ["aPackage", "aStream"],
  56239. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'smalltalk.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  56240. referencedClasses: [],
  56241. //>>excludeEnd("ide");
  56242. messageSends: ["nextPutAll:", ",", "name", "lf"]
  56243. }),
  56244. globals.Exporter);
  56245. smalltalk.addMethod(
  56246. smalltalk.method({
  56247. selector: "exportPackageEpilogueOf:on:",
  56248. protocol: 'output',
  56249. fn: function (aPackage,aStream){
  56250. var self=this;
  56251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56252. return smalltalk.withContext(function($ctx1) {
  56253. //>>excludeEnd("ctx");
  56254. var $1;
  56255. _st(aStream)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  56256. $1=_st(aStream)._lf();
  56257. return self;
  56258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56259. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56260. //>>excludeEnd("ctx");
  56261. },
  56262. //>>excludeStart("ide", pragmas.excludeIdeData);
  56263. args: ["aPackage", "aStream"],
  56264. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '})(global_smalltalk,global_nil,global__st);';\x0a\x09\x09lf",
  56265. referencedClasses: [],
  56266. //>>excludeEnd("ide");
  56267. messageSends: ["nextPutAll:", "lf"]
  56268. }),
  56269. globals.Exporter);
  56270. smalltalk.addMethod(
  56271. smalltalk.method({
  56272. selector: "exportPackagePrologueOf:on:",
  56273. protocol: 'output',
  56274. fn: function (aPackage,aStream){
  56275. var self=this;
  56276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56277. return smalltalk.withContext(function($ctx1) {
  56278. //>>excludeEnd("ctx");
  56279. var $1;
  56280. _st(aStream)._nextPutAll_("(function(smalltalk,nil,_st){");
  56281. $1=_st(aStream)._lf();
  56282. return self;
  56283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56284. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56285. //>>excludeEnd("ctx");
  56286. },
  56287. //>>excludeStart("ide", pragmas.excludeIdeData);
  56288. args: ["aPackage", "aStream"],
  56289. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '(function(smalltalk,nil,_st){';\x0a\x09\x09lf",
  56290. referencedClasses: [],
  56291. //>>excludeEnd("ide");
  56292. messageSends: ["nextPutAll:", "lf"]
  56293. }),
  56294. globals.Exporter);
  56295. smalltalk.addMethod(
  56296. smalltalk.method({
  56297. selector: "exportPackageTransportOf:on:",
  56298. protocol: 'output',
  56299. fn: function (aPackage,aStream){
  56300. var self=this;
  56301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56302. return smalltalk.withContext(function($ctx1) {
  56303. //>>excludeEnd("ctx");
  56304. var $1;
  56305. _st(aStream)._nextPutAll_("smalltalk.packages[");
  56306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56307. $ctx1.sendIdx["nextPutAll:"]=1;
  56308. //>>excludeEnd("ctx");
  56309. _st(aStream)._nextPutAll_(_st(_st(aPackage)._name())._asJavascript());
  56310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56311. $ctx1.sendIdx["nextPutAll:"]=2;
  56312. //>>excludeEnd("ctx");
  56313. _st(aStream)._nextPutAll_("].transport = ");
  56314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56315. $ctx1.sendIdx["nextPutAll:"]=3;
  56316. //>>excludeEnd("ctx");
  56317. _st(aStream)._nextPutAll_(_st(_st(aPackage)._transport())._asJSONString());
  56318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56319. $ctx1.sendIdx["nextPutAll:"]=4;
  56320. //>>excludeEnd("ctx");
  56321. _st(aStream)._nextPutAll_(";");
  56322. $1=_st(aStream)._lf();
  56323. return self;
  56324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56325. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},globals.Exporter)});
  56326. //>>excludeEnd("ctx");
  56327. },
  56328. //>>excludeStart("ide", pragmas.excludeIdeData);
  56329. args: ["aPackage", "aStream"],
  56330. 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",
  56331. referencedClasses: [],
  56332. //>>excludeEnd("ide");
  56333. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  56334. }),
  56335. globals.Exporter);
  56336. smalltalk.addMethod(
  56337. smalltalk.method({
  56338. selector: "jsClassNameFor:",
  56339. protocol: 'convenience',
  56340. fn: function (aClass){
  56341. var self=this;
  56342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56343. return smalltalk.withContext(function($ctx1) {
  56344. //>>excludeEnd("ctx");
  56345. var $2,$1,$receiver;
  56346. $2=_st(aClass)._isMetaclass();
  56347. if(smalltalk.assert($2)){
  56348. $1=_st(self._jsClassNameFor_(_st(aClass)._instanceClass())).__comma(".klass");
  56349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56350. $ctx1.sendIdx[","]=1;
  56351. //>>excludeEnd("ctx");
  56352. } else {
  56353. if(($receiver = aClass) == null || $receiver.isNil){
  56354. $1="null";
  56355. } else {
  56356. $1="globals.".__comma(_st(aClass)._name());
  56357. };
  56358. };
  56359. return $1;
  56360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56361. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},globals.Exporter)});
  56362. //>>excludeEnd("ctx");
  56363. },
  56364. //>>excludeStart("ide", pragmas.excludeIdeData);
  56365. args: ["aClass"],
  56366. 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 ] ]",
  56367. referencedClasses: [],
  56368. //>>excludeEnd("ide");
  56369. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  56370. }),
  56371. globals.Exporter);
  56372. smalltalk.addMethod(
  56373. smalltalk.method({
  56374. selector: "ownMethodsOfClass:",
  56375. protocol: 'accessing',
  56376. fn: function (aClass){
  56377. var self=this;
  56378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56379. return smalltalk.withContext(function($ctx1) {
  56380. //>>excludeEnd("ctx");
  56381. var $2,$1;
  56382. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  56383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56384. return smalltalk.withContext(function($ctx2) {
  56385. //>>excludeEnd("ctx");
  56386. $2=_st(a)._selector();
  56387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56388. $ctx2.sendIdx["selector"]=1;
  56389. //>>excludeEnd("ctx");
  56390. return _st($2).__lt_eq(_st(b)._selector());
  56391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56392. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  56393. //>>excludeEnd("ctx");
  56394. })))._reject_((function(each){
  56395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56396. return smalltalk.withContext(function($ctx2) {
  56397. //>>excludeEnd("ctx");
  56398. return _st(_st(each)._protocol())._match_("^\x5c*");
  56399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56401. //>>excludeEnd("ctx");
  56402. }));
  56403. return $1;
  56404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56405. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},globals.Exporter)});
  56406. //>>excludeEnd("ctx");
  56407. },
  56408. //>>excludeStart("ide", pragmas.excludeIdeData);
  56409. args: ["aClass"],
  56410. 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*') ]",
  56411. referencedClasses: [],
  56412. //>>excludeEnd("ide");
  56413. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  56414. }),
  56415. globals.Exporter);
  56416. smalltalk.addMethod(
  56417. smalltalk.method({
  56418. selector: "ownMethodsOfMetaClass:",
  56419. protocol: 'accessing',
  56420. fn: function (aClass){
  56421. var self=this;
  56422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56423. return smalltalk.withContext(function($ctx1) {
  56424. //>>excludeEnd("ctx");
  56425. var $1;
  56426. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  56427. return $1;
  56428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56429. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},globals.Exporter)});
  56430. //>>excludeEnd("ctx");
  56431. },
  56432. //>>excludeStart("ide", pragmas.excludeIdeData);
  56433. args: ["aClass"],
  56434. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  56435. referencedClasses: [],
  56436. //>>excludeEnd("ide");
  56437. messageSends: ["ownMethodsOfClass:", "class"]
  56438. }),
  56439. globals.Exporter);
  56440. smalltalk.addClass('AmdExporter', globals.Exporter, ['namespace'], 'Kernel-ImportExport');
  56441. //>>excludeStart("ide", pragmas.excludeIdeData);
  56442. globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  56443. //>>excludeEnd("ide");
  56444. smalltalk.addMethod(
  56445. smalltalk.method({
  56446. selector: "amdNamesOfPackages:",
  56447. protocol: 'private',
  56448. fn: function (anArray){
  56449. var self=this;
  56450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56451. return smalltalk.withContext(function($ctx1) {
  56452. //>>excludeEnd("ctx");
  56453. var $2,$1;
  56454. $1=_st(_st(anArray)._select_((function(each){
  56455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56456. return smalltalk.withContext(function($ctx2) {
  56457. //>>excludeEnd("ctx");
  56458. $2=self._amdNamespaceOfPackage_(each);
  56459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56460. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  56461. //>>excludeEnd("ctx");
  56462. return _st($2)._notNil();
  56463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56464. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56465. //>>excludeEnd("ctx");
  56466. })))._collect_((function(each){
  56467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56468. return smalltalk.withContext(function($ctx2) {
  56469. //>>excludeEnd("ctx");
  56470. return _st(_st(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma(_st(each)._name());
  56471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56472. $ctx2.sendIdx[","]=1;
  56473. //>>excludeEnd("ctx");
  56474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  56476. //>>excludeEnd("ctx");
  56477. }));
  56478. return $1;
  56479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56480. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},globals.AmdExporter)});
  56481. //>>excludeEnd("ctx");
  56482. },
  56483. //>>excludeStart("ide", pragmas.excludeIdeData);
  56484. args: ["anArray"],
  56485. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  56486. referencedClasses: [],
  56487. //>>excludeEnd("ide");
  56488. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  56489. }),
  56490. globals.AmdExporter);
  56491. smalltalk.addMethod(
  56492. smalltalk.method({
  56493. selector: "amdNamespaceOfPackage:",
  56494. protocol: 'private',
  56495. fn: function (aPackage){
  56496. var self=this;
  56497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56498. return smalltalk.withContext(function($ctx1) {
  56499. //>>excludeEnd("ctx");
  56500. var $4,$3,$2,$1;
  56501. $4=_st(aPackage)._transport();
  56502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56503. $ctx1.sendIdx["transport"]=1;
  56504. //>>excludeEnd("ctx");
  56505. $3=_st($4)._type();
  56506. $2=_st($3).__eq("amd");
  56507. if(smalltalk.assert($2)){
  56508. $1=_st(_st(aPackage)._transport())._namespace();
  56509. } else {
  56510. $1=nil;
  56511. };
  56512. return $1;
  56513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56514. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},globals.AmdExporter)});
  56515. //>>excludeEnd("ctx");
  56516. },
  56517. //>>excludeStart("ide", pragmas.excludeIdeData);
  56518. args: ["aPackage"],
  56519. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  56520. referencedClasses: [],
  56521. //>>excludeEnd("ide");
  56522. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  56523. }),
  56524. globals.AmdExporter);
  56525. smalltalk.addMethod(
  56526. smalltalk.method({
  56527. selector: "exportPackageEpilogueOf:on:",
  56528. protocol: 'output',
  56529. fn: function (aPackage,aStream){
  56530. var self=this;
  56531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56532. return smalltalk.withContext(function($ctx1) {
  56533. //>>excludeEnd("ctx");
  56534. var $1;
  56535. _st(aStream)._nextPutAll_("});");
  56536. $1=_st(aStream)._lf();
  56537. return self;
  56538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56539. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)});
  56540. //>>excludeEnd("ctx");
  56541. },
  56542. //>>excludeStart("ide", pragmas.excludeIdeData);
  56543. args: ["aPackage", "aStream"],
  56544. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  56545. referencedClasses: [],
  56546. //>>excludeEnd("ide");
  56547. messageSends: ["nextPutAll:", "lf"]
  56548. }),
  56549. globals.AmdExporter);
  56550. smalltalk.addMethod(
  56551. smalltalk.method({
  56552. selector: "exportPackagePrologueOf:on:",
  56553. protocol: 'output',
  56554. fn: function (aPackage,aStream){
  56555. var self=this;
  56556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56557. return smalltalk.withContext(function($ctx1) {
  56558. //>>excludeEnd("ctx");
  56559. var $1;
  56560. _st(aStream)._nextPutAll_("define(\x22");
  56561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56562. $ctx1.sendIdx["nextPutAll:"]=1;
  56563. //>>excludeEnd("ctx");
  56564. _st(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  56565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56566. $ctx1.sendIdx["nextPutAll:"]=2;
  56567. //>>excludeEnd("ctx");
  56568. _st(aStream)._nextPutAll_("/");
  56569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56570. $ctx1.sendIdx["nextPutAll:"]=3;
  56571. //>>excludeEnd("ctx");
  56572. _st(aStream)._nextPutAll_(_st(aPackage)._name());
  56573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56574. $ctx1.sendIdx["nextPutAll:"]=4;
  56575. //>>excludeEnd("ctx");
  56576. _st(aStream)._nextPutAll_("\x22, ");
  56577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56578. $ctx1.sendIdx["nextPutAll:"]=5;
  56579. //>>excludeEnd("ctx");
  56580. _st(aStream)._nextPutAll_(_st(["amber/boot"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
  56581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56582. $ctx1.sendIdx["nextPutAll:"]=6;
  56583. //>>excludeEnd("ctx");
  56584. _st(aStream)._nextPutAll_(", function($boot){");
  56585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56586. $ctx1.sendIdx["nextPutAll:"]=7;
  56587. //>>excludeEnd("ctx");
  56588. _st(aStream)._lf();
  56589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56590. $ctx1.sendIdx["lf"]=1;
  56591. //>>excludeEnd("ctx");
  56592. _st(aStream)._nextPutAll_("var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;");
  56593. $1=_st(aStream)._lf();
  56594. return self;
  56595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56596. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)});
  56597. //>>excludeEnd("ctx");
  56598. },
  56599. //>>excludeStart("ide", pragmas.excludeIdeData);
  56600. args: ["aPackage", "aStream"],
  56601. 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",
  56602. referencedClasses: [],
  56603. //>>excludeEnd("ide");
  56604. messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"]
  56605. }),
  56606. globals.AmdExporter);
  56607. smalltalk.addClass('ChunkParser', globals.Object, ['stream', 'last'], 'Kernel-ImportExport');
  56608. //>>excludeStart("ide", pragmas.excludeIdeData);
  56609. 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";
  56610. //>>excludeEnd("ide");
  56611. smalltalk.addMethod(
  56612. smalltalk.method({
  56613. selector: "last",
  56614. protocol: 'accessing',
  56615. fn: function (){
  56616. var self=this;
  56617. var $1;
  56618. $1=self["@last"];
  56619. return $1;
  56620. },
  56621. //>>excludeStart("ide", pragmas.excludeIdeData);
  56622. args: [],
  56623. source: "last\x0a\x09^ last",
  56624. referencedClasses: [],
  56625. //>>excludeEnd("ide");
  56626. messageSends: []
  56627. }),
  56628. globals.ChunkParser);
  56629. smalltalk.addMethod(
  56630. smalltalk.method({
  56631. selector: "nextChunk",
  56632. protocol: 'reading',
  56633. fn: function (){
  56634. var self=this;
  56635. var char,result,chunk;
  56636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56637. return smalltalk.withContext(function($ctx1) {
  56638. //>>excludeEnd("ctx");
  56639. var $1,$2,$3,$4;
  56640. var $early={};
  56641. try {
  56642. result=""._writeStream();
  56643. _st((function(){
  56644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56645. return smalltalk.withContext(function($ctx2) {
  56646. //>>excludeEnd("ctx");
  56647. char=_st(self["@stream"])._next();
  56648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56649. $ctx2.sendIdx["next"]=1;
  56650. //>>excludeEnd("ctx");
  56651. char;
  56652. return _st(char)._notNil();
  56653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56655. //>>excludeEnd("ctx");
  56656. }))._whileTrue_((function(){
  56657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56658. return smalltalk.withContext(function($ctx2) {
  56659. //>>excludeEnd("ctx");
  56660. $1=_st(char).__eq("!");
  56661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56662. $ctx2.sendIdx["="]=1;
  56663. //>>excludeEnd("ctx");
  56664. if(smalltalk.assert($1)){
  56665. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  56666. if(smalltalk.assert($2)){
  56667. _st(self["@stream"])._next();
  56668. } else {
  56669. self["@last"]=_st(_st(result)._contents())._trimBoth();
  56670. $3=self["@last"];
  56671. throw $early=[$3];
  56672. };
  56673. };
  56674. return _st(result)._nextPut_(char);
  56675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56677. //>>excludeEnd("ctx");
  56678. }));
  56679. self["@last"]=nil;
  56680. $4=self["@last"];
  56681. return $4;
  56682. }
  56683. catch(e) {if(e===$early)return e[0]; throw e}
  56684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56685. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},globals.ChunkParser)});
  56686. //>>excludeEnd("ctx");
  56687. },
  56688. //>>excludeStart("ide", pragmas.excludeIdeData);
  56689. args: [],
  56690. 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",
  56691. referencedClasses: [],
  56692. //>>excludeEnd("ide");
  56693. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  56694. }),
  56695. globals.ChunkParser);
  56696. smalltalk.addMethod(
  56697. smalltalk.method({
  56698. selector: "stream:",
  56699. protocol: 'accessing',
  56700. fn: function (aStream){
  56701. var self=this;
  56702. self["@stream"]=aStream;
  56703. return self;
  56704. },
  56705. //>>excludeStart("ide", pragmas.excludeIdeData);
  56706. args: ["aStream"],
  56707. source: "stream: aStream\x0a\x09stream := aStream",
  56708. referencedClasses: [],
  56709. //>>excludeEnd("ide");
  56710. messageSends: []
  56711. }),
  56712. globals.ChunkParser);
  56713. smalltalk.addMethod(
  56714. smalltalk.method({
  56715. selector: "on:",
  56716. protocol: 'instance creation',
  56717. fn: function (aStream){
  56718. var self=this;
  56719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56720. return smalltalk.withContext(function($ctx1) {
  56721. //>>excludeEnd("ctx");
  56722. var $1;
  56723. $1=_st(self._new())._stream_(aStream);
  56724. return $1;
  56725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56726. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},globals.ChunkParser.klass)});
  56727. //>>excludeEnd("ctx");
  56728. },
  56729. //>>excludeStart("ide", pragmas.excludeIdeData);
  56730. args: ["aStream"],
  56731. source: "on: aStream\x0a\x09^ self new stream: aStream",
  56732. referencedClasses: [],
  56733. //>>excludeEnd("ide");
  56734. messageSends: ["stream:", "new"]
  56735. }),
  56736. globals.ChunkParser.klass);
  56737. smalltalk.addClass('ExportMethodProtocol', globals.Object, ['name', 'theClass'], 'Kernel-ImportExport');
  56738. //>>excludeStart("ide", pragmas.excludeIdeData);
  56739. 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.";
  56740. //>>excludeEnd("ide");
  56741. smalltalk.addMethod(
  56742. smalltalk.method({
  56743. selector: "methods",
  56744. protocol: 'accessing',
  56745. fn: function (){
  56746. var self=this;
  56747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56748. return smalltalk.withContext(function($ctx1) {
  56749. //>>excludeEnd("ctx");
  56750. var $2,$1;
  56751. $1=_st(_st(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  56752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56753. return smalltalk.withContext(function($ctx2) {
  56754. //>>excludeEnd("ctx");
  56755. $2=_st(a)._selector();
  56756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56757. $ctx2.sendIdx["selector"]=1;
  56758. //>>excludeEnd("ctx");
  56759. return _st($2).__lt_eq(_st(b)._selector());
  56760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56761. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  56762. //>>excludeEnd("ctx");
  56763. }));
  56764. return $1;
  56765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56766. }, function($ctx1) {$ctx1.fill(self,"methods",{},globals.ExportMethodProtocol)});
  56767. //>>excludeEnd("ctx");
  56768. },
  56769. //>>excludeStart("ide", pragmas.excludeIdeData);
  56770. args: [],
  56771. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  56772. referencedClasses: [],
  56773. //>>excludeEnd("ide");
  56774. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  56775. }),
  56776. globals.ExportMethodProtocol);
  56777. smalltalk.addMethod(
  56778. smalltalk.method({
  56779. selector: "name",
  56780. protocol: 'accessing',
  56781. fn: function (){
  56782. var self=this;
  56783. var $1;
  56784. $1=self["@name"];
  56785. return $1;
  56786. },
  56787. //>>excludeStart("ide", pragmas.excludeIdeData);
  56788. args: [],
  56789. source: "name\x0a\x09^ name",
  56790. referencedClasses: [],
  56791. //>>excludeEnd("ide");
  56792. messageSends: []
  56793. }),
  56794. globals.ExportMethodProtocol);
  56795. smalltalk.addMethod(
  56796. smalltalk.method({
  56797. selector: "name:",
  56798. protocol: 'accessing',
  56799. fn: function (aString){
  56800. var self=this;
  56801. self["@name"]=aString;
  56802. return self;
  56803. },
  56804. //>>excludeStart("ide", pragmas.excludeIdeData);
  56805. args: ["aString"],
  56806. source: "name: aString\x0a\x09name := aString",
  56807. referencedClasses: [],
  56808. //>>excludeEnd("ide");
  56809. messageSends: []
  56810. }),
  56811. globals.ExportMethodProtocol);
  56812. smalltalk.addMethod(
  56813. smalltalk.method({
  56814. selector: "theClass",
  56815. protocol: 'accessing',
  56816. fn: function (){
  56817. var self=this;
  56818. var $1;
  56819. $1=self["@theClass"];
  56820. return $1;
  56821. },
  56822. //>>excludeStart("ide", pragmas.excludeIdeData);
  56823. args: [],
  56824. source: "theClass\x0a\x09^ theClass",
  56825. referencedClasses: [],
  56826. //>>excludeEnd("ide");
  56827. messageSends: []
  56828. }),
  56829. globals.ExportMethodProtocol);
  56830. smalltalk.addMethod(
  56831. smalltalk.method({
  56832. selector: "theClass:",
  56833. protocol: 'accessing',
  56834. fn: function (aClass){
  56835. var self=this;
  56836. self["@theClass"]=aClass;
  56837. return self;
  56838. },
  56839. //>>excludeStart("ide", pragmas.excludeIdeData);
  56840. args: ["aClass"],
  56841. source: "theClass: aClass\x0a\x09theClass := aClass",
  56842. referencedClasses: [],
  56843. //>>excludeEnd("ide");
  56844. messageSends: []
  56845. }),
  56846. globals.ExportMethodProtocol);
  56847. smalltalk.addMethod(
  56848. smalltalk.method({
  56849. selector: "name:theClass:",
  56850. protocol: 'instance creation',
  56851. fn: function (aString,aClass){
  56852. var self=this;
  56853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56854. return smalltalk.withContext(function($ctx1) {
  56855. //>>excludeEnd("ctx");
  56856. var $2,$3,$1;
  56857. $2=self._new();
  56858. _st($2)._name_(aString);
  56859. _st($2)._theClass_(aClass);
  56860. $3=_st($2)._yourself();
  56861. $1=$3;
  56862. return $1;
  56863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56864. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},globals.ExportMethodProtocol.klass)});
  56865. //>>excludeEnd("ctx");
  56866. },
  56867. //>>excludeStart("ide", pragmas.excludeIdeData);
  56868. args: ["aString", "aClass"],
  56869. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  56870. referencedClasses: [],
  56871. //>>excludeEnd("ide");
  56872. messageSends: ["name:", "new", "theClass:", "yourself"]
  56873. }),
  56874. globals.ExportMethodProtocol.klass);
  56875. smalltalk.addClass('Importer', globals.Object, ['lastSection', 'lastChunk'], 'Kernel-ImportExport');
  56876. //>>excludeStart("ide", pragmas.excludeIdeData);
  56877. globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  56878. //>>excludeEnd("ide");
  56879. smalltalk.addMethod(
  56880. smalltalk.method({
  56881. selector: "import:",
  56882. protocol: 'fileIn',
  56883. fn: function (aStream){
  56884. var self=this;
  56885. var chunk,result,parser,lastEmpty;
  56886. function $ChunkParser(){return globals.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  56887. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  56888. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  56889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56890. return smalltalk.withContext(function($ctx1) {
  56891. //>>excludeEnd("ctx");
  56892. var $1,$2;
  56893. parser=_st($ChunkParser())._on_(aStream);
  56894. lastEmpty=false;
  56895. self["@lastSection"]="n/a, not started";
  56896. self["@lastChunk"]=nil;
  56897. _st((function(){
  56898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56899. return smalltalk.withContext(function($ctx2) {
  56900. //>>excludeEnd("ctx");
  56901. _st((function(){
  56902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56903. return smalltalk.withContext(function($ctx3) {
  56904. //>>excludeEnd("ctx");
  56905. chunk=_st(parser)._nextChunk();
  56906. chunk;
  56907. return _st(chunk)._isNil();
  56908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56909. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56910. //>>excludeEnd("ctx");
  56911. }))._whileFalse_((function(){
  56912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56913. return smalltalk.withContext(function($ctx3) {
  56914. //>>excludeEnd("ctx");
  56915. $1=_st(chunk)._isEmpty();
  56916. if(smalltalk.assert($1)){
  56917. lastEmpty=true;
  56918. return lastEmpty;
  56919. } else {
  56920. self["@lastSection"]=chunk;
  56921. self["@lastSection"];
  56922. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  56923. result;
  56924. $2=lastEmpty;
  56925. if(smalltalk.assert($2)){
  56926. lastEmpty=false;
  56927. lastEmpty;
  56928. return _st(result)._scanFrom_(parser);
  56929. };
  56930. };
  56931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56932. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  56933. //>>excludeEnd("ctx");
  56934. }));
  56935. self["@lastSection"]="n/a, finished";
  56936. return self["@lastSection"];
  56937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56939. //>>excludeEnd("ctx");
  56940. }))._on_do_($Error(),(function(e){
  56941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56942. return smalltalk.withContext(function($ctx2) {
  56943. //>>excludeEnd("ctx");
  56944. self["@lastChunk"]=_st(parser)._last();
  56945. self["@lastChunk"];
  56946. return _st(e)._signal();
  56947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56948. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  56949. //>>excludeEnd("ctx");
  56950. }));
  56951. return self;
  56952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56953. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},globals.Importer)});
  56954. //>>excludeEnd("ctx");
  56955. },
  56956. //>>excludeStart("ide", pragmas.excludeIdeData);
  56957. args: ["aStream"],
  56958. 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 ].",
  56959. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  56960. //>>excludeEnd("ide");
  56961. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "signal"]
  56962. }),
  56963. globals.Importer);
  56964. smalltalk.addMethod(
  56965. smalltalk.method({
  56966. selector: "lastChunk",
  56967. protocol: 'accessing',
  56968. fn: function (){
  56969. var self=this;
  56970. var $1;
  56971. $1=self["@lastChunk"];
  56972. return $1;
  56973. },
  56974. //>>excludeStart("ide", pragmas.excludeIdeData);
  56975. args: [],
  56976. source: "lastChunk\x0a\x09^ lastChunk",
  56977. referencedClasses: [],
  56978. //>>excludeEnd("ide");
  56979. messageSends: []
  56980. }),
  56981. globals.Importer);
  56982. smalltalk.addMethod(
  56983. smalltalk.method({
  56984. selector: "lastSection",
  56985. protocol: 'accessing',
  56986. fn: function (){
  56987. var self=this;
  56988. var $1;
  56989. $1=self["@lastSection"];
  56990. return $1;
  56991. },
  56992. //>>excludeStart("ide", pragmas.excludeIdeData);
  56993. args: [],
  56994. source: "lastSection\x0a\x09^ lastSection",
  56995. referencedClasses: [],
  56996. //>>excludeEnd("ide");
  56997. messageSends: []
  56998. }),
  56999. globals.Importer);
  57000. smalltalk.addClass('PackageHandler', globals.InterfacingObject, [], 'Kernel-ImportExport');
  57001. //>>excludeStart("ide", pragmas.excludeIdeData);
  57002. 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.";
  57003. //>>excludeEnd("ide");
  57004. smalltalk.addMethod(
  57005. smalltalk.method({
  57006. selector: "ajaxPutAt:data:onSuccess:onError:",
  57007. protocol: 'private',
  57008. fn: function (aURL,aString,aBlock,anotherBlock){
  57009. var self=this;
  57010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57011. return smalltalk.withContext(function($ctx1) {
  57012. //>>excludeEnd("ctx");
  57013. self._ajax_(globals.HashedCollection._newFromPairs_(["url",aURL,"type","PUT","data",aString,"contentType","text/plain;charset=UTF-8","success",aBlock,"error",anotherBlock]));
  57014. return self;
  57015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57016. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57017. //>>excludeEnd("ctx");
  57018. },
  57019. //>>excludeStart("ide", pragmas.excludeIdeData);
  57020. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  57021. 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}",
  57022. referencedClasses: [],
  57023. //>>excludeEnd("ide");
  57024. messageSends: ["ajax:"]
  57025. }),
  57026. globals.PackageHandler);
  57027. smalltalk.addMethod(
  57028. smalltalk.method({
  57029. selector: "chunkContentsFor:",
  57030. protocol: 'accessing',
  57031. fn: function (aPackage){
  57032. var self=this;
  57033. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  57034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57035. return smalltalk.withContext(function($ctx1) {
  57036. //>>excludeEnd("ctx");
  57037. var $1;
  57038. $1=_st($String())._streamContents_((function(str){
  57039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57040. return smalltalk.withContext(function($ctx2) {
  57041. //>>excludeEnd("ctx");
  57042. return _st(self._chunkExporter())._exportPackage_on_(aPackage,str);
  57043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57044. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  57045. //>>excludeEnd("ctx");
  57046. }));
  57047. return $1;
  57048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57049. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57050. //>>excludeEnd("ctx");
  57051. },
  57052. //>>excludeStart("ide", pragmas.excludeIdeData);
  57053. args: ["aPackage"],
  57054. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  57055. referencedClasses: ["String"],
  57056. //>>excludeEnd("ide");
  57057. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  57058. }),
  57059. globals.PackageHandler);
  57060. smalltalk.addMethod(
  57061. smalltalk.method({
  57062. selector: "chunkExporter",
  57063. protocol: 'factory',
  57064. fn: function (){
  57065. var self=this;
  57066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57067. return smalltalk.withContext(function($ctx1) {
  57068. //>>excludeEnd("ctx");
  57069. var $1;
  57070. $1=_st(self._chunkExporterClass())._new();
  57071. return $1;
  57072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57073. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},globals.PackageHandler)});
  57074. //>>excludeEnd("ctx");
  57075. },
  57076. //>>excludeStart("ide", pragmas.excludeIdeData);
  57077. args: [],
  57078. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  57079. referencedClasses: [],
  57080. //>>excludeEnd("ide");
  57081. messageSends: ["new", "chunkExporterClass"]
  57082. }),
  57083. globals.PackageHandler);
  57084. smalltalk.addMethod(
  57085. smalltalk.method({
  57086. selector: "chunkExporterClass",
  57087. protocol: 'accessing',
  57088. fn: function (){
  57089. var self=this;
  57090. function $ChunkExporter(){return globals.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  57091. return $ChunkExporter();
  57092. },
  57093. //>>excludeStart("ide", pragmas.excludeIdeData);
  57094. args: [],
  57095. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  57096. referencedClasses: ["ChunkExporter"],
  57097. //>>excludeEnd("ide");
  57098. messageSends: []
  57099. }),
  57100. globals.PackageHandler);
  57101. smalltalk.addMethod(
  57102. smalltalk.method({
  57103. selector: "commit:",
  57104. protocol: 'committing',
  57105. fn: function (aPackage){
  57106. var self=this;
  57107. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  57108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57109. return smalltalk.withContext(function($ctx1) {
  57110. //>>excludeEnd("ctx");
  57111. var $1,$2,$3,$4;
  57112. self._commit_onSuccess_onError_(aPackage,(function(){
  57113. }),(function(error){
  57114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57115. return smalltalk.withContext(function($ctx2) {
  57116. //>>excludeEnd("ctx");
  57117. $1=_st($PackageCommitError())._new();
  57118. $2=$1;
  57119. $3=_st("Commiting failed with reason: \x22".__comma(_st(error)._responseText())).__comma("\x22");
  57120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57121. $ctx2.sendIdx[","]=1;
  57122. //>>excludeEnd("ctx");
  57123. _st($2)._messageText_($3);
  57124. $4=_st($1)._signal();
  57125. return $4;
  57126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57127. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57128. //>>excludeEnd("ctx");
  57129. }));
  57130. return self;
  57131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57132. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},globals.PackageHandler)});
  57133. //>>excludeEnd("ctx");
  57134. },
  57135. //>>excludeStart("ide", pragmas.excludeIdeData);
  57136. args: ["aPackage"],
  57137. 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 ]",
  57138. referencedClasses: ["PackageCommitError"],
  57139. //>>excludeEnd("ide");
  57140. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  57141. }),
  57142. globals.PackageHandler);
  57143. smalltalk.addMethod(
  57144. smalltalk.method({
  57145. selector: "commit:onSuccess:onError:",
  57146. protocol: 'committing',
  57147. fn: function (aPackage,aBlock,anotherBlock){
  57148. var self=this;
  57149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57150. return smalltalk.withContext(function($ctx1) {
  57151. //>>excludeEnd("ctx");
  57152. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  57153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57154. return smalltalk.withContext(function($ctx2) {
  57155. //>>excludeEnd("ctx");
  57156. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  57157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57158. return smalltalk.withContext(function($ctx3) {
  57159. //>>excludeEnd("ctx");
  57160. _st(aPackage)._beClean();
  57161. return _st(aBlock)._value();
  57162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57163. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57164. //>>excludeEnd("ctx");
  57165. }),anotherBlock);
  57166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57167. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57168. //>>excludeEnd("ctx");
  57169. }),anotherBlock);
  57170. return self;
  57171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57172. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57173. //>>excludeEnd("ctx");
  57174. },
  57175. //>>excludeStart("ide", pragmas.excludeIdeData);
  57176. args: ["aPackage", "aBlock", "anotherBlock"],
  57177. 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",
  57178. referencedClasses: [],
  57179. //>>excludeEnd("ide");
  57180. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  57181. }),
  57182. globals.PackageHandler);
  57183. smalltalk.addMethod(
  57184. smalltalk.method({
  57185. selector: "commitJsFileFor:onSuccess:onError:",
  57186. protocol: 'committing',
  57187. fn: function (aPackage,aBlock,anotherBlock){
  57188. var self=this;
  57189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57190. return smalltalk.withContext(function($ctx1) {
  57191. //>>excludeEnd("ctx");
  57192. var $2,$1;
  57193. $2=_st(_st(self._commitPathJsFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57195. $ctx1.sendIdx[","]=2;
  57196. //>>excludeEnd("ctx");
  57197. $1=_st($2).__comma(".js");
  57198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57199. $ctx1.sendIdx[","]=1;
  57200. //>>excludeEnd("ctx");
  57201. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  57202. return self;
  57203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57204. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57205. //>>excludeEnd("ctx");
  57206. },
  57207. //>>excludeStart("ide", pragmas.excludeIdeData);
  57208. args: ["aPackage", "aBlock", "anotherBlock"],
  57209. 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",
  57210. referencedClasses: [],
  57211. //>>excludeEnd("ide");
  57212. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  57213. }),
  57214. globals.PackageHandler);
  57215. smalltalk.addMethod(
  57216. smalltalk.method({
  57217. selector: "commitPathJsFor:",
  57218. protocol: 'accessing',
  57219. fn: function (aPackage){
  57220. var self=this;
  57221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57222. return smalltalk.withContext(function($ctx1) {
  57223. //>>excludeEnd("ctx");
  57224. self._subclassResponsibility();
  57225. return self;
  57226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57227. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57228. //>>excludeEnd("ctx");
  57229. },
  57230. //>>excludeStart("ide", pragmas.excludeIdeData);
  57231. args: ["aPackage"],
  57232. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  57233. referencedClasses: [],
  57234. //>>excludeEnd("ide");
  57235. messageSends: ["subclassResponsibility"]
  57236. }),
  57237. globals.PackageHandler);
  57238. smalltalk.addMethod(
  57239. smalltalk.method({
  57240. selector: "commitPathStFor:",
  57241. protocol: 'accessing',
  57242. fn: function (aPackage){
  57243. var self=this;
  57244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57245. return smalltalk.withContext(function($ctx1) {
  57246. //>>excludeEnd("ctx");
  57247. self._subclassResponsibility();
  57248. return self;
  57249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57250. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},globals.PackageHandler)});
  57251. //>>excludeEnd("ctx");
  57252. },
  57253. //>>excludeStart("ide", pragmas.excludeIdeData);
  57254. args: ["aPackage"],
  57255. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  57256. referencedClasses: [],
  57257. //>>excludeEnd("ide");
  57258. messageSends: ["subclassResponsibility"]
  57259. }),
  57260. globals.PackageHandler);
  57261. smalltalk.addMethod(
  57262. smalltalk.method({
  57263. selector: "commitStFileFor:onSuccess:onError:",
  57264. protocol: 'committing',
  57265. fn: function (aPackage,aBlock,anotherBlock){
  57266. var self=this;
  57267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57268. return smalltalk.withContext(function($ctx1) {
  57269. //>>excludeEnd("ctx");
  57270. var $2,$1;
  57271. $2=_st(_st(self._commitPathStFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57273. $ctx1.sendIdx[","]=2;
  57274. //>>excludeEnd("ctx");
  57275. $1=_st($2).__comma(".st");
  57276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57277. $ctx1.sendIdx[","]=1;
  57278. //>>excludeEnd("ctx");
  57279. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  57280. return self;
  57281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57282. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageHandler)});
  57283. //>>excludeEnd("ctx");
  57284. },
  57285. //>>excludeStart("ide", pragmas.excludeIdeData);
  57286. args: ["aPackage", "aBlock", "anotherBlock"],
  57287. 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",
  57288. referencedClasses: [],
  57289. //>>excludeEnd("ide");
  57290. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  57291. }),
  57292. globals.PackageHandler);
  57293. smalltalk.addMethod(
  57294. smalltalk.method({
  57295. selector: "contentsFor:",
  57296. protocol: 'accessing',
  57297. fn: function (aPackage){
  57298. var self=this;
  57299. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  57300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57301. return smalltalk.withContext(function($ctx1) {
  57302. //>>excludeEnd("ctx");
  57303. var $1;
  57304. $1=_st($String())._streamContents_((function(str){
  57305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57306. return smalltalk.withContext(function($ctx2) {
  57307. //>>excludeEnd("ctx");
  57308. return _st(self._exporter())._exportPackage_on_(aPackage,str);
  57309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57310. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  57311. //>>excludeEnd("ctx");
  57312. }));
  57313. return $1;
  57314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57315. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},globals.PackageHandler)});
  57316. //>>excludeEnd("ctx");
  57317. },
  57318. //>>excludeStart("ide", pragmas.excludeIdeData);
  57319. args: ["aPackage"],
  57320. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  57321. referencedClasses: ["String"],
  57322. //>>excludeEnd("ide");
  57323. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  57324. }),
  57325. globals.PackageHandler);
  57326. smalltalk.addMethod(
  57327. smalltalk.method({
  57328. selector: "exporter",
  57329. protocol: 'factory',
  57330. fn: function (){
  57331. var self=this;
  57332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57333. return smalltalk.withContext(function($ctx1) {
  57334. //>>excludeEnd("ctx");
  57335. var $1;
  57336. $1=_st(self._exporterClass())._new();
  57337. return $1;
  57338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57339. }, function($ctx1) {$ctx1.fill(self,"exporter",{},globals.PackageHandler)});
  57340. //>>excludeEnd("ctx");
  57341. },
  57342. //>>excludeStart("ide", pragmas.excludeIdeData);
  57343. args: [],
  57344. source: "exporter\x0a\x09^ self exporterClass new",
  57345. referencedClasses: [],
  57346. //>>excludeEnd("ide");
  57347. messageSends: ["new", "exporterClass"]
  57348. }),
  57349. globals.PackageHandler);
  57350. smalltalk.addMethod(
  57351. smalltalk.method({
  57352. selector: "exporterClass",
  57353. protocol: 'accessing',
  57354. fn: function (){
  57355. var self=this;
  57356. function $Exporter(){return globals.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  57357. return $Exporter();
  57358. },
  57359. //>>excludeStart("ide", pragmas.excludeIdeData);
  57360. args: [],
  57361. source: "exporterClass\x0a\x09^ Exporter",
  57362. referencedClasses: ["Exporter"],
  57363. //>>excludeEnd("ide");
  57364. messageSends: []
  57365. }),
  57366. globals.PackageHandler);
  57367. smalltalk.addMethod(
  57368. smalltalk.method({
  57369. selector: "load:",
  57370. protocol: 'loading',
  57371. fn: function (aPackage){
  57372. var self=this;
  57373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57374. return smalltalk.withContext(function($ctx1) {
  57375. //>>excludeEnd("ctx");
  57376. self._subclassResponsibility();
  57377. return self;
  57378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57379. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.PackageHandler)});
  57380. //>>excludeEnd("ctx");
  57381. },
  57382. //>>excludeStart("ide", pragmas.excludeIdeData);
  57383. args: ["aPackage"],
  57384. source: "load: aPackage\x0a\x09self subclassResponsibility",
  57385. referencedClasses: [],
  57386. //>>excludeEnd("ide");
  57387. messageSends: ["subclassResponsibility"]
  57388. }),
  57389. globals.PackageHandler);
  57390. smalltalk.addMethod(
  57391. smalltalk.method({
  57392. selector: "onCommitError:",
  57393. protocol: 'error handling',
  57394. fn: function (anError){
  57395. var self=this;
  57396. function $PackageCommitError(){return globals.PackageCommitError||(typeof PackageCommitError=="undefined"?nil:PackageCommitError)}
  57397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57398. return smalltalk.withContext(function($ctx1) {
  57399. //>>excludeEnd("ctx");
  57400. var $1,$2,$3,$4;
  57401. $1=_st($PackageCommitError())._new();
  57402. $2=$1;
  57403. $3=_st("Commiting failed with reason: \x22".__comma(_st(anError)._responseText())).__comma("\x22");
  57404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57405. $ctx1.sendIdx[","]=1;
  57406. //>>excludeEnd("ctx");
  57407. _st($2)._messageText_($3);
  57408. $4=_st($1)._signal();
  57409. return self;
  57410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57411. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},globals.PackageHandler)});
  57412. //>>excludeEnd("ctx");
  57413. },
  57414. //>>excludeStart("ide", pragmas.excludeIdeData);
  57415. args: ["anError"],
  57416. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  57417. referencedClasses: ["PackageCommitError"],
  57418. //>>excludeEnd("ide");
  57419. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  57420. }),
  57421. globals.PackageHandler);
  57422. smalltalk.addClass('AmdPackageHandler', globals.PackageHandler, [], 'Kernel-ImportExport');
  57423. //>>excludeStart("ide", pragmas.excludeIdeData);
  57424. 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.";
  57425. //>>excludeEnd("ide");
  57426. smalltalk.addMethod(
  57427. smalltalk.method({
  57428. selector: "commitPathJsFor:",
  57429. protocol: 'accessing',
  57430. fn: function (aPackage){
  57431. var self=this;
  57432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57433. return smalltalk.withContext(function($ctx1) {
  57434. //>>excludeEnd("ctx");
  57435. var $1;
  57436. $1=self._toUrl_(self._namespaceFor_(aPackage));
  57437. return $1;
  57438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57439. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57440. //>>excludeEnd("ctx");
  57441. },
  57442. //>>excludeStart("ide", pragmas.excludeIdeData);
  57443. args: ["aPackage"],
  57444. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  57445. referencedClasses: [],
  57446. //>>excludeEnd("ide");
  57447. messageSends: ["toUrl:", "namespaceFor:"]
  57448. }),
  57449. globals.AmdPackageHandler);
  57450. smalltalk.addMethod(
  57451. smalltalk.method({
  57452. selector: "commitPathStFor:",
  57453. protocol: 'accessing',
  57454. fn: function (aPackage){
  57455. var self=this;
  57456. var path,pathWithout;
  57457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57458. return smalltalk.withContext(function($ctx1) {
  57459. //>>excludeEnd("ctx");
  57460. var $1,$3,$2;
  57461. $1=_st(self._namespaceFor_(aPackage)).__comma("/_source");
  57462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57463. $ctx1.sendIdx[","]=1;
  57464. //>>excludeEnd("ctx");
  57465. path=self._toUrl_($1);
  57466. pathWithout=self._commitPathJsFor_(aPackage);
  57467. $3=_st(path).__eq(_st(pathWithout).__comma("/_source"));
  57468. if(smalltalk.assert($3)){
  57469. $2=pathWithout;
  57470. } else {
  57471. $2=path;
  57472. };
  57473. return $2;
  57474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57475. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},globals.AmdPackageHandler)});
  57476. //>>excludeEnd("ctx");
  57477. },
  57478. //>>excludeStart("ide", pragmas.excludeIdeData);
  57479. args: ["aPackage"],
  57480. 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 ]",
  57481. referencedClasses: [],
  57482. //>>excludeEnd("ide");
  57483. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  57484. }),
  57485. globals.AmdPackageHandler);
  57486. smalltalk.addMethod(
  57487. smalltalk.method({
  57488. selector: "exporterClass",
  57489. protocol: 'accessing',
  57490. fn: function (){
  57491. var self=this;
  57492. function $AmdExporter(){return globals.AmdExporter||(typeof AmdExporter=="undefined"?nil:AmdExporter)}
  57493. return $AmdExporter();
  57494. },
  57495. //>>excludeStart("ide", pragmas.excludeIdeData);
  57496. args: [],
  57497. source: "exporterClass\x0a\x09^ AmdExporter",
  57498. referencedClasses: ["AmdExporter"],
  57499. //>>excludeEnd("ide");
  57500. messageSends: []
  57501. }),
  57502. globals.AmdPackageHandler);
  57503. smalltalk.addMethod(
  57504. smalltalk.method({
  57505. selector: "load:",
  57506. protocol: 'loading',
  57507. fn: function (aPackage){
  57508. var self=this;
  57509. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57510. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  57511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57512. return smalltalk.withContext(function($ctx1) {
  57513. //>>excludeEnd("ctx");
  57514. var $1,$3,$2,$receiver;
  57515. $1=_st($Smalltalk())._amdRequire();
  57516. if(($receiver = $1) == null || $receiver.isNil){
  57517. self._error_("AMD loader not present");
  57518. } else {
  57519. var require;
  57520. require=$receiver;
  57521. $3=_st(_st(self._namespaceFor_(aPackage)).__comma("/")).__comma(_st(aPackage)._name());
  57522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57523. $ctx1.sendIdx[","]=1;
  57524. //>>excludeEnd("ctx");
  57525. $2=_st($Array())._with_($3);
  57526. _st(require)._value_($2);
  57527. };
  57528. return self;
  57529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57530. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57531. //>>excludeEnd("ctx");
  57532. },
  57533. //>>excludeStart("ide", pragmas.excludeIdeData);
  57534. args: ["aPackage"],
  57535. 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 with: (self namespaceFor: aPackage), '/', aPackage name ) ]",
  57536. referencedClasses: ["Smalltalk", "Array"],
  57537. //>>excludeEnd("ide");
  57538. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  57539. }),
  57540. globals.AmdPackageHandler);
  57541. smalltalk.addMethod(
  57542. smalltalk.method({
  57543. selector: "namespaceFor:",
  57544. protocol: 'committing',
  57545. fn: function (aPackage){
  57546. var self=this;
  57547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57548. return smalltalk.withContext(function($ctx1) {
  57549. //>>excludeEnd("ctx");
  57550. var $1;
  57551. $1=_st(_st(aPackage)._transport())._namespace();
  57552. return $1;
  57553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57554. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},globals.AmdPackageHandler)});
  57555. //>>excludeEnd("ctx");
  57556. },
  57557. //>>excludeStart("ide", pragmas.excludeIdeData);
  57558. args: ["aPackage"],
  57559. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  57560. referencedClasses: [],
  57561. //>>excludeEnd("ide");
  57562. messageSends: ["namespace", "transport"]
  57563. }),
  57564. globals.AmdPackageHandler);
  57565. smalltalk.addMethod(
  57566. smalltalk.method({
  57567. selector: "toUrl:",
  57568. protocol: 'private',
  57569. fn: function (aString){
  57570. var self=this;
  57571. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57573. return smalltalk.withContext(function($ctx1) {
  57574. //>>excludeEnd("ctx");
  57575. var $2,$1,$receiver;
  57576. $2=_st($Smalltalk())._amdRequire();
  57577. if(($receiver = $2) == null || $receiver.isNil){
  57578. $1=self._error_("AMD loader not present");
  57579. } else {
  57580. var require;
  57581. require=$receiver;
  57582. $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
  57583. };
  57584. return $1;
  57585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57586. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},globals.AmdPackageHandler)});
  57587. //>>excludeEnd("ctx");
  57588. },
  57589. //>>excludeStart("ide", pragmas.excludeIdeData);
  57590. args: ["aString"],
  57591. 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 ]",
  57592. referencedClasses: ["Smalltalk"],
  57593. //>>excludeEnd("ide");
  57594. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  57595. }),
  57596. globals.AmdPackageHandler);
  57597. smalltalk.addMethod(
  57598. smalltalk.method({
  57599. selector: "defaultNamespace",
  57600. protocol: 'commit paths',
  57601. fn: function (){
  57602. var self=this;
  57603. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57605. return smalltalk.withContext(function($ctx1) {
  57606. //>>excludeEnd("ctx");
  57607. var $1;
  57608. $1=_st($Smalltalk())._defaultAmdNamespace();
  57609. return $1;
  57610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57611. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageHandler.klass)});
  57612. //>>excludeEnd("ctx");
  57613. },
  57614. //>>excludeStart("ide", pragmas.excludeIdeData);
  57615. args: [],
  57616. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  57617. referencedClasses: ["Smalltalk"],
  57618. //>>excludeEnd("ide");
  57619. messageSends: ["defaultAmdNamespace"]
  57620. }),
  57621. globals.AmdPackageHandler.klass);
  57622. smalltalk.addMethod(
  57623. smalltalk.method({
  57624. selector: "defaultNamespace:",
  57625. protocol: 'commit paths',
  57626. fn: function (aString){
  57627. var self=this;
  57628. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  57629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57630. return smalltalk.withContext(function($ctx1) {
  57631. //>>excludeEnd("ctx");
  57632. _st($Smalltalk())._defaultAmdNamespace_(aString);
  57633. return self;
  57634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57635. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},globals.AmdPackageHandler.klass)});
  57636. //>>excludeEnd("ctx");
  57637. },
  57638. //>>excludeStart("ide", pragmas.excludeIdeData);
  57639. args: ["aString"],
  57640. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  57641. referencedClasses: ["Smalltalk"],
  57642. //>>excludeEnd("ide");
  57643. messageSends: ["defaultAmdNamespace:"]
  57644. }),
  57645. globals.AmdPackageHandler.klass);
  57646. smalltalk.addClass('PackageTransport', globals.Object, ['package'], 'Kernel-ImportExport');
  57647. //>>excludeStart("ide", pragmas.excludeIdeData);
  57648. 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.";
  57649. //>>excludeEnd("ide");
  57650. smalltalk.addMethod(
  57651. smalltalk.method({
  57652. selector: "asJSON",
  57653. protocol: 'converting',
  57654. fn: function (){
  57655. var self=this;
  57656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57657. return smalltalk.withContext(function($ctx1) {
  57658. //>>excludeEnd("ctx");
  57659. var $1;
  57660. $1=globals.HashedCollection._newFromPairs_(["type",self._type()]);
  57661. return $1;
  57662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57663. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.PackageTransport)});
  57664. //>>excludeEnd("ctx");
  57665. },
  57666. //>>excludeStart("ide", pragmas.excludeIdeData);
  57667. args: [],
  57668. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  57669. referencedClasses: [],
  57670. //>>excludeEnd("ide");
  57671. messageSends: ["type"]
  57672. }),
  57673. globals.PackageTransport);
  57674. smalltalk.addMethod(
  57675. smalltalk.method({
  57676. selector: "commit",
  57677. protocol: 'committing',
  57678. fn: function (){
  57679. var self=this;
  57680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57681. return smalltalk.withContext(function($ctx1) {
  57682. //>>excludeEnd("ctx");
  57683. _st(self._commitHandler())._commit_(self._package());
  57684. return self;
  57685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57686. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.PackageTransport)});
  57687. //>>excludeEnd("ctx");
  57688. },
  57689. //>>excludeStart("ide", pragmas.excludeIdeData);
  57690. args: [],
  57691. source: "commit\x0a\x09self commitHandler commit: self package",
  57692. referencedClasses: [],
  57693. //>>excludeEnd("ide");
  57694. messageSends: ["commit:", "commitHandler", "package"]
  57695. }),
  57696. globals.PackageTransport);
  57697. smalltalk.addMethod(
  57698. smalltalk.method({
  57699. selector: "commitHandler",
  57700. protocol: 'factory',
  57701. fn: function (){
  57702. var self=this;
  57703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57704. return smalltalk.withContext(function($ctx1) {
  57705. //>>excludeEnd("ctx");
  57706. var $1;
  57707. $1=_st(self._commitHandlerClass())._new();
  57708. return $1;
  57709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57710. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},globals.PackageTransport)});
  57711. //>>excludeEnd("ctx");
  57712. },
  57713. //>>excludeStart("ide", pragmas.excludeIdeData);
  57714. args: [],
  57715. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  57716. referencedClasses: [],
  57717. //>>excludeEnd("ide");
  57718. messageSends: ["new", "commitHandlerClass"]
  57719. }),
  57720. globals.PackageTransport);
  57721. smalltalk.addMethod(
  57722. smalltalk.method({
  57723. selector: "commitHandlerClass",
  57724. protocol: 'accessing',
  57725. fn: function (){
  57726. var self=this;
  57727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57728. return smalltalk.withContext(function($ctx1) {
  57729. //>>excludeEnd("ctx");
  57730. self._subclassResponsibility();
  57731. return self;
  57732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57733. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},globals.PackageTransport)});
  57734. //>>excludeEnd("ctx");
  57735. },
  57736. //>>excludeStart("ide", pragmas.excludeIdeData);
  57737. args: [],
  57738. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  57739. referencedClasses: [],
  57740. //>>excludeEnd("ide");
  57741. messageSends: ["subclassResponsibility"]
  57742. }),
  57743. globals.PackageTransport);
  57744. smalltalk.addMethod(
  57745. smalltalk.method({
  57746. selector: "commitOnSuccess:onError:",
  57747. protocol: 'committing',
  57748. fn: function (aBlock,anotherBlock){
  57749. var self=this;
  57750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57751. return smalltalk.withContext(function($ctx1) {
  57752. //>>excludeEnd("ctx");
  57753. _st(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  57754. return self;
  57755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57756. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.PackageTransport)});
  57757. //>>excludeEnd("ctx");
  57758. },
  57759. //>>excludeStart("ide", pragmas.excludeIdeData);
  57760. args: ["aBlock", "anotherBlock"],
  57761. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  57762. referencedClasses: [],
  57763. //>>excludeEnd("ide");
  57764. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  57765. }),
  57766. globals.PackageTransport);
  57767. smalltalk.addMethod(
  57768. smalltalk.method({
  57769. selector: "definition",
  57770. protocol: 'accessing',
  57771. fn: function (){
  57772. var self=this;
  57773. return "";
  57774. },
  57775. //>>excludeStart("ide", pragmas.excludeIdeData);
  57776. args: [],
  57777. source: "definition\x0a\x09^ ''",
  57778. referencedClasses: [],
  57779. //>>excludeEnd("ide");
  57780. messageSends: []
  57781. }),
  57782. globals.PackageTransport);
  57783. smalltalk.addMethod(
  57784. smalltalk.method({
  57785. selector: "load",
  57786. protocol: 'loading',
  57787. fn: function (){
  57788. var self=this;
  57789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57790. return smalltalk.withContext(function($ctx1) {
  57791. //>>excludeEnd("ctx");
  57792. _st(self._commitHandler())._load_(self._package());
  57793. return self;
  57794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57795. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.PackageTransport)});
  57796. //>>excludeEnd("ctx");
  57797. },
  57798. //>>excludeStart("ide", pragmas.excludeIdeData);
  57799. args: [],
  57800. source: "load\x0a\x09self commitHandler load: self package",
  57801. referencedClasses: [],
  57802. //>>excludeEnd("ide");
  57803. messageSends: ["load:", "commitHandler", "package"]
  57804. }),
  57805. globals.PackageTransport);
  57806. smalltalk.addMethod(
  57807. smalltalk.method({
  57808. selector: "package",
  57809. protocol: 'accessing',
  57810. fn: function (){
  57811. var self=this;
  57812. var $1;
  57813. $1=self["@package"];
  57814. return $1;
  57815. },
  57816. //>>excludeStart("ide", pragmas.excludeIdeData);
  57817. args: [],
  57818. source: "package\x0a\x09^ package",
  57819. referencedClasses: [],
  57820. //>>excludeEnd("ide");
  57821. messageSends: []
  57822. }),
  57823. globals.PackageTransport);
  57824. smalltalk.addMethod(
  57825. smalltalk.method({
  57826. selector: "package:",
  57827. protocol: 'accessing',
  57828. fn: function (aPackage){
  57829. var self=this;
  57830. self["@package"]=aPackage;
  57831. return self;
  57832. },
  57833. //>>excludeStart("ide", pragmas.excludeIdeData);
  57834. args: ["aPackage"],
  57835. source: "package: aPackage\x0a\x09package := aPackage",
  57836. referencedClasses: [],
  57837. //>>excludeEnd("ide");
  57838. messageSends: []
  57839. }),
  57840. globals.PackageTransport);
  57841. smalltalk.addMethod(
  57842. smalltalk.method({
  57843. selector: "setupFromJson:",
  57844. protocol: 'initialization',
  57845. fn: function (anObject){
  57846. var self=this;
  57847. return self;
  57848. },
  57849. //>>excludeStart("ide", pragmas.excludeIdeData);
  57850. args: ["anObject"],
  57851. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  57852. referencedClasses: [],
  57853. //>>excludeEnd("ide");
  57854. messageSends: []
  57855. }),
  57856. globals.PackageTransport);
  57857. smalltalk.addMethod(
  57858. smalltalk.method({
  57859. selector: "type",
  57860. protocol: 'accessing',
  57861. fn: function (){
  57862. var self=this;
  57863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57864. return smalltalk.withContext(function($ctx1) {
  57865. //>>excludeEnd("ctx");
  57866. var $1;
  57867. $1=_st(self._class())._type();
  57868. return $1;
  57869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57870. }, function($ctx1) {$ctx1.fill(self,"type",{},globals.PackageTransport)});
  57871. //>>excludeEnd("ctx");
  57872. },
  57873. //>>excludeStart("ide", pragmas.excludeIdeData);
  57874. args: [],
  57875. source: "type\x0a\x09^ self class type",
  57876. referencedClasses: [],
  57877. //>>excludeEnd("ide");
  57878. messageSends: ["type", "class"]
  57879. }),
  57880. globals.PackageTransport);
  57881. globals.PackageTransport.klass.iVarNames = ['registry'];
  57882. smalltalk.addMethod(
  57883. smalltalk.method({
  57884. selector: "classRegisteredFor:",
  57885. protocol: 'accessing',
  57886. fn: function (aString){
  57887. var self=this;
  57888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57889. return smalltalk.withContext(function($ctx1) {
  57890. //>>excludeEnd("ctx");
  57891. var $1;
  57892. $1=_st(self["@registry"])._at_(aString);
  57893. return $1;
  57894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57895. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},globals.PackageTransport.klass)});
  57896. //>>excludeEnd("ctx");
  57897. },
  57898. //>>excludeStart("ide", pragmas.excludeIdeData);
  57899. args: ["aString"],
  57900. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  57901. referencedClasses: [],
  57902. //>>excludeEnd("ide");
  57903. messageSends: ["at:"]
  57904. }),
  57905. globals.PackageTransport.klass);
  57906. smalltalk.addMethod(
  57907. smalltalk.method({
  57908. selector: "defaultType",
  57909. protocol: 'accessing',
  57910. fn: function (){
  57911. var self=this;
  57912. function $AmdPackageTransport(){return globals.AmdPackageTransport||(typeof AmdPackageTransport=="undefined"?nil:AmdPackageTransport)}
  57913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57914. return smalltalk.withContext(function($ctx1) {
  57915. //>>excludeEnd("ctx");
  57916. var $1;
  57917. $1=_st($AmdPackageTransport())._type();
  57918. return $1;
  57919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57920. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},globals.PackageTransport.klass)});
  57921. //>>excludeEnd("ctx");
  57922. },
  57923. //>>excludeStart("ide", pragmas.excludeIdeData);
  57924. args: [],
  57925. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  57926. referencedClasses: ["AmdPackageTransport"],
  57927. //>>excludeEnd("ide");
  57928. messageSends: ["type"]
  57929. }),
  57930. globals.PackageTransport.klass);
  57931. smalltalk.addMethod(
  57932. smalltalk.method({
  57933. selector: "for:",
  57934. protocol: 'instance creation',
  57935. fn: function (aString){
  57936. var self=this;
  57937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57938. return smalltalk.withContext(function($ctx1) {
  57939. //>>excludeEnd("ctx");
  57940. var $1;
  57941. $1=_st(self._classRegisteredFor_(aString))._new();
  57942. return $1;
  57943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57944. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},globals.PackageTransport.klass)});
  57945. //>>excludeEnd("ctx");
  57946. },
  57947. //>>excludeStart("ide", pragmas.excludeIdeData);
  57948. args: ["aString"],
  57949. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  57950. referencedClasses: [],
  57951. //>>excludeEnd("ide");
  57952. messageSends: ["new", "classRegisteredFor:"]
  57953. }),
  57954. globals.PackageTransport.klass);
  57955. smalltalk.addMethod(
  57956. smalltalk.method({
  57957. selector: "fromJson:",
  57958. protocol: 'instance creation',
  57959. fn: function (anObject){
  57960. var self=this;
  57961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57962. return smalltalk.withContext(function($ctx1) {
  57963. //>>excludeEnd("ctx");
  57964. var $1,$3,$4,$2,$receiver;
  57965. if(($receiver = anObject) == null || $receiver.isNil){
  57966. $1=self._for_(self._defaultType());
  57967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57968. $ctx1.sendIdx["for:"]=1;
  57969. //>>excludeEnd("ctx");
  57970. return $1;
  57971. } else {
  57972. anObject;
  57973. };
  57974. $3=self._for_(_st(anObject)._type());
  57975. _st($3)._setupFromJson_(anObject);
  57976. $4=_st($3)._yourself();
  57977. $2=$4;
  57978. return $2;
  57979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57980. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},globals.PackageTransport.klass)});
  57981. //>>excludeEnd("ctx");
  57982. },
  57983. //>>excludeStart("ide", pragmas.excludeIdeData);
  57984. args: ["anObject"],
  57985. 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",
  57986. referencedClasses: [],
  57987. //>>excludeEnd("ide");
  57988. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  57989. }),
  57990. globals.PackageTransport.klass);
  57991. smalltalk.addMethod(
  57992. smalltalk.method({
  57993. selector: "initialize",
  57994. protocol: 'initialization',
  57995. fn: function (){
  57996. var self=this;
  57997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57998. return smalltalk.withContext(function($ctx1) {
  57999. //>>excludeEnd("ctx");
  58000. (
  58001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58002. $ctx1.supercall = true,
  58003. //>>excludeEnd("ctx");
  58004. globals.PackageTransport.klass.superclass.fn.prototype._initialize.apply(_st(self), []));
  58005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58006. $ctx1.supercall = false;
  58007. //>>excludeEnd("ctx");;
  58008. self["@registry"]=globals.HashedCollection._newFromPairs_([]);
  58009. self._register();
  58010. return self;
  58011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58012. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.PackageTransport.klass)});
  58013. //>>excludeEnd("ctx");
  58014. },
  58015. //>>excludeStart("ide", pragmas.excludeIdeData);
  58016. args: [],
  58017. source: "initialize\x0a\x09super initialize.\x0a\x09registry := #{}.\x0a\x09self register",
  58018. referencedClasses: [],
  58019. //>>excludeEnd("ide");
  58020. messageSends: ["initialize", "register"]
  58021. }),
  58022. globals.PackageTransport.klass);
  58023. smalltalk.addMethod(
  58024. smalltalk.method({
  58025. selector: "register",
  58026. protocol: 'registration',
  58027. fn: function (){
  58028. var self=this;
  58029. function $PackageTransport(){return globals.PackageTransport||(typeof PackageTransport=="undefined"?nil:PackageTransport)}
  58030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58031. return smalltalk.withContext(function($ctx1) {
  58032. //>>excludeEnd("ctx");
  58033. _st($PackageTransport())._register_(self);
  58034. return self;
  58035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58036. }, function($ctx1) {$ctx1.fill(self,"register",{},globals.PackageTransport.klass)});
  58037. //>>excludeEnd("ctx");
  58038. },
  58039. //>>excludeStart("ide", pragmas.excludeIdeData);
  58040. args: [],
  58041. source: "register\x0a\x09PackageTransport register: self",
  58042. referencedClasses: ["PackageTransport"],
  58043. //>>excludeEnd("ide");
  58044. messageSends: ["register:"]
  58045. }),
  58046. globals.PackageTransport.klass);
  58047. smalltalk.addMethod(
  58048. smalltalk.method({
  58049. selector: "register:",
  58050. protocol: 'registration',
  58051. fn: function (aClass){
  58052. var self=this;
  58053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58054. return smalltalk.withContext(function($ctx1) {
  58055. //>>excludeEnd("ctx");
  58056. var $1,$receiver;
  58057. $1=_st(aClass)._type();
  58058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58059. $ctx1.sendIdx["type"]=1;
  58060. //>>excludeEnd("ctx");
  58061. if(($receiver = $1) == null || $receiver.isNil){
  58062. $1;
  58063. } else {
  58064. _st(self["@registry"])._at_put_(_st(aClass)._type(),aClass);
  58065. };
  58066. return self;
  58067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58068. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},globals.PackageTransport.klass)});
  58069. //>>excludeEnd("ctx");
  58070. },
  58071. //>>excludeStart("ide", pragmas.excludeIdeData);
  58072. args: ["aClass"],
  58073. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  58074. referencedClasses: [],
  58075. //>>excludeEnd("ide");
  58076. messageSends: ["ifNotNil:", "type", "at:put:"]
  58077. }),
  58078. globals.PackageTransport.klass);
  58079. smalltalk.addMethod(
  58080. smalltalk.method({
  58081. selector: "type",
  58082. protocol: 'accessing',
  58083. fn: function (){
  58084. var self=this;
  58085. return nil;
  58086. },
  58087. //>>excludeStart("ide", pragmas.excludeIdeData);
  58088. args: [],
  58089. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  58090. referencedClasses: [],
  58091. //>>excludeEnd("ide");
  58092. messageSends: []
  58093. }),
  58094. globals.PackageTransport.klass);
  58095. smalltalk.addClass('AmdPackageTransport', globals.PackageTransport, ['namespace'], 'Kernel-ImportExport');
  58096. //>>excludeStart("ide", pragmas.excludeIdeData);
  58097. globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  58098. //>>excludeEnd("ide");
  58099. smalltalk.addMethod(
  58100. smalltalk.method({
  58101. selector: "asJSON",
  58102. protocol: 'converting',
  58103. fn: function (){
  58104. var self=this;
  58105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58106. return smalltalk.withContext(function($ctx1) {
  58107. //>>excludeEnd("ctx");
  58108. var $2,$3,$1;
  58109. $2=(
  58110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58111. $ctx1.supercall = true,
  58112. //>>excludeEnd("ctx");
  58113. globals.AmdPackageTransport.superclass.fn.prototype._asJSON.apply(_st(self), []));
  58114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58115. $ctx1.supercall = false;
  58116. //>>excludeEnd("ctx");;
  58117. _st($2)._at_put_("amdNamespace",self._namespace());
  58118. $3=_st($2)._yourself();
  58119. $1=$3;
  58120. return $1;
  58121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58122. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.AmdPackageTransport)});
  58123. //>>excludeEnd("ctx");
  58124. },
  58125. //>>excludeStart("ide", pragmas.excludeIdeData);
  58126. args: [],
  58127. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  58128. referencedClasses: [],
  58129. //>>excludeEnd("ide");
  58130. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  58131. }),
  58132. globals.AmdPackageTransport);
  58133. smalltalk.addMethod(
  58134. smalltalk.method({
  58135. selector: "commitHandlerClass",
  58136. protocol: 'accessing',
  58137. fn: function (){
  58138. var self=this;
  58139. function $AmdPackageHandler(){return globals.AmdPackageHandler||(typeof AmdPackageHandler=="undefined"?nil:AmdPackageHandler)}
  58140. return $AmdPackageHandler();
  58141. },
  58142. //>>excludeStart("ide", pragmas.excludeIdeData);
  58143. args: [],
  58144. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  58145. referencedClasses: ["AmdPackageHandler"],
  58146. //>>excludeEnd("ide");
  58147. messageSends: []
  58148. }),
  58149. globals.AmdPackageTransport);
  58150. smalltalk.addMethod(
  58151. smalltalk.method({
  58152. selector: "defaultNamespace",
  58153. protocol: 'defaults',
  58154. fn: function (){
  58155. var self=this;
  58156. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  58157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58158. return smalltalk.withContext(function($ctx1) {
  58159. //>>excludeEnd("ctx");
  58160. var $1;
  58161. $1=_st($Smalltalk())._defaultAmdNamespace();
  58162. return $1;
  58163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58164. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},globals.AmdPackageTransport)});
  58165. //>>excludeEnd("ctx");
  58166. },
  58167. //>>excludeStart("ide", pragmas.excludeIdeData);
  58168. args: [],
  58169. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  58170. referencedClasses: ["Smalltalk"],
  58171. //>>excludeEnd("ide");
  58172. messageSends: ["defaultAmdNamespace"]
  58173. }),
  58174. globals.AmdPackageTransport);
  58175. smalltalk.addMethod(
  58176. smalltalk.method({
  58177. selector: "definition",
  58178. protocol: 'accessing',
  58179. fn: function (){
  58180. var self=this;
  58181. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  58182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58183. return smalltalk.withContext(function($ctx1) {
  58184. //>>excludeEnd("ctx");
  58185. var $3,$2,$1;
  58186. $1=_st($String())._streamContents_((function(stream){
  58187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58188. return smalltalk.withContext(function($ctx2) {
  58189. //>>excludeEnd("ctx");
  58190. _st(stream)._nextPutAll_(_st(self._class())._name());
  58191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58192. $ctx2.sendIdx["nextPutAll:"]=1;
  58193. //>>excludeEnd("ctx");
  58194. _st(stream)._nextPutAll_(" namespace: ");
  58195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58196. $ctx2.sendIdx["nextPutAll:"]=2;
  58197. //>>excludeEnd("ctx");
  58198. $3=_st("'".__comma(self._namespace())).__comma("'");
  58199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58200. $ctx2.sendIdx[","]=1;
  58201. //>>excludeEnd("ctx");
  58202. $2=_st(stream)._nextPutAll_($3);
  58203. return $2;
  58204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58205. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  58206. //>>excludeEnd("ctx");
  58207. }));
  58208. return $1;
  58209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58210. }, function($ctx1) {$ctx1.fill(self,"definition",{},globals.AmdPackageTransport)});
  58211. //>>excludeEnd("ctx");
  58212. },
  58213. //>>excludeStart("ide", pragmas.excludeIdeData);
  58214. args: [],
  58215. 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, '''' ]",
  58216. referencedClasses: ["String"],
  58217. //>>excludeEnd("ide");
  58218. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  58219. }),
  58220. globals.AmdPackageTransport);
  58221. smalltalk.addMethod(
  58222. smalltalk.method({
  58223. selector: "namespace",
  58224. protocol: 'accessing',
  58225. fn: function (){
  58226. var self=this;
  58227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58228. return smalltalk.withContext(function($ctx1) {
  58229. //>>excludeEnd("ctx");
  58230. var $2,$1,$receiver;
  58231. $2=self["@namespace"];
  58232. if(($receiver = $2) == null || $receiver.isNil){
  58233. $1=self._defaultNamespace();
  58234. } else {
  58235. $1=$2;
  58236. };
  58237. return $1;
  58238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58239. }, function($ctx1) {$ctx1.fill(self,"namespace",{},globals.AmdPackageTransport)});
  58240. //>>excludeEnd("ctx");
  58241. },
  58242. //>>excludeStart("ide", pragmas.excludeIdeData);
  58243. args: [],
  58244. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  58245. referencedClasses: [],
  58246. //>>excludeEnd("ide");
  58247. messageSends: ["ifNil:", "defaultNamespace"]
  58248. }),
  58249. globals.AmdPackageTransport);
  58250. smalltalk.addMethod(
  58251. smalltalk.method({
  58252. selector: "namespace:",
  58253. protocol: 'accessing',
  58254. fn: function (aString){
  58255. var self=this;
  58256. self["@namespace"]=aString;
  58257. return self;
  58258. },
  58259. //>>excludeStart("ide", pragmas.excludeIdeData);
  58260. args: ["aString"],
  58261. source: "namespace: aString\x0a\x09namespace := aString",
  58262. referencedClasses: [],
  58263. //>>excludeEnd("ide");
  58264. messageSends: []
  58265. }),
  58266. globals.AmdPackageTransport);
  58267. smalltalk.addMethod(
  58268. smalltalk.method({
  58269. selector: "printOn:",
  58270. protocol: 'printing',
  58271. fn: function (aStream){
  58272. var self=this;
  58273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58274. return smalltalk.withContext(function($ctx1) {
  58275. //>>excludeEnd("ctx");
  58276. var $1;
  58277. (
  58278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58279. $ctx1.supercall = true,
  58280. //>>excludeEnd("ctx");
  58281. globals.AmdPackageTransport.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  58282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58283. $ctx1.supercall = false;
  58284. //>>excludeEnd("ctx");;
  58285. _st(aStream)._nextPutAll_(" (AMD Namespace: ");
  58286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58287. $ctx1.sendIdx["nextPutAll:"]=1;
  58288. //>>excludeEnd("ctx");
  58289. _st(aStream)._nextPutAll_(self._namespace());
  58290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58291. $ctx1.sendIdx["nextPutAll:"]=2;
  58292. //>>excludeEnd("ctx");
  58293. $1=_st(aStream)._nextPutAll_(")");
  58294. return self;
  58295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58296. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AmdPackageTransport)});
  58297. //>>excludeEnd("ctx");
  58298. },
  58299. //>>excludeStart("ide", pragmas.excludeIdeData);
  58300. args: ["aStream"],
  58301. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  58302. referencedClasses: [],
  58303. //>>excludeEnd("ide");
  58304. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  58305. }),
  58306. globals.AmdPackageTransport);
  58307. smalltalk.addMethod(
  58308. smalltalk.method({
  58309. selector: "setPath:",
  58310. protocol: 'actions',
  58311. fn: function (aString){
  58312. var self=this;
  58313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58314. return smalltalk.withContext(function($ctx1) {
  58315. //>>excludeEnd("ctx");
  58316. _st(_st(require)._basicAt_("config"))._value_(globals.HashedCollection._newFromPairs_(["paths",globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  58317. return self;
  58318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58319. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},globals.AmdPackageTransport)});
  58320. //>>excludeEnd("ctx");
  58321. },
  58322. //>>excludeStart("ide", pragmas.excludeIdeData);
  58323. args: ["aString"],
  58324. 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}.",
  58325. referencedClasses: [],
  58326. //>>excludeEnd("ide");
  58327. messageSends: ["value:", "basicAt:", "namespace"]
  58328. }),
  58329. globals.AmdPackageTransport);
  58330. smalltalk.addMethod(
  58331. smalltalk.method({
  58332. selector: "setupFromJson:",
  58333. protocol: 'initialization',
  58334. fn: function (anObject){
  58335. var self=this;
  58336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58337. return smalltalk.withContext(function($ctx1) {
  58338. //>>excludeEnd("ctx");
  58339. self._namespace_(_st(anObject)._at_("amdNamespace"));
  58340. return self;
  58341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58342. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},globals.AmdPackageTransport)});
  58343. //>>excludeEnd("ctx");
  58344. },
  58345. //>>excludeStart("ide", pragmas.excludeIdeData);
  58346. args: ["anObject"],
  58347. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  58348. referencedClasses: [],
  58349. //>>excludeEnd("ide");
  58350. messageSends: ["namespace:", "at:"]
  58351. }),
  58352. globals.AmdPackageTransport);
  58353. smalltalk.addMethod(
  58354. smalltalk.method({
  58355. selector: "namespace:",
  58356. protocol: 'instance creation',
  58357. fn: function (aString){
  58358. var self=this;
  58359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58360. return smalltalk.withContext(function($ctx1) {
  58361. //>>excludeEnd("ctx");
  58362. var $2,$3,$1;
  58363. $2=self._new();
  58364. _st($2)._namespace_(aString);
  58365. $3=_st($2)._yourself();
  58366. $1=$3;
  58367. return $1;
  58368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58369. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},globals.AmdPackageTransport.klass)});
  58370. //>>excludeEnd("ctx");
  58371. },
  58372. //>>excludeStart("ide", pragmas.excludeIdeData);
  58373. args: ["aString"],
  58374. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  58375. referencedClasses: [],
  58376. //>>excludeEnd("ide");
  58377. messageSends: ["namespace:", "new", "yourself"]
  58378. }),
  58379. globals.AmdPackageTransport.klass);
  58380. smalltalk.addMethod(
  58381. smalltalk.method({
  58382. selector: "type",
  58383. protocol: 'accessing',
  58384. fn: function (){
  58385. var self=this;
  58386. return "amd";
  58387. },
  58388. //>>excludeStart("ide", pragmas.excludeIdeData);
  58389. args: [],
  58390. source: "type\x0a\x09^ 'amd'",
  58391. referencedClasses: [],
  58392. //>>excludeEnd("ide");
  58393. messageSends: []
  58394. }),
  58395. globals.AmdPackageTransport.klass);
  58396. smalltalk.addMethod(
  58397. smalltalk.method({
  58398. selector: "commit",
  58399. protocol: '*Kernel-ImportExport',
  58400. fn: function (){
  58401. var self=this;
  58402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58403. return smalltalk.withContext(function($ctx1) {
  58404. //>>excludeEnd("ctx");
  58405. var $1;
  58406. $1=_st(self._transport())._commit();
  58407. return $1;
  58408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58409. }, function($ctx1) {$ctx1.fill(self,"commit",{},globals.Package)});
  58410. //>>excludeEnd("ctx");
  58411. },
  58412. //>>excludeStart("ide", pragmas.excludeIdeData);
  58413. args: [],
  58414. source: "commit\x0a\x09^ self transport commit",
  58415. referencedClasses: [],
  58416. //>>excludeEnd("ide");
  58417. messageSends: ["commit", "transport"]
  58418. }),
  58419. globals.Package);
  58420. smalltalk.addMethod(
  58421. smalltalk.method({
  58422. selector: "load",
  58423. protocol: '*Kernel-ImportExport',
  58424. fn: function (){
  58425. var self=this;
  58426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58427. return smalltalk.withContext(function($ctx1) {
  58428. //>>excludeEnd("ctx");
  58429. var $1;
  58430. $1=_st(self._transport())._load();
  58431. return $1;
  58432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58433. }, function($ctx1) {$ctx1.fill(self,"load",{},globals.Package)});
  58434. //>>excludeEnd("ctx");
  58435. },
  58436. //>>excludeStart("ide", pragmas.excludeIdeData);
  58437. args: [],
  58438. source: "load\x0a\x09^ self transport load",
  58439. referencedClasses: [],
  58440. //>>excludeEnd("ide");
  58441. messageSends: ["load", "transport"]
  58442. }),
  58443. globals.Package);
  58444. smalltalk.addMethod(
  58445. smalltalk.method({
  58446. selector: "loadFromNamespace:",
  58447. protocol: '*Kernel-ImportExport',
  58448. fn: function (aString){
  58449. var self=this;
  58450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58451. return smalltalk.withContext(function($ctx1) {
  58452. //>>excludeEnd("ctx");
  58453. var $2,$3,$1;
  58454. $2=self._transport();
  58455. _st($2)._namespace_(aString);
  58456. $3=_st($2)._load();
  58457. $1=$3;
  58458. return $1;
  58459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58460. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},globals.Package)});
  58461. //>>excludeEnd("ctx");
  58462. },
  58463. //>>excludeStart("ide", pragmas.excludeIdeData);
  58464. args: ["aString"],
  58465. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  58466. referencedClasses: [],
  58467. //>>excludeEnd("ide");
  58468. messageSends: ["namespace:", "transport", "load"]
  58469. }),
  58470. globals.Package);
  58471. smalltalk.addMethod(
  58472. smalltalk.method({
  58473. selector: "load:",
  58474. protocol: '*Kernel-ImportExport',
  58475. fn: function (aPackageName){
  58476. var self=this;
  58477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58478. return smalltalk.withContext(function($ctx1) {
  58479. //>>excludeEnd("ctx");
  58480. _st(self._named_(aPackageName))._load();
  58481. return self;
  58482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58483. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},globals.Package.klass)});
  58484. //>>excludeEnd("ctx");
  58485. },
  58486. //>>excludeStart("ide", pragmas.excludeIdeData);
  58487. args: ["aPackageName"],
  58488. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  58489. referencedClasses: [],
  58490. //>>excludeEnd("ide");
  58491. messageSends: ["load", "named:"]
  58492. }),
  58493. globals.Package.klass);
  58494. smalltalk.addMethod(
  58495. smalltalk.method({
  58496. selector: "load:fromNamespace:",
  58497. protocol: '*Kernel-ImportExport',
  58498. fn: function (aPackageName,aString){
  58499. var self=this;
  58500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58501. return smalltalk.withContext(function($ctx1) {
  58502. //>>excludeEnd("ctx");
  58503. _st(self._named_(aPackageName))._loadFromNamespace_(aString);
  58504. return self;
  58505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58506. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},globals.Package.klass)});
  58507. //>>excludeEnd("ctx");
  58508. },
  58509. //>>excludeStart("ide", pragmas.excludeIdeData);
  58510. args: ["aPackageName", "aString"],
  58511. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  58512. referencedClasses: [],
  58513. //>>excludeEnd("ide");
  58514. messageSends: ["loadFromNamespace:", "named:"]
  58515. }),
  58516. globals.Package.klass);
  58517. });
  58518. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  58519. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  58520. smalltalk.addPackage('Kernel-Tests');
  58521. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  58522. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  58523. smalltalk.addMethod(
  58524. smalltalk.method({
  58525. selector: "testAddExtensionMethod",
  58526. protocol: 'tests',
  58527. fn: function (){
  58528. var self=this;
  58529. var method,dirty;
  58530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58531. return smalltalk.withContext(function($ctx1) {
  58532. //>>excludeEnd("ctx");
  58533. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  58534. $2=self._class();
  58535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58536. $ctx1.sendIdx["class"]=1;
  58537. //>>excludeEnd("ctx");
  58538. $1=_st($2)._package();
  58539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58540. $ctx1.sendIdx["package"]=1;
  58541. //>>excludeEnd("ctx");
  58542. dirty=_st($1)._isDirty();
  58543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58544. $ctx1.sendIdx["isDirty"]=1;
  58545. //>>excludeEnd("ctx");
  58546. $4=self._class();
  58547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58548. $ctx1.sendIdx["class"]=2;
  58549. //>>excludeEnd("ctx");
  58550. $3=_st($4)._package();
  58551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58552. $ctx1.sendIdx["package"]=2;
  58553. //>>excludeEnd("ctx");
  58554. _st($3)._beClean();
  58555. $5=self._class();
  58556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58557. $ctx1.sendIdx["class"]=3;
  58558. //>>excludeEnd("ctx");
  58559. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  58560. $8=self._class();
  58561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58562. $ctx1.sendIdx["class"]=4;
  58563. //>>excludeEnd("ctx");
  58564. $7=_st($8)._package();
  58565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58566. $ctx1.sendIdx["package"]=3;
  58567. //>>excludeEnd("ctx");
  58568. $6=_st($7)._isDirty();
  58569. self._deny_($6);
  58570. $9=self._class();
  58571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58572. $ctx1.sendIdx["class"]=5;
  58573. //>>excludeEnd("ctx");
  58574. _st($9)._removeCompiledMethod_(method);
  58575. $10=dirty;
  58576. if(smalltalk.assert($10)){
  58577. _st(_st(self._class())._package())._beDirty();
  58578. };
  58579. return self;
  58580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58581. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)});
  58582. //>>excludeEnd("ctx");
  58583. },
  58584. //>>excludeStart("ide", pragmas.excludeIdeData);
  58585. args: [],
  58586. 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 ]",
  58587. referencedClasses: [],
  58588. //>>excludeEnd("ide");
  58589. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  58590. }),
  58591. globals.AnnouncementSubscriptionTest);
  58592. smalltalk.addMethod(
  58593. smalltalk.method({
  58594. selector: "testHandlesAnnouncement",
  58595. protocol: 'tests',
  58596. fn: function (){
  58597. var self=this;
  58598. var subscription,announcementClass1,announcementClass2,classBuilder;
  58599. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58600. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58601. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  58602. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  58603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58604. return smalltalk.withContext(function($ctx1) {
  58605. //>>excludeEnd("ctx");
  58606. var $1,$2;
  58607. classBuilder=_st($ClassBuilder())._new();
  58608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58609. $ctx1.sendIdx["new"]=1;
  58610. //>>excludeEnd("ctx");
  58611. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  58612. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  58613. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  58614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58615. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  58616. //>>excludeEnd("ctx");
  58617. self._assert_equals_($1,true);
  58618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58619. $ctx1.sendIdx["assert:equals:"]=1;
  58620. //>>excludeEnd("ctx");
  58621. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  58622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58623. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  58624. //>>excludeEnd("ctx");
  58625. self._assert_equals_($2,true);
  58626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58627. $ctx1.sendIdx["assert:equals:"]=2;
  58628. //>>excludeEnd("ctx");
  58629. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  58630. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  58631. return self;
  58632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58633. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)});
  58634. //>>excludeEnd("ctx");
  58635. },
  58636. //>>excludeStart("ide", pragmas.excludeIdeData);
  58637. args: [],
  58638. 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.",
  58639. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  58640. //>>excludeEnd("ide");
  58641. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  58642. }),
  58643. globals.AnnouncementSubscriptionTest);
  58644. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  58645. smalltalk.addMethod(
  58646. smalltalk.method({
  58647. selector: "testOnDo",
  58648. protocol: 'tests',
  58649. fn: function (){
  58650. var self=this;
  58651. var counter,announcer;
  58652. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58653. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58655. return smalltalk.withContext(function($ctx1) {
  58656. //>>excludeEnd("ctx");
  58657. var $1,$2;
  58658. counter=(0);
  58659. announcer=_st($Announcer())._new();
  58660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58661. $ctx1.sendIdx["new"]=1;
  58662. //>>excludeEnd("ctx");
  58663. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  58664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58665. return smalltalk.withContext(function($ctx2) {
  58666. //>>excludeEnd("ctx");
  58667. counter=_st(counter).__plus((1));
  58668. return counter;
  58669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58671. //>>excludeEnd("ctx");
  58672. }));
  58673. $1=announcer;
  58674. $2=_st($SystemAnnouncement())._new();
  58675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58676. $ctx1.sendIdx["new"]=2;
  58677. //>>excludeEnd("ctx");
  58678. _st($1)._announce_($2);
  58679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58680. $ctx1.sendIdx["announce:"]=1;
  58681. //>>excludeEnd("ctx");
  58682. self._assert_equals_(counter,(1));
  58683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58684. $ctx1.sendIdx["assert:equals:"]=1;
  58685. //>>excludeEnd("ctx");
  58686. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58687. self._assert_equals_(counter,(2));
  58688. return self;
  58689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58690. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58691. //>>excludeEnd("ctx");
  58692. },
  58693. //>>excludeStart("ide", pragmas.excludeIdeData);
  58694. args: [],
  58695. 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.",
  58696. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58697. //>>excludeEnd("ide");
  58698. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  58699. }),
  58700. globals.AnnouncerTest);
  58701. smalltalk.addMethod(
  58702. smalltalk.method({
  58703. selector: "testOnDoFor",
  58704. protocol: 'tests',
  58705. fn: function (){
  58706. var self=this;
  58707. var counter,announcer;
  58708. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58709. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58711. return smalltalk.withContext(function($ctx1) {
  58712. //>>excludeEnd("ctx");
  58713. var $1,$2,$3,$4;
  58714. counter=(0);
  58715. announcer=_st($Announcer())._new();
  58716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58717. $ctx1.sendIdx["new"]=1;
  58718. //>>excludeEnd("ctx");
  58719. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  58720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58721. return smalltalk.withContext(function($ctx2) {
  58722. //>>excludeEnd("ctx");
  58723. counter=_st(counter).__plus((1));
  58724. return counter;
  58725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58727. //>>excludeEnd("ctx");
  58728. }),self);
  58729. $1=announcer;
  58730. $2=_st($SystemAnnouncement())._new();
  58731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58732. $ctx1.sendIdx["new"]=2;
  58733. //>>excludeEnd("ctx");
  58734. _st($1)._announce_($2);
  58735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58736. $ctx1.sendIdx["announce:"]=1;
  58737. //>>excludeEnd("ctx");
  58738. self._assert_equals_(counter,(1));
  58739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58740. $ctx1.sendIdx["assert:equals:"]=1;
  58741. //>>excludeEnd("ctx");
  58742. $3=announcer;
  58743. $4=_st($SystemAnnouncement())._new();
  58744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58745. $ctx1.sendIdx["new"]=3;
  58746. //>>excludeEnd("ctx");
  58747. _st($3)._announce_($4);
  58748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58749. $ctx1.sendIdx["announce:"]=2;
  58750. //>>excludeEnd("ctx");
  58751. self._assert_equals_(counter,(2));
  58752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58753. $ctx1.sendIdx["assert:equals:"]=2;
  58754. //>>excludeEnd("ctx");
  58755. _st(announcer)._unsubscribe_(self);
  58756. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58757. self._assert_equals_(counter,(2));
  58758. return self;
  58759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58760. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58761. //>>excludeEnd("ctx");
  58762. },
  58763. //>>excludeStart("ide", pragmas.excludeIdeData);
  58764. args: [],
  58765. 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.",
  58766. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58767. //>>excludeEnd("ide");
  58768. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  58769. }),
  58770. globals.AnnouncerTest);
  58771. smalltalk.addMethod(
  58772. smalltalk.method({
  58773. selector: "testOnDoOnce",
  58774. protocol: 'tests',
  58775. fn: function (){
  58776. var self=this;
  58777. var counter,announcer;
  58778. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  58779. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58781. return smalltalk.withContext(function($ctx1) {
  58782. //>>excludeEnd("ctx");
  58783. var $1,$2;
  58784. counter=(0);
  58785. announcer=_st($Announcer())._new();
  58786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58787. $ctx1.sendIdx["new"]=1;
  58788. //>>excludeEnd("ctx");
  58789. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  58790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58791. return smalltalk.withContext(function($ctx2) {
  58792. //>>excludeEnd("ctx");
  58793. counter=_st(counter).__plus((1));
  58794. return counter;
  58795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58797. //>>excludeEnd("ctx");
  58798. }));
  58799. $1=announcer;
  58800. $2=_st($SystemAnnouncement())._new();
  58801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58802. $ctx1.sendIdx["new"]=2;
  58803. //>>excludeEnd("ctx");
  58804. _st($1)._announce_($2);
  58805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58806. $ctx1.sendIdx["announce:"]=1;
  58807. //>>excludeEnd("ctx");
  58808. self._assert_equals_(counter,(1));
  58809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58810. $ctx1.sendIdx["assert:equals:"]=1;
  58811. //>>excludeEnd("ctx");
  58812. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  58813. self._assert_equals_(counter,(1));
  58814. return self;
  58815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58816. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)});
  58817. //>>excludeEnd("ctx");
  58818. },
  58819. //>>excludeStart("ide", pragmas.excludeIdeData);
  58820. args: [],
  58821. 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.",
  58822. referencedClasses: ["Announcer", "SystemAnnouncement"],
  58823. //>>excludeEnd("ide");
  58824. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  58825. }),
  58826. globals.AnnouncerTest);
  58827. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  58828. smalltalk.addMethod(
  58829. smalltalk.method({
  58830. selector: "testCanClearInterval",
  58831. protocol: 'tests',
  58832. fn: function (){
  58833. var self=this;
  58834. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  58835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58836. return smalltalk.withContext(function($ctx1) {
  58837. //>>excludeEnd("ctx");
  58838. self._shouldnt_raise_((function(){
  58839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58840. return smalltalk.withContext(function($ctx2) {
  58841. //>>excludeEnd("ctx");
  58842. return _st(_st((function(){
  58843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58844. return smalltalk.withContext(function($ctx3) {
  58845. //>>excludeEnd("ctx");
  58846. return _st(_st($Error())._new())._signal();
  58847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58848. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58849. //>>excludeEnd("ctx");
  58850. }))._valueWithInterval_((0)))._clearInterval();
  58851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58853. //>>excludeEnd("ctx");
  58854. }),$Error());
  58855. return self;
  58856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58857. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)});
  58858. //>>excludeEnd("ctx");
  58859. },
  58860. //>>excludeStart("ide", pragmas.excludeIdeData);
  58861. args: [],
  58862. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  58863. referencedClasses: ["Error"],
  58864. //>>excludeEnd("ide");
  58865. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  58866. }),
  58867. globals.BlockClosureTest);
  58868. smalltalk.addMethod(
  58869. smalltalk.method({
  58870. selector: "testCanClearTimeout",
  58871. protocol: 'tests',
  58872. fn: function (){
  58873. var self=this;
  58874. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  58875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58876. return smalltalk.withContext(function($ctx1) {
  58877. //>>excludeEnd("ctx");
  58878. self._shouldnt_raise_((function(){
  58879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58880. return smalltalk.withContext(function($ctx2) {
  58881. //>>excludeEnd("ctx");
  58882. return _st(_st((function(){
  58883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58884. return smalltalk.withContext(function($ctx3) {
  58885. //>>excludeEnd("ctx");
  58886. return _st(_st($Error())._new())._signal();
  58887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58888. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58889. //>>excludeEnd("ctx");
  58890. }))._valueWithTimeout_((0)))._clearTimeout();
  58891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58893. //>>excludeEnd("ctx");
  58894. }),$Error());
  58895. return self;
  58896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58897. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)});
  58898. //>>excludeEnd("ctx");
  58899. },
  58900. //>>excludeStart("ide", pragmas.excludeIdeData);
  58901. args: [],
  58902. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  58903. referencedClasses: ["Error"],
  58904. //>>excludeEnd("ide");
  58905. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  58906. }),
  58907. globals.BlockClosureTest);
  58908. smalltalk.addMethod(
  58909. smalltalk.method({
  58910. selector: "testCompiledSource",
  58911. protocol: 'tests',
  58912. fn: function (){
  58913. var self=this;
  58914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58915. return smalltalk.withContext(function($ctx1) {
  58916. //>>excludeEnd("ctx");
  58917. self._assert_(_st(_st((function(){
  58918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58919. return smalltalk.withContext(function($ctx2) {
  58920. //>>excludeEnd("ctx");
  58921. return (1).__plus((1));
  58922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58923. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58924. //>>excludeEnd("ctx");
  58925. }))._compiledSource())._includesSubString_("function"));
  58926. return self;
  58927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58928. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)});
  58929. //>>excludeEnd("ctx");
  58930. },
  58931. //>>excludeStart("ide", pragmas.excludeIdeData);
  58932. args: [],
  58933. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  58934. referencedClasses: [],
  58935. //>>excludeEnd("ide");
  58936. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  58937. }),
  58938. globals.BlockClosureTest);
  58939. smalltalk.addMethod(
  58940. smalltalk.method({
  58941. selector: "testCurrySelf",
  58942. protocol: 'tests',
  58943. fn: function (){
  58944. var self=this;
  58945. var curriedMethod,array;
  58946. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  58947. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  58948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58949. return smalltalk.withContext(function($ctx1) {
  58950. //>>excludeEnd("ctx");
  58951. curriedMethod=_st(_st((function(selfarg,x){
  58952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58953. return smalltalk.withContext(function($ctx2) {
  58954. //>>excludeEnd("ctx");
  58955. return _st(selfarg)._at_(x);
  58956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58957. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  58958. //>>excludeEnd("ctx");
  58959. }))._currySelf())._asCompiledMethod_("foo:");
  58960. array=[(3), (1), (4)];
  58961. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  58962. _st((function(){
  58963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58964. return smalltalk.withContext(function($ctx2) {
  58965. //>>excludeEnd("ctx");
  58966. return self._assert_equals_(_st(array)._foo_((2)),(1));
  58967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58969. //>>excludeEnd("ctx");
  58970. }))._ensure_((function(){
  58971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58972. return smalltalk.withContext(function($ctx2) {
  58973. //>>excludeEnd("ctx");
  58974. return _st($Array())._removeCompiledMethod_(curriedMethod);
  58975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58977. //>>excludeEnd("ctx");
  58978. }));
  58979. return self;
  58980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58981. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)});
  58982. //>>excludeEnd("ctx");
  58983. },
  58984. //>>excludeStart("ide", pragmas.excludeIdeData);
  58985. args: [],
  58986. 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 ]",
  58987. referencedClasses: ["ClassBuilder", "Array"],
  58988. //>>excludeEnd("ide");
  58989. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  58990. }),
  58991. globals.BlockClosureTest);
  58992. smalltalk.addMethod(
  58993. smalltalk.method({
  58994. selector: "testEnsure",
  58995. protocol: 'tests',
  58996. fn: function (){
  58997. var self=this;
  58998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58999. return smalltalk.withContext(function($ctx1) {
  59000. //>>excludeEnd("ctx");
  59001. self._assert_equals_(_st((function(){
  59002. return (3);
  59003. }))._ensure_((function(){
  59004. return (4);
  59005. })),(3));
  59006. return self;
  59007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59008. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)});
  59009. //>>excludeEnd("ctx");
  59010. },
  59011. //>>excludeStart("ide", pragmas.excludeIdeData);
  59012. args: [],
  59013. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  59014. referencedClasses: [],
  59015. //>>excludeEnd("ide");
  59016. messageSends: ["assert:equals:", "ensure:"]
  59017. }),
  59018. globals.BlockClosureTest);
  59019. smalltalk.addMethod(
  59020. smalltalk.method({
  59021. selector: "testEnsureRaises",
  59022. protocol: 'tests',
  59023. fn: function (){
  59024. var self=this;
  59025. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59027. return smalltalk.withContext(function($ctx1) {
  59028. //>>excludeEnd("ctx");
  59029. self._should_raise_((function(){
  59030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59031. return smalltalk.withContext(function($ctx2) {
  59032. //>>excludeEnd("ctx");
  59033. return _st((function(){
  59034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59035. return smalltalk.withContext(function($ctx3) {
  59036. //>>excludeEnd("ctx");
  59037. return _st(_st($Error())._new())._signal();
  59038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59040. //>>excludeEnd("ctx");
  59041. }))._ensure_((function(){
  59042. return true;
  59043. }));
  59044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59046. //>>excludeEnd("ctx");
  59047. }),$Error());
  59048. return self;
  59049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59050. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)});
  59051. //>>excludeEnd("ctx");
  59052. },
  59053. //>>excludeStart("ide", pragmas.excludeIdeData);
  59054. args: [],
  59055. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  59056. referencedClasses: ["Error"],
  59057. //>>excludeEnd("ide");
  59058. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  59059. }),
  59060. globals.BlockClosureTest);
  59061. smalltalk.addMethod(
  59062. smalltalk.method({
  59063. selector: "testExceptionSemantics",
  59064. protocol: 'tests',
  59065. fn: function (){
  59066. var self=this;
  59067. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59069. return smalltalk.withContext(function($ctx1) {
  59070. //>>excludeEnd("ctx");
  59071. self._timeout_((100));
  59072. _st(self._async_((function(){
  59073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59074. return smalltalk.withContext(function($ctx2) {
  59075. //>>excludeEnd("ctx");
  59076. return _st((function(){
  59077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59078. return smalltalk.withContext(function($ctx3) {
  59079. //>>excludeEnd("ctx");
  59080. self._assert_(true);
  59081. _st($Error())._signal();
  59082. self._deny_(true);
  59083. return self._finished();
  59084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59085. $ctx3.sendIdx["finished"]=1;
  59086. //>>excludeEnd("ctx");
  59087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59088. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59089. //>>excludeEnd("ctx");
  59090. }))._on_do_($Error(),(function(ex){
  59091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59092. return smalltalk.withContext(function($ctx3) {
  59093. //>>excludeEnd("ctx");
  59094. return self._finished();
  59095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59096. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  59097. //>>excludeEnd("ctx");
  59098. }));
  59099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59101. //>>excludeEnd("ctx");
  59102. })))._valueWithTimeout_((0));
  59103. return self;
  59104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59105. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)});
  59106. //>>excludeEnd("ctx");
  59107. },
  59108. //>>excludeStart("ide", pragmas.excludeIdeData);
  59109. args: [],
  59110. 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",
  59111. referencedClasses: ["Error"],
  59112. //>>excludeEnd("ide");
  59113. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  59114. }),
  59115. globals.BlockClosureTest);
  59116. smalltalk.addMethod(
  59117. smalltalk.method({
  59118. selector: "testNewWithValues",
  59119. protocol: 'tests',
  59120. fn: function (){
  59121. var self=this;
  59122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59123. return smalltalk.withContext(function($ctx1) {
  59124. //>>excludeEnd("ctx");
  59125. function TestConstructor(arg1, arg2, arg3) {}
  59126. TestConstructor.prototype.name = 'theTestPrototype';
  59127. var wrappedConstructor = _st(TestConstructor);
  59128. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  59129. self._assert_(result instanceof TestConstructor);
  59130. self._assert_equals_(result.name, 'theTestPrototype');
  59131. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  59132. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  59133. return self;
  59134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59135. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)});
  59136. //>>excludeEnd("ctx");
  59137. },
  59138. //>>excludeStart("ide", pragmas.excludeIdeData);
  59139. args: [],
  59140. 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>",
  59141. referencedClasses: [],
  59142. //>>excludeEnd("ide");
  59143. messageSends: []
  59144. }),
  59145. globals.BlockClosureTest);
  59146. smalltalk.addMethod(
  59147. smalltalk.method({
  59148. selector: "testNumArgs",
  59149. protocol: 'tests',
  59150. fn: function (){
  59151. var self=this;
  59152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59153. return smalltalk.withContext(function($ctx1) {
  59154. //>>excludeEnd("ctx");
  59155. var $1;
  59156. $1=_st((function(){
  59157. }))._numArgs();
  59158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59159. $ctx1.sendIdx["numArgs"]=1;
  59160. //>>excludeEnd("ctx");
  59161. self._assert_equals_($1,(0));
  59162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59163. $ctx1.sendIdx["assert:equals:"]=1;
  59164. //>>excludeEnd("ctx");
  59165. self._assert_equals_(_st((function(a,b){
  59166. }))._numArgs(),(2));
  59167. return self;
  59168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59169. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)});
  59170. //>>excludeEnd("ctx");
  59171. },
  59172. //>>excludeStart("ide", pragmas.excludeIdeData);
  59173. args: [],
  59174. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  59175. referencedClasses: [],
  59176. //>>excludeEnd("ide");
  59177. messageSends: ["assert:equals:", "numArgs"]
  59178. }),
  59179. globals.BlockClosureTest);
  59180. smalltalk.addMethod(
  59181. smalltalk.method({
  59182. selector: "testOnDo",
  59183. protocol: 'tests',
  59184. fn: function (){
  59185. var self=this;
  59186. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  59187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59188. return smalltalk.withContext(function($ctx1) {
  59189. //>>excludeEnd("ctx");
  59190. self._assert_(_st((function(){
  59191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59192. return smalltalk.withContext(function($ctx2) {
  59193. //>>excludeEnd("ctx");
  59194. return _st(_st($Error())._new())._signal();
  59195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59197. //>>excludeEnd("ctx");
  59198. }))._on_do_($Error(),(function(ex){
  59199. return true;
  59200. })));
  59201. return self;
  59202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59203. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)});
  59204. //>>excludeEnd("ctx");
  59205. },
  59206. //>>excludeStart("ide", pragmas.excludeIdeData);
  59207. args: [],
  59208. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  59209. referencedClasses: ["Error"],
  59210. //>>excludeEnd("ide");
  59211. messageSends: ["assert:", "on:do:", "signal", "new"]
  59212. }),
  59213. globals.BlockClosureTest);
  59214. smalltalk.addMethod(
  59215. smalltalk.method({
  59216. selector: "testValue",
  59217. protocol: 'tests',
  59218. fn: function (){
  59219. var self=this;
  59220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59221. return smalltalk.withContext(function($ctx1) {
  59222. //>>excludeEnd("ctx");
  59223. var $1;
  59224. $1=_st((function(){
  59225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59226. return smalltalk.withContext(function($ctx2) {
  59227. //>>excludeEnd("ctx");
  59228. return (1).__plus((1));
  59229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59230. $ctx2.sendIdx["+"]=1;
  59231. //>>excludeEnd("ctx");
  59232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59234. //>>excludeEnd("ctx");
  59235. }))._value();
  59236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59237. $ctx1.sendIdx["value"]=1;
  59238. //>>excludeEnd("ctx");
  59239. self._assert_equals_($1,(2));
  59240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59241. $ctx1.sendIdx["assert:equals:"]=1;
  59242. //>>excludeEnd("ctx");
  59243. self._assert_equals_(_st((function(x){
  59244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59245. return smalltalk.withContext(function($ctx2) {
  59246. //>>excludeEnd("ctx");
  59247. return _st(x).__plus((1));
  59248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59249. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  59250. //>>excludeEnd("ctx");
  59251. }))._value_((2)),(3));
  59252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59253. $ctx1.sendIdx["assert:equals:"]=2;
  59254. //>>excludeEnd("ctx");
  59255. self._assert_equals_(_st((function(x,y){
  59256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59257. return smalltalk.withContext(function($ctx2) {
  59258. //>>excludeEnd("ctx");
  59259. return _st(x).__star(y);
  59260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59261. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  59262. //>>excludeEnd("ctx");
  59263. }))._value_value_((2),(4)),(8));
  59264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59265. $ctx1.sendIdx["assert:equals:"]=3;
  59266. //>>excludeEnd("ctx");
  59267. self._assert_equals_(_st((function(a,b,c){
  59268. return (1);
  59269. }))._value(),(1));
  59270. return self;
  59271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59272. }, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)});
  59273. //>>excludeEnd("ctx");
  59274. },
  59275. //>>excludeStart("ide", pragmas.excludeIdeData);
  59276. args: [],
  59277. 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",
  59278. referencedClasses: [],
  59279. //>>excludeEnd("ide");
  59280. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  59281. }),
  59282. globals.BlockClosureTest);
  59283. smalltalk.addMethod(
  59284. smalltalk.method({
  59285. selector: "testValueWithPossibleArguments",
  59286. protocol: 'tests',
  59287. fn: function (){
  59288. var self=this;
  59289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59290. return smalltalk.withContext(function($ctx1) {
  59291. //>>excludeEnd("ctx");
  59292. var $1,$2;
  59293. $1=_st((function(){
  59294. return (1);
  59295. }))._valueWithPossibleArguments_([(3), (4)]);
  59296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59297. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  59298. //>>excludeEnd("ctx");
  59299. self._assert_equals_($1,(1));
  59300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59301. $ctx1.sendIdx["assert:equals:"]=1;
  59302. //>>excludeEnd("ctx");
  59303. $2=_st((function(a){
  59304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59305. return smalltalk.withContext(function($ctx2) {
  59306. //>>excludeEnd("ctx");
  59307. return _st(a).__plus((4));
  59308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59309. $ctx2.sendIdx["+"]=1;
  59310. //>>excludeEnd("ctx");
  59311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59312. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59313. //>>excludeEnd("ctx");
  59314. }))._valueWithPossibleArguments_([(3), (4)]);
  59315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59316. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  59317. //>>excludeEnd("ctx");
  59318. self._assert_equals_($2,(7));
  59319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59320. $ctx1.sendIdx["assert:equals:"]=2;
  59321. //>>excludeEnd("ctx");
  59322. self._assert_equals_(_st((function(a,b){
  59323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59324. return smalltalk.withContext(function($ctx2) {
  59325. //>>excludeEnd("ctx");
  59326. return _st(a).__plus(b);
  59327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59328. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  59329. //>>excludeEnd("ctx");
  59330. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  59331. return self;
  59332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59333. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)});
  59334. //>>excludeEnd("ctx");
  59335. },
  59336. //>>excludeStart("ide", pragmas.excludeIdeData);
  59337. args: [],
  59338. 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.",
  59339. referencedClasses: [],
  59340. //>>excludeEnd("ide");
  59341. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  59342. }),
  59343. globals.BlockClosureTest);
  59344. smalltalk.addMethod(
  59345. smalltalk.method({
  59346. selector: "testWhileFalse",
  59347. protocol: 'tests',
  59348. fn: function (){
  59349. var self=this;
  59350. var i;
  59351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59352. return smalltalk.withContext(function($ctx1) {
  59353. //>>excludeEnd("ctx");
  59354. i=(0);
  59355. _st((function(){
  59356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59357. return smalltalk.withContext(function($ctx2) {
  59358. //>>excludeEnd("ctx");
  59359. return _st(i).__gt((5));
  59360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59361. $ctx2.sendIdx[">"]=1;
  59362. //>>excludeEnd("ctx");
  59363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59365. //>>excludeEnd("ctx");
  59366. }))._whileFalse_((function(){
  59367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59368. return smalltalk.withContext(function($ctx2) {
  59369. //>>excludeEnd("ctx");
  59370. i=_st(i).__plus((1));
  59371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59372. $ctx2.sendIdx["+"]=1;
  59373. //>>excludeEnd("ctx");
  59374. return i;
  59375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59377. //>>excludeEnd("ctx");
  59378. }));
  59379. self._assert_equals_(i,(6));
  59380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59381. $ctx1.sendIdx["assert:equals:"]=1;
  59382. //>>excludeEnd("ctx");
  59383. i=(0);
  59384. _st((function(){
  59385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59386. return smalltalk.withContext(function($ctx2) {
  59387. //>>excludeEnd("ctx");
  59388. i=_st(i).__plus((1));
  59389. i;
  59390. return _st(i).__gt((5));
  59391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59393. //>>excludeEnd("ctx");
  59394. }))._whileFalse();
  59395. self._assert_equals_(i,(6));
  59396. return self;
  59397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59398. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)});
  59399. //>>excludeEnd("ctx");
  59400. },
  59401. //>>excludeStart("ide", pragmas.excludeIdeData);
  59402. args: [],
  59403. 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",
  59404. referencedClasses: [],
  59405. //>>excludeEnd("ide");
  59406. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  59407. }),
  59408. globals.BlockClosureTest);
  59409. smalltalk.addMethod(
  59410. smalltalk.method({
  59411. selector: "testWhileTrue",
  59412. protocol: 'tests',
  59413. fn: function (){
  59414. var self=this;
  59415. var i;
  59416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59417. return smalltalk.withContext(function($ctx1) {
  59418. //>>excludeEnd("ctx");
  59419. i=(0);
  59420. _st((function(){
  59421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59422. return smalltalk.withContext(function($ctx2) {
  59423. //>>excludeEnd("ctx");
  59424. return _st(i).__lt((5));
  59425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59426. $ctx2.sendIdx["<"]=1;
  59427. //>>excludeEnd("ctx");
  59428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59430. //>>excludeEnd("ctx");
  59431. }))._whileTrue_((function(){
  59432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59433. return smalltalk.withContext(function($ctx2) {
  59434. //>>excludeEnd("ctx");
  59435. i=_st(i).__plus((1));
  59436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59437. $ctx2.sendIdx["+"]=1;
  59438. //>>excludeEnd("ctx");
  59439. return i;
  59440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59441. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59442. //>>excludeEnd("ctx");
  59443. }));
  59444. self._assert_equals_(i,(5));
  59445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59446. $ctx1.sendIdx["assert:equals:"]=1;
  59447. //>>excludeEnd("ctx");
  59448. i=(0);
  59449. _st((function(){
  59450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59451. return smalltalk.withContext(function($ctx2) {
  59452. //>>excludeEnd("ctx");
  59453. i=_st(i).__plus((1));
  59454. i;
  59455. return _st(i).__lt((5));
  59456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  59458. //>>excludeEnd("ctx");
  59459. }))._whileTrue();
  59460. self._assert_equals_(i,(5));
  59461. return self;
  59462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59463. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)});
  59464. //>>excludeEnd("ctx");
  59465. },
  59466. //>>excludeStart("ide", pragmas.excludeIdeData);
  59467. args: [],
  59468. 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",
  59469. referencedClasses: [],
  59470. //>>excludeEnd("ide");
  59471. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  59472. }),
  59473. globals.BlockClosureTest);
  59474. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  59475. smalltalk.addMethod(
  59476. smalltalk.method({
  59477. selector: "testEquality",
  59478. protocol: 'tests',
  59479. fn: function (){
  59480. var self=this;
  59481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59482. return smalltalk.withContext(function($ctx1) {
  59483. //>>excludeEnd("ctx");
  59484. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  59485. $1=(0).__eq(false);
  59486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59487. $ctx1.sendIdx["="]=1;
  59488. //>>excludeEnd("ctx");
  59489. self._deny_($1);
  59490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59491. $ctx1.sendIdx["deny:"]=1;
  59492. //>>excludeEnd("ctx");
  59493. $2=false.__eq((0));
  59494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59495. $ctx1.sendIdx["="]=2;
  59496. //>>excludeEnd("ctx");
  59497. self._deny_($2);
  59498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59499. $ctx1.sendIdx["deny:"]=2;
  59500. //>>excludeEnd("ctx");
  59501. $3="".__eq(false);
  59502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59503. $ctx1.sendIdx["="]=3;
  59504. //>>excludeEnd("ctx");
  59505. self._deny_($3);
  59506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59507. $ctx1.sendIdx["deny:"]=3;
  59508. //>>excludeEnd("ctx");
  59509. $4=false.__eq("");
  59510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59511. $ctx1.sendIdx["="]=4;
  59512. //>>excludeEnd("ctx");
  59513. self._deny_($4);
  59514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59515. $ctx1.sendIdx["deny:"]=4;
  59516. //>>excludeEnd("ctx");
  59517. $5=true.__eq(true);
  59518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59519. $ctx1.sendIdx["="]=5;
  59520. //>>excludeEnd("ctx");
  59521. self._assert_($5);
  59522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59523. $ctx1.sendIdx["assert:"]=1;
  59524. //>>excludeEnd("ctx");
  59525. $6=false.__eq(true);
  59526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59527. $ctx1.sendIdx["="]=6;
  59528. //>>excludeEnd("ctx");
  59529. self._deny_($6);
  59530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59531. $ctx1.sendIdx["deny:"]=5;
  59532. //>>excludeEnd("ctx");
  59533. $7=true.__eq(false);
  59534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59535. $ctx1.sendIdx["="]=7;
  59536. //>>excludeEnd("ctx");
  59537. self._deny_($7);
  59538. $8=false.__eq(false);
  59539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59540. $ctx1.sendIdx["="]=8;
  59541. //>>excludeEnd("ctx");
  59542. self._assert_($8);
  59543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59544. $ctx1.sendIdx["assert:"]=2;
  59545. //>>excludeEnd("ctx");
  59546. $10=true._yourself();
  59547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59548. $ctx1.sendIdx["yourself"]=1;
  59549. //>>excludeEnd("ctx");
  59550. $9=_st($10).__eq(true);
  59551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59552. $ctx1.sendIdx["="]=9;
  59553. //>>excludeEnd("ctx");
  59554. self._assert_($9);
  59555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59556. $ctx1.sendIdx["assert:"]=3;
  59557. //>>excludeEnd("ctx");
  59558. $12=true._yourself();
  59559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59560. $ctx1.sendIdx["yourself"]=2;
  59561. //>>excludeEnd("ctx");
  59562. $11=_st($12).__eq(true._yourself());
  59563. self._assert_($11);
  59564. return self;
  59565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59566. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)});
  59567. //>>excludeEnd("ctx");
  59568. },
  59569. //>>excludeStart("ide", pragmas.excludeIdeData);
  59570. args: [],
  59571. 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)",
  59572. referencedClasses: [],
  59573. //>>excludeEnd("ide");
  59574. messageSends: ["deny:", "=", "assert:", "yourself"]
  59575. }),
  59576. globals.BooleanTest);
  59577. smalltalk.addMethod(
  59578. smalltalk.method({
  59579. selector: "testIdentity",
  59580. protocol: 'tests',
  59581. fn: function (){
  59582. var self=this;
  59583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59584. return smalltalk.withContext(function($ctx1) {
  59585. //>>excludeEnd("ctx");
  59586. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  59587. $1=(0).__eq_eq(false);
  59588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59589. $ctx1.sendIdx["=="]=1;
  59590. //>>excludeEnd("ctx");
  59591. self._deny_($1);
  59592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59593. $ctx1.sendIdx["deny:"]=1;
  59594. //>>excludeEnd("ctx");
  59595. $2=false.__eq_eq((0));
  59596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59597. $ctx1.sendIdx["=="]=2;
  59598. //>>excludeEnd("ctx");
  59599. self._deny_($2);
  59600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59601. $ctx1.sendIdx["deny:"]=2;
  59602. //>>excludeEnd("ctx");
  59603. $3="".__eq_eq(false);
  59604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59605. $ctx1.sendIdx["=="]=3;
  59606. //>>excludeEnd("ctx");
  59607. self._deny_($3);
  59608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59609. $ctx1.sendIdx["deny:"]=3;
  59610. //>>excludeEnd("ctx");
  59611. $4=false.__eq_eq("");
  59612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59613. $ctx1.sendIdx["=="]=4;
  59614. //>>excludeEnd("ctx");
  59615. self._deny_($4);
  59616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59617. $ctx1.sendIdx["deny:"]=4;
  59618. //>>excludeEnd("ctx");
  59619. $5=true.__eq_eq(true);
  59620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59621. $ctx1.sendIdx["=="]=5;
  59622. //>>excludeEnd("ctx");
  59623. self._assert_($5);
  59624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59625. $ctx1.sendIdx["assert:"]=1;
  59626. //>>excludeEnd("ctx");
  59627. $6=false.__eq_eq(true);
  59628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59629. $ctx1.sendIdx["=="]=6;
  59630. //>>excludeEnd("ctx");
  59631. self._deny_($6);
  59632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59633. $ctx1.sendIdx["deny:"]=5;
  59634. //>>excludeEnd("ctx");
  59635. $7=true.__eq_eq(false);
  59636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59637. $ctx1.sendIdx["=="]=7;
  59638. //>>excludeEnd("ctx");
  59639. self._deny_($7);
  59640. $8=false.__eq_eq(false);
  59641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59642. $ctx1.sendIdx["=="]=8;
  59643. //>>excludeEnd("ctx");
  59644. self._assert_($8);
  59645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59646. $ctx1.sendIdx["assert:"]=2;
  59647. //>>excludeEnd("ctx");
  59648. $10=true._yourself();
  59649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59650. $ctx1.sendIdx["yourself"]=1;
  59651. //>>excludeEnd("ctx");
  59652. $9=_st($10).__eq_eq(true);
  59653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59654. $ctx1.sendIdx["=="]=9;
  59655. //>>excludeEnd("ctx");
  59656. self._assert_($9);
  59657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59658. $ctx1.sendIdx["assert:"]=3;
  59659. //>>excludeEnd("ctx");
  59660. $12=true._yourself();
  59661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59662. $ctx1.sendIdx["yourself"]=2;
  59663. //>>excludeEnd("ctx");
  59664. $11=_st($12).__eq_eq(true._yourself());
  59665. self._assert_($11);
  59666. return self;
  59667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59668. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)});
  59669. //>>excludeEnd("ctx");
  59670. },
  59671. //>>excludeStart("ide", pragmas.excludeIdeData);
  59672. args: [],
  59673. 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",
  59674. referencedClasses: [],
  59675. //>>excludeEnd("ide");
  59676. messageSends: ["deny:", "==", "assert:", "yourself"]
  59677. }),
  59678. globals.BooleanTest);
  59679. smalltalk.addMethod(
  59680. smalltalk.method({
  59681. selector: "testIfTrueIfFalse",
  59682. protocol: 'tests',
  59683. fn: function (){
  59684. var self=this;
  59685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59686. return smalltalk.withContext(function($ctx1) {
  59687. //>>excludeEnd("ctx");
  59688. var $1,$2,$3,$4,$5,$6,$7,$8;
  59689. if(smalltalk.assert(true)){
  59690. $1="alternative block";
  59691. };
  59692. self._assert_equals_($1,"alternative block");
  59693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59694. $ctx1.sendIdx["assert:equals:"]=1;
  59695. //>>excludeEnd("ctx");
  59696. if(! smalltalk.assert(true)){
  59697. $2="alternative block";
  59698. };
  59699. self._assert_equals_($2,nil);
  59700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59701. $ctx1.sendIdx["assert:equals:"]=2;
  59702. //>>excludeEnd("ctx");
  59703. if(smalltalk.assert(false)){
  59704. $3="alternative block";
  59705. };
  59706. self._assert_equals_($3,nil);
  59707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59708. $ctx1.sendIdx["assert:equals:"]=3;
  59709. //>>excludeEnd("ctx");
  59710. if(! smalltalk.assert(false)){
  59711. $4="alternative block";
  59712. };
  59713. self._assert_equals_($4,"alternative block");
  59714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59715. $ctx1.sendIdx["assert:equals:"]=4;
  59716. //>>excludeEnd("ctx");
  59717. if(smalltalk.assert(false)){
  59718. $5="alternative block";
  59719. } else {
  59720. $5="alternative block2";
  59721. };
  59722. self._assert_equals_($5,"alternative block2");
  59723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59724. $ctx1.sendIdx["assert:equals:"]=5;
  59725. //>>excludeEnd("ctx");
  59726. if(smalltalk.assert(false)){
  59727. $6="alternative block2";
  59728. } else {
  59729. $6="alternative block";
  59730. };
  59731. self._assert_equals_($6,"alternative block");
  59732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59733. $ctx1.sendIdx["assert:equals:"]=6;
  59734. //>>excludeEnd("ctx");
  59735. if(smalltalk.assert(true)){
  59736. $7="alternative block";
  59737. } else {
  59738. $7="alternative block2";
  59739. };
  59740. self._assert_equals_($7,"alternative block");
  59741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59742. $ctx1.sendIdx["assert:equals:"]=7;
  59743. //>>excludeEnd("ctx");
  59744. if(smalltalk.assert(true)){
  59745. $8="alternative block2";
  59746. } else {
  59747. $8="alternative block";
  59748. };
  59749. self._assert_equals_($8,"alternative block2");
  59750. return self;
  59751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59752. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)});
  59753. //>>excludeEnd("ctx");
  59754. },
  59755. //>>excludeStart("ide", pragmas.excludeIdeData);
  59756. args: [],
  59757. 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'.",
  59758. referencedClasses: [],
  59759. //>>excludeEnd("ide");
  59760. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  59761. }),
  59762. globals.BooleanTest);
  59763. smalltalk.addMethod(
  59764. smalltalk.method({
  59765. selector: "testIfTrueIfFalseWithBoxing",
  59766. protocol: 'tests',
  59767. fn: function (){
  59768. var self=this;
  59769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59770. return smalltalk.withContext(function($ctx1) {
  59771. //>>excludeEnd("ctx");
  59772. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  59773. $2=true._yourself();
  59774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59775. $ctx1.sendIdx["yourself"]=1;
  59776. //>>excludeEnd("ctx");
  59777. if(smalltalk.assert($2)){
  59778. $1="alternative block";
  59779. };
  59780. self._assert_equals_($1,"alternative block");
  59781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59782. $ctx1.sendIdx["assert:equals:"]=1;
  59783. //>>excludeEnd("ctx");
  59784. $4=true._yourself();
  59785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59786. $ctx1.sendIdx["yourself"]=2;
  59787. //>>excludeEnd("ctx");
  59788. if(! smalltalk.assert($4)){
  59789. $3="alternative block";
  59790. };
  59791. self._assert_equals_($3,nil);
  59792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59793. $ctx1.sendIdx["assert:equals:"]=2;
  59794. //>>excludeEnd("ctx");
  59795. $6=false._yourself();
  59796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59797. $ctx1.sendIdx["yourself"]=3;
  59798. //>>excludeEnd("ctx");
  59799. if(smalltalk.assert($6)){
  59800. $5="alternative block";
  59801. };
  59802. self._assert_equals_($5,nil);
  59803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59804. $ctx1.sendIdx["assert:equals:"]=3;
  59805. //>>excludeEnd("ctx");
  59806. $8=false._yourself();
  59807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59808. $ctx1.sendIdx["yourself"]=4;
  59809. //>>excludeEnd("ctx");
  59810. if(! smalltalk.assert($8)){
  59811. $7="alternative block";
  59812. };
  59813. self._assert_equals_($7,"alternative block");
  59814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59815. $ctx1.sendIdx["assert:equals:"]=4;
  59816. //>>excludeEnd("ctx");
  59817. $10=false._yourself();
  59818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59819. $ctx1.sendIdx["yourself"]=5;
  59820. //>>excludeEnd("ctx");
  59821. if(smalltalk.assert($10)){
  59822. $9="alternative block";
  59823. } else {
  59824. $9="alternative block2";
  59825. };
  59826. self._assert_equals_($9,"alternative block2");
  59827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59828. $ctx1.sendIdx["assert:equals:"]=5;
  59829. //>>excludeEnd("ctx");
  59830. $12=false._yourself();
  59831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59832. $ctx1.sendIdx["yourself"]=6;
  59833. //>>excludeEnd("ctx");
  59834. if(smalltalk.assert($12)){
  59835. $11="alternative block2";
  59836. } else {
  59837. $11="alternative block";
  59838. };
  59839. self._assert_equals_($11,"alternative block");
  59840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59841. $ctx1.sendIdx["assert:equals:"]=6;
  59842. //>>excludeEnd("ctx");
  59843. $14=true._yourself();
  59844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59845. $ctx1.sendIdx["yourself"]=7;
  59846. //>>excludeEnd("ctx");
  59847. if(smalltalk.assert($14)){
  59848. $13="alternative block";
  59849. } else {
  59850. $13="alternative block2";
  59851. };
  59852. self._assert_equals_($13,"alternative block");
  59853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59854. $ctx1.sendIdx["assert:equals:"]=7;
  59855. //>>excludeEnd("ctx");
  59856. $16=true._yourself();
  59857. if(smalltalk.assert($16)){
  59858. $15="alternative block2";
  59859. } else {
  59860. $15="alternative block";
  59861. };
  59862. self._assert_equals_($15,"alternative block2");
  59863. return self;
  59864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59865. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)});
  59866. //>>excludeEnd("ctx");
  59867. },
  59868. //>>excludeStart("ide", pragmas.excludeIdeData);
  59869. args: [],
  59870. 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'.",
  59871. referencedClasses: [],
  59872. //>>excludeEnd("ide");
  59873. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  59874. }),
  59875. globals.BooleanTest);
  59876. smalltalk.addMethod(
  59877. smalltalk.method({
  59878. selector: "testLogic",
  59879. protocol: 'tests',
  59880. fn: function (){
  59881. var self=this;
  59882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59883. return smalltalk.withContext(function($ctx1) {
  59884. //>>excludeEnd("ctx");
  59885. 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;
  59886. $1=true.__and(true);
  59887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59888. $ctx1.sendIdx["&"]=1;
  59889. //>>excludeEnd("ctx");
  59890. self._assert_($1);
  59891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59892. $ctx1.sendIdx["assert:"]=1;
  59893. //>>excludeEnd("ctx");
  59894. $2=true.__and(false);
  59895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59896. $ctx1.sendIdx["&"]=2;
  59897. //>>excludeEnd("ctx");
  59898. self._deny_($2);
  59899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59900. $ctx1.sendIdx["deny:"]=1;
  59901. //>>excludeEnd("ctx");
  59902. $3=false.__and(true);
  59903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59904. $ctx1.sendIdx["&"]=3;
  59905. //>>excludeEnd("ctx");
  59906. self._deny_($3);
  59907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59908. $ctx1.sendIdx["deny:"]=2;
  59909. //>>excludeEnd("ctx");
  59910. $5=false.__and(false);
  59911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59912. $ctx1.sendIdx["&"]=4;
  59913. //>>excludeEnd("ctx");
  59914. $4=self._deny_($5);
  59915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59916. $ctx1.sendIdx["deny:"]=3;
  59917. //>>excludeEnd("ctx");
  59918. $6=true.__or(true);
  59919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59920. $ctx1.sendIdx["|"]=1;
  59921. //>>excludeEnd("ctx");
  59922. self._assert_($6);
  59923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59924. $ctx1.sendIdx["assert:"]=2;
  59925. //>>excludeEnd("ctx");
  59926. $7=true.__or(false);
  59927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59928. $ctx1.sendIdx["|"]=2;
  59929. //>>excludeEnd("ctx");
  59930. self._assert_($7);
  59931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59932. $ctx1.sendIdx["assert:"]=3;
  59933. //>>excludeEnd("ctx");
  59934. $8=false.__or(true);
  59935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59936. $ctx1.sendIdx["|"]=3;
  59937. //>>excludeEnd("ctx");
  59938. self._assert_($8);
  59939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59940. $ctx1.sendIdx["assert:"]=4;
  59941. //>>excludeEnd("ctx");
  59942. $10=false.__or(false);
  59943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59944. $ctx1.sendIdx["|"]=4;
  59945. //>>excludeEnd("ctx");
  59946. $9=self._deny_($10);
  59947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59948. $ctx1.sendIdx["deny:"]=4;
  59949. //>>excludeEnd("ctx");
  59950. $12=(1).__gt((0));
  59951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59952. $ctx1.sendIdx[">"]=1;
  59953. //>>excludeEnd("ctx");
  59954. $11=true.__and($12);
  59955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59956. $ctx1.sendIdx["&"]=5;
  59957. //>>excludeEnd("ctx");
  59958. self._assert_($11);
  59959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59960. $ctx1.sendIdx["assert:"]=5;
  59961. //>>excludeEnd("ctx");
  59962. $14=(1).__gt((0));
  59963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59964. $ctx1.sendIdx[">"]=2;
  59965. //>>excludeEnd("ctx");
  59966. $13=_st($14).__and(false);
  59967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59968. $ctx1.sendIdx["&"]=6;
  59969. //>>excludeEnd("ctx");
  59970. self._deny_($13);
  59971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59972. $ctx1.sendIdx["deny:"]=5;
  59973. //>>excludeEnd("ctx");
  59974. $17=(1).__gt((0));
  59975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59976. $ctx1.sendIdx[">"]=3;
  59977. //>>excludeEnd("ctx");
  59978. $18=(1).__gt((2));
  59979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59980. $ctx1.sendIdx[">"]=4;
  59981. //>>excludeEnd("ctx");
  59982. $16=_st($17).__and($18);
  59983. $15=self._deny_($16);
  59984. $20=(1).__gt((0));
  59985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59986. $ctx1.sendIdx[">"]=5;
  59987. //>>excludeEnd("ctx");
  59988. $19=false.__or($20);
  59989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59990. $ctx1.sendIdx["|"]=5;
  59991. //>>excludeEnd("ctx");
  59992. self._assert_($19);
  59993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59994. $ctx1.sendIdx["assert:"]=6;
  59995. //>>excludeEnd("ctx");
  59996. $22=(1).__gt((0));
  59997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59998. $ctx1.sendIdx[">"]=6;
  59999. //>>excludeEnd("ctx");
  60000. $21=_st($22).__or(false);
  60001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60002. $ctx1.sendIdx["|"]=6;
  60003. //>>excludeEnd("ctx");
  60004. self._assert_($21);
  60005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60006. $ctx1.sendIdx["assert:"]=7;
  60007. //>>excludeEnd("ctx");
  60008. $25=(1).__gt((0));
  60009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60010. $ctx1.sendIdx[">"]=7;
  60011. //>>excludeEnd("ctx");
  60012. $24=_st($25).__or((1).__gt((2)));
  60013. $23=self._assert_($24);
  60014. return self;
  60015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60016. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)});
  60017. //>>excludeEnd("ctx");
  60018. },
  60019. //>>excludeStart("ide", pragmas.excludeIdeData);
  60020. args: [],
  60021. 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))",
  60022. referencedClasses: [],
  60023. //>>excludeEnd("ide");
  60024. messageSends: ["assert:", "&", "deny:", "|", ">"]
  60025. }),
  60026. globals.BooleanTest);
  60027. smalltalk.addMethod(
  60028. smalltalk.method({
  60029. selector: "testLogicKeywords",
  60030. protocol: 'tests',
  60031. fn: function (){
  60032. var self=this;
  60033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60034. return smalltalk.withContext(function($ctx1) {
  60035. //>>excludeEnd("ctx");
  60036. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  60037. $1=true._and_((function(){
  60038. return true;
  60039. }));
  60040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60041. $ctx1.sendIdx["and:"]=1;
  60042. //>>excludeEnd("ctx");
  60043. self._assert_($1);
  60044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60045. $ctx1.sendIdx["assert:"]=1;
  60046. //>>excludeEnd("ctx");
  60047. $2=true._and_((function(){
  60048. return false;
  60049. }));
  60050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60051. $ctx1.sendIdx["and:"]=2;
  60052. //>>excludeEnd("ctx");
  60053. self._deny_($2);
  60054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60055. $ctx1.sendIdx["deny:"]=1;
  60056. //>>excludeEnd("ctx");
  60057. $3=false._and_((function(){
  60058. return true;
  60059. }));
  60060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60061. $ctx1.sendIdx["and:"]=3;
  60062. //>>excludeEnd("ctx");
  60063. self._deny_($3);
  60064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60065. $ctx1.sendIdx["deny:"]=2;
  60066. //>>excludeEnd("ctx");
  60067. $5=false._and_((function(){
  60068. return false;
  60069. }));
  60070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60071. $ctx1.sendIdx["and:"]=4;
  60072. //>>excludeEnd("ctx");
  60073. $4=self._deny_($5);
  60074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60075. $ctx1.sendIdx["deny:"]=3;
  60076. //>>excludeEnd("ctx");
  60077. $6=true._or_((function(){
  60078. return true;
  60079. }));
  60080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60081. $ctx1.sendIdx["or:"]=1;
  60082. //>>excludeEnd("ctx");
  60083. self._assert_($6);
  60084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60085. $ctx1.sendIdx["assert:"]=2;
  60086. //>>excludeEnd("ctx");
  60087. $7=true._or_((function(){
  60088. return false;
  60089. }));
  60090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60091. $ctx1.sendIdx["or:"]=2;
  60092. //>>excludeEnd("ctx");
  60093. self._assert_($7);
  60094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60095. $ctx1.sendIdx["assert:"]=3;
  60096. //>>excludeEnd("ctx");
  60097. $8=false._or_((function(){
  60098. return true;
  60099. }));
  60100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60101. $ctx1.sendIdx["or:"]=3;
  60102. //>>excludeEnd("ctx");
  60103. self._assert_($8);
  60104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60105. $ctx1.sendIdx["assert:"]=4;
  60106. //>>excludeEnd("ctx");
  60107. $10=false._or_((function(){
  60108. return false;
  60109. }));
  60110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60111. $ctx1.sendIdx["or:"]=4;
  60112. //>>excludeEnd("ctx");
  60113. $9=self._deny_($10);
  60114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60115. $ctx1.sendIdx["deny:"]=4;
  60116. //>>excludeEnd("ctx");
  60117. $11=true._and_((function(){
  60118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60119. return smalltalk.withContext(function($ctx2) {
  60120. //>>excludeEnd("ctx");
  60121. return (1).__gt((0));
  60122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60123. $ctx2.sendIdx[">"]=1;
  60124. //>>excludeEnd("ctx");
  60125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  60127. //>>excludeEnd("ctx");
  60128. }));
  60129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60130. $ctx1.sendIdx["and:"]=5;
  60131. //>>excludeEnd("ctx");
  60132. self._assert_($11);
  60133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60134. $ctx1.sendIdx["assert:"]=5;
  60135. //>>excludeEnd("ctx");
  60136. $13=(1).__gt((0));
  60137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60138. $ctx1.sendIdx[">"]=2;
  60139. //>>excludeEnd("ctx");
  60140. $12=_st($13)._and_((function(){
  60141. return false;
  60142. }));
  60143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60144. $ctx1.sendIdx["and:"]=6;
  60145. //>>excludeEnd("ctx");
  60146. self._deny_($12);
  60147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60148. $ctx1.sendIdx["deny:"]=5;
  60149. //>>excludeEnd("ctx");
  60150. $16=(1).__gt((0));
  60151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60152. $ctx1.sendIdx[">"]=3;
  60153. //>>excludeEnd("ctx");
  60154. $15=_st($16)._and_((function(){
  60155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60156. return smalltalk.withContext(function($ctx2) {
  60157. //>>excludeEnd("ctx");
  60158. return (1).__gt((2));
  60159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60160. $ctx2.sendIdx[">"]=4;
  60161. //>>excludeEnd("ctx");
  60162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60163. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  60164. //>>excludeEnd("ctx");
  60165. }));
  60166. $14=self._deny_($15);
  60167. $17=false._or_((function(){
  60168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60169. return smalltalk.withContext(function($ctx2) {
  60170. //>>excludeEnd("ctx");
  60171. return (1).__gt((0));
  60172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60173. $ctx2.sendIdx[">"]=5;
  60174. //>>excludeEnd("ctx");
  60175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  60177. //>>excludeEnd("ctx");
  60178. }));
  60179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60180. $ctx1.sendIdx["or:"]=5;
  60181. //>>excludeEnd("ctx");
  60182. self._assert_($17);
  60183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60184. $ctx1.sendIdx["assert:"]=6;
  60185. //>>excludeEnd("ctx");
  60186. $19=(1).__gt((0));
  60187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60188. $ctx1.sendIdx[">"]=6;
  60189. //>>excludeEnd("ctx");
  60190. $18=_st($19)._or_((function(){
  60191. return false;
  60192. }));
  60193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60194. $ctx1.sendIdx["or:"]=6;
  60195. //>>excludeEnd("ctx");
  60196. self._assert_($18);
  60197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60198. $ctx1.sendIdx["assert:"]=7;
  60199. //>>excludeEnd("ctx");
  60200. $22=(1).__gt((0));
  60201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60202. $ctx1.sendIdx[">"]=7;
  60203. //>>excludeEnd("ctx");
  60204. $21=_st($22)._or_((function(){
  60205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60206. return smalltalk.withContext(function($ctx2) {
  60207. //>>excludeEnd("ctx");
  60208. return (1).__gt((2));
  60209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  60211. //>>excludeEnd("ctx");
  60212. }));
  60213. $20=self._assert_($21);
  60214. return self;
  60215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60216. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)});
  60217. //>>excludeEnd("ctx");
  60218. },
  60219. //>>excludeStart("ide", pragmas.excludeIdeData);
  60220. args: [],
  60221. 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 ])",
  60222. referencedClasses: [],
  60223. //>>excludeEnd("ide");
  60224. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  60225. }),
  60226. globals.BooleanTest);
  60227. smalltalk.addMethod(
  60228. smalltalk.method({
  60229. selector: "testNonBooleanError",
  60230. protocol: 'tests',
  60231. fn: function (){
  60232. var self=this;
  60233. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  60234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60235. return smalltalk.withContext(function($ctx1) {
  60236. //>>excludeEnd("ctx");
  60237. self._should_raise_((function(){
  60238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60239. return smalltalk.withContext(function($ctx2) {
  60240. //>>excludeEnd("ctx");
  60241. if(smalltalk.assert("")){
  60242. } else {
  60243. };
  60244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60245. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60246. //>>excludeEnd("ctx");
  60247. }),$NonBooleanReceiver());
  60248. return self;
  60249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60250. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)});
  60251. //>>excludeEnd("ctx");
  60252. },
  60253. //>>excludeStart("ide", pragmas.excludeIdeData);
  60254. args: [],
  60255. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  60256. referencedClasses: ["NonBooleanReceiver"],
  60257. //>>excludeEnd("ide");
  60258. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  60259. }),
  60260. globals.BooleanTest);
  60261. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  60262. smalltalk.addMethod(
  60263. smalltalk.method({
  60264. selector: "setUp",
  60265. protocol: 'running',
  60266. fn: function (){
  60267. var self=this;
  60268. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  60269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60270. return smalltalk.withContext(function($ctx1) {
  60271. //>>excludeEnd("ctx");
  60272. self["@builder"]=_st($ClassBuilder())._new();
  60273. return self;
  60274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60275. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)});
  60276. //>>excludeEnd("ctx");
  60277. },
  60278. //>>excludeStart("ide", pragmas.excludeIdeData);
  60279. args: [],
  60280. source: "setUp\x0a\x09builder := ClassBuilder new",
  60281. referencedClasses: ["ClassBuilder"],
  60282. //>>excludeEnd("ide");
  60283. messageSends: ["new"]
  60284. }),
  60285. globals.ClassBuilderTest);
  60286. smalltalk.addMethod(
  60287. smalltalk.method({
  60288. selector: "tearDown",
  60289. protocol: 'running',
  60290. fn: function (){
  60291. var self=this;
  60292. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60294. return smalltalk.withContext(function($ctx1) {
  60295. //>>excludeEnd("ctx");
  60296. var $1,$receiver;
  60297. $1=self["@theClass"];
  60298. if(($receiver = $1) == null || $receiver.isNil){
  60299. $1;
  60300. } else {
  60301. _st($Smalltalk())._removeClass_(self["@theClass"]);
  60302. self["@theClass"]=nil;
  60303. self["@theClass"];
  60304. };
  60305. return self;
  60306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60307. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)});
  60308. //>>excludeEnd("ctx");
  60309. },
  60310. //>>excludeStart("ide", pragmas.excludeIdeData);
  60311. args: [],
  60312. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  60313. referencedClasses: ["Smalltalk"],
  60314. //>>excludeEnd("ide");
  60315. messageSends: ["ifNotNil:", "removeClass:"]
  60316. }),
  60317. globals.ClassBuilderTest);
  60318. smalltalk.addMethod(
  60319. smalltalk.method({
  60320. selector: "testClassCopy",
  60321. protocol: 'tests',
  60322. fn: function (){
  60323. var self=this;
  60324. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60326. return smalltalk.withContext(function($ctx1) {
  60327. //>>excludeEnd("ctx");
  60328. var $2,$1,$4,$3,$6,$5,$8,$7;
  60329. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60330. $2=_st(self["@theClass"])._superclass();
  60331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60332. $ctx1.sendIdx["superclass"]=1;
  60333. //>>excludeEnd("ctx");
  60334. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  60335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60336. $ctx1.sendIdx["=="]=1;
  60337. //>>excludeEnd("ctx");
  60338. self._assert_($1);
  60339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60340. $ctx1.sendIdx["assert:"]=1;
  60341. //>>excludeEnd("ctx");
  60342. $4=_st(self["@theClass"])._instanceVariableNames();
  60343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60344. $ctx1.sendIdx["instanceVariableNames"]=1;
  60345. //>>excludeEnd("ctx");
  60346. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  60347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60348. $ctx1.sendIdx["=="]=2;
  60349. //>>excludeEnd("ctx");
  60350. self._assert_($3);
  60351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60352. $ctx1.sendIdx["assert:"]=2;
  60353. //>>excludeEnd("ctx");
  60354. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  60355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60356. $ctx1.sendIdx["assert:equals:"]=1;
  60357. //>>excludeEnd("ctx");
  60358. $6=_st(self["@theClass"])._package();
  60359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60360. $ctx1.sendIdx["package"]=1;
  60361. //>>excludeEnd("ctx");
  60362. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  60363. self._assert_($5);
  60364. $8=_st(self["@theClass"])._methodDictionary();
  60365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60366. $ctx1.sendIdx["methodDictionary"]=1;
  60367. //>>excludeEnd("ctx");
  60368. $7=_st($8)._keys();
  60369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60370. $ctx1.sendIdx["keys"]=1;
  60371. //>>excludeEnd("ctx");
  60372. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  60373. return self;
  60374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60375. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)});
  60376. //>>excludeEnd("ctx");
  60377. },
  60378. //>>excludeStart("ide", pragmas.excludeIdeData);
  60379. args: [],
  60380. 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",
  60381. referencedClasses: ["ObjectMock"],
  60382. //>>excludeEnd("ide");
  60383. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  60384. }),
  60385. globals.ClassBuilderTest);
  60386. smalltalk.addMethod(
  60387. smalltalk.method({
  60388. selector: "testClassMigration",
  60389. protocol: 'tests',
  60390. fn: function (){
  60391. var self=this;
  60392. var instance,oldClass;
  60393. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60394. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60395. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60397. return smalltalk.withContext(function($ctx1) {
  60398. //>>excludeEnd("ctx");
  60399. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  60400. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60401. $2=_st($Smalltalk())._globals();
  60402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60403. $ctx1.sendIdx["globals"]=1;
  60404. //>>excludeEnd("ctx");
  60405. $1=_st($2)._at_("ObjectMock2");
  60406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60407. $ctx1.sendIdx["at:"]=1;
  60408. //>>excludeEnd("ctx");
  60409. instance=_st($1)._new();
  60410. $4=_st($Smalltalk())._globals();
  60411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60412. $ctx1.sendIdx["globals"]=2;
  60413. //>>excludeEnd("ctx");
  60414. $3=_st($4)._at_("ObjectMock2");
  60415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60416. $ctx1.sendIdx["at:"]=2;
  60417. //>>excludeEnd("ctx");
  60418. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  60419. $5=_st(oldClass).__eq_eq($ObjectMock2());
  60420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60421. $ctx1.sendIdx["=="]=1;
  60422. //>>excludeEnd("ctx");
  60423. self._deny_($5);
  60424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60425. $ctx1.sendIdx["deny:"]=1;
  60426. //>>excludeEnd("ctx");
  60427. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  60428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60429. $ctx1.sendIdx["=="]=2;
  60430. //>>excludeEnd("ctx");
  60431. self._assert_($6);
  60432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60433. $ctx1.sendIdx["assert:"]=1;
  60434. //>>excludeEnd("ctx");
  60435. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  60436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60437. $ctx1.sendIdx["assert:"]=2;
  60438. //>>excludeEnd("ctx");
  60439. $7=_st($ObjectMock2())._selectors();
  60440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60441. $ctx1.sendIdx["selectors"]=1;
  60442. //>>excludeEnd("ctx");
  60443. self._assert_equals_($7,_st(oldClass)._selectors());
  60444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60445. $ctx1.sendIdx["assert:equals:"]=1;
  60446. //>>excludeEnd("ctx");
  60447. $8=_st($ObjectMock2())._comment();
  60448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60449. $ctx1.sendIdx["comment"]=1;
  60450. //>>excludeEnd("ctx");
  60451. self._assert_equals_($8,_st(oldClass)._comment());
  60452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60453. $ctx1.sendIdx["assert:equals:"]=2;
  60454. //>>excludeEnd("ctx");
  60455. $9=_st(_st($ObjectMock2())._package())._name();
  60456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60457. $ctx1.sendIdx["name"]=1;
  60458. //>>excludeEnd("ctx");
  60459. self._assert_equals_($9,"Kernel-Tests");
  60460. $11=_st(instance)._class();
  60461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60462. $ctx1.sendIdx["class"]=1;
  60463. //>>excludeEnd("ctx");
  60464. $10=_st($11).__eq_eq($ObjectMock2());
  60465. self._deny_($10);
  60466. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  60467. _st($Smalltalk())._removeClass_($ObjectMock2());
  60468. return self;
  60469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60470. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)});
  60471. //>>excludeEnd("ctx");
  60472. },
  60473. //>>excludeStart("ide", pragmas.excludeIdeData);
  60474. args: [],
  60475. 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",
  60476. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  60477. //>>excludeEnd("ide");
  60478. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  60479. }),
  60480. globals.ClassBuilderTest);
  60481. smalltalk.addMethod(
  60482. smalltalk.method({
  60483. selector: "testClassMigrationWithClassInstanceVariables",
  60484. protocol: 'tests',
  60485. fn: function (){
  60486. var self=this;
  60487. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60488. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60489. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60491. return smalltalk.withContext(function($ctx1) {
  60492. //>>excludeEnd("ctx");
  60493. var $1;
  60494. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60495. $1=_st($ObjectMock2())._class();
  60496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60497. $ctx1.sendIdx["class"]=1;
  60498. //>>excludeEnd("ctx");
  60499. _st($1)._instanceVariableNames_("foo bar");
  60500. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  60501. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  60502. _st($Smalltalk())._removeClass_($ObjectMock2());
  60503. return self;
  60504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60505. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)});
  60506. //>>excludeEnd("ctx");
  60507. },
  60508. //>>excludeStart("ide", pragmas.excludeIdeData);
  60509. args: [],
  60510. 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",
  60511. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  60512. //>>excludeEnd("ide");
  60513. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  60514. }),
  60515. globals.ClassBuilderTest);
  60516. smalltalk.addMethod(
  60517. smalltalk.method({
  60518. selector: "testClassMigrationWithSubclasses",
  60519. protocol: 'tests',
  60520. fn: function (){
  60521. var self=this;
  60522. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  60523. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  60524. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  60525. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  60526. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  60527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60528. return smalltalk.withContext(function($ctx1) {
  60529. //>>excludeEnd("ctx");
  60530. var $2,$1,$4,$3;
  60531. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  60532. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  60533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60534. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  60535. //>>excludeEnd("ctx");
  60536. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  60537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60538. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  60539. //>>excludeEnd("ctx");
  60540. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  60541. $2=_st($ObjectMock())._subclasses();
  60542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60543. $ctx1.sendIdx["subclasses"]=1;
  60544. //>>excludeEnd("ctx");
  60545. $1=_st($2)._includes_($ObjectMock2());
  60546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60547. $ctx1.sendIdx["includes:"]=1;
  60548. //>>excludeEnd("ctx");
  60549. self._assert_($1);
  60550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60551. $ctx1.sendIdx["assert:"]=1;
  60552. //>>excludeEnd("ctx");
  60553. $4=_st($ObjectMock2())._subclasses();
  60554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60555. $ctx1.sendIdx["subclasses"]=2;
  60556. //>>excludeEnd("ctx");
  60557. $3=_st($4)._includes_($ObjectMock3());
  60558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60559. $ctx1.sendIdx["includes:"]=2;
  60560. //>>excludeEnd("ctx");
  60561. self._assert_($3);
  60562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60563. $ctx1.sendIdx["assert:"]=2;
  60564. //>>excludeEnd("ctx");
  60565. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  60566. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  60567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60568. return smalltalk.withContext(function($ctx2) {
  60569. //>>excludeEnd("ctx");
  60570. return _st($Smalltalk())._removeClass_(each);
  60571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60573. //>>excludeEnd("ctx");
  60574. }));
  60575. return self;
  60576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60577. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)});
  60578. //>>excludeEnd("ctx");
  60579. },
  60580. //>>excludeStart("ide", pragmas.excludeIdeData);
  60581. args: [],
  60582. 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 ]",
  60583. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  60584. //>>excludeEnd("ide");
  60585. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  60586. }),
  60587. globals.ClassBuilderTest);
  60588. smalltalk.addMethod(
  60589. smalltalk.method({
  60590. selector: "testInstanceVariableNames",
  60591. protocol: 'tests',
  60592. fn: function (){
  60593. var self=this;
  60594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60595. return smalltalk.withContext(function($ctx1) {
  60596. //>>excludeEnd("ctx");
  60597. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  60598. return self;
  60599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60600. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)});
  60601. //>>excludeEnd("ctx");
  60602. },
  60603. //>>excludeStart("ide", pragmas.excludeIdeData);
  60604. args: [],
  60605. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  60606. referencedClasses: [],
  60607. //>>excludeEnd("ide");
  60608. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  60609. }),
  60610. globals.ClassBuilderTest);
  60611. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  60612. smalltalk.addMethod(
  60613. smalltalk.method({
  60614. selector: "assertSameContents:as:",
  60615. protocol: 'convenience',
  60616. fn: function (aCollection,anotherCollection){
  60617. var self=this;
  60618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60619. return smalltalk.withContext(function($ctx1) {
  60620. //>>excludeEnd("ctx");
  60621. var $2,$1,$4,$3;
  60622. $2=_st(aCollection)._size();
  60623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60624. $ctx1.sendIdx["size"]=1;
  60625. //>>excludeEnd("ctx");
  60626. $1=_st($2).__eq(_st(anotherCollection)._size());
  60627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60628. $ctx1.sendIdx["="]=1;
  60629. //>>excludeEnd("ctx");
  60630. self._assert_($1);
  60631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60632. $ctx1.sendIdx["assert:"]=1;
  60633. //>>excludeEnd("ctx");
  60634. _st(aCollection)._do_((function(each){
  60635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60636. return smalltalk.withContext(function($ctx2) {
  60637. //>>excludeEnd("ctx");
  60638. $4=_st(aCollection)._occurrencesOf_(each);
  60639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60640. $ctx2.sendIdx["occurrencesOf:"]=1;
  60641. //>>excludeEnd("ctx");
  60642. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  60643. return self._assert_($3);
  60644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60646. //>>excludeEnd("ctx");
  60647. }));
  60648. return self;
  60649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60650. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)});
  60651. //>>excludeEnd("ctx");
  60652. },
  60653. //>>excludeStart("ide", pragmas.excludeIdeData);
  60654. args: ["aCollection", "anotherCollection"],
  60655. 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)) ]",
  60656. referencedClasses: [],
  60657. //>>excludeEnd("ide");
  60658. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  60659. }),
  60660. globals.CollectionTest);
  60661. smalltalk.addMethod(
  60662. smalltalk.method({
  60663. selector: "collection",
  60664. protocol: 'fixture',
  60665. fn: function (){
  60666. var self=this;
  60667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60668. return smalltalk.withContext(function($ctx1) {
  60669. //>>excludeEnd("ctx");
  60670. self._subclassResponsibility();
  60671. return self;
  60672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60673. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)});
  60674. //>>excludeEnd("ctx");
  60675. },
  60676. //>>excludeStart("ide", pragmas.excludeIdeData);
  60677. args: [],
  60678. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  60679. referencedClasses: [],
  60680. //>>excludeEnd("ide");
  60681. messageSends: ["subclassResponsibility"]
  60682. }),
  60683. globals.CollectionTest);
  60684. smalltalk.addMethod(
  60685. smalltalk.method({
  60686. selector: "collectionClass",
  60687. protocol: 'fixture',
  60688. fn: function (){
  60689. var self=this;
  60690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60691. return smalltalk.withContext(function($ctx1) {
  60692. //>>excludeEnd("ctx");
  60693. var $1;
  60694. $1=_st(self._class())._collectionClass();
  60695. return $1;
  60696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60697. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)});
  60698. //>>excludeEnd("ctx");
  60699. },
  60700. //>>excludeStart("ide", pragmas.excludeIdeData);
  60701. args: [],
  60702. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  60703. referencedClasses: [],
  60704. //>>excludeEnd("ide");
  60705. messageSends: ["collectionClass", "class"]
  60706. }),
  60707. globals.CollectionTest);
  60708. smalltalk.addMethod(
  60709. smalltalk.method({
  60710. selector: "collectionOfPrintStrings",
  60711. protocol: 'fixture',
  60712. fn: function (){
  60713. var self=this;
  60714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60715. return smalltalk.withContext(function($ctx1) {
  60716. //>>excludeEnd("ctx");
  60717. self._subclassResponsibility();
  60718. return self;
  60719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60720. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)});
  60721. //>>excludeEnd("ctx");
  60722. },
  60723. //>>excludeStart("ide", pragmas.excludeIdeData);
  60724. args: [],
  60725. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  60726. referencedClasses: [],
  60727. //>>excludeEnd("ide");
  60728. messageSends: ["subclassResponsibility"]
  60729. }),
  60730. globals.CollectionTest);
  60731. smalltalk.addMethod(
  60732. smalltalk.method({
  60733. selector: "collectionSize",
  60734. protocol: 'fixture',
  60735. fn: function (){
  60736. var self=this;
  60737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60738. return smalltalk.withContext(function($ctx1) {
  60739. //>>excludeEnd("ctx");
  60740. self._subclassResponsibility();
  60741. return self;
  60742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60743. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)});
  60744. //>>excludeEnd("ctx");
  60745. },
  60746. //>>excludeStart("ide", pragmas.excludeIdeData);
  60747. args: [],
  60748. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  60749. referencedClasses: [],
  60750. //>>excludeEnd("ide");
  60751. messageSends: ["subclassResponsibility"]
  60752. }),
  60753. globals.CollectionTest);
  60754. smalltalk.addMethod(
  60755. smalltalk.method({
  60756. selector: "collectionWithDuplicates",
  60757. protocol: 'fixture',
  60758. fn: function (){
  60759. var self=this;
  60760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60761. return smalltalk.withContext(function($ctx1) {
  60762. //>>excludeEnd("ctx");
  60763. self._subclassResponsibility();
  60764. return self;
  60765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60766. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)});
  60767. //>>excludeEnd("ctx");
  60768. },
  60769. //>>excludeStart("ide", pragmas.excludeIdeData);
  60770. args: [],
  60771. 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",
  60772. referencedClasses: [],
  60773. //>>excludeEnd("ide");
  60774. messageSends: ["subclassResponsibility"]
  60775. }),
  60776. globals.CollectionTest);
  60777. smalltalk.addMethod(
  60778. smalltalk.method({
  60779. selector: "collectionWithNewValue",
  60780. protocol: 'fixture',
  60781. fn: function (){
  60782. var self=this;
  60783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60784. return smalltalk.withContext(function($ctx1) {
  60785. //>>excludeEnd("ctx");
  60786. self._subclassResponsibility();
  60787. return self;
  60788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60789. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)});
  60790. //>>excludeEnd("ctx");
  60791. },
  60792. //>>excludeStart("ide", pragmas.excludeIdeData);
  60793. args: [],
  60794. 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",
  60795. referencedClasses: [],
  60796. //>>excludeEnd("ide");
  60797. messageSends: ["subclassResponsibility"]
  60798. }),
  60799. globals.CollectionTest);
  60800. smalltalk.addMethod(
  60801. smalltalk.method({
  60802. selector: "isCollectionReadOnly",
  60803. protocol: 'testing',
  60804. fn: function (){
  60805. var self=this;
  60806. return false;
  60807. },
  60808. //>>excludeStart("ide", pragmas.excludeIdeData);
  60809. args: [],
  60810. source: "isCollectionReadOnly\x0a\x09^ false",
  60811. referencedClasses: [],
  60812. //>>excludeEnd("ide");
  60813. messageSends: []
  60814. }),
  60815. globals.CollectionTest);
  60816. smalltalk.addMethod(
  60817. smalltalk.method({
  60818. selector: "sampleNewValue",
  60819. protocol: 'fixture',
  60820. fn: function (){
  60821. var self=this;
  60822. return "N";
  60823. },
  60824. //>>excludeStart("ide", pragmas.excludeIdeData);
  60825. args: [],
  60826. 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'",
  60827. referencedClasses: [],
  60828. //>>excludeEnd("ide");
  60829. messageSends: []
  60830. }),
  60831. globals.CollectionTest);
  60832. smalltalk.addMethod(
  60833. smalltalk.method({
  60834. selector: "sampleNewValueAsCollection",
  60835. protocol: 'fixture',
  60836. fn: function (){
  60837. var self=this;
  60838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60839. return smalltalk.withContext(function($ctx1) {
  60840. //>>excludeEnd("ctx");
  60841. var $1;
  60842. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  60843. return $1;
  60844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60845. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)});
  60846. //>>excludeEnd("ctx");
  60847. },
  60848. //>>excludeStart("ide", pragmas.excludeIdeData);
  60849. args: [],
  60850. 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",
  60851. referencedClasses: [],
  60852. //>>excludeEnd("ide");
  60853. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  60854. }),
  60855. globals.CollectionTest);
  60856. smalltalk.addMethod(
  60857. smalltalk.method({
  60858. selector: "testAddAll",
  60859. protocol: 'tests',
  60860. fn: function (){
  60861. var self=this;
  60862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60863. return smalltalk.withContext(function($ctx1) {
  60864. //>>excludeEnd("ctx");
  60865. 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;
  60866. $2=self._collection();
  60867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60868. $ctx1.sendIdx["collection"]=1;
  60869. //>>excludeEnd("ctx");
  60870. $3=$2;
  60871. $5=self._collectionClass();
  60872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60873. $ctx1.sendIdx["collectionClass"]=1;
  60874. //>>excludeEnd("ctx");
  60875. $4=_st($5)._new();
  60876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60877. $ctx1.sendIdx["new"]=1;
  60878. //>>excludeEnd("ctx");
  60879. _st($3)._addAll_($4);
  60880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60881. $ctx1.sendIdx["addAll:"]=1;
  60882. //>>excludeEnd("ctx");
  60883. $6=_st($2)._yourself();
  60884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60885. $ctx1.sendIdx["yourself"]=1;
  60886. //>>excludeEnd("ctx");
  60887. $1=$6;
  60888. $7=self._collection();
  60889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60890. $ctx1.sendIdx["collection"]=2;
  60891. //>>excludeEnd("ctx");
  60892. self._assert_equals_($1,$7);
  60893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60894. $ctx1.sendIdx["assert:equals:"]=1;
  60895. //>>excludeEnd("ctx");
  60896. $10=self._collectionClass();
  60897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60898. $ctx1.sendIdx["collectionClass"]=2;
  60899. //>>excludeEnd("ctx");
  60900. $9=_st($10)._new();
  60901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60902. $ctx1.sendIdx["new"]=2;
  60903. //>>excludeEnd("ctx");
  60904. $11=$9;
  60905. $12=self._collection();
  60906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60907. $ctx1.sendIdx["collection"]=3;
  60908. //>>excludeEnd("ctx");
  60909. _st($11)._addAll_($12);
  60910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60911. $ctx1.sendIdx["addAll:"]=2;
  60912. //>>excludeEnd("ctx");
  60913. $13=_st($9)._yourself();
  60914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60915. $ctx1.sendIdx["yourself"]=2;
  60916. //>>excludeEnd("ctx");
  60917. $8=$13;
  60918. $14=self._collection();
  60919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60920. $ctx1.sendIdx["collection"]=4;
  60921. //>>excludeEnd("ctx");
  60922. self._assert_equals_($8,$14);
  60923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60924. $ctx1.sendIdx["assert:equals:"]=2;
  60925. //>>excludeEnd("ctx");
  60926. $17=self._collectionClass();
  60927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60928. $ctx1.sendIdx["collectionClass"]=3;
  60929. //>>excludeEnd("ctx");
  60930. $16=_st($17)._new();
  60931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60932. $ctx1.sendIdx["new"]=3;
  60933. //>>excludeEnd("ctx");
  60934. $18=$16;
  60935. $20=self._collectionClass();
  60936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60937. $ctx1.sendIdx["collectionClass"]=4;
  60938. //>>excludeEnd("ctx");
  60939. $19=_st($20)._new();
  60940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60941. $ctx1.sendIdx["new"]=4;
  60942. //>>excludeEnd("ctx");
  60943. _st($18)._addAll_($19);
  60944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60945. $ctx1.sendIdx["addAll:"]=3;
  60946. //>>excludeEnd("ctx");
  60947. $21=_st($16)._yourself();
  60948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60949. $ctx1.sendIdx["yourself"]=3;
  60950. //>>excludeEnd("ctx");
  60951. $15=$21;
  60952. self._assert_equals_($15,_st(self._collectionClass())._new());
  60953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60954. $ctx1.sendIdx["assert:equals:"]=3;
  60955. //>>excludeEnd("ctx");
  60956. $23=self._collection();
  60957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60958. $ctx1.sendIdx["collection"]=5;
  60959. //>>excludeEnd("ctx");
  60960. $24=$23;
  60961. $25=self._sampleNewValueAsCollection();
  60962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60963. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  60964. //>>excludeEnd("ctx");
  60965. _st($24)._addAll_($25);
  60966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60967. $ctx1.sendIdx["addAll:"]=4;
  60968. //>>excludeEnd("ctx");
  60969. $26=_st($23)._yourself();
  60970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60971. $ctx1.sendIdx["yourself"]=4;
  60972. //>>excludeEnd("ctx");
  60973. $22=$26;
  60974. $27=self._collectionWithNewValue();
  60975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60976. $ctx1.sendIdx["collectionWithNewValue"]=1;
  60977. //>>excludeEnd("ctx");
  60978. self._assert_equals_($22,$27);
  60979. $28=self._sampleNewValueAsCollection();
  60980. _st($28)._addAll_(self._collection());
  60981. $29=_st($28)._yourself();
  60982. self._assertSameContents_as_($29,self._collectionWithNewValue());
  60983. return self;
  60984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60985. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)});
  60986. //>>excludeEnd("ctx");
  60987. },
  60988. //>>excludeStart("ide", pragmas.excludeIdeData);
  60989. args: [],
  60990. 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",
  60991. referencedClasses: [],
  60992. //>>excludeEnd("ide");
  60993. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  60994. }),
  60995. globals.CollectionTest);
  60996. smalltalk.addMethod(
  60997. smalltalk.method({
  60998. selector: "testAllSatisfy",
  60999. protocol: 'tests',
  61000. fn: function (){
  61001. var self=this;
  61002. var collection,anyOne;
  61003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61004. return smalltalk.withContext(function($ctx1) {
  61005. //>>excludeEnd("ctx");
  61006. var $1;
  61007. collection=self._collection();
  61008. anyOne=_st(collection)._anyOne();
  61009. $1=_st(collection)._allSatisfy_((function(each){
  61010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61011. return smalltalk.withContext(function($ctx2) {
  61012. //>>excludeEnd("ctx");
  61013. return _st(collection)._includes_(each);
  61014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61016. //>>excludeEnd("ctx");
  61017. }));
  61018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61019. $ctx1.sendIdx["allSatisfy:"]=1;
  61020. //>>excludeEnd("ctx");
  61021. self._assert_($1);
  61022. self._deny_(_st(collection)._allSatisfy_((function(each){
  61023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61024. return smalltalk.withContext(function($ctx2) {
  61025. //>>excludeEnd("ctx");
  61026. return _st(each).__tild_eq(anyOne);
  61027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61029. //>>excludeEnd("ctx");
  61030. })));
  61031. return self;
  61032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61033. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)});
  61034. //>>excludeEnd("ctx");
  61035. },
  61036. //>>excludeStart("ide", pragmas.excludeIdeData);
  61037. args: [],
  61038. 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 ])",
  61039. referencedClasses: [],
  61040. //>>excludeEnd("ide");
  61041. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  61042. }),
  61043. globals.CollectionTest);
  61044. smalltalk.addMethod(
  61045. smalltalk.method({
  61046. selector: "testAnyOne",
  61047. protocol: 'tests',
  61048. fn: function (){
  61049. var self=this;
  61050. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  61051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61052. return smalltalk.withContext(function($ctx1) {
  61053. //>>excludeEnd("ctx");
  61054. var $2,$1;
  61055. self._should_raise_((function(){
  61056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61057. return smalltalk.withContext(function($ctx2) {
  61058. //>>excludeEnd("ctx");
  61059. return _st(_st(self._collectionClass())._new())._anyOne();
  61060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61061. $ctx2.sendIdx["anyOne"]=1;
  61062. //>>excludeEnd("ctx");
  61063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61065. //>>excludeEnd("ctx");
  61066. }),$Error());
  61067. $2=self._collection();
  61068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61069. $ctx1.sendIdx["collection"]=1;
  61070. //>>excludeEnd("ctx");
  61071. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  61072. self._assert_($1);
  61073. return self;
  61074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61075. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)});
  61076. //>>excludeEnd("ctx");
  61077. },
  61078. //>>excludeStart("ide", pragmas.excludeIdeData);
  61079. args: [],
  61080. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  61081. referencedClasses: ["Error"],
  61082. //>>excludeEnd("ide");
  61083. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  61084. }),
  61085. globals.CollectionTest);
  61086. smalltalk.addMethod(
  61087. smalltalk.method({
  61088. selector: "testAnySatisfy",
  61089. protocol: 'tests',
  61090. fn: function (){
  61091. var self=this;
  61092. var anyOne;
  61093. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  61094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61095. return smalltalk.withContext(function($ctx1) {
  61096. //>>excludeEnd("ctx");
  61097. var $1,$3,$2;
  61098. $1=self._collection();
  61099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61100. $ctx1.sendIdx["collection"]=1;
  61101. //>>excludeEnd("ctx");
  61102. anyOne=_st($1)._anyOne();
  61103. $3=self._collection();
  61104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61105. $ctx1.sendIdx["collection"]=2;
  61106. //>>excludeEnd("ctx");
  61107. $2=_st($3)._anySatisfy_((function(each){
  61108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61109. return smalltalk.withContext(function($ctx2) {
  61110. //>>excludeEnd("ctx");
  61111. return _st(each).__eq(anyOne);
  61112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61113. $ctx2.sendIdx["="]=1;
  61114. //>>excludeEnd("ctx");
  61115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61117. //>>excludeEnd("ctx");
  61118. }));
  61119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61120. $ctx1.sendIdx["anySatisfy:"]=1;
  61121. //>>excludeEnd("ctx");
  61122. self._assert_($2);
  61123. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  61124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61125. return smalltalk.withContext(function($ctx2) {
  61126. //>>excludeEnd("ctx");
  61127. return _st(each).__eq(_st($Object())._new());
  61128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61130. //>>excludeEnd("ctx");
  61131. })));
  61132. return self;
  61133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61134. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)});
  61135. //>>excludeEnd("ctx");
  61136. },
  61137. //>>excludeStart("ide", pragmas.excludeIdeData);
  61138. args: [],
  61139. 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 ])",
  61140. referencedClasses: ["Object"],
  61141. //>>excludeEnd("ide");
  61142. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  61143. }),
  61144. globals.CollectionTest);
  61145. smalltalk.addMethod(
  61146. smalltalk.method({
  61147. selector: "testAsArray",
  61148. protocol: 'tests',
  61149. fn: function (){
  61150. var self=this;
  61151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61152. return smalltalk.withContext(function($ctx1) {
  61153. //>>excludeEnd("ctx");
  61154. var $1;
  61155. $1=self._collection();
  61156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61157. $ctx1.sendIdx["collection"]=1;
  61158. //>>excludeEnd("ctx");
  61159. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  61160. return self;
  61161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61162. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)});
  61163. //>>excludeEnd("ctx");
  61164. },
  61165. //>>excludeStart("ide", pragmas.excludeIdeData);
  61166. args: [],
  61167. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  61168. referencedClasses: [],
  61169. //>>excludeEnd("ide");
  61170. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  61171. }),
  61172. globals.CollectionTest);
  61173. smalltalk.addMethod(
  61174. smalltalk.method({
  61175. selector: "testAsOrderedCollection",
  61176. protocol: 'tests',
  61177. fn: function (){
  61178. var self=this;
  61179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61180. return smalltalk.withContext(function($ctx1) {
  61181. //>>excludeEnd("ctx");
  61182. var $1;
  61183. $1=self._collection();
  61184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61185. $ctx1.sendIdx["collection"]=1;
  61186. //>>excludeEnd("ctx");
  61187. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  61188. return self;
  61189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61190. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)});
  61191. //>>excludeEnd("ctx");
  61192. },
  61193. //>>excludeStart("ide", pragmas.excludeIdeData);
  61194. args: [],
  61195. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  61196. referencedClasses: [],
  61197. //>>excludeEnd("ide");
  61198. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  61199. }),
  61200. globals.CollectionTest);
  61201. smalltalk.addMethod(
  61202. smalltalk.method({
  61203. selector: "testAsSet",
  61204. protocol: 'tests',
  61205. fn: function (){
  61206. var self=this;
  61207. var c,set;
  61208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61209. return smalltalk.withContext(function($ctx1) {
  61210. //>>excludeEnd("ctx");
  61211. c=self._collectionWithDuplicates();
  61212. set=_st(c)._asSet();
  61213. self._assert_equals_(_st(set)._size(),(5));
  61214. _st(c)._do_((function(each){
  61215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61216. return smalltalk.withContext(function($ctx2) {
  61217. //>>excludeEnd("ctx");
  61218. return self._assert_(_st(set)._includes_(each));
  61219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61221. //>>excludeEnd("ctx");
  61222. }));
  61223. return self;
  61224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61225. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)});
  61226. //>>excludeEnd("ctx");
  61227. },
  61228. //>>excludeStart("ide", pragmas.excludeIdeData);
  61229. args: [],
  61230. 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) ]",
  61231. referencedClasses: [],
  61232. //>>excludeEnd("ide");
  61233. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  61234. }),
  61235. globals.CollectionTest);
  61236. smalltalk.addMethod(
  61237. smalltalk.method({
  61238. selector: "testCollect",
  61239. protocol: 'tests',
  61240. fn: function (){
  61241. var self=this;
  61242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61243. return smalltalk.withContext(function($ctx1) {
  61244. //>>excludeEnd("ctx");
  61245. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  61246. $2=self._collection();
  61247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61248. $ctx1.sendIdx["collection"]=1;
  61249. //>>excludeEnd("ctx");
  61250. $1=_st($2)._collect_((function(each){
  61251. return each;
  61252. }));
  61253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61254. $ctx1.sendIdx["collect:"]=1;
  61255. //>>excludeEnd("ctx");
  61256. $3=self._collection();
  61257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61258. $ctx1.sendIdx["collection"]=2;
  61259. //>>excludeEnd("ctx");
  61260. self._assert_equals_($1,$3);
  61261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61262. $ctx1.sendIdx["assert:equals:"]=1;
  61263. //>>excludeEnd("ctx");
  61264. $5=self._collectionWithNewValue();
  61265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61266. $ctx1.sendIdx["collectionWithNewValue"]=1;
  61267. //>>excludeEnd("ctx");
  61268. $4=_st($5)._collect_((function(each){
  61269. return each;
  61270. }));
  61271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61272. $ctx1.sendIdx["collect:"]=2;
  61273. //>>excludeEnd("ctx");
  61274. self._assert_equals_($4,self._collectionWithNewValue());
  61275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61276. $ctx1.sendIdx["assert:equals:"]=2;
  61277. //>>excludeEnd("ctx");
  61278. $8=self._collectionClass();
  61279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61280. $ctx1.sendIdx["collectionClass"]=1;
  61281. //>>excludeEnd("ctx");
  61282. $7=_st($8)._new();
  61283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61284. $ctx1.sendIdx["new"]=1;
  61285. //>>excludeEnd("ctx");
  61286. $6=_st($7)._collect_((function(each){
  61287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61288. return smalltalk.withContext(function($ctx2) {
  61289. //>>excludeEnd("ctx");
  61290. return _st(each)._printString();
  61291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61292. $ctx2.sendIdx["printString"]=1;
  61293. //>>excludeEnd("ctx");
  61294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61296. //>>excludeEnd("ctx");
  61297. }));
  61298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61299. $ctx1.sendIdx["collect:"]=3;
  61300. //>>excludeEnd("ctx");
  61301. self._assert_equals_($6,_st(self._collectionClass())._new());
  61302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61303. $ctx1.sendIdx["assert:equals:"]=3;
  61304. //>>excludeEnd("ctx");
  61305. $11=self._collection();
  61306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61307. $ctx1.sendIdx["collection"]=3;
  61308. //>>excludeEnd("ctx");
  61309. $10=_st($11)._collect_((function(){
  61310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61311. return smalltalk.withContext(function($ctx2) {
  61312. //>>excludeEnd("ctx");
  61313. return self._sampleNewValue();
  61314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61315. $ctx2.sendIdx["sampleNewValue"]=1;
  61316. //>>excludeEnd("ctx");
  61317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  61319. //>>excludeEnd("ctx");
  61320. }));
  61321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61322. $ctx1.sendIdx["collect:"]=4;
  61323. //>>excludeEnd("ctx");
  61324. $9=_st($10)._detect_((function(){
  61325. return true;
  61326. }));
  61327. self._assert_equals_($9,self._sampleNewValue());
  61328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61329. $ctx1.sendIdx["assert:equals:"]=4;
  61330. //>>excludeEnd("ctx");
  61331. self._assert_equals_(_st(self._collection())._collect_((function(each){
  61332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61333. return smalltalk.withContext(function($ctx2) {
  61334. //>>excludeEnd("ctx");
  61335. return _st(each)._printString();
  61336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  61338. //>>excludeEnd("ctx");
  61339. })),self._collectionOfPrintStrings());
  61340. return self;
  61341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61342. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)});
  61343. //>>excludeEnd("ctx");
  61344. },
  61345. //>>excludeStart("ide", pragmas.excludeIdeData);
  61346. args: [],
  61347. 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",
  61348. referencedClasses: [],
  61349. //>>excludeEnd("ide");
  61350. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  61351. }),
  61352. globals.CollectionTest);
  61353. smalltalk.addMethod(
  61354. smalltalk.method({
  61355. selector: "testComma",
  61356. protocol: 'tests',
  61357. fn: function (){
  61358. var self=this;
  61359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61360. return smalltalk.withContext(function($ctx1) {
  61361. //>>excludeEnd("ctx");
  61362. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  61363. $2=self._collection();
  61364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61365. $ctx1.sendIdx["collection"]=1;
  61366. //>>excludeEnd("ctx");
  61367. $4=self._collectionClass();
  61368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61369. $ctx1.sendIdx["collectionClass"]=1;
  61370. //>>excludeEnd("ctx");
  61371. $3=_st($4)._new();
  61372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61373. $ctx1.sendIdx["new"]=1;
  61374. //>>excludeEnd("ctx");
  61375. $1=_st($2).__comma($3);
  61376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61377. $ctx1.sendIdx[","]=1;
  61378. //>>excludeEnd("ctx");
  61379. $5=self._collection();
  61380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61381. $ctx1.sendIdx["collection"]=2;
  61382. //>>excludeEnd("ctx");
  61383. self._assert_equals_($1,$5);
  61384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61385. $ctx1.sendIdx["assert:equals:"]=1;
  61386. //>>excludeEnd("ctx");
  61387. $8=self._collectionClass();
  61388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61389. $ctx1.sendIdx["collectionClass"]=2;
  61390. //>>excludeEnd("ctx");
  61391. $7=_st($8)._new();
  61392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61393. $ctx1.sendIdx["new"]=2;
  61394. //>>excludeEnd("ctx");
  61395. $9=self._collection();
  61396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61397. $ctx1.sendIdx["collection"]=3;
  61398. //>>excludeEnd("ctx");
  61399. $6=_st($7).__comma($9);
  61400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61401. $ctx1.sendIdx[","]=2;
  61402. //>>excludeEnd("ctx");
  61403. $10=self._collection();
  61404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61405. $ctx1.sendIdx["collection"]=4;
  61406. //>>excludeEnd("ctx");
  61407. self._assert_equals_($6,$10);
  61408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61409. $ctx1.sendIdx["assert:equals:"]=2;
  61410. //>>excludeEnd("ctx");
  61411. $13=self._collectionClass();
  61412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61413. $ctx1.sendIdx["collectionClass"]=3;
  61414. //>>excludeEnd("ctx");
  61415. $12=_st($13)._new();
  61416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61417. $ctx1.sendIdx["new"]=3;
  61418. //>>excludeEnd("ctx");
  61419. $15=self._collectionClass();
  61420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61421. $ctx1.sendIdx["collectionClass"]=4;
  61422. //>>excludeEnd("ctx");
  61423. $14=_st($15)._new();
  61424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61425. $ctx1.sendIdx["new"]=4;
  61426. //>>excludeEnd("ctx");
  61427. $11=_st($12).__comma($14);
  61428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61429. $ctx1.sendIdx[","]=3;
  61430. //>>excludeEnd("ctx");
  61431. self._assert_equals_($11,_st(self._collectionClass())._new());
  61432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61433. $ctx1.sendIdx["assert:equals:"]=3;
  61434. //>>excludeEnd("ctx");
  61435. $17=self._collection();
  61436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61437. $ctx1.sendIdx["collection"]=5;
  61438. //>>excludeEnd("ctx");
  61439. $18=self._sampleNewValueAsCollection();
  61440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61441. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  61442. //>>excludeEnd("ctx");
  61443. $16=_st($17).__comma($18);
  61444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61445. $ctx1.sendIdx[","]=4;
  61446. //>>excludeEnd("ctx");
  61447. $19=self._collectionWithNewValue();
  61448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61449. $ctx1.sendIdx["collectionWithNewValue"]=1;
  61450. //>>excludeEnd("ctx");
  61451. self._assert_equals_($16,$19);
  61452. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  61453. return self;
  61454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61455. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)});
  61456. //>>excludeEnd("ctx");
  61457. },
  61458. //>>excludeStart("ide", pragmas.excludeIdeData);
  61459. args: [],
  61460. 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",
  61461. referencedClasses: [],
  61462. //>>excludeEnd("ide");
  61463. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  61464. }),
  61465. globals.CollectionTest);
  61466. smalltalk.addMethod(
  61467. smalltalk.method({
  61468. selector: "testDetect",
  61469. protocol: 'tests',
  61470. fn: function (){
  61471. var self=this;
  61472. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  61473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61474. return smalltalk.withContext(function($ctx1) {
  61475. //>>excludeEnd("ctx");
  61476. var $1,$2,$3,$4,$6,$5,$7;
  61477. self._shouldnt_raise_((function(){
  61478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61479. return smalltalk.withContext(function($ctx2) {
  61480. //>>excludeEnd("ctx");
  61481. $1=self._collection();
  61482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61483. $ctx2.sendIdx["collection"]=1;
  61484. //>>excludeEnd("ctx");
  61485. return _st($1)._detect_((function(){
  61486. return true;
  61487. }));
  61488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61489. $ctx2.sendIdx["detect:"]=1;
  61490. //>>excludeEnd("ctx");
  61491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61493. //>>excludeEnd("ctx");
  61494. }),$Error());
  61495. self._should_raise_((function(){
  61496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61497. return smalltalk.withContext(function($ctx2) {
  61498. //>>excludeEnd("ctx");
  61499. $2=self._collection();
  61500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61501. $ctx2.sendIdx["collection"]=2;
  61502. //>>excludeEnd("ctx");
  61503. return _st($2)._detect_((function(){
  61504. return false;
  61505. }));
  61506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61507. $ctx2.sendIdx["detect:"]=2;
  61508. //>>excludeEnd("ctx");
  61509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61511. //>>excludeEnd("ctx");
  61512. }),$Error());
  61513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61514. $ctx1.sendIdx["should:raise:"]=1;
  61515. //>>excludeEnd("ctx");
  61516. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  61517. return true;
  61518. }));
  61519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61520. $ctx1.sendIdx["detect:"]=3;
  61521. //>>excludeEnd("ctx");
  61522. $4=self._sampleNewValue();
  61523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61524. $ctx1.sendIdx["sampleNewValue"]=1;
  61525. //>>excludeEnd("ctx");
  61526. self._assert_equals_($3,$4);
  61527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61528. $ctx1.sendIdx["assert:equals:"]=1;
  61529. //>>excludeEnd("ctx");
  61530. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  61531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61532. return smalltalk.withContext(function($ctx2) {
  61533. //>>excludeEnd("ctx");
  61534. $6=self._sampleNewValue();
  61535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61536. $ctx2.sendIdx["sampleNewValue"]=2;
  61537. //>>excludeEnd("ctx");
  61538. return _st(each).__eq($6);
  61539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61540. $ctx2.sendIdx["="]=1;
  61541. //>>excludeEnd("ctx");
  61542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61543. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  61544. //>>excludeEnd("ctx");
  61545. }));
  61546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61547. $ctx1.sendIdx["detect:"]=4;
  61548. //>>excludeEnd("ctx");
  61549. $7=self._sampleNewValue();
  61550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61551. $ctx1.sendIdx["sampleNewValue"]=3;
  61552. //>>excludeEnd("ctx");
  61553. self._assert_equals_($5,$7);
  61554. self._should_raise_((function(){
  61555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61556. return smalltalk.withContext(function($ctx2) {
  61557. //>>excludeEnd("ctx");
  61558. return _st(self._collection())._detect_((function(each){
  61559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61560. return smalltalk.withContext(function($ctx3) {
  61561. //>>excludeEnd("ctx");
  61562. return _st(each).__eq(self._sampleNewValue());
  61563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61564. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  61565. //>>excludeEnd("ctx");
  61566. }));
  61567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  61569. //>>excludeEnd("ctx");
  61570. }),$Error());
  61571. return self;
  61572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61573. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)});
  61574. //>>excludeEnd("ctx");
  61575. },
  61576. //>>excludeStart("ide", pragmas.excludeIdeData);
  61577. args: [],
  61578. 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",
  61579. referencedClasses: ["Error"],
  61580. //>>excludeEnd("ide");
  61581. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  61582. }),
  61583. globals.CollectionTest);
  61584. smalltalk.addMethod(
  61585. smalltalk.method({
  61586. selector: "testDetectIfNone",
  61587. protocol: 'tests',
  61588. fn: function (){
  61589. var self=this;
  61590. var sentinel;
  61591. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  61592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61593. return smalltalk.withContext(function($ctx1) {
  61594. //>>excludeEnd("ctx");
  61595. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  61596. sentinel=_st($Object())._new();
  61597. $3=self._collection();
  61598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61599. $ctx1.sendIdx["collection"]=1;
  61600. //>>excludeEnd("ctx");
  61601. $2=_st($3)._detect_ifNone_((function(){
  61602. return true;
  61603. }),(function(){
  61604. return sentinel;
  61605. }));
  61606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61607. $ctx1.sendIdx["detect:ifNone:"]=1;
  61608. //>>excludeEnd("ctx");
  61609. $1=_st($2).__tild_eq(sentinel);
  61610. self._assert_($1);
  61611. $5=self._collection();
  61612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61613. $ctx1.sendIdx["collection"]=2;
  61614. //>>excludeEnd("ctx");
  61615. $4=_st($5)._detect_ifNone_((function(){
  61616. return false;
  61617. }),(function(){
  61618. return sentinel;
  61619. }));
  61620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61621. $ctx1.sendIdx["detect:ifNone:"]=2;
  61622. //>>excludeEnd("ctx");
  61623. self._assert_equals_($4,sentinel);
  61624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61625. $ctx1.sendIdx["assert:equals:"]=1;
  61626. //>>excludeEnd("ctx");
  61627. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  61628. return true;
  61629. }),(function(){
  61630. return sentinel;
  61631. }));
  61632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61633. $ctx1.sendIdx["detect:ifNone:"]=3;
  61634. //>>excludeEnd("ctx");
  61635. $7=self._sampleNewValue();
  61636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61637. $ctx1.sendIdx["sampleNewValue"]=1;
  61638. //>>excludeEnd("ctx");
  61639. self._assert_equals_($6,$7);
  61640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61641. $ctx1.sendIdx["assert:equals:"]=2;
  61642. //>>excludeEnd("ctx");
  61643. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  61644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61645. return smalltalk.withContext(function($ctx2) {
  61646. //>>excludeEnd("ctx");
  61647. $9=self._sampleNewValue();
  61648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61649. $ctx2.sendIdx["sampleNewValue"]=2;
  61650. //>>excludeEnd("ctx");
  61651. return _st(each).__eq($9);
  61652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61653. $ctx2.sendIdx["="]=1;
  61654. //>>excludeEnd("ctx");
  61655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  61657. //>>excludeEnd("ctx");
  61658. }),(function(){
  61659. return sentinel;
  61660. }));
  61661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61662. $ctx1.sendIdx["detect:ifNone:"]=4;
  61663. //>>excludeEnd("ctx");
  61664. $10=self._sampleNewValue();
  61665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61666. $ctx1.sendIdx["sampleNewValue"]=3;
  61667. //>>excludeEnd("ctx");
  61668. self._assert_equals_($8,$10);
  61669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61670. $ctx1.sendIdx["assert:equals:"]=3;
  61671. //>>excludeEnd("ctx");
  61672. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  61673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61674. return smalltalk.withContext(function($ctx2) {
  61675. //>>excludeEnd("ctx");
  61676. return _st(each).__eq(self._sampleNewValue());
  61677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  61679. //>>excludeEnd("ctx");
  61680. }),(function(){
  61681. return sentinel;
  61682. })),sentinel);
  61683. return self;
  61684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61685. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)});
  61686. //>>excludeEnd("ctx");
  61687. },
  61688. //>>excludeStart("ide", pragmas.excludeIdeData);
  61689. args: [],
  61690. 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",
  61691. referencedClasses: ["Object"],
  61692. //>>excludeEnd("ide");
  61693. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  61694. }),
  61695. globals.CollectionTest);
  61696. smalltalk.addMethod(
  61697. smalltalk.method({
  61698. selector: "testDo",
  61699. protocol: 'tests',
  61700. fn: function (){
  61701. var self=this;
  61702. var newCollection;
  61703. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  61704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61705. return smalltalk.withContext(function($ctx1) {
  61706. //>>excludeEnd("ctx");
  61707. var $1,$2;
  61708. newCollection=_st($OrderedCollection())._new();
  61709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61710. $ctx1.sendIdx["new"]=1;
  61711. //>>excludeEnd("ctx");
  61712. $1=self._collection();
  61713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61714. $ctx1.sendIdx["collection"]=1;
  61715. //>>excludeEnd("ctx");
  61716. _st($1)._do_((function(each){
  61717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61718. return smalltalk.withContext(function($ctx2) {
  61719. //>>excludeEnd("ctx");
  61720. return _st(newCollection)._add_(each);
  61721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61722. $ctx2.sendIdx["add:"]=1;
  61723. //>>excludeEnd("ctx");
  61724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61726. //>>excludeEnd("ctx");
  61727. }));
  61728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61729. $ctx1.sendIdx["do:"]=1;
  61730. //>>excludeEnd("ctx");
  61731. self._assertSameContents_as_(self._collection(),newCollection);
  61732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61733. $ctx1.sendIdx["assertSameContents:as:"]=1;
  61734. //>>excludeEnd("ctx");
  61735. newCollection=_st($OrderedCollection())._new();
  61736. $2=self._collectionWithDuplicates();
  61737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61738. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  61739. //>>excludeEnd("ctx");
  61740. _st($2)._do_((function(each){
  61741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61742. return smalltalk.withContext(function($ctx2) {
  61743. //>>excludeEnd("ctx");
  61744. return _st(newCollection)._add_(each);
  61745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61747. //>>excludeEnd("ctx");
  61748. }));
  61749. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  61750. return self;
  61751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61752. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)});
  61753. //>>excludeEnd("ctx");
  61754. },
  61755. //>>excludeStart("ide", pragmas.excludeIdeData);
  61756. args: [],
  61757. 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",
  61758. referencedClasses: ["OrderedCollection"],
  61759. //>>excludeEnd("ide");
  61760. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  61761. }),
  61762. globals.CollectionTest);
  61763. smalltalk.addMethod(
  61764. smalltalk.method({
  61765. selector: "testIfEmptyFamily",
  61766. protocol: 'tests',
  61767. fn: function (){
  61768. var self=this;
  61769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61770. return smalltalk.withContext(function($ctx1) {
  61771. //>>excludeEnd("ctx");
  61772. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$15,$14,$16,$19,$18,$17,$21,$20,$23,$22,$24,$25,$27,$26,$29,$28;
  61773. $3=self._collectionClass();
  61774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61775. $ctx1.sendIdx["collectionClass"]=1;
  61776. //>>excludeEnd("ctx");
  61777. $2=_st($3)._new();
  61778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61779. $ctx1.sendIdx["new"]=1;
  61780. //>>excludeEnd("ctx");
  61781. $1=_st($2)._ifEmpty_((function(){
  61782. return (42);
  61783. }));
  61784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61785. $ctx1.sendIdx["ifEmpty:"]=1;
  61786. //>>excludeEnd("ctx");
  61787. self._assert_equals_($1,(42));
  61788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61789. $ctx1.sendIdx["assert:equals:"]=1;
  61790. //>>excludeEnd("ctx");
  61791. $5=self._collection();
  61792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61793. $ctx1.sendIdx["collection"]=1;
  61794. //>>excludeEnd("ctx");
  61795. $4=_st($5)._ifEmpty_((function(){
  61796. return (42);
  61797. }));
  61798. $6=self._collection();
  61799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61800. $ctx1.sendIdx["collection"]=2;
  61801. //>>excludeEnd("ctx");
  61802. self._assert_equals_($4,$6);
  61803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61804. $ctx1.sendIdx["assert:equals:"]=2;
  61805. //>>excludeEnd("ctx");
  61806. $9=self._collectionClass();
  61807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61808. $ctx1.sendIdx["collectionClass"]=2;
  61809. //>>excludeEnd("ctx");
  61810. $8=_st($9)._new();
  61811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61812. $ctx1.sendIdx["new"]=2;
  61813. //>>excludeEnd("ctx");
  61814. $7=_st($8)._ifNotEmpty_((function(){
  61815. return (42);
  61816. }));
  61817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61818. $ctx1.sendIdx["ifNotEmpty:"]=1;
  61819. //>>excludeEnd("ctx");
  61820. $11=self._collectionClass();
  61821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61822. $ctx1.sendIdx["collectionClass"]=3;
  61823. //>>excludeEnd("ctx");
  61824. $10=_st($11)._new();
  61825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61826. $ctx1.sendIdx["new"]=3;
  61827. //>>excludeEnd("ctx");
  61828. self._assert_equals_($7,$10);
  61829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61830. $ctx1.sendIdx["assert:equals:"]=3;
  61831. //>>excludeEnd("ctx");
  61832. $13=self._collection();
  61833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61834. $ctx1.sendIdx["collection"]=3;
  61835. //>>excludeEnd("ctx");
  61836. $12=_st($13)._ifNotEmpty_((function(){
  61837. return (42);
  61838. }));
  61839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61840. $ctx1.sendIdx["ifNotEmpty:"]=2;
  61841. //>>excludeEnd("ctx");
  61842. self._assert_equals_($12,(42));
  61843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61844. $ctx1.sendIdx["assert:equals:"]=4;
  61845. //>>excludeEnd("ctx");
  61846. $15=self._collection();
  61847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61848. $ctx1.sendIdx["collection"]=4;
  61849. //>>excludeEnd("ctx");
  61850. $14=_st($15)._ifNotEmpty_((function(col){
  61851. return col;
  61852. }));
  61853. $16=self._collection();
  61854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61855. $ctx1.sendIdx["collection"]=5;
  61856. //>>excludeEnd("ctx");
  61857. self._assert_equals_($14,$16);
  61858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61859. $ctx1.sendIdx["assert:equals:"]=5;
  61860. //>>excludeEnd("ctx");
  61861. $19=self._collectionClass();
  61862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61863. $ctx1.sendIdx["collectionClass"]=4;
  61864. //>>excludeEnd("ctx");
  61865. $18=_st($19)._new();
  61866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61867. $ctx1.sendIdx["new"]=4;
  61868. //>>excludeEnd("ctx");
  61869. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  61870. return (42);
  61871. }),(function(){
  61872. return (999);
  61873. }));
  61874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61875. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  61876. //>>excludeEnd("ctx");
  61877. self._assert_equals_($17,(42));
  61878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61879. $ctx1.sendIdx["assert:equals:"]=6;
  61880. //>>excludeEnd("ctx");
  61881. $21=self._collection();
  61882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61883. $ctx1.sendIdx["collection"]=6;
  61884. //>>excludeEnd("ctx");
  61885. $20=_st($21)._ifEmpty_ifNotEmpty_((function(){
  61886. return (42);
  61887. }),(function(){
  61888. return (999);
  61889. }));
  61890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61891. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  61892. //>>excludeEnd("ctx");
  61893. self._assert_equals_($20,(999));
  61894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61895. $ctx1.sendIdx["assert:equals:"]=7;
  61896. //>>excludeEnd("ctx");
  61897. $23=self._collection();
  61898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61899. $ctx1.sendIdx["collection"]=7;
  61900. //>>excludeEnd("ctx");
  61901. $22=_st($23)._ifEmpty_ifNotEmpty_((function(){
  61902. return (42);
  61903. }),(function(col){
  61904. return col;
  61905. }));
  61906. $24=self._collection();
  61907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61908. $ctx1.sendIdx["collection"]=8;
  61909. //>>excludeEnd("ctx");
  61910. self._assert_equals_($22,$24);
  61911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61912. $ctx1.sendIdx["assert:equals:"]=8;
  61913. //>>excludeEnd("ctx");
  61914. $25=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  61915. return (42);
  61916. }),(function(){
  61917. return (999);
  61918. }));
  61919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61920. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  61921. //>>excludeEnd("ctx");
  61922. self._assert_equals_($25,(999));
  61923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61924. $ctx1.sendIdx["assert:equals:"]=9;
  61925. //>>excludeEnd("ctx");
  61926. $27=self._collection();
  61927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61928. $ctx1.sendIdx["collection"]=9;
  61929. //>>excludeEnd("ctx");
  61930. $26=_st($27)._ifNotEmpty_ifEmpty_((function(){
  61931. return (42);
  61932. }),(function(){
  61933. return (999);
  61934. }));
  61935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61936. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  61937. //>>excludeEnd("ctx");
  61938. self._assert_equals_($26,(42));
  61939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61940. $ctx1.sendIdx["assert:equals:"]=10;
  61941. //>>excludeEnd("ctx");
  61942. $29=self._collection();
  61943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61944. $ctx1.sendIdx["collection"]=10;
  61945. //>>excludeEnd("ctx");
  61946. $28=_st($29)._ifNotEmpty_ifEmpty_((function(col){
  61947. return col;
  61948. }),(function(){
  61949. return (999);
  61950. }));
  61951. self._assert_equals_($28,self._collection());
  61952. return self;
  61953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61954. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)});
  61955. //>>excludeEnd("ctx");
  61956. },
  61957. //>>excludeStart("ide", pragmas.excludeIdeData);
  61958. args: [],
  61959. 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\x09self assert: (self collection ifNotEmpty: [ :col | col ]) equals: self collection.\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\x09self assert: (self collection ifEmpty: [ 42 ] ifNotEmpty: [ :col | col ]) equals: self collection.\x0a\x0a\x09self assert: (self collectionClass new ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 999.\x0a\x09self assert: (self collection ifNotEmpty: [ 42 ] ifEmpty: [ 999 ]) equals: 42.\x0a\x09self assert: (self collection ifNotEmpty: [ :col | col ] ifEmpty: [ 999 ]) equals: self collection.",
  61960. referencedClasses: [],
  61961. //>>excludeEnd("ide");
  61962. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  61963. }),
  61964. globals.CollectionTest);
  61965. smalltalk.addMethod(
  61966. smalltalk.method({
  61967. selector: "testIsEmpty",
  61968. protocol: 'tests',
  61969. fn: function (){
  61970. var self=this;
  61971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61972. return smalltalk.withContext(function($ctx1) {
  61973. //>>excludeEnd("ctx");
  61974. var $1;
  61975. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  61976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61977. $ctx1.sendIdx["isEmpty"]=1;
  61978. //>>excludeEnd("ctx");
  61979. self._assert_($1);
  61980. self._deny_(_st(self._collection())._isEmpty());
  61981. return self;
  61982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61983. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)});
  61984. //>>excludeEnd("ctx");
  61985. },
  61986. //>>excludeStart("ide", pragmas.excludeIdeData);
  61987. args: [],
  61988. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  61989. referencedClasses: [],
  61990. //>>excludeEnd("ide");
  61991. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  61992. }),
  61993. globals.CollectionTest);
  61994. smalltalk.addMethod(
  61995. smalltalk.method({
  61996. selector: "testNoneSatisfy",
  61997. protocol: 'tests',
  61998. fn: function (){
  61999. var self=this;
  62000. var anyOne;
  62001. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62003. return smalltalk.withContext(function($ctx1) {
  62004. //>>excludeEnd("ctx");
  62005. var $1,$3,$2;
  62006. $1=self._collection();
  62007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62008. $ctx1.sendIdx["collection"]=1;
  62009. //>>excludeEnd("ctx");
  62010. anyOne=_st($1)._anyOne();
  62011. $3=self._collection();
  62012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62013. $ctx1.sendIdx["collection"]=2;
  62014. //>>excludeEnd("ctx");
  62015. $2=_st($3)._noneSatisfy_((function(each){
  62016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62017. return smalltalk.withContext(function($ctx2) {
  62018. //>>excludeEnd("ctx");
  62019. return _st(each).__eq(anyOne);
  62020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62021. $ctx2.sendIdx["="]=1;
  62022. //>>excludeEnd("ctx");
  62023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62025. //>>excludeEnd("ctx");
  62026. }));
  62027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62028. $ctx1.sendIdx["noneSatisfy:"]=1;
  62029. //>>excludeEnd("ctx");
  62030. self._deny_($2);
  62031. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  62032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62033. return smalltalk.withContext(function($ctx2) {
  62034. //>>excludeEnd("ctx");
  62035. return _st(each).__eq(_st($Object())._new());
  62036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62037. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62038. //>>excludeEnd("ctx");
  62039. })));
  62040. return self;
  62041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62042. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)});
  62043. //>>excludeEnd("ctx");
  62044. },
  62045. //>>excludeStart("ide", pragmas.excludeIdeData);
  62046. args: [],
  62047. 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 ])",
  62048. referencedClasses: ["Object"],
  62049. //>>excludeEnd("ide");
  62050. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  62051. }),
  62052. globals.CollectionTest);
  62053. smalltalk.addMethod(
  62054. smalltalk.method({
  62055. selector: "testRemoveAll",
  62056. protocol: 'tests',
  62057. fn: function (){
  62058. var self=this;
  62059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62060. return smalltalk.withContext(function($ctx1) {
  62061. //>>excludeEnd("ctx");
  62062. var $1,$2;
  62063. $1=self._collection();
  62064. _st($1)._removeAll();
  62065. $2=_st($1)._yourself();
  62066. self._assert_equals_($2,_st(self._collectionClass())._new());
  62067. return self;
  62068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62069. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)});
  62070. //>>excludeEnd("ctx");
  62071. },
  62072. //>>excludeStart("ide", pragmas.excludeIdeData);
  62073. args: [],
  62074. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  62075. referencedClasses: [],
  62076. //>>excludeEnd("ide");
  62077. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  62078. }),
  62079. globals.CollectionTest);
  62080. smalltalk.addMethod(
  62081. smalltalk.method({
  62082. selector: "testSelect",
  62083. protocol: 'tests',
  62084. fn: function (){
  62085. var self=this;
  62086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62087. return smalltalk.withContext(function($ctx1) {
  62088. //>>excludeEnd("ctx");
  62089. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  62090. $2=self._collection();
  62091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62092. $ctx1.sendIdx["collection"]=1;
  62093. //>>excludeEnd("ctx");
  62094. $1=_st($2)._select_((function(){
  62095. return false;
  62096. }));
  62097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62098. $ctx1.sendIdx["select:"]=1;
  62099. //>>excludeEnd("ctx");
  62100. $4=self._collectionClass();
  62101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62102. $ctx1.sendIdx["collectionClass"]=1;
  62103. //>>excludeEnd("ctx");
  62104. $3=_st($4)._new();
  62105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62106. $ctx1.sendIdx["new"]=1;
  62107. //>>excludeEnd("ctx");
  62108. self._assert_equals_($1,$3);
  62109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62110. $ctx1.sendIdx["assert:equals:"]=1;
  62111. //>>excludeEnd("ctx");
  62112. $6=self._collection();
  62113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62114. $ctx1.sendIdx["collection"]=2;
  62115. //>>excludeEnd("ctx");
  62116. $5=_st($6)._select_((function(){
  62117. return true;
  62118. }));
  62119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62120. $ctx1.sendIdx["select:"]=2;
  62121. //>>excludeEnd("ctx");
  62122. $7=self._collection();
  62123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62124. $ctx1.sendIdx["collection"]=3;
  62125. //>>excludeEnd("ctx");
  62126. self._assert_equals_($5,$7);
  62127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62128. $ctx1.sendIdx["assert:equals:"]=2;
  62129. //>>excludeEnd("ctx");
  62130. $9=self._collectionWithNewValue();
  62131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62132. $ctx1.sendIdx["collectionWithNewValue"]=1;
  62133. //>>excludeEnd("ctx");
  62134. $8=_st($9)._select_((function(each){
  62135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62136. return smalltalk.withContext(function($ctx2) {
  62137. //>>excludeEnd("ctx");
  62138. $10=self._sampleNewValue();
  62139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62140. $ctx2.sendIdx["sampleNewValue"]=1;
  62141. //>>excludeEnd("ctx");
  62142. return _st(each).__eq($10);
  62143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62144. $ctx2.sendIdx["="]=1;
  62145. //>>excludeEnd("ctx");
  62146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62147. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  62148. //>>excludeEnd("ctx");
  62149. }));
  62150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62151. $ctx1.sendIdx["select:"]=3;
  62152. //>>excludeEnd("ctx");
  62153. self._assert_equals_($8,self._sampleNewValueAsCollection());
  62154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62155. $ctx1.sendIdx["assert:equals:"]=3;
  62156. //>>excludeEnd("ctx");
  62157. $12=self._collectionWithNewValue();
  62158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62159. $ctx1.sendIdx["collectionWithNewValue"]=2;
  62160. //>>excludeEnd("ctx");
  62161. $11=_st($12)._select_((function(each){
  62162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62163. return smalltalk.withContext(function($ctx2) {
  62164. //>>excludeEnd("ctx");
  62165. $13=self._sampleNewValue();
  62166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62167. $ctx2.sendIdx["sampleNewValue"]=2;
  62168. //>>excludeEnd("ctx");
  62169. return _st(each).__tild_eq($13);
  62170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62171. $ctx2.sendIdx["~="]=1;
  62172. //>>excludeEnd("ctx");
  62173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62174. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  62175. //>>excludeEnd("ctx");
  62176. }));
  62177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62178. $ctx1.sendIdx["select:"]=4;
  62179. //>>excludeEnd("ctx");
  62180. $14=self._collection();
  62181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62182. $ctx1.sendIdx["collection"]=4;
  62183. //>>excludeEnd("ctx");
  62184. self._assert_equals_($11,$14);
  62185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62186. $ctx1.sendIdx["assert:equals:"]=4;
  62187. //>>excludeEnd("ctx");
  62188. $16=self._collection();
  62189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62190. $ctx1.sendIdx["collection"]=5;
  62191. //>>excludeEnd("ctx");
  62192. $15=_st($16)._select_((function(each){
  62193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62194. return smalltalk.withContext(function($ctx2) {
  62195. //>>excludeEnd("ctx");
  62196. $17=self._sampleNewValue();
  62197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62198. $ctx2.sendIdx["sampleNewValue"]=3;
  62199. //>>excludeEnd("ctx");
  62200. return _st(each).__eq($17);
  62201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  62203. //>>excludeEnd("ctx");
  62204. }));
  62205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62206. $ctx1.sendIdx["select:"]=5;
  62207. //>>excludeEnd("ctx");
  62208. self._assert_equals_($15,_st(self._collectionClass())._new());
  62209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62210. $ctx1.sendIdx["assert:equals:"]=5;
  62211. //>>excludeEnd("ctx");
  62212. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  62213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62214. return smalltalk.withContext(function($ctx2) {
  62215. //>>excludeEnd("ctx");
  62216. return _st(each).__tild_eq(self._sampleNewValue());
  62217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62218. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  62219. //>>excludeEnd("ctx");
  62220. })),self._collection());
  62221. return self;
  62222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62223. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)});
  62224. //>>excludeEnd("ctx");
  62225. },
  62226. //>>excludeStart("ide", pragmas.excludeIdeData);
  62227. args: [],
  62228. 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",
  62229. referencedClasses: [],
  62230. //>>excludeEnd("ide");
  62231. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  62232. }),
  62233. globals.CollectionTest);
  62234. smalltalk.addMethod(
  62235. smalltalk.method({
  62236. selector: "testSize",
  62237. protocol: 'tests',
  62238. fn: function (){
  62239. var self=this;
  62240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62241. return smalltalk.withContext(function($ctx1) {
  62242. //>>excludeEnd("ctx");
  62243. var $1,$2;
  62244. $1=_st(_st(self._collectionClass())._new())._size();
  62245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62246. $ctx1.sendIdx["size"]=1;
  62247. //>>excludeEnd("ctx");
  62248. self._assert_equals_($1,(0));
  62249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62250. $ctx1.sendIdx["assert:equals:"]=1;
  62251. //>>excludeEnd("ctx");
  62252. $2=_st(self._sampleNewValueAsCollection())._size();
  62253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62254. $ctx1.sendIdx["size"]=2;
  62255. //>>excludeEnd("ctx");
  62256. self._assert_equals_($2,(1));
  62257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62258. $ctx1.sendIdx["assert:equals:"]=2;
  62259. //>>excludeEnd("ctx");
  62260. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  62261. return self;
  62262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62263. }, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)});
  62264. //>>excludeEnd("ctx");
  62265. },
  62266. //>>excludeStart("ide", pragmas.excludeIdeData);
  62267. args: [],
  62268. 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",
  62269. referencedClasses: [],
  62270. //>>excludeEnd("ide");
  62271. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  62272. }),
  62273. globals.CollectionTest);
  62274. smalltalk.addMethod(
  62275. smalltalk.method({
  62276. selector: "collectionClass",
  62277. protocol: 'fixture',
  62278. fn: function (){
  62279. var self=this;
  62280. return nil;
  62281. },
  62282. //>>excludeStart("ide", pragmas.excludeIdeData);
  62283. args: [],
  62284. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  62285. referencedClasses: [],
  62286. //>>excludeEnd("ide");
  62287. messageSends: []
  62288. }),
  62289. globals.CollectionTest.klass);
  62290. smalltalk.addMethod(
  62291. smalltalk.method({
  62292. selector: "isAbstract",
  62293. protocol: 'testing',
  62294. fn: function (){
  62295. var self=this;
  62296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62297. return smalltalk.withContext(function($ctx1) {
  62298. //>>excludeEnd("ctx");
  62299. var $1;
  62300. $1=_st(self._collectionClass())._isNil();
  62301. return $1;
  62302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62303. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)});
  62304. //>>excludeEnd("ctx");
  62305. },
  62306. //>>excludeStart("ide", pragmas.excludeIdeData);
  62307. args: [],
  62308. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  62309. referencedClasses: [],
  62310. //>>excludeEnd("ide");
  62311. messageSends: ["isNil", "collectionClass"]
  62312. }),
  62313. globals.CollectionTest.klass);
  62314. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  62315. smalltalk.addMethod(
  62316. smalltalk.method({
  62317. selector: "collectionWithNewValue",
  62318. protocol: 'fixture',
  62319. fn: function (){
  62320. var self=this;
  62321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62322. return smalltalk.withContext(function($ctx1) {
  62323. //>>excludeEnd("ctx");
  62324. self._subclassResponsibility();
  62325. return self;
  62326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62327. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)});
  62328. //>>excludeEnd("ctx");
  62329. },
  62330. //>>excludeStart("ide", pragmas.excludeIdeData);
  62331. args: [],
  62332. 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",
  62333. referencedClasses: [],
  62334. //>>excludeEnd("ide");
  62335. messageSends: ["subclassResponsibility"]
  62336. }),
  62337. globals.IndexableCollectionTest);
  62338. smalltalk.addMethod(
  62339. smalltalk.method({
  62340. selector: "sampleNewIndex",
  62341. protocol: 'fixture',
  62342. fn: function (){
  62343. var self=this;
  62344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62345. return smalltalk.withContext(function($ctx1) {
  62346. //>>excludeEnd("ctx");
  62347. self._subclassResponsibility();
  62348. return self;
  62349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62350. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)});
  62351. //>>excludeEnd("ctx");
  62352. },
  62353. //>>excludeStart("ide", pragmas.excludeIdeData);
  62354. args: [],
  62355. 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",
  62356. referencedClasses: [],
  62357. //>>excludeEnd("ide");
  62358. messageSends: ["subclassResponsibility"]
  62359. }),
  62360. globals.IndexableCollectionTest);
  62361. smalltalk.addMethod(
  62362. smalltalk.method({
  62363. selector: "sampleNonIndexesDo:",
  62364. protocol: 'fixture',
  62365. fn: function (aBlock){
  62366. var self=this;
  62367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62368. return smalltalk.withContext(function($ctx1) {
  62369. //>>excludeEnd("ctx");
  62370. self._subclassResponsibility();
  62371. return self;
  62372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62373. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  62374. //>>excludeEnd("ctx");
  62375. },
  62376. //>>excludeStart("ide", pragmas.excludeIdeData);
  62377. args: ["aBlock"],
  62378. 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",
  62379. referencedClasses: [],
  62380. //>>excludeEnd("ide");
  62381. messageSends: ["subclassResponsibility"]
  62382. }),
  62383. globals.IndexableCollectionTest);
  62384. smalltalk.addMethod(
  62385. smalltalk.method({
  62386. selector: "samplesDo:",
  62387. protocol: 'fixture',
  62388. fn: function (aBlock){
  62389. var self=this;
  62390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62391. return smalltalk.withContext(function($ctx1) {
  62392. //>>excludeEnd("ctx");
  62393. self._subclassResponsibility();
  62394. return self;
  62395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62396. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)});
  62397. //>>excludeEnd("ctx");
  62398. },
  62399. //>>excludeStart("ide", pragmas.excludeIdeData);
  62400. args: ["aBlock"],
  62401. 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",
  62402. referencedClasses: [],
  62403. //>>excludeEnd("ide");
  62404. messageSends: ["subclassResponsibility"]
  62405. }),
  62406. globals.IndexableCollectionTest);
  62407. smalltalk.addMethod(
  62408. smalltalk.method({
  62409. selector: "testAt",
  62410. protocol: 'tests',
  62411. fn: function (){
  62412. var self=this;
  62413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  62414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62415. return smalltalk.withContext(function($ctx1) {
  62416. //>>excludeEnd("ctx");
  62417. var $1;
  62418. self._nonIndexesDo_((function(each){
  62419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62420. return smalltalk.withContext(function($ctx2) {
  62421. //>>excludeEnd("ctx");
  62422. return self._should_raise_((function(){
  62423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62424. return smalltalk.withContext(function($ctx3) {
  62425. //>>excludeEnd("ctx");
  62426. $1=self._collection();
  62427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62428. $ctx3.sendIdx["collection"]=1;
  62429. //>>excludeEnd("ctx");
  62430. return _st($1)._at_(each);
  62431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62432. $ctx3.sendIdx["at:"]=1;
  62433. //>>excludeEnd("ctx");
  62434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62435. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62436. //>>excludeEnd("ctx");
  62437. }),$Error());
  62438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62440. //>>excludeEnd("ctx");
  62441. }));
  62442. self._samplesDo_((function(index,value){
  62443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62444. return smalltalk.withContext(function($ctx2) {
  62445. //>>excludeEnd("ctx");
  62446. return self._assert_equals_(_st(self._collection())._at_(index),value);
  62447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62448. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62449. //>>excludeEnd("ctx");
  62450. }));
  62451. return self;
  62452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62453. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)});
  62454. //>>excludeEnd("ctx");
  62455. },
  62456. //>>excludeStart("ide", pragmas.excludeIdeData);
  62457. args: [],
  62458. 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 ]",
  62459. referencedClasses: ["Error"],
  62460. //>>excludeEnd("ide");
  62461. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  62462. }),
  62463. globals.IndexableCollectionTest);
  62464. smalltalk.addMethod(
  62465. smalltalk.method({
  62466. selector: "testAtIfAbsent",
  62467. protocol: 'tests',
  62468. fn: function (){
  62469. var self=this;
  62470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62471. return smalltalk.withContext(function($ctx1) {
  62472. //>>excludeEnd("ctx");
  62473. var $2,$1,$3;
  62474. self._nonIndexesDo_((function(each){
  62475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62476. return smalltalk.withContext(function($ctx2) {
  62477. //>>excludeEnd("ctx");
  62478. $2=self._collection();
  62479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62480. $ctx2.sendIdx["collection"]=1;
  62481. //>>excludeEnd("ctx");
  62482. $1=_st($2)._at_ifAbsent_(each,(function(){
  62483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62484. return smalltalk.withContext(function($ctx3) {
  62485. //>>excludeEnd("ctx");
  62486. return self._sampleNewValue();
  62487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62488. $ctx3.sendIdx["sampleNewValue"]=1;
  62489. //>>excludeEnd("ctx");
  62490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62491. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62492. //>>excludeEnd("ctx");
  62493. }));
  62494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62495. $ctx2.sendIdx["at:ifAbsent:"]=1;
  62496. //>>excludeEnd("ctx");
  62497. $3=self._sampleNewValue();
  62498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62499. $ctx2.sendIdx["sampleNewValue"]=2;
  62500. //>>excludeEnd("ctx");
  62501. return self._assert_equals_($1,$3);
  62502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62503. $ctx2.sendIdx["assert:equals:"]=1;
  62504. //>>excludeEnd("ctx");
  62505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62507. //>>excludeEnd("ctx");
  62508. }));
  62509. self._samplesDo_((function(index,value){
  62510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62511. return smalltalk.withContext(function($ctx2) {
  62512. //>>excludeEnd("ctx");
  62513. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  62514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62515. return smalltalk.withContext(function($ctx3) {
  62516. //>>excludeEnd("ctx");
  62517. return self._sampleNewValue();
  62518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62519. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  62520. //>>excludeEnd("ctx");
  62521. })),value);
  62522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62523. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62524. //>>excludeEnd("ctx");
  62525. }));
  62526. return self;
  62527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62528. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)});
  62529. //>>excludeEnd("ctx");
  62530. },
  62531. //>>excludeStart("ide", pragmas.excludeIdeData);
  62532. args: [],
  62533. 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 ].",
  62534. referencedClasses: [],
  62535. //>>excludeEnd("ide");
  62536. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  62537. }),
  62538. globals.IndexableCollectionTest);
  62539. smalltalk.addMethod(
  62540. smalltalk.method({
  62541. selector: "testAtIfAbsentPut",
  62542. protocol: 'tests',
  62543. fn: function (){
  62544. var self=this;
  62545. var newCollection;
  62546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62547. return smalltalk.withContext(function($ctx1) {
  62548. //>>excludeEnd("ctx");
  62549. var $1;
  62550. newCollection=self._collection();
  62551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62552. $ctx1.sendIdx["collection"]=1;
  62553. //>>excludeEnd("ctx");
  62554. self._samplesDo_((function(index,value){
  62555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62556. return smalltalk.withContext(function($ctx2) {
  62557. //>>excludeEnd("ctx");
  62558. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  62559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62560. return smalltalk.withContext(function($ctx3) {
  62561. //>>excludeEnd("ctx");
  62562. return self._sampleNewValue();
  62563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62564. $ctx3.sendIdx["sampleNewValue"]=1;
  62565. //>>excludeEnd("ctx");
  62566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62567. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  62568. //>>excludeEnd("ctx");
  62569. }));
  62570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62571. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  62572. //>>excludeEnd("ctx");
  62573. return self._assert_equals_($1,value);
  62574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62575. $ctx2.sendIdx["assert:equals:"]=1;
  62576. //>>excludeEnd("ctx");
  62577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62578. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62579. //>>excludeEnd("ctx");
  62580. }));
  62581. self._assert_equals_(newCollection,self._collection());
  62582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62583. $ctx1.sendIdx["assert:equals:"]=2;
  62584. //>>excludeEnd("ctx");
  62585. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  62586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62587. return smalltalk.withContext(function($ctx2) {
  62588. //>>excludeEnd("ctx");
  62589. return self._sampleNewValue();
  62590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62591. $ctx2.sendIdx["sampleNewValue"]=2;
  62592. //>>excludeEnd("ctx");
  62593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62595. //>>excludeEnd("ctx");
  62596. })),self._sampleNewValue());
  62597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62598. $ctx1.sendIdx["assert:equals:"]=3;
  62599. //>>excludeEnd("ctx");
  62600. self._assert_equals_(newCollection,self._collectionWithNewValue());
  62601. return self;
  62602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62603. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  62604. //>>excludeEnd("ctx");
  62605. },
  62606. //>>excludeStart("ide", pragmas.excludeIdeData);
  62607. args: [],
  62608. 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",
  62609. referencedClasses: [],
  62610. //>>excludeEnd("ide");
  62611. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  62612. }),
  62613. globals.IndexableCollectionTest);
  62614. smalltalk.addMethod(
  62615. smalltalk.method({
  62616. selector: "testAtIfPresent",
  62617. protocol: 'tests',
  62618. fn: function (){
  62619. var self=this;
  62620. var visited,sentinel;
  62621. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62623. return smalltalk.withContext(function($ctx1) {
  62624. //>>excludeEnd("ctx");
  62625. var $2,$1,$4,$3;
  62626. sentinel=_st($Object())._new();
  62627. self._nonIndexesDo_((function(each){
  62628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62629. return smalltalk.withContext(function($ctx2) {
  62630. //>>excludeEnd("ctx");
  62631. visited=nil;
  62632. visited;
  62633. $2=self._collection();
  62634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62635. $ctx2.sendIdx["collection"]=1;
  62636. //>>excludeEnd("ctx");
  62637. $1=_st($2)._at_ifPresent_(each,(function(value1){
  62638. visited=value1;
  62639. visited;
  62640. return sentinel;
  62641. }));
  62642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62643. $ctx2.sendIdx["at:ifPresent:"]=1;
  62644. //>>excludeEnd("ctx");
  62645. self._assert_equals_($1,nil);
  62646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62647. $ctx2.sendIdx["assert:equals:"]=1;
  62648. //>>excludeEnd("ctx");
  62649. return self._assert_(_st(visited)._isNil());
  62650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62651. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62652. //>>excludeEnd("ctx");
  62653. }));
  62654. self._samplesDo_((function(index,value){
  62655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62656. return smalltalk.withContext(function($ctx2) {
  62657. //>>excludeEnd("ctx");
  62658. visited=nil;
  62659. visited;
  62660. $4=self._collection();
  62661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62662. $ctx2.sendIdx["collection"]=2;
  62663. //>>excludeEnd("ctx");
  62664. $3=_st($4)._at_ifPresent_(index,(function(value2){
  62665. visited=value2;
  62666. visited;
  62667. return sentinel;
  62668. }));
  62669. self._assert_equals_($3,sentinel);
  62670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62671. $ctx2.sendIdx["assert:equals:"]=2;
  62672. //>>excludeEnd("ctx");
  62673. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  62674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62675. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  62676. //>>excludeEnd("ctx");
  62677. }));
  62678. return self;
  62679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62680. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  62681. //>>excludeEnd("ctx");
  62682. },
  62683. //>>excludeStart("ide", pragmas.excludeIdeData);
  62684. args: [],
  62685. 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) ]",
  62686. referencedClasses: ["Object"],
  62687. //>>excludeEnd("ide");
  62688. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  62689. }),
  62690. globals.IndexableCollectionTest);
  62691. smalltalk.addMethod(
  62692. smalltalk.method({
  62693. selector: "testAtIfPresentIfAbsent",
  62694. protocol: 'tests',
  62695. fn: function (){
  62696. var self=this;
  62697. var visited,sentinel;
  62698. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  62699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62700. return smalltalk.withContext(function($ctx1) {
  62701. //>>excludeEnd("ctx");
  62702. var $2,$1,$3,$5,$4;
  62703. sentinel=_st($Object())._new();
  62704. self._nonIndexesDo_((function(each){
  62705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62706. return smalltalk.withContext(function($ctx2) {
  62707. //>>excludeEnd("ctx");
  62708. visited=nil;
  62709. visited;
  62710. $2=self._collection();
  62711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62712. $ctx2.sendIdx["collection"]=1;
  62713. //>>excludeEnd("ctx");
  62714. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  62715. visited=value1;
  62716. visited;
  62717. return sentinel;
  62718. }),(function(){
  62719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62720. return smalltalk.withContext(function($ctx3) {
  62721. //>>excludeEnd("ctx");
  62722. return self._sampleNewValue();
  62723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62724. $ctx3.sendIdx["sampleNewValue"]=1;
  62725. //>>excludeEnd("ctx");
  62726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62727. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  62728. //>>excludeEnd("ctx");
  62729. }));
  62730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62731. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  62732. //>>excludeEnd("ctx");
  62733. $3=self._sampleNewValue();
  62734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62735. $ctx2.sendIdx["sampleNewValue"]=2;
  62736. //>>excludeEnd("ctx");
  62737. self._assert_equals_($1,$3);
  62738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62739. $ctx2.sendIdx["assert:equals:"]=1;
  62740. //>>excludeEnd("ctx");
  62741. return self._assert_(_st(visited)._isNil());
  62742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62744. //>>excludeEnd("ctx");
  62745. }));
  62746. self._samplesDo_((function(index,value){
  62747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62748. return smalltalk.withContext(function($ctx2) {
  62749. //>>excludeEnd("ctx");
  62750. visited=nil;
  62751. visited;
  62752. $5=self._collection();
  62753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62754. $ctx2.sendIdx["collection"]=2;
  62755. //>>excludeEnd("ctx");
  62756. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  62757. visited=value2;
  62758. visited;
  62759. return sentinel;
  62760. }),(function(){
  62761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62762. return smalltalk.withContext(function($ctx3) {
  62763. //>>excludeEnd("ctx");
  62764. return self._sampleNewValue();
  62765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62766. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  62767. //>>excludeEnd("ctx");
  62768. }));
  62769. self._assert_equals_($4,sentinel);
  62770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62771. $ctx2.sendIdx["assert:equals:"]=2;
  62772. //>>excludeEnd("ctx");
  62773. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  62774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62775. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  62776. //>>excludeEnd("ctx");
  62777. }));
  62778. return self;
  62779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62780. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)});
  62781. //>>excludeEnd("ctx");
  62782. },
  62783. //>>excludeStart("ide", pragmas.excludeIdeData);
  62784. args: [],
  62785. 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) ]",
  62786. referencedClasses: ["Object"],
  62787. //>>excludeEnd("ide");
  62788. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  62789. }),
  62790. globals.IndexableCollectionTest);
  62791. smalltalk.addMethod(
  62792. smalltalk.method({
  62793. selector: "testAtPut",
  62794. protocol: 'tests',
  62795. fn: function (){
  62796. var self=this;
  62797. var newCollection;
  62798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62799. return smalltalk.withContext(function($ctx1) {
  62800. //>>excludeEnd("ctx");
  62801. newCollection=self._collection();
  62802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62803. $ctx1.sendIdx["collection"]=1;
  62804. //>>excludeEnd("ctx");
  62805. self._samplesDo_((function(index,value){
  62806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62807. return smalltalk.withContext(function($ctx2) {
  62808. //>>excludeEnd("ctx");
  62809. return _st(newCollection)._at_put_(index,value);
  62810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62811. $ctx2.sendIdx["at:put:"]=1;
  62812. //>>excludeEnd("ctx");
  62813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62814. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62815. //>>excludeEnd("ctx");
  62816. }));
  62817. self._assert_equals_(newCollection,self._collection());
  62818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62819. $ctx1.sendIdx["assert:equals:"]=1;
  62820. //>>excludeEnd("ctx");
  62821. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  62822. self._assert_equals_(newCollection,self._collectionWithNewValue());
  62823. return self;
  62824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62825. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)});
  62826. //>>excludeEnd("ctx");
  62827. },
  62828. //>>excludeStart("ide", pragmas.excludeIdeData);
  62829. args: [],
  62830. 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",
  62831. referencedClasses: [],
  62832. //>>excludeEnd("ide");
  62833. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  62834. }),
  62835. globals.IndexableCollectionTest);
  62836. smalltalk.addMethod(
  62837. smalltalk.method({
  62838. selector: "testEquality",
  62839. protocol: 'tests',
  62840. fn: function (){
  62841. var self=this;
  62842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62843. return smalltalk.withContext(function($ctx1) {
  62844. //>>excludeEnd("ctx");
  62845. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  62846. $2=self._collectionClass();
  62847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62848. $ctx1.sendIdx["collectionClass"]=1;
  62849. //>>excludeEnd("ctx");
  62850. $1=_st($2)._new();
  62851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62852. $ctx1.sendIdx["new"]=1;
  62853. //>>excludeEnd("ctx");
  62854. $4=self._collectionClass();
  62855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62856. $ctx1.sendIdx["collectionClass"]=2;
  62857. //>>excludeEnd("ctx");
  62858. $3=_st($4)._new();
  62859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62860. $ctx1.sendIdx["new"]=2;
  62861. //>>excludeEnd("ctx");
  62862. self._assert_equals_($1,$3);
  62863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62864. $ctx1.sendIdx["assert:equals:"]=1;
  62865. //>>excludeEnd("ctx");
  62866. $5=self._collection();
  62867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62868. $ctx1.sendIdx["collection"]=1;
  62869. //>>excludeEnd("ctx");
  62870. $6=self._collection();
  62871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62872. $ctx1.sendIdx["collection"]=2;
  62873. //>>excludeEnd("ctx");
  62874. self._assert_equals_($5,$6);
  62875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62876. $ctx1.sendIdx["assert:equals:"]=2;
  62877. //>>excludeEnd("ctx");
  62878. $7=self._collectionWithNewValue();
  62879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62880. $ctx1.sendIdx["collectionWithNewValue"]=1;
  62881. //>>excludeEnd("ctx");
  62882. self._assert_equals_($7,self._collectionWithNewValue());
  62883. $10=self._collectionClass();
  62884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62885. $ctx1.sendIdx["collectionClass"]=3;
  62886. //>>excludeEnd("ctx");
  62887. $9=_st($10)._new();
  62888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62889. $ctx1.sendIdx["new"]=3;
  62890. //>>excludeEnd("ctx");
  62891. $11=self._collection();
  62892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62893. $ctx1.sendIdx["collection"]=3;
  62894. //>>excludeEnd("ctx");
  62895. $8=_st($9).__eq($11);
  62896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62897. $ctx1.sendIdx["="]=1;
  62898. //>>excludeEnd("ctx");
  62899. self._deny_($8);
  62900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62901. $ctx1.sendIdx["deny:"]=1;
  62902. //>>excludeEnd("ctx");
  62903. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  62904. return self;
  62905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62906. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)});
  62907. //>>excludeEnd("ctx");
  62908. },
  62909. //>>excludeStart("ide", pragmas.excludeIdeData);
  62910. args: [],
  62911. 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",
  62912. referencedClasses: [],
  62913. //>>excludeEnd("ide");
  62914. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  62915. }),
  62916. globals.IndexableCollectionTest);
  62917. smalltalk.addMethod(
  62918. smalltalk.method({
  62919. selector: "testIndexOf",
  62920. protocol: 'tests',
  62921. fn: function (){
  62922. var self=this;
  62923. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  62924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62925. return smalltalk.withContext(function($ctx1) {
  62926. //>>excludeEnd("ctx");
  62927. var $1;
  62928. self._should_raise_((function(){
  62929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62930. return smalltalk.withContext(function($ctx2) {
  62931. //>>excludeEnd("ctx");
  62932. $1=self._collection();
  62933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62934. $ctx2.sendIdx["collection"]=1;
  62935. //>>excludeEnd("ctx");
  62936. return _st($1)._indexOf_(self._sampleNewValue());
  62937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62938. $ctx2.sendIdx["indexOf:"]=1;
  62939. //>>excludeEnd("ctx");
  62940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62942. //>>excludeEnd("ctx");
  62943. }),$Error());
  62944. self._samplesDo_((function(index,value){
  62945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62946. return smalltalk.withContext(function($ctx2) {
  62947. //>>excludeEnd("ctx");
  62948. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  62949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62950. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  62951. //>>excludeEnd("ctx");
  62952. }));
  62953. return self;
  62954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62955. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)});
  62956. //>>excludeEnd("ctx");
  62957. },
  62958. //>>excludeStart("ide", pragmas.excludeIdeData);
  62959. args: [],
  62960. 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 ]",
  62961. referencedClasses: ["Error"],
  62962. //>>excludeEnd("ide");
  62963. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  62964. }),
  62965. globals.IndexableCollectionTest);
  62966. smalltalk.addMethod(
  62967. smalltalk.method({
  62968. selector: "testIndexOfWithNull",
  62969. protocol: 'tests',
  62970. fn: function (){
  62971. var self=this;
  62972. var jsNull;
  62973. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  62974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62975. return smalltalk.withContext(function($ctx1) {
  62976. //>>excludeEnd("ctx");
  62977. var $1,$2;
  62978. jsNull=_st($JSON())._parse_("null");
  62979. self._samplesDo_((function(index,value){
  62980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62981. return smalltalk.withContext(function($ctx2) {
  62982. //>>excludeEnd("ctx");
  62983. $1=self._collection();
  62984. _st($1)._at_put_(index,jsNull);
  62985. $2=_st($1)._indexOf_(jsNull);
  62986. return self._assert_equals_($2,index);
  62987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62988. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  62989. //>>excludeEnd("ctx");
  62990. }));
  62991. return self;
  62992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62993. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)});
  62994. //>>excludeEnd("ctx");
  62995. },
  62996. //>>excludeStart("ide", pragmas.excludeIdeData);
  62997. args: [],
  62998. 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 ]",
  62999. referencedClasses: ["JSON"],
  63000. //>>excludeEnd("ide");
  63001. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  63002. }),
  63003. globals.IndexableCollectionTest);
  63004. smalltalk.addMethod(
  63005. smalltalk.method({
  63006. selector: "testWithIndexDo",
  63007. protocol: 'tests',
  63008. fn: function (){
  63009. var self=this;
  63010. var collection;
  63011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63012. return smalltalk.withContext(function($ctx1) {
  63013. //>>excludeEnd("ctx");
  63014. collection=self._collection();
  63015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63016. $ctx1.sendIdx["collection"]=1;
  63017. //>>excludeEnd("ctx");
  63018. _st(self._collection())._withIndexDo_((function(each,index){
  63019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63020. return smalltalk.withContext(function($ctx2) {
  63021. //>>excludeEnd("ctx");
  63022. return self._assert_equals_(_st(collection)._at_(index),each);
  63023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63024. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  63025. //>>excludeEnd("ctx");
  63026. }));
  63027. return self;
  63028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63029. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)});
  63030. //>>excludeEnd("ctx");
  63031. },
  63032. //>>excludeStart("ide", pragmas.excludeIdeData);
  63033. args: [],
  63034. 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 ]",
  63035. referencedClasses: [],
  63036. //>>excludeEnd("ide");
  63037. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  63038. }),
  63039. globals.IndexableCollectionTest);
  63040. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  63041. smalltalk.addMethod(
  63042. smalltalk.method({
  63043. selector: "collectionKeys",
  63044. protocol: 'fixture',
  63045. fn: function (){
  63046. var self=this;
  63047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63048. return smalltalk.withContext(function($ctx1) {
  63049. //>>excludeEnd("ctx");
  63050. self._subclassResponsibility();
  63051. return self;
  63052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63053. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)});
  63054. //>>excludeEnd("ctx");
  63055. },
  63056. //>>excludeStart("ide", pragmas.excludeIdeData);
  63057. args: [],
  63058. source: "collectionKeys\x0a\x09self subclassResponsibility",
  63059. referencedClasses: [],
  63060. //>>excludeEnd("ide");
  63061. messageSends: ["subclassResponsibility"]
  63062. }),
  63063. globals.AssociativeCollectionTest);
  63064. smalltalk.addMethod(
  63065. smalltalk.method({
  63066. selector: "collectionValues",
  63067. protocol: 'fixture',
  63068. fn: function (){
  63069. var self=this;
  63070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63071. return smalltalk.withContext(function($ctx1) {
  63072. //>>excludeEnd("ctx");
  63073. self._subclassResponsibility();
  63074. return self;
  63075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63076. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)});
  63077. //>>excludeEnd("ctx");
  63078. },
  63079. //>>excludeStart("ide", pragmas.excludeIdeData);
  63080. args: [],
  63081. source: "collectionValues\x0a\x09self subclassResponsibility",
  63082. referencedClasses: [],
  63083. //>>excludeEnd("ide");
  63084. messageSends: ["subclassResponsibility"]
  63085. }),
  63086. globals.AssociativeCollectionTest);
  63087. smalltalk.addMethod(
  63088. smalltalk.method({
  63089. selector: "nonIndexesDo:",
  63090. protocol: 'fixture',
  63091. fn: function (aBlock){
  63092. var self=this;
  63093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63094. return smalltalk.withContext(function($ctx1) {
  63095. //>>excludeEnd("ctx");
  63096. _st(aBlock)._value_((5));
  63097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63098. $ctx1.sendIdx["value:"]=1;
  63099. //>>excludeEnd("ctx");
  63100. _st(aBlock)._value_("z");
  63101. return self;
  63102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63103. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  63104. //>>excludeEnd("ctx");
  63105. },
  63106. //>>excludeStart("ide", pragmas.excludeIdeData);
  63107. args: ["aBlock"],
  63108. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  63109. referencedClasses: [],
  63110. //>>excludeEnd("ide");
  63111. messageSends: ["value:"]
  63112. }),
  63113. globals.AssociativeCollectionTest);
  63114. smalltalk.addMethod(
  63115. smalltalk.method({
  63116. selector: "sampleNewIndex",
  63117. protocol: 'fixture',
  63118. fn: function (){
  63119. var self=this;
  63120. return "new";
  63121. },
  63122. //>>excludeStart("ide", pragmas.excludeIdeData);
  63123. args: [],
  63124. source: "sampleNewIndex\x0a\x09^ 'new'",
  63125. referencedClasses: [],
  63126. //>>excludeEnd("ide");
  63127. messageSends: []
  63128. }),
  63129. globals.AssociativeCollectionTest);
  63130. smalltalk.addMethod(
  63131. smalltalk.method({
  63132. selector: "samplesDo:",
  63133. protocol: 'fixture',
  63134. fn: function (aBlock){
  63135. var self=this;
  63136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63137. return smalltalk.withContext(function($ctx1) {
  63138. //>>excludeEnd("ctx");
  63139. _st(aBlock)._value_value_("a",(2));
  63140. return self;
  63141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63142. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)});
  63143. //>>excludeEnd("ctx");
  63144. },
  63145. //>>excludeStart("ide", pragmas.excludeIdeData);
  63146. args: ["aBlock"],
  63147. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  63148. referencedClasses: [],
  63149. //>>excludeEnd("ide");
  63150. messageSends: ["value:value:"]
  63151. }),
  63152. globals.AssociativeCollectionTest);
  63153. smalltalk.addMethod(
  63154. smalltalk.method({
  63155. selector: "testAddAll",
  63156. protocol: 'tests',
  63157. fn: function (){
  63158. var self=this;
  63159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63160. return smalltalk.withContext(function($ctx1) {
  63161. //>>excludeEnd("ctx");
  63162. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  63163. (
  63164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63165. $ctx1.supercall = true,
  63166. //>>excludeEnd("ctx");
  63167. globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  63168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63169. $ctx1.supercall = false;
  63170. //>>excludeEnd("ctx");;
  63171. $2=self._collection();
  63172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63173. $ctx1.sendIdx["collection"]=1;
  63174. //>>excludeEnd("ctx");
  63175. $3=$2;
  63176. $4=self._collection();
  63177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63178. $ctx1.sendIdx["collection"]=2;
  63179. //>>excludeEnd("ctx");
  63180. _st($3)._addAll_($4);
  63181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63182. $ctx1.sendIdx["addAll:"]=1;
  63183. //>>excludeEnd("ctx");
  63184. $5=_st($2)._yourself();
  63185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63186. $ctx1.sendIdx["yourself"]=1;
  63187. //>>excludeEnd("ctx");
  63188. $1=$5;
  63189. $6=self._collection();
  63190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63191. $ctx1.sendIdx["collection"]=3;
  63192. //>>excludeEnd("ctx");
  63193. self._assert_equals_($1,$6);
  63194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63195. $ctx1.sendIdx["assert:equals:"]=1;
  63196. //>>excludeEnd("ctx");
  63197. $8=self._collection();
  63198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63199. $ctx1.sendIdx["collection"]=4;
  63200. //>>excludeEnd("ctx");
  63201. $9=$8;
  63202. $10=self._collectionWithNewValue();
  63203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63204. $ctx1.sendIdx["collectionWithNewValue"]=1;
  63205. //>>excludeEnd("ctx");
  63206. _st($9)._addAll_($10);
  63207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63208. $ctx1.sendIdx["addAll:"]=2;
  63209. //>>excludeEnd("ctx");
  63210. $11=_st($8)._yourself();
  63211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63212. $ctx1.sendIdx["yourself"]=2;
  63213. //>>excludeEnd("ctx");
  63214. $7=$11;
  63215. $12=self._collectionWithNewValue();
  63216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63217. $ctx1.sendIdx["collectionWithNewValue"]=2;
  63218. //>>excludeEnd("ctx");
  63219. self._assert_equals_($7,$12);
  63220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63221. $ctx1.sendIdx["assert:equals:"]=2;
  63222. //>>excludeEnd("ctx");
  63223. $14=self._collectionWithNewValue();
  63224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63225. $ctx1.sendIdx["collectionWithNewValue"]=3;
  63226. //>>excludeEnd("ctx");
  63227. _st($14)._addAll_(self._collection());
  63228. $15=_st($14)._yourself();
  63229. $13=$15;
  63230. self._assert_equals_($13,self._collectionWithNewValue());
  63231. return self;
  63232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63233. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)});
  63234. //>>excludeEnd("ctx");
  63235. },
  63236. //>>excludeStart("ide", pragmas.excludeIdeData);
  63237. args: [],
  63238. 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",
  63239. referencedClasses: [],
  63240. //>>excludeEnd("ide");
  63241. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  63242. }),
  63243. globals.AssociativeCollectionTest);
  63244. smalltalk.addMethod(
  63245. smalltalk.method({
  63246. selector: "testAsDictionary",
  63247. protocol: 'tests',
  63248. fn: function (){
  63249. var self=this;
  63250. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63252. return smalltalk.withContext(function($ctx1) {
  63253. //>>excludeEnd("ctx");
  63254. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  63255. return self;
  63256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63257. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)});
  63258. //>>excludeEnd("ctx");
  63259. },
  63260. //>>excludeStart("ide", pragmas.excludeIdeData);
  63261. args: [],
  63262. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  63263. referencedClasses: ["Dictionary"],
  63264. //>>excludeEnd("ide");
  63265. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  63266. }),
  63267. globals.AssociativeCollectionTest);
  63268. smalltalk.addMethod(
  63269. smalltalk.method({
  63270. selector: "testAsHashedCollection",
  63271. protocol: 'tests',
  63272. fn: function (){
  63273. var self=this;
  63274. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  63275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63276. return smalltalk.withContext(function($ctx1) {
  63277. //>>excludeEnd("ctx");
  63278. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  63279. return self;
  63280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63281. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)});
  63282. //>>excludeEnd("ctx");
  63283. },
  63284. //>>excludeStart("ide", pragmas.excludeIdeData);
  63285. args: [],
  63286. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  63287. referencedClasses: ["HashedCollection"],
  63288. //>>excludeEnd("ide");
  63289. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  63290. }),
  63291. globals.AssociativeCollectionTest);
  63292. smalltalk.addMethod(
  63293. smalltalk.method({
  63294. selector: "testComma",
  63295. protocol: 'tests',
  63296. fn: function (){
  63297. var self=this;
  63298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63299. return smalltalk.withContext(function($ctx1) {
  63300. //>>excludeEnd("ctx");
  63301. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  63302. (
  63303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63304. $ctx1.supercall = true,
  63305. //>>excludeEnd("ctx");
  63306. globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  63307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63308. $ctx1.supercall = false;
  63309. //>>excludeEnd("ctx");;
  63310. $2=self._collection();
  63311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63312. $ctx1.sendIdx["collection"]=1;
  63313. //>>excludeEnd("ctx");
  63314. $3=self._collection();
  63315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63316. $ctx1.sendIdx["collection"]=2;
  63317. //>>excludeEnd("ctx");
  63318. $1=_st($2).__comma($3);
  63319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63320. $ctx1.sendIdx[","]=1;
  63321. //>>excludeEnd("ctx");
  63322. $4=self._collection();
  63323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63324. $ctx1.sendIdx["collection"]=3;
  63325. //>>excludeEnd("ctx");
  63326. self._assert_equals_($1,$4);
  63327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63328. $ctx1.sendIdx["assert:equals:"]=1;
  63329. //>>excludeEnd("ctx");
  63330. $6=self._collection();
  63331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63332. $ctx1.sendIdx["collection"]=4;
  63333. //>>excludeEnd("ctx");
  63334. $7=self._collectionWithNewValue();
  63335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63336. $ctx1.sendIdx["collectionWithNewValue"]=1;
  63337. //>>excludeEnd("ctx");
  63338. $5=_st($6).__comma($7);
  63339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63340. $ctx1.sendIdx[","]=2;
  63341. //>>excludeEnd("ctx");
  63342. $8=self._collectionWithNewValue();
  63343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63344. $ctx1.sendIdx["collectionWithNewValue"]=2;
  63345. //>>excludeEnd("ctx");
  63346. self._assert_equals_($5,$8);
  63347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63348. $ctx1.sendIdx["assert:equals:"]=2;
  63349. //>>excludeEnd("ctx");
  63350. $10=self._collectionWithNewValue();
  63351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63352. $ctx1.sendIdx["collectionWithNewValue"]=3;
  63353. //>>excludeEnd("ctx");
  63354. $9=_st($10).__comma(self._collection());
  63355. self._assert_equals_($9,self._collectionWithNewValue());
  63356. return self;
  63357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63358. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)});
  63359. //>>excludeEnd("ctx");
  63360. },
  63361. //>>excludeStart("ide", pragmas.excludeIdeData);
  63362. args: [],
  63363. 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",
  63364. referencedClasses: [],
  63365. //>>excludeEnd("ide");
  63366. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  63367. }),
  63368. globals.AssociativeCollectionTest);
  63369. smalltalk.addMethod(
  63370. smalltalk.method({
  63371. selector: "testFrom",
  63372. protocol: 'tests',
  63373. fn: function (){
  63374. var self=this;
  63375. var associations;
  63376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63377. return smalltalk.withContext(function($ctx1) {
  63378. //>>excludeEnd("ctx");
  63379. var $1;
  63380. $1="a".__minus_gt((1));
  63381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63382. $ctx1.sendIdx["->"]=1;
  63383. //>>excludeEnd("ctx");
  63384. associations=[$1,"b".__minus_gt((2))];
  63385. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  63386. return self;
  63387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63388. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)});
  63389. //>>excludeEnd("ctx");
  63390. },
  63391. //>>excludeStart("ide", pragmas.excludeIdeData);
  63392. args: [],
  63393. 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 }.",
  63394. referencedClasses: [],
  63395. //>>excludeEnd("ide");
  63396. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  63397. }),
  63398. globals.AssociativeCollectionTest);
  63399. smalltalk.addMethod(
  63400. smalltalk.method({
  63401. selector: "testKeys",
  63402. protocol: 'tests',
  63403. fn: function (){
  63404. var self=this;
  63405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63406. return smalltalk.withContext(function($ctx1) {
  63407. //>>excludeEnd("ctx");
  63408. var $2,$1,$3,$4;
  63409. $2=_st(_st(self._collectionClass())._new())._keys();
  63410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63411. $ctx1.sendIdx["keys"]=1;
  63412. //>>excludeEnd("ctx");
  63413. $1=_st($2)._isEmpty();
  63414. self._assert_($1);
  63415. $3=_st(self._collection())._keys();
  63416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63417. $ctx1.sendIdx["keys"]=2;
  63418. //>>excludeEnd("ctx");
  63419. $4=self._collectionKeys();
  63420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63421. $ctx1.sendIdx["collectionKeys"]=1;
  63422. //>>excludeEnd("ctx");
  63423. self._assertSameContents_as_($3,$4);
  63424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63425. $ctx1.sendIdx["assertSameContents:as:"]=1;
  63426. //>>excludeEnd("ctx");
  63427. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  63428. return self;
  63429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63430. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)});
  63431. //>>excludeEnd("ctx");
  63432. },
  63433. //>>excludeStart("ide", pragmas.excludeIdeData);
  63434. args: [],
  63435. 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 }",
  63436. referencedClasses: [],
  63437. //>>excludeEnd("ide");
  63438. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  63439. }),
  63440. globals.AssociativeCollectionTest);
  63441. smalltalk.addMethod(
  63442. smalltalk.method({
  63443. selector: "testNewFromPairs",
  63444. protocol: 'tests',
  63445. fn: function (){
  63446. var self=this;
  63447. var flattenedAssociations;
  63448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63449. return smalltalk.withContext(function($ctx1) {
  63450. //>>excludeEnd("ctx");
  63451. flattenedAssociations=["a",(1),"b",(2)];
  63452. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  63453. return self;
  63454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63455. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)});
  63456. //>>excludeEnd("ctx");
  63457. },
  63458. //>>excludeStart("ide", pragmas.excludeIdeData);
  63459. args: [],
  63460. 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 }.",
  63461. referencedClasses: [],
  63462. //>>excludeEnd("ide");
  63463. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  63464. }),
  63465. globals.AssociativeCollectionTest);
  63466. smalltalk.addMethod(
  63467. smalltalk.method({
  63468. selector: "testPrintString",
  63469. protocol: 'tests',
  63470. fn: function (){
  63471. var self=this;
  63472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63473. return smalltalk.withContext(function($ctx1) {
  63474. //>>excludeEnd("ctx");
  63475. var $3,$2,$4,$1,$5;
  63476. $3=self._collectionClass();
  63477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63478. $ctx1.sendIdx["collectionClass"]=1;
  63479. //>>excludeEnd("ctx");
  63480. $2=_st($3)._new();
  63481. _st($2)._at_put_("firstname","James");
  63482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63483. $ctx1.sendIdx["at:put:"]=1;
  63484. //>>excludeEnd("ctx");
  63485. _st($2)._at_put_("lastname","Bond");
  63486. $4=_st($2)._printString();
  63487. $1=$4;
  63488. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  63489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63490. $ctx1.sendIdx[","]=1;
  63491. //>>excludeEnd("ctx");
  63492. self._assert_equals_($1,$5);
  63493. return self;
  63494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63495. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)});
  63496. //>>excludeEnd("ctx");
  63497. },
  63498. //>>excludeStart("ide", pragmas.excludeIdeData);
  63499. args: [],
  63500. 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'')'",
  63501. referencedClasses: [],
  63502. //>>excludeEnd("ide");
  63503. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  63504. }),
  63505. globals.AssociativeCollectionTest);
  63506. smalltalk.addMethod(
  63507. smalltalk.method({
  63508. selector: "testRemoveKey",
  63509. protocol: 'tests',
  63510. fn: function (){
  63511. var self=this;
  63512. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  63513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63514. return smalltalk.withContext(function($ctx1) {
  63515. //>>excludeEnd("ctx");
  63516. var $1,$2,$3,$5,$6,$4,$7,$8;
  63517. self._nonIndexesDo_((function(each){
  63518. var collection;
  63519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63520. return smalltalk.withContext(function($ctx2) {
  63521. //>>excludeEnd("ctx");
  63522. collection=self._collection();
  63523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63524. $ctx2.sendIdx["collection"]=1;
  63525. //>>excludeEnd("ctx");
  63526. collection;
  63527. self._should_raise_((function(){
  63528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63529. return smalltalk.withContext(function($ctx3) {
  63530. //>>excludeEnd("ctx");
  63531. return _st(collection)._removeKey_(each);
  63532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63533. $ctx3.sendIdx["removeKey:"]=1;
  63534. //>>excludeEnd("ctx");
  63535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63536. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63537. //>>excludeEnd("ctx");
  63538. }),$Error());
  63539. $1=collection;
  63540. $2=self._collection();
  63541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63542. $ctx2.sendIdx["collection"]=2;
  63543. //>>excludeEnd("ctx");
  63544. return self._assert_equals_($1,$2);
  63545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63546. $ctx2.sendIdx["assert:equals:"]=1;
  63547. //>>excludeEnd("ctx");
  63548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63549. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  63550. //>>excludeEnd("ctx");
  63551. }));
  63552. self._samplesDo_((function(index,value){
  63553. var collection;
  63554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63555. return smalltalk.withContext(function($ctx2) {
  63556. //>>excludeEnd("ctx");
  63557. collection=self._collection();
  63558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63559. $ctx2.sendIdx["collection"]=3;
  63560. //>>excludeEnd("ctx");
  63561. collection;
  63562. $3=_st(collection)._removeKey_(index);
  63563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63564. $ctx2.sendIdx["removeKey:"]=2;
  63565. //>>excludeEnd("ctx");
  63566. self._assert_equals_($3,value);
  63567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63568. $ctx2.sendIdx["assert:equals:"]=2;
  63569. //>>excludeEnd("ctx");
  63570. $5=collection;
  63571. $6=self._collection();
  63572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63573. $ctx2.sendIdx["collection"]=4;
  63574. //>>excludeEnd("ctx");
  63575. $4=_st($5).__eq($6);
  63576. return self._deny_($4);
  63577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63578. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  63579. //>>excludeEnd("ctx");
  63580. }));
  63581. $7=self._collectionWithNewValue();
  63582. _st($7)._removeKey_(self._sampleNewIndex());
  63583. $8=_st($7)._yourself();
  63584. self._assert_equals_($8,self._collection());
  63585. return self;
  63586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63587. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)});
  63588. //>>excludeEnd("ctx");
  63589. },
  63590. //>>excludeStart("ide", pragmas.excludeIdeData);
  63591. args: [],
  63592. 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",
  63593. referencedClasses: ["Error"],
  63594. //>>excludeEnd("ide");
  63595. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  63596. }),
  63597. globals.AssociativeCollectionTest);
  63598. smalltalk.addMethod(
  63599. smalltalk.method({
  63600. selector: "testRemoveKeyIfAbsent",
  63601. protocol: 'tests',
  63602. fn: function (){
  63603. var self=this;
  63604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63605. return smalltalk.withContext(function($ctx1) {
  63606. //>>excludeEnd("ctx");
  63607. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  63608. self._nonIndexesDo_((function(each){
  63609. var collection;
  63610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63611. return smalltalk.withContext(function($ctx2) {
  63612. //>>excludeEnd("ctx");
  63613. collection=self._collection();
  63614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63615. $ctx2.sendIdx["collection"]=1;
  63616. //>>excludeEnd("ctx");
  63617. collection;
  63618. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  63619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63620. return smalltalk.withContext(function($ctx3) {
  63621. //>>excludeEnd("ctx");
  63622. return self._sampleNewValue();
  63623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63624. $ctx3.sendIdx["sampleNewValue"]=1;
  63625. //>>excludeEnd("ctx");
  63626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63627. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63628. //>>excludeEnd("ctx");
  63629. }));
  63630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63631. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  63632. //>>excludeEnd("ctx");
  63633. $2=self._sampleNewValue();
  63634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63635. $ctx2.sendIdx["sampleNewValue"]=2;
  63636. //>>excludeEnd("ctx");
  63637. self._assert_equals_($1,$2);
  63638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63639. $ctx2.sendIdx["assert:equals:"]=1;
  63640. //>>excludeEnd("ctx");
  63641. $3=collection;
  63642. $4=self._collection();
  63643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63644. $ctx2.sendIdx["collection"]=2;
  63645. //>>excludeEnd("ctx");
  63646. return self._assert_equals_($3,$4);
  63647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63648. $ctx2.sendIdx["assert:equals:"]=2;
  63649. //>>excludeEnd("ctx");
  63650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63651. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  63652. //>>excludeEnd("ctx");
  63653. }));
  63654. self._samplesDo_((function(index,value){
  63655. var collection;
  63656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63657. return smalltalk.withContext(function($ctx2) {
  63658. //>>excludeEnd("ctx");
  63659. collection=self._collection();
  63660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63661. $ctx2.sendIdx["collection"]=3;
  63662. //>>excludeEnd("ctx");
  63663. collection;
  63664. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  63665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63666. return smalltalk.withContext(function($ctx3) {
  63667. //>>excludeEnd("ctx");
  63668. return self._sampleNewValue();
  63669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63670. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  63671. //>>excludeEnd("ctx");
  63672. }));
  63673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63674. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  63675. //>>excludeEnd("ctx");
  63676. self._assert_equals_($5,value);
  63677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63678. $ctx2.sendIdx["assert:equals:"]=3;
  63679. //>>excludeEnd("ctx");
  63680. $7=collection;
  63681. $8=self._collection();
  63682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63683. $ctx2.sendIdx["collection"]=4;
  63684. //>>excludeEnd("ctx");
  63685. $6=_st($7).__eq($8);
  63686. return self._deny_($6);
  63687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63688. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  63689. //>>excludeEnd("ctx");
  63690. }));
  63691. $9=self._collectionWithNewValue();
  63692. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  63693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63694. return smalltalk.withContext(function($ctx2) {
  63695. //>>excludeEnd("ctx");
  63696. return self._assert_(false);
  63697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63699. //>>excludeEnd("ctx");
  63700. }));
  63701. $10=_st($9)._yourself();
  63702. self._assert_equals_($10,self._collection());
  63703. return self;
  63704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63705. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)});
  63706. //>>excludeEnd("ctx");
  63707. },
  63708. //>>excludeStart("ide", pragmas.excludeIdeData);
  63709. args: [],
  63710. 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",
  63711. referencedClasses: [],
  63712. //>>excludeEnd("ide");
  63713. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  63714. }),
  63715. globals.AssociativeCollectionTest);
  63716. smalltalk.addMethod(
  63717. smalltalk.method({
  63718. selector: "testValues",
  63719. protocol: 'tests',
  63720. fn: function (){
  63721. var self=this;
  63722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63723. return smalltalk.withContext(function($ctx1) {
  63724. //>>excludeEnd("ctx");
  63725. var $2,$1,$3,$4;
  63726. $2=_st(_st(self._collectionClass())._new())._values();
  63727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63728. $ctx1.sendIdx["values"]=1;
  63729. //>>excludeEnd("ctx");
  63730. $1=_st($2)._isEmpty();
  63731. self._assert_($1);
  63732. $3=_st(self._collection())._values();
  63733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63734. $ctx1.sendIdx["values"]=2;
  63735. //>>excludeEnd("ctx");
  63736. $4=self._collectionValues();
  63737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63738. $ctx1.sendIdx["collectionValues"]=1;
  63739. //>>excludeEnd("ctx");
  63740. self._assertSameContents_as_($3,$4);
  63741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63742. $ctx1.sendIdx["assertSameContents:as:"]=1;
  63743. //>>excludeEnd("ctx");
  63744. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  63745. return self;
  63746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63747. }, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)});
  63748. //>>excludeEnd("ctx");
  63749. },
  63750. //>>excludeStart("ide", pragmas.excludeIdeData);
  63751. args: [],
  63752. 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 }",
  63753. referencedClasses: [],
  63754. //>>excludeEnd("ide");
  63755. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  63756. }),
  63757. globals.AssociativeCollectionTest);
  63758. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  63759. smalltalk.addMethod(
  63760. smalltalk.method({
  63761. selector: "collection",
  63762. protocol: 'fixture',
  63763. fn: function (){
  63764. var self=this;
  63765. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63767. return smalltalk.withContext(function($ctx1) {
  63768. //>>excludeEnd("ctx");
  63769. var $2,$3,$1;
  63770. $2=_st($Dictionary())._new();
  63771. _st($2)._at_put_((1),(1));
  63772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63773. $ctx1.sendIdx["at:put:"]=1;
  63774. //>>excludeEnd("ctx");
  63775. _st($2)._at_put_("a",(2));
  63776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63777. $ctx1.sendIdx["at:put:"]=2;
  63778. //>>excludeEnd("ctx");
  63779. _st($2)._at_put_(true,(3));
  63780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63781. $ctx1.sendIdx["at:put:"]=3;
  63782. //>>excludeEnd("ctx");
  63783. _st($2)._at_put_((1).__at((3)),(-4));
  63784. $3=_st($2)._yourself();
  63785. $1=$3;
  63786. return $1;
  63787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63788. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)});
  63789. //>>excludeEnd("ctx");
  63790. },
  63791. //>>excludeStart("ide", pragmas.excludeIdeData);
  63792. args: [],
  63793. 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",
  63794. referencedClasses: ["Dictionary"],
  63795. //>>excludeEnd("ide");
  63796. messageSends: ["at:put:", "new", "@", "yourself"]
  63797. }),
  63798. globals.DictionaryTest);
  63799. smalltalk.addMethod(
  63800. smalltalk.method({
  63801. selector: "collectionKeys",
  63802. protocol: 'fixture',
  63803. fn: function (){
  63804. var self=this;
  63805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63806. return smalltalk.withContext(function($ctx1) {
  63807. //>>excludeEnd("ctx");
  63808. var $1;
  63809. $1=[(1),"a",true,(1).__at((3))];
  63810. return $1;
  63811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63812. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)});
  63813. //>>excludeEnd("ctx");
  63814. },
  63815. //>>excludeStart("ide", pragmas.excludeIdeData);
  63816. args: [],
  63817. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  63818. referencedClasses: [],
  63819. //>>excludeEnd("ide");
  63820. messageSends: ["@"]
  63821. }),
  63822. globals.DictionaryTest);
  63823. smalltalk.addMethod(
  63824. smalltalk.method({
  63825. selector: "collectionOfPrintStrings",
  63826. protocol: 'fixture',
  63827. fn: function (){
  63828. var self=this;
  63829. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63831. return smalltalk.withContext(function($ctx1) {
  63832. //>>excludeEnd("ctx");
  63833. var $2,$3,$1;
  63834. $2=_st($Dictionary())._new();
  63835. _st($2)._at_put_((1),"1");
  63836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63837. $ctx1.sendIdx["at:put:"]=1;
  63838. //>>excludeEnd("ctx");
  63839. _st($2)._at_put_("a","2");
  63840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63841. $ctx1.sendIdx["at:put:"]=2;
  63842. //>>excludeEnd("ctx");
  63843. _st($2)._at_put_(true,"3");
  63844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63845. $ctx1.sendIdx["at:put:"]=3;
  63846. //>>excludeEnd("ctx");
  63847. _st($2)._at_put_((1).__at((3)),"-4");
  63848. $3=_st($2)._yourself();
  63849. $1=$3;
  63850. return $1;
  63851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63852. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)});
  63853. //>>excludeEnd("ctx");
  63854. },
  63855. //>>excludeStart("ide", pragmas.excludeIdeData);
  63856. args: [],
  63857. 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",
  63858. referencedClasses: ["Dictionary"],
  63859. //>>excludeEnd("ide");
  63860. messageSends: ["at:put:", "new", "@", "yourself"]
  63861. }),
  63862. globals.DictionaryTest);
  63863. smalltalk.addMethod(
  63864. smalltalk.method({
  63865. selector: "collectionSize",
  63866. protocol: 'fixture',
  63867. fn: function (){
  63868. var self=this;
  63869. return (4);
  63870. },
  63871. //>>excludeStart("ide", pragmas.excludeIdeData);
  63872. args: [],
  63873. source: "collectionSize\x0a\x09^ 4",
  63874. referencedClasses: [],
  63875. //>>excludeEnd("ide");
  63876. messageSends: []
  63877. }),
  63878. globals.DictionaryTest);
  63879. smalltalk.addMethod(
  63880. smalltalk.method({
  63881. selector: "collectionValues",
  63882. protocol: 'fixture',
  63883. fn: function (){
  63884. var self=this;
  63885. var $1;
  63886. $1=[(1),(2),(3),(-4)];
  63887. return $1;
  63888. },
  63889. //>>excludeStart("ide", pragmas.excludeIdeData);
  63890. args: [],
  63891. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  63892. referencedClasses: [],
  63893. //>>excludeEnd("ide");
  63894. messageSends: []
  63895. }),
  63896. globals.DictionaryTest);
  63897. smalltalk.addMethod(
  63898. smalltalk.method({
  63899. selector: "collectionWithDuplicates",
  63900. protocol: 'fixture',
  63901. fn: function (){
  63902. var self=this;
  63903. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63905. return smalltalk.withContext(function($ctx1) {
  63906. //>>excludeEnd("ctx");
  63907. var $2,$3,$1;
  63908. $2=_st($Dictionary())._new();
  63909. _st($2)._at_put_((1),(1));
  63910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63911. $ctx1.sendIdx["at:put:"]=1;
  63912. //>>excludeEnd("ctx");
  63913. _st($2)._at_put_("a",(2));
  63914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63915. $ctx1.sendIdx["at:put:"]=2;
  63916. //>>excludeEnd("ctx");
  63917. _st($2)._at_put_(true,(3));
  63918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63919. $ctx1.sendIdx["at:put:"]=3;
  63920. //>>excludeEnd("ctx");
  63921. _st($2)._at_put_((4),(-4));
  63922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63923. $ctx1.sendIdx["at:put:"]=4;
  63924. //>>excludeEnd("ctx");
  63925. _st($2)._at_put_("b",(1));
  63926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63927. $ctx1.sendIdx["at:put:"]=5;
  63928. //>>excludeEnd("ctx");
  63929. _st($2)._at_put_((3),(3));
  63930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63931. $ctx1.sendIdx["at:put:"]=6;
  63932. //>>excludeEnd("ctx");
  63933. _st($2)._at_put_(false,(12));
  63934. $3=_st($2)._yourself();
  63935. $1=$3;
  63936. return $1;
  63937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63938. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)});
  63939. //>>excludeEnd("ctx");
  63940. },
  63941. //>>excludeStart("ide", pragmas.excludeIdeData);
  63942. args: [],
  63943. 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",
  63944. referencedClasses: ["Dictionary"],
  63945. //>>excludeEnd("ide");
  63946. messageSends: ["at:put:", "new", "yourself"]
  63947. }),
  63948. globals.DictionaryTest);
  63949. smalltalk.addMethod(
  63950. smalltalk.method({
  63951. selector: "collectionWithNewValue",
  63952. protocol: 'fixture',
  63953. fn: function (){
  63954. var self=this;
  63955. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  63956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63957. return smalltalk.withContext(function($ctx1) {
  63958. //>>excludeEnd("ctx");
  63959. var $2,$3,$1;
  63960. $2=_st($Dictionary())._new();
  63961. _st($2)._at_put_((1),(1));
  63962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63963. $ctx1.sendIdx["at:put:"]=1;
  63964. //>>excludeEnd("ctx");
  63965. _st($2)._at_put_("a",(2));
  63966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63967. $ctx1.sendIdx["at:put:"]=2;
  63968. //>>excludeEnd("ctx");
  63969. _st($2)._at_put_(true,(3));
  63970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63971. $ctx1.sendIdx["at:put:"]=3;
  63972. //>>excludeEnd("ctx");
  63973. _st($2)._at_put_((1).__at((3)),(-4));
  63974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63975. $ctx1.sendIdx["at:put:"]=4;
  63976. //>>excludeEnd("ctx");
  63977. _st($2)._at_put_("new","N");
  63978. $3=_st($2)._yourself();
  63979. $1=$3;
  63980. return $1;
  63981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63982. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)});
  63983. //>>excludeEnd("ctx");
  63984. },
  63985. //>>excludeStart("ide", pragmas.excludeIdeData);
  63986. args: [],
  63987. 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",
  63988. referencedClasses: ["Dictionary"],
  63989. //>>excludeEnd("ide");
  63990. messageSends: ["at:put:", "new", "@", "yourself"]
  63991. }),
  63992. globals.DictionaryTest);
  63993. smalltalk.addMethod(
  63994. smalltalk.method({
  63995. selector: "sampleNewValueAsCollection",
  63996. protocol: 'fixture',
  63997. fn: function (){
  63998. var self=this;
  63999. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64001. return smalltalk.withContext(function($ctx1) {
  64002. //>>excludeEnd("ctx");
  64003. var $2,$3,$1;
  64004. $2=_st($Dictionary())._new();
  64005. _st($2)._at_put_("new","N");
  64006. $3=_st($2)._yourself();
  64007. $1=$3;
  64008. return $1;
  64009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64010. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)});
  64011. //>>excludeEnd("ctx");
  64012. },
  64013. //>>excludeStart("ide", pragmas.excludeIdeData);
  64014. args: [],
  64015. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  64016. referencedClasses: ["Dictionary"],
  64017. //>>excludeEnd("ide");
  64018. messageSends: ["at:put:", "new", "yourself"]
  64019. }),
  64020. globals.DictionaryTest);
  64021. smalltalk.addMethod(
  64022. smalltalk.method({
  64023. selector: "samplesDo:",
  64024. protocol: 'fixture',
  64025. fn: function (aBlock){
  64026. var self=this;
  64027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64028. return smalltalk.withContext(function($ctx1) {
  64029. //>>excludeEnd("ctx");
  64030. (
  64031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64032. $ctx1.supercall = true,
  64033. //>>excludeEnd("ctx");
  64034. globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  64035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64036. $ctx1.supercall = false;
  64037. //>>excludeEnd("ctx");;
  64038. _st(aBlock)._value_value_(true,(3));
  64039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64040. $ctx1.sendIdx["value:value:"]=1;
  64041. //>>excludeEnd("ctx");
  64042. _st(aBlock)._value_value_((1).__at((3)),(-4));
  64043. return self;
  64044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64045. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)});
  64046. //>>excludeEnd("ctx");
  64047. },
  64048. //>>excludeStart("ide", pragmas.excludeIdeData);
  64049. args: ["aBlock"],
  64050. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  64051. referencedClasses: [],
  64052. //>>excludeEnd("ide");
  64053. messageSends: ["samplesDo:", "value:value:", "@"]
  64054. }),
  64055. globals.DictionaryTest);
  64056. smalltalk.addMethod(
  64057. smalltalk.method({
  64058. selector: "testAccessing",
  64059. protocol: 'tests',
  64060. fn: function (){
  64061. var self=this;
  64062. var d;
  64063. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64065. return smalltalk.withContext(function($ctx1) {
  64066. //>>excludeEnd("ctx");
  64067. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  64068. d=_st($Dictionary())._new();
  64069. _st(d)._at_put_("hello","world");
  64070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64071. $ctx1.sendIdx["at:put:"]=1;
  64072. //>>excludeEnd("ctx");
  64073. $1=_st(d)._at_("hello");
  64074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64075. $ctx1.sendIdx["at:"]=1;
  64076. //>>excludeEnd("ctx");
  64077. self._assert_equals_($1,"world");
  64078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64079. $ctx1.sendIdx["assert:equals:"]=1;
  64080. //>>excludeEnd("ctx");
  64081. $2=_st(d)._at_ifAbsent_("hello",(function(){
  64082. return nil;
  64083. }));
  64084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64085. $ctx1.sendIdx["at:ifAbsent:"]=1;
  64086. //>>excludeEnd("ctx");
  64087. self._assert_equals_($2,"world");
  64088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64089. $ctx1.sendIdx["assert:equals:"]=2;
  64090. //>>excludeEnd("ctx");
  64091. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  64092. return nil;
  64093. }))).__eq("world"));
  64094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64095. $ctx1.sendIdx["deny:"]=1;
  64096. //>>excludeEnd("ctx");
  64097. $3=_st(d)._includesKey_("hello");
  64098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64099. $ctx1.sendIdx["includesKey:"]=1;
  64100. //>>excludeEnd("ctx");
  64101. self._assert_($3);
  64102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64103. $ctx1.sendIdx["assert:"]=1;
  64104. //>>excludeEnd("ctx");
  64105. $4=_st(d)._includesKey_("foo");
  64106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64107. $ctx1.sendIdx["includesKey:"]=2;
  64108. //>>excludeEnd("ctx");
  64109. self._deny_($4);
  64110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64111. $ctx1.sendIdx["deny:"]=2;
  64112. //>>excludeEnd("ctx");
  64113. _st(d)._at_put_((1),(2));
  64114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64115. $ctx1.sendIdx["at:put:"]=2;
  64116. //>>excludeEnd("ctx");
  64117. $5=_st(d)._at_((1));
  64118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64119. $ctx1.sendIdx["at:"]=2;
  64120. //>>excludeEnd("ctx");
  64121. self._assert_equals_($5,(2));
  64122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64123. $ctx1.sendIdx["assert:equals:"]=3;
  64124. //>>excludeEnd("ctx");
  64125. $6=d;
  64126. $7=(1).__at((3));
  64127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64128. $ctx1.sendIdx["@"]=1;
  64129. //>>excludeEnd("ctx");
  64130. _st($6)._at_put_($7,(3));
  64131. $9=d;
  64132. $10=(1).__at((3));
  64133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64134. $ctx1.sendIdx["@"]=2;
  64135. //>>excludeEnd("ctx");
  64136. $8=_st($9)._at_($10);
  64137. self._assert_equals_($8,(3));
  64138. $12=d;
  64139. $13=(1).__at((3));
  64140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64141. $ctx1.sendIdx["@"]=3;
  64142. //>>excludeEnd("ctx");
  64143. $11=_st($12)._includesKey_($13);
  64144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64145. $ctx1.sendIdx["includesKey:"]=3;
  64146. //>>excludeEnd("ctx");
  64147. self._assert_($11);
  64148. self._deny_(_st(d)._includesKey_((3).__at((1))));
  64149. return self;
  64150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64151. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)});
  64152. //>>excludeEnd("ctx");
  64153. },
  64154. //>>excludeStart("ide", pragmas.excludeIdeData);
  64155. args: [],
  64156. 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)",
  64157. referencedClasses: ["Dictionary"],
  64158. //>>excludeEnd("ide");
  64159. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  64160. }),
  64161. globals.DictionaryTest);
  64162. smalltalk.addMethod(
  64163. smalltalk.method({
  64164. selector: "testDynamicDictionaries",
  64165. protocol: 'tests',
  64166. fn: function (){
  64167. var self=this;
  64168. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64170. return smalltalk.withContext(function($ctx1) {
  64171. //>>excludeEnd("ctx");
  64172. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  64173. return self;
  64174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64175. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)});
  64176. //>>excludeEnd("ctx");
  64177. },
  64178. //>>excludeStart("ide", pragmas.excludeIdeData);
  64179. args: [],
  64180. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  64181. referencedClasses: ["Dictionary"],
  64182. //>>excludeEnd("ide");
  64183. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  64184. }),
  64185. globals.DictionaryTest);
  64186. smalltalk.addMethod(
  64187. smalltalk.method({
  64188. selector: "collectionClass",
  64189. protocol: 'fixture',
  64190. fn: function (){
  64191. var self=this;
  64192. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  64193. return $Dictionary();
  64194. },
  64195. //>>excludeStart("ide", pragmas.excludeIdeData);
  64196. args: [],
  64197. source: "collectionClass\x0a\x09^ Dictionary",
  64198. referencedClasses: ["Dictionary"],
  64199. //>>excludeEnd("ide");
  64200. messageSends: []
  64201. }),
  64202. globals.DictionaryTest.klass);
  64203. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  64204. smalltalk.addMethod(
  64205. smalltalk.method({
  64206. selector: "collection",
  64207. protocol: 'fixture',
  64208. fn: function (){
  64209. var self=this;
  64210. var $1;
  64211. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  64212. return $1;
  64213. },
  64214. //>>excludeStart("ide", pragmas.excludeIdeData);
  64215. args: [],
  64216. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  64217. referencedClasses: [],
  64218. //>>excludeEnd("ide");
  64219. messageSends: []
  64220. }),
  64221. globals.HashedCollectionTest);
  64222. smalltalk.addMethod(
  64223. smalltalk.method({
  64224. selector: "collectionKeys",
  64225. protocol: 'fixture',
  64226. fn: function (){
  64227. var self=this;
  64228. var $1;
  64229. $1=["b","a","c","d"];
  64230. return $1;
  64231. },
  64232. //>>excludeStart("ide", pragmas.excludeIdeData);
  64233. args: [],
  64234. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  64235. referencedClasses: [],
  64236. //>>excludeEnd("ide");
  64237. messageSends: []
  64238. }),
  64239. globals.HashedCollectionTest);
  64240. smalltalk.addMethod(
  64241. smalltalk.method({
  64242. selector: "collectionOfPrintStrings",
  64243. protocol: 'fixture',
  64244. fn: function (){
  64245. var self=this;
  64246. var $1;
  64247. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  64248. return $1;
  64249. },
  64250. //>>excludeStart("ide", pragmas.excludeIdeData);
  64251. args: [],
  64252. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  64253. referencedClasses: [],
  64254. //>>excludeEnd("ide");
  64255. messageSends: []
  64256. }),
  64257. globals.HashedCollectionTest);
  64258. smalltalk.addMethod(
  64259. smalltalk.method({
  64260. selector: "collectionSize",
  64261. protocol: 'fixture',
  64262. fn: function (){
  64263. var self=this;
  64264. return (4);
  64265. },
  64266. //>>excludeStart("ide", pragmas.excludeIdeData);
  64267. args: [],
  64268. source: "collectionSize\x0a\x09^ 4",
  64269. referencedClasses: [],
  64270. //>>excludeEnd("ide");
  64271. messageSends: []
  64272. }),
  64273. globals.HashedCollectionTest);
  64274. smalltalk.addMethod(
  64275. smalltalk.method({
  64276. selector: "collectionValues",
  64277. protocol: 'fixture',
  64278. fn: function (){
  64279. var self=this;
  64280. var $1;
  64281. $1=[(1),(2),(3),(-4)];
  64282. return $1;
  64283. },
  64284. //>>excludeStart("ide", pragmas.excludeIdeData);
  64285. args: [],
  64286. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  64287. referencedClasses: [],
  64288. //>>excludeEnd("ide");
  64289. messageSends: []
  64290. }),
  64291. globals.HashedCollectionTest);
  64292. smalltalk.addMethod(
  64293. smalltalk.method({
  64294. selector: "collectionWithDuplicates",
  64295. protocol: 'fixture',
  64296. fn: function (){
  64297. var self=this;
  64298. var $1;
  64299. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  64300. return $1;
  64301. },
  64302. //>>excludeStart("ide", pragmas.excludeIdeData);
  64303. args: [],
  64304. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  64305. referencedClasses: [],
  64306. //>>excludeEnd("ide");
  64307. messageSends: []
  64308. }),
  64309. globals.HashedCollectionTest);
  64310. smalltalk.addMethod(
  64311. smalltalk.method({
  64312. selector: "collectionWithNewValue",
  64313. protocol: 'fixture',
  64314. fn: function (){
  64315. var self=this;
  64316. var $1;
  64317. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  64318. return $1;
  64319. },
  64320. //>>excludeStart("ide", pragmas.excludeIdeData);
  64321. args: [],
  64322. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  64323. referencedClasses: [],
  64324. //>>excludeEnd("ide");
  64325. messageSends: []
  64326. }),
  64327. globals.HashedCollectionTest);
  64328. smalltalk.addMethod(
  64329. smalltalk.method({
  64330. selector: "sampleNewValueAsCollection",
  64331. protocol: 'fixture',
  64332. fn: function (){
  64333. var self=this;
  64334. var $1;
  64335. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  64336. return $1;
  64337. },
  64338. //>>excludeStart("ide", pragmas.excludeIdeData);
  64339. args: [],
  64340. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  64341. referencedClasses: [],
  64342. //>>excludeEnd("ide");
  64343. messageSends: []
  64344. }),
  64345. globals.HashedCollectionTest);
  64346. smalltalk.addMethod(
  64347. smalltalk.method({
  64348. selector: "testDynamicDictionaries",
  64349. protocol: 'tests',
  64350. fn: function (){
  64351. var self=this;
  64352. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  64353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64354. return smalltalk.withContext(function($ctx1) {
  64355. //>>excludeEnd("ctx");
  64356. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  64357. return self;
  64358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64359. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)});
  64360. //>>excludeEnd("ctx");
  64361. },
  64362. //>>excludeStart("ide", pragmas.excludeIdeData);
  64363. args: [],
  64364. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  64365. referencedClasses: ["HashedCollection"],
  64366. //>>excludeEnd("ide");
  64367. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  64368. }),
  64369. globals.HashedCollectionTest);
  64370. smalltalk.addMethod(
  64371. smalltalk.method({
  64372. selector: "collectionClass",
  64373. protocol: 'fixture',
  64374. fn: function (){
  64375. var self=this;
  64376. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  64377. return $HashedCollection();
  64378. },
  64379. //>>excludeStart("ide", pragmas.excludeIdeData);
  64380. args: [],
  64381. source: "collectionClass\x0a\x09^ HashedCollection",
  64382. referencedClasses: ["HashedCollection"],
  64383. //>>excludeEnd("ide");
  64384. messageSends: []
  64385. }),
  64386. globals.HashedCollectionTest.klass);
  64387. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  64388. smalltalk.addMethod(
  64389. smalltalk.method({
  64390. selector: "collectionFirst",
  64391. protocol: 'fixture',
  64392. fn: function (){
  64393. var self=this;
  64394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64395. return smalltalk.withContext(function($ctx1) {
  64396. //>>excludeEnd("ctx");
  64397. self._subclassResponsibility();
  64398. return self;
  64399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64400. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)});
  64401. //>>excludeEnd("ctx");
  64402. },
  64403. //>>excludeStart("ide", pragmas.excludeIdeData);
  64404. args: [],
  64405. source: "collectionFirst\x0a\x09self subclassResponsibility",
  64406. referencedClasses: [],
  64407. //>>excludeEnd("ide");
  64408. messageSends: ["subclassResponsibility"]
  64409. }),
  64410. globals.SequenceableCollectionTest);
  64411. smalltalk.addMethod(
  64412. smalltalk.method({
  64413. selector: "collectionFirstTwo",
  64414. protocol: 'fixture',
  64415. fn: function (){
  64416. var self=this;
  64417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64418. return smalltalk.withContext(function($ctx1) {
  64419. //>>excludeEnd("ctx");
  64420. self._subclassResponsibility();
  64421. return self;
  64422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64423. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)});
  64424. //>>excludeEnd("ctx");
  64425. },
  64426. //>>excludeStart("ide", pragmas.excludeIdeData);
  64427. args: [],
  64428. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  64429. referencedClasses: [],
  64430. //>>excludeEnd("ide");
  64431. messageSends: ["subclassResponsibility"]
  64432. }),
  64433. globals.SequenceableCollectionTest);
  64434. smalltalk.addMethod(
  64435. smalltalk.method({
  64436. selector: "collectionLast",
  64437. protocol: 'fixture',
  64438. fn: function (){
  64439. var self=this;
  64440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64441. return smalltalk.withContext(function($ctx1) {
  64442. //>>excludeEnd("ctx");
  64443. self._subclassResponsibility();
  64444. return self;
  64445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64446. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)});
  64447. //>>excludeEnd("ctx");
  64448. },
  64449. //>>excludeStart("ide", pragmas.excludeIdeData);
  64450. args: [],
  64451. source: "collectionLast\x0a\x09self subclassResponsibility",
  64452. referencedClasses: [],
  64453. //>>excludeEnd("ide");
  64454. messageSends: ["subclassResponsibility"]
  64455. }),
  64456. globals.SequenceableCollectionTest);
  64457. smalltalk.addMethod(
  64458. smalltalk.method({
  64459. selector: "collectionLastTwo",
  64460. protocol: 'fixture',
  64461. fn: function (){
  64462. var self=this;
  64463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64464. return smalltalk.withContext(function($ctx1) {
  64465. //>>excludeEnd("ctx");
  64466. self._subclassResponsibility();
  64467. return self;
  64468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64469. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)});
  64470. //>>excludeEnd("ctx");
  64471. },
  64472. //>>excludeStart("ide", pragmas.excludeIdeData);
  64473. args: [],
  64474. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  64475. referencedClasses: [],
  64476. //>>excludeEnd("ide");
  64477. messageSends: ["subclassResponsibility"]
  64478. }),
  64479. globals.SequenceableCollectionTest);
  64480. smalltalk.addMethod(
  64481. smalltalk.method({
  64482. selector: "nonIndexesDo:",
  64483. protocol: 'fixture',
  64484. fn: function (aBlock){
  64485. var self=this;
  64486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64487. return smalltalk.withContext(function($ctx1) {
  64488. //>>excludeEnd("ctx");
  64489. _st(aBlock)._value_((0));
  64490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64491. $ctx1.sendIdx["value:"]=1;
  64492. //>>excludeEnd("ctx");
  64493. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  64494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64495. $ctx1.sendIdx["value:"]=2;
  64496. //>>excludeEnd("ctx");
  64497. _st(aBlock)._value_("z");
  64498. return self;
  64499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64500. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  64501. //>>excludeEnd("ctx");
  64502. },
  64503. //>>excludeStart("ide", pragmas.excludeIdeData);
  64504. args: ["aBlock"],
  64505. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  64506. referencedClasses: [],
  64507. //>>excludeEnd("ide");
  64508. messageSends: ["value:", "+", "collectionSize"]
  64509. }),
  64510. globals.SequenceableCollectionTest);
  64511. smalltalk.addMethod(
  64512. smalltalk.method({
  64513. selector: "samplesDo:",
  64514. protocol: 'fixture',
  64515. fn: function (aBlock){
  64516. var self=this;
  64517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64518. return smalltalk.withContext(function($ctx1) {
  64519. //>>excludeEnd("ctx");
  64520. _st(aBlock)._value_value_((1),self._collectionFirst());
  64521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64522. $ctx1.sendIdx["value:value:"]=1;
  64523. //>>excludeEnd("ctx");
  64524. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  64525. return self;
  64526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64527. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)});
  64528. //>>excludeEnd("ctx");
  64529. },
  64530. //>>excludeStart("ide", pragmas.excludeIdeData);
  64531. args: ["aBlock"],
  64532. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  64533. referencedClasses: [],
  64534. //>>excludeEnd("ide");
  64535. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  64536. }),
  64537. globals.SequenceableCollectionTest);
  64538. smalltalk.addMethod(
  64539. smalltalk.method({
  64540. selector: "testBeginsWith",
  64541. protocol: 'tests',
  64542. fn: function (){
  64543. var self=this;
  64544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64545. return smalltalk.withContext(function($ctx1) {
  64546. //>>excludeEnd("ctx");
  64547. var $2,$1,$4,$5,$3,$7,$6;
  64548. $2=self._collection();
  64549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64550. $ctx1.sendIdx["collection"]=1;
  64551. //>>excludeEnd("ctx");
  64552. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  64553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64554. $ctx1.sendIdx["beginsWith:"]=1;
  64555. //>>excludeEnd("ctx");
  64556. self._assert_($1);
  64557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64558. $ctx1.sendIdx["assert:"]=1;
  64559. //>>excludeEnd("ctx");
  64560. $4=self._collection();
  64561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64562. $ctx1.sendIdx["collection"]=2;
  64563. //>>excludeEnd("ctx");
  64564. $5=self._collection();
  64565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64566. $ctx1.sendIdx["collection"]=3;
  64567. //>>excludeEnd("ctx");
  64568. $3=_st($4)._beginsWith_($5);
  64569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64570. $ctx1.sendIdx["beginsWith:"]=2;
  64571. //>>excludeEnd("ctx");
  64572. self._assert_($3);
  64573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64574. $ctx1.sendIdx["assert:"]=2;
  64575. //>>excludeEnd("ctx");
  64576. $7=self._collection();
  64577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64578. $ctx1.sendIdx["collection"]=4;
  64579. //>>excludeEnd("ctx");
  64580. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  64581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64582. $ctx1.sendIdx["beginsWith:"]=3;
  64583. //>>excludeEnd("ctx");
  64584. self._assert_($6);
  64585. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  64586. return self;
  64587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64588. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)});
  64589. //>>excludeEnd("ctx");
  64590. },
  64591. //>>excludeStart("ide", pragmas.excludeIdeData);
  64592. args: [],
  64593. 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)",
  64594. referencedClasses: [],
  64595. //>>excludeEnd("ide");
  64596. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  64597. }),
  64598. globals.SequenceableCollectionTest);
  64599. smalltalk.addMethod(
  64600. smalltalk.method({
  64601. selector: "testEndsWith",
  64602. protocol: 'tests',
  64603. fn: function (){
  64604. var self=this;
  64605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64606. return smalltalk.withContext(function($ctx1) {
  64607. //>>excludeEnd("ctx");
  64608. var $2,$1,$4,$5,$3,$7,$6;
  64609. $2=self._collection();
  64610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64611. $ctx1.sendIdx["collection"]=1;
  64612. //>>excludeEnd("ctx");
  64613. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  64614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64615. $ctx1.sendIdx["endsWith:"]=1;
  64616. //>>excludeEnd("ctx");
  64617. self._assert_($1);
  64618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64619. $ctx1.sendIdx["assert:"]=1;
  64620. //>>excludeEnd("ctx");
  64621. $4=self._collection();
  64622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64623. $ctx1.sendIdx["collection"]=2;
  64624. //>>excludeEnd("ctx");
  64625. $5=self._collection();
  64626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64627. $ctx1.sendIdx["collection"]=3;
  64628. //>>excludeEnd("ctx");
  64629. $3=_st($4)._endsWith_($5);
  64630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64631. $ctx1.sendIdx["endsWith:"]=2;
  64632. //>>excludeEnd("ctx");
  64633. self._assert_($3);
  64634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64635. $ctx1.sendIdx["assert:"]=2;
  64636. //>>excludeEnd("ctx");
  64637. $7=self._collection();
  64638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64639. $ctx1.sendIdx["collection"]=4;
  64640. //>>excludeEnd("ctx");
  64641. $6=_st($7)._endsWith_(self._collectionLastTwo());
  64642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64643. $ctx1.sendIdx["endsWith:"]=3;
  64644. //>>excludeEnd("ctx");
  64645. self._assert_($6);
  64646. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  64647. return self;
  64648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64649. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)});
  64650. //>>excludeEnd("ctx");
  64651. },
  64652. //>>excludeStart("ide", pragmas.excludeIdeData);
  64653. args: [],
  64654. 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)",
  64655. referencedClasses: [],
  64656. //>>excludeEnd("ide");
  64657. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  64658. }),
  64659. globals.SequenceableCollectionTest);
  64660. smalltalk.addMethod(
  64661. smalltalk.method({
  64662. selector: "testFirst",
  64663. protocol: 'tests',
  64664. fn: function (){
  64665. var self=this;
  64666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64667. return smalltalk.withContext(function($ctx1) {
  64668. //>>excludeEnd("ctx");
  64669. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  64670. return self;
  64671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64672. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)});
  64673. //>>excludeEnd("ctx");
  64674. },
  64675. //>>excludeStart("ide", pragmas.excludeIdeData);
  64676. args: [],
  64677. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  64678. referencedClasses: [],
  64679. //>>excludeEnd("ide");
  64680. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  64681. }),
  64682. globals.SequenceableCollectionTest);
  64683. smalltalk.addMethod(
  64684. smalltalk.method({
  64685. selector: "testFirstN",
  64686. protocol: 'tests',
  64687. fn: function (){
  64688. var self=this;
  64689. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  64690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64691. return smalltalk.withContext(function($ctx1) {
  64692. //>>excludeEnd("ctx");
  64693. var $2,$1,$4,$3,$6,$5,$7;
  64694. $2=self._collection();
  64695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64696. $ctx1.sendIdx["collection"]=1;
  64697. //>>excludeEnd("ctx");
  64698. $1=_st($2)._first_((2));
  64699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64700. $ctx1.sendIdx["first:"]=1;
  64701. //>>excludeEnd("ctx");
  64702. self._assert_equals_($1,self._collectionFirstTwo());
  64703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64704. $ctx1.sendIdx["assert:equals:"]=1;
  64705. //>>excludeEnd("ctx");
  64706. $4=self._collection();
  64707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64708. $ctx1.sendIdx["collection"]=2;
  64709. //>>excludeEnd("ctx");
  64710. $3=_st($4)._first_((0));
  64711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64712. $ctx1.sendIdx["first:"]=2;
  64713. //>>excludeEnd("ctx");
  64714. self._assert_equals_($3,_st(self._collectionClass())._new());
  64715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64716. $ctx1.sendIdx["assert:equals:"]=2;
  64717. //>>excludeEnd("ctx");
  64718. $6=self._collection();
  64719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64720. $ctx1.sendIdx["collection"]=3;
  64721. //>>excludeEnd("ctx");
  64722. $5=_st($6)._first_(self._collectionSize());
  64723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64724. $ctx1.sendIdx["first:"]=3;
  64725. //>>excludeEnd("ctx");
  64726. $7=self._collection();
  64727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64728. $ctx1.sendIdx["collection"]=4;
  64729. //>>excludeEnd("ctx");
  64730. self._assert_equals_($5,$7);
  64731. self._should_raise_((function(){
  64732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64733. return smalltalk.withContext(function($ctx2) {
  64734. //>>excludeEnd("ctx");
  64735. return _st(self._collection())._first_((33));
  64736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64738. //>>excludeEnd("ctx");
  64739. }),$Error());
  64740. return self;
  64741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64742. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)});
  64743. //>>excludeEnd("ctx");
  64744. },
  64745. //>>excludeStart("ide", pragmas.excludeIdeData);
  64746. args: [],
  64747. 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",
  64748. referencedClasses: ["Error"],
  64749. //>>excludeEnd("ide");
  64750. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  64751. }),
  64752. globals.SequenceableCollectionTest);
  64753. smalltalk.addMethod(
  64754. smalltalk.method({
  64755. selector: "testFourth",
  64756. protocol: 'tests',
  64757. fn: function (){
  64758. var self=this;
  64759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64760. return smalltalk.withContext(function($ctx1) {
  64761. //>>excludeEnd("ctx");
  64762. var $2,$1;
  64763. $2=self._collection();
  64764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64765. $ctx1.sendIdx["collection"]=1;
  64766. //>>excludeEnd("ctx");
  64767. $1=_st($2)._fourth();
  64768. self._assert_equals_($1,_st(self._collection())._at_((4)));
  64769. return self;
  64770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64771. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)});
  64772. //>>excludeEnd("ctx");
  64773. },
  64774. //>>excludeStart("ide", pragmas.excludeIdeData);
  64775. args: [],
  64776. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  64777. referencedClasses: [],
  64778. //>>excludeEnd("ide");
  64779. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  64780. }),
  64781. globals.SequenceableCollectionTest);
  64782. smalltalk.addMethod(
  64783. smalltalk.method({
  64784. selector: "testIndexOfStartingAt",
  64785. protocol: 'tests',
  64786. fn: function (){
  64787. var self=this;
  64788. var jsNull;
  64789. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  64790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64791. return smalltalk.withContext(function($ctx1) {
  64792. //>>excludeEnd("ctx");
  64793. var $2,$1,$4,$3;
  64794. jsNull=_st($JSON())._parse_("null");
  64795. self._samplesDo_((function(index,value){
  64796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64797. return smalltalk.withContext(function($ctx2) {
  64798. //>>excludeEnd("ctx");
  64799. $2=self._collection();
  64800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64801. $ctx2.sendIdx["collection"]=1;
  64802. //>>excludeEnd("ctx");
  64803. $1=_st($2)._indexOf_startingAt_(value,(1));
  64804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64805. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  64806. //>>excludeEnd("ctx");
  64807. self._assert_equals_($1,index);
  64808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64809. $ctx2.sendIdx["assert:equals:"]=1;
  64810. //>>excludeEnd("ctx");
  64811. $4=self._collection();
  64812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64813. $ctx2.sendIdx["collection"]=2;
  64814. //>>excludeEnd("ctx");
  64815. $3=_st($4)._indexOf_startingAt_(value,index);
  64816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64817. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  64818. //>>excludeEnd("ctx");
  64819. self._assert_equals_($3,index);
  64820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64821. $ctx2.sendIdx["assert:equals:"]=2;
  64822. //>>excludeEnd("ctx");
  64823. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  64824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64825. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  64826. //>>excludeEnd("ctx");
  64827. }));
  64828. return self;
  64829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64830. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  64831. //>>excludeEnd("ctx");
  64832. },
  64833. //>>excludeStart("ide", pragmas.excludeIdeData);
  64834. args: [],
  64835. 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 ]",
  64836. referencedClasses: ["JSON"],
  64837. //>>excludeEnd("ide");
  64838. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  64839. }),
  64840. globals.SequenceableCollectionTest);
  64841. smalltalk.addMethod(
  64842. smalltalk.method({
  64843. selector: "testIndexOfStartingAtWithNull",
  64844. protocol: 'tests',
  64845. fn: function (){
  64846. var self=this;
  64847. var jsNull;
  64848. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  64849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64850. return smalltalk.withContext(function($ctx1) {
  64851. //>>excludeEnd("ctx");
  64852. var $1,$2;
  64853. jsNull=_st($JSON())._parse_("null");
  64854. self._samplesDo_((function(index,value){
  64855. var collection;
  64856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64857. return smalltalk.withContext(function($ctx2) {
  64858. //>>excludeEnd("ctx");
  64859. collection=self._collection();
  64860. collection;
  64861. _st(collection)._at_put_(index,jsNull);
  64862. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  64863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64864. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  64865. //>>excludeEnd("ctx");
  64866. self._assert_equals_($1,index);
  64867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64868. $ctx2.sendIdx["assert:equals:"]=1;
  64869. //>>excludeEnd("ctx");
  64870. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  64871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64872. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  64873. //>>excludeEnd("ctx");
  64874. self._assert_equals_($2,index);
  64875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64876. $ctx2.sendIdx["assert:equals:"]=2;
  64877. //>>excludeEnd("ctx");
  64878. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  64879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64880. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  64881. //>>excludeEnd("ctx");
  64882. }));
  64883. return self;
  64884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64885. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)});
  64886. //>>excludeEnd("ctx");
  64887. },
  64888. //>>excludeStart("ide", pragmas.excludeIdeData);
  64889. args: [],
  64890. 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 ]",
  64891. referencedClasses: ["JSON"],
  64892. //>>excludeEnd("ide");
  64893. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  64894. }),
  64895. globals.SequenceableCollectionTest);
  64896. smalltalk.addMethod(
  64897. smalltalk.method({
  64898. selector: "testLast",
  64899. protocol: 'tests',
  64900. fn: function (){
  64901. var self=this;
  64902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64903. return smalltalk.withContext(function($ctx1) {
  64904. //>>excludeEnd("ctx");
  64905. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  64906. return self;
  64907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64908. }, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)});
  64909. //>>excludeEnd("ctx");
  64910. },
  64911. //>>excludeStart("ide", pragmas.excludeIdeData);
  64912. args: [],
  64913. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  64914. referencedClasses: [],
  64915. //>>excludeEnd("ide");
  64916. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  64917. }),
  64918. globals.SequenceableCollectionTest);
  64919. smalltalk.addMethod(
  64920. smalltalk.method({
  64921. selector: "testLastN",
  64922. protocol: 'tests',
  64923. fn: function (){
  64924. var self=this;
  64925. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  64926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64927. return smalltalk.withContext(function($ctx1) {
  64928. //>>excludeEnd("ctx");
  64929. var $2,$1,$4,$3,$6,$5,$7;
  64930. $2=self._collection();
  64931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64932. $ctx1.sendIdx["collection"]=1;
  64933. //>>excludeEnd("ctx");
  64934. $1=_st($2)._last_((2));
  64935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64936. $ctx1.sendIdx["last:"]=1;
  64937. //>>excludeEnd("ctx");
  64938. self._assert_equals_($1,self._collectionLastTwo());
  64939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64940. $ctx1.sendIdx["assert:equals:"]=1;
  64941. //>>excludeEnd("ctx");
  64942. $4=self._collection();
  64943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64944. $ctx1.sendIdx["collection"]=2;
  64945. //>>excludeEnd("ctx");
  64946. $3=_st($4)._last_((0));
  64947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64948. $ctx1.sendIdx["last:"]=2;
  64949. //>>excludeEnd("ctx");
  64950. self._assert_equals_($3,_st(self._collectionClass())._new());
  64951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64952. $ctx1.sendIdx["assert:equals:"]=2;
  64953. //>>excludeEnd("ctx");
  64954. $6=self._collection();
  64955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64956. $ctx1.sendIdx["collection"]=3;
  64957. //>>excludeEnd("ctx");
  64958. $5=_st($6)._last_(self._collectionSize());
  64959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64960. $ctx1.sendIdx["last:"]=3;
  64961. //>>excludeEnd("ctx");
  64962. $7=self._collection();
  64963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64964. $ctx1.sendIdx["collection"]=4;
  64965. //>>excludeEnd("ctx");
  64966. self._assert_equals_($5,$7);
  64967. self._should_raise_((function(){
  64968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64969. return smalltalk.withContext(function($ctx2) {
  64970. //>>excludeEnd("ctx");
  64971. return _st(self._collection())._last_((33));
  64972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64973. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64974. //>>excludeEnd("ctx");
  64975. }),$Error());
  64976. return self;
  64977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64978. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)});
  64979. //>>excludeEnd("ctx");
  64980. },
  64981. //>>excludeStart("ide", pragmas.excludeIdeData);
  64982. args: [],
  64983. 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",
  64984. referencedClasses: ["Error"],
  64985. //>>excludeEnd("ide");
  64986. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  64987. }),
  64988. globals.SequenceableCollectionTest);
  64989. smalltalk.addMethod(
  64990. smalltalk.method({
  64991. selector: "testSecond",
  64992. protocol: 'tests',
  64993. fn: function (){
  64994. var self=this;
  64995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64996. return smalltalk.withContext(function($ctx1) {
  64997. //>>excludeEnd("ctx");
  64998. var $2,$1;
  64999. $2=self._collection();
  65000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65001. $ctx1.sendIdx["collection"]=1;
  65002. //>>excludeEnd("ctx");
  65003. $1=_st($2)._second();
  65004. self._assert_equals_($1,_st(self._collection())._at_((2)));
  65005. return self;
  65006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65007. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)});
  65008. //>>excludeEnd("ctx");
  65009. },
  65010. //>>excludeStart("ide", pragmas.excludeIdeData);
  65011. args: [],
  65012. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  65013. referencedClasses: [],
  65014. //>>excludeEnd("ide");
  65015. messageSends: ["assert:equals:", "second", "collection", "at:"]
  65016. }),
  65017. globals.SequenceableCollectionTest);
  65018. smalltalk.addMethod(
  65019. smalltalk.method({
  65020. selector: "testThird",
  65021. protocol: 'tests',
  65022. fn: function (){
  65023. var self=this;
  65024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65025. return smalltalk.withContext(function($ctx1) {
  65026. //>>excludeEnd("ctx");
  65027. var $2,$1;
  65028. $2=self._collection();
  65029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65030. $ctx1.sendIdx["collection"]=1;
  65031. //>>excludeEnd("ctx");
  65032. $1=_st($2)._third();
  65033. self._assert_equals_($1,_st(self._collection())._at_((3)));
  65034. return self;
  65035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65036. }, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)});
  65037. //>>excludeEnd("ctx");
  65038. },
  65039. //>>excludeStart("ide", pragmas.excludeIdeData);
  65040. args: [],
  65041. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  65042. referencedClasses: [],
  65043. //>>excludeEnd("ide");
  65044. messageSends: ["assert:equals:", "third", "collection", "at:"]
  65045. }),
  65046. globals.SequenceableCollectionTest);
  65047. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  65048. smalltalk.addMethod(
  65049. smalltalk.method({
  65050. selector: "collection",
  65051. protocol: 'fixture',
  65052. fn: function (){
  65053. var self=this;
  65054. var $1;
  65055. $1=[(1), (2), (3), (-4)];
  65056. return $1;
  65057. },
  65058. //>>excludeStart("ide", pragmas.excludeIdeData);
  65059. args: [],
  65060. source: "collection\x0a\x09^ #(1 2 3 -4)",
  65061. referencedClasses: [],
  65062. //>>excludeEnd("ide");
  65063. messageSends: []
  65064. }),
  65065. globals.ArrayTest);
  65066. smalltalk.addMethod(
  65067. smalltalk.method({
  65068. selector: "collectionFirst",
  65069. protocol: 'fixture',
  65070. fn: function (){
  65071. var self=this;
  65072. return (1);
  65073. },
  65074. //>>excludeStart("ide", pragmas.excludeIdeData);
  65075. args: [],
  65076. source: "collectionFirst\x0a\x09^ 1",
  65077. referencedClasses: [],
  65078. //>>excludeEnd("ide");
  65079. messageSends: []
  65080. }),
  65081. globals.ArrayTest);
  65082. smalltalk.addMethod(
  65083. smalltalk.method({
  65084. selector: "collectionFirstTwo",
  65085. protocol: 'fixture',
  65086. fn: function (){
  65087. var self=this;
  65088. var $1;
  65089. $1=[(1), (2)];
  65090. return $1;
  65091. },
  65092. //>>excludeStart("ide", pragmas.excludeIdeData);
  65093. args: [],
  65094. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  65095. referencedClasses: [],
  65096. //>>excludeEnd("ide");
  65097. messageSends: []
  65098. }),
  65099. globals.ArrayTest);
  65100. smalltalk.addMethod(
  65101. smalltalk.method({
  65102. selector: "collectionLast",
  65103. protocol: 'fixture',
  65104. fn: function (){
  65105. var self=this;
  65106. return (-4);
  65107. },
  65108. //>>excludeStart("ide", pragmas.excludeIdeData);
  65109. args: [],
  65110. source: "collectionLast\x0a\x09^ -4",
  65111. referencedClasses: [],
  65112. //>>excludeEnd("ide");
  65113. messageSends: []
  65114. }),
  65115. globals.ArrayTest);
  65116. smalltalk.addMethod(
  65117. smalltalk.method({
  65118. selector: "collectionLastTwo",
  65119. protocol: 'fixture',
  65120. fn: function (){
  65121. var self=this;
  65122. var $1;
  65123. $1=[(3), (-4)];
  65124. return $1;
  65125. },
  65126. //>>excludeStart("ide", pragmas.excludeIdeData);
  65127. args: [],
  65128. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  65129. referencedClasses: [],
  65130. //>>excludeEnd("ide");
  65131. messageSends: []
  65132. }),
  65133. globals.ArrayTest);
  65134. smalltalk.addMethod(
  65135. smalltalk.method({
  65136. selector: "collectionOfPrintStrings",
  65137. protocol: 'fixture',
  65138. fn: function (){
  65139. var self=this;
  65140. var $1;
  65141. $1=["1", "2", "3", "-4"];
  65142. return $1;
  65143. },
  65144. //>>excludeStart("ide", pragmas.excludeIdeData);
  65145. args: [],
  65146. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  65147. referencedClasses: [],
  65148. //>>excludeEnd("ide");
  65149. messageSends: []
  65150. }),
  65151. globals.ArrayTest);
  65152. smalltalk.addMethod(
  65153. smalltalk.method({
  65154. selector: "collectionSize",
  65155. protocol: 'fixture',
  65156. fn: function (){
  65157. var self=this;
  65158. return (4);
  65159. },
  65160. //>>excludeStart("ide", pragmas.excludeIdeData);
  65161. args: [],
  65162. source: "collectionSize\x0a\x09^ 4",
  65163. referencedClasses: [],
  65164. //>>excludeEnd("ide");
  65165. messageSends: []
  65166. }),
  65167. globals.ArrayTest);
  65168. smalltalk.addMethod(
  65169. smalltalk.method({
  65170. selector: "collectionWithDuplicates",
  65171. protocol: 'fixture',
  65172. fn: function (){
  65173. var self=this;
  65174. var $1;
  65175. $1=["a", "b", "c", (1), (2), (1), "a"];
  65176. return $1;
  65177. },
  65178. //>>excludeStart("ide", pragmas.excludeIdeData);
  65179. args: [],
  65180. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  65181. referencedClasses: [],
  65182. //>>excludeEnd("ide");
  65183. messageSends: []
  65184. }),
  65185. globals.ArrayTest);
  65186. smalltalk.addMethod(
  65187. smalltalk.method({
  65188. selector: "collectionWithNewValue",
  65189. protocol: 'fixture',
  65190. fn: function (){
  65191. var self=this;
  65192. var $1;
  65193. $1=[(1), (2), (3), (-4), "N"];
  65194. return $1;
  65195. },
  65196. //>>excludeStart("ide", pragmas.excludeIdeData);
  65197. args: [],
  65198. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  65199. referencedClasses: [],
  65200. //>>excludeEnd("ide");
  65201. messageSends: []
  65202. }),
  65203. globals.ArrayTest);
  65204. smalltalk.addMethod(
  65205. smalltalk.method({
  65206. selector: "sampleNewIndex",
  65207. protocol: 'fixture',
  65208. fn: function (){
  65209. var self=this;
  65210. return (5);
  65211. },
  65212. //>>excludeStart("ide", pragmas.excludeIdeData);
  65213. args: [],
  65214. source: "sampleNewIndex\x0a\x09^ 5",
  65215. referencedClasses: [],
  65216. //>>excludeEnd("ide");
  65217. messageSends: []
  65218. }),
  65219. globals.ArrayTest);
  65220. smalltalk.addMethod(
  65221. smalltalk.method({
  65222. selector: "samplesDo:",
  65223. protocol: 'fixture',
  65224. fn: function (aBlock){
  65225. var self=this;
  65226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65227. return smalltalk.withContext(function($ctx1) {
  65228. //>>excludeEnd("ctx");
  65229. (
  65230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65231. $ctx1.supercall = true,
  65232. //>>excludeEnd("ctx");
  65233. globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  65234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65235. $ctx1.supercall = false;
  65236. //>>excludeEnd("ctx");;
  65237. _st(aBlock)._value_value_((3),(3));
  65238. return self;
  65239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65240. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)});
  65241. //>>excludeEnd("ctx");
  65242. },
  65243. //>>excludeStart("ide", pragmas.excludeIdeData);
  65244. args: ["aBlock"],
  65245. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  65246. referencedClasses: [],
  65247. //>>excludeEnd("ide");
  65248. messageSends: ["samplesDo:", "value:value:"]
  65249. }),
  65250. globals.ArrayTest);
  65251. smalltalk.addMethod(
  65252. smalltalk.method({
  65253. selector: "testAdd",
  65254. protocol: 'tests',
  65255. fn: function (){
  65256. var self=this;
  65257. var array;
  65258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65259. return smalltalk.withContext(function($ctx1) {
  65260. //>>excludeEnd("ctx");
  65261. array=self._collection();
  65262. _st(array)._add_((6));
  65263. self._assert_equals_(_st(array)._last(),(6));
  65264. return self;
  65265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65266. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)});
  65267. //>>excludeEnd("ctx");
  65268. },
  65269. //>>excludeStart("ide", pragmas.excludeIdeData);
  65270. args: [],
  65271. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  65272. referencedClasses: [],
  65273. //>>excludeEnd("ide");
  65274. messageSends: ["collection", "add:", "assert:equals:", "last"]
  65275. }),
  65276. globals.ArrayTest);
  65277. smalltalk.addMethod(
  65278. smalltalk.method({
  65279. selector: "testAddFirst",
  65280. protocol: 'tests',
  65281. fn: function (){
  65282. var self=this;
  65283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65284. return smalltalk.withContext(function($ctx1) {
  65285. //>>excludeEnd("ctx");
  65286. var $1,$2;
  65287. $1=self._collection();
  65288. _st($1)._addFirst_((0));
  65289. $2=_st($1)._yourself();
  65290. self._assert_equals_(_st($2)._first(),(0));
  65291. return self;
  65292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65293. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)});
  65294. //>>excludeEnd("ctx");
  65295. },
  65296. //>>excludeStart("ide", pragmas.excludeIdeData);
  65297. args: [],
  65298. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  65299. referencedClasses: [],
  65300. //>>excludeEnd("ide");
  65301. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  65302. }),
  65303. globals.ArrayTest);
  65304. smalltalk.addMethod(
  65305. smalltalk.method({
  65306. selector: "testPrintString",
  65307. protocol: 'tests',
  65308. fn: function (){
  65309. var self=this;
  65310. var array;
  65311. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  65312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65313. return smalltalk.withContext(function($ctx1) {
  65314. //>>excludeEnd("ctx");
  65315. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  65316. array=_st($Array())._new();
  65317. $1=_st(array)._printString();
  65318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65319. $ctx1.sendIdx["printString"]=1;
  65320. //>>excludeEnd("ctx");
  65321. self._assert_equals_($1,"an Array ()");
  65322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65323. $ctx1.sendIdx["assert:equals:"]=1;
  65324. //>>excludeEnd("ctx");
  65325. $2=array;
  65326. _st($2)._add_((1));
  65327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65328. $ctx1.sendIdx["add:"]=1;
  65329. //>>excludeEnd("ctx");
  65330. $3=_st($2)._add_((3));
  65331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65332. $ctx1.sendIdx["add:"]=2;
  65333. //>>excludeEnd("ctx");
  65334. $4=_st(array)._printString();
  65335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65336. $ctx1.sendIdx["printString"]=2;
  65337. //>>excludeEnd("ctx");
  65338. self._assert_equals_($4,"an Array (1 3)");
  65339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65340. $ctx1.sendIdx["assert:equals:"]=2;
  65341. //>>excludeEnd("ctx");
  65342. _st(array)._add_("foo");
  65343. $5=_st(array)._printString();
  65344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65345. $ctx1.sendIdx["printString"]=3;
  65346. //>>excludeEnd("ctx");
  65347. self._assert_equals_($5,"an Array (1 3 'foo')");
  65348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65349. $ctx1.sendIdx["assert:equals:"]=3;
  65350. //>>excludeEnd("ctx");
  65351. $6=array;
  65352. _st($6)._remove_((1));
  65353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65354. $ctx1.sendIdx["remove:"]=1;
  65355. //>>excludeEnd("ctx");
  65356. $7=_st($6)._remove_((3));
  65357. $8=_st(array)._printString();
  65358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65359. $ctx1.sendIdx["printString"]=4;
  65360. //>>excludeEnd("ctx");
  65361. self._assert_equals_($8,"an Array ('foo')");
  65362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65363. $ctx1.sendIdx["assert:equals:"]=4;
  65364. //>>excludeEnd("ctx");
  65365. _st(array)._addLast_((3));
  65366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65367. $ctx1.sendIdx["addLast:"]=1;
  65368. //>>excludeEnd("ctx");
  65369. $9=_st(array)._printString();
  65370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65371. $ctx1.sendIdx["printString"]=5;
  65372. //>>excludeEnd("ctx");
  65373. self._assert_equals_($9,"an Array ('foo' 3)");
  65374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65375. $ctx1.sendIdx["assert:equals:"]=5;
  65376. //>>excludeEnd("ctx");
  65377. _st(array)._addLast_((3));
  65378. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  65379. return self;
  65380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65381. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)});
  65382. //>>excludeEnd("ctx");
  65383. },
  65384. //>>excludeStart("ide", pragmas.excludeIdeData);
  65385. args: [],
  65386. 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)'.",
  65387. referencedClasses: ["Array"],
  65388. //>>excludeEnd("ide");
  65389. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  65390. }),
  65391. globals.ArrayTest);
  65392. smalltalk.addMethod(
  65393. smalltalk.method({
  65394. selector: "testRemove",
  65395. protocol: 'tests',
  65396. fn: function (){
  65397. var self=this;
  65398. var array;
  65399. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65401. return smalltalk.withContext(function($ctx1) {
  65402. //>>excludeEnd("ctx");
  65403. array=[(1), (2), (3), (4), (5)];
  65404. _st(array)._remove_((3));
  65405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65406. $ctx1.sendIdx["remove:"]=1;
  65407. //>>excludeEnd("ctx");
  65408. self._assert_equals_(array,[(1), (2), (4), (5)]);
  65409. self._should_raise_((function(){
  65410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65411. return smalltalk.withContext(function($ctx2) {
  65412. //>>excludeEnd("ctx");
  65413. return _st(array)._remove_((3));
  65414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65415. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65416. //>>excludeEnd("ctx");
  65417. }),$Error());
  65418. return self;
  65419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65420. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)});
  65421. //>>excludeEnd("ctx");
  65422. },
  65423. //>>excludeStart("ide", pragmas.excludeIdeData);
  65424. args: [],
  65425. 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",
  65426. referencedClasses: ["Error"],
  65427. //>>excludeEnd("ide");
  65428. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  65429. }),
  65430. globals.ArrayTest);
  65431. smalltalk.addMethod(
  65432. smalltalk.method({
  65433. selector: "testRemoveFromTo",
  65434. protocol: 'tests',
  65435. fn: function (){
  65436. var self=this;
  65437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65438. return smalltalk.withContext(function($ctx1) {
  65439. //>>excludeEnd("ctx");
  65440. var $1,$2;
  65441. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  65442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65443. $ctx1.sendIdx["removeFrom:to:"]=1;
  65444. //>>excludeEnd("ctx");
  65445. self._assert_equals_($1,[(4)]);
  65446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65447. $ctx1.sendIdx["assert:equals:"]=1;
  65448. //>>excludeEnd("ctx");
  65449. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  65450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65451. $ctx1.sendIdx["removeFrom:to:"]=2;
  65452. //>>excludeEnd("ctx");
  65453. self._assert_equals_($2,[(1), (4)]);
  65454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65455. $ctx1.sendIdx["assert:equals:"]=2;
  65456. //>>excludeEnd("ctx");
  65457. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  65458. return self;
  65459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65460. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)});
  65461. //>>excludeEnd("ctx");
  65462. },
  65463. //>>excludeStart("ide", pragmas.excludeIdeData);
  65464. args: [],
  65465. 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)",
  65466. referencedClasses: [],
  65467. //>>excludeEnd("ide");
  65468. messageSends: ["assert:equals:", "removeFrom:to:"]
  65469. }),
  65470. globals.ArrayTest);
  65471. smalltalk.addMethod(
  65472. smalltalk.method({
  65473. selector: "testRemoveIndex",
  65474. protocol: 'tests',
  65475. fn: function (){
  65476. var self=this;
  65477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65478. return smalltalk.withContext(function($ctx1) {
  65479. //>>excludeEnd("ctx");
  65480. var $1,$2;
  65481. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  65482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65483. $ctx1.sendIdx["removeIndex:"]=1;
  65484. //>>excludeEnd("ctx");
  65485. self._assert_equals_($1,[(1), (3), (4)]);
  65486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65487. $ctx1.sendIdx["assert:equals:"]=1;
  65488. //>>excludeEnd("ctx");
  65489. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  65490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65491. $ctx1.sendIdx["removeIndex:"]=2;
  65492. //>>excludeEnd("ctx");
  65493. self._assert_equals_($2,[(2), (3), (4)]);
  65494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65495. $ctx1.sendIdx["assert:equals:"]=2;
  65496. //>>excludeEnd("ctx");
  65497. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  65498. return self;
  65499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65500. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)});
  65501. //>>excludeEnd("ctx");
  65502. },
  65503. //>>excludeStart("ide", pragmas.excludeIdeData);
  65504. args: [],
  65505. 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: #()",
  65506. referencedClasses: [],
  65507. //>>excludeEnd("ide");
  65508. messageSends: ["assert:equals:", "removeIndex:"]
  65509. }),
  65510. globals.ArrayTest);
  65511. smalltalk.addMethod(
  65512. smalltalk.method({
  65513. selector: "testRemoveLast",
  65514. protocol: 'tests',
  65515. fn: function (){
  65516. var self=this;
  65517. var array;
  65518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65519. return smalltalk.withContext(function($ctx1) {
  65520. //>>excludeEnd("ctx");
  65521. array=[(1), (2)];
  65522. _st(array)._removeLast();
  65523. self._assert_equals_(_st(array)._last(),(1));
  65524. return self;
  65525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65526. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)});
  65527. //>>excludeEnd("ctx");
  65528. },
  65529. //>>excludeStart("ide", pragmas.excludeIdeData);
  65530. args: [],
  65531. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  65532. referencedClasses: [],
  65533. //>>excludeEnd("ide");
  65534. messageSends: ["removeLast", "assert:equals:", "last"]
  65535. }),
  65536. globals.ArrayTest);
  65537. smalltalk.addMethod(
  65538. smalltalk.method({
  65539. selector: "testReversed",
  65540. protocol: 'tests',
  65541. fn: function (){
  65542. var self=this;
  65543. var array;
  65544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65545. return smalltalk.withContext(function($ctx1) {
  65546. //>>excludeEnd("ctx");
  65547. array=[(5), (4), (3), (2), (1)];
  65548. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  65549. return self;
  65550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65551. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)});
  65552. //>>excludeEnd("ctx");
  65553. },
  65554. //>>excludeStart("ide", pragmas.excludeIdeData);
  65555. args: [],
  65556. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  65557. referencedClasses: [],
  65558. //>>excludeEnd("ide");
  65559. messageSends: ["assert:equals:", "reversed"]
  65560. }),
  65561. globals.ArrayTest);
  65562. smalltalk.addMethod(
  65563. smalltalk.method({
  65564. selector: "testSort",
  65565. protocol: 'tests',
  65566. fn: function (){
  65567. var self=this;
  65568. var array;
  65569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65570. return smalltalk.withContext(function($ctx1) {
  65571. //>>excludeEnd("ctx");
  65572. array=[(10), (1), (5)];
  65573. _st(array)._sort();
  65574. self._assert_equals_(array,[(1), (5), (10)]);
  65575. return self;
  65576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65577. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)});
  65578. //>>excludeEnd("ctx");
  65579. },
  65580. //>>excludeStart("ide", pragmas.excludeIdeData);
  65581. args: [],
  65582. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  65583. referencedClasses: [],
  65584. //>>excludeEnd("ide");
  65585. messageSends: ["sort", "assert:equals:"]
  65586. }),
  65587. globals.ArrayTest);
  65588. smalltalk.addMethod(
  65589. smalltalk.method({
  65590. selector: "collectionClass",
  65591. protocol: 'fixture',
  65592. fn: function (){
  65593. var self=this;
  65594. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  65595. return $Array();
  65596. },
  65597. //>>excludeStart("ide", pragmas.excludeIdeData);
  65598. args: [],
  65599. source: "collectionClass\x0a\x09^ Array",
  65600. referencedClasses: ["Array"],
  65601. //>>excludeEnd("ide");
  65602. messageSends: []
  65603. }),
  65604. globals.ArrayTest.klass);
  65605. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  65606. smalltalk.addMethod(
  65607. smalltalk.method({
  65608. selector: "collection",
  65609. protocol: 'fixture',
  65610. fn: function (){
  65611. var self=this;
  65612. return "helLo";
  65613. },
  65614. //>>excludeStart("ide", pragmas.excludeIdeData);
  65615. args: [],
  65616. source: "collection\x0a\x09^ 'helLo'",
  65617. referencedClasses: [],
  65618. //>>excludeEnd("ide");
  65619. messageSends: []
  65620. }),
  65621. globals.StringTest);
  65622. smalltalk.addMethod(
  65623. smalltalk.method({
  65624. selector: "collectionFirst",
  65625. protocol: 'fixture',
  65626. fn: function (){
  65627. var self=this;
  65628. return "h";
  65629. },
  65630. //>>excludeStart("ide", pragmas.excludeIdeData);
  65631. args: [],
  65632. source: "collectionFirst\x0a\x09^ 'h'",
  65633. referencedClasses: [],
  65634. //>>excludeEnd("ide");
  65635. messageSends: []
  65636. }),
  65637. globals.StringTest);
  65638. smalltalk.addMethod(
  65639. smalltalk.method({
  65640. selector: "collectionFirstTwo",
  65641. protocol: 'fixture',
  65642. fn: function (){
  65643. var self=this;
  65644. return "he";
  65645. },
  65646. //>>excludeStart("ide", pragmas.excludeIdeData);
  65647. args: [],
  65648. source: "collectionFirstTwo\x0a\x09^ 'he'",
  65649. referencedClasses: [],
  65650. //>>excludeEnd("ide");
  65651. messageSends: []
  65652. }),
  65653. globals.StringTest);
  65654. smalltalk.addMethod(
  65655. smalltalk.method({
  65656. selector: "collectionLast",
  65657. protocol: 'fixture',
  65658. fn: function (){
  65659. var self=this;
  65660. return "o";
  65661. },
  65662. //>>excludeStart("ide", pragmas.excludeIdeData);
  65663. args: [],
  65664. source: "collectionLast\x0a\x09^ 'o'",
  65665. referencedClasses: [],
  65666. //>>excludeEnd("ide");
  65667. messageSends: []
  65668. }),
  65669. globals.StringTest);
  65670. smalltalk.addMethod(
  65671. smalltalk.method({
  65672. selector: "collectionLastTwo",
  65673. protocol: 'fixture',
  65674. fn: function (){
  65675. var self=this;
  65676. return "Lo";
  65677. },
  65678. //>>excludeStart("ide", pragmas.excludeIdeData);
  65679. args: [],
  65680. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  65681. referencedClasses: [],
  65682. //>>excludeEnd("ide");
  65683. messageSends: []
  65684. }),
  65685. globals.StringTest);
  65686. smalltalk.addMethod(
  65687. smalltalk.method({
  65688. selector: "collectionOfPrintStrings",
  65689. protocol: 'fixture',
  65690. fn: function (){
  65691. var self=this;
  65692. return "'h''e''l''L''o'";
  65693. },
  65694. //>>excludeStart("ide", pragmas.excludeIdeData);
  65695. args: [],
  65696. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  65697. referencedClasses: [],
  65698. //>>excludeEnd("ide");
  65699. messageSends: []
  65700. }),
  65701. globals.StringTest);
  65702. smalltalk.addMethod(
  65703. smalltalk.method({
  65704. selector: "collectionSize",
  65705. protocol: 'fixture',
  65706. fn: function (){
  65707. var self=this;
  65708. return (5);
  65709. },
  65710. //>>excludeStart("ide", pragmas.excludeIdeData);
  65711. args: [],
  65712. source: "collectionSize\x0a\x09^ 5",
  65713. referencedClasses: [],
  65714. //>>excludeEnd("ide");
  65715. messageSends: []
  65716. }),
  65717. globals.StringTest);
  65718. smalltalk.addMethod(
  65719. smalltalk.method({
  65720. selector: "collectionWithDuplicates",
  65721. protocol: 'fixture',
  65722. fn: function (){
  65723. var self=this;
  65724. return "abbaerte";
  65725. },
  65726. //>>excludeStart("ide", pragmas.excludeIdeData);
  65727. args: [],
  65728. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  65729. referencedClasses: [],
  65730. //>>excludeEnd("ide");
  65731. messageSends: []
  65732. }),
  65733. globals.StringTest);
  65734. smalltalk.addMethod(
  65735. smalltalk.method({
  65736. selector: "collectionWithNewValue",
  65737. protocol: 'fixture',
  65738. fn: function (){
  65739. var self=this;
  65740. return "helLoN";
  65741. },
  65742. //>>excludeStart("ide", pragmas.excludeIdeData);
  65743. args: [],
  65744. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  65745. referencedClasses: [],
  65746. //>>excludeEnd("ide");
  65747. messageSends: []
  65748. }),
  65749. globals.StringTest);
  65750. smalltalk.addMethod(
  65751. smalltalk.method({
  65752. selector: "sampleNewValueAsCollection",
  65753. protocol: 'fixture',
  65754. fn: function (){
  65755. var self=this;
  65756. return "N";
  65757. },
  65758. //>>excludeStart("ide", pragmas.excludeIdeData);
  65759. args: [],
  65760. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  65761. referencedClasses: [],
  65762. //>>excludeEnd("ide");
  65763. messageSends: []
  65764. }),
  65765. globals.StringTest);
  65766. smalltalk.addMethod(
  65767. smalltalk.method({
  65768. selector: "samplesDo:",
  65769. protocol: 'fixture',
  65770. fn: function (aBlock){
  65771. var self=this;
  65772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65773. return smalltalk.withContext(function($ctx1) {
  65774. //>>excludeEnd("ctx");
  65775. (
  65776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65777. $ctx1.supercall = true,
  65778. //>>excludeEnd("ctx");
  65779. globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  65780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65781. $ctx1.supercall = false;
  65782. //>>excludeEnd("ctx");;
  65783. _st(aBlock)._value_value_((3),"l");
  65784. return self;
  65785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65786. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)});
  65787. //>>excludeEnd("ctx");
  65788. },
  65789. //>>excludeStart("ide", pragmas.excludeIdeData);
  65790. args: ["aBlock"],
  65791. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  65792. referencedClasses: [],
  65793. //>>excludeEnd("ide");
  65794. messageSends: ["samplesDo:", "value:value:"]
  65795. }),
  65796. globals.StringTest);
  65797. smalltalk.addMethod(
  65798. smalltalk.method({
  65799. selector: "testAddAll",
  65800. protocol: 'tests',
  65801. fn: function (){
  65802. var self=this;
  65803. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65805. return smalltalk.withContext(function($ctx1) {
  65806. //>>excludeEnd("ctx");
  65807. var $1;
  65808. self._should_raise_((function(){
  65809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65810. return smalltalk.withContext(function($ctx2) {
  65811. //>>excludeEnd("ctx");
  65812. $1=self._collection();
  65813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65814. $ctx2.sendIdx["collection"]=1;
  65815. //>>excludeEnd("ctx");
  65816. return _st($1)._addAll_(self._collection());
  65817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65819. //>>excludeEnd("ctx");
  65820. }),$Error());
  65821. return self;
  65822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65823. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)});
  65824. //>>excludeEnd("ctx");
  65825. },
  65826. //>>excludeStart("ide", pragmas.excludeIdeData);
  65827. args: [],
  65828. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  65829. referencedClasses: ["Error"],
  65830. //>>excludeEnd("ide");
  65831. messageSends: ["should:raise:", "addAll:", "collection"]
  65832. }),
  65833. globals.StringTest);
  65834. smalltalk.addMethod(
  65835. smalltalk.method({
  65836. selector: "testAddRemove",
  65837. protocol: 'tests',
  65838. fn: function (){
  65839. var self=this;
  65840. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  65841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65842. return smalltalk.withContext(function($ctx1) {
  65843. //>>excludeEnd("ctx");
  65844. self._should_raise_((function(){
  65845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65846. return smalltalk.withContext(function($ctx2) {
  65847. //>>excludeEnd("ctx");
  65848. return "hello"._add_("a");
  65849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  65851. //>>excludeEnd("ctx");
  65852. }),$Error());
  65853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65854. $ctx1.sendIdx["should:raise:"]=1;
  65855. //>>excludeEnd("ctx");
  65856. self._should_raise_((function(){
  65857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65858. return smalltalk.withContext(function($ctx2) {
  65859. //>>excludeEnd("ctx");
  65860. return "hello"._remove_("h");
  65861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65862. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  65863. //>>excludeEnd("ctx");
  65864. }),$Error());
  65865. return self;
  65866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65867. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)});
  65868. //>>excludeEnd("ctx");
  65869. },
  65870. //>>excludeStart("ide", pragmas.excludeIdeData);
  65871. args: [],
  65872. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  65873. referencedClasses: ["Error"],
  65874. //>>excludeEnd("ide");
  65875. messageSends: ["should:raise:", "add:", "remove:"]
  65876. }),
  65877. globals.StringTest);
  65878. smalltalk.addMethod(
  65879. smalltalk.method({
  65880. selector: "testAsArray",
  65881. protocol: 'tests',
  65882. fn: function (){
  65883. var self=this;
  65884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65885. return smalltalk.withContext(function($ctx1) {
  65886. //>>excludeEnd("ctx");
  65887. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  65888. return self;
  65889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65890. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)});
  65891. //>>excludeEnd("ctx");
  65892. },
  65893. //>>excludeStart("ide", pragmas.excludeIdeData);
  65894. args: [],
  65895. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  65896. referencedClasses: [],
  65897. //>>excludeEnd("ide");
  65898. messageSends: ["assert:equals:", "asArray"]
  65899. }),
  65900. globals.StringTest);
  65901. smalltalk.addMethod(
  65902. smalltalk.method({
  65903. selector: "testAsLowerCase",
  65904. protocol: 'tests',
  65905. fn: function (){
  65906. var self=this;
  65907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65908. return smalltalk.withContext(function($ctx1) {
  65909. //>>excludeEnd("ctx");
  65910. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  65911. return self;
  65912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65913. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)});
  65914. //>>excludeEnd("ctx");
  65915. },
  65916. //>>excludeStart("ide", pragmas.excludeIdeData);
  65917. args: [],
  65918. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  65919. referencedClasses: [],
  65920. //>>excludeEnd("ide");
  65921. messageSends: ["assert:equals:", "asLowercase"]
  65922. }),
  65923. globals.StringTest);
  65924. smalltalk.addMethod(
  65925. smalltalk.method({
  65926. selector: "testAsNumber",
  65927. protocol: 'tests',
  65928. fn: function (){
  65929. var self=this;
  65930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65931. return smalltalk.withContext(function($ctx1) {
  65932. //>>excludeEnd("ctx");
  65933. var $1,$2;
  65934. $1="3"._asNumber();
  65935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65936. $ctx1.sendIdx["asNumber"]=1;
  65937. //>>excludeEnd("ctx");
  65938. self._assert_equals_($1,(3));
  65939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65940. $ctx1.sendIdx["assert:equals:"]=1;
  65941. //>>excludeEnd("ctx");
  65942. $2="-3"._asNumber();
  65943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65944. $ctx1.sendIdx["asNumber"]=2;
  65945. //>>excludeEnd("ctx");
  65946. self._assert_equals_($2,(-3));
  65947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65948. $ctx1.sendIdx["assert:equals:"]=2;
  65949. //>>excludeEnd("ctx");
  65950. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  65951. return self;
  65952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65953. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)});
  65954. //>>excludeEnd("ctx");
  65955. },
  65956. //>>excludeStart("ide", pragmas.excludeIdeData);
  65957. args: [],
  65958. 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.",
  65959. referencedClasses: [],
  65960. //>>excludeEnd("ide");
  65961. messageSends: ["assert:equals:", "asNumber"]
  65962. }),
  65963. globals.StringTest);
  65964. smalltalk.addMethod(
  65965. smalltalk.method({
  65966. selector: "testAsUpperCase",
  65967. protocol: 'tests',
  65968. fn: function (){
  65969. var self=this;
  65970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65971. return smalltalk.withContext(function($ctx1) {
  65972. //>>excludeEnd("ctx");
  65973. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  65974. return self;
  65975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65976. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)});
  65977. //>>excludeEnd("ctx");
  65978. },
  65979. //>>excludeStart("ide", pragmas.excludeIdeData);
  65980. args: [],
  65981. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  65982. referencedClasses: [],
  65983. //>>excludeEnd("ide");
  65984. messageSends: ["assert:equals:", "asUppercase"]
  65985. }),
  65986. globals.StringTest);
  65987. smalltalk.addMethod(
  65988. smalltalk.method({
  65989. selector: "testAsciiValue",
  65990. protocol: 'tests',
  65991. fn: function (){
  65992. var self=this;
  65993. var characterA,characterU;
  65994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65995. return smalltalk.withContext(function($ctx1) {
  65996. //>>excludeEnd("ctx");
  65997. var $1;
  65998. characterA="A";
  65999. characterU="U";
  66000. $1=_st(characterA)._asciiValue();
  66001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66002. $ctx1.sendIdx["asciiValue"]=1;
  66003. //>>excludeEnd("ctx");
  66004. self._assert_equals_($1,(65));
  66005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66006. $ctx1.sendIdx["assert:equals:"]=1;
  66007. //>>excludeEnd("ctx");
  66008. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  66009. return self;
  66010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66011. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)});
  66012. //>>excludeEnd("ctx");
  66013. },
  66014. //>>excludeStart("ide", pragmas.excludeIdeData);
  66015. args: [],
  66016. 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",
  66017. referencedClasses: [],
  66018. //>>excludeEnd("ide");
  66019. messageSends: ["assert:equals:", "asciiValue"]
  66020. }),
  66021. globals.StringTest);
  66022. smalltalk.addMethod(
  66023. smalltalk.method({
  66024. selector: "testAtIfAbsentPut",
  66025. protocol: 'tests',
  66026. fn: function (){
  66027. var self=this;
  66028. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66030. return smalltalk.withContext(function($ctx1) {
  66031. //>>excludeEnd("ctx");
  66032. self._should_raise_((function(){
  66033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66034. return smalltalk.withContext(function($ctx2) {
  66035. //>>excludeEnd("ctx");
  66036. return "hello"._at_ifAbsentPut_((6),(function(){
  66037. return "a";
  66038. }));
  66039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66041. //>>excludeEnd("ctx");
  66042. }),$Error());
  66043. return self;
  66044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66045. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)});
  66046. //>>excludeEnd("ctx");
  66047. },
  66048. //>>excludeStart("ide", pragmas.excludeIdeData);
  66049. args: [],
  66050. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  66051. referencedClasses: ["Error"],
  66052. //>>excludeEnd("ide");
  66053. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  66054. }),
  66055. globals.StringTest);
  66056. smalltalk.addMethod(
  66057. smalltalk.method({
  66058. selector: "testAtPut",
  66059. protocol: 'tests',
  66060. fn: function (){
  66061. var self=this;
  66062. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66064. return smalltalk.withContext(function($ctx1) {
  66065. //>>excludeEnd("ctx");
  66066. self._should_raise_((function(){
  66067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66068. return smalltalk.withContext(function($ctx2) {
  66069. //>>excludeEnd("ctx");
  66070. return "hello"._at_put_((1),"a");
  66071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66073. //>>excludeEnd("ctx");
  66074. }),$Error());
  66075. return self;
  66076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66077. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)});
  66078. //>>excludeEnd("ctx");
  66079. },
  66080. //>>excludeStart("ide", pragmas.excludeIdeData);
  66081. args: [],
  66082. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  66083. referencedClasses: ["Error"],
  66084. //>>excludeEnd("ide");
  66085. messageSends: ["should:raise:", "at:put:"]
  66086. }),
  66087. globals.StringTest);
  66088. smalltalk.addMethod(
  66089. smalltalk.method({
  66090. selector: "testCapitalized",
  66091. protocol: 'tests',
  66092. fn: function (){
  66093. var self=this;
  66094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66095. return smalltalk.withContext(function($ctx1) {
  66096. //>>excludeEnd("ctx");
  66097. var $1,$2,$3;
  66098. $1="test"._capitalized();
  66099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66100. $ctx1.sendIdx["capitalized"]=1;
  66101. //>>excludeEnd("ctx");
  66102. self._assert_equals_($1,"Test");
  66103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66104. $ctx1.sendIdx["assert:equals:"]=1;
  66105. //>>excludeEnd("ctx");
  66106. $2="Test"._capitalized();
  66107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66108. $ctx1.sendIdx["capitalized"]=2;
  66109. //>>excludeEnd("ctx");
  66110. self._assert_equals_($2,"Test");
  66111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66112. $ctx1.sendIdx["assert:equals:"]=2;
  66113. //>>excludeEnd("ctx");
  66114. self._assert_equals_(""._capitalized(),"");
  66115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66116. $ctx1.sendIdx["assert:equals:"]=3;
  66117. //>>excludeEnd("ctx");
  66118. $3="Test"._isCapitalized();
  66119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66120. $ctx1.sendIdx["isCapitalized"]=1;
  66121. //>>excludeEnd("ctx");
  66122. self._assert_equals_($3,true);
  66123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66124. $ctx1.sendIdx["assert:equals:"]=4;
  66125. //>>excludeEnd("ctx");
  66126. self._assert_equals_("test"._isCapitalized(),false);
  66127. return self;
  66128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66129. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)});
  66130. //>>excludeEnd("ctx");
  66131. },
  66132. //>>excludeStart("ide", pragmas.excludeIdeData);
  66133. args: [],
  66134. 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.",
  66135. referencedClasses: [],
  66136. //>>excludeEnd("ide");
  66137. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  66138. }),
  66139. globals.StringTest);
  66140. smalltalk.addMethod(
  66141. smalltalk.method({
  66142. selector: "testCharCodeAt",
  66143. protocol: 'tests',
  66144. fn: function (){
  66145. var self=this;
  66146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66147. return smalltalk.withContext(function($ctx1) {
  66148. //>>excludeEnd("ctx");
  66149. var $1,$2,$3,$4,$5;
  66150. $1="jackie"._charCodeAt_((1));
  66151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66152. $ctx1.sendIdx["charCodeAt:"]=1;
  66153. //>>excludeEnd("ctx");
  66154. self._assert_equals_($1,(106));
  66155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66156. $ctx1.sendIdx["assert:equals:"]=1;
  66157. //>>excludeEnd("ctx");
  66158. $2="jackie"._charCodeAt_((2));
  66159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66160. $ctx1.sendIdx["charCodeAt:"]=2;
  66161. //>>excludeEnd("ctx");
  66162. self._assert_equals_($2,(97));
  66163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66164. $ctx1.sendIdx["assert:equals:"]=2;
  66165. //>>excludeEnd("ctx");
  66166. $3="jackie"._charCodeAt_((3));
  66167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66168. $ctx1.sendIdx["charCodeAt:"]=3;
  66169. //>>excludeEnd("ctx");
  66170. self._assert_equals_($3,(99));
  66171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66172. $ctx1.sendIdx["assert:equals:"]=3;
  66173. //>>excludeEnd("ctx");
  66174. $4="jackie"._charCodeAt_((4));
  66175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66176. $ctx1.sendIdx["charCodeAt:"]=4;
  66177. //>>excludeEnd("ctx");
  66178. self._assert_equals_($4,(107));
  66179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66180. $ctx1.sendIdx["assert:equals:"]=4;
  66181. //>>excludeEnd("ctx");
  66182. $5="jackie"._charCodeAt_((5));
  66183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66184. $ctx1.sendIdx["charCodeAt:"]=5;
  66185. //>>excludeEnd("ctx");
  66186. self._assert_equals_($5,(105));
  66187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66188. $ctx1.sendIdx["assert:equals:"]=5;
  66189. //>>excludeEnd("ctx");
  66190. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  66191. return self;
  66192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66193. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)});
  66194. //>>excludeEnd("ctx");
  66195. },
  66196. //>>excludeStart("ide", pragmas.excludeIdeData);
  66197. args: [],
  66198. 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",
  66199. referencedClasses: [],
  66200. //>>excludeEnd("ide");
  66201. messageSends: ["assert:equals:", "charCodeAt:"]
  66202. }),
  66203. globals.StringTest);
  66204. smalltalk.addMethod(
  66205. smalltalk.method({
  66206. selector: "testCopyFromTo",
  66207. protocol: 'tests',
  66208. fn: function (){
  66209. var self=this;
  66210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66211. return smalltalk.withContext(function($ctx1) {
  66212. //>>excludeEnd("ctx");
  66213. var $1;
  66214. $1="jackie"._copyFrom_to_((1),(3));
  66215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66216. $ctx1.sendIdx["copyFrom:to:"]=1;
  66217. //>>excludeEnd("ctx");
  66218. self._assert_equals_($1,"jac");
  66219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66220. $ctx1.sendIdx["assert:equals:"]=1;
  66221. //>>excludeEnd("ctx");
  66222. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  66223. return self;
  66224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66225. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)});
  66226. //>>excludeEnd("ctx");
  66227. },
  66228. //>>excludeStart("ide", pragmas.excludeIdeData);
  66229. args: [],
  66230. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  66231. referencedClasses: [],
  66232. //>>excludeEnd("ide");
  66233. messageSends: ["assert:equals:", "copyFrom:to:"]
  66234. }),
  66235. globals.StringTest);
  66236. smalltalk.addMethod(
  66237. smalltalk.method({
  66238. selector: "testCopyWithoutAll",
  66239. protocol: 'tests',
  66240. fn: function (){
  66241. var self=this;
  66242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66243. return smalltalk.withContext(function($ctx1) {
  66244. //>>excludeEnd("ctx");
  66245. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  66246. return self;
  66247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66248. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)});
  66249. //>>excludeEnd("ctx");
  66250. },
  66251. //>>excludeStart("ide", pragmas.excludeIdeData);
  66252. args: [],
  66253. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  66254. referencedClasses: [],
  66255. //>>excludeEnd("ide");
  66256. messageSends: ["assert:equals:", "copyWithoutAll:"]
  66257. }),
  66258. globals.StringTest);
  66259. smalltalk.addMethod(
  66260. smalltalk.method({
  66261. selector: "testEquality",
  66262. protocol: 'tests',
  66263. fn: function (){
  66264. var self=this;
  66265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66266. return smalltalk.withContext(function($ctx1) {
  66267. //>>excludeEnd("ctx");
  66268. var $1,$2,$3;
  66269. self._assert_equals_("hello","hello");
  66270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66271. $ctx1.sendIdx["assert:equals:"]=1;
  66272. //>>excludeEnd("ctx");
  66273. $1="hello".__eq("world");
  66274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66275. $ctx1.sendIdx["="]=1;
  66276. //>>excludeEnd("ctx");
  66277. self._deny_($1);
  66278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66279. $ctx1.sendIdx["deny:"]=1;
  66280. //>>excludeEnd("ctx");
  66281. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  66282. })));
  66283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66284. $ctx1.sendIdx["="]=2;
  66285. //>>excludeEnd("ctx");
  66286. self._deny_($2);
  66287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66288. $ctx1.sendIdx["deny:"]=2;
  66289. //>>excludeEnd("ctx");
  66290. $3="hello"._yourself();
  66291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66292. $ctx1.sendIdx["yourself"]=1;
  66293. //>>excludeEnd("ctx");
  66294. self._assert_equals_("hello",$3);
  66295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66296. $ctx1.sendIdx["assert:equals:"]=2;
  66297. //>>excludeEnd("ctx");
  66298. self._assert_equals_("hello"._yourself(),"hello");
  66299. self._deny_("".__eq((0)));
  66300. return self;
  66301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66302. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)});
  66303. //>>excludeEnd("ctx");
  66304. },
  66305. //>>excludeStart("ide", pragmas.excludeIdeData);
  66306. args: [],
  66307. 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",
  66308. referencedClasses: [],
  66309. //>>excludeEnd("ide");
  66310. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  66311. }),
  66312. globals.StringTest);
  66313. smalltalk.addMethod(
  66314. smalltalk.method({
  66315. selector: "testIdentity",
  66316. protocol: 'tests',
  66317. fn: function (){
  66318. var self=this;
  66319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66320. return smalltalk.withContext(function($ctx1) {
  66321. //>>excludeEnd("ctx");
  66322. var $1,$2,$4,$3,$5;
  66323. $1="hello".__eq_eq("hello");
  66324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66325. $ctx1.sendIdx["=="]=1;
  66326. //>>excludeEnd("ctx");
  66327. self._assert_($1);
  66328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66329. $ctx1.sendIdx["assert:"]=1;
  66330. //>>excludeEnd("ctx");
  66331. $2="hello".__eq_eq("world");
  66332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66333. $ctx1.sendIdx["=="]=2;
  66334. //>>excludeEnd("ctx");
  66335. self._deny_($2);
  66336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66337. $ctx1.sendIdx["deny:"]=1;
  66338. //>>excludeEnd("ctx");
  66339. $4="hello"._yourself();
  66340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66341. $ctx1.sendIdx["yourself"]=1;
  66342. //>>excludeEnd("ctx");
  66343. $3="hello".__eq_eq($4);
  66344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66345. $ctx1.sendIdx["=="]=3;
  66346. //>>excludeEnd("ctx");
  66347. self._assert_($3);
  66348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66349. $ctx1.sendIdx["assert:"]=2;
  66350. //>>excludeEnd("ctx");
  66351. $5=_st("hello"._yourself()).__eq_eq("hello");
  66352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66353. $ctx1.sendIdx["=="]=4;
  66354. //>>excludeEnd("ctx");
  66355. self._assert_($5);
  66356. self._deny_("".__eq_eq((0)));
  66357. return self;
  66358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66359. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)});
  66360. //>>excludeEnd("ctx");
  66361. },
  66362. //>>excludeStart("ide", pragmas.excludeIdeData);
  66363. args: [],
  66364. 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",
  66365. referencedClasses: [],
  66366. //>>excludeEnd("ide");
  66367. messageSends: ["assert:", "==", "deny:", "yourself"]
  66368. }),
  66369. globals.StringTest);
  66370. smalltalk.addMethod(
  66371. smalltalk.method({
  66372. selector: "testIdentityHash",
  66373. protocol: 'tests',
  66374. fn: function (){
  66375. var self=this;
  66376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66377. return smalltalk.withContext(function($ctx1) {
  66378. //>>excludeEnd("ctx");
  66379. var $1,$2,$4,$3;
  66380. $1="foo"._identityHash();
  66381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66382. $ctx1.sendIdx["identityHash"]=1;
  66383. //>>excludeEnd("ctx");
  66384. $2="foo"._identityHash();
  66385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66386. $ctx1.sendIdx["identityHash"]=2;
  66387. //>>excludeEnd("ctx");
  66388. self._assert_equals_($1,$2);
  66389. $4="foo"._identityHash();
  66390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66391. $ctx1.sendIdx["identityHash"]=3;
  66392. //>>excludeEnd("ctx");
  66393. $3=_st($4).__eq("bar"._identityHash());
  66394. self._deny_($3);
  66395. return self;
  66396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66397. }, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)});
  66398. //>>excludeEnd("ctx");
  66399. },
  66400. //>>excludeStart("ide", pragmas.excludeIdeData);
  66401. args: [],
  66402. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  66403. referencedClasses: [],
  66404. //>>excludeEnd("ide");
  66405. messageSends: ["assert:equals:", "identityHash", "deny:", "="]
  66406. }),
  66407. globals.StringTest);
  66408. smalltalk.addMethod(
  66409. smalltalk.method({
  66410. selector: "testIncludesSubString",
  66411. protocol: 'tests',
  66412. fn: function (){
  66413. var self=this;
  66414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66415. return smalltalk.withContext(function($ctx1) {
  66416. //>>excludeEnd("ctx");
  66417. var $1;
  66418. $1="amber"._includesSubString_("ber");
  66419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66420. $ctx1.sendIdx["includesSubString:"]=1;
  66421. //>>excludeEnd("ctx");
  66422. self._assert_($1);
  66423. self._deny_("amber"._includesSubString_("zork"));
  66424. return self;
  66425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66426. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)});
  66427. //>>excludeEnd("ctx");
  66428. },
  66429. //>>excludeStart("ide", pragmas.excludeIdeData);
  66430. args: [],
  66431. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  66432. referencedClasses: [],
  66433. //>>excludeEnd("ide");
  66434. messageSends: ["assert:", "includesSubString:", "deny:"]
  66435. }),
  66436. globals.StringTest);
  66437. smalltalk.addMethod(
  66438. smalltalk.method({
  66439. selector: "testIndexOfStartingAtWithNull",
  66440. protocol: 'tests',
  66441. fn: function (){
  66442. var self=this;
  66443. return self;
  66444. },
  66445. //>>excludeStart("ide", pragmas.excludeIdeData);
  66446. args: [],
  66447. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  66448. referencedClasses: [],
  66449. //>>excludeEnd("ide");
  66450. messageSends: []
  66451. }),
  66452. globals.StringTest);
  66453. smalltalk.addMethod(
  66454. smalltalk.method({
  66455. selector: "testIndexOfWithNull",
  66456. protocol: 'tests',
  66457. fn: function (){
  66458. var self=this;
  66459. return self;
  66460. },
  66461. //>>excludeStart("ide", pragmas.excludeIdeData);
  66462. args: [],
  66463. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  66464. referencedClasses: [],
  66465. //>>excludeEnd("ide");
  66466. messageSends: []
  66467. }),
  66468. globals.StringTest);
  66469. smalltalk.addMethod(
  66470. smalltalk.method({
  66471. selector: "testIsVowel",
  66472. protocol: 'tests',
  66473. fn: function (){
  66474. var self=this;
  66475. var vowel,consonant;
  66476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66477. return smalltalk.withContext(function($ctx1) {
  66478. //>>excludeEnd("ctx");
  66479. var $1;
  66480. vowel="u";
  66481. consonant="z";
  66482. $1=_st(vowel)._isVowel();
  66483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66484. $ctx1.sendIdx["isVowel"]=1;
  66485. //>>excludeEnd("ctx");
  66486. self._assert_equals_($1,true);
  66487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66488. $ctx1.sendIdx["assert:equals:"]=1;
  66489. //>>excludeEnd("ctx");
  66490. self._assert_equals_(_st(consonant)._isVowel(),false);
  66491. return self;
  66492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66493. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)});
  66494. //>>excludeEnd("ctx");
  66495. },
  66496. //>>excludeStart("ide", pragmas.excludeIdeData);
  66497. args: [],
  66498. 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",
  66499. referencedClasses: [],
  66500. //>>excludeEnd("ide");
  66501. messageSends: ["assert:equals:", "isVowel"]
  66502. }),
  66503. globals.StringTest);
  66504. smalltalk.addMethod(
  66505. smalltalk.method({
  66506. selector: "testJoin",
  66507. protocol: 'tests',
  66508. fn: function (){
  66509. var self=this;
  66510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66511. return smalltalk.withContext(function($ctx1) {
  66512. //>>excludeEnd("ctx");
  66513. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  66514. return self;
  66515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66516. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)});
  66517. //>>excludeEnd("ctx");
  66518. },
  66519. //>>excludeStart("ide", pragmas.excludeIdeData);
  66520. args: [],
  66521. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  66522. referencedClasses: [],
  66523. //>>excludeEnd("ide");
  66524. messageSends: ["assert:equals:", "join:"]
  66525. }),
  66526. globals.StringTest);
  66527. smalltalk.addMethod(
  66528. smalltalk.method({
  66529. selector: "testRemoveAll",
  66530. protocol: 'tests',
  66531. fn: function (){
  66532. var self=this;
  66533. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  66534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66535. return smalltalk.withContext(function($ctx1) {
  66536. //>>excludeEnd("ctx");
  66537. self._should_raise_((function(){
  66538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66539. return smalltalk.withContext(function($ctx2) {
  66540. //>>excludeEnd("ctx");
  66541. return _st(self._collection())._removeAll();
  66542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  66544. //>>excludeEnd("ctx");
  66545. }),$Error());
  66546. return self;
  66547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66548. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)});
  66549. //>>excludeEnd("ctx");
  66550. },
  66551. //>>excludeStart("ide", pragmas.excludeIdeData);
  66552. args: [],
  66553. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  66554. referencedClasses: ["Error"],
  66555. //>>excludeEnd("ide");
  66556. messageSends: ["should:raise:", "removeAll", "collection"]
  66557. }),
  66558. globals.StringTest);
  66559. smalltalk.addMethod(
  66560. smalltalk.method({
  66561. selector: "testReversed",
  66562. protocol: 'tests',
  66563. fn: function (){
  66564. var self=this;
  66565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66566. return smalltalk.withContext(function($ctx1) {
  66567. //>>excludeEnd("ctx");
  66568. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  66569. return self;
  66570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66571. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)});
  66572. //>>excludeEnd("ctx");
  66573. },
  66574. //>>excludeStart("ide", pragmas.excludeIdeData);
  66575. args: [],
  66576. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  66577. referencedClasses: [],
  66578. //>>excludeEnd("ide");
  66579. messageSends: ["assert:equals:", "reversed"]
  66580. }),
  66581. globals.StringTest);
  66582. smalltalk.addMethod(
  66583. smalltalk.method({
  66584. selector: "testStreamContents",
  66585. protocol: 'tests',
  66586. fn: function (){
  66587. var self=this;
  66588. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  66589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66590. return smalltalk.withContext(function($ctx1) {
  66591. //>>excludeEnd("ctx");
  66592. var $1;
  66593. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  66594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66595. return smalltalk.withContext(function($ctx2) {
  66596. //>>excludeEnd("ctx");
  66597. _st(aStream)._nextPutAll_("hello");
  66598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66599. $ctx2.sendIdx["nextPutAll:"]=1;
  66600. //>>excludeEnd("ctx");
  66601. _st(aStream)._space();
  66602. $1=_st(aStream)._nextPutAll_("world");
  66603. return $1;
  66604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66605. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  66606. //>>excludeEnd("ctx");
  66607. })),"hello world");
  66608. return self;
  66609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66610. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)});
  66611. //>>excludeEnd("ctx");
  66612. },
  66613. //>>excludeStart("ide", pragmas.excludeIdeData);
  66614. args: [],
  66615. 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'",
  66616. referencedClasses: ["String"],
  66617. //>>excludeEnd("ide");
  66618. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  66619. }),
  66620. globals.StringTest);
  66621. smalltalk.addMethod(
  66622. smalltalk.method({
  66623. selector: "testSubStrings",
  66624. protocol: 'tests',
  66625. fn: function (){
  66626. var self=this;
  66627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66628. return smalltalk.withContext(function($ctx1) {
  66629. //>>excludeEnd("ctx");
  66630. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  66631. return self;
  66632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66633. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)});
  66634. //>>excludeEnd("ctx");
  66635. },
  66636. //>>excludeStart("ide", pragmas.excludeIdeData);
  66637. args: [],
  66638. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  66639. referencedClasses: [],
  66640. //>>excludeEnd("ide");
  66641. messageSends: ["assert:equals:", "subStrings:"]
  66642. }),
  66643. globals.StringTest);
  66644. smalltalk.addMethod(
  66645. smalltalk.method({
  66646. selector: "testTrim",
  66647. protocol: 'tests',
  66648. fn: function (){
  66649. var self=this;
  66650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66651. return smalltalk.withContext(function($ctx1) {
  66652. //>>excludeEnd("ctx");
  66653. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  66654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66655. $ctx1.sendIdx["assert:equals:"]=1;
  66656. //>>excludeEnd("ctx");
  66657. self._assert_equals_("jackie "._trimRight(),"jackie");
  66658. return self;
  66659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66660. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)});
  66661. //>>excludeEnd("ctx");
  66662. },
  66663. //>>excludeStart("ide", pragmas.excludeIdeData);
  66664. args: [],
  66665. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  66666. referencedClasses: [],
  66667. //>>excludeEnd("ide");
  66668. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  66669. }),
  66670. globals.StringTest);
  66671. smalltalk.addMethod(
  66672. smalltalk.method({
  66673. selector: "testValue",
  66674. protocol: 'tests',
  66675. fn: function (){
  66676. var self=this;
  66677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66678. return smalltalk.withContext(function($ctx1) {
  66679. //>>excludeEnd("ctx");
  66680. self._assert_equals_("asString"._value_((1)),"1");
  66681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66682. $ctx1.sendIdx["assert:equals:"]=1;
  66683. //>>excludeEnd("ctx");
  66684. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  66685. return self;
  66686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66687. }, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)});
  66688. //>>excludeEnd("ctx");
  66689. },
  66690. //>>excludeStart("ide", pragmas.excludeIdeData);
  66691. args: [],
  66692. 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')",
  66693. referencedClasses: [],
  66694. //>>excludeEnd("ide");
  66695. messageSends: ["assert:equals:", "value:", "collect:"]
  66696. }),
  66697. globals.StringTest);
  66698. smalltalk.addMethod(
  66699. smalltalk.method({
  66700. selector: "collectionClass",
  66701. protocol: 'fixture',
  66702. fn: function (){
  66703. var self=this;
  66704. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  66705. return $String();
  66706. },
  66707. //>>excludeStart("ide", pragmas.excludeIdeData);
  66708. args: [],
  66709. source: "collectionClass\x0a\x09^ String",
  66710. referencedClasses: ["String"],
  66711. //>>excludeEnd("ide");
  66712. messageSends: []
  66713. }),
  66714. globals.StringTest.klass);
  66715. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  66716. smalltalk.addMethod(
  66717. smalltalk.method({
  66718. selector: "collection",
  66719. protocol: 'fixture',
  66720. fn: function (){
  66721. var self=this;
  66722. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66723. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  66724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66725. return smalltalk.withContext(function($ctx1) {
  66726. //>>excludeEnd("ctx");
  66727. var $2,$3,$1;
  66728. $2=_st($Set())._new();
  66729. _st($2)._add_($Smalltalk());
  66730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66731. $ctx1.sendIdx["add:"]=1;
  66732. //>>excludeEnd("ctx");
  66733. _st($2)._add_(nil);
  66734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66735. $ctx1.sendIdx["add:"]=2;
  66736. //>>excludeEnd("ctx");
  66737. _st($2)._add_((3).__at((3)));
  66738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66739. $ctx1.sendIdx["add:"]=3;
  66740. //>>excludeEnd("ctx");
  66741. _st($2)._add_(false);
  66742. $3=_st($2)._yourself();
  66743. $1=$3;
  66744. return $1;
  66745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66746. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)});
  66747. //>>excludeEnd("ctx");
  66748. },
  66749. //>>excludeStart("ide", pragmas.excludeIdeData);
  66750. args: [],
  66751. 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",
  66752. referencedClasses: ["Set", "Smalltalk"],
  66753. //>>excludeEnd("ide");
  66754. messageSends: ["add:", "new", "@", "yourself"]
  66755. }),
  66756. globals.SetTest);
  66757. smalltalk.addMethod(
  66758. smalltalk.method({
  66759. selector: "collectionOfPrintStrings",
  66760. protocol: 'fixture',
  66761. fn: function (){
  66762. var self=this;
  66763. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66765. return smalltalk.withContext(function($ctx1) {
  66766. //>>excludeEnd("ctx");
  66767. var $2,$3,$1;
  66768. $2=_st($Set())._new();
  66769. _st($2)._add_("a SmalltalkImage");
  66770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66771. $ctx1.sendIdx["add:"]=1;
  66772. //>>excludeEnd("ctx");
  66773. _st($2)._add_("nil");
  66774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66775. $ctx1.sendIdx["add:"]=2;
  66776. //>>excludeEnd("ctx");
  66777. _st($2)._add_("3@3");
  66778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66779. $ctx1.sendIdx["add:"]=3;
  66780. //>>excludeEnd("ctx");
  66781. _st($2)._add_("false");
  66782. $3=_st($2)._yourself();
  66783. $1=$3;
  66784. return $1;
  66785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66786. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)});
  66787. //>>excludeEnd("ctx");
  66788. },
  66789. //>>excludeStart("ide", pragmas.excludeIdeData);
  66790. args: [],
  66791. 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",
  66792. referencedClasses: ["Set"],
  66793. //>>excludeEnd("ide");
  66794. messageSends: ["add:", "new", "yourself"]
  66795. }),
  66796. globals.SetTest);
  66797. smalltalk.addMethod(
  66798. smalltalk.method({
  66799. selector: "collectionSize",
  66800. protocol: 'fixture',
  66801. fn: function (){
  66802. var self=this;
  66803. return (4);
  66804. },
  66805. //>>excludeStart("ide", pragmas.excludeIdeData);
  66806. args: [],
  66807. source: "collectionSize\x0a\x09^ 4",
  66808. referencedClasses: [],
  66809. //>>excludeEnd("ide");
  66810. messageSends: []
  66811. }),
  66812. globals.SetTest);
  66813. smalltalk.addMethod(
  66814. smalltalk.method({
  66815. selector: "collectionWithDuplicates",
  66816. protocol: 'fixture',
  66817. fn: function (){
  66818. var self=this;
  66819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66820. return smalltalk.withContext(function($ctx1) {
  66821. //>>excludeEnd("ctx");
  66822. var $2,$3,$1;
  66823. $2=self._collection();
  66824. _st($2)._add_((0));
  66825. $3=_st($2)._yourself();
  66826. $1=$3;
  66827. return $1;
  66828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66829. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)});
  66830. //>>excludeEnd("ctx");
  66831. },
  66832. //>>excludeStart("ide", pragmas.excludeIdeData);
  66833. args: [],
  66834. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  66835. referencedClasses: [],
  66836. //>>excludeEnd("ide");
  66837. messageSends: ["add:", "collection", "yourself"]
  66838. }),
  66839. globals.SetTest);
  66840. smalltalk.addMethod(
  66841. smalltalk.method({
  66842. selector: "collectionWithNewValue",
  66843. protocol: 'fixture',
  66844. fn: function (){
  66845. var self=this;
  66846. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66847. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  66848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66849. return smalltalk.withContext(function($ctx1) {
  66850. //>>excludeEnd("ctx");
  66851. var $2,$3,$1;
  66852. $2=_st($Set())._new();
  66853. _st($2)._add_($Smalltalk());
  66854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66855. $ctx1.sendIdx["add:"]=1;
  66856. //>>excludeEnd("ctx");
  66857. _st($2)._add_(nil);
  66858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66859. $ctx1.sendIdx["add:"]=2;
  66860. //>>excludeEnd("ctx");
  66861. _st($2)._add_((3).__at((3)));
  66862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66863. $ctx1.sendIdx["add:"]=3;
  66864. //>>excludeEnd("ctx");
  66865. _st($2)._add_("N");
  66866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66867. $ctx1.sendIdx["add:"]=4;
  66868. //>>excludeEnd("ctx");
  66869. _st($2)._add_(false);
  66870. $3=_st($2)._yourself();
  66871. $1=$3;
  66872. return $1;
  66873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66874. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)});
  66875. //>>excludeEnd("ctx");
  66876. },
  66877. //>>excludeStart("ide", pragmas.excludeIdeData);
  66878. args: [],
  66879. 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",
  66880. referencedClasses: ["Set", "Smalltalk"],
  66881. //>>excludeEnd("ide");
  66882. messageSends: ["add:", "new", "@", "yourself"]
  66883. }),
  66884. globals.SetTest);
  66885. smalltalk.addMethod(
  66886. smalltalk.method({
  66887. selector: "testAddAll",
  66888. protocol: 'tests',
  66889. fn: function (){
  66890. var self=this;
  66891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66892. return smalltalk.withContext(function($ctx1) {
  66893. //>>excludeEnd("ctx");
  66894. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  66895. (
  66896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66897. $ctx1.supercall = true,
  66898. //>>excludeEnd("ctx");
  66899. globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  66900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66901. $ctx1.supercall = false;
  66902. //>>excludeEnd("ctx");;
  66903. $2=self._collection();
  66904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66905. $ctx1.sendIdx["collection"]=1;
  66906. //>>excludeEnd("ctx");
  66907. $3=$2;
  66908. $4=self._collection();
  66909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66910. $ctx1.sendIdx["collection"]=2;
  66911. //>>excludeEnd("ctx");
  66912. _st($3)._addAll_($4);
  66913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66914. $ctx1.sendIdx["addAll:"]=1;
  66915. //>>excludeEnd("ctx");
  66916. $5=_st($2)._yourself();
  66917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66918. $ctx1.sendIdx["yourself"]=1;
  66919. //>>excludeEnd("ctx");
  66920. $1=$5;
  66921. $6=self._collection();
  66922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66923. $ctx1.sendIdx["collection"]=3;
  66924. //>>excludeEnd("ctx");
  66925. self._assert_equals_($1,$6);
  66926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66927. $ctx1.sendIdx["assert:equals:"]=1;
  66928. //>>excludeEnd("ctx");
  66929. $8=self._collection();
  66930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66931. $ctx1.sendIdx["collection"]=4;
  66932. //>>excludeEnd("ctx");
  66933. $9=$8;
  66934. $10=self._collectionWithNewValue();
  66935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66936. $ctx1.sendIdx["collectionWithNewValue"]=1;
  66937. //>>excludeEnd("ctx");
  66938. _st($9)._addAll_($10);
  66939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66940. $ctx1.sendIdx["addAll:"]=2;
  66941. //>>excludeEnd("ctx");
  66942. $11=_st($8)._yourself();
  66943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66944. $ctx1.sendIdx["yourself"]=2;
  66945. //>>excludeEnd("ctx");
  66946. $7=$11;
  66947. $12=self._collectionWithNewValue();
  66948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66949. $ctx1.sendIdx["collectionWithNewValue"]=2;
  66950. //>>excludeEnd("ctx");
  66951. self._assert_equals_($7,$12);
  66952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66953. $ctx1.sendIdx["assert:equals:"]=2;
  66954. //>>excludeEnd("ctx");
  66955. $14=self._collectionWithNewValue();
  66956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66957. $ctx1.sendIdx["collectionWithNewValue"]=3;
  66958. //>>excludeEnd("ctx");
  66959. _st($14)._addAll_(self._collection());
  66960. $15=_st($14)._yourself();
  66961. $13=$15;
  66962. self._assert_equals_($13,self._collectionWithNewValue());
  66963. return self;
  66964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66965. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)});
  66966. //>>excludeEnd("ctx");
  66967. },
  66968. //>>excludeStart("ide", pragmas.excludeIdeData);
  66969. args: [],
  66970. 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",
  66971. referencedClasses: [],
  66972. //>>excludeEnd("ide");
  66973. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  66974. }),
  66975. globals.SetTest);
  66976. smalltalk.addMethod(
  66977. smalltalk.method({
  66978. selector: "testAddRemove",
  66979. protocol: 'tests',
  66980. fn: function (){
  66981. var self=this;
  66982. var set;
  66983. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  66984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66985. return smalltalk.withContext(function($ctx1) {
  66986. //>>excludeEnd("ctx");
  66987. var $1,$2;
  66988. set=_st($Set())._new();
  66989. self._assert_(_st(set)._isEmpty());
  66990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66991. $ctx1.sendIdx["assert:"]=1;
  66992. //>>excludeEnd("ctx");
  66993. _st(set)._add_((3));
  66994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66995. $ctx1.sendIdx["add:"]=1;
  66996. //>>excludeEnd("ctx");
  66997. $1=_st(set)._includes_((3));
  66998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  66999. $ctx1.sendIdx["includes:"]=1;
  67000. //>>excludeEnd("ctx");
  67001. self._assert_($1);
  67002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67003. $ctx1.sendIdx["assert:"]=2;
  67004. //>>excludeEnd("ctx");
  67005. _st(set)._add_((5));
  67006. $2=_st(set)._includes_((5));
  67007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67008. $ctx1.sendIdx["includes:"]=2;
  67009. //>>excludeEnd("ctx");
  67010. self._assert_($2);
  67011. _st(set)._remove_((3));
  67012. self._deny_(_st(set)._includes_((3)));
  67013. return self;
  67014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67015. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)});
  67016. //>>excludeEnd("ctx");
  67017. },
  67018. //>>excludeStart("ide", pragmas.excludeIdeData);
  67019. args: [],
  67020. 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)",
  67021. referencedClasses: ["Set"],
  67022. //>>excludeEnd("ide");
  67023. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  67024. }),
  67025. globals.SetTest);
  67026. smalltalk.addMethod(
  67027. smalltalk.method({
  67028. selector: "testAt",
  67029. protocol: 'tests',
  67030. fn: function (){
  67031. var self=this;
  67032. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67033. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67035. return smalltalk.withContext(function($ctx1) {
  67036. //>>excludeEnd("ctx");
  67037. self._should_raise_((function(){
  67038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67039. return smalltalk.withContext(function($ctx2) {
  67040. //>>excludeEnd("ctx");
  67041. return _st(_st($Set())._new())._at_put_((1),(2));
  67042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67044. //>>excludeEnd("ctx");
  67045. }),$Error());
  67046. return self;
  67047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67048. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)});
  67049. //>>excludeEnd("ctx");
  67050. },
  67051. //>>excludeStart("ide", pragmas.excludeIdeData);
  67052. args: [],
  67053. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  67054. referencedClasses: ["Set", "Error"],
  67055. //>>excludeEnd("ide");
  67056. messageSends: ["should:raise:", "at:put:", "new"]
  67057. }),
  67058. globals.SetTest);
  67059. smalltalk.addMethod(
  67060. smalltalk.method({
  67061. selector: "testCollect",
  67062. protocol: 'tests',
  67063. fn: function (){
  67064. var self=this;
  67065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67066. return smalltalk.withContext(function($ctx1) {
  67067. //>>excludeEnd("ctx");
  67068. var $2,$1;
  67069. (
  67070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67071. $ctx1.supercall = true,
  67072. //>>excludeEnd("ctx");
  67073. globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  67074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67075. $ctx1.supercall = false;
  67076. //>>excludeEnd("ctx");;
  67077. $2=[(5), (6), (8)]._asSet();
  67078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67079. $ctx1.sendIdx["asSet"]=1;
  67080. //>>excludeEnd("ctx");
  67081. $1=_st($2)._collect_((function(x){
  67082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67083. return smalltalk.withContext(function($ctx2) {
  67084. //>>excludeEnd("ctx");
  67085. return _st(x).__backslash_backslash((3));
  67086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67087. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67088. //>>excludeEnd("ctx");
  67089. }));
  67090. self._assert_equals_($1,[(0), (2)]._asSet());
  67091. return self;
  67092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67093. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)});
  67094. //>>excludeEnd("ctx");
  67095. },
  67096. //>>excludeStart("ide", pragmas.excludeIdeData);
  67097. args: [],
  67098. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  67099. referencedClasses: [],
  67100. //>>excludeEnd("ide");
  67101. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  67102. }),
  67103. globals.SetTest);
  67104. smalltalk.addMethod(
  67105. smalltalk.method({
  67106. selector: "testComma",
  67107. protocol: 'tests',
  67108. fn: function (){
  67109. var self=this;
  67110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67111. return smalltalk.withContext(function($ctx1) {
  67112. //>>excludeEnd("ctx");
  67113. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  67114. (
  67115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67116. $ctx1.supercall = true,
  67117. //>>excludeEnd("ctx");
  67118. globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  67119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67120. $ctx1.supercall = false;
  67121. //>>excludeEnd("ctx");;
  67122. $2=self._collection();
  67123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67124. $ctx1.sendIdx["collection"]=1;
  67125. //>>excludeEnd("ctx");
  67126. $3=self._collection();
  67127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67128. $ctx1.sendIdx["collection"]=2;
  67129. //>>excludeEnd("ctx");
  67130. $1=_st($2).__comma($3);
  67131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67132. $ctx1.sendIdx[","]=1;
  67133. //>>excludeEnd("ctx");
  67134. $4=self._collection();
  67135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67136. $ctx1.sendIdx["collection"]=3;
  67137. //>>excludeEnd("ctx");
  67138. self._assert_equals_($1,$4);
  67139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67140. $ctx1.sendIdx["assert:equals:"]=1;
  67141. //>>excludeEnd("ctx");
  67142. $6=self._collection();
  67143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67144. $ctx1.sendIdx["collection"]=4;
  67145. //>>excludeEnd("ctx");
  67146. $7=self._collectionWithNewValue();
  67147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67148. $ctx1.sendIdx["collectionWithNewValue"]=1;
  67149. //>>excludeEnd("ctx");
  67150. $5=_st($6).__comma($7);
  67151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67152. $ctx1.sendIdx[","]=2;
  67153. //>>excludeEnd("ctx");
  67154. $8=self._collectionWithNewValue();
  67155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67156. $ctx1.sendIdx["collectionWithNewValue"]=2;
  67157. //>>excludeEnd("ctx");
  67158. self._assert_equals_($5,$8);
  67159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67160. $ctx1.sendIdx["assert:equals:"]=2;
  67161. //>>excludeEnd("ctx");
  67162. $10=self._collectionWithNewValue();
  67163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67164. $ctx1.sendIdx["collectionWithNewValue"]=3;
  67165. //>>excludeEnd("ctx");
  67166. $9=_st($10).__comma(self._collection());
  67167. self._assert_equals_($9,self._collectionWithNewValue());
  67168. return self;
  67169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67170. }, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)});
  67171. //>>excludeEnd("ctx");
  67172. },
  67173. //>>excludeStart("ide", pragmas.excludeIdeData);
  67174. args: [],
  67175. 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",
  67176. referencedClasses: [],
  67177. //>>excludeEnd("ide");
  67178. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  67179. }),
  67180. globals.SetTest);
  67181. smalltalk.addMethod(
  67182. smalltalk.method({
  67183. selector: "testComparing",
  67184. protocol: 'tests',
  67185. fn: function (){
  67186. var self=this;
  67187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67188. return smalltalk.withContext(function($ctx1) {
  67189. //>>excludeEnd("ctx");
  67190. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  67191. $1=[(0), (2)]._asSet();
  67192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67193. $ctx1.sendIdx["asSet"]=1;
  67194. //>>excludeEnd("ctx");
  67195. $2=[(0), (2)]._asSet();
  67196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67197. $ctx1.sendIdx["asSet"]=2;
  67198. //>>excludeEnd("ctx");
  67199. self._assert_equals_($1,$2);
  67200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67201. $ctx1.sendIdx["assert:equals:"]=1;
  67202. //>>excludeEnd("ctx");
  67203. $3=[(2), (0)]._asSet();
  67204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67205. $ctx1.sendIdx["asSet"]=3;
  67206. //>>excludeEnd("ctx");
  67207. $4=[(0), (2)]._asSet();
  67208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67209. $ctx1.sendIdx["asSet"]=4;
  67210. //>>excludeEnd("ctx");
  67211. self._assert_equals_($3,$4);
  67212. $6=[(0), (2), (3)]._asSet();
  67213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67214. $ctx1.sendIdx["asSet"]=5;
  67215. //>>excludeEnd("ctx");
  67216. $7=[(0), (2)]._asSet();
  67217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67218. $ctx1.sendIdx["asSet"]=6;
  67219. //>>excludeEnd("ctx");
  67220. $5=_st($6).__eq($7);
  67221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67222. $ctx1.sendIdx["="]=1;
  67223. //>>excludeEnd("ctx");
  67224. self._deny_($5);
  67225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67226. $ctx1.sendIdx["deny:"]=1;
  67227. //>>excludeEnd("ctx");
  67228. $9=[(1), (2)]._asSet();
  67229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67230. $ctx1.sendIdx["asSet"]=7;
  67231. //>>excludeEnd("ctx");
  67232. $8=_st($9).__eq([(0), (2)]._asSet());
  67233. self._deny_($8);
  67234. return self;
  67235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67236. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)});
  67237. //>>excludeEnd("ctx");
  67238. },
  67239. //>>excludeStart("ide", pragmas.excludeIdeData);
  67240. args: [],
  67241. 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",
  67242. referencedClasses: [],
  67243. //>>excludeEnd("ide");
  67244. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  67245. }),
  67246. globals.SetTest);
  67247. smalltalk.addMethod(
  67248. smalltalk.method({
  67249. selector: "testPrintString",
  67250. protocol: 'tests',
  67251. fn: function (){
  67252. var self=this;
  67253. var set;
  67254. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67256. return smalltalk.withContext(function($ctx1) {
  67257. //>>excludeEnd("ctx");
  67258. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  67259. set=_st($Set())._new();
  67260. $1=_st(set)._printString();
  67261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67262. $ctx1.sendIdx["printString"]=1;
  67263. //>>excludeEnd("ctx");
  67264. self._assert_equals_($1,"a Set ()");
  67265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67266. $ctx1.sendIdx["assert:equals:"]=1;
  67267. //>>excludeEnd("ctx");
  67268. $2=set;
  67269. _st($2)._add_((1));
  67270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67271. $ctx1.sendIdx["add:"]=1;
  67272. //>>excludeEnd("ctx");
  67273. $3=_st($2)._add_((3));
  67274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67275. $ctx1.sendIdx["add:"]=2;
  67276. //>>excludeEnd("ctx");
  67277. $4=_st(set)._printString();
  67278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67279. $ctx1.sendIdx["printString"]=2;
  67280. //>>excludeEnd("ctx");
  67281. self._assert_equals_($4,"a Set (1 3)");
  67282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67283. $ctx1.sendIdx["assert:equals:"]=2;
  67284. //>>excludeEnd("ctx");
  67285. _st(set)._add_("foo");
  67286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67287. $ctx1.sendIdx["add:"]=3;
  67288. //>>excludeEnd("ctx");
  67289. $5=_st(set)._printString();
  67290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67291. $ctx1.sendIdx["printString"]=3;
  67292. //>>excludeEnd("ctx");
  67293. self._assert_equals_($5,"a Set (1 3 'foo')");
  67294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67295. $ctx1.sendIdx["assert:equals:"]=3;
  67296. //>>excludeEnd("ctx");
  67297. $6=set;
  67298. _st($6)._remove_((1));
  67299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67300. $ctx1.sendIdx["remove:"]=1;
  67301. //>>excludeEnd("ctx");
  67302. $7=_st($6)._remove_((3));
  67303. $8=_st(set)._printString();
  67304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67305. $ctx1.sendIdx["printString"]=4;
  67306. //>>excludeEnd("ctx");
  67307. self._assert_equals_($8,"a Set ('foo')");
  67308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67309. $ctx1.sendIdx["assert:equals:"]=4;
  67310. //>>excludeEnd("ctx");
  67311. _st(set)._add_((3));
  67312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67313. $ctx1.sendIdx["add:"]=4;
  67314. //>>excludeEnd("ctx");
  67315. $9=_st(set)._printString();
  67316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67317. $ctx1.sendIdx["printString"]=5;
  67318. //>>excludeEnd("ctx");
  67319. self._assert_equals_($9,"a Set (3 'foo')");
  67320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67321. $ctx1.sendIdx["assert:equals:"]=5;
  67322. //>>excludeEnd("ctx");
  67323. _st(set)._add_((3));
  67324. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  67325. return self;
  67326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67327. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)});
  67328. //>>excludeEnd("ctx");
  67329. },
  67330. //>>excludeStart("ide", pragmas.excludeIdeData);
  67331. args: [],
  67332. 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'')'",
  67333. referencedClasses: ["Set"],
  67334. //>>excludeEnd("ide");
  67335. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  67336. }),
  67337. globals.SetTest);
  67338. smalltalk.addMethod(
  67339. smalltalk.method({
  67340. selector: "testUnboxedObjects",
  67341. protocol: 'tests',
  67342. fn: function (){
  67343. var self=this;
  67344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67345. return smalltalk.withContext(function($ctx1) {
  67346. //>>excludeEnd("ctx");
  67347. var $4,$3,$2,$1;
  67348. $4="foo"._yourself();
  67349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67350. $ctx1.sendIdx["yourself"]=1;
  67351. //>>excludeEnd("ctx");
  67352. $3=[$4,"foo"._yourself()];
  67353. $2=_st($3)._asSet();
  67354. $1=_st($2)._asArray();
  67355. self._assert_equals_($1,["foo"]);
  67356. return self;
  67357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67358. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)});
  67359. //>>excludeEnd("ctx");
  67360. },
  67361. //>>excludeStart("ide", pragmas.excludeIdeData);
  67362. args: [],
  67363. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  67364. referencedClasses: [],
  67365. //>>excludeEnd("ide");
  67366. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  67367. }),
  67368. globals.SetTest);
  67369. smalltalk.addMethod(
  67370. smalltalk.method({
  67371. selector: "testUnicity",
  67372. protocol: 'tests',
  67373. fn: function (){
  67374. var self=this;
  67375. var set;
  67376. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67378. return smalltalk.withContext(function($ctx1) {
  67379. //>>excludeEnd("ctx");
  67380. var $1;
  67381. set=_st($Set())._new();
  67382. _st(set)._add_((21));
  67383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67384. $ctx1.sendIdx["add:"]=1;
  67385. //>>excludeEnd("ctx");
  67386. _st(set)._add_("hello");
  67387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67388. $ctx1.sendIdx["add:"]=2;
  67389. //>>excludeEnd("ctx");
  67390. _st(set)._add_((21));
  67391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67392. $ctx1.sendIdx["add:"]=3;
  67393. //>>excludeEnd("ctx");
  67394. $1=_st(set)._size();
  67395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67396. $ctx1.sendIdx["size"]=1;
  67397. //>>excludeEnd("ctx");
  67398. self._assert_equals_($1,(2));
  67399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67400. $ctx1.sendIdx["assert:equals:"]=1;
  67401. //>>excludeEnd("ctx");
  67402. _st(set)._add_("hello");
  67403. self._assert_equals_(_st(set)._size(),(2));
  67404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67405. $ctx1.sendIdx["assert:equals:"]=2;
  67406. //>>excludeEnd("ctx");
  67407. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  67408. return self;
  67409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67410. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)});
  67411. //>>excludeEnd("ctx");
  67412. },
  67413. //>>excludeStart("ide", pragmas.excludeIdeData);
  67414. args: [],
  67415. 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')",
  67416. referencedClasses: ["Set"],
  67417. //>>excludeEnd("ide");
  67418. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  67419. }),
  67420. globals.SetTest);
  67421. smalltalk.addMethod(
  67422. smalltalk.method({
  67423. selector: "collectionClass",
  67424. protocol: 'fixture',
  67425. fn: function (){
  67426. var self=this;
  67427. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  67428. return $Set();
  67429. },
  67430. //>>excludeStart("ide", pragmas.excludeIdeData);
  67431. args: [],
  67432. source: "collectionClass\x0a\x09^ Set",
  67433. referencedClasses: ["Set"],
  67434. //>>excludeEnd("ide");
  67435. messageSends: []
  67436. }),
  67437. globals.SetTest.klass);
  67438. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  67439. smalltalk.addMethod(
  67440. smalltalk.method({
  67441. selector: "testShow",
  67442. protocol: 'tests',
  67443. fn: function (){
  67444. var self=this;
  67445. var originalTranscript;
  67446. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  67447. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  67448. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67450. return smalltalk.withContext(function($ctx1) {
  67451. //>>excludeEnd("ctx");
  67452. originalTranscript=_st($Transcript())._current();
  67453. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  67454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67455. $ctx1.sendIdx["register:"]=1;
  67456. //>>excludeEnd("ctx");
  67457. self._shouldnt_raise_((function(){
  67458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67459. return smalltalk.withContext(function($ctx2) {
  67460. //>>excludeEnd("ctx");
  67461. return _st($Transcript())._show_("Hello console!");
  67462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67463. $ctx2.sendIdx["show:"]=1;
  67464. //>>excludeEnd("ctx");
  67465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67467. //>>excludeEnd("ctx");
  67468. }),$Error());
  67469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67470. $ctx1.sendIdx["shouldnt:raise:"]=1;
  67471. //>>excludeEnd("ctx");
  67472. self._shouldnt_raise_((function(){
  67473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67474. return smalltalk.withContext(function($ctx2) {
  67475. //>>excludeEnd("ctx");
  67476. return _st($Transcript())._show_(console);
  67477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67478. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67479. //>>excludeEnd("ctx");
  67480. }),$Error());
  67481. _st($Transcript())._register_(originalTranscript);
  67482. return self;
  67483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67484. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)});
  67485. //>>excludeEnd("ctx");
  67486. },
  67487. //>>excludeStart("ide", pragmas.excludeIdeData);
  67488. args: [],
  67489. 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.",
  67490. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  67491. //>>excludeEnd("ide");
  67492. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  67493. }),
  67494. globals.ConsoleTranscriptTest);
  67495. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  67496. smalltalk.addMethod(
  67497. smalltalk.method({
  67498. selector: "jsNull",
  67499. protocol: 'accessing',
  67500. fn: function (){
  67501. var self=this;
  67502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67503. return smalltalk.withContext(function($ctx1) {
  67504. //>>excludeEnd("ctx");
  67505. return null;
  67506. return self;
  67507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67508. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)});
  67509. //>>excludeEnd("ctx");
  67510. },
  67511. //>>excludeStart("ide", pragmas.excludeIdeData);
  67512. args: [],
  67513. source: "jsNull\x0a\x09<return null>",
  67514. referencedClasses: [],
  67515. //>>excludeEnd("ide");
  67516. messageSends: []
  67517. }),
  67518. globals.JSObjectProxyTest);
  67519. smalltalk.addMethod(
  67520. smalltalk.method({
  67521. selector: "jsObject",
  67522. protocol: 'accessing',
  67523. fn: function (){
  67524. var self=this;
  67525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67526. return smalltalk.withContext(function($ctx1) {
  67527. //>>excludeEnd("ctx");
  67528. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  67529. return self;
  67530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67531. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)});
  67532. //>>excludeEnd("ctx");
  67533. },
  67534. //>>excludeStart("ide", pragmas.excludeIdeData);
  67535. args: [],
  67536. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  67537. referencedClasses: [],
  67538. //>>excludeEnd("ide");
  67539. messageSends: []
  67540. }),
  67541. globals.JSObjectProxyTest);
  67542. smalltalk.addMethod(
  67543. smalltalk.method({
  67544. selector: "jsUndefined",
  67545. protocol: 'accessing',
  67546. fn: function (){
  67547. var self=this;
  67548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67549. return smalltalk.withContext(function($ctx1) {
  67550. //>>excludeEnd("ctx");
  67551. return;
  67552. return self;
  67553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67554. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)});
  67555. //>>excludeEnd("ctx");
  67556. },
  67557. //>>excludeStart("ide", pragmas.excludeIdeData);
  67558. args: [],
  67559. source: "jsUndefined\x0a\x09<return>",
  67560. referencedClasses: [],
  67561. //>>excludeEnd("ide");
  67562. messageSends: []
  67563. }),
  67564. globals.JSObjectProxyTest);
  67565. smalltalk.addMethod(
  67566. smalltalk.method({
  67567. selector: "testAtIfAbsent",
  67568. protocol: 'tests',
  67569. fn: function (){
  67570. var self=this;
  67571. var testObject;
  67572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67573. return smalltalk.withContext(function($ctx1) {
  67574. //>>excludeEnd("ctx");
  67575. var $1,$2,$3;
  67576. testObject=self._jsObject();
  67577. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  67578. return "Property does not exist";
  67579. }));
  67580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67581. $ctx1.sendIdx["at:ifAbsent:"]=1;
  67582. //>>excludeEnd("ctx");
  67583. self._assert_equals_($1,"Property does not exist");
  67584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67585. $ctx1.sendIdx["assert:equals:"]=1;
  67586. //>>excludeEnd("ctx");
  67587. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  67588. return "Property does not exist";
  67589. }));
  67590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67591. $ctx1.sendIdx["at:ifAbsent:"]=2;
  67592. //>>excludeEnd("ctx");
  67593. self._assert_equals_($2,nil);
  67594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67595. $ctx1.sendIdx["assert:equals:"]=2;
  67596. //>>excludeEnd("ctx");
  67597. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  67598. return "Property does not exist";
  67599. }));
  67600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67601. $ctx1.sendIdx["at:ifAbsent:"]=3;
  67602. //>>excludeEnd("ctx");
  67603. self._assert_equals_($3,(1));
  67604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67605. $ctx1.sendIdx["assert:equals:"]=3;
  67606. //>>excludeEnd("ctx");
  67607. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  67608. return "Property does not exist";
  67609. })),nil);
  67610. return self;
  67611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67612. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  67613. //>>excludeEnd("ctx");
  67614. },
  67615. //>>excludeStart("ide", pragmas.excludeIdeData);
  67616. args: [],
  67617. 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.",
  67618. referencedClasses: [],
  67619. //>>excludeEnd("ide");
  67620. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  67621. }),
  67622. globals.JSObjectProxyTest);
  67623. smalltalk.addMethod(
  67624. smalltalk.method({
  67625. selector: "testAtIfPresent",
  67626. protocol: 'tests',
  67627. fn: function (){
  67628. var self=this;
  67629. var testObject;
  67630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67631. return smalltalk.withContext(function($ctx1) {
  67632. //>>excludeEnd("ctx");
  67633. var $2,$1,$4,$3,$6,$5;
  67634. testObject=self._jsObject();
  67635. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  67636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67637. return smalltalk.withContext(function($ctx2) {
  67638. //>>excludeEnd("ctx");
  67639. $2=_st(x)._asString();
  67640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67641. $ctx2.sendIdx["asString"]=1;
  67642. //>>excludeEnd("ctx");
  67643. return "hello ".__comma($2);
  67644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67645. $ctx2.sendIdx[","]=1;
  67646. //>>excludeEnd("ctx");
  67647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67648. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67649. //>>excludeEnd("ctx");
  67650. }));
  67651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67652. $ctx1.sendIdx["at:ifPresent:"]=1;
  67653. //>>excludeEnd("ctx");
  67654. self._assert_equals_($1,nil);
  67655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67656. $ctx1.sendIdx["assert:equals:"]=1;
  67657. //>>excludeEnd("ctx");
  67658. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  67659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67660. return smalltalk.withContext(function($ctx2) {
  67661. //>>excludeEnd("ctx");
  67662. $4=_st(x)._asString();
  67663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67664. $ctx2.sendIdx["asString"]=2;
  67665. //>>excludeEnd("ctx");
  67666. return "hello ".__comma($4);
  67667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67668. $ctx2.sendIdx[","]=2;
  67669. //>>excludeEnd("ctx");
  67670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67671. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  67672. //>>excludeEnd("ctx");
  67673. }));
  67674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67675. $ctx1.sendIdx["at:ifPresent:"]=2;
  67676. //>>excludeEnd("ctx");
  67677. self._assert_equals_($3,"hello nil");
  67678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67679. $ctx1.sendIdx["assert:equals:"]=2;
  67680. //>>excludeEnd("ctx");
  67681. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  67682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67683. return smalltalk.withContext(function($ctx2) {
  67684. //>>excludeEnd("ctx");
  67685. $6=_st(x)._asString();
  67686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67687. $ctx2.sendIdx["asString"]=3;
  67688. //>>excludeEnd("ctx");
  67689. return "hello ".__comma($6);
  67690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67691. $ctx2.sendIdx[","]=3;
  67692. //>>excludeEnd("ctx");
  67693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67694. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  67695. //>>excludeEnd("ctx");
  67696. }));
  67697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67698. $ctx1.sendIdx["at:ifPresent:"]=3;
  67699. //>>excludeEnd("ctx");
  67700. self._assert_equals_($5,"hello 1");
  67701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67702. $ctx1.sendIdx["assert:equals:"]=3;
  67703. //>>excludeEnd("ctx");
  67704. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  67705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67706. return smalltalk.withContext(function($ctx2) {
  67707. //>>excludeEnd("ctx");
  67708. return "hello ".__comma(_st(x)._asString());
  67709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67710. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  67711. //>>excludeEnd("ctx");
  67712. })),"hello nil");
  67713. return self;
  67714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67715. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)});
  67716. //>>excludeEnd("ctx");
  67717. },
  67718. //>>excludeStart("ide", pragmas.excludeIdeData);
  67719. args: [],
  67720. 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'.",
  67721. referencedClasses: [],
  67722. //>>excludeEnd("ide");
  67723. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  67724. }),
  67725. globals.JSObjectProxyTest);
  67726. smalltalk.addMethod(
  67727. smalltalk.method({
  67728. selector: "testAtIfPresentIfAbsent",
  67729. protocol: 'tests',
  67730. fn: function (){
  67731. var self=this;
  67732. var testObject;
  67733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67734. return smalltalk.withContext(function($ctx1) {
  67735. //>>excludeEnd("ctx");
  67736. var $2,$1,$4,$3,$6,$5;
  67737. testObject=self._jsObject();
  67738. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  67739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67740. return smalltalk.withContext(function($ctx2) {
  67741. //>>excludeEnd("ctx");
  67742. $2=_st(x)._asString();
  67743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67744. $ctx2.sendIdx["asString"]=1;
  67745. //>>excludeEnd("ctx");
  67746. return "hello ".__comma($2);
  67747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67748. $ctx2.sendIdx[","]=1;
  67749. //>>excludeEnd("ctx");
  67750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67751. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  67752. //>>excludeEnd("ctx");
  67753. }),(function(){
  67754. return "not present";
  67755. }));
  67756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67757. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  67758. //>>excludeEnd("ctx");
  67759. self._assert_equals_($1,"not present");
  67760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67761. $ctx1.sendIdx["assert:equals:"]=1;
  67762. //>>excludeEnd("ctx");
  67763. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  67764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67765. return smalltalk.withContext(function($ctx2) {
  67766. //>>excludeEnd("ctx");
  67767. $4=_st(x)._asString();
  67768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67769. $ctx2.sendIdx["asString"]=2;
  67770. //>>excludeEnd("ctx");
  67771. return "hello ".__comma($4);
  67772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67773. $ctx2.sendIdx[","]=2;
  67774. //>>excludeEnd("ctx");
  67775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67776. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  67777. //>>excludeEnd("ctx");
  67778. }),(function(){
  67779. return "not present";
  67780. }));
  67781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67782. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  67783. //>>excludeEnd("ctx");
  67784. self._assert_equals_($3,"hello nil");
  67785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67786. $ctx1.sendIdx["assert:equals:"]=2;
  67787. //>>excludeEnd("ctx");
  67788. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  67789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67790. return smalltalk.withContext(function($ctx2) {
  67791. //>>excludeEnd("ctx");
  67792. $6=_st(x)._asString();
  67793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67794. $ctx2.sendIdx["asString"]=3;
  67795. //>>excludeEnd("ctx");
  67796. return "hello ".__comma($6);
  67797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67798. $ctx2.sendIdx[","]=3;
  67799. //>>excludeEnd("ctx");
  67800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67801. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  67802. //>>excludeEnd("ctx");
  67803. }),(function(){
  67804. return "not present";
  67805. }));
  67806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67807. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  67808. //>>excludeEnd("ctx");
  67809. self._assert_equals_($5,"hello 1");
  67810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67811. $ctx1.sendIdx["assert:equals:"]=3;
  67812. //>>excludeEnd("ctx");
  67813. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  67814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67815. return smalltalk.withContext(function($ctx2) {
  67816. //>>excludeEnd("ctx");
  67817. return "hello ".__comma(_st(x)._asString());
  67818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67819. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  67820. //>>excludeEnd("ctx");
  67821. }),(function(){
  67822. return "not present";
  67823. })),"hello nil");
  67824. return self;
  67825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67826. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)});
  67827. //>>excludeEnd("ctx");
  67828. },
  67829. //>>excludeStart("ide", pragmas.excludeIdeData);
  67830. args: [],
  67831. 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'.",
  67832. referencedClasses: [],
  67833. //>>excludeEnd("ide");
  67834. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  67835. }),
  67836. globals.JSObjectProxyTest);
  67837. smalltalk.addMethod(
  67838. smalltalk.method({
  67839. selector: "testAtPut",
  67840. protocol: 'tests',
  67841. fn: function (){
  67842. var self=this;
  67843. var testObject;
  67844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67845. return smalltalk.withContext(function($ctx1) {
  67846. //>>excludeEnd("ctx");
  67847. var $2,$1;
  67848. testObject=self._jsObject();
  67849. $2=_st(testObject)._at_("abc");
  67850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67851. $ctx1.sendIdx["at:"]=1;
  67852. //>>excludeEnd("ctx");
  67853. $1=_st($2).__tild_eq("xyz");
  67854. self._assert_($1);
  67855. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  67856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67857. $ctx1.sendIdx["assert:equals:"]=1;
  67858. //>>excludeEnd("ctx");
  67859. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  67860. return self;
  67861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67862. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)});
  67863. //>>excludeEnd("ctx");
  67864. },
  67865. //>>excludeStart("ide", pragmas.excludeIdeData);
  67866. args: [],
  67867. 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'",
  67868. referencedClasses: [],
  67869. //>>excludeEnd("ide");
  67870. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  67871. }),
  67872. globals.JSObjectProxyTest);
  67873. smalltalk.addMethod(
  67874. smalltalk.method({
  67875. selector: "testComparison",
  67876. protocol: 'tests',
  67877. fn: function (){
  67878. var self=this;
  67879. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  67880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67881. return smalltalk.withContext(function($ctx1) {
  67882. //>>excludeEnd("ctx");
  67883. var $1,$2;
  67884. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  67885. $1=_st(console).__eq(console);
  67886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67887. $ctx1.sendIdx["="]=1;
  67888. //>>excludeEnd("ctx");
  67889. self._assert_($1);
  67890. $2=_st(console).__eq(_st($Object())._new());
  67891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67892. $ctx1.sendIdx["="]=2;
  67893. //>>excludeEnd("ctx");
  67894. self._deny_($2);
  67895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67896. $ctx1.sendIdx["deny:"]=1;
  67897. //>>excludeEnd("ctx");
  67898. self._deny_(_st(console).__eq(self._jsObject()));
  67899. return self;
  67900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67901. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)});
  67902. //>>excludeEnd("ctx");
  67903. },
  67904. //>>excludeStart("ide", pragmas.excludeIdeData);
  67905. args: [],
  67906. 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",
  67907. referencedClasses: ["Object"],
  67908. //>>excludeEnd("ide");
  67909. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  67910. }),
  67911. globals.JSObjectProxyTest);
  67912. smalltalk.addMethod(
  67913. smalltalk.method({
  67914. selector: "testDNU",
  67915. protocol: 'tests',
  67916. fn: function (){
  67917. var self=this;
  67918. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  67919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67920. return smalltalk.withContext(function($ctx1) {
  67921. //>>excludeEnd("ctx");
  67922. self._should_raise_((function(){
  67923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67924. return smalltalk.withContext(function($ctx2) {
  67925. //>>excludeEnd("ctx");
  67926. return _st(self._jsObject())._foo();
  67927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67928. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67929. //>>excludeEnd("ctx");
  67930. }),$MessageNotUnderstood());
  67931. return self;
  67932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67933. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)});
  67934. //>>excludeEnd("ctx");
  67935. },
  67936. //>>excludeStart("ide", pragmas.excludeIdeData);
  67937. args: [],
  67938. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  67939. referencedClasses: ["MessageNotUnderstood"],
  67940. //>>excludeEnd("ide");
  67941. messageSends: ["should:raise:", "foo", "jsObject"]
  67942. }),
  67943. globals.JSObjectProxyTest);
  67944. smalltalk.addMethod(
  67945. smalltalk.method({
  67946. selector: "testDNURegression1057",
  67947. protocol: 'tests',
  67948. fn: function (){
  67949. var self=this;
  67950. var jsObject;
  67951. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  67952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67953. return smalltalk.withContext(function($ctx1) {
  67954. //>>excludeEnd("ctx");
  67955. var $1;
  67956. jsObject=[];
  67957. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  67958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67959. $ctx1.sendIdx["basicAt:put:"]=1;
  67960. //>>excludeEnd("ctx");
  67961. _st(jsObject)._basicAt_put_("foo",(3));
  67962. self._shouldnt_raise_((function(){
  67963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67964. return smalltalk.withContext(function($ctx2) {
  67965. //>>excludeEnd("ctx");
  67966. return _st(jsObject)._foo();
  67967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67968. $ctx2.sendIdx["foo"]=1;
  67969. //>>excludeEnd("ctx");
  67970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  67972. //>>excludeEnd("ctx");
  67973. }),$Error());
  67974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67975. $ctx1.sendIdx["shouldnt:raise:"]=1;
  67976. //>>excludeEnd("ctx");
  67977. $1=_st(jsObject)._foo();
  67978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67979. $ctx1.sendIdx["foo"]=2;
  67980. //>>excludeEnd("ctx");
  67981. self._assert_equals_($1,(3));
  67982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67983. $ctx1.sendIdx["assert:equals:"]=1;
  67984. //>>excludeEnd("ctx");
  67985. self._shouldnt_raise_((function(){
  67986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67987. return smalltalk.withContext(function($ctx2) {
  67988. //>>excludeEnd("ctx");
  67989. return _st(jsObject)._foo_((4));
  67990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  67992. //>>excludeEnd("ctx");
  67993. }),$Error());
  67994. self._assert_equals_(_st(jsObject)._foo(),(4));
  67995. return self;
  67996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67997. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},globals.JSObjectProxyTest)});
  67998. //>>excludeEnd("ctx");
  67999. },
  68000. //>>excludeStart("ide", pragmas.excludeIdeData);
  68001. args: [],
  68002. source: "testDNURegression1057\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'foo' put: 3.\x0a\x09self shouldnt: [ jsObject foo ] raise: Error.\x0a\x09self assert: jsObject foo equals: 3.\x0a\x09self shouldnt: [ jsObject foo: 4 ] raise: Error.\x0a\x09self assert: jsObject foo equals: 4",
  68003. referencedClasses: ["Error"],
  68004. //>>excludeEnd("ide");
  68005. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  68006. }),
  68007. globals.JSObjectProxyTest);
  68008. smalltalk.addMethod(
  68009. smalltalk.method({
  68010. selector: "testDNURegression1059",
  68011. protocol: 'tests',
  68012. fn: function (){
  68013. var self=this;
  68014. var jsObject;
  68015. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68017. return smalltalk.withContext(function($ctx1) {
  68018. //>>excludeEnd("ctx");
  68019. jsObject=[];
  68020. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  68021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68022. $ctx1.sendIdx["basicAt:put:"]=1;
  68023. //>>excludeEnd("ctx");
  68024. _st(jsObject)._basicAt_put_("x",(3));
  68025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68026. $ctx1.sendIdx["basicAt:put:"]=2;
  68027. //>>excludeEnd("ctx");
  68028. _st(jsObject)._basicAt_put_("x:",(function(){
  68029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68030. return smalltalk.withContext(function($ctx2) {
  68031. //>>excludeEnd("ctx");
  68032. return self._error();
  68033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68035. //>>excludeEnd("ctx");
  68036. }));
  68037. self._shouldnt_raise_((function(){
  68038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68039. return smalltalk.withContext(function($ctx2) {
  68040. //>>excludeEnd("ctx");
  68041. return _st(jsObject)._x_((4));
  68042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68043. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  68044. //>>excludeEnd("ctx");
  68045. }),$Error());
  68046. self._assert_equals_(_st(jsObject)._x(),(4));
  68047. return self;
  68048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68049. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},globals.JSObjectProxyTest)});
  68050. //>>excludeEnd("ctx");
  68051. },
  68052. //>>excludeStart("ide", pragmas.excludeIdeData);
  68053. args: [],
  68054. source: "testDNURegression1059\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: 3.\x0a\x09jsObject basicAt: 'x:' put: [ self error ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: jsObject x equals: 4",
  68055. referencedClasses: ["Error"],
  68056. //>>excludeEnd("ide");
  68057. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  68058. }),
  68059. globals.JSObjectProxyTest);
  68060. smalltalk.addMethod(
  68061. smalltalk.method({
  68062. selector: "testDNURegression1062",
  68063. protocol: 'tests',
  68064. fn: function (){
  68065. var self=this;
  68066. var jsObject,stored;
  68067. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68069. return smalltalk.withContext(function($ctx1) {
  68070. //>>excludeEnd("ctx");
  68071. jsObject=[];
  68072. _st(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  68073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68074. $ctx1.sendIdx["basicAt:put:"]=1;
  68075. //>>excludeEnd("ctx");
  68076. _st(jsObject)._basicAt_put_("x",(function(v){
  68077. stored=v;
  68078. return stored;
  68079. }));
  68080. self._shouldnt_raise_((function(){
  68081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68082. return smalltalk.withContext(function($ctx2) {
  68083. //>>excludeEnd("ctx");
  68084. return _st(jsObject)._x_((4));
  68085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  68087. //>>excludeEnd("ctx");
  68088. }),$Error());
  68089. self._assert_equals_(stored,(4));
  68090. return self;
  68091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68092. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},globals.JSObjectProxyTest)});
  68093. //>>excludeEnd("ctx");
  68094. },
  68095. //>>excludeStart("ide", pragmas.excludeIdeData);
  68096. args: [],
  68097. source: "testDNURegression1062\x0a\x09| jsObject stored |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09jsObject basicAt: 'x' put: [ :v | stored := v ].\x0a\x09self shouldnt: [ jsObject x: 4 ] raise: Error.\x0a\x09self assert: stored equals: 4",
  68098. referencedClasses: ["Error"],
  68099. //>>excludeEnd("ide");
  68100. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  68101. }),
  68102. globals.JSObjectProxyTest);
  68103. smalltalk.addMethod(
  68104. smalltalk.method({
  68105. selector: "testMessageSend",
  68106. protocol: 'tests',
  68107. fn: function (){
  68108. var self=this;
  68109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68110. return smalltalk.withContext(function($ctx1) {
  68111. //>>excludeEnd("ctx");
  68112. var $2,$1,$4,$3;
  68113. $2=self._jsObject();
  68114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68115. $ctx1.sendIdx["jsObject"]=1;
  68116. //>>excludeEnd("ctx");
  68117. $1=_st($2)._a();
  68118. self._assert_equals_($1,(1));
  68119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68120. $ctx1.sendIdx["assert:equals:"]=1;
  68121. //>>excludeEnd("ctx");
  68122. $4=self._jsObject();
  68123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68124. $ctx1.sendIdx["jsObject"]=2;
  68125. //>>excludeEnd("ctx");
  68126. $3=_st($4)._b();
  68127. self._assert_equals_($3,(2));
  68128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68129. $ctx1.sendIdx["assert:equals:"]=2;
  68130. //>>excludeEnd("ctx");
  68131. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  68132. return self;
  68133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68134. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)});
  68135. //>>excludeEnd("ctx");
  68136. },
  68137. //>>excludeStart("ide", pragmas.excludeIdeData);
  68138. args: [],
  68139. 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",
  68140. referencedClasses: [],
  68141. //>>excludeEnd("ide");
  68142. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  68143. }),
  68144. globals.JSObjectProxyTest);
  68145. smalltalk.addMethod(
  68146. smalltalk.method({
  68147. selector: "testMethodWithArguments",
  68148. protocol: 'tests',
  68149. fn: function (){
  68150. var self=this;
  68151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68152. return smalltalk.withContext(function($ctx1) {
  68153. //>>excludeEnd("ctx");
  68154. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  68155. return self;
  68156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68157. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)});
  68158. //>>excludeEnd("ctx");
  68159. },
  68160. //>>excludeStart("ide", pragmas.excludeIdeData);
  68161. args: [],
  68162. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  68163. referencedClasses: [],
  68164. //>>excludeEnd("ide");
  68165. messageSends: ["assert:equals:", "c:", "jsObject"]
  68166. }),
  68167. globals.JSObjectProxyTest);
  68168. smalltalk.addMethod(
  68169. smalltalk.method({
  68170. selector: "testPrinting",
  68171. protocol: 'tests',
  68172. fn: function (){
  68173. var self=this;
  68174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68175. return smalltalk.withContext(function($ctx1) {
  68176. //>>excludeEnd("ctx");
  68177. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  68178. return self;
  68179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68180. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)});
  68181. //>>excludeEnd("ctx");
  68182. },
  68183. //>>excludeStart("ide", pragmas.excludeIdeData);
  68184. args: [],
  68185. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  68186. referencedClasses: [],
  68187. //>>excludeEnd("ide");
  68188. messageSends: ["assert:equals:", "printString", "jsObject"]
  68189. }),
  68190. globals.JSObjectProxyTest);
  68191. smalltalk.addMethod(
  68192. smalltalk.method({
  68193. selector: "testPropertyThatReturnsEmptyString",
  68194. protocol: 'tests',
  68195. fn: function (){
  68196. var self=this;
  68197. var object;
  68198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68199. return smalltalk.withContext(function($ctx1) {
  68200. //>>excludeEnd("ctx");
  68201. var $1;
  68202. object=self._jsObject();
  68203. $1=_st(object)._d();
  68204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68205. $ctx1.sendIdx["d"]=1;
  68206. //>>excludeEnd("ctx");
  68207. self._assert_equals_($1,"");
  68208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68209. $ctx1.sendIdx["assert:equals:"]=1;
  68210. //>>excludeEnd("ctx");
  68211. _st(object)._d_("hello");
  68212. self._assert_equals_(_st(object)._d(),"hello");
  68213. return self;
  68214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68215. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)});
  68216. //>>excludeEnd("ctx");
  68217. },
  68218. //>>excludeStart("ide", pragmas.excludeIdeData);
  68219. args: [],
  68220. 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'",
  68221. referencedClasses: [],
  68222. //>>excludeEnd("ide");
  68223. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  68224. }),
  68225. globals.JSObjectProxyTest);
  68226. smalltalk.addMethod(
  68227. smalltalk.method({
  68228. selector: "testPropertyThatReturnsUndefined",
  68229. protocol: 'tests',
  68230. fn: function (){
  68231. var self=this;
  68232. var object;
  68233. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68235. return smalltalk.withContext(function($ctx1) {
  68236. //>>excludeEnd("ctx");
  68237. object=self._jsObject();
  68238. self._shouldnt_raise_((function(){
  68239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68240. return smalltalk.withContext(function($ctx2) {
  68241. //>>excludeEnd("ctx");
  68242. return _st(object)._e();
  68243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68244. $ctx2.sendIdx["e"]=1;
  68245. //>>excludeEnd("ctx");
  68246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68248. //>>excludeEnd("ctx");
  68249. }),$MessageNotUnderstood());
  68250. self._assert_(_st(_st(object)._e())._isNil());
  68251. return self;
  68252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68253. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)});
  68254. //>>excludeEnd("ctx");
  68255. },
  68256. //>>excludeStart("ide", pragmas.excludeIdeData);
  68257. args: [],
  68258. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  68259. referencedClasses: ["MessageNotUnderstood"],
  68260. //>>excludeEnd("ide");
  68261. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  68262. }),
  68263. globals.JSObjectProxyTest);
  68264. smalltalk.addMethod(
  68265. smalltalk.method({
  68266. selector: "testSetPropertyWithFalsyValue",
  68267. protocol: 'tests',
  68268. fn: function (){
  68269. var self=this;
  68270. var jsObject;
  68271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68272. return smalltalk.withContext(function($ctx1) {
  68273. //>>excludeEnd("ctx");
  68274. var $1,$2,$3,$4,$5;
  68275. jsObject=self._jsObject();
  68276. $1=_st(jsObject)._a();
  68277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68278. $ctx1.sendIdx["a"]=1;
  68279. //>>excludeEnd("ctx");
  68280. self._assert_equals_($1,(1));
  68281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68282. $ctx1.sendIdx["assert:equals:"]=1;
  68283. //>>excludeEnd("ctx");
  68284. _st(jsObject)._a_(self._jsNull());
  68285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68286. $ctx1.sendIdx["a:"]=1;
  68287. //>>excludeEnd("ctx");
  68288. $2=_st(jsObject)._a();
  68289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68290. $ctx1.sendIdx["a"]=2;
  68291. //>>excludeEnd("ctx");
  68292. self._assert_equals_($2,nil);
  68293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68294. $ctx1.sendIdx["assert:equals:"]=2;
  68295. //>>excludeEnd("ctx");
  68296. _st(jsObject)._a_((0));
  68297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68298. $ctx1.sendIdx["a:"]=2;
  68299. //>>excludeEnd("ctx");
  68300. $3=_st(jsObject)._a();
  68301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68302. $ctx1.sendIdx["a"]=3;
  68303. //>>excludeEnd("ctx");
  68304. self._assert_equals_($3,(0));
  68305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68306. $ctx1.sendIdx["assert:equals:"]=3;
  68307. //>>excludeEnd("ctx");
  68308. _st(jsObject)._a_(self._jsUndefined());
  68309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68310. $ctx1.sendIdx["a:"]=3;
  68311. //>>excludeEnd("ctx");
  68312. $4=_st(jsObject)._a();
  68313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68314. $ctx1.sendIdx["a"]=4;
  68315. //>>excludeEnd("ctx");
  68316. self._assert_equals_($4,nil);
  68317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68318. $ctx1.sendIdx["assert:equals:"]=4;
  68319. //>>excludeEnd("ctx");
  68320. _st(jsObject)._a_("");
  68321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68322. $ctx1.sendIdx["a:"]=4;
  68323. //>>excludeEnd("ctx");
  68324. $5=_st(jsObject)._a();
  68325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68326. $ctx1.sendIdx["a"]=5;
  68327. //>>excludeEnd("ctx");
  68328. self._assert_equals_($5,"");
  68329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68330. $ctx1.sendIdx["assert:equals:"]=5;
  68331. //>>excludeEnd("ctx");
  68332. _st(jsObject)._a_(false);
  68333. self._assert_equals_(_st(jsObject)._a(),false);
  68334. return self;
  68335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68336. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)});
  68337. //>>excludeEnd("ctx");
  68338. },
  68339. //>>excludeStart("ide", pragmas.excludeIdeData);
  68340. args: [],
  68341. 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",
  68342. referencedClasses: [],
  68343. //>>excludeEnd("ide");
  68344. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  68345. }),
  68346. globals.JSObjectProxyTest);
  68347. smalltalk.addMethod(
  68348. smalltalk.method({
  68349. selector: "testValue",
  68350. protocol: 'tests',
  68351. fn: function (){
  68352. var self=this;
  68353. var testObject;
  68354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68355. return smalltalk.withContext(function($ctx1) {
  68356. //>>excludeEnd("ctx");
  68357. testObject=self._jsObject();
  68358. _st(testObject)._at_put_("value","aValue");
  68359. self._assert_equals_(_st(testObject)._value(),"aValue");
  68360. return self;
  68361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68362. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)});
  68363. //>>excludeEnd("ctx");
  68364. },
  68365. //>>excludeStart("ide", pragmas.excludeIdeData);
  68366. args: [],
  68367. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  68368. referencedClasses: [],
  68369. //>>excludeEnd("ide");
  68370. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  68371. }),
  68372. globals.JSObjectProxyTest);
  68373. smalltalk.addMethod(
  68374. smalltalk.method({
  68375. selector: "testYourself",
  68376. protocol: 'tests',
  68377. fn: function (){
  68378. var self=this;
  68379. var object;
  68380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68381. return smalltalk.withContext(function($ctx1) {
  68382. //>>excludeEnd("ctx");
  68383. var $1,$2;
  68384. $1=self._jsObject();
  68385. _st($1)._d_("test");
  68386. $2=_st($1)._yourself();
  68387. object=$2;
  68388. self._assert_equals_(_st(object)._d(),"test");
  68389. return self;
  68390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68391. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)});
  68392. //>>excludeEnd("ctx");
  68393. },
  68394. //>>excludeStart("ide", pragmas.excludeIdeData);
  68395. args: [],
  68396. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  68397. referencedClasses: [],
  68398. //>>excludeEnd("ide");
  68399. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  68400. }),
  68401. globals.JSObjectProxyTest);
  68402. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  68403. smalltalk.addMethod(
  68404. smalltalk.method({
  68405. selector: "testCatchingException",
  68406. protocol: 'tests',
  68407. fn: function (){
  68408. var self=this;
  68409. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  68410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68411. return smalltalk.withContext(function($ctx1) {
  68412. //>>excludeEnd("ctx");
  68413. _st((function(){
  68414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68415. return smalltalk.withContext(function($ctx2) {
  68416. //>>excludeEnd("ctx");
  68417. return self._throwException();
  68418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68420. //>>excludeEnd("ctx");
  68421. }))._on_do_($Error(),(function(error){
  68422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68423. return smalltalk.withContext(function($ctx2) {
  68424. //>>excludeEnd("ctx");
  68425. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  68426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68427. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  68428. //>>excludeEnd("ctx");
  68429. }));
  68430. return self;
  68431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68432. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)});
  68433. //>>excludeEnd("ctx");
  68434. },
  68435. //>>excludeStart("ide", pragmas.excludeIdeData);
  68436. args: [],
  68437. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  68438. referencedClasses: ["Error"],
  68439. //>>excludeEnd("ide");
  68440. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  68441. }),
  68442. globals.JavaScriptExceptionTest);
  68443. smalltalk.addMethod(
  68444. smalltalk.method({
  68445. selector: "testRaisingException",
  68446. protocol: 'tests',
  68447. fn: function (){
  68448. var self=this;
  68449. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  68450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68451. return smalltalk.withContext(function($ctx1) {
  68452. //>>excludeEnd("ctx");
  68453. self._should_raise_((function(){
  68454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68455. return smalltalk.withContext(function($ctx2) {
  68456. //>>excludeEnd("ctx");
  68457. return self._throwException();
  68458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68460. //>>excludeEnd("ctx");
  68461. }),$JavaScriptException());
  68462. return self;
  68463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68464. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)});
  68465. //>>excludeEnd("ctx");
  68466. },
  68467. //>>excludeStart("ide", pragmas.excludeIdeData);
  68468. args: [],
  68469. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  68470. referencedClasses: ["JavaScriptException"],
  68471. //>>excludeEnd("ide");
  68472. messageSends: ["should:raise:", "throwException"]
  68473. }),
  68474. globals.JavaScriptExceptionTest);
  68475. smalltalk.addMethod(
  68476. smalltalk.method({
  68477. selector: "throwException",
  68478. protocol: 'helpers',
  68479. fn: function (){
  68480. var self=this;
  68481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68482. return smalltalk.withContext(function($ctx1) {
  68483. //>>excludeEnd("ctx");
  68484. throw 'test';
  68485. return self;
  68486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68487. }, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)});
  68488. //>>excludeEnd("ctx");
  68489. },
  68490. //>>excludeStart("ide", pragmas.excludeIdeData);
  68491. args: [],
  68492. source: "throwException\x0a\x09<throw 'test'>",
  68493. referencedClasses: [],
  68494. //>>excludeEnd("ide");
  68495. messageSends: []
  68496. }),
  68497. globals.JavaScriptExceptionTest);
  68498. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  68499. smalltalk.addMethod(
  68500. smalltalk.method({
  68501. selector: "testValue",
  68502. protocol: 'tests',
  68503. fn: function (){
  68504. var self=this;
  68505. var messageSend;
  68506. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  68507. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  68508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68509. return smalltalk.withContext(function($ctx1) {
  68510. //>>excludeEnd("ctx");
  68511. var $1,$2;
  68512. $1=_st($MessageSend())._new();
  68513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68514. $ctx1.sendIdx["new"]=1;
  68515. //>>excludeEnd("ctx");
  68516. _st($1)._receiver_(_st($Object())._new());
  68517. _st($1)._selector_("asString");
  68518. $2=_st($1)._yourself();
  68519. messageSend=$2;
  68520. self._assert_equals_(_st(messageSend)._value(),"an Object");
  68521. return self;
  68522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68523. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)});
  68524. //>>excludeEnd("ctx");
  68525. },
  68526. //>>excludeStart("ide", pragmas.excludeIdeData);
  68527. args: [],
  68528. 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'",
  68529. referencedClasses: ["MessageSend", "Object"],
  68530. //>>excludeEnd("ide");
  68531. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  68532. }),
  68533. globals.MessageSendTest);
  68534. smalltalk.addMethod(
  68535. smalltalk.method({
  68536. selector: "testValueWithArguments",
  68537. protocol: 'tests',
  68538. fn: function (){
  68539. var self=this;
  68540. var messageSend;
  68541. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  68542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68543. return smalltalk.withContext(function($ctx1) {
  68544. //>>excludeEnd("ctx");
  68545. var $1,$2;
  68546. $1=_st($MessageSend())._new();
  68547. _st($1)._receiver_((2));
  68548. _st($1)._selector_("+");
  68549. $2=_st($1)._yourself();
  68550. messageSend=$2;
  68551. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  68552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68553. $ctx1.sendIdx["assert:equals:"]=1;
  68554. //>>excludeEnd("ctx");
  68555. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  68556. return self;
  68557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68558. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)});
  68559. //>>excludeEnd("ctx");
  68560. },
  68561. //>>excludeStart("ide", pragmas.excludeIdeData);
  68562. args: [],
  68563. 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",
  68564. referencedClasses: ["MessageSend"],
  68565. //>>excludeEnd("ide");
  68566. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  68567. }),
  68568. globals.MessageSendTest);
  68569. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  68570. smalltalk.addMethod(
  68571. smalltalk.method({
  68572. selector: "codeGeneratorClass",
  68573. protocol: 'accessing',
  68574. fn: function (){
  68575. var self=this;
  68576. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  68577. return $CodeGenerator();
  68578. },
  68579. //>>excludeStart("ide", pragmas.excludeIdeData);
  68580. args: [],
  68581. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  68582. referencedClasses: ["CodeGenerator"],
  68583. //>>excludeEnd("ide");
  68584. messageSends: []
  68585. }),
  68586. globals.MethodInheritanceTest);
  68587. smalltalk.addMethod(
  68588. smalltalk.method({
  68589. selector: "compiler",
  68590. protocol: 'factory',
  68591. fn: function (){
  68592. var self=this;
  68593. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  68594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68595. return smalltalk.withContext(function($ctx1) {
  68596. //>>excludeEnd("ctx");
  68597. var $2,$3,$1;
  68598. $2=_st($Compiler())._new();
  68599. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  68600. $3=_st($2)._yourself();
  68601. $1=$3;
  68602. return $1;
  68603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68604. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)});
  68605. //>>excludeEnd("ctx");
  68606. },
  68607. //>>excludeStart("ide", pragmas.excludeIdeData);
  68608. args: [],
  68609. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  68610. referencedClasses: ["Compiler"],
  68611. //>>excludeEnd("ide");
  68612. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  68613. }),
  68614. globals.MethodInheritanceTest);
  68615. smalltalk.addMethod(
  68616. smalltalk.method({
  68617. selector: "deinstallBottom",
  68618. protocol: 'testing',
  68619. fn: function (){
  68620. var self=this;
  68621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68622. return smalltalk.withContext(function($ctx1) {
  68623. //>>excludeEnd("ctx");
  68624. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  68625. return self;
  68626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68627. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)});
  68628. //>>excludeEnd("ctx");
  68629. },
  68630. //>>excludeStart("ide", pragmas.excludeIdeData);
  68631. args: [],
  68632. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  68633. referencedClasses: [],
  68634. //>>excludeEnd("ide");
  68635. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  68636. }),
  68637. globals.MethodInheritanceTest);
  68638. smalltalk.addMethod(
  68639. smalltalk.method({
  68640. selector: "deinstallMiddle",
  68641. protocol: 'testing',
  68642. fn: function (){
  68643. var self=this;
  68644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68645. return smalltalk.withContext(function($ctx1) {
  68646. //>>excludeEnd("ctx");
  68647. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  68648. return self;
  68649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68650. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)});
  68651. //>>excludeEnd("ctx");
  68652. },
  68653. //>>excludeStart("ide", pragmas.excludeIdeData);
  68654. args: [],
  68655. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  68656. referencedClasses: [],
  68657. //>>excludeEnd("ide");
  68658. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  68659. }),
  68660. globals.MethodInheritanceTest);
  68661. smalltalk.addMethod(
  68662. smalltalk.method({
  68663. selector: "deinstallTop",
  68664. protocol: 'testing',
  68665. fn: function (){
  68666. var self=this;
  68667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68668. return smalltalk.withContext(function($ctx1) {
  68669. //>>excludeEnd("ctx");
  68670. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  68671. return self;
  68672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68673. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)});
  68674. //>>excludeEnd("ctx");
  68675. },
  68676. //>>excludeStart("ide", pragmas.excludeIdeData);
  68677. args: [],
  68678. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  68679. referencedClasses: [],
  68680. //>>excludeEnd("ide");
  68681. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  68682. }),
  68683. globals.MethodInheritanceTest);
  68684. smalltalk.addMethod(
  68685. smalltalk.method({
  68686. selector: "installBottom:",
  68687. protocol: 'testing',
  68688. fn: function (aString){
  68689. var self=this;
  68690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68691. return smalltalk.withContext(function($ctx1) {
  68692. //>>excludeEnd("ctx");
  68693. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  68694. return self;
  68695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68696. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)});
  68697. //>>excludeEnd("ctx");
  68698. },
  68699. //>>excludeStart("ide", pragmas.excludeIdeData);
  68700. args: ["aString"],
  68701. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  68702. referencedClasses: [],
  68703. //>>excludeEnd("ide");
  68704. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  68705. }),
  68706. globals.MethodInheritanceTest);
  68707. smalltalk.addMethod(
  68708. smalltalk.method({
  68709. selector: "installMiddle:",
  68710. protocol: 'testing',
  68711. fn: function (aString){
  68712. var self=this;
  68713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68714. return smalltalk.withContext(function($ctx1) {
  68715. //>>excludeEnd("ctx");
  68716. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  68717. return self;
  68718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68719. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)});
  68720. //>>excludeEnd("ctx");
  68721. },
  68722. //>>excludeStart("ide", pragmas.excludeIdeData);
  68723. args: ["aString"],
  68724. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  68725. referencedClasses: [],
  68726. //>>excludeEnd("ide");
  68727. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  68728. }),
  68729. globals.MethodInheritanceTest);
  68730. smalltalk.addMethod(
  68731. smalltalk.method({
  68732. selector: "installTop:",
  68733. protocol: 'testing',
  68734. fn: function (aString){
  68735. var self=this;
  68736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68737. return smalltalk.withContext(function($ctx1) {
  68738. //>>excludeEnd("ctx");
  68739. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  68740. return self;
  68741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68742. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)});
  68743. //>>excludeEnd("ctx");
  68744. },
  68745. //>>excludeStart("ide", pragmas.excludeIdeData);
  68746. args: ["aString"],
  68747. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  68748. referencedClasses: [],
  68749. //>>excludeEnd("ide");
  68750. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  68751. }),
  68752. globals.MethodInheritanceTest);
  68753. smalltalk.addMethod(
  68754. smalltalk.method({
  68755. selector: "setUp",
  68756. protocol: 'initialization',
  68757. fn: function (){
  68758. var self=this;
  68759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68760. return smalltalk.withContext(function($ctx1) {
  68761. //>>excludeEnd("ctx");
  68762. self["@receiverTop"]=_st(self._targetClassTop())._new();
  68763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68764. $ctx1.sendIdx["new"]=1;
  68765. //>>excludeEnd("ctx");
  68766. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  68767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68768. $ctx1.sendIdx["new"]=2;
  68769. //>>excludeEnd("ctx");
  68770. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  68771. self["@method"]=nil;
  68772. self["@performBlock"]=(function(){
  68773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68774. return smalltalk.withContext(function($ctx2) {
  68775. //>>excludeEnd("ctx");
  68776. return self._error_("performBlock not initialized");
  68777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68778. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68779. //>>excludeEnd("ctx");
  68780. });
  68781. return self;
  68782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68783. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)});
  68784. //>>excludeEnd("ctx");
  68785. },
  68786. //>>excludeStart("ide", pragmas.excludeIdeData);
  68787. args: [],
  68788. 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' ]",
  68789. referencedClasses: [],
  68790. //>>excludeEnd("ide");
  68791. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  68792. }),
  68793. globals.MethodInheritanceTest);
  68794. smalltalk.addMethod(
  68795. smalltalk.method({
  68796. selector: "shouldMNU",
  68797. protocol: 'testing',
  68798. fn: function (){
  68799. var self=this;
  68800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68801. return smalltalk.withContext(function($ctx1) {
  68802. //>>excludeEnd("ctx");
  68803. self._shouldMNUTop();
  68804. self._shouldMNUMiddle();
  68805. self._shouldMNUBottom();
  68806. return self;
  68807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68808. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)});
  68809. //>>excludeEnd("ctx");
  68810. },
  68811. //>>excludeStart("ide", pragmas.excludeIdeData);
  68812. args: [],
  68813. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  68814. referencedClasses: [],
  68815. //>>excludeEnd("ide");
  68816. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  68817. }),
  68818. globals.MethodInheritanceTest);
  68819. smalltalk.addMethod(
  68820. smalltalk.method({
  68821. selector: "shouldMNUBottom",
  68822. protocol: 'testing',
  68823. fn: function (){
  68824. var self=this;
  68825. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68827. return smalltalk.withContext(function($ctx1) {
  68828. //>>excludeEnd("ctx");
  68829. self._should_raise_((function(){
  68830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68831. return smalltalk.withContext(function($ctx2) {
  68832. //>>excludeEnd("ctx");
  68833. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68836. //>>excludeEnd("ctx");
  68837. }),$MessageNotUnderstood());
  68838. return self;
  68839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68840. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)});
  68841. //>>excludeEnd("ctx");
  68842. },
  68843. //>>excludeStart("ide", pragmas.excludeIdeData);
  68844. args: [],
  68845. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  68846. referencedClasses: ["MessageNotUnderstood"],
  68847. //>>excludeEnd("ide");
  68848. messageSends: ["should:raise:", "value:"]
  68849. }),
  68850. globals.MethodInheritanceTest);
  68851. smalltalk.addMethod(
  68852. smalltalk.method({
  68853. selector: "shouldMNUMiddle",
  68854. protocol: 'testing',
  68855. fn: function (){
  68856. var self=this;
  68857. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68859. return smalltalk.withContext(function($ctx1) {
  68860. //>>excludeEnd("ctx");
  68861. self._should_raise_((function(){
  68862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68863. return smalltalk.withContext(function($ctx2) {
  68864. //>>excludeEnd("ctx");
  68865. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68867. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68868. //>>excludeEnd("ctx");
  68869. }),$MessageNotUnderstood());
  68870. return self;
  68871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68872. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)});
  68873. //>>excludeEnd("ctx");
  68874. },
  68875. //>>excludeStart("ide", pragmas.excludeIdeData);
  68876. args: [],
  68877. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  68878. referencedClasses: ["MessageNotUnderstood"],
  68879. //>>excludeEnd("ide");
  68880. messageSends: ["should:raise:", "value:"]
  68881. }),
  68882. globals.MethodInheritanceTest);
  68883. smalltalk.addMethod(
  68884. smalltalk.method({
  68885. selector: "shouldMNUTop",
  68886. protocol: 'testing',
  68887. fn: function (){
  68888. var self=this;
  68889. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  68890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68891. return smalltalk.withContext(function($ctx1) {
  68892. //>>excludeEnd("ctx");
  68893. self._should_raise_((function(){
  68894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68895. return smalltalk.withContext(function($ctx2) {
  68896. //>>excludeEnd("ctx");
  68897. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  68898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  68900. //>>excludeEnd("ctx");
  68901. }),$MessageNotUnderstood());
  68902. return self;
  68903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68904. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)});
  68905. //>>excludeEnd("ctx");
  68906. },
  68907. //>>excludeStart("ide", pragmas.excludeIdeData);
  68908. args: [],
  68909. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  68910. referencedClasses: ["MessageNotUnderstood"],
  68911. //>>excludeEnd("ide");
  68912. messageSends: ["should:raise:", "value:"]
  68913. }),
  68914. globals.MethodInheritanceTest);
  68915. smalltalk.addMethod(
  68916. smalltalk.method({
  68917. selector: "shouldReturn:",
  68918. protocol: 'testing',
  68919. fn: function (anObject){
  68920. var self=this;
  68921. var result;
  68922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68923. return smalltalk.withContext(function($ctx1) {
  68924. //>>excludeEnd("ctx");
  68925. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  68926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68927. $ctx1.sendIdx["value:"]=1;
  68928. //>>excludeEnd("ctx");
  68929. self._assert_equals_(["top",anObject],["top",result]);
  68930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68931. $ctx1.sendIdx["assert:equals:"]=1;
  68932. //>>excludeEnd("ctx");
  68933. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68935. $ctx1.sendIdx["value:"]=2;
  68936. //>>excludeEnd("ctx");
  68937. self._assert_equals_(["middle",anObject],["middle",result]);
  68938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68939. $ctx1.sendIdx["assert:equals:"]=2;
  68940. //>>excludeEnd("ctx");
  68941. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68942. self._assert_equals_(["bottom",anObject],["bottom",result]);
  68943. return self;
  68944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68945. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)});
  68946. //>>excludeEnd("ctx");
  68947. },
  68948. //>>excludeStart("ide", pragmas.excludeIdeData);
  68949. args: ["anObject"],
  68950. 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 }",
  68951. referencedClasses: [],
  68952. //>>excludeEnd("ide");
  68953. messageSends: ["value:", "assert:equals:"]
  68954. }),
  68955. globals.MethodInheritanceTest);
  68956. smalltalk.addMethod(
  68957. smalltalk.method({
  68958. selector: "shouldReturn:and:and:",
  68959. protocol: 'testing',
  68960. fn: function (anObject,anObject2,anObject3){
  68961. var self=this;
  68962. var result;
  68963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68964. return smalltalk.withContext(function($ctx1) {
  68965. //>>excludeEnd("ctx");
  68966. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  68967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68968. $ctx1.sendIdx["value:"]=1;
  68969. //>>excludeEnd("ctx");
  68970. self._assert_equals_(["top",anObject],["top",result]);
  68971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68972. $ctx1.sendIdx["assert:equals:"]=1;
  68973. //>>excludeEnd("ctx");
  68974. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  68975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68976. $ctx1.sendIdx["value:"]=2;
  68977. //>>excludeEnd("ctx");
  68978. self._assert_equals_(["middle",anObject2],["middle",result]);
  68979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68980. $ctx1.sendIdx["assert:equals:"]=2;
  68981. //>>excludeEnd("ctx");
  68982. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  68983. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  68984. return self;
  68985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68986. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)});
  68987. //>>excludeEnd("ctx");
  68988. },
  68989. //>>excludeStart("ide", pragmas.excludeIdeData);
  68990. args: ["anObject", "anObject2", "anObject3"],
  68991. 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 }",
  68992. referencedClasses: [],
  68993. //>>excludeEnd("ide");
  68994. messageSends: ["value:", "assert:equals:"]
  68995. }),
  68996. globals.MethodInheritanceTest);
  68997. smalltalk.addMethod(
  68998. smalltalk.method({
  68999. selector: "targetClassBottom",
  69000. protocol: 'accessing',
  69001. fn: function (){
  69002. var self=this;
  69003. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  69004. return $JavaScriptException();
  69005. },
  69006. //>>excludeStart("ide", pragmas.excludeIdeData);
  69007. args: [],
  69008. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  69009. referencedClasses: ["JavaScriptException"],
  69010. //>>excludeEnd("ide");
  69011. messageSends: []
  69012. }),
  69013. globals.MethodInheritanceTest);
  69014. smalltalk.addMethod(
  69015. smalltalk.method({
  69016. selector: "targetClassMiddle",
  69017. protocol: 'accessing',
  69018. fn: function (){
  69019. var self=this;
  69020. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  69021. return $Error();
  69022. },
  69023. //>>excludeStart("ide", pragmas.excludeIdeData);
  69024. args: [],
  69025. source: "targetClassMiddle\x0a\x09^ Error",
  69026. referencedClasses: ["Error"],
  69027. //>>excludeEnd("ide");
  69028. messageSends: []
  69029. }),
  69030. globals.MethodInheritanceTest);
  69031. smalltalk.addMethod(
  69032. smalltalk.method({
  69033. selector: "targetClassTop",
  69034. protocol: 'accessing',
  69035. fn: function (){
  69036. var self=this;
  69037. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  69038. return $Object();
  69039. },
  69040. //>>excludeStart("ide", pragmas.excludeIdeData);
  69041. args: [],
  69042. source: "targetClassTop\x0a\x09^ Object",
  69043. referencedClasses: ["Object"],
  69044. //>>excludeEnd("ide");
  69045. messageSends: []
  69046. }),
  69047. globals.MethodInheritanceTest);
  69048. smalltalk.addMethod(
  69049. smalltalk.method({
  69050. selector: "tearDown",
  69051. protocol: 'initialization',
  69052. fn: function (){
  69053. var self=this;
  69054. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  69055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69056. return smalltalk.withContext(function($ctx1) {
  69057. //>>excludeEnd("ctx");
  69058. _st((function(){
  69059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69060. return smalltalk.withContext(function($ctx2) {
  69061. //>>excludeEnd("ctx");
  69062. return self._deinstallTop();
  69063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  69065. //>>excludeEnd("ctx");
  69066. }))._on_do_($Error(),(function(){
  69067. }));
  69068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69069. $ctx1.sendIdx["on:do:"]=1;
  69070. //>>excludeEnd("ctx");
  69071. _st((function(){
  69072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69073. return smalltalk.withContext(function($ctx2) {
  69074. //>>excludeEnd("ctx");
  69075. return self._deinstallMiddle();
  69076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  69078. //>>excludeEnd("ctx");
  69079. }))._on_do_($Error(),(function(){
  69080. }));
  69081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69082. $ctx1.sendIdx["on:do:"]=2;
  69083. //>>excludeEnd("ctx");
  69084. _st((function(){
  69085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69086. return smalltalk.withContext(function($ctx2) {
  69087. //>>excludeEnd("ctx");
  69088. return self._deinstallBottom();
  69089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  69091. //>>excludeEnd("ctx");
  69092. }))._on_do_($Error(),(function(){
  69093. }));
  69094. return self;
  69095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69096. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)});
  69097. //>>excludeEnd("ctx");
  69098. },
  69099. //>>excludeStart("ide", pragmas.excludeIdeData);
  69100. args: [],
  69101. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  69102. referencedClasses: ["Error"],
  69103. //>>excludeEnd("ide");
  69104. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  69105. }),
  69106. globals.MethodInheritanceTest);
  69107. smalltalk.addMethod(
  69108. smalltalk.method({
  69109. selector: "testMNU11",
  69110. protocol: 'tests',
  69111. fn: function (){
  69112. var self=this;
  69113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69114. return smalltalk.withContext(function($ctx1) {
  69115. //>>excludeEnd("ctx");
  69116. self["@performBlock"]=(function(x){
  69117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69118. return smalltalk.withContext(function($ctx2) {
  69119. //>>excludeEnd("ctx");
  69120. return _st(x)._foo();
  69121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69122. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69123. //>>excludeEnd("ctx");
  69124. });
  69125. self._shouldMNU();
  69126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69127. $ctx1.sendIdx["shouldMNU"]=1;
  69128. //>>excludeEnd("ctx");
  69129. self._installTop_("foo ^ false");
  69130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69131. $ctx1.sendIdx["installTop:"]=1;
  69132. //>>excludeEnd("ctx");
  69133. self._installTop_("foo ^ true");
  69134. self._deinstallTop();
  69135. self._shouldMNU();
  69136. return self;
  69137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69138. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)});
  69139. //>>excludeEnd("ctx");
  69140. },
  69141. //>>excludeStart("ide", pragmas.excludeIdeData);
  69142. args: [],
  69143. 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",
  69144. referencedClasses: [],
  69145. //>>excludeEnd("ide");
  69146. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  69147. }),
  69148. globals.MethodInheritanceTest);
  69149. smalltalk.addMethod(
  69150. smalltalk.method({
  69151. selector: "testMNU22",
  69152. protocol: 'tests',
  69153. fn: function (){
  69154. var self=this;
  69155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69156. return smalltalk.withContext(function($ctx1) {
  69157. //>>excludeEnd("ctx");
  69158. self["@performBlock"]=(function(x){
  69159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69160. return smalltalk.withContext(function($ctx2) {
  69161. //>>excludeEnd("ctx");
  69162. return _st(x)._foo();
  69163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69164. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69165. //>>excludeEnd("ctx");
  69166. });
  69167. self._shouldMNU();
  69168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69169. $ctx1.sendIdx["shouldMNU"]=1;
  69170. //>>excludeEnd("ctx");
  69171. self._installMiddle_("foo ^ false");
  69172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69173. $ctx1.sendIdx["installMiddle:"]=1;
  69174. //>>excludeEnd("ctx");
  69175. self._installMiddle_("foo ^ true");
  69176. self._deinstallMiddle();
  69177. self._shouldMNU();
  69178. return self;
  69179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69180. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)});
  69181. //>>excludeEnd("ctx");
  69182. },
  69183. //>>excludeStart("ide", pragmas.excludeIdeData);
  69184. args: [],
  69185. 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",
  69186. referencedClasses: [],
  69187. //>>excludeEnd("ide");
  69188. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  69189. }),
  69190. globals.MethodInheritanceTest);
  69191. smalltalk.addMethod(
  69192. smalltalk.method({
  69193. selector: "testReturns1",
  69194. protocol: 'tests',
  69195. fn: function (){
  69196. var self=this;
  69197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69198. return smalltalk.withContext(function($ctx1) {
  69199. //>>excludeEnd("ctx");
  69200. self["@performBlock"]=(function(x){
  69201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69202. return smalltalk.withContext(function($ctx2) {
  69203. //>>excludeEnd("ctx");
  69204. return _st(x)._foo();
  69205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69206. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  69207. //>>excludeEnd("ctx");
  69208. });
  69209. self._installTop_("foo ^ false");
  69210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69211. $ctx1.sendIdx["installTop:"]=1;
  69212. //>>excludeEnd("ctx");
  69213. self._shouldReturn_(false);
  69214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69215. $ctx1.sendIdx["shouldReturn:"]=1;
  69216. //>>excludeEnd("ctx");
  69217. self._installTop_("foo ^ true");
  69218. self._shouldReturn_(true);
  69219. return self;
  69220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69221. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)});
  69222. //>>excludeEnd("ctx");
  69223. },
  69224. //>>excludeStart("ide", pragmas.excludeIdeData);
  69225. args: [],
  69226. 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",
  69227. referencedClasses: [],
  69228. //>>excludeEnd("ide");
  69229. messageSends: ["foo", "installTop:", "shouldReturn:"]
  69230. }),
  69231. globals.MethodInheritanceTest);
  69232. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  69233. smalltalk.addMethod(
  69234. smalltalk.method({
  69235. selector: "testAbs",
  69236. protocol: 'tests',
  69237. fn: function (){
  69238. var self=this;
  69239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69240. return smalltalk.withContext(function($ctx1) {
  69241. //>>excludeEnd("ctx");
  69242. var $1;
  69243. $1=(4)._abs();
  69244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69245. $ctx1.sendIdx["abs"]=1;
  69246. //>>excludeEnd("ctx");
  69247. self._assert_equals_($1,(4));
  69248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69249. $ctx1.sendIdx["assert:equals:"]=1;
  69250. //>>excludeEnd("ctx");
  69251. self._assert_equals_((-4)._abs(),(4));
  69252. return self;
  69253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69254. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)});
  69255. //>>excludeEnd("ctx");
  69256. },
  69257. //>>excludeStart("ide", pragmas.excludeIdeData);
  69258. args: [],
  69259. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  69260. referencedClasses: [],
  69261. //>>excludeEnd("ide");
  69262. messageSends: ["assert:equals:", "abs"]
  69263. }),
  69264. globals.NumberTest);
  69265. smalltalk.addMethod(
  69266. smalltalk.method({
  69267. selector: "testArithmetic",
  69268. protocol: 'tests',
  69269. fn: function (){
  69270. var self=this;
  69271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69272. return smalltalk.withContext(function($ctx1) {
  69273. //>>excludeEnd("ctx");
  69274. var $1,$2,$3,$5,$4;
  69275. $1=(1.5).__plus((1));
  69276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69277. $ctx1.sendIdx["+"]=1;
  69278. //>>excludeEnd("ctx");
  69279. self._assert_equals_($1,(2.5));
  69280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69281. $ctx1.sendIdx["assert:equals:"]=1;
  69282. //>>excludeEnd("ctx");
  69283. $2=(2).__minus((1));
  69284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69285. $ctx1.sendIdx["-"]=1;
  69286. //>>excludeEnd("ctx");
  69287. self._assert_equals_($2,(1));
  69288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69289. $ctx1.sendIdx["assert:equals:"]=2;
  69290. //>>excludeEnd("ctx");
  69291. self._assert_equals_((-2).__minus((1)),(-3));
  69292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69293. $ctx1.sendIdx["assert:equals:"]=3;
  69294. //>>excludeEnd("ctx");
  69295. self._assert_equals_((12).__slash((2)),(6));
  69296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69297. $ctx1.sendIdx["assert:equals:"]=4;
  69298. //>>excludeEnd("ctx");
  69299. $3=(3).__star((4));
  69300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69301. $ctx1.sendIdx["*"]=1;
  69302. //>>excludeEnd("ctx");
  69303. self._assert_equals_($3,(12));
  69304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69305. $ctx1.sendIdx["assert:equals:"]=5;
  69306. //>>excludeEnd("ctx");
  69307. self._assert_equals_((7).__slash_slash((2)),(3));
  69308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69309. $ctx1.sendIdx["assert:equals:"]=6;
  69310. //>>excludeEnd("ctx");
  69311. self._assert_equals_((7).__backslash_backslash((2)),(1));
  69312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69313. $ctx1.sendIdx["assert:equals:"]=7;
  69314. //>>excludeEnd("ctx");
  69315. $5=(1).__plus((2));
  69316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69317. $ctx1.sendIdx["+"]=2;
  69318. //>>excludeEnd("ctx");
  69319. $4=_st($5).__star((3));
  69320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69321. $ctx1.sendIdx["*"]=2;
  69322. //>>excludeEnd("ctx");
  69323. self._assert_equals_($4,(9));
  69324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69325. $ctx1.sendIdx["assert:equals:"]=8;
  69326. //>>excludeEnd("ctx");
  69327. self._assert_equals_((1).__plus((2).__star((3))),(7));
  69328. return self;
  69329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69330. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)});
  69331. //>>excludeEnd("ctx");
  69332. },
  69333. //>>excludeStart("ide", pragmas.excludeIdeData);
  69334. args: [],
  69335. 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",
  69336. referencedClasses: [],
  69337. //>>excludeEnd("ide");
  69338. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  69339. }),
  69340. globals.NumberTest);
  69341. smalltalk.addMethod(
  69342. smalltalk.method({
  69343. selector: "testAsNumber",
  69344. protocol: 'tests',
  69345. fn: function (){
  69346. var self=this;
  69347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69348. return smalltalk.withContext(function($ctx1) {
  69349. //>>excludeEnd("ctx");
  69350. self._assert_equals_((3)._asNumber(),(3));
  69351. return self;
  69352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69353. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)});
  69354. //>>excludeEnd("ctx");
  69355. },
  69356. //>>excludeStart("ide", pragmas.excludeIdeData);
  69357. args: [],
  69358. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  69359. referencedClasses: [],
  69360. //>>excludeEnd("ide");
  69361. messageSends: ["assert:equals:", "asNumber"]
  69362. }),
  69363. globals.NumberTest);
  69364. smalltalk.addMethod(
  69365. smalltalk.method({
  69366. selector: "testCeiling",
  69367. protocol: 'tests',
  69368. fn: function (){
  69369. var self=this;
  69370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69371. return smalltalk.withContext(function($ctx1) {
  69372. //>>excludeEnd("ctx");
  69373. var $1,$2;
  69374. $1=(1.2)._ceiling();
  69375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69376. $ctx1.sendIdx["ceiling"]=1;
  69377. //>>excludeEnd("ctx");
  69378. self._assert_equals_($1,(2));
  69379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69380. $ctx1.sendIdx["assert:equals:"]=1;
  69381. //>>excludeEnd("ctx");
  69382. $2=(-1.2)._ceiling();
  69383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69384. $ctx1.sendIdx["ceiling"]=2;
  69385. //>>excludeEnd("ctx");
  69386. self._assert_equals_($2,(-1));
  69387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69388. $ctx1.sendIdx["assert:equals:"]=2;
  69389. //>>excludeEnd("ctx");
  69390. self._assert_equals_((1)._ceiling(),(1));
  69391. return self;
  69392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69393. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)});
  69394. //>>excludeEnd("ctx");
  69395. },
  69396. //>>excludeStart("ide", pragmas.excludeIdeData);
  69397. args: [],
  69398. 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.",
  69399. referencedClasses: [],
  69400. //>>excludeEnd("ide");
  69401. messageSends: ["assert:equals:", "ceiling"]
  69402. }),
  69403. globals.NumberTest);
  69404. smalltalk.addMethod(
  69405. smalltalk.method({
  69406. selector: "testComparison",
  69407. protocol: 'tests',
  69408. fn: function (){
  69409. var self=this;
  69410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69411. return smalltalk.withContext(function($ctx1) {
  69412. //>>excludeEnd("ctx");
  69413. var $1,$2,$3,$4;
  69414. $1=(3).__gt((2));
  69415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69416. $ctx1.sendIdx[">"]=1;
  69417. //>>excludeEnd("ctx");
  69418. self._assert_($1);
  69419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69420. $ctx1.sendIdx["assert:"]=1;
  69421. //>>excludeEnd("ctx");
  69422. $2=(2).__lt((3));
  69423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69424. $ctx1.sendIdx["<"]=1;
  69425. //>>excludeEnd("ctx");
  69426. self._assert_($2);
  69427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69428. $ctx1.sendIdx["assert:"]=2;
  69429. //>>excludeEnd("ctx");
  69430. self._deny_((3).__lt((2)));
  69431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69432. $ctx1.sendIdx["deny:"]=1;
  69433. //>>excludeEnd("ctx");
  69434. self._deny_((2).__gt((3)));
  69435. $3=(3).__gt_eq((3));
  69436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69437. $ctx1.sendIdx[">="]=1;
  69438. //>>excludeEnd("ctx");
  69439. self._assert_($3);
  69440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69441. $ctx1.sendIdx["assert:"]=3;
  69442. //>>excludeEnd("ctx");
  69443. self._assert_((3.1).__gt_eq((3)));
  69444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69445. $ctx1.sendIdx["assert:"]=4;
  69446. //>>excludeEnd("ctx");
  69447. $4=(3).__lt_eq((3));
  69448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69449. $ctx1.sendIdx["<="]=1;
  69450. //>>excludeEnd("ctx");
  69451. self._assert_($4);
  69452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69453. $ctx1.sendIdx["assert:"]=5;
  69454. //>>excludeEnd("ctx");
  69455. self._assert_((3).__lt_eq((3.1)));
  69456. return self;
  69457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69458. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)});
  69459. //>>excludeEnd("ctx");
  69460. },
  69461. //>>excludeStart("ide", pragmas.excludeIdeData);
  69462. args: [],
  69463. 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",
  69464. referencedClasses: [],
  69465. //>>excludeEnd("ide");
  69466. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  69467. }),
  69468. globals.NumberTest);
  69469. smalltalk.addMethod(
  69470. smalltalk.method({
  69471. selector: "testCopying",
  69472. protocol: 'tests',
  69473. fn: function (){
  69474. var self=this;
  69475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69476. return smalltalk.withContext(function($ctx1) {
  69477. //>>excludeEnd("ctx");
  69478. var $1;
  69479. $1=_st((1)._copy()).__eq_eq((1));
  69480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69481. $ctx1.sendIdx["=="]=1;
  69482. //>>excludeEnd("ctx");
  69483. self._assert_($1);
  69484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69485. $ctx1.sendIdx["assert:"]=1;
  69486. //>>excludeEnd("ctx");
  69487. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  69488. return self;
  69489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69490. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)});
  69491. //>>excludeEnd("ctx");
  69492. },
  69493. //>>excludeStart("ide", pragmas.excludeIdeData);
  69494. args: [],
  69495. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  69496. referencedClasses: [],
  69497. //>>excludeEnd("ide");
  69498. messageSends: ["assert:", "==", "copy", "deepCopy"]
  69499. }),
  69500. globals.NumberTest);
  69501. smalltalk.addMethod(
  69502. smalltalk.method({
  69503. selector: "testEquality",
  69504. protocol: 'tests',
  69505. fn: function (){
  69506. var self=this;
  69507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69508. return smalltalk.withContext(function($ctx1) {
  69509. //>>excludeEnd("ctx");
  69510. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  69511. $1=(1).__eq((1));
  69512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69513. $ctx1.sendIdx["="]=1;
  69514. //>>excludeEnd("ctx");
  69515. self._assert_($1);
  69516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69517. $ctx1.sendIdx["assert:"]=1;
  69518. //>>excludeEnd("ctx");
  69519. $2=(0).__eq((0));
  69520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69521. $ctx1.sendIdx["="]=2;
  69522. //>>excludeEnd("ctx");
  69523. self._assert_($2);
  69524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69525. $ctx1.sendIdx["assert:"]=2;
  69526. //>>excludeEnd("ctx");
  69527. $3=(1).__eq((0));
  69528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69529. $ctx1.sendIdx["="]=3;
  69530. //>>excludeEnd("ctx");
  69531. self._deny_($3);
  69532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69533. $ctx1.sendIdx["deny:"]=1;
  69534. //>>excludeEnd("ctx");
  69535. $5=(1)._yourself();
  69536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69537. $ctx1.sendIdx["yourself"]=1;
  69538. //>>excludeEnd("ctx");
  69539. $4=_st($5).__eq((1));
  69540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69541. $ctx1.sendIdx["="]=4;
  69542. //>>excludeEnd("ctx");
  69543. self._assert_($4);
  69544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69545. $ctx1.sendIdx["assert:"]=3;
  69546. //>>excludeEnd("ctx");
  69547. $7=(1)._yourself();
  69548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69549. $ctx1.sendIdx["yourself"]=2;
  69550. //>>excludeEnd("ctx");
  69551. $6=(1).__eq($7);
  69552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69553. $ctx1.sendIdx["="]=5;
  69554. //>>excludeEnd("ctx");
  69555. self._assert_($6);
  69556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69557. $ctx1.sendIdx["assert:"]=4;
  69558. //>>excludeEnd("ctx");
  69559. $9=(1)._yourself();
  69560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69561. $ctx1.sendIdx["yourself"]=3;
  69562. //>>excludeEnd("ctx");
  69563. $8=_st($9).__eq((1)._yourself());
  69564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69565. $ctx1.sendIdx["="]=6;
  69566. //>>excludeEnd("ctx");
  69567. self._assert_($8);
  69568. $10=(0).__eq(false);
  69569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69570. $ctx1.sendIdx["="]=7;
  69571. //>>excludeEnd("ctx");
  69572. self._deny_($10);
  69573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69574. $ctx1.sendIdx["deny:"]=2;
  69575. //>>excludeEnd("ctx");
  69576. $11=false.__eq((0));
  69577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69578. $ctx1.sendIdx["="]=8;
  69579. //>>excludeEnd("ctx");
  69580. self._deny_($11);
  69581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69582. $ctx1.sendIdx["deny:"]=3;
  69583. //>>excludeEnd("ctx");
  69584. $12="".__eq((0));
  69585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69586. $ctx1.sendIdx["="]=9;
  69587. //>>excludeEnd("ctx");
  69588. self._deny_($12);
  69589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69590. $ctx1.sendIdx["deny:"]=4;
  69591. //>>excludeEnd("ctx");
  69592. self._deny_((0).__eq(""));
  69593. return self;
  69594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69595. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)});
  69596. //>>excludeEnd("ctx");
  69597. },
  69598. //>>excludeStart("ide", pragmas.excludeIdeData);
  69599. args: [],
  69600. 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 = ''",
  69601. referencedClasses: [],
  69602. //>>excludeEnd("ide");
  69603. messageSends: ["assert:", "=", "deny:", "yourself"]
  69604. }),
  69605. globals.NumberTest);
  69606. smalltalk.addMethod(
  69607. smalltalk.method({
  69608. selector: "testFloor",
  69609. protocol: 'tests',
  69610. fn: function (){
  69611. var self=this;
  69612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69613. return smalltalk.withContext(function($ctx1) {
  69614. //>>excludeEnd("ctx");
  69615. var $1,$2;
  69616. $1=(1.2)._floor();
  69617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69618. $ctx1.sendIdx["floor"]=1;
  69619. //>>excludeEnd("ctx");
  69620. self._assert_equals_($1,(1));
  69621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69622. $ctx1.sendIdx["assert:equals:"]=1;
  69623. //>>excludeEnd("ctx");
  69624. $2=(-1.2)._floor();
  69625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69626. $ctx1.sendIdx["floor"]=2;
  69627. //>>excludeEnd("ctx");
  69628. self._assert_equals_($2,(-2));
  69629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69630. $ctx1.sendIdx["assert:equals:"]=2;
  69631. //>>excludeEnd("ctx");
  69632. self._assert_equals_((1)._floor(),(1));
  69633. return self;
  69634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69635. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)});
  69636. //>>excludeEnd("ctx");
  69637. },
  69638. //>>excludeStart("ide", pragmas.excludeIdeData);
  69639. args: [],
  69640. 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.",
  69641. referencedClasses: [],
  69642. //>>excludeEnd("ide");
  69643. messageSends: ["assert:equals:", "floor"]
  69644. }),
  69645. globals.NumberTest);
  69646. smalltalk.addMethod(
  69647. smalltalk.method({
  69648. selector: "testHexNumbers",
  69649. protocol: 'tests',
  69650. fn: function (){
  69651. var self=this;
  69652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69653. return smalltalk.withContext(function($ctx1) {
  69654. //>>excludeEnd("ctx");
  69655. var $1,$2,$3,$4,$5;
  69656. self._assert_equals_((9),(9));
  69657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69658. $ctx1.sendIdx["assert:equals:"]=1;
  69659. //>>excludeEnd("ctx");
  69660. $1=(10)._truncated();
  69661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69662. $ctx1.sendIdx["truncated"]=1;
  69663. //>>excludeEnd("ctx");
  69664. self._assert_equals_($1,(10));
  69665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69666. $ctx1.sendIdx["assert:equals:"]=2;
  69667. //>>excludeEnd("ctx");
  69668. $2=(11)._truncated();
  69669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69670. $ctx1.sendIdx["truncated"]=2;
  69671. //>>excludeEnd("ctx");
  69672. self._assert_equals_($2,(11));
  69673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69674. $ctx1.sendIdx["assert:equals:"]=3;
  69675. //>>excludeEnd("ctx");
  69676. $3=(12)._truncated();
  69677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69678. $ctx1.sendIdx["truncated"]=3;
  69679. //>>excludeEnd("ctx");
  69680. self._assert_equals_($3,(12));
  69681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69682. $ctx1.sendIdx["assert:equals:"]=4;
  69683. //>>excludeEnd("ctx");
  69684. $4=(13)._truncated();
  69685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69686. $ctx1.sendIdx["truncated"]=4;
  69687. //>>excludeEnd("ctx");
  69688. self._assert_equals_($4,(13));
  69689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69690. $ctx1.sendIdx["assert:equals:"]=5;
  69691. //>>excludeEnd("ctx");
  69692. $5=(14)._truncated();
  69693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69694. $ctx1.sendIdx["truncated"]=5;
  69695. //>>excludeEnd("ctx");
  69696. self._assert_equals_($5,(14));
  69697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69698. $ctx1.sendIdx["assert:equals:"]=6;
  69699. //>>excludeEnd("ctx");
  69700. self._assert_equals_((15)._truncated(),(15));
  69701. return self;
  69702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69703. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)});
  69704. //>>excludeEnd("ctx");
  69705. },
  69706. //>>excludeStart("ide", pragmas.excludeIdeData);
  69707. args: [],
  69708. 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",
  69709. referencedClasses: [],
  69710. //>>excludeEnd("ide");
  69711. messageSends: ["assert:equals:", "truncated"]
  69712. }),
  69713. globals.NumberTest);
  69714. smalltalk.addMethod(
  69715. smalltalk.method({
  69716. selector: "testIdentity",
  69717. protocol: 'tests',
  69718. fn: function (){
  69719. var self=this;
  69720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69721. return smalltalk.withContext(function($ctx1) {
  69722. //>>excludeEnd("ctx");
  69723. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  69724. $1=(1).__eq_eq((1));
  69725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69726. $ctx1.sendIdx["=="]=1;
  69727. //>>excludeEnd("ctx");
  69728. self._assert_($1);
  69729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69730. $ctx1.sendIdx["assert:"]=1;
  69731. //>>excludeEnd("ctx");
  69732. $2=(0).__eq_eq((0));
  69733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69734. $ctx1.sendIdx["=="]=2;
  69735. //>>excludeEnd("ctx");
  69736. self._assert_($2);
  69737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69738. $ctx1.sendIdx["assert:"]=2;
  69739. //>>excludeEnd("ctx");
  69740. $3=(1).__eq_eq((0));
  69741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69742. $ctx1.sendIdx["=="]=3;
  69743. //>>excludeEnd("ctx");
  69744. self._deny_($3);
  69745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69746. $ctx1.sendIdx["deny:"]=1;
  69747. //>>excludeEnd("ctx");
  69748. $5=(1)._yourself();
  69749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69750. $ctx1.sendIdx["yourself"]=1;
  69751. //>>excludeEnd("ctx");
  69752. $4=_st($5).__eq_eq((1));
  69753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69754. $ctx1.sendIdx["=="]=4;
  69755. //>>excludeEnd("ctx");
  69756. self._assert_($4);
  69757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69758. $ctx1.sendIdx["assert:"]=3;
  69759. //>>excludeEnd("ctx");
  69760. $7=(1)._yourself();
  69761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69762. $ctx1.sendIdx["yourself"]=2;
  69763. //>>excludeEnd("ctx");
  69764. $6=(1).__eq_eq($7);
  69765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69766. $ctx1.sendIdx["=="]=5;
  69767. //>>excludeEnd("ctx");
  69768. self._assert_($6);
  69769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69770. $ctx1.sendIdx["assert:"]=4;
  69771. //>>excludeEnd("ctx");
  69772. $9=(1)._yourself();
  69773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69774. $ctx1.sendIdx["yourself"]=3;
  69775. //>>excludeEnd("ctx");
  69776. $8=_st($9).__eq_eq((1)._yourself());
  69777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69778. $ctx1.sendIdx["=="]=6;
  69779. //>>excludeEnd("ctx");
  69780. self._assert_($8);
  69781. self._deny_((1).__eq_eq((2)));
  69782. return self;
  69783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69784. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)});
  69785. //>>excludeEnd("ctx");
  69786. },
  69787. //>>excludeStart("ide", pragmas.excludeIdeData);
  69788. args: [],
  69789. 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",
  69790. referencedClasses: [],
  69791. //>>excludeEnd("ide");
  69792. messageSends: ["assert:", "==", "deny:", "yourself"]
  69793. }),
  69794. globals.NumberTest);
  69795. smalltalk.addMethod(
  69796. smalltalk.method({
  69797. selector: "testInvalidHexNumbers",
  69798. protocol: 'tests',
  69799. fn: function (){
  69800. var self=this;
  69801. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  69802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69803. return smalltalk.withContext(function($ctx1) {
  69804. //>>excludeEnd("ctx");
  69805. self._should_raise_((function(){
  69806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69807. return smalltalk.withContext(function($ctx2) {
  69808. //>>excludeEnd("ctx");
  69809. return (16)._rG();
  69810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  69812. //>>excludeEnd("ctx");
  69813. }),$MessageNotUnderstood());
  69814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69815. $ctx1.sendIdx["should:raise:"]=1;
  69816. //>>excludeEnd("ctx");
  69817. self._should_raise_((function(){
  69818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69819. return smalltalk.withContext(function($ctx2) {
  69820. //>>excludeEnd("ctx");
  69821. return (16)._rg();
  69822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  69824. //>>excludeEnd("ctx");
  69825. }),$MessageNotUnderstood());
  69826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69827. $ctx1.sendIdx["should:raise:"]=2;
  69828. //>>excludeEnd("ctx");
  69829. self._should_raise_((function(){
  69830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69831. return smalltalk.withContext(function($ctx2) {
  69832. //>>excludeEnd("ctx");
  69833. return (16)._rH();
  69834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  69836. //>>excludeEnd("ctx");
  69837. }),$MessageNotUnderstood());
  69838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69839. $ctx1.sendIdx["should:raise:"]=3;
  69840. //>>excludeEnd("ctx");
  69841. self._should_raise_((function(){
  69842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69843. return smalltalk.withContext(function($ctx2) {
  69844. //>>excludeEnd("ctx");
  69845. return (16)._rh();
  69846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  69848. //>>excludeEnd("ctx");
  69849. }),$MessageNotUnderstood());
  69850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69851. $ctx1.sendIdx["should:raise:"]=4;
  69852. //>>excludeEnd("ctx");
  69853. self._should_raise_((function(){
  69854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69855. return smalltalk.withContext(function($ctx2) {
  69856. //>>excludeEnd("ctx");
  69857. return (16)._rI();
  69858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  69860. //>>excludeEnd("ctx");
  69861. }),$MessageNotUnderstood());
  69862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69863. $ctx1.sendIdx["should:raise:"]=5;
  69864. //>>excludeEnd("ctx");
  69865. self._should_raise_((function(){
  69866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69867. return smalltalk.withContext(function($ctx2) {
  69868. //>>excludeEnd("ctx");
  69869. return (16)._ri();
  69870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  69872. //>>excludeEnd("ctx");
  69873. }),$MessageNotUnderstood());
  69874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69875. $ctx1.sendIdx["should:raise:"]=6;
  69876. //>>excludeEnd("ctx");
  69877. self._should_raise_((function(){
  69878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69879. return smalltalk.withContext(function($ctx2) {
  69880. //>>excludeEnd("ctx");
  69881. return (16)._rJ();
  69882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  69884. //>>excludeEnd("ctx");
  69885. }),$MessageNotUnderstood());
  69886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69887. $ctx1.sendIdx["should:raise:"]=7;
  69888. //>>excludeEnd("ctx");
  69889. self._should_raise_((function(){
  69890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69891. return smalltalk.withContext(function($ctx2) {
  69892. //>>excludeEnd("ctx");
  69893. return (16)._rj();
  69894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  69896. //>>excludeEnd("ctx");
  69897. }),$MessageNotUnderstood());
  69898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69899. $ctx1.sendIdx["should:raise:"]=8;
  69900. //>>excludeEnd("ctx");
  69901. self._should_raise_((function(){
  69902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69903. return smalltalk.withContext(function($ctx2) {
  69904. //>>excludeEnd("ctx");
  69905. return (16)._rK();
  69906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  69908. //>>excludeEnd("ctx");
  69909. }),$MessageNotUnderstood());
  69910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69911. $ctx1.sendIdx["should:raise:"]=9;
  69912. //>>excludeEnd("ctx");
  69913. self._should_raise_((function(){
  69914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69915. return smalltalk.withContext(function($ctx2) {
  69916. //>>excludeEnd("ctx");
  69917. return (16)._rk();
  69918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  69920. //>>excludeEnd("ctx");
  69921. }),$MessageNotUnderstood());
  69922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69923. $ctx1.sendIdx["should:raise:"]=10;
  69924. //>>excludeEnd("ctx");
  69925. self._should_raise_((function(){
  69926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69927. return smalltalk.withContext(function($ctx2) {
  69928. //>>excludeEnd("ctx");
  69929. return (16)._rL();
  69930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  69932. //>>excludeEnd("ctx");
  69933. }),$MessageNotUnderstood());
  69934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69935. $ctx1.sendIdx["should:raise:"]=11;
  69936. //>>excludeEnd("ctx");
  69937. self._should_raise_((function(){
  69938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69939. return smalltalk.withContext(function($ctx2) {
  69940. //>>excludeEnd("ctx");
  69941. return (16)._rl();
  69942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  69944. //>>excludeEnd("ctx");
  69945. }),$MessageNotUnderstood());
  69946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69947. $ctx1.sendIdx["should:raise:"]=12;
  69948. //>>excludeEnd("ctx");
  69949. self._should_raise_((function(){
  69950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69951. return smalltalk.withContext(function($ctx2) {
  69952. //>>excludeEnd("ctx");
  69953. return (16)._rM();
  69954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  69956. //>>excludeEnd("ctx");
  69957. }),$MessageNotUnderstood());
  69958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69959. $ctx1.sendIdx["should:raise:"]=13;
  69960. //>>excludeEnd("ctx");
  69961. self._should_raise_((function(){
  69962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69963. return smalltalk.withContext(function($ctx2) {
  69964. //>>excludeEnd("ctx");
  69965. return (16)._rm();
  69966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  69968. //>>excludeEnd("ctx");
  69969. }),$MessageNotUnderstood());
  69970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69971. $ctx1.sendIdx["should:raise:"]=14;
  69972. //>>excludeEnd("ctx");
  69973. self._should_raise_((function(){
  69974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69975. return smalltalk.withContext(function($ctx2) {
  69976. //>>excludeEnd("ctx");
  69977. return (16)._rN();
  69978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  69980. //>>excludeEnd("ctx");
  69981. }),$MessageNotUnderstood());
  69982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69983. $ctx1.sendIdx["should:raise:"]=15;
  69984. //>>excludeEnd("ctx");
  69985. self._should_raise_((function(){
  69986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69987. return smalltalk.withContext(function($ctx2) {
  69988. //>>excludeEnd("ctx");
  69989. return (16)._rn();
  69990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  69992. //>>excludeEnd("ctx");
  69993. }),$MessageNotUnderstood());
  69994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69995. $ctx1.sendIdx["should:raise:"]=16;
  69996. //>>excludeEnd("ctx");
  69997. self._should_raise_((function(){
  69998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69999. return smalltalk.withContext(function($ctx2) {
  70000. //>>excludeEnd("ctx");
  70001. return (16)._rO();
  70002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  70004. //>>excludeEnd("ctx");
  70005. }),$MessageNotUnderstood());
  70006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70007. $ctx1.sendIdx["should:raise:"]=17;
  70008. //>>excludeEnd("ctx");
  70009. self._should_raise_((function(){
  70010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70011. return smalltalk.withContext(function($ctx2) {
  70012. //>>excludeEnd("ctx");
  70013. return (16)._ro();
  70014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  70016. //>>excludeEnd("ctx");
  70017. }),$MessageNotUnderstood());
  70018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70019. $ctx1.sendIdx["should:raise:"]=18;
  70020. //>>excludeEnd("ctx");
  70021. self._should_raise_((function(){
  70022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70023. return smalltalk.withContext(function($ctx2) {
  70024. //>>excludeEnd("ctx");
  70025. return (16)._rP();
  70026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70027. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  70028. //>>excludeEnd("ctx");
  70029. }),$MessageNotUnderstood());
  70030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70031. $ctx1.sendIdx["should:raise:"]=19;
  70032. //>>excludeEnd("ctx");
  70033. self._should_raise_((function(){
  70034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70035. return smalltalk.withContext(function($ctx2) {
  70036. //>>excludeEnd("ctx");
  70037. return (16)._rp();
  70038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  70040. //>>excludeEnd("ctx");
  70041. }),$MessageNotUnderstood());
  70042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70043. $ctx1.sendIdx["should:raise:"]=20;
  70044. //>>excludeEnd("ctx");
  70045. self._should_raise_((function(){
  70046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70047. return smalltalk.withContext(function($ctx2) {
  70048. //>>excludeEnd("ctx");
  70049. return (16)._rQ();
  70050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70051. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  70052. //>>excludeEnd("ctx");
  70053. }),$MessageNotUnderstood());
  70054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70055. $ctx1.sendIdx["should:raise:"]=21;
  70056. //>>excludeEnd("ctx");
  70057. self._should_raise_((function(){
  70058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70059. return smalltalk.withContext(function($ctx2) {
  70060. //>>excludeEnd("ctx");
  70061. return (16)._rq();
  70062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70063. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  70064. //>>excludeEnd("ctx");
  70065. }),$MessageNotUnderstood());
  70066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70067. $ctx1.sendIdx["should:raise:"]=22;
  70068. //>>excludeEnd("ctx");
  70069. self._should_raise_((function(){
  70070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70071. return smalltalk.withContext(function($ctx2) {
  70072. //>>excludeEnd("ctx");
  70073. return (16)._rR();
  70074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  70076. //>>excludeEnd("ctx");
  70077. }),$MessageNotUnderstood());
  70078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70079. $ctx1.sendIdx["should:raise:"]=23;
  70080. //>>excludeEnd("ctx");
  70081. self._should_raise_((function(){
  70082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70083. return smalltalk.withContext(function($ctx2) {
  70084. //>>excludeEnd("ctx");
  70085. return (16)._rr();
  70086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  70088. //>>excludeEnd("ctx");
  70089. }),$MessageNotUnderstood());
  70090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70091. $ctx1.sendIdx["should:raise:"]=24;
  70092. //>>excludeEnd("ctx");
  70093. self._should_raise_((function(){
  70094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70095. return smalltalk.withContext(function($ctx2) {
  70096. //>>excludeEnd("ctx");
  70097. return (16)._rS();
  70098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  70100. //>>excludeEnd("ctx");
  70101. }),$MessageNotUnderstood());
  70102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70103. $ctx1.sendIdx["should:raise:"]=25;
  70104. //>>excludeEnd("ctx");
  70105. self._should_raise_((function(){
  70106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70107. return smalltalk.withContext(function($ctx2) {
  70108. //>>excludeEnd("ctx");
  70109. return (16)._rs();
  70110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  70112. //>>excludeEnd("ctx");
  70113. }),$MessageNotUnderstood());
  70114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70115. $ctx1.sendIdx["should:raise:"]=26;
  70116. //>>excludeEnd("ctx");
  70117. self._should_raise_((function(){
  70118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70119. return smalltalk.withContext(function($ctx2) {
  70120. //>>excludeEnd("ctx");
  70121. return (16)._rT();
  70122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  70124. //>>excludeEnd("ctx");
  70125. }),$MessageNotUnderstood());
  70126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70127. $ctx1.sendIdx["should:raise:"]=27;
  70128. //>>excludeEnd("ctx");
  70129. self._should_raise_((function(){
  70130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70131. return smalltalk.withContext(function($ctx2) {
  70132. //>>excludeEnd("ctx");
  70133. return (16)._rt();
  70134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  70136. //>>excludeEnd("ctx");
  70137. }),$MessageNotUnderstood());
  70138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70139. $ctx1.sendIdx["should:raise:"]=28;
  70140. //>>excludeEnd("ctx");
  70141. self._should_raise_((function(){
  70142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70143. return smalltalk.withContext(function($ctx2) {
  70144. //>>excludeEnd("ctx");
  70145. return (16)._rU();
  70146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  70148. //>>excludeEnd("ctx");
  70149. }),$MessageNotUnderstood());
  70150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70151. $ctx1.sendIdx["should:raise:"]=29;
  70152. //>>excludeEnd("ctx");
  70153. self._should_raise_((function(){
  70154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70155. return smalltalk.withContext(function($ctx2) {
  70156. //>>excludeEnd("ctx");
  70157. return (16)._ru();
  70158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  70160. //>>excludeEnd("ctx");
  70161. }),$MessageNotUnderstood());
  70162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70163. $ctx1.sendIdx["should:raise:"]=30;
  70164. //>>excludeEnd("ctx");
  70165. self._should_raise_((function(){
  70166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70167. return smalltalk.withContext(function($ctx2) {
  70168. //>>excludeEnd("ctx");
  70169. return (16)._rV();
  70170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  70172. //>>excludeEnd("ctx");
  70173. }),$MessageNotUnderstood());
  70174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70175. $ctx1.sendIdx["should:raise:"]=31;
  70176. //>>excludeEnd("ctx");
  70177. self._should_raise_((function(){
  70178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70179. return smalltalk.withContext(function($ctx2) {
  70180. //>>excludeEnd("ctx");
  70181. return (16)._rv();
  70182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  70184. //>>excludeEnd("ctx");
  70185. }),$MessageNotUnderstood());
  70186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70187. $ctx1.sendIdx["should:raise:"]=32;
  70188. //>>excludeEnd("ctx");
  70189. self._should_raise_((function(){
  70190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70191. return smalltalk.withContext(function($ctx2) {
  70192. //>>excludeEnd("ctx");
  70193. return (16)._rW();
  70194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  70196. //>>excludeEnd("ctx");
  70197. }),$MessageNotUnderstood());
  70198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70199. $ctx1.sendIdx["should:raise:"]=33;
  70200. //>>excludeEnd("ctx");
  70201. self._should_raise_((function(){
  70202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70203. return smalltalk.withContext(function($ctx2) {
  70204. //>>excludeEnd("ctx");
  70205. return (16)._rw();
  70206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  70208. //>>excludeEnd("ctx");
  70209. }),$MessageNotUnderstood());
  70210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70211. $ctx1.sendIdx["should:raise:"]=34;
  70212. //>>excludeEnd("ctx");
  70213. self._should_raise_((function(){
  70214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70215. return smalltalk.withContext(function($ctx2) {
  70216. //>>excludeEnd("ctx");
  70217. return (16)._rX();
  70218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  70220. //>>excludeEnd("ctx");
  70221. }),$MessageNotUnderstood());
  70222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70223. $ctx1.sendIdx["should:raise:"]=35;
  70224. //>>excludeEnd("ctx");
  70225. self._should_raise_((function(){
  70226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70227. return smalltalk.withContext(function($ctx2) {
  70228. //>>excludeEnd("ctx");
  70229. return (16)._rx();
  70230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  70232. //>>excludeEnd("ctx");
  70233. }),$MessageNotUnderstood());
  70234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70235. $ctx1.sendIdx["should:raise:"]=36;
  70236. //>>excludeEnd("ctx");
  70237. self._should_raise_((function(){
  70238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70239. return smalltalk.withContext(function($ctx2) {
  70240. //>>excludeEnd("ctx");
  70241. return (16)._rY();
  70242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  70244. //>>excludeEnd("ctx");
  70245. }),$MessageNotUnderstood());
  70246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70247. $ctx1.sendIdx["should:raise:"]=37;
  70248. //>>excludeEnd("ctx");
  70249. self._should_raise_((function(){
  70250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70251. return smalltalk.withContext(function($ctx2) {
  70252. //>>excludeEnd("ctx");
  70253. return (16)._ry();
  70254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  70256. //>>excludeEnd("ctx");
  70257. }),$MessageNotUnderstood());
  70258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70259. $ctx1.sendIdx["should:raise:"]=38;
  70260. //>>excludeEnd("ctx");
  70261. self._should_raise_((function(){
  70262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70263. return smalltalk.withContext(function($ctx2) {
  70264. //>>excludeEnd("ctx");
  70265. return (16)._rZ();
  70266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  70268. //>>excludeEnd("ctx");
  70269. }),$MessageNotUnderstood());
  70270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70271. $ctx1.sendIdx["should:raise:"]=39;
  70272. //>>excludeEnd("ctx");
  70273. self._should_raise_((function(){
  70274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70275. return smalltalk.withContext(function($ctx2) {
  70276. //>>excludeEnd("ctx");
  70277. return (16)._rz();
  70278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  70280. //>>excludeEnd("ctx");
  70281. }),$MessageNotUnderstood());
  70282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70283. $ctx1.sendIdx["should:raise:"]=40;
  70284. //>>excludeEnd("ctx");
  70285. self._should_raise_((function(){
  70286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70287. return smalltalk.withContext(function($ctx2) {
  70288. //>>excludeEnd("ctx");
  70289. return (11259375)._Z();
  70290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70291. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  70292. //>>excludeEnd("ctx");
  70293. }),$MessageNotUnderstood());
  70294. return self;
  70295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70296. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)});
  70297. //>>excludeEnd("ctx");
  70298. },
  70299. //>>excludeStart("ide", pragmas.excludeIdeData);
  70300. args: [],
  70301. 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.",
  70302. referencedClasses: ["MessageNotUnderstood"],
  70303. //>>excludeEnd("ide");
  70304. 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"]
  70305. }),
  70306. globals.NumberTest);
  70307. smalltalk.addMethod(
  70308. smalltalk.method({
  70309. selector: "testLog",
  70310. protocol: 'tests',
  70311. fn: function (){
  70312. var self=this;
  70313. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  70314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70315. return smalltalk.withContext(function($ctx1) {
  70316. //>>excludeEnd("ctx");
  70317. self._assert_equals_((10000)._log(),(4));
  70318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70319. $ctx1.sendIdx["assert:equals:"]=1;
  70320. //>>excludeEnd("ctx");
  70321. self._assert_equals_((512)._log_((2)),(9));
  70322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70323. $ctx1.sendIdx["assert:equals:"]=2;
  70324. //>>excludeEnd("ctx");
  70325. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  70326. return self;
  70327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70328. }, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)});
  70329. //>>excludeEnd("ctx");
  70330. },
  70331. //>>excludeStart("ide", pragmas.excludeIdeData);
  70332. args: [],
  70333. 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.",
  70334. referencedClasses: ["Number"],
  70335. //>>excludeEnd("ide");
  70336. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  70337. }),
  70338. globals.NumberTest);
  70339. smalltalk.addMethod(
  70340. smalltalk.method({
  70341. selector: "testMinMax",
  70342. protocol: 'tests',
  70343. fn: function (){
  70344. var self=this;
  70345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70346. return smalltalk.withContext(function($ctx1) {
  70347. //>>excludeEnd("ctx");
  70348. self._assert_equals_((2)._max_((5)),(5));
  70349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70350. $ctx1.sendIdx["assert:equals:"]=1;
  70351. //>>excludeEnd("ctx");
  70352. self._assert_equals_((2)._min_((5)),(2));
  70353. return self;
  70354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70355. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)});
  70356. //>>excludeEnd("ctx");
  70357. },
  70358. //>>excludeStart("ide", pragmas.excludeIdeData);
  70359. args: [],
  70360. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  70361. referencedClasses: [],
  70362. //>>excludeEnd("ide");
  70363. messageSends: ["assert:equals:", "max:", "min:"]
  70364. }),
  70365. globals.NumberTest);
  70366. smalltalk.addMethod(
  70367. smalltalk.method({
  70368. selector: "testNegated",
  70369. protocol: 'tests',
  70370. fn: function (){
  70371. var self=this;
  70372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70373. return smalltalk.withContext(function($ctx1) {
  70374. //>>excludeEnd("ctx");
  70375. var $1;
  70376. $1=(3)._negated();
  70377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70378. $ctx1.sendIdx["negated"]=1;
  70379. //>>excludeEnd("ctx");
  70380. self._assert_equals_($1,(-3));
  70381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70382. $ctx1.sendIdx["assert:equals:"]=1;
  70383. //>>excludeEnd("ctx");
  70384. self._assert_equals_((-3)._negated(),(3));
  70385. return self;
  70386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70387. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)});
  70388. //>>excludeEnd("ctx");
  70389. },
  70390. //>>excludeStart("ide", pragmas.excludeIdeData);
  70391. args: [],
  70392. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  70393. referencedClasses: [],
  70394. //>>excludeEnd("ide");
  70395. messageSends: ["assert:equals:", "negated"]
  70396. }),
  70397. globals.NumberTest);
  70398. smalltalk.addMethod(
  70399. smalltalk.method({
  70400. selector: "testPrintShowingDecimalPlaces",
  70401. protocol: 'tests',
  70402. fn: function (){
  70403. var self=this;
  70404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70405. return smalltalk.withContext(function($ctx1) {
  70406. //>>excludeEnd("ctx");
  70407. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  70408. $1=(23)._printShowingDecimalPlaces_((2));
  70409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70410. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  70411. //>>excludeEnd("ctx");
  70412. self._assert_equals_($1,"23.00");
  70413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70414. $ctx1.sendIdx["assert:equals:"]=1;
  70415. //>>excludeEnd("ctx");
  70416. $2=(23.5698)._printShowingDecimalPlaces_((2));
  70417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70418. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  70419. //>>excludeEnd("ctx");
  70420. self._assert_equals_($2,"23.57");
  70421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70422. $ctx1.sendIdx["assert:equals:"]=2;
  70423. //>>excludeEnd("ctx");
  70424. $4=(234.567)._negated();
  70425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70426. $ctx1.sendIdx["negated"]=1;
  70427. //>>excludeEnd("ctx");
  70428. $3=_st($4)._printShowingDecimalPlaces_((5));
  70429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70430. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  70431. //>>excludeEnd("ctx");
  70432. self._assert_equals_($3,"-234.56700");
  70433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70434. $ctx1.sendIdx["assert:equals:"]=3;
  70435. //>>excludeEnd("ctx");
  70436. $5=(23.4567)._printShowingDecimalPlaces_((0));
  70437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70438. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  70439. //>>excludeEnd("ctx");
  70440. self._assert_equals_($5,"23");
  70441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70442. $ctx1.sendIdx["assert:equals:"]=4;
  70443. //>>excludeEnd("ctx");
  70444. $6=(23.5567)._printShowingDecimalPlaces_((0));
  70445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70446. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  70447. //>>excludeEnd("ctx");
  70448. self._assert_equals_($6,"24");
  70449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70450. $ctx1.sendIdx["assert:equals:"]=5;
  70451. //>>excludeEnd("ctx");
  70452. $8=(23.4567)._negated();
  70453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70454. $ctx1.sendIdx["negated"]=2;
  70455. //>>excludeEnd("ctx");
  70456. $7=_st($8)._printShowingDecimalPlaces_((0));
  70457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70458. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  70459. //>>excludeEnd("ctx");
  70460. self._assert_equals_($7,"-23");
  70461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70462. $ctx1.sendIdx["assert:equals:"]=6;
  70463. //>>excludeEnd("ctx");
  70464. $10=(23.5567)._negated();
  70465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70466. $ctx1.sendIdx["negated"]=3;
  70467. //>>excludeEnd("ctx");
  70468. $9=_st($10)._printShowingDecimalPlaces_((0));
  70469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70470. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  70471. //>>excludeEnd("ctx");
  70472. self._assert_equals_($9,"-24");
  70473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70474. $ctx1.sendIdx["assert:equals:"]=7;
  70475. //>>excludeEnd("ctx");
  70476. $11=(100000000)._printShowingDecimalPlaces_((1));
  70477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70478. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  70479. //>>excludeEnd("ctx");
  70480. self._assert_equals_($11,"100000000.0");
  70481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70482. $ctx1.sendIdx["assert:equals:"]=8;
  70483. //>>excludeEnd("ctx");
  70484. $12=(0.98)._printShowingDecimalPlaces_((5));
  70485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70486. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  70487. //>>excludeEnd("ctx");
  70488. self._assert_equals_($12,"0.98000");
  70489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70490. $ctx1.sendIdx["assert:equals:"]=9;
  70491. //>>excludeEnd("ctx");
  70492. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  70493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70494. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  70495. //>>excludeEnd("ctx");
  70496. self._assert_equals_($13,"-0.98");
  70497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70498. $ctx1.sendIdx["assert:equals:"]=10;
  70499. //>>excludeEnd("ctx");
  70500. $14=(2.567)._printShowingDecimalPlaces_((2));
  70501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70502. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  70503. //>>excludeEnd("ctx");
  70504. self._assert_equals_($14,"2.57");
  70505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70506. $ctx1.sendIdx["assert:equals:"]=11;
  70507. //>>excludeEnd("ctx");
  70508. $15=(-2.567)._printShowingDecimalPlaces_((2));
  70509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70510. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  70511. //>>excludeEnd("ctx");
  70512. self._assert_equals_($15,"-2.57");
  70513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70514. $ctx1.sendIdx["assert:equals:"]=12;
  70515. //>>excludeEnd("ctx");
  70516. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  70517. return self;
  70518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70519. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)});
  70520. //>>excludeEnd("ctx");
  70521. },
  70522. //>>excludeStart("ide", pragmas.excludeIdeData);
  70523. args: [],
  70524. 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'.",
  70525. referencedClasses: [],
  70526. //>>excludeEnd("ide");
  70527. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  70528. }),
  70529. globals.NumberTest);
  70530. smalltalk.addMethod(
  70531. smalltalk.method({
  70532. selector: "testRaisedTo",
  70533. protocol: 'tests',
  70534. fn: function (){
  70535. var self=this;
  70536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70537. return smalltalk.withContext(function($ctx1) {
  70538. //>>excludeEnd("ctx");
  70539. var $1,$2,$3;
  70540. $1=(2)._raisedTo_((4));
  70541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70542. $ctx1.sendIdx["raisedTo:"]=1;
  70543. //>>excludeEnd("ctx");
  70544. self._assert_equals_($1,(16));
  70545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70546. $ctx1.sendIdx["assert:equals:"]=1;
  70547. //>>excludeEnd("ctx");
  70548. $2=(2)._raisedTo_((0));
  70549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70550. $ctx1.sendIdx["raisedTo:"]=2;
  70551. //>>excludeEnd("ctx");
  70552. self._assert_equals_($2,(1));
  70553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70554. $ctx1.sendIdx["assert:equals:"]=2;
  70555. //>>excludeEnd("ctx");
  70556. $3=(2)._raisedTo_((-3));
  70557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70558. $ctx1.sendIdx["raisedTo:"]=3;
  70559. //>>excludeEnd("ctx");
  70560. self._assert_equals_($3,(0.125));
  70561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70562. $ctx1.sendIdx["assert:equals:"]=3;
  70563. //>>excludeEnd("ctx");
  70564. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  70565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70566. $ctx1.sendIdx["assert:equals:"]=4;
  70567. //>>excludeEnd("ctx");
  70568. self._assert_equals_((2).__star_star((4)),(16));
  70569. return self;
  70570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70571. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)});
  70572. //>>excludeEnd("ctx");
  70573. },
  70574. //>>excludeStart("ide", pragmas.excludeIdeData);
  70575. args: [],
  70576. 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.",
  70577. referencedClasses: [],
  70578. //>>excludeEnd("ide");
  70579. messageSends: ["assert:equals:", "raisedTo:", "**"]
  70580. }),
  70581. globals.NumberTest);
  70582. smalltalk.addMethod(
  70583. smalltalk.method({
  70584. selector: "testRounded",
  70585. protocol: 'tests',
  70586. fn: function (){
  70587. var self=this;
  70588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70589. return smalltalk.withContext(function($ctx1) {
  70590. //>>excludeEnd("ctx");
  70591. var $1,$2;
  70592. $1=(3)._rounded();
  70593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70594. $ctx1.sendIdx["rounded"]=1;
  70595. //>>excludeEnd("ctx");
  70596. self._assert_equals_($1,(3));
  70597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70598. $ctx1.sendIdx["assert:equals:"]=1;
  70599. //>>excludeEnd("ctx");
  70600. $2=(3.212)._rounded();
  70601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70602. $ctx1.sendIdx["rounded"]=2;
  70603. //>>excludeEnd("ctx");
  70604. self._assert_equals_($2,(3));
  70605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70606. $ctx1.sendIdx["assert:equals:"]=2;
  70607. //>>excludeEnd("ctx");
  70608. self._assert_equals_((3.51)._rounded(),(4));
  70609. return self;
  70610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70611. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)});
  70612. //>>excludeEnd("ctx");
  70613. },
  70614. //>>excludeStart("ide", pragmas.excludeIdeData);
  70615. args: [],
  70616. 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",
  70617. referencedClasses: [],
  70618. //>>excludeEnd("ide");
  70619. messageSends: ["assert:equals:", "rounded"]
  70620. }),
  70621. globals.NumberTest);
  70622. smalltalk.addMethod(
  70623. smalltalk.method({
  70624. selector: "testSign",
  70625. protocol: 'tests',
  70626. fn: function (){
  70627. var self=this;
  70628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70629. return smalltalk.withContext(function($ctx1) {
  70630. //>>excludeEnd("ctx");
  70631. var $1,$2;
  70632. $1=(5)._sign();
  70633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70634. $ctx1.sendIdx["sign"]=1;
  70635. //>>excludeEnd("ctx");
  70636. self._assert_equals_($1,(1));
  70637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70638. $ctx1.sendIdx["assert:equals:"]=1;
  70639. //>>excludeEnd("ctx");
  70640. $2=(0)._sign();
  70641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70642. $ctx1.sendIdx["sign"]=2;
  70643. //>>excludeEnd("ctx");
  70644. self._assert_equals_($2,(0));
  70645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70646. $ctx1.sendIdx["assert:equals:"]=2;
  70647. //>>excludeEnd("ctx");
  70648. self._assert_equals_((-1.4)._sign(),(-1));
  70649. return self;
  70650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70651. }, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)});
  70652. //>>excludeEnd("ctx");
  70653. },
  70654. //>>excludeStart("ide", pragmas.excludeIdeData);
  70655. args: [],
  70656. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  70657. referencedClasses: [],
  70658. //>>excludeEnd("ide");
  70659. messageSends: ["assert:equals:", "sign"]
  70660. }),
  70661. globals.NumberTest);
  70662. smalltalk.addMethod(
  70663. smalltalk.method({
  70664. selector: "testSqrt",
  70665. protocol: 'tests',
  70666. fn: function (){
  70667. var self=this;
  70668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70669. return smalltalk.withContext(function($ctx1) {
  70670. //>>excludeEnd("ctx");
  70671. var $1;
  70672. $1=(4)._sqrt();
  70673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70674. $ctx1.sendIdx["sqrt"]=1;
  70675. //>>excludeEnd("ctx");
  70676. self._assert_equals_($1,(2));
  70677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70678. $ctx1.sendIdx["assert:equals:"]=1;
  70679. //>>excludeEnd("ctx");
  70680. self._assert_equals_((16)._sqrt(),(4));
  70681. return self;
  70682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70683. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)});
  70684. //>>excludeEnd("ctx");
  70685. },
  70686. //>>excludeStart("ide", pragmas.excludeIdeData);
  70687. args: [],
  70688. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  70689. referencedClasses: [],
  70690. //>>excludeEnd("ide");
  70691. messageSends: ["assert:equals:", "sqrt"]
  70692. }),
  70693. globals.NumberTest);
  70694. smalltalk.addMethod(
  70695. smalltalk.method({
  70696. selector: "testSquared",
  70697. protocol: 'tests',
  70698. fn: function (){
  70699. var self=this;
  70700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70701. return smalltalk.withContext(function($ctx1) {
  70702. //>>excludeEnd("ctx");
  70703. self._assert_equals_((4)._squared(),(16));
  70704. return self;
  70705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70706. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)});
  70707. //>>excludeEnd("ctx");
  70708. },
  70709. //>>excludeStart("ide", pragmas.excludeIdeData);
  70710. args: [],
  70711. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  70712. referencedClasses: [],
  70713. //>>excludeEnd("ide");
  70714. messageSends: ["assert:equals:", "squared"]
  70715. }),
  70716. globals.NumberTest);
  70717. smalltalk.addMethod(
  70718. smalltalk.method({
  70719. selector: "testTimesRepeat",
  70720. protocol: 'tests',
  70721. fn: function (){
  70722. var self=this;
  70723. var i;
  70724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70725. return smalltalk.withContext(function($ctx1) {
  70726. //>>excludeEnd("ctx");
  70727. i=(0);
  70728. (0)._timesRepeat_((function(){
  70729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70730. return smalltalk.withContext(function($ctx2) {
  70731. //>>excludeEnd("ctx");
  70732. i=_st(i).__plus((1));
  70733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70734. $ctx2.sendIdx["+"]=1;
  70735. //>>excludeEnd("ctx");
  70736. return i;
  70737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  70739. //>>excludeEnd("ctx");
  70740. }));
  70741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70742. $ctx1.sendIdx["timesRepeat:"]=1;
  70743. //>>excludeEnd("ctx");
  70744. self._assert_equals_(i,(0));
  70745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70746. $ctx1.sendIdx["assert:equals:"]=1;
  70747. //>>excludeEnd("ctx");
  70748. (5)._timesRepeat_((function(){
  70749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70750. return smalltalk.withContext(function($ctx2) {
  70751. //>>excludeEnd("ctx");
  70752. i=_st(i).__plus((1));
  70753. return i;
  70754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70755. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  70756. //>>excludeEnd("ctx");
  70757. }));
  70758. self._assert_equals_(i,(5));
  70759. return self;
  70760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70761. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)});
  70762. //>>excludeEnd("ctx");
  70763. },
  70764. //>>excludeStart("ide", pragmas.excludeIdeData);
  70765. args: [],
  70766. 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",
  70767. referencedClasses: [],
  70768. //>>excludeEnd("ide");
  70769. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  70770. }),
  70771. globals.NumberTest);
  70772. smalltalk.addMethod(
  70773. smalltalk.method({
  70774. selector: "testTo",
  70775. protocol: 'tests',
  70776. fn: function (){
  70777. var self=this;
  70778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70779. return smalltalk.withContext(function($ctx1) {
  70780. //>>excludeEnd("ctx");
  70781. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  70782. return self;
  70783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70784. }, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)});
  70785. //>>excludeEnd("ctx");
  70786. },
  70787. //>>excludeStart("ide", pragmas.excludeIdeData);
  70788. args: [],
  70789. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  70790. referencedClasses: [],
  70791. //>>excludeEnd("ide");
  70792. messageSends: ["assert:equals:", "to:"]
  70793. }),
  70794. globals.NumberTest);
  70795. smalltalk.addMethod(
  70796. smalltalk.method({
  70797. selector: "testToBy",
  70798. protocol: 'tests',
  70799. fn: function (){
  70800. var self=this;
  70801. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  70802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70803. return smalltalk.withContext(function($ctx1) {
  70804. //>>excludeEnd("ctx");
  70805. var $1;
  70806. $1=(0)._to_by_((6),(2));
  70807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70808. $ctx1.sendIdx["to:by:"]=1;
  70809. //>>excludeEnd("ctx");
  70810. self._assert_equals_($1,[(0), (2), (4), (6)]);
  70811. self._should_raise_((function(){
  70812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70813. return smalltalk.withContext(function($ctx2) {
  70814. //>>excludeEnd("ctx");
  70815. return (1)._to_by_((4),(0));
  70816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  70818. //>>excludeEnd("ctx");
  70819. }),$Error());
  70820. return self;
  70821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70822. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)});
  70823. //>>excludeEnd("ctx");
  70824. },
  70825. //>>excludeStart("ide", pragmas.excludeIdeData);
  70826. args: [],
  70827. 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",
  70828. referencedClasses: ["Error"],
  70829. //>>excludeEnd("ide");
  70830. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  70831. }),
  70832. globals.NumberTest);
  70833. smalltalk.addMethod(
  70834. smalltalk.method({
  70835. selector: "testTrigonometry",
  70836. protocol: 'tests',
  70837. fn: function (){
  70838. var self=this;
  70839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70840. return smalltalk.withContext(function($ctx1) {
  70841. //>>excludeEnd("ctx");
  70842. self._assert_equals_((0)._cos(),(1));
  70843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70844. $ctx1.sendIdx["assert:equals:"]=1;
  70845. //>>excludeEnd("ctx");
  70846. self._assert_equals_((0)._sin(),(0));
  70847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70848. $ctx1.sendIdx["assert:equals:"]=2;
  70849. //>>excludeEnd("ctx");
  70850. self._assert_equals_((0)._tan(),(0));
  70851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70852. $ctx1.sendIdx["assert:equals:"]=3;
  70853. //>>excludeEnd("ctx");
  70854. self._assert_equals_((1)._arcCos(),(0));
  70855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70856. $ctx1.sendIdx["assert:equals:"]=4;
  70857. //>>excludeEnd("ctx");
  70858. self._assert_equals_((0)._arcSin(),(0));
  70859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70860. $ctx1.sendIdx["assert:equals:"]=5;
  70861. //>>excludeEnd("ctx");
  70862. self._assert_equals_((0)._arcTan(),(0));
  70863. return self;
  70864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70865. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)});
  70866. //>>excludeEnd("ctx");
  70867. },
  70868. //>>excludeStart("ide", pragmas.excludeIdeData);
  70869. args: [],
  70870. 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.",
  70871. referencedClasses: [],
  70872. //>>excludeEnd("ide");
  70873. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  70874. }),
  70875. globals.NumberTest);
  70876. smalltalk.addMethod(
  70877. smalltalk.method({
  70878. selector: "testTruncated",
  70879. protocol: 'tests',
  70880. fn: function (){
  70881. var self=this;
  70882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70883. return smalltalk.withContext(function($ctx1) {
  70884. //>>excludeEnd("ctx");
  70885. var $1,$2;
  70886. $1=(3)._truncated();
  70887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70888. $ctx1.sendIdx["truncated"]=1;
  70889. //>>excludeEnd("ctx");
  70890. self._assert_equals_($1,(3));
  70891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70892. $ctx1.sendIdx["assert:equals:"]=1;
  70893. //>>excludeEnd("ctx");
  70894. $2=(3.212)._truncated();
  70895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70896. $ctx1.sendIdx["truncated"]=2;
  70897. //>>excludeEnd("ctx");
  70898. self._assert_equals_($2,(3));
  70899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70900. $ctx1.sendIdx["assert:equals:"]=2;
  70901. //>>excludeEnd("ctx");
  70902. self._assert_equals_((3.51)._truncated(),(3));
  70903. return self;
  70904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70905. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)});
  70906. //>>excludeEnd("ctx");
  70907. },
  70908. //>>excludeStart("ide", pragmas.excludeIdeData);
  70909. args: [],
  70910. 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",
  70911. referencedClasses: [],
  70912. //>>excludeEnd("ide");
  70913. messageSends: ["assert:equals:", "truncated"]
  70914. }),
  70915. globals.NumberTest);
  70916. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  70917. //>>excludeStart("ide", pragmas.excludeIdeData);
  70918. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  70919. //>>excludeEnd("ide");
  70920. smalltalk.addMethod(
  70921. smalltalk.method({
  70922. selector: "foo",
  70923. protocol: 'not yet classified',
  70924. fn: function (){
  70925. var self=this;
  70926. var $1;
  70927. $1=self["@foo"];
  70928. return $1;
  70929. },
  70930. //>>excludeStart("ide", pragmas.excludeIdeData);
  70931. args: [],
  70932. source: "foo\x0a\x09^ foo",
  70933. referencedClasses: [],
  70934. //>>excludeEnd("ide");
  70935. messageSends: []
  70936. }),
  70937. globals.ObjectMock);
  70938. smalltalk.addMethod(
  70939. smalltalk.method({
  70940. selector: "foo:",
  70941. protocol: 'not yet classified',
  70942. fn: function (anObject){
  70943. var self=this;
  70944. self["@foo"]=anObject;
  70945. return self;
  70946. },
  70947. //>>excludeStart("ide", pragmas.excludeIdeData);
  70948. args: ["anObject"],
  70949. source: "foo: anObject\x0a\x09foo := anObject",
  70950. referencedClasses: [],
  70951. //>>excludeEnd("ide");
  70952. messageSends: []
  70953. }),
  70954. globals.ObjectMock);
  70955. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  70956. smalltalk.addMethod(
  70957. smalltalk.method({
  70958. selector: "notDefined",
  70959. protocol: 'tests',
  70960. fn: function (){
  70961. var self=this;
  70962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70963. return smalltalk.withContext(function($ctx1) {
  70964. //>>excludeEnd("ctx");
  70965. return void 0;;
  70966. return self;
  70967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70968. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)});
  70969. //>>excludeEnd("ctx");
  70970. },
  70971. //>>excludeStart("ide", pragmas.excludeIdeData);
  70972. args: [],
  70973. source: "notDefined\x0a\x09<return void 0;>",
  70974. referencedClasses: [],
  70975. //>>excludeEnd("ide");
  70976. messageSends: []
  70977. }),
  70978. globals.ObjectTest);
  70979. smalltalk.addMethod(
  70980. smalltalk.method({
  70981. selector: "testBasicAccess",
  70982. protocol: 'tests',
  70983. fn: function (){
  70984. var self=this;
  70985. var o;
  70986. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  70987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70988. return smalltalk.withContext(function($ctx1) {
  70989. //>>excludeEnd("ctx");
  70990. var $1;
  70991. o=_st($Object())._new();
  70992. _st(o)._basicAt_put_("a",(1));
  70993. $1=_st(o)._basicAt_("a");
  70994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70995. $ctx1.sendIdx["basicAt:"]=1;
  70996. //>>excludeEnd("ctx");
  70997. self._assert_equals_($1,(1));
  70998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  70999. $ctx1.sendIdx["assert:equals:"]=1;
  71000. //>>excludeEnd("ctx");
  71001. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  71002. return self;
  71003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71004. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)});
  71005. //>>excludeEnd("ctx");
  71006. },
  71007. //>>excludeStart("ide", pragmas.excludeIdeData);
  71008. args: [],
  71009. 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",
  71010. referencedClasses: ["Object"],
  71011. //>>excludeEnd("ide");
  71012. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  71013. }),
  71014. globals.ObjectTest);
  71015. smalltalk.addMethod(
  71016. smalltalk.method({
  71017. selector: "testBasicPerform",
  71018. protocol: 'tests',
  71019. fn: function (){
  71020. var self=this;
  71021. var o;
  71022. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71024. return smalltalk.withContext(function($ctx1) {
  71025. //>>excludeEnd("ctx");
  71026. o=_st($Object())._new();
  71027. _st(o)._basicAt_put_("func",(function(){
  71028. return "hello";
  71029. }));
  71030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71031. $ctx1.sendIdx["basicAt:put:"]=1;
  71032. //>>excludeEnd("ctx");
  71033. _st(o)._basicAt_put_("func2",(function(a){
  71034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71035. return smalltalk.withContext(function($ctx2) {
  71036. //>>excludeEnd("ctx");
  71037. return _st(a).__plus((1));
  71038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71039. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  71040. //>>excludeEnd("ctx");
  71041. }));
  71042. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  71043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71044. $ctx1.sendIdx["assert:equals:"]=1;
  71045. //>>excludeEnd("ctx");
  71046. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  71047. return self;
  71048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71049. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)});
  71050. //>>excludeEnd("ctx");
  71051. },
  71052. //>>excludeStart("ide", pragmas.excludeIdeData);
  71053. args: [],
  71054. 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",
  71055. referencedClasses: ["Object"],
  71056. //>>excludeEnd("ide");
  71057. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  71058. }),
  71059. globals.ObjectTest);
  71060. smalltalk.addMethod(
  71061. smalltalk.method({
  71062. selector: "testDNU",
  71063. protocol: 'tests',
  71064. fn: function (){
  71065. var self=this;
  71066. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71067. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  71068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71069. return smalltalk.withContext(function($ctx1) {
  71070. //>>excludeEnd("ctx");
  71071. self._should_raise_((function(){
  71072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71073. return smalltalk.withContext(function($ctx2) {
  71074. //>>excludeEnd("ctx");
  71075. return _st(_st($Object())._new())._foo();
  71076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  71078. //>>excludeEnd("ctx");
  71079. }),$MessageNotUnderstood());
  71080. return self;
  71081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71082. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)});
  71083. //>>excludeEnd("ctx");
  71084. },
  71085. //>>excludeStart("ide", pragmas.excludeIdeData);
  71086. args: [],
  71087. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  71088. referencedClasses: ["Object", "MessageNotUnderstood"],
  71089. //>>excludeEnd("ide");
  71090. messageSends: ["should:raise:", "foo", "new"]
  71091. }),
  71092. globals.ObjectTest);
  71093. smalltalk.addMethod(
  71094. smalltalk.method({
  71095. selector: "testEquality",
  71096. protocol: 'tests',
  71097. fn: function (){
  71098. var self=this;
  71099. var o;
  71100. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71102. return smalltalk.withContext(function($ctx1) {
  71103. //>>excludeEnd("ctx");
  71104. var $1,$2,$4,$3;
  71105. o=_st($Object())._new();
  71106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71107. $ctx1.sendIdx["new"]=1;
  71108. //>>excludeEnd("ctx");
  71109. $1=_st(o).__eq(_st($Object())._new());
  71110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71111. $ctx1.sendIdx["="]=1;
  71112. //>>excludeEnd("ctx");
  71113. self._deny_($1);
  71114. $2=_st(o).__eq(o);
  71115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71116. $ctx1.sendIdx["="]=2;
  71117. //>>excludeEnd("ctx");
  71118. self._assert_($2);
  71119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71120. $ctx1.sendIdx["assert:"]=1;
  71121. //>>excludeEnd("ctx");
  71122. $4=_st(o)._yourself();
  71123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71124. $ctx1.sendIdx["yourself"]=1;
  71125. //>>excludeEnd("ctx");
  71126. $3=_st($4).__eq(o);
  71127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71128. $ctx1.sendIdx["="]=3;
  71129. //>>excludeEnd("ctx");
  71130. self._assert_($3);
  71131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71132. $ctx1.sendIdx["assert:"]=2;
  71133. //>>excludeEnd("ctx");
  71134. self._assert_(_st(o).__eq(_st(o)._yourself()));
  71135. return self;
  71136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71137. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)});
  71138. //>>excludeEnd("ctx");
  71139. },
  71140. //>>excludeStart("ide", pragmas.excludeIdeData);
  71141. args: [],
  71142. 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)",
  71143. referencedClasses: ["Object"],
  71144. //>>excludeEnd("ide");
  71145. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  71146. }),
  71147. globals.ObjectTest);
  71148. smalltalk.addMethod(
  71149. smalltalk.method({
  71150. selector: "testHalt",
  71151. protocol: 'tests',
  71152. fn: function (){
  71153. var self=this;
  71154. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71155. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  71156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71157. return smalltalk.withContext(function($ctx1) {
  71158. //>>excludeEnd("ctx");
  71159. self._should_raise_((function(){
  71160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71161. return smalltalk.withContext(function($ctx2) {
  71162. //>>excludeEnd("ctx");
  71163. return _st(_st($Object())._new())._halt();
  71164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  71166. //>>excludeEnd("ctx");
  71167. }),$Error());
  71168. return self;
  71169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71170. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)});
  71171. //>>excludeEnd("ctx");
  71172. },
  71173. //>>excludeStart("ide", pragmas.excludeIdeData);
  71174. args: [],
  71175. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  71176. referencedClasses: ["Object", "Error"],
  71177. //>>excludeEnd("ide");
  71178. messageSends: ["should:raise:", "halt", "new"]
  71179. }),
  71180. globals.ObjectTest);
  71181. smalltalk.addMethod(
  71182. smalltalk.method({
  71183. selector: "testIdentity",
  71184. protocol: 'tests',
  71185. fn: function (){
  71186. var self=this;
  71187. var o;
  71188. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71190. return smalltalk.withContext(function($ctx1) {
  71191. //>>excludeEnd("ctx");
  71192. var $1,$2,$4,$3;
  71193. o=_st($Object())._new();
  71194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71195. $ctx1.sendIdx["new"]=1;
  71196. //>>excludeEnd("ctx");
  71197. $1=_st(o).__eq_eq(_st($Object())._new());
  71198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71199. $ctx1.sendIdx["=="]=1;
  71200. //>>excludeEnd("ctx");
  71201. self._deny_($1);
  71202. $2=_st(o).__eq_eq(o);
  71203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71204. $ctx1.sendIdx["=="]=2;
  71205. //>>excludeEnd("ctx");
  71206. self._assert_($2);
  71207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71208. $ctx1.sendIdx["assert:"]=1;
  71209. //>>excludeEnd("ctx");
  71210. $4=_st(o)._yourself();
  71211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71212. $ctx1.sendIdx["yourself"]=1;
  71213. //>>excludeEnd("ctx");
  71214. $3=_st($4).__eq_eq(o);
  71215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71216. $ctx1.sendIdx["=="]=3;
  71217. //>>excludeEnd("ctx");
  71218. self._assert_($3);
  71219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71220. $ctx1.sendIdx["assert:"]=2;
  71221. //>>excludeEnd("ctx");
  71222. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  71223. return self;
  71224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71225. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)});
  71226. //>>excludeEnd("ctx");
  71227. },
  71228. //>>excludeStart("ide", pragmas.excludeIdeData);
  71229. args: [],
  71230. 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",
  71231. referencedClasses: ["Object"],
  71232. //>>excludeEnd("ide");
  71233. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  71234. }),
  71235. globals.ObjectTest);
  71236. smalltalk.addMethod(
  71237. smalltalk.method({
  71238. selector: "testIfNil",
  71239. protocol: 'tests',
  71240. fn: function (){
  71241. var self=this;
  71242. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71244. return smalltalk.withContext(function($ctx1) {
  71245. //>>excludeEnd("ctx");
  71246. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  71247. $2=_st($Object())._new();
  71248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71249. $ctx1.sendIdx["new"]=1;
  71250. //>>excludeEnd("ctx");
  71251. $1=_st($2)._isNil();
  71252. self._deny_($1);
  71253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71254. $ctx1.sendIdx["deny:"]=1;
  71255. //>>excludeEnd("ctx");
  71256. $5=_st($Object())._new();
  71257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71258. $ctx1.sendIdx["new"]=2;
  71259. //>>excludeEnd("ctx");
  71260. if(($receiver = $5) == null || $receiver.isNil){
  71261. $4=true;
  71262. } else {
  71263. $4=$5;
  71264. };
  71265. $3=_st($4).__eq(true);
  71266. self._deny_($3);
  71267. $7=_st($Object())._new();
  71268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71269. $ctx1.sendIdx["new"]=3;
  71270. //>>excludeEnd("ctx");
  71271. if(($receiver = $7) == null || $receiver.isNil){
  71272. $6=$7;
  71273. } else {
  71274. $6=true;
  71275. };
  71276. self._assert_equals_($6,true);
  71277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71278. $ctx1.sendIdx["assert:equals:"]=1;
  71279. //>>excludeEnd("ctx");
  71280. $9=_st($Object())._new();
  71281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71282. $ctx1.sendIdx["new"]=4;
  71283. //>>excludeEnd("ctx");
  71284. if(($receiver = $9) == null || $receiver.isNil){
  71285. $8=false;
  71286. } else {
  71287. $8=true;
  71288. };
  71289. self._assert_equals_($8,true);
  71290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71291. $ctx1.sendIdx["assert:equals:"]=2;
  71292. //>>excludeEnd("ctx");
  71293. $11=_st($Object())._new();
  71294. if(($receiver = $11) == null || $receiver.isNil){
  71295. $10=false;
  71296. } else {
  71297. $10=true;
  71298. };
  71299. self._assert_equals_($10,true);
  71300. return self;
  71301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71302. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)});
  71303. //>>excludeEnd("ctx");
  71304. },
  71305. //>>excludeStart("ide", pragmas.excludeIdeData);
  71306. args: [],
  71307. 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",
  71308. referencedClasses: ["Object"],
  71309. //>>excludeEnd("ide");
  71310. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  71311. }),
  71312. globals.ObjectTest);
  71313. smalltalk.addMethod(
  71314. smalltalk.method({
  71315. selector: "testInstVars",
  71316. protocol: 'tests',
  71317. fn: function (){
  71318. var self=this;
  71319. var o;
  71320. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  71321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71322. return smalltalk.withContext(function($ctx1) {
  71323. //>>excludeEnd("ctx");
  71324. var $1,$2;
  71325. o=_st($ObjectMock())._new();
  71326. $1=_st(o)._instVarAt_("foo");
  71327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71328. $ctx1.sendIdx["instVarAt:"]=1;
  71329. //>>excludeEnd("ctx");
  71330. self._assert_equals_($1,nil);
  71331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71332. $ctx1.sendIdx["assert:equals:"]=1;
  71333. //>>excludeEnd("ctx");
  71334. _st(o)._instVarAt_put_("foo",(1));
  71335. $2=_st(o)._instVarAt_("foo");
  71336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71337. $ctx1.sendIdx["instVarAt:"]=2;
  71338. //>>excludeEnd("ctx");
  71339. self._assert_equals_($2,(1));
  71340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71341. $ctx1.sendIdx["assert:equals:"]=2;
  71342. //>>excludeEnd("ctx");
  71343. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  71344. return self;
  71345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71346. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)});
  71347. //>>excludeEnd("ctx");
  71348. },
  71349. //>>excludeStart("ide", pragmas.excludeIdeData);
  71350. args: [],
  71351. 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",
  71352. referencedClasses: ["ObjectMock"],
  71353. //>>excludeEnd("ide");
  71354. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  71355. }),
  71356. globals.ObjectTest);
  71357. smalltalk.addMethod(
  71358. smalltalk.method({
  71359. selector: "testNilUndefined",
  71360. protocol: 'tests',
  71361. fn: function (){
  71362. var self=this;
  71363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71364. return smalltalk.withContext(function($ctx1) {
  71365. //>>excludeEnd("ctx");
  71366. self._assert_equals_(self._notDefined(),nil);
  71367. return self;
  71368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71369. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)});
  71370. //>>excludeEnd("ctx");
  71371. },
  71372. //>>excludeStart("ide", pragmas.excludeIdeData);
  71373. args: [],
  71374. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  71375. referencedClasses: [],
  71376. //>>excludeEnd("ide");
  71377. messageSends: ["assert:equals:", "notDefined"]
  71378. }),
  71379. globals.ObjectTest);
  71380. smalltalk.addMethod(
  71381. smalltalk.method({
  71382. selector: "testYourself",
  71383. protocol: 'tests',
  71384. fn: function (){
  71385. var self=this;
  71386. var o;
  71387. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  71388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71389. return smalltalk.withContext(function($ctx1) {
  71390. //>>excludeEnd("ctx");
  71391. o=_st($ObjectMock())._new();
  71392. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  71393. return self;
  71394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71395. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)});
  71396. //>>excludeEnd("ctx");
  71397. },
  71398. //>>excludeStart("ide", pragmas.excludeIdeData);
  71399. args: [],
  71400. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  71401. referencedClasses: ["ObjectMock"],
  71402. //>>excludeEnd("ide");
  71403. messageSends: ["new", "assert:", "==", "yourself"]
  71404. }),
  71405. globals.ObjectTest);
  71406. smalltalk.addMethod(
  71407. smalltalk.method({
  71408. selector: "testidentityHash",
  71409. protocol: 'tests',
  71410. fn: function (){
  71411. var self=this;
  71412. var o1,o2;
  71413. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  71414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71415. return smalltalk.withContext(function($ctx1) {
  71416. //>>excludeEnd("ctx");
  71417. var $2,$3,$1,$5,$4;
  71418. o1=_st($Object())._new();
  71419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71420. $ctx1.sendIdx["new"]=1;
  71421. //>>excludeEnd("ctx");
  71422. o2=_st($Object())._new();
  71423. $2=_st(o1)._identityHash();
  71424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71425. $ctx1.sendIdx["identityHash"]=1;
  71426. //>>excludeEnd("ctx");
  71427. $3=_st(o1)._identityHash();
  71428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71429. $ctx1.sendIdx["identityHash"]=2;
  71430. //>>excludeEnd("ctx");
  71431. $1=_st($2).__eq_eq($3);
  71432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71433. $ctx1.sendIdx["=="]=1;
  71434. //>>excludeEnd("ctx");
  71435. self._assert_($1);
  71436. $5=_st(o1)._identityHash();
  71437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71438. $ctx1.sendIdx["identityHash"]=3;
  71439. //>>excludeEnd("ctx");
  71440. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  71441. self._deny_($4);
  71442. return self;
  71443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71444. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)});
  71445. //>>excludeEnd("ctx");
  71446. },
  71447. //>>excludeStart("ide", pragmas.excludeIdeData);
  71448. args: [],
  71449. 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",
  71450. referencedClasses: ["Object"],
  71451. //>>excludeEnd("ide");
  71452. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  71453. }),
  71454. globals.ObjectTest);
  71455. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  71456. smalltalk.addMethod(
  71457. smalltalk.method({
  71458. selector: "testAccessing",
  71459. protocol: 'tests',
  71460. fn: function (){
  71461. var self=this;
  71462. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71464. return smalltalk.withContext(function($ctx1) {
  71465. //>>excludeEnd("ctx");
  71466. var $2,$1,$3,$6,$5,$4;
  71467. $2=_st($Point())._x_y_((3),(4));
  71468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71469. $ctx1.sendIdx["x:y:"]=1;
  71470. //>>excludeEnd("ctx");
  71471. $1=_st($2)._x();
  71472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71473. $ctx1.sendIdx["x"]=1;
  71474. //>>excludeEnd("ctx");
  71475. self._assert_equals_($1,(3));
  71476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71477. $ctx1.sendIdx["assert:equals:"]=1;
  71478. //>>excludeEnd("ctx");
  71479. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  71480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71481. $ctx1.sendIdx["y"]=1;
  71482. //>>excludeEnd("ctx");
  71483. self._assert_equals_($3,(4));
  71484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71485. $ctx1.sendIdx["assert:equals:"]=2;
  71486. //>>excludeEnd("ctx");
  71487. $6=_st($Point())._new();
  71488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71489. $ctx1.sendIdx["new"]=1;
  71490. //>>excludeEnd("ctx");
  71491. $5=_st($6)._x_((3));
  71492. $4=_st($5)._x();
  71493. self._assert_equals_($4,(3));
  71494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71495. $ctx1.sendIdx["assert:equals:"]=3;
  71496. //>>excludeEnd("ctx");
  71497. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  71498. return self;
  71499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71500. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)});
  71501. //>>excludeEnd("ctx");
  71502. },
  71503. //>>excludeStart("ide", pragmas.excludeIdeData);
  71504. args: [],
  71505. 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",
  71506. referencedClasses: ["Point"],
  71507. //>>excludeEnd("ide");
  71508. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  71509. }),
  71510. globals.PointTest);
  71511. smalltalk.addMethod(
  71512. smalltalk.method({
  71513. selector: "testArithmetic",
  71514. protocol: 'tests',
  71515. fn: function (){
  71516. var self=this;
  71517. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71519. return smalltalk.withContext(function($ctx1) {
  71520. //>>excludeEnd("ctx");
  71521. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  71522. $2=(3).__at((4));
  71523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71524. $ctx1.sendIdx["@"]=1;
  71525. //>>excludeEnd("ctx");
  71526. $3=(3).__at((4));
  71527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71528. $ctx1.sendIdx["@"]=2;
  71529. //>>excludeEnd("ctx");
  71530. $1=_st($2).__star($3);
  71531. $4=_st($Point())._x_y_((9),(16));
  71532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71533. $ctx1.sendIdx["x:y:"]=1;
  71534. //>>excludeEnd("ctx");
  71535. self._assert_equals_($1,$4);
  71536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71537. $ctx1.sendIdx["assert:equals:"]=1;
  71538. //>>excludeEnd("ctx");
  71539. $6=(3).__at((4));
  71540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71541. $ctx1.sendIdx["@"]=3;
  71542. //>>excludeEnd("ctx");
  71543. $7=(3).__at((4));
  71544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71545. $ctx1.sendIdx["@"]=4;
  71546. //>>excludeEnd("ctx");
  71547. $5=_st($6).__plus($7);
  71548. $8=_st($Point())._x_y_((6),(8));
  71549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71550. $ctx1.sendIdx["x:y:"]=2;
  71551. //>>excludeEnd("ctx");
  71552. self._assert_equals_($5,$8);
  71553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71554. $ctx1.sendIdx["assert:equals:"]=2;
  71555. //>>excludeEnd("ctx");
  71556. $10=(3).__at((4));
  71557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71558. $ctx1.sendIdx["@"]=5;
  71559. //>>excludeEnd("ctx");
  71560. $11=(3).__at((4));
  71561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71562. $ctx1.sendIdx["@"]=6;
  71563. //>>excludeEnd("ctx");
  71564. $9=_st($10).__minus($11);
  71565. $12=_st($Point())._x_y_((0),(0));
  71566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71567. $ctx1.sendIdx["x:y:"]=3;
  71568. //>>excludeEnd("ctx");
  71569. self._assert_equals_($9,$12);
  71570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71571. $ctx1.sendIdx["assert:equals:"]=3;
  71572. //>>excludeEnd("ctx");
  71573. $14=(6).__at((8));
  71574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71575. $ctx1.sendIdx["@"]=7;
  71576. //>>excludeEnd("ctx");
  71577. $13=_st($14).__slash((3).__at((4)));
  71578. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  71579. return self;
  71580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71581. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)});
  71582. //>>excludeEnd("ctx");
  71583. },
  71584. //>>excludeStart("ide", pragmas.excludeIdeData);
  71585. args: [],
  71586. 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)",
  71587. referencedClasses: ["Point"],
  71588. //>>excludeEnd("ide");
  71589. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  71590. }),
  71591. globals.PointTest);
  71592. smalltalk.addMethod(
  71593. smalltalk.method({
  71594. selector: "testAt",
  71595. protocol: 'tests',
  71596. fn: function (){
  71597. var self=this;
  71598. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71600. return smalltalk.withContext(function($ctx1) {
  71601. //>>excludeEnd("ctx");
  71602. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  71603. return self;
  71604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71605. }, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)});
  71606. //>>excludeEnd("ctx");
  71607. },
  71608. //>>excludeStart("ide", pragmas.excludeIdeData);
  71609. args: [],
  71610. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  71611. referencedClasses: ["Point"],
  71612. //>>excludeEnd("ide");
  71613. messageSends: ["assert:equals:", "@", "x:y:"]
  71614. }),
  71615. globals.PointTest);
  71616. smalltalk.addMethod(
  71617. smalltalk.method({
  71618. selector: "testComparison",
  71619. protocol: 'tests',
  71620. fn: function (){
  71621. var self=this;
  71622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71623. return smalltalk.withContext(function($ctx1) {
  71624. //>>excludeEnd("ctx");
  71625. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  71626. $2=(3).__at((4));
  71627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71628. $ctx1.sendIdx["@"]=1;
  71629. //>>excludeEnd("ctx");
  71630. $3=(4).__at((5));
  71631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71632. $ctx1.sendIdx["@"]=2;
  71633. //>>excludeEnd("ctx");
  71634. $1=_st($2).__lt($3);
  71635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71636. $ctx1.sendIdx["<"]=1;
  71637. //>>excludeEnd("ctx");
  71638. self._assert_($1);
  71639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71640. $ctx1.sendIdx["assert:"]=1;
  71641. //>>excludeEnd("ctx");
  71642. $5=(3).__at((4));
  71643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71644. $ctx1.sendIdx["@"]=3;
  71645. //>>excludeEnd("ctx");
  71646. $6=(4).__at((4));
  71647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71648. $ctx1.sendIdx["@"]=4;
  71649. //>>excludeEnd("ctx");
  71650. $4=_st($5).__lt($6);
  71651. self._deny_($4);
  71652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71653. $ctx1.sendIdx["deny:"]=1;
  71654. //>>excludeEnd("ctx");
  71655. $8=(4).__at((5));
  71656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71657. $ctx1.sendIdx["@"]=5;
  71658. //>>excludeEnd("ctx");
  71659. $9=(4).__at((5));
  71660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71661. $ctx1.sendIdx["@"]=6;
  71662. //>>excludeEnd("ctx");
  71663. $7=_st($8).__lt_eq($9);
  71664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71665. $ctx1.sendIdx["<="]=1;
  71666. //>>excludeEnd("ctx");
  71667. self._assert_($7);
  71668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71669. $ctx1.sendIdx["assert:"]=2;
  71670. //>>excludeEnd("ctx");
  71671. $11=(4).__at((5));
  71672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71673. $ctx1.sendIdx["@"]=7;
  71674. //>>excludeEnd("ctx");
  71675. $12=(3).__at((5));
  71676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71677. $ctx1.sendIdx["@"]=8;
  71678. //>>excludeEnd("ctx");
  71679. $10=_st($11).__lt_eq($12);
  71680. self._deny_($10);
  71681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71682. $ctx1.sendIdx["deny:"]=2;
  71683. //>>excludeEnd("ctx");
  71684. $14=(5).__at((6));
  71685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71686. $ctx1.sendIdx["@"]=9;
  71687. //>>excludeEnd("ctx");
  71688. $15=(4).__at((5));
  71689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71690. $ctx1.sendIdx["@"]=10;
  71691. //>>excludeEnd("ctx");
  71692. $13=_st($14).__gt($15);
  71693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71694. $ctx1.sendIdx[">"]=1;
  71695. //>>excludeEnd("ctx");
  71696. self._assert_($13);
  71697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71698. $ctx1.sendIdx["assert:"]=3;
  71699. //>>excludeEnd("ctx");
  71700. $17=(5).__at((6));
  71701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71702. $ctx1.sendIdx["@"]=11;
  71703. //>>excludeEnd("ctx");
  71704. $18=(6).__at((6));
  71705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71706. $ctx1.sendIdx["@"]=12;
  71707. //>>excludeEnd("ctx");
  71708. $16=_st($17).__gt($18);
  71709. self._deny_($16);
  71710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71711. $ctx1.sendIdx["deny:"]=3;
  71712. //>>excludeEnd("ctx");
  71713. $20=(4).__at((5));
  71714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71715. $ctx1.sendIdx["@"]=13;
  71716. //>>excludeEnd("ctx");
  71717. $21=(4).__at((5));
  71718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71719. $ctx1.sendIdx["@"]=14;
  71720. //>>excludeEnd("ctx");
  71721. $19=_st($20).__gt_eq($21);
  71722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71723. $ctx1.sendIdx[">="]=1;
  71724. //>>excludeEnd("ctx");
  71725. self._assert_($19);
  71726. $23=(4).__at((5));
  71727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71728. $ctx1.sendIdx["@"]=15;
  71729. //>>excludeEnd("ctx");
  71730. $22=_st($23).__gt_eq((5).__at((5)));
  71731. self._deny_($22);
  71732. return self;
  71733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71734. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)});
  71735. //>>excludeEnd("ctx");
  71736. },
  71737. //>>excludeStart("ide", pragmas.excludeIdeData);
  71738. args: [],
  71739. 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)",
  71740. referencedClasses: [],
  71741. //>>excludeEnd("ide");
  71742. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  71743. }),
  71744. globals.PointTest);
  71745. smalltalk.addMethod(
  71746. smalltalk.method({
  71747. selector: "testEgality",
  71748. protocol: 'tests',
  71749. fn: function (){
  71750. var self=this;
  71751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71752. return smalltalk.withContext(function($ctx1) {
  71753. //>>excludeEnd("ctx");
  71754. var $2,$3,$1,$5,$4;
  71755. $2=(3).__at((4));
  71756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71757. $ctx1.sendIdx["@"]=1;
  71758. //>>excludeEnd("ctx");
  71759. $3=(3).__at((4));
  71760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71761. $ctx1.sendIdx["@"]=2;
  71762. //>>excludeEnd("ctx");
  71763. $1=_st($2).__eq($3);
  71764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71765. $ctx1.sendIdx["="]=1;
  71766. //>>excludeEnd("ctx");
  71767. self._assert_($1);
  71768. $5=(3).__at((5));
  71769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71770. $ctx1.sendIdx["@"]=3;
  71771. //>>excludeEnd("ctx");
  71772. $4=_st($5).__eq((3).__at((6)));
  71773. self._deny_($4);
  71774. return self;
  71775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71776. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)});
  71777. //>>excludeEnd("ctx");
  71778. },
  71779. //>>excludeStart("ide", pragmas.excludeIdeData);
  71780. args: [],
  71781. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  71782. referencedClasses: [],
  71783. //>>excludeEnd("ide");
  71784. messageSends: ["assert:", "=", "@", "deny:"]
  71785. }),
  71786. globals.PointTest);
  71787. smalltalk.addMethod(
  71788. smalltalk.method({
  71789. selector: "testNew",
  71790. protocol: 'tests',
  71791. fn: function (){
  71792. var self=this;
  71793. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  71794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71795. return smalltalk.withContext(function($ctx1) {
  71796. //>>excludeEnd("ctx");
  71797. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  71798. $3=_st($Point())._new();
  71799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71800. $ctx1.sendIdx["new"]=1;
  71801. //>>excludeEnd("ctx");
  71802. $2=_st($3)._x_((3));
  71803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71804. $ctx1.sendIdx["x:"]=1;
  71805. //>>excludeEnd("ctx");
  71806. $1=_st($2)._y();
  71807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71808. $ctx1.sendIdx["y"]=1;
  71809. //>>excludeEnd("ctx");
  71810. self._assert_equals_($1,nil);
  71811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71812. $ctx1.sendIdx["assert:equals:"]=1;
  71813. //>>excludeEnd("ctx");
  71814. $7=_st($Point())._new();
  71815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71816. $ctx1.sendIdx["new"]=2;
  71817. //>>excludeEnd("ctx");
  71818. $6=_st($7)._x_((3));
  71819. $5=_st($6)._x();
  71820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71821. $ctx1.sendIdx["x"]=1;
  71822. //>>excludeEnd("ctx");
  71823. $4=_st($5).__eq((0));
  71824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71825. $ctx1.sendIdx["="]=1;
  71826. //>>excludeEnd("ctx");
  71827. self._deny_($4);
  71828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71829. $ctx1.sendIdx["deny:"]=1;
  71830. //>>excludeEnd("ctx");
  71831. $10=_st($Point())._new();
  71832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71833. $ctx1.sendIdx["new"]=3;
  71834. //>>excludeEnd("ctx");
  71835. $9=_st($10)._y_((4));
  71836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71837. $ctx1.sendIdx["y:"]=1;
  71838. //>>excludeEnd("ctx");
  71839. $8=_st($9)._x();
  71840. self._assert_equals_($8,nil);
  71841. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  71842. return self;
  71843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71844. }, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)});
  71845. //>>excludeEnd("ctx");
  71846. },
  71847. //>>excludeStart("ide", pragmas.excludeIdeData);
  71848. args: [],
  71849. 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",
  71850. referencedClasses: ["Point"],
  71851. //>>excludeEnd("ide");
  71852. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  71853. }),
  71854. globals.PointTest);
  71855. smalltalk.addMethod(
  71856. smalltalk.method({
  71857. selector: "testTranslateBy",
  71858. protocol: 'tests',
  71859. fn: function (){
  71860. var self=this;
  71861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71862. return smalltalk.withContext(function($ctx1) {
  71863. //>>excludeEnd("ctx");
  71864. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  71865. $2=(3).__at((3));
  71866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71867. $ctx1.sendIdx["@"]=1;
  71868. //>>excludeEnd("ctx");
  71869. $3=(0).__at((1));
  71870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71871. $ctx1.sendIdx["@"]=2;
  71872. //>>excludeEnd("ctx");
  71873. $1=_st($2)._translateBy_($3);
  71874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71875. $ctx1.sendIdx["translateBy:"]=1;
  71876. //>>excludeEnd("ctx");
  71877. $4=(3).__at((4));
  71878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71879. $ctx1.sendIdx["@"]=3;
  71880. //>>excludeEnd("ctx");
  71881. self._assert_equals_($1,$4);
  71882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71883. $ctx1.sendIdx["assert:equals:"]=1;
  71884. //>>excludeEnd("ctx");
  71885. $6=(3).__at((3));
  71886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71887. $ctx1.sendIdx["@"]=4;
  71888. //>>excludeEnd("ctx");
  71889. $8=(1)._negated();
  71890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71891. $ctx1.sendIdx["negated"]=1;
  71892. //>>excludeEnd("ctx");
  71893. $7=(0).__at($8);
  71894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71895. $ctx1.sendIdx["@"]=5;
  71896. //>>excludeEnd("ctx");
  71897. $5=_st($6)._translateBy_($7);
  71898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71899. $ctx1.sendIdx["translateBy:"]=2;
  71900. //>>excludeEnd("ctx");
  71901. $9=(3).__at((2));
  71902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71903. $ctx1.sendIdx["@"]=6;
  71904. //>>excludeEnd("ctx");
  71905. self._assert_equals_($5,$9);
  71906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71907. $ctx1.sendIdx["assert:equals:"]=2;
  71908. //>>excludeEnd("ctx");
  71909. $11=(3).__at((3));
  71910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71911. $ctx1.sendIdx["@"]=7;
  71912. //>>excludeEnd("ctx");
  71913. $12=(2).__at((3));
  71914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71915. $ctx1.sendIdx["@"]=8;
  71916. //>>excludeEnd("ctx");
  71917. $10=_st($11)._translateBy_($12);
  71918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71919. $ctx1.sendIdx["translateBy:"]=3;
  71920. //>>excludeEnd("ctx");
  71921. $13=(5).__at((6));
  71922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71923. $ctx1.sendIdx["@"]=9;
  71924. //>>excludeEnd("ctx");
  71925. self._assert_equals_($10,$13);
  71926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71927. $ctx1.sendIdx["assert:equals:"]=3;
  71928. //>>excludeEnd("ctx");
  71929. $15=(3).__at((3));
  71930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71931. $ctx1.sendIdx["@"]=10;
  71932. //>>excludeEnd("ctx");
  71933. $16=_st((3)._negated()).__at((0));
  71934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71935. $ctx1.sendIdx["@"]=11;
  71936. //>>excludeEnd("ctx");
  71937. $14=_st($15)._translateBy_($16);
  71938. self._assert_equals_($14,(0).__at((3)));
  71939. return self;
  71940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71941. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)});
  71942. //>>excludeEnd("ctx");
  71943. },
  71944. //>>excludeStart("ide", pragmas.excludeIdeData);
  71945. args: [],
  71946. 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.",
  71947. referencedClasses: [],
  71948. //>>excludeEnd("ide");
  71949. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  71950. }),
  71951. globals.PointTest);
  71952. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  71953. smalltalk.addMethod(
  71954. smalltalk.method({
  71955. selector: "testNextIfAbsent",
  71956. protocol: 'tests',
  71957. fn: function (){
  71958. var self=this;
  71959. var queue;
  71960. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  71961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71962. return smalltalk.withContext(function($ctx1) {
  71963. //>>excludeEnd("ctx");
  71964. var $2,$1;
  71965. queue=_st($Queue())._new();
  71966. _st(queue)._nextPut_("index1");
  71967. $2=_st(queue)._nextIfAbsent_("empty");
  71968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71969. $ctx1.sendIdx["nextIfAbsent:"]=1;
  71970. //>>excludeEnd("ctx");
  71971. $1=_st($2).__eq("index1");
  71972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71973. $ctx1.sendIdx["="]=1;
  71974. //>>excludeEnd("ctx");
  71975. self._assert_($1);
  71976. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  71977. return self;
  71978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  71979. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)});
  71980. //>>excludeEnd("ctx");
  71981. },
  71982. //>>excludeStart("ide", pragmas.excludeIdeData);
  71983. args: [],
  71984. 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'",
  71985. referencedClasses: ["Queue"],
  71986. //>>excludeEnd("ide");
  71987. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  71988. }),
  71989. globals.QueueTest);
  71990. smalltalk.addMethod(
  71991. smalltalk.method({
  71992. selector: "testQueueNext",
  71993. protocol: 'tests',
  71994. fn: function (){
  71995. var self=this;
  71996. var queue;
  71997. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  71998. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  71999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72000. return smalltalk.withContext(function($ctx1) {
  72001. //>>excludeEnd("ctx");
  72002. var $1,$2,$4,$3,$6,$5;
  72003. queue=_st($Queue())._new();
  72004. $1=queue;
  72005. _st($1)._nextPut_("index1");
  72006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72007. $ctx1.sendIdx["nextPut:"]=1;
  72008. //>>excludeEnd("ctx");
  72009. $2=_st($1)._nextPut_("index2");
  72010. $4=_st(queue)._next();
  72011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72012. $ctx1.sendIdx["next"]=1;
  72013. //>>excludeEnd("ctx");
  72014. $3=_st($4).__eq("index1");
  72015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72016. $ctx1.sendIdx["="]=1;
  72017. //>>excludeEnd("ctx");
  72018. self._assert_($3);
  72019. $6=_st(queue)._next();
  72020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72021. $ctx1.sendIdx["next"]=2;
  72022. //>>excludeEnd("ctx");
  72023. $5=_st($6).__eq("index");
  72024. self._deny_($5);
  72025. self._should_raise_((function(){
  72026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72027. return smalltalk.withContext(function($ctx2) {
  72028. //>>excludeEnd("ctx");
  72029. return _st(queue)._next();
  72030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72032. //>>excludeEnd("ctx");
  72033. }),$Error());
  72034. return self;
  72035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72036. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)});
  72037. //>>excludeEnd("ctx");
  72038. },
  72039. //>>excludeStart("ide", pragmas.excludeIdeData);
  72040. args: [],
  72041. 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",
  72042. referencedClasses: ["Queue", "Error"],
  72043. //>>excludeEnd("ide");
  72044. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  72045. }),
  72046. globals.QueueTest);
  72047. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  72048. smalltalk.addMethod(
  72049. smalltalk.method({
  72050. selector: "testAtRandomNumber",
  72051. protocol: 'tests',
  72052. fn: function (){
  72053. var self=this;
  72054. var val;
  72055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72056. return smalltalk.withContext(function($ctx1) {
  72057. //>>excludeEnd("ctx");
  72058. (100)._timesRepeat_((function(){
  72059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72060. return smalltalk.withContext(function($ctx2) {
  72061. //>>excludeEnd("ctx");
  72062. val=(10)._atRandom();
  72063. val;
  72064. self._assert_(_st(val).__gt((0)));
  72065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72066. $ctx2.sendIdx["assert:"]=1;
  72067. //>>excludeEnd("ctx");
  72068. return self._assert_(_st(val).__lt((11)));
  72069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72071. //>>excludeEnd("ctx");
  72072. }));
  72073. return self;
  72074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72075. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)});
  72076. //>>excludeEnd("ctx");
  72077. },
  72078. //>>excludeStart("ide", pragmas.excludeIdeData);
  72079. args: [],
  72080. 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]",
  72081. referencedClasses: [],
  72082. //>>excludeEnd("ide");
  72083. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  72084. }),
  72085. globals.RandomTest);
  72086. smalltalk.addMethod(
  72087. smalltalk.method({
  72088. selector: "testAtRandomSequenceableCollection",
  72089. protocol: 'tests',
  72090. fn: function (){
  72091. var self=this;
  72092. var val;
  72093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72094. return smalltalk.withContext(function($ctx1) {
  72095. //>>excludeEnd("ctx");
  72096. var $3,$4,$2,$1;
  72097. (100)._timesRepeat_((function(){
  72098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72099. return smalltalk.withContext(function($ctx2) {
  72100. //>>excludeEnd("ctx");
  72101. val="abc"._atRandom();
  72102. val;
  72103. $3=_st(val).__eq("a");
  72104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72105. $ctx2.sendIdx["="]=1;
  72106. //>>excludeEnd("ctx");
  72107. $4=_st(val).__eq("b");
  72108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72109. $ctx2.sendIdx["="]=2;
  72110. //>>excludeEnd("ctx");
  72111. $2=_st($3).__or($4);
  72112. $1=_st($2).__or(_st(val).__eq("c"));
  72113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72114. $ctx2.sendIdx["|"]=1;
  72115. //>>excludeEnd("ctx");
  72116. return self._assert_($1);
  72117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  72119. //>>excludeEnd("ctx");
  72120. }));
  72121. return self;
  72122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72123. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)});
  72124. //>>excludeEnd("ctx");
  72125. },
  72126. //>>excludeStart("ide", pragmas.excludeIdeData);
  72127. args: [],
  72128. 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].",
  72129. referencedClasses: [],
  72130. //>>excludeEnd("ide");
  72131. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  72132. }),
  72133. globals.RandomTest);
  72134. smalltalk.addMethod(
  72135. smalltalk.method({
  72136. selector: "textNext",
  72137. protocol: 'tests',
  72138. fn: function (){
  72139. var self=this;
  72140. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  72141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72142. return smalltalk.withContext(function($ctx1) {
  72143. //>>excludeEnd("ctx");
  72144. var $1;
  72145. (10000)._timesRepeat_((function(){
  72146. var current,next;
  72147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72148. return smalltalk.withContext(function($ctx2) {
  72149. //>>excludeEnd("ctx");
  72150. next=_st(_st($Random())._new())._next();
  72151. next;
  72152. self._assert_(_st(next).__gt_eq((0)));
  72153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72154. $ctx2.sendIdx["assert:"]=1;
  72155. //>>excludeEnd("ctx");
  72156. self._assert_(_st(next).__lt((1)));
  72157. $1=_st(current).__eq(next);
  72158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72159. $ctx2.sendIdx["="]=1;
  72160. //>>excludeEnd("ctx");
  72161. self._deny_($1);
  72162. return _st(next).__eq(current);
  72163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72164. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  72165. //>>excludeEnd("ctx");
  72166. }));
  72167. return self;
  72168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72169. }, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)});
  72170. //>>excludeEnd("ctx");
  72171. },
  72172. //>>excludeStart("ide", pragmas.excludeIdeData);
  72173. args: [],
  72174. 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 ]",
  72175. referencedClasses: ["Random"],
  72176. //>>excludeEnd("ide");
  72177. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  72178. }),
  72179. globals.RandomTest);
  72180. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  72181. smalltalk.addMethod(
  72182. smalltalk.method({
  72183. selector: "collectionClass",
  72184. protocol: 'accessing',
  72185. fn: function (){
  72186. var self=this;
  72187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72188. return smalltalk.withContext(function($ctx1) {
  72189. //>>excludeEnd("ctx");
  72190. var $1;
  72191. $1=_st(self._class())._collectionClass();
  72192. return $1;
  72193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72194. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)});
  72195. //>>excludeEnd("ctx");
  72196. },
  72197. //>>excludeStart("ide", pragmas.excludeIdeData);
  72198. args: [],
  72199. source: "collectionClass\x0a\x09^ self class collectionClass",
  72200. referencedClasses: [],
  72201. //>>excludeEnd("ide");
  72202. messageSends: ["collectionClass", "class"]
  72203. }),
  72204. globals.StreamTest);
  72205. smalltalk.addMethod(
  72206. smalltalk.method({
  72207. selector: "newCollection",
  72208. protocol: 'accessing',
  72209. fn: function (){
  72210. var self=this;
  72211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72212. return smalltalk.withContext(function($ctx1) {
  72213. //>>excludeEnd("ctx");
  72214. var $1;
  72215. $1=_st(self._collectionClass())._new();
  72216. return $1;
  72217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72218. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)});
  72219. //>>excludeEnd("ctx");
  72220. },
  72221. //>>excludeStart("ide", pragmas.excludeIdeData);
  72222. args: [],
  72223. source: "newCollection\x0a\x09^ self collectionClass new",
  72224. referencedClasses: [],
  72225. //>>excludeEnd("ide");
  72226. messageSends: ["new", "collectionClass"]
  72227. }),
  72228. globals.StreamTest);
  72229. smalltalk.addMethod(
  72230. smalltalk.method({
  72231. selector: "newStream",
  72232. protocol: 'accessing',
  72233. fn: function (){
  72234. var self=this;
  72235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72236. return smalltalk.withContext(function($ctx1) {
  72237. //>>excludeEnd("ctx");
  72238. var $1;
  72239. $1=_st(_st(self._collectionClass())._new())._stream();
  72240. return $1;
  72241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72242. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)});
  72243. //>>excludeEnd("ctx");
  72244. },
  72245. //>>excludeStart("ide", pragmas.excludeIdeData);
  72246. args: [],
  72247. source: "newStream\x0a\x09^ self collectionClass new stream",
  72248. referencedClasses: [],
  72249. //>>excludeEnd("ide");
  72250. messageSends: ["stream", "new", "collectionClass"]
  72251. }),
  72252. globals.StreamTest);
  72253. smalltalk.addMethod(
  72254. smalltalk.method({
  72255. selector: "testAtStartAtEnd",
  72256. protocol: 'tests',
  72257. fn: function (){
  72258. var self=this;
  72259. var stream;
  72260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72261. return smalltalk.withContext(function($ctx1) {
  72262. //>>excludeEnd("ctx");
  72263. var $1,$2,$3,$4;
  72264. stream=self._newStream();
  72265. $1=_st(stream)._atStart();
  72266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72267. $ctx1.sendIdx["atStart"]=1;
  72268. //>>excludeEnd("ctx");
  72269. self._assert_($1);
  72270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72271. $ctx1.sendIdx["assert:"]=1;
  72272. //>>excludeEnd("ctx");
  72273. $2=_st(stream)._atEnd();
  72274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72275. $ctx1.sendIdx["atEnd"]=1;
  72276. //>>excludeEnd("ctx");
  72277. self._assert_($2);
  72278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72279. $ctx1.sendIdx["assert:"]=2;
  72280. //>>excludeEnd("ctx");
  72281. _st(stream)._nextPutAll_(self._newCollection());
  72282. $3=_st(stream)._atEnd();
  72283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72284. $ctx1.sendIdx["atEnd"]=2;
  72285. //>>excludeEnd("ctx");
  72286. self._assert_($3);
  72287. $4=_st(stream)._atStart();
  72288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72289. $ctx1.sendIdx["atStart"]=2;
  72290. //>>excludeEnd("ctx");
  72291. self._deny_($4);
  72292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72293. $ctx1.sendIdx["deny:"]=1;
  72294. //>>excludeEnd("ctx");
  72295. _st(stream)._position_((1));
  72296. self._deny_(_st(stream)._atEnd());
  72297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72298. $ctx1.sendIdx["deny:"]=2;
  72299. //>>excludeEnd("ctx");
  72300. self._deny_(_st(stream)._atStart());
  72301. return self;
  72302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72303. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)});
  72304. //>>excludeEnd("ctx");
  72305. },
  72306. //>>excludeStart("ide", pragmas.excludeIdeData);
  72307. args: [],
  72308. 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",
  72309. referencedClasses: [],
  72310. //>>excludeEnd("ide");
  72311. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  72312. }),
  72313. globals.StreamTest);
  72314. smalltalk.addMethod(
  72315. smalltalk.method({
  72316. selector: "testContents",
  72317. protocol: 'tests',
  72318. fn: function (){
  72319. var self=this;
  72320. var stream;
  72321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72322. return smalltalk.withContext(function($ctx1) {
  72323. //>>excludeEnd("ctx");
  72324. var $1,$2;
  72325. stream=self._newStream();
  72326. $1=stream;
  72327. $2=self._newCollection();
  72328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72329. $ctx1.sendIdx["newCollection"]=1;
  72330. //>>excludeEnd("ctx");
  72331. _st($1)._nextPutAll_($2);
  72332. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  72333. return self;
  72334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72335. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)});
  72336. //>>excludeEnd("ctx");
  72337. },
  72338. //>>excludeStart("ide", pragmas.excludeIdeData);
  72339. args: [],
  72340. 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",
  72341. referencedClasses: [],
  72342. //>>excludeEnd("ide");
  72343. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  72344. }),
  72345. globals.StreamTest);
  72346. smalltalk.addMethod(
  72347. smalltalk.method({
  72348. selector: "testIsEmpty",
  72349. protocol: 'tests',
  72350. fn: function (){
  72351. var self=this;
  72352. var stream;
  72353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72354. return smalltalk.withContext(function($ctx1) {
  72355. //>>excludeEnd("ctx");
  72356. var $1;
  72357. stream=self._newStream();
  72358. $1=_st(stream)._isEmpty();
  72359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72360. $ctx1.sendIdx["isEmpty"]=1;
  72361. //>>excludeEnd("ctx");
  72362. self._assert_($1);
  72363. _st(stream)._nextPutAll_(self._newCollection());
  72364. self._deny_(_st(stream)._isEmpty());
  72365. return self;
  72366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72367. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)});
  72368. //>>excludeEnd("ctx");
  72369. },
  72370. //>>excludeStart("ide", pragmas.excludeIdeData);
  72371. args: [],
  72372. 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",
  72373. referencedClasses: [],
  72374. //>>excludeEnd("ide");
  72375. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  72376. }),
  72377. globals.StreamTest);
  72378. smalltalk.addMethod(
  72379. smalltalk.method({
  72380. selector: "testPosition",
  72381. protocol: 'tests',
  72382. fn: function (){
  72383. var self=this;
  72384. var collection,stream;
  72385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72386. return smalltalk.withContext(function($ctx1) {
  72387. //>>excludeEnd("ctx");
  72388. var $1,$2,$3;
  72389. collection=self._newCollection();
  72390. stream=self._newStream();
  72391. _st(stream)._nextPutAll_(collection);
  72392. $1=_st(stream)._position();
  72393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72394. $ctx1.sendIdx["position"]=1;
  72395. //>>excludeEnd("ctx");
  72396. self._assert_equals_($1,_st(collection)._size());
  72397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72398. $ctx1.sendIdx["assert:equals:"]=1;
  72399. //>>excludeEnd("ctx");
  72400. _st(stream)._position_((0));
  72401. $2=_st(stream)._position();
  72402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72403. $ctx1.sendIdx["position"]=2;
  72404. //>>excludeEnd("ctx");
  72405. self._assert_equals_($2,(0));
  72406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72407. $ctx1.sendIdx["assert:equals:"]=2;
  72408. //>>excludeEnd("ctx");
  72409. _st(stream)._next();
  72410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72411. $ctx1.sendIdx["next"]=1;
  72412. //>>excludeEnd("ctx");
  72413. $3=_st(stream)._position();
  72414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72415. $ctx1.sendIdx["position"]=3;
  72416. //>>excludeEnd("ctx");
  72417. self._assert_equals_($3,(1));
  72418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72419. $ctx1.sendIdx["assert:equals:"]=3;
  72420. //>>excludeEnd("ctx");
  72421. _st(stream)._next();
  72422. self._assert_equals_(_st(stream)._position(),(2));
  72423. return self;
  72424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72425. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)});
  72426. //>>excludeEnd("ctx");
  72427. },
  72428. //>>excludeStart("ide", pragmas.excludeIdeData);
  72429. args: [],
  72430. 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",
  72431. referencedClasses: [],
  72432. //>>excludeEnd("ide");
  72433. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  72434. }),
  72435. globals.StreamTest);
  72436. smalltalk.addMethod(
  72437. smalltalk.method({
  72438. selector: "testReading",
  72439. protocol: 'tests',
  72440. fn: function (){
  72441. var self=this;
  72442. var stream,collection;
  72443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72444. return smalltalk.withContext(function($ctx1) {
  72445. //>>excludeEnd("ctx");
  72446. var $1,$2,$3;
  72447. collection=self._newCollection();
  72448. stream=self._newStream();
  72449. $1=stream;
  72450. _st($1)._nextPutAll_(collection);
  72451. $2=_st($1)._position_((0));
  72452. _st(collection)._do_((function(each){
  72453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72454. return smalltalk.withContext(function($ctx2) {
  72455. //>>excludeEnd("ctx");
  72456. $3=_st(stream)._next();
  72457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72458. $ctx2.sendIdx["next"]=1;
  72459. //>>excludeEnd("ctx");
  72460. return self._assert_equals_($3,each);
  72461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72462. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72463. //>>excludeEnd("ctx");
  72464. }));
  72465. self._assert_(_st(_st(stream)._next())._isNil());
  72466. return self;
  72467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72468. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)});
  72469. //>>excludeEnd("ctx");
  72470. },
  72471. //>>excludeStart("ide", pragmas.excludeIdeData);
  72472. args: [],
  72473. 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",
  72474. referencedClasses: [],
  72475. //>>excludeEnd("ide");
  72476. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  72477. }),
  72478. globals.StreamTest);
  72479. smalltalk.addMethod(
  72480. smalltalk.method({
  72481. selector: "testStreamContents",
  72482. protocol: 'tests',
  72483. fn: function (){
  72484. var self=this;
  72485. return self;
  72486. },
  72487. //>>excludeStart("ide", pragmas.excludeIdeData);
  72488. args: [],
  72489. source: "testStreamContents",
  72490. referencedClasses: [],
  72491. //>>excludeEnd("ide");
  72492. messageSends: []
  72493. }),
  72494. globals.StreamTest);
  72495. smalltalk.addMethod(
  72496. smalltalk.method({
  72497. selector: "testWrite",
  72498. protocol: 'tests',
  72499. fn: function (){
  72500. var self=this;
  72501. var stream,collection;
  72502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72503. return smalltalk.withContext(function($ctx1) {
  72504. //>>excludeEnd("ctx");
  72505. collection=self._newCollection();
  72506. stream=self._newStream();
  72507. _st(collection)._do_((function(each){
  72508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72509. return smalltalk.withContext(function($ctx2) {
  72510. //>>excludeEnd("ctx");
  72511. return _st(stream).__lt_lt(each);
  72512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72513. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72514. //>>excludeEnd("ctx");
  72515. }));
  72516. self._assert_equals_(_st(stream)._contents(),collection);
  72517. return self;
  72518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72519. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)});
  72520. //>>excludeEnd("ctx");
  72521. },
  72522. //>>excludeStart("ide", pragmas.excludeIdeData);
  72523. args: [],
  72524. 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",
  72525. referencedClasses: [],
  72526. //>>excludeEnd("ide");
  72527. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  72528. }),
  72529. globals.StreamTest);
  72530. smalltalk.addMethod(
  72531. smalltalk.method({
  72532. selector: "testWriting",
  72533. protocol: 'tests',
  72534. fn: function (){
  72535. var self=this;
  72536. var stream,collection;
  72537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72538. return smalltalk.withContext(function($ctx1) {
  72539. //>>excludeEnd("ctx");
  72540. var $1;
  72541. collection=self._newCollection();
  72542. stream=self._newStream();
  72543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72544. $ctx1.sendIdx["newStream"]=1;
  72545. //>>excludeEnd("ctx");
  72546. _st(collection)._do_((function(each){
  72547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72548. return smalltalk.withContext(function($ctx2) {
  72549. //>>excludeEnd("ctx");
  72550. return _st(stream)._nextPut_(each);
  72551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  72553. //>>excludeEnd("ctx");
  72554. }));
  72555. $1=_st(stream)._contents();
  72556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72557. $ctx1.sendIdx["contents"]=1;
  72558. //>>excludeEnd("ctx");
  72559. self._assert_equals_($1,collection);
  72560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72561. $ctx1.sendIdx["assert:equals:"]=1;
  72562. //>>excludeEnd("ctx");
  72563. stream=self._newStream();
  72564. _st(stream)._nextPutAll_(collection);
  72565. self._assert_equals_(_st(stream)._contents(),collection);
  72566. return self;
  72567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72568. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)});
  72569. //>>excludeEnd("ctx");
  72570. },
  72571. //>>excludeStart("ide", pragmas.excludeIdeData);
  72572. args: [],
  72573. 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",
  72574. referencedClasses: [],
  72575. //>>excludeEnd("ide");
  72576. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  72577. }),
  72578. globals.StreamTest);
  72579. smalltalk.addMethod(
  72580. smalltalk.method({
  72581. selector: "collectionClass",
  72582. protocol: 'accessing',
  72583. fn: function (){
  72584. var self=this;
  72585. return nil;
  72586. },
  72587. //>>excludeStart("ide", pragmas.excludeIdeData);
  72588. args: [],
  72589. source: "collectionClass\x0a\x09^ nil",
  72590. referencedClasses: [],
  72591. //>>excludeEnd("ide");
  72592. messageSends: []
  72593. }),
  72594. globals.StreamTest.klass);
  72595. smalltalk.addMethod(
  72596. smalltalk.method({
  72597. selector: "isAbstract",
  72598. protocol: 'testing',
  72599. fn: function (){
  72600. var self=this;
  72601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72602. return smalltalk.withContext(function($ctx1) {
  72603. //>>excludeEnd("ctx");
  72604. var $1;
  72605. $1=_st(self._collectionClass())._isNil();
  72606. return $1;
  72607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72608. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)});
  72609. //>>excludeEnd("ctx");
  72610. },
  72611. //>>excludeStart("ide", pragmas.excludeIdeData);
  72612. args: [],
  72613. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  72614. referencedClasses: [],
  72615. //>>excludeEnd("ide");
  72616. messageSends: ["isNil", "collectionClass"]
  72617. }),
  72618. globals.StreamTest.klass);
  72619. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  72620. smalltalk.addMethod(
  72621. smalltalk.method({
  72622. selector: "newCollection",
  72623. protocol: 'accessing',
  72624. fn: function (){
  72625. var self=this;
  72626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72627. return smalltalk.withContext(function($ctx1) {
  72628. //>>excludeEnd("ctx");
  72629. var $1;
  72630. $1=[true,(1),(3).__at((4)),"foo"];
  72631. return $1;
  72632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72633. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)});
  72634. //>>excludeEnd("ctx");
  72635. },
  72636. //>>excludeStart("ide", pragmas.excludeIdeData);
  72637. args: [],
  72638. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  72639. referencedClasses: [],
  72640. //>>excludeEnd("ide");
  72641. messageSends: ["@"]
  72642. }),
  72643. globals.ArrayStreamTest);
  72644. smalltalk.addMethod(
  72645. smalltalk.method({
  72646. selector: "collectionClass",
  72647. protocol: 'accessing',
  72648. fn: function (){
  72649. var self=this;
  72650. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  72651. return $Array();
  72652. },
  72653. //>>excludeStart("ide", pragmas.excludeIdeData);
  72654. args: [],
  72655. source: "collectionClass\x0a\x09^ Array",
  72656. referencedClasses: ["Array"],
  72657. //>>excludeEnd("ide");
  72658. messageSends: []
  72659. }),
  72660. globals.ArrayStreamTest.klass);
  72661. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  72662. smalltalk.addMethod(
  72663. smalltalk.method({
  72664. selector: "newCollection",
  72665. protocol: 'accessing',
  72666. fn: function (){
  72667. var self=this;
  72668. return "hello world";
  72669. },
  72670. //>>excludeStart("ide", pragmas.excludeIdeData);
  72671. args: [],
  72672. source: "newCollection\x0a\x09^ 'hello world'",
  72673. referencedClasses: [],
  72674. //>>excludeEnd("ide");
  72675. messageSends: []
  72676. }),
  72677. globals.StringStreamTest);
  72678. smalltalk.addMethod(
  72679. smalltalk.method({
  72680. selector: "collectionClass",
  72681. protocol: 'accessing',
  72682. fn: function (){
  72683. var self=this;
  72684. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  72685. return $String();
  72686. },
  72687. //>>excludeStart("ide", pragmas.excludeIdeData);
  72688. args: [],
  72689. source: "collectionClass\x0a\x09^ String",
  72690. referencedClasses: ["String"],
  72691. //>>excludeEnd("ide");
  72692. messageSends: []
  72693. }),
  72694. globals.StringStreamTest.klass);
  72695. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  72696. smalltalk.addMethod(
  72697. smalltalk.method({
  72698. selector: "testCopying",
  72699. protocol: 'tests',
  72700. fn: function (){
  72701. var self=this;
  72702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72703. return smalltalk.withContext(function($ctx1) {
  72704. //>>excludeEnd("ctx");
  72705. self._assert_equals_(nil._copy(),nil);
  72706. return self;
  72707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72708. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)});
  72709. //>>excludeEnd("ctx");
  72710. },
  72711. //>>excludeStart("ide", pragmas.excludeIdeData);
  72712. args: [],
  72713. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  72714. referencedClasses: [],
  72715. //>>excludeEnd("ide");
  72716. messageSends: ["assert:equals:", "copy"]
  72717. }),
  72718. globals.UndefinedTest);
  72719. smalltalk.addMethod(
  72720. smalltalk.method({
  72721. selector: "testDeepCopy",
  72722. protocol: 'tests',
  72723. fn: function (){
  72724. var self=this;
  72725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72726. return smalltalk.withContext(function($ctx1) {
  72727. //>>excludeEnd("ctx");
  72728. self._assert_(_st(nil._deepCopy()).__eq(nil));
  72729. return self;
  72730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72731. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)});
  72732. //>>excludeEnd("ctx");
  72733. },
  72734. //>>excludeStart("ide", pragmas.excludeIdeData);
  72735. args: [],
  72736. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  72737. referencedClasses: [],
  72738. //>>excludeEnd("ide");
  72739. messageSends: ["assert:", "=", "deepCopy"]
  72740. }),
  72741. globals.UndefinedTest);
  72742. smalltalk.addMethod(
  72743. smalltalk.method({
  72744. selector: "testIfNil",
  72745. protocol: 'tests',
  72746. fn: function (){
  72747. var self=this;
  72748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72749. return smalltalk.withContext(function($ctx1) {
  72750. //>>excludeEnd("ctx");
  72751. var $1,$3,$2,$4,$6,$5,$receiver;
  72752. if(($receiver = nil) == null || $receiver.isNil){
  72753. $1=true;
  72754. } else {
  72755. $1=nil;
  72756. };
  72757. self._assert_equals_($1,true);
  72758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72759. $ctx1.sendIdx["assert:equals:"]=1;
  72760. //>>excludeEnd("ctx");
  72761. if(($receiver = nil) == null || $receiver.isNil){
  72762. $3=nil;
  72763. } else {
  72764. $3=true;
  72765. };
  72766. $2=_st($3).__eq(true);
  72767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72768. $ctx1.sendIdx["="]=1;
  72769. //>>excludeEnd("ctx");
  72770. self._deny_($2);
  72771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72772. $ctx1.sendIdx["deny:"]=1;
  72773. //>>excludeEnd("ctx");
  72774. if(($receiver = nil) == null || $receiver.isNil){
  72775. $4=true;
  72776. } else {
  72777. $4=false;
  72778. };
  72779. self._assert_equals_($4,true);
  72780. if(($receiver = nil) == null || $receiver.isNil){
  72781. $6=false;
  72782. } else {
  72783. $6=true;
  72784. };
  72785. $5=_st($6).__eq(true);
  72786. self._deny_($5);
  72787. return self;
  72788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72789. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)});
  72790. //>>excludeEnd("ctx");
  72791. },
  72792. //>>excludeStart("ide", pragmas.excludeIdeData);
  72793. args: [],
  72794. 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",
  72795. referencedClasses: [],
  72796. //>>excludeEnd("ide");
  72797. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  72798. }),
  72799. globals.UndefinedTest);
  72800. smalltalk.addMethod(
  72801. smalltalk.method({
  72802. selector: "testIsNil",
  72803. protocol: 'tests',
  72804. fn: function (){
  72805. var self=this;
  72806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72807. return smalltalk.withContext(function($ctx1) {
  72808. //>>excludeEnd("ctx");
  72809. self._assert_(nil._isNil());
  72810. self._deny_(nil._notNil());
  72811. return self;
  72812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72813. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)});
  72814. //>>excludeEnd("ctx");
  72815. },
  72816. //>>excludeStart("ide", pragmas.excludeIdeData);
  72817. args: [],
  72818. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  72819. referencedClasses: [],
  72820. //>>excludeEnd("ide");
  72821. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  72822. }),
  72823. globals.UndefinedTest);
  72824. });
  72825. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  72826. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  72827. smalltalk.addPackage('Compiler-Tests');
  72828. smalltalk.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  72829. smalltalk.addClass('ASTParsingTest', globals.TestCase, [], 'Compiler-Tests');
  72830. smalltalk.addMethod(
  72831. smalltalk.method({
  72832. selector: "analyze:forClass:",
  72833. protocol: 'convenience',
  72834. fn: function (aNode,aClass){
  72835. var self=this;
  72836. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  72837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72838. return smalltalk.withContext(function($ctx1) {
  72839. //>>excludeEnd("ctx");
  72840. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  72841. return aNode;
  72842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72843. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTParsingTest)});
  72844. //>>excludeEnd("ctx");
  72845. },
  72846. //>>excludeStart("ide", pragmas.excludeIdeData);
  72847. args: ["aNode", "aClass"],
  72848. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  72849. referencedClasses: ["SemanticAnalyzer"],
  72850. //>>excludeEnd("ide");
  72851. messageSends: ["visit:", "on:"]
  72852. }),
  72853. globals.ASTParsingTest);
  72854. smalltalk.addMethod(
  72855. smalltalk.method({
  72856. selector: "parse:",
  72857. protocol: 'parsing',
  72858. fn: function (aString){
  72859. var self=this;
  72860. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  72861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72862. return smalltalk.withContext(function($ctx1) {
  72863. //>>excludeEnd("ctx");
  72864. var $1;
  72865. $1=_st($Smalltalk())._parse_(aString);
  72866. return $1;
  72867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72868. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTParsingTest)});
  72869. //>>excludeEnd("ctx");
  72870. },
  72871. //>>excludeStart("ide", pragmas.excludeIdeData);
  72872. args: ["aString"],
  72873. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  72874. referencedClasses: ["Smalltalk"],
  72875. //>>excludeEnd("ide");
  72876. messageSends: ["parse:"]
  72877. }),
  72878. globals.ASTParsingTest);
  72879. smalltalk.addMethod(
  72880. smalltalk.method({
  72881. selector: "parse:forClass:",
  72882. protocol: 'parsing',
  72883. fn: function (aString,aClass){
  72884. var self=this;
  72885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72886. return smalltalk.withContext(function($ctx1) {
  72887. //>>excludeEnd("ctx");
  72888. var $1;
  72889. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  72890. return $1;
  72891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72892. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTParsingTest)});
  72893. //>>excludeEnd("ctx");
  72894. },
  72895. //>>excludeStart("ide", pragmas.excludeIdeData);
  72896. args: ["aString", "aClass"],
  72897. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  72898. referencedClasses: [],
  72899. //>>excludeEnd("ide");
  72900. messageSends: ["analyze:forClass:", "parse:"]
  72901. }),
  72902. globals.ASTParsingTest);
  72903. smalltalk.addClass('ASTPCNodeVisitorTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  72904. smalltalk.addMethod(
  72905. smalltalk.method({
  72906. selector: "astPCNodeVisitor",
  72907. protocol: 'factory',
  72908. fn: function (){
  72909. var self=this;
  72910. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  72911. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  72912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72913. return smalltalk.withContext(function($ctx1) {
  72914. //>>excludeEnd("ctx");
  72915. var $2,$3,$4,$5,$1;
  72916. $2=_st($ASTPCNodeVisitor())._new();
  72917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72918. $ctx1.sendIdx["new"]=1;
  72919. //>>excludeEnd("ctx");
  72920. $3=$2;
  72921. $4=_st(_st($AIContext())._new())._yourself();
  72922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72923. $ctx1.sendIdx["yourself"]=1;
  72924. //>>excludeEnd("ctx");
  72925. _st($3)._context_($4);
  72926. $5=_st($2)._yourself();
  72927. $1=$5;
  72928. return $1;
  72929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72930. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},globals.ASTPCNodeVisitorTest)});
  72931. //>>excludeEnd("ctx");
  72932. },
  72933. //>>excludeStart("ide", pragmas.excludeIdeData);
  72934. args: [],
  72935. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  72936. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  72937. //>>excludeEnd("ide");
  72938. messageSends: ["context:", "new", "yourself"]
  72939. }),
  72940. globals.ASTPCNodeVisitorTest);
  72941. smalltalk.addMethod(
  72942. smalltalk.method({
  72943. selector: "astPCNodeVisitorForSelector:",
  72944. protocol: 'factory',
  72945. fn: function (aString){
  72946. var self=this;
  72947. function $ASTPCNodeVisitor(){return globals.ASTPCNodeVisitor||(typeof ASTPCNodeVisitor=="undefined"?nil:ASTPCNodeVisitor)}
  72948. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  72949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72950. return smalltalk.withContext(function($ctx1) {
  72951. //>>excludeEnd("ctx");
  72952. var $2,$3,$4,$5,$1;
  72953. $2=_st($ASTPCNodeVisitor())._new();
  72954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72955. $ctx1.sendIdx["new"]=1;
  72956. //>>excludeEnd("ctx");
  72957. _st($2)._selector_(aString);
  72958. $3=$2;
  72959. $4=_st(_st($AIContext())._new())._yourself();
  72960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72961. $ctx1.sendIdx["yourself"]=1;
  72962. //>>excludeEnd("ctx");
  72963. _st($3)._context_($4);
  72964. $5=_st($2)._yourself();
  72965. $1=$5;
  72966. return $1;
  72967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72968. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},globals.ASTPCNodeVisitorTest)});
  72969. //>>excludeEnd("ctx");
  72970. },
  72971. //>>excludeStart("ide", pragmas.excludeIdeData);
  72972. args: ["aString"],
  72973. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  72974. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  72975. //>>excludeEnd("ide");
  72976. messageSends: ["selector:", "new", "context:", "yourself"]
  72977. }),
  72978. globals.ASTPCNodeVisitorTest);
  72979. smalltalk.addMethod(
  72980. smalltalk.method({
  72981. selector: "testJSStatementNode",
  72982. protocol: 'tests',
  72983. fn: function (){
  72984. var self=this;
  72985. var ast,visitor;
  72986. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  72987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72988. return smalltalk.withContext(function($ctx1) {
  72989. //>>excludeEnd("ctx");
  72990. var $1,$2;
  72991. ast=self._parse_forClass_("foo <consolee.log(1)>",$Object());
  72992. $1=self._astPCNodeVisitor();
  72993. _st($1)._visit_(ast);
  72994. $2=_st($1)._currentNode();
  72995. self._assert_(_st($2)._isJSStatementNode());
  72996. return self;
  72997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  72998. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)});
  72999. //>>excludeEnd("ctx");
  73000. },
  73001. //>>excludeStart("ide", pragmas.excludeIdeData);
  73002. args: [],
  73003. 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",
  73004. referencedClasses: ["Object"],
  73005. //>>excludeEnd("ide");
  73006. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  73007. }),
  73008. globals.ASTPCNodeVisitorTest);
  73009. smalltalk.addMethod(
  73010. smalltalk.method({
  73011. selector: "testMessageSend",
  73012. protocol: 'tests',
  73013. fn: function (){
  73014. var self=this;
  73015. var ast;
  73016. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73018. return smalltalk.withContext(function($ctx1) {
  73019. //>>excludeEnd("ctx");
  73020. var $1,$2;
  73021. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$Object());
  73022. $1=self._astPCNodeVisitorForSelector_("yourself");
  73023. _st($1)._visit_(ast);
  73024. $2=_st($1)._currentNode();
  73025. self._assert_equals_(_st($2)._selector(),"yourself");
  73026. return self;
  73027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73028. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73029. //>>excludeEnd("ctx");
  73030. },
  73031. //>>excludeStart("ide", pragmas.excludeIdeData);
  73032. args: [],
  73033. 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'",
  73034. referencedClasses: ["Object"],
  73035. //>>excludeEnd("ide");
  73036. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73037. }),
  73038. globals.ASTPCNodeVisitorTest);
  73039. smalltalk.addMethod(
  73040. smalltalk.method({
  73041. selector: "testMessageSendWithBlocks",
  73042. protocol: 'tests',
  73043. fn: function (){
  73044. var self=this;
  73045. var ast;
  73046. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73048. return smalltalk.withContext(function($ctx1) {
  73049. //>>excludeEnd("ctx");
  73050. var $1,$2;
  73051. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$Object());
  73052. $1=self._astPCNodeVisitorForSelector_("yourself");
  73053. _st($1)._visit_(ast);
  73054. $2=_st($1)._currentNode();
  73055. self._assert_equals_(_st($2)._selector(),"yourself");
  73056. return self;
  73057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73058. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73059. //>>excludeEnd("ctx");
  73060. },
  73061. //>>excludeStart("ide", pragmas.excludeIdeData);
  73062. args: [],
  73063. 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'",
  73064. referencedClasses: ["Object"],
  73065. //>>excludeEnd("ide");
  73066. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73067. }),
  73068. globals.ASTPCNodeVisitorTest);
  73069. smalltalk.addMethod(
  73070. smalltalk.method({
  73071. selector: "testMessageSendWithInlining",
  73072. protocol: 'tests',
  73073. fn: function (){
  73074. var self=this;
  73075. var ast;
  73076. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73078. return smalltalk.withContext(function($ctx1) {
  73079. //>>excludeEnd("ctx");
  73080. var $3,$4,$2,$1,$5,$6;
  73081. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  73082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73083. $ctx1.sendIdx["parse:forClass:"]=1;
  73084. //>>excludeEnd("ctx");
  73085. $3=self._astPCNodeVisitorForSelector_("yourself");
  73086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73087. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  73088. //>>excludeEnd("ctx");
  73089. _st($3)._visit_(ast);
  73090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73091. $ctx1.sendIdx["visit:"]=1;
  73092. //>>excludeEnd("ctx");
  73093. $4=_st($3)._currentNode();
  73094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73095. $ctx1.sendIdx["currentNode"]=1;
  73096. //>>excludeEnd("ctx");
  73097. $2=$4;
  73098. $1=_st($2)._selector();
  73099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73100. $ctx1.sendIdx["selector"]=1;
  73101. //>>excludeEnd("ctx");
  73102. self._assert_equals_($1,"yourself");
  73103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73104. $ctx1.sendIdx["assert:equals:"]=1;
  73105. //>>excludeEnd("ctx");
  73106. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$Object());
  73107. $5=self._astPCNodeVisitorForSelector_("asBoolean");
  73108. _st($5)._visit_(ast);
  73109. $6=_st($5)._currentNode();
  73110. self._assert_equals_(_st($6)._selector(),"asBoolean");
  73111. return self;
  73112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73113. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73114. //>>excludeEnd("ctx");
  73115. },
  73116. //>>excludeStart("ide", pragmas.excludeIdeData);
  73117. args: [],
  73118. 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'",
  73119. referencedClasses: ["Object"],
  73120. //>>excludeEnd("ide");
  73121. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  73122. }),
  73123. globals.ASTPCNodeVisitorTest);
  73124. smalltalk.addMethod(
  73125. smalltalk.method({
  73126. selector: "testNoMessageSend",
  73127. protocol: 'tests',
  73128. fn: function (){
  73129. var self=this;
  73130. var ast;
  73131. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73133. return smalltalk.withContext(function($ctx1) {
  73134. //>>excludeEnd("ctx");
  73135. var $1,$2;
  73136. ast=self._parse_forClass_("foo ^ self",$Object());
  73137. $1=self._astPCNodeVisitor();
  73138. _st($1)._visit_(ast);
  73139. $2=_st($1)._currentNode();
  73140. self._assert_(_st($2)._isNil());
  73141. return self;
  73142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73143. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},globals.ASTPCNodeVisitorTest)});
  73144. //>>excludeEnd("ctx");
  73145. },
  73146. //>>excludeStart("ide", pragmas.excludeIdeData);
  73147. args: [],
  73148. 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",
  73149. referencedClasses: ["Object"],
  73150. //>>excludeEnd("ide");
  73151. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  73152. }),
  73153. globals.ASTPCNodeVisitorTest);
  73154. smalltalk.addMethod(
  73155. smalltalk.method({
  73156. selector: "testPC",
  73157. protocol: 'tests',
  73158. fn: function (){
  73159. var self=this;
  73160. var ast,visitor;
  73161. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  73162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73163. return smalltalk.withContext(function($ctx1) {
  73164. //>>excludeEnd("ctx");
  73165. var $1,$2;
  73166. ast=self._parse_forClass_("foo <console.log(1)>",$Object());
  73167. $1=self._astPCNodeVisitor();
  73168. _st($1)._visit_(ast);
  73169. $2=_st($1)._currentNode();
  73170. self._assert_(_st($2)._isJSStatementNode());
  73171. return self;
  73172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73173. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},globals.ASTPCNodeVisitorTest)});
  73174. //>>excludeEnd("ctx");
  73175. },
  73176. //>>excludeStart("ide", pragmas.excludeIdeData);
  73177. args: [],
  73178. 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",
  73179. referencedClasses: ["Object"],
  73180. //>>excludeEnd("ide");
  73181. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  73182. }),
  73183. globals.ASTPCNodeVisitorTest);
  73184. smalltalk.addClass('ASTPositionTest', globals.ASTParsingTest, [], 'Compiler-Tests');
  73185. smalltalk.addMethod(
  73186. smalltalk.method({
  73187. selector: "testNodeAtPosition",
  73188. protocol: 'tests',
  73189. fn: function (){
  73190. var self=this;
  73191. var node;
  73192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73193. return smalltalk.withContext(function($ctx1) {
  73194. //>>excludeEnd("ctx");
  73195. var $3,$4,$2,$1,$7,$8,$6,$5;
  73196. node=self._parse_("yourself\x0a\x09^ self");
  73197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73198. $ctx1.sendIdx["parse:"]=1;
  73199. //>>excludeEnd("ctx");
  73200. $3=node;
  73201. $4=(2).__at((4));
  73202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73203. $ctx1.sendIdx["@"]=1;
  73204. //>>excludeEnd("ctx");
  73205. $2=_st($3)._navigationNodeAt_ifAbsent_($4,(function(){
  73206. return nil;
  73207. }));
  73208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73209. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  73210. //>>excludeEnd("ctx");
  73211. $1=_st($2)._source();
  73212. self._assert_equals_($1,"self");
  73213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73214. $ctx1.sendIdx["assert:equals:"]=1;
  73215. //>>excludeEnd("ctx");
  73216. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  73217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73218. $ctx1.sendIdx["parse:"]=2;
  73219. //>>excludeEnd("ctx");
  73220. $7=node;
  73221. $8=(2).__at((7));
  73222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73223. $ctx1.sendIdx["@"]=2;
  73224. //>>excludeEnd("ctx");
  73225. $6=_st($7)._navigationNodeAt_ifAbsent_($8,(function(){
  73226. return nil;
  73227. }));
  73228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73229. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  73230. //>>excludeEnd("ctx");
  73231. $5=_st($6)._selector();
  73232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73233. $ctx1.sendIdx["selector"]=1;
  73234. //>>excludeEnd("ctx");
  73235. self._assert_equals_($5,"ifTrue:");
  73236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73237. $ctx1.sendIdx["assert:equals:"]=2;
  73238. //>>excludeEnd("ctx");
  73239. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  73240. self._assert_equals_(_st(_st(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  73241. return nil;
  73242. })))._selector(),"foo");
  73243. return self;
  73244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73245. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},globals.ASTPositionTest)});
  73246. //>>excludeEnd("ctx");
  73247. },
  73248. //>>excludeStart("ide", pragmas.excludeIdeData);
  73249. args: [],
  73250. 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'",
  73251. referencedClasses: [],
  73252. //>>excludeEnd("ide");
  73253. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  73254. }),
  73255. globals.ASTPositionTest);
  73256. smalltalk.addClass('CodeGeneratorTest', globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  73257. smalltalk.addMethod(
  73258. smalltalk.method({
  73259. selector: "codeGeneratorClass",
  73260. protocol: 'accessing',
  73261. fn: function (){
  73262. var self=this;
  73263. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  73264. return $CodeGenerator();
  73265. },
  73266. //>>excludeStart("ide", pragmas.excludeIdeData);
  73267. args: [],
  73268. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  73269. referencedClasses: ["CodeGenerator"],
  73270. //>>excludeEnd("ide");
  73271. messageSends: []
  73272. }),
  73273. globals.CodeGeneratorTest);
  73274. smalltalk.addMethod(
  73275. smalltalk.method({
  73276. selector: "compiler",
  73277. protocol: 'factory',
  73278. fn: function (){
  73279. var self=this;
  73280. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  73281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73282. return smalltalk.withContext(function($ctx1) {
  73283. //>>excludeEnd("ctx");
  73284. var $2,$3,$1;
  73285. $2=_st($Compiler())._new();
  73286. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  73287. $3=_st($2)._yourself();
  73288. $1=$3;
  73289. return $1;
  73290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73291. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.CodeGeneratorTest)});
  73292. //>>excludeEnd("ctx");
  73293. },
  73294. //>>excludeStart("ide", pragmas.excludeIdeData);
  73295. args: [],
  73296. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  73297. referencedClasses: ["Compiler"],
  73298. //>>excludeEnd("ide");
  73299. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  73300. }),
  73301. globals.CodeGeneratorTest);
  73302. smalltalk.addMethod(
  73303. smalltalk.method({
  73304. selector: "setUp",
  73305. protocol: 'initialization',
  73306. fn: function (){
  73307. var self=this;
  73308. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  73309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73310. return smalltalk.withContext(function($ctx1) {
  73311. //>>excludeEnd("ctx");
  73312. self["@receiver"]=_st($DoIt())._new();
  73313. return self;
  73314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73315. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.CodeGeneratorTest)});
  73316. //>>excludeEnd("ctx");
  73317. },
  73318. //>>excludeStart("ide", pragmas.excludeIdeData);
  73319. args: [],
  73320. source: "setUp\x0a\x09receiver := DoIt new",
  73321. referencedClasses: ["DoIt"],
  73322. //>>excludeEnd("ide");
  73323. messageSends: ["new"]
  73324. }),
  73325. globals.CodeGeneratorTest);
  73326. smalltalk.addMethod(
  73327. smalltalk.method({
  73328. selector: "should:receiver:return:",
  73329. protocol: 'testing',
  73330. fn: function (aString,anObject,aResult){
  73331. var self=this;
  73332. var method,result;
  73333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73334. return smalltalk.withContext(function($ctx1) {
  73335. //>>excludeEnd("ctx");
  73336. var $1,$2;
  73337. self["@receiver"]=anObject;
  73338. $1=self._compiler();
  73339. $2=_st(anObject)._class();
  73340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73341. $ctx1.sendIdx["class"]=1;
  73342. //>>excludeEnd("ctx");
  73343. method=_st($1)._install_forClass_protocol_(aString,$2,"tests");
  73344. result=_st(self["@receiver"])._perform_(_st(method)._selector());
  73345. _st(_st(anObject)._class())._removeCompiledMethod_(method);
  73346. self._assert_equals_(aResult,result);
  73347. return self;
  73348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73349. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},globals.CodeGeneratorTest)});
  73350. //>>excludeEnd("ctx");
  73351. },
  73352. //>>excludeStart("ide", pragmas.excludeIdeData);
  73353. args: ["aString", "anObject", "aResult"],
  73354. 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",
  73355. referencedClasses: [],
  73356. //>>excludeEnd("ide");
  73357. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  73358. }),
  73359. globals.CodeGeneratorTest);
  73360. smalltalk.addMethod(
  73361. smalltalk.method({
  73362. selector: "should:return:",
  73363. protocol: 'testing',
  73364. fn: function (aString,anObject){
  73365. var self=this;
  73366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73367. return smalltalk.withContext(function($ctx1) {
  73368. //>>excludeEnd("ctx");
  73369. var $1;
  73370. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  73371. return $1;
  73372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73373. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.CodeGeneratorTest)});
  73374. //>>excludeEnd("ctx");
  73375. },
  73376. //>>excludeStart("ide", pragmas.excludeIdeData);
  73377. args: ["aString", "anObject"],
  73378. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  73379. referencedClasses: [],
  73380. //>>excludeEnd("ide");
  73381. messageSends: ["should:receiver:return:"]
  73382. }),
  73383. globals.CodeGeneratorTest);
  73384. smalltalk.addMethod(
  73385. smalltalk.method({
  73386. selector: "tearDown",
  73387. protocol: 'initialization',
  73388. fn: function (){
  73389. var self=this;
  73390. return self;
  73391. },
  73392. //>>excludeStart("ide", pragmas.excludeIdeData);
  73393. args: [],
  73394. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  73395. referencedClasses: [],
  73396. //>>excludeEnd("ide");
  73397. messageSends: []
  73398. }),
  73399. globals.CodeGeneratorTest);
  73400. smalltalk.addMethod(
  73401. smalltalk.method({
  73402. selector: "testAssignment",
  73403. protocol: 'tests',
  73404. fn: function (){
  73405. var self=this;
  73406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73407. return smalltalk.withContext(function($ctx1) {
  73408. //>>excludeEnd("ctx");
  73409. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  73410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73411. $ctx1.sendIdx["should:return:"]=1;
  73412. //>>excludeEnd("ctx");
  73413. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  73414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73415. $ctx1.sendIdx["should:return:"]=2;
  73416. //>>excludeEnd("ctx");
  73417. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  73418. return self;
  73419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73420. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},globals.CodeGeneratorTest)});
  73421. //>>excludeEnd("ctx");
  73422. },
  73423. //>>excludeStart("ide", pragmas.excludeIdeData);
  73424. args: [],
  73425. 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",
  73426. referencedClasses: [],
  73427. //>>excludeEnd("ide");
  73428. messageSends: ["should:return:"]
  73429. }),
  73430. globals.CodeGeneratorTest);
  73431. smalltalk.addMethod(
  73432. smalltalk.method({
  73433. selector: "testBackslashSelectors",
  73434. protocol: 'tests',
  73435. fn: function (){
  73436. var self=this;
  73437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73438. return smalltalk.withContext(function($ctx1) {
  73439. //>>excludeEnd("ctx");
  73440. self._should_return_("\x5c arg ^ 4",(4));
  73441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73442. $ctx1.sendIdx["should:return:"]=1;
  73443. //>>excludeEnd("ctx");
  73444. self._should_return_("\x5c\x5c arg ^ 42",(42));
  73445. return self;
  73446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73447. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},globals.CodeGeneratorTest)});
  73448. //>>excludeEnd("ctx");
  73449. },
  73450. //>>excludeStart("ide", pragmas.excludeIdeData);
  73451. args: [],
  73452. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  73453. referencedClasses: [],
  73454. //>>excludeEnd("ide");
  73455. messageSends: ["should:return:"]
  73456. }),
  73457. globals.CodeGeneratorTest);
  73458. smalltalk.addMethod(
  73459. smalltalk.method({
  73460. selector: "testBlockReturn",
  73461. protocol: 'tests',
  73462. fn: function (){
  73463. var self=this;
  73464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73465. return smalltalk.withContext(function($ctx1) {
  73466. //>>excludeEnd("ctx");
  73467. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  73468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73469. $ctx1.sendIdx["should:return:"]=1;
  73470. //>>excludeEnd("ctx");
  73471. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  73472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73473. $ctx1.sendIdx["should:return:"]=2;
  73474. //>>excludeEnd("ctx");
  73475. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  73476. return self;
  73477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73478. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},globals.CodeGeneratorTest)});
  73479. //>>excludeEnd("ctx");
  73480. },
  73481. //>>excludeStart("ide", pragmas.excludeIdeData);
  73482. args: [],
  73483. 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).",
  73484. referencedClasses: [],
  73485. //>>excludeEnd("ide");
  73486. messageSends: ["should:return:"]
  73487. }),
  73488. globals.CodeGeneratorTest);
  73489. smalltalk.addMethod(
  73490. smalltalk.method({
  73491. selector: "testCascades",
  73492. protocol: 'tests',
  73493. fn: function (){
  73494. var self=this;
  73495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73496. return smalltalk.withContext(function($ctx1) {
  73497. //>>excludeEnd("ctx");
  73498. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  73499. return self;
  73500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73501. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},globals.CodeGeneratorTest)});
  73502. //>>excludeEnd("ctx");
  73503. },
  73504. //>>excludeStart("ide", pragmas.excludeIdeData);
  73505. args: [],
  73506. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  73507. referencedClasses: [],
  73508. //>>excludeEnd("ide");
  73509. messageSends: ["should:return:"]
  73510. }),
  73511. globals.CodeGeneratorTest);
  73512. smalltalk.addMethod(
  73513. smalltalk.method({
  73514. selector: "testCascadesWithInlining",
  73515. protocol: 'tests',
  73516. fn: function (){
  73517. var self=this;
  73518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73519. return smalltalk.withContext(function($ctx1) {
  73520. //>>excludeEnd("ctx");
  73521. self._should_return_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  73522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73523. $ctx1.sendIdx["should:return:"]=1;
  73524. //>>excludeEnd("ctx");
  73525. self._should_return_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  73526. return self;
  73527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73528. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},globals.CodeGeneratorTest)});
  73529. //>>excludeEnd("ctx");
  73530. },
  73531. //>>excludeStart("ide", pragmas.excludeIdeData);
  73532. args: [],
  73533. 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",
  73534. referencedClasses: [],
  73535. //>>excludeEnd("ide");
  73536. messageSends: ["should:return:"]
  73537. }),
  73538. globals.CodeGeneratorTest);
  73539. smalltalk.addMethod(
  73540. smalltalk.method({
  73541. selector: "testDynamicArrayElementsOrdered",
  73542. protocol: 'tests',
  73543. fn: function (){
  73544. var self=this;
  73545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73546. return smalltalk.withContext(function($ctx1) {
  73547. //>>excludeEnd("ctx");
  73548. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  73549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73550. $ctx1.sendIdx["should:return:"]=1;
  73551. //>>excludeEnd("ctx");
  73552. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  73553. return self;
  73554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73555. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},globals.CodeGeneratorTest)});
  73556. //>>excludeEnd("ctx");
  73557. },
  73558. //>>excludeStart("ide", pragmas.excludeIdeData);
  73559. args: [],
  73560. 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).",
  73561. referencedClasses: [],
  73562. //>>excludeEnd("ide");
  73563. messageSends: ["should:return:"]
  73564. }),
  73565. globals.CodeGeneratorTest);
  73566. smalltalk.addMethod(
  73567. smalltalk.method({
  73568. selector: "testDynamicDictionaryElementsOrdered",
  73569. protocol: 'tests',
  73570. fn: function (){
  73571. var self=this;
  73572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73573. return smalltalk.withContext(function($ctx1) {
  73574. //>>excludeEnd("ctx");
  73575. 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)]));
  73576. return self;
  73577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73578. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},globals.CodeGeneratorTest)});
  73579. //>>excludeEnd("ctx");
  73580. },
  73581. //>>excludeStart("ide", pragmas.excludeIdeData);
  73582. args: [],
  73583. 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}.",
  73584. referencedClasses: [],
  73585. //>>excludeEnd("ide");
  73586. messageSends: ["should:return:"]
  73587. }),
  73588. globals.CodeGeneratorTest);
  73589. smalltalk.addMethod(
  73590. smalltalk.method({
  73591. selector: "testDynamicDictionaryWithMoreArrows",
  73592. protocol: 'tests',
  73593. fn: function (){
  73594. var self=this;
  73595. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  73596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73597. return smalltalk.withContext(function($ctx1) {
  73598. //>>excludeEnd("ctx");
  73599. var $2,$1;
  73600. $2=_st((1).__minus_gt((2))).__minus_gt((3));
  73601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73602. $ctx1.sendIdx["->"]=1;
  73603. //>>excludeEnd("ctx");
  73604. $1=_st($HashedCollection())._with_($2);
  73605. self._should_return_("foo ^ #{1->2->3}",$1);
  73606. return self;
  73607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73608. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)});
  73609. //>>excludeEnd("ctx");
  73610. },
  73611. //>>excludeStart("ide", pragmas.excludeIdeData);
  73612. args: [],
  73613. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  73614. referencedClasses: ["HashedCollection"],
  73615. //>>excludeEnd("ide");
  73616. messageSends: ["should:return:", "with:", "->"]
  73617. }),
  73618. globals.CodeGeneratorTest);
  73619. smalltalk.addMethod(
  73620. smalltalk.method({
  73621. selector: "testGlobalVar",
  73622. protocol: 'tests',
  73623. fn: function (){
  73624. var self=this;
  73625. function $BlockClosure(){return globals.BlockClosure||(typeof BlockClosure=="undefined"?nil:BlockClosure)}
  73626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73627. return smalltalk.withContext(function($ctx1) {
  73628. //>>excludeEnd("ctx");
  73629. self._should_return_("foo ^ eval class",$BlockClosure());
  73630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73631. $ctx1.sendIdx["should:return:"]=1;
  73632. //>>excludeEnd("ctx");
  73633. self._should_return_("foo ^ Math cos: 0",(1));
  73634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73635. $ctx1.sendIdx["should:return:"]=2;
  73636. //>>excludeEnd("ctx");
  73637. self._should_return_("foo ^ NonExistingVar",nil);
  73638. return self;
  73639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73640. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},globals.CodeGeneratorTest)});
  73641. //>>excludeEnd("ctx");
  73642. },
  73643. //>>excludeStart("ide", pragmas.excludeIdeData);
  73644. args: [],
  73645. 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",
  73646. referencedClasses: ["BlockClosure"],
  73647. //>>excludeEnd("ide");
  73648. messageSends: ["should:return:"]
  73649. }),
  73650. globals.CodeGeneratorTest);
  73651. smalltalk.addMethod(
  73652. smalltalk.method({
  73653. selector: "testInnerTemporalDependentElementsOrdered",
  73654. protocol: 'tests',
  73655. fn: function (){
  73656. var self=this;
  73657. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  73658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73659. return smalltalk.withContext(function($ctx1) {
  73660. //>>excludeEnd("ctx");
  73661. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  73662. $2="foo".__minus_gt($Array());
  73663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73664. $ctx1.sendIdx["->"]=1;
  73665. //>>excludeEnd("ctx");
  73666. $3="bar".__minus_gt((2));
  73667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73668. $ctx1.sendIdx["->"]=2;
  73669. //>>excludeEnd("ctx");
  73670. $1=[$2,$3];
  73671. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  73672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73673. $ctx1.sendIdx["should:return:"]=1;
  73674. //>>excludeEnd("ctx");
  73675. $5="foo".__minus_gt($Array());
  73676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73677. $ctx1.sendIdx["->"]=3;
  73678. //>>excludeEnd("ctx");
  73679. $6="bar".__minus_gt((2));
  73680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73681. $ctx1.sendIdx["->"]=4;
  73682. //>>excludeEnd("ctx");
  73683. $4=[$5,$6];
  73684. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  73685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73686. $ctx1.sendIdx["should:return:"]=2;
  73687. //>>excludeEnd("ctx");
  73688. $8="foo".__minus_gt((1));
  73689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73690. $ctx1.sendIdx["->"]=5;
  73691. //>>excludeEnd("ctx");
  73692. $9="bar".__minus_gt((2));
  73693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73694. $ctx1.sendIdx["->"]=6;
  73695. //>>excludeEnd("ctx");
  73696. $7=[$8,$9];
  73697. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  73698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73699. $ctx1.sendIdx["should:return:"]=3;
  73700. //>>excludeEnd("ctx");
  73701. $11="foo".__minus_gt((1));
  73702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73703. $ctx1.sendIdx["->"]=7;
  73704. //>>excludeEnd("ctx");
  73705. $10=[$11,"bar".__minus_gt((2))];
  73706. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  73707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73708. $ctx1.sendIdx["should:return:"]=4;
  73709. //>>excludeEnd("ctx");
  73710. 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)]));
  73711. return self;
  73712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73713. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},globals.CodeGeneratorTest)});
  73714. //>>excludeEnd("ctx");
  73715. },
  73716. //>>excludeStart("ide", pragmas.excludeIdeData);
  73717. args: [],
  73718. 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}.",
  73719. referencedClasses: ["Array"],
  73720. //>>excludeEnd("ide");
  73721. messageSends: ["should:return:", "->"]
  73722. }),
  73723. globals.CodeGeneratorTest);
  73724. smalltalk.addMethod(
  73725. smalltalk.method({
  73726. selector: "testJSStatement",
  73727. protocol: 'tests',
  73728. fn: function (){
  73729. var self=this;
  73730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73731. return smalltalk.withContext(function($ctx1) {
  73732. //>>excludeEnd("ctx");
  73733. self._should_return_("foo <return 2+3>",(5));
  73734. return self;
  73735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73736. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},globals.CodeGeneratorTest)});
  73737. //>>excludeEnd("ctx");
  73738. },
  73739. //>>excludeStart("ide", pragmas.excludeIdeData);
  73740. args: [],
  73741. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  73742. referencedClasses: [],
  73743. //>>excludeEnd("ide");
  73744. messageSends: ["should:return:"]
  73745. }),
  73746. globals.CodeGeneratorTest);
  73747. smalltalk.addMethod(
  73748. smalltalk.method({
  73749. selector: "testLexicalScope",
  73750. protocol: 'tests',
  73751. fn: function (){
  73752. var self=this;
  73753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73754. return smalltalk.withContext(function($ctx1) {
  73755. //>>excludeEnd("ctx");
  73756. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  73757. return self;
  73758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73759. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},globals.CodeGeneratorTest)});
  73760. //>>excludeEnd("ctx");
  73761. },
  73762. //>>excludeStart("ide", pragmas.excludeIdeData);
  73763. args: [],
  73764. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  73765. referencedClasses: [],
  73766. //>>excludeEnd("ide");
  73767. messageSends: ["should:return:"]
  73768. }),
  73769. globals.CodeGeneratorTest);
  73770. smalltalk.addMethod(
  73771. smalltalk.method({
  73772. selector: "testLiterals",
  73773. protocol: 'tests',
  73774. fn: function (){
  73775. var self=this;
  73776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73777. return smalltalk.withContext(function($ctx1) {
  73778. //>>excludeEnd("ctx");
  73779. self._should_return_("foo ^ 1",(1));
  73780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73781. $ctx1.sendIdx["should:return:"]=1;
  73782. //>>excludeEnd("ctx");
  73783. self._should_return_("foo ^ 'hello'","hello");
  73784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73785. $ctx1.sendIdx["should:return:"]=2;
  73786. //>>excludeEnd("ctx");
  73787. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  73788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73789. $ctx1.sendIdx["should:return:"]=3;
  73790. //>>excludeEnd("ctx");
  73791. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  73792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73793. $ctx1.sendIdx["should:return:"]=4;
  73794. //>>excludeEnd("ctx");
  73795. self._should_return_("foo ^ true",true);
  73796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73797. $ctx1.sendIdx["should:return:"]=5;
  73798. //>>excludeEnd("ctx");
  73799. self._should_return_("foo ^ false",false);
  73800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73801. $ctx1.sendIdx["should:return:"]=6;
  73802. //>>excludeEnd("ctx");
  73803. self._should_return_("foo ^ #{1->2. 3->4}",globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  73804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73805. $ctx1.sendIdx["should:return:"]=7;
  73806. //>>excludeEnd("ctx");
  73807. self._should_return_("foo ^ #hello","hello");
  73808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73809. $ctx1.sendIdx["should:return:"]=8;
  73810. //>>excludeEnd("ctx");
  73811. self._should_return_("foo ^ $h","h");
  73812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73813. $ctx1.sendIdx["should:return:"]=9;
  73814. //>>excludeEnd("ctx");
  73815. self._should_return_("foo ^ -123.456",(-123.456));
  73816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73817. $ctx1.sendIdx["should:return:"]=10;
  73818. //>>excludeEnd("ctx");
  73819. self._should_return_("foo ^ -2.5e4",(-25000));
  73820. return self;
  73821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73822. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},globals.CodeGeneratorTest)});
  73823. //>>excludeEnd("ctx");
  73824. },
  73825. //>>excludeStart("ide", pragmas.excludeIdeData);
  73826. args: [],
  73827. 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.",
  73828. referencedClasses: [],
  73829. //>>excludeEnd("ide");
  73830. messageSends: ["should:return:"]
  73831. }),
  73832. globals.CodeGeneratorTest);
  73833. smalltalk.addMethod(
  73834. smalltalk.method({
  73835. selector: "testLocalReturn",
  73836. protocol: 'tests',
  73837. fn: function (){
  73838. var self=this;
  73839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73840. return smalltalk.withContext(function($ctx1) {
  73841. //>>excludeEnd("ctx");
  73842. self._should_return_("foo ^ 1",(1));
  73843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73844. $ctx1.sendIdx["should:return:"]=1;
  73845. //>>excludeEnd("ctx");
  73846. self._should_return_("foo ^ 1 + 1",(2));
  73847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73848. $ctx1.sendIdx["should:return:"]=2;
  73849. //>>excludeEnd("ctx");
  73850. self._should_return_("foo ",self["@receiver"]);
  73851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73852. $ctx1.sendIdx["should:return:"]=3;
  73853. //>>excludeEnd("ctx");
  73854. self._should_return_("foo self asString",self["@receiver"]);
  73855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73856. $ctx1.sendIdx["should:return:"]=4;
  73857. //>>excludeEnd("ctx");
  73858. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  73859. return self;
  73860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73861. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},globals.CodeGeneratorTest)});
  73862. //>>excludeEnd("ctx");
  73863. },
  73864. //>>excludeStart("ide", pragmas.excludeIdeData);
  73865. args: [],
  73866. 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",
  73867. referencedClasses: [],
  73868. //>>excludeEnd("ide");
  73869. messageSends: ["should:return:"]
  73870. }),
  73871. globals.CodeGeneratorTest);
  73872. smalltalk.addMethod(
  73873. smalltalk.method({
  73874. selector: "testMessageSends",
  73875. protocol: 'tests',
  73876. fn: function (){
  73877. var self=this;
  73878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73879. return smalltalk.withContext(function($ctx1) {
  73880. //>>excludeEnd("ctx");
  73881. self._should_return_("foo ^ 1 asString","1");
  73882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73883. $ctx1.sendIdx["should:return:"]=1;
  73884. //>>excludeEnd("ctx");
  73885. self._should_return_("foo ^ 1 + 1",(2));
  73886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73887. $ctx1.sendIdx["should:return:"]=2;
  73888. //>>excludeEnd("ctx");
  73889. self._should_return_("foo ^ 1 + 2 * 3",(9));
  73890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73891. $ctx1.sendIdx["should:return:"]=3;
  73892. //>>excludeEnd("ctx");
  73893. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  73894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73895. $ctx1.sendIdx["should:return:"]=4;
  73896. //>>excludeEnd("ctx");
  73897. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  73898. return self;
  73899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73900. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},globals.CodeGeneratorTest)});
  73901. //>>excludeEnd("ctx");
  73902. },
  73903. //>>excludeStart("ide", pragmas.excludeIdeData);
  73904. args: [],
  73905. 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)",
  73906. referencedClasses: [],
  73907. //>>excludeEnd("ide");
  73908. messageSends: ["should:return:"]
  73909. }),
  73910. globals.CodeGeneratorTest);
  73911. smalltalk.addMethod(
  73912. smalltalk.method({
  73913. selector: "testMultipleSequences",
  73914. protocol: 'tests',
  73915. fn: function (){
  73916. var self=this;
  73917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73918. return smalltalk.withContext(function($ctx1) {
  73919. //>>excludeEnd("ctx");
  73920. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  73921. return self;
  73922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73923. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},globals.CodeGeneratorTest)});
  73924. //>>excludeEnd("ctx");
  73925. },
  73926. //>>excludeStart("ide", pragmas.excludeIdeData);
  73927. args: [],
  73928. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  73929. referencedClasses: [],
  73930. //>>excludeEnd("ide");
  73931. messageSends: ["should:return:"]
  73932. }),
  73933. globals.CodeGeneratorTest);
  73934. smalltalk.addMethod(
  73935. smalltalk.method({
  73936. selector: "testMutableLiterals",
  73937. protocol: 'tests',
  73938. fn: function (){
  73939. var self=this;
  73940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73941. return smalltalk.withContext(function($ctx1) {
  73942. //>>excludeEnd("ctx");
  73943. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  73944. return self;
  73945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73946. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},globals.CodeGeneratorTest)});
  73947. //>>excludeEnd("ctx");
  73948. },
  73949. //>>excludeStart("ide", pragmas.excludeIdeData);
  73950. args: [],
  73951. 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)",
  73952. referencedClasses: [],
  73953. //>>excludeEnd("ide");
  73954. messageSends: ["should:return:"]
  73955. }),
  73956. globals.CodeGeneratorTest);
  73957. smalltalk.addMethod(
  73958. smalltalk.method({
  73959. selector: "testNestedIfTrue",
  73960. protocol: 'tests',
  73961. fn: function (){
  73962. var self=this;
  73963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73964. return smalltalk.withContext(function($ctx1) {
  73965. //>>excludeEnd("ctx");
  73966. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  73967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73968. $ctx1.sendIdx["should:return:"]=1;
  73969. //>>excludeEnd("ctx");
  73970. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  73971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73972. $ctx1.sendIdx["should:return:"]=2;
  73973. //>>excludeEnd("ctx");
  73974. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  73975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73976. $ctx1.sendIdx["should:return:"]=3;
  73977. //>>excludeEnd("ctx");
  73978. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  73979. return self;
  73980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73981. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},globals.CodeGeneratorTest)});
  73982. //>>excludeEnd("ctx");
  73983. },
  73984. //>>excludeStart("ide", pragmas.excludeIdeData);
  73985. args: [],
  73986. 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.",
  73987. referencedClasses: [],
  73988. //>>excludeEnd("ide");
  73989. messageSends: ["should:return:"]
  73990. }),
  73991. globals.CodeGeneratorTest);
  73992. smalltalk.addMethod(
  73993. smalltalk.method({
  73994. selector: "testNestedSends",
  73995. protocol: 'tests',
  73996. fn: function (){
  73997. var self=this;
  73998. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  73999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74000. return smalltalk.withContext(function($ctx1) {
  74001. //>>excludeEnd("ctx");
  74002. self._should_return_("foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString",_st(_st($Point())._x_y_((2).__at((3)),(4)))._asString());
  74003. return self;
  74004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74005. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},globals.CodeGeneratorTest)});
  74006. //>>excludeEnd("ctx");
  74007. },
  74008. //>>excludeStart("ide", pragmas.excludeIdeData);
  74009. args: [],
  74010. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  74011. referencedClasses: ["Point"],
  74012. //>>excludeEnd("ide");
  74013. messageSends: ["should:return:", "asString", "x:y:", "@"]
  74014. }),
  74015. globals.CodeGeneratorTest);
  74016. smalltalk.addMethod(
  74017. smalltalk.method({
  74018. selector: "testNonLocalReturn",
  74019. protocol: 'tests',
  74020. fn: function (){
  74021. var self=this;
  74022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74023. return smalltalk.withContext(function($ctx1) {
  74024. //>>excludeEnd("ctx");
  74025. self._should_return_("foo [ ^ 1 ] value",(1));
  74026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74027. $ctx1.sendIdx["should:return:"]=1;
  74028. //>>excludeEnd("ctx");
  74029. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  74030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74031. $ctx1.sendIdx["should:return:"]=2;
  74032. //>>excludeEnd("ctx");
  74033. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  74034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74035. $ctx1.sendIdx["should:return:"]=3;
  74036. //>>excludeEnd("ctx");
  74037. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  74038. return self;
  74039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74040. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},globals.CodeGeneratorTest)});
  74041. //>>excludeEnd("ctx");
  74042. },
  74043. //>>excludeStart("ide", pragmas.excludeIdeData);
  74044. args: [],
  74045. 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",
  74046. referencedClasses: [],
  74047. //>>excludeEnd("ide");
  74048. messageSends: ["should:return:"]
  74049. }),
  74050. globals.CodeGeneratorTest);
  74051. smalltalk.addMethod(
  74052. smalltalk.method({
  74053. selector: "testPascalCaseGlobal",
  74054. protocol: 'tests',
  74055. fn: function (){
  74056. var self=this;
  74057. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74059. return smalltalk.withContext(function($ctx1) {
  74060. //>>excludeEnd("ctx");
  74061. self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
  74062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74063. $ctx1.sendIdx["should:return:"]=1;
  74064. //>>excludeEnd("ctx");
  74065. self._should_return_("foo ^NonExistent",nil);
  74066. return self;
  74067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74068. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},globals.CodeGeneratorTest)});
  74069. //>>excludeEnd("ctx");
  74070. },
  74071. //>>excludeStart("ide", pragmas.excludeIdeData);
  74072. args: [],
  74073. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  74074. referencedClasses: ["Smalltalk"],
  74075. //>>excludeEnd("ide");
  74076. messageSends: ["should:return:", "at:", "globals"]
  74077. }),
  74078. globals.CodeGeneratorTest);
  74079. smalltalk.addMethod(
  74080. smalltalk.method({
  74081. selector: "testSendReceiverAndArgumentsOrdered",
  74082. protocol: 'tests',
  74083. fn: function (){
  74084. var self=this;
  74085. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  74086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74087. return smalltalk.withContext(function($ctx1) {
  74088. //>>excludeEnd("ctx");
  74089. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  74090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74091. $ctx1.sendIdx["should:return:"]=1;
  74092. //>>excludeEnd("ctx");
  74093. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$Array(),(2)]);
  74094. return self;
  74095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74096. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},globals.CodeGeneratorTest)});
  74097. //>>excludeEnd("ctx");
  74098. },
  74099. //>>excludeStart("ide", pragmas.excludeIdeData);
  74100. args: [],
  74101. 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}.",
  74102. referencedClasses: ["Array"],
  74103. //>>excludeEnd("ide");
  74104. messageSends: ["should:return:"]
  74105. }),
  74106. globals.CodeGeneratorTest);
  74107. smalltalk.addMethod(
  74108. smalltalk.method({
  74109. selector: "testSuperSend",
  74110. protocol: 'tests',
  74111. fn: function (){
  74112. var self=this;
  74113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74114. return smalltalk.withContext(function($ctx1) {
  74115. //>>excludeEnd("ctx");
  74116. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  74117. return self;
  74118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74119. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},globals.CodeGeneratorTest)});
  74120. //>>excludeEnd("ctx");
  74121. },
  74122. //>>excludeStart("ide", pragmas.excludeIdeData);
  74123. args: [],
  74124. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  74125. referencedClasses: [],
  74126. //>>excludeEnd("ide");
  74127. messageSends: ["should:receiver:return:"]
  74128. }),
  74129. globals.CodeGeneratorTest);
  74130. smalltalk.addMethod(
  74131. smalltalk.method({
  74132. selector: "testTempVariables",
  74133. protocol: 'tests',
  74134. fn: function (){
  74135. var self=this;
  74136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74137. return smalltalk.withContext(function($ctx1) {
  74138. //>>excludeEnd("ctx");
  74139. self._should_return_("foo | a | ^ a",nil);
  74140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74141. $ctx1.sendIdx["should:return:"]=1;
  74142. //>>excludeEnd("ctx");
  74143. self._should_return_("foo | AVariable | ^ AVariable",nil);
  74144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74145. $ctx1.sendIdx["should:return:"]=2;
  74146. //>>excludeEnd("ctx");
  74147. self._should_return_("foo | a b c | ^ c",nil);
  74148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74149. $ctx1.sendIdx["should:return:"]=3;
  74150. //>>excludeEnd("ctx");
  74151. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  74152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74153. $ctx1.sendIdx["should:return:"]=4;
  74154. //>>excludeEnd("ctx");
  74155. self._should_return_("foo | a | a:= 1. ^ a",(1));
  74156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74157. $ctx1.sendIdx["should:return:"]=5;
  74158. //>>excludeEnd("ctx");
  74159. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  74160. return self;
  74161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74162. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},globals.CodeGeneratorTest)});
  74163. //>>excludeEnd("ctx");
  74164. },
  74165. //>>excludeStart("ide", pragmas.excludeIdeData);
  74166. args: [],
  74167. 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.",
  74168. referencedClasses: [],
  74169. //>>excludeEnd("ide");
  74170. messageSends: ["should:return:"]
  74171. }),
  74172. globals.CodeGeneratorTest);
  74173. smalltalk.addMethod(
  74174. smalltalk.method({
  74175. selector: "testThisContext",
  74176. protocol: 'tests',
  74177. fn: function (){
  74178. var self=this;
  74179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74180. return smalltalk.withContext(function($ctx1) {
  74181. //>>excludeEnd("ctx");
  74182. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  74183. return self;
  74184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74185. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},globals.CodeGeneratorTest)});
  74186. //>>excludeEnd("ctx");
  74187. },
  74188. //>>excludeStart("ide", pragmas.excludeIdeData);
  74189. args: [],
  74190. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  74191. referencedClasses: [],
  74192. //>>excludeEnd("ide");
  74193. messageSends: ["should:return:"]
  74194. }),
  74195. globals.CodeGeneratorTest);
  74196. smalltalk.addMethod(
  74197. smalltalk.method({
  74198. selector: "testifFalse",
  74199. protocol: 'tests',
  74200. fn: function (){
  74201. var self=this;
  74202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74203. return smalltalk.withContext(function($ctx1) {
  74204. //>>excludeEnd("ctx");
  74205. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  74206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74207. $ctx1.sendIdx["should:return:"]=1;
  74208. //>>excludeEnd("ctx");
  74209. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  74210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74211. $ctx1.sendIdx["should:return:"]=2;
  74212. //>>excludeEnd("ctx");
  74213. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  74214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74215. $ctx1.sendIdx["should:return:"]=3;
  74216. //>>excludeEnd("ctx");
  74217. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  74218. return self;
  74219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74220. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},globals.CodeGeneratorTest)});
  74221. //>>excludeEnd("ctx");
  74222. },
  74223. //>>excludeStart("ide", pragmas.excludeIdeData);
  74224. args: [],
  74225. 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.",
  74226. referencedClasses: [],
  74227. //>>excludeEnd("ide");
  74228. messageSends: ["should:return:"]
  74229. }),
  74230. globals.CodeGeneratorTest);
  74231. smalltalk.addMethod(
  74232. smalltalk.method({
  74233. selector: "testifFalseIfTrue",
  74234. protocol: 'tests',
  74235. fn: function (){
  74236. var self=this;
  74237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74238. return smalltalk.withContext(function($ctx1) {
  74239. //>>excludeEnd("ctx");
  74240. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  74241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74242. $ctx1.sendIdx["should:return:"]=1;
  74243. //>>excludeEnd("ctx");
  74244. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  74245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74246. $ctx1.sendIdx["should:return:"]=2;
  74247. //>>excludeEnd("ctx");
  74248. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  74249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74250. $ctx1.sendIdx["should:return:"]=3;
  74251. //>>excludeEnd("ctx");
  74252. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  74253. return self;
  74254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74255. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},globals.CodeGeneratorTest)});
  74256. //>>excludeEnd("ctx");
  74257. },
  74258. //>>excludeStart("ide", pragmas.excludeIdeData);
  74259. args: [],
  74260. 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.",
  74261. referencedClasses: [],
  74262. //>>excludeEnd("ide");
  74263. messageSends: ["should:return:"]
  74264. }),
  74265. globals.CodeGeneratorTest);
  74266. smalltalk.addMethod(
  74267. smalltalk.method({
  74268. selector: "testifNil",
  74269. protocol: 'tests',
  74270. fn: function (){
  74271. var self=this;
  74272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74273. return smalltalk.withContext(function($ctx1) {
  74274. //>>excludeEnd("ctx");
  74275. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  74276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74277. $ctx1.sendIdx["should:return:"]=1;
  74278. //>>excludeEnd("ctx");
  74279. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  74280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74281. $ctx1.sendIdx["should:return:"]=2;
  74282. //>>excludeEnd("ctx");
  74283. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  74284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74285. $ctx1.sendIdx["should:return:"]=3;
  74286. //>>excludeEnd("ctx");
  74287. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  74288. return self;
  74289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74290. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},globals.CodeGeneratorTest)});
  74291. //>>excludeEnd("ctx");
  74292. },
  74293. //>>excludeStart("ide", pragmas.excludeIdeData);
  74294. args: [],
  74295. 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.",
  74296. referencedClasses: [],
  74297. //>>excludeEnd("ide");
  74298. messageSends: ["should:return:"]
  74299. }),
  74300. globals.CodeGeneratorTest);
  74301. smalltalk.addMethod(
  74302. smalltalk.method({
  74303. selector: "testifNilIfNotNil",
  74304. protocol: 'tests',
  74305. fn: function (){
  74306. var self=this;
  74307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74308. return smalltalk.withContext(function($ctx1) {
  74309. //>>excludeEnd("ctx");
  74310. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  74311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74312. $ctx1.sendIdx["should:return:"]=1;
  74313. //>>excludeEnd("ctx");
  74314. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  74315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74316. $ctx1.sendIdx["should:return:"]=2;
  74317. //>>excludeEnd("ctx");
  74318. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  74319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74320. $ctx1.sendIdx["should:return:"]=3;
  74321. //>>excludeEnd("ctx");
  74322. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  74323. return self;
  74324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74325. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},globals.CodeGeneratorTest)});
  74326. //>>excludeEnd("ctx");
  74327. },
  74328. //>>excludeStart("ide", pragmas.excludeIdeData);
  74329. args: [],
  74330. 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.",
  74331. referencedClasses: [],
  74332. //>>excludeEnd("ide");
  74333. messageSends: ["should:return:"]
  74334. }),
  74335. globals.CodeGeneratorTest);
  74336. smalltalk.addMethod(
  74337. smalltalk.method({
  74338. selector: "testifNotNil",
  74339. protocol: 'tests',
  74340. fn: function (){
  74341. var self=this;
  74342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74343. return smalltalk.withContext(function($ctx1) {
  74344. //>>excludeEnd("ctx");
  74345. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  74346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74347. $ctx1.sendIdx["should:return:"]=1;
  74348. //>>excludeEnd("ctx");
  74349. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  74350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74351. $ctx1.sendIdx["should:return:"]=2;
  74352. //>>excludeEnd("ctx");
  74353. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  74354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74355. $ctx1.sendIdx["should:return:"]=3;
  74356. //>>excludeEnd("ctx");
  74357. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  74358. return self;
  74359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74360. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},globals.CodeGeneratorTest)});
  74361. //>>excludeEnd("ctx");
  74362. },
  74363. //>>excludeStart("ide", pragmas.excludeIdeData);
  74364. args: [],
  74365. 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.",
  74366. referencedClasses: [],
  74367. //>>excludeEnd("ide");
  74368. messageSends: ["should:return:"]
  74369. }),
  74370. globals.CodeGeneratorTest);
  74371. smalltalk.addMethod(
  74372. smalltalk.method({
  74373. selector: "testifNotNilWithArgument",
  74374. protocol: 'tests',
  74375. fn: function (){
  74376. var self=this;
  74377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74378. return smalltalk.withContext(function($ctx1) {
  74379. //>>excludeEnd("ctx");
  74380. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  74381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74382. $ctx1.sendIdx["should:return:"]=1;
  74383. //>>excludeEnd("ctx");
  74384. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  74385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74386. $ctx1.sendIdx["should:return:"]=2;
  74387. //>>excludeEnd("ctx");
  74388. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  74389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74390. $ctx1.sendIdx["should:return:"]=3;
  74391. //>>excludeEnd("ctx");
  74392. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  74393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74394. $ctx1.sendIdx["should:return:"]=4;
  74395. //>>excludeEnd("ctx");
  74396. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  74397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74398. $ctx1.sendIdx["should:return:"]=5;
  74399. //>>excludeEnd("ctx");
  74400. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  74401. return self;
  74402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74403. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},globals.CodeGeneratorTest)});
  74404. //>>excludeEnd("ctx");
  74405. },
  74406. //>>excludeStart("ide", pragmas.excludeIdeData);
  74407. args: [],
  74408. 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",
  74409. referencedClasses: [],
  74410. //>>excludeEnd("ide");
  74411. messageSends: ["should:return:"]
  74412. }),
  74413. globals.CodeGeneratorTest);
  74414. smalltalk.addMethod(
  74415. smalltalk.method({
  74416. selector: "testifTrue",
  74417. protocol: 'tests',
  74418. fn: function (){
  74419. var self=this;
  74420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74421. return smalltalk.withContext(function($ctx1) {
  74422. //>>excludeEnd("ctx");
  74423. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  74424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74425. $ctx1.sendIdx["should:return:"]=1;
  74426. //>>excludeEnd("ctx");
  74427. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  74428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74429. $ctx1.sendIdx["should:return:"]=2;
  74430. //>>excludeEnd("ctx");
  74431. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  74432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74433. $ctx1.sendIdx["should:return:"]=3;
  74434. //>>excludeEnd("ctx");
  74435. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  74436. return self;
  74437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74438. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},globals.CodeGeneratorTest)});
  74439. //>>excludeEnd("ctx");
  74440. },
  74441. //>>excludeStart("ide", pragmas.excludeIdeData);
  74442. args: [],
  74443. 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.",
  74444. referencedClasses: [],
  74445. //>>excludeEnd("ide");
  74446. messageSends: ["should:return:"]
  74447. }),
  74448. globals.CodeGeneratorTest);
  74449. smalltalk.addMethod(
  74450. smalltalk.method({
  74451. selector: "testifTrueIfFalse",
  74452. protocol: 'tests',
  74453. fn: function (){
  74454. var self=this;
  74455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74456. return smalltalk.withContext(function($ctx1) {
  74457. //>>excludeEnd("ctx");
  74458. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  74459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74460. $ctx1.sendIdx["should:return:"]=1;
  74461. //>>excludeEnd("ctx");
  74462. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  74463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74464. $ctx1.sendIdx["should:return:"]=2;
  74465. //>>excludeEnd("ctx");
  74466. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  74467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74468. $ctx1.sendIdx["should:return:"]=3;
  74469. //>>excludeEnd("ctx");
  74470. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  74471. return self;
  74472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74473. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},globals.CodeGeneratorTest)});
  74474. //>>excludeEnd("ctx");
  74475. },
  74476. //>>excludeStart("ide", pragmas.excludeIdeData);
  74477. args: [],
  74478. 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.",
  74479. referencedClasses: [],
  74480. //>>excludeEnd("ide");
  74481. messageSends: ["should:return:"]
  74482. }),
  74483. globals.CodeGeneratorTest);
  74484. smalltalk.addClass('ASTInterpreterTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  74485. smalltalk.addMethod(
  74486. smalltalk.method({
  74487. selector: "analyze:forClass:",
  74488. protocol: 'parsing',
  74489. fn: function (aNode,aClass){
  74490. var self=this;
  74491. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74493. return smalltalk.withContext(function($ctx1) {
  74494. //>>excludeEnd("ctx");
  74495. _st(_st($SemanticAnalyzer())._on_(aClass))._visit_(aNode);
  74496. return aNode;
  74497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74498. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},globals.ASTInterpreterTest)});
  74499. //>>excludeEnd("ctx");
  74500. },
  74501. //>>excludeStart("ide", pragmas.excludeIdeData);
  74502. args: ["aNode", "aClass"],
  74503. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  74504. referencedClasses: ["SemanticAnalyzer"],
  74505. //>>excludeEnd("ide");
  74506. messageSends: ["visit:", "on:"]
  74507. }),
  74508. globals.ASTInterpreterTest);
  74509. smalltalk.addMethod(
  74510. smalltalk.method({
  74511. selector: "interpret:receiver:withArguments:",
  74512. protocol: 'private',
  74513. fn: function (aString,anObject,aDictionary){
  74514. var self=this;
  74515. var ctx,ast,interpreter;
  74516. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  74517. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  74518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74519. return smalltalk.withContext(function($ctx1) {
  74520. //>>excludeEnd("ctx");
  74521. var $1,$2,$3,$5,$6,$4,$receiver;
  74522. interpreter=_st($ASTInterpreter())._new();
  74523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74524. $ctx1.sendIdx["new"]=1;
  74525. //>>excludeEnd("ctx");
  74526. ast=self._parse_forClass_(aString,_st(anObject)._class());
  74527. $1=_st($AIContext())._new();
  74528. _st($1)._receiver_(anObject);
  74529. _st($1)._interpreter_(interpreter);
  74530. $2=_st($1)._yourself();
  74531. ctx=$2;
  74532. $3=_st(ast)._sequenceNode();
  74533. if(($receiver = $3) == null || $receiver.isNil){
  74534. $3;
  74535. } else {
  74536. var sequence;
  74537. sequence=$receiver;
  74538. _st(_st(sequence)._temps())._do_((function(each){
  74539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74540. return smalltalk.withContext(function($ctx2) {
  74541. //>>excludeEnd("ctx");
  74542. return _st(ctx)._defineLocal_(each);
  74543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  74545. //>>excludeEnd("ctx");
  74546. }));
  74547. };
  74548. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  74549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74550. return smalltalk.withContext(function($ctx2) {
  74551. //>>excludeEnd("ctx");
  74552. return _st(ctx)._localAt_put_(key,value);
  74553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74554. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  74555. //>>excludeEnd("ctx");
  74556. }));
  74557. $5=interpreter;
  74558. _st($5)._context_(ctx);
  74559. _st($5)._interpret_(_st(ast)._nextChild());
  74560. _st($5)._proceed();
  74561. $6=_st($5)._result();
  74562. $4=$6;
  74563. return $4;
  74564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74565. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},globals.ASTInterpreterTest)});
  74566. //>>excludeEnd("ctx");
  74567. },
  74568. //>>excludeStart("ide", pragmas.excludeIdeData);
  74569. args: ["aString", "anObject", "aDictionary"],
  74570. 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",
  74571. referencedClasses: ["ASTInterpreter", "AIContext"],
  74572. //>>excludeEnd("ide");
  74573. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpret:", "nextChild", "proceed", "result"]
  74574. }),
  74575. globals.ASTInterpreterTest);
  74576. smalltalk.addMethod(
  74577. smalltalk.method({
  74578. selector: "parse:",
  74579. protocol: 'parsing',
  74580. fn: function (aString){
  74581. var self=this;
  74582. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74584. return smalltalk.withContext(function($ctx1) {
  74585. //>>excludeEnd("ctx");
  74586. var $1;
  74587. $1=_st($Smalltalk())._parse_(aString);
  74588. return $1;
  74589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74590. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},globals.ASTInterpreterTest)});
  74591. //>>excludeEnd("ctx");
  74592. },
  74593. //>>excludeStart("ide", pragmas.excludeIdeData);
  74594. args: ["aString"],
  74595. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  74596. referencedClasses: ["Smalltalk"],
  74597. //>>excludeEnd("ide");
  74598. messageSends: ["parse:"]
  74599. }),
  74600. globals.ASTInterpreterTest);
  74601. smalltalk.addMethod(
  74602. smalltalk.method({
  74603. selector: "parse:forClass:",
  74604. protocol: 'parsing',
  74605. fn: function (aString,aClass){
  74606. var self=this;
  74607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74608. return smalltalk.withContext(function($ctx1) {
  74609. //>>excludeEnd("ctx");
  74610. var $1;
  74611. $1=self._analyze_forClass_(self._parse_(aString),aClass);
  74612. return $1;
  74613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74614. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},globals.ASTInterpreterTest)});
  74615. //>>excludeEnd("ctx");
  74616. },
  74617. //>>excludeStart("ide", pragmas.excludeIdeData);
  74618. args: ["aString", "aClass"],
  74619. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  74620. referencedClasses: [],
  74621. //>>excludeEnd("ide");
  74622. messageSends: ["analyze:forClass:", "parse:"]
  74623. }),
  74624. globals.ASTInterpreterTest);
  74625. smalltalk.addMethod(
  74626. smalltalk.method({
  74627. selector: "should:receiver:return:",
  74628. protocol: 'testing',
  74629. fn: function (aString,anObject,aResult){
  74630. var self=this;
  74631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74632. return smalltalk.withContext(function($ctx1) {
  74633. //>>excludeEnd("ctx");
  74634. var $1;
  74635. self["@receiver"]=anObject;
  74636. $1=self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],globals.HashedCollection._newFromPairs_([])),aResult);
  74637. return $1;
  74638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74639. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},globals.ASTInterpreterTest)});
  74640. //>>excludeEnd("ctx");
  74641. },
  74642. //>>excludeStart("ide", pragmas.excludeIdeData);
  74643. args: ["aString", "anObject", "aResult"],
  74644. 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",
  74645. referencedClasses: [],
  74646. //>>excludeEnd("ide");
  74647. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  74648. }),
  74649. globals.ASTInterpreterTest);
  74650. smalltalk.addMethod(
  74651. smalltalk.method({
  74652. selector: "should:return:",
  74653. protocol: 'testing',
  74654. fn: function (aString,anObject){
  74655. var self=this;
  74656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74657. return smalltalk.withContext(function($ctx1) {
  74658. //>>excludeEnd("ctx");
  74659. var $1;
  74660. $1=self._should_receiver_return_(aString,self["@receiver"],anObject);
  74661. return $1;
  74662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74663. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},globals.ASTInterpreterTest)});
  74664. //>>excludeEnd("ctx");
  74665. },
  74666. //>>excludeStart("ide", pragmas.excludeIdeData);
  74667. args: ["aString", "anObject"],
  74668. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString\x0a\x09\x09receiver: receiver\x0a\x09\x09return: anObject",
  74669. referencedClasses: [],
  74670. //>>excludeEnd("ide");
  74671. messageSends: ["should:receiver:return:"]
  74672. }),
  74673. globals.ASTInterpreterTest);
  74674. smalltalk.addClass('ASTDebuggerTest', globals.ASTInterpreterTest, [], 'Compiler-Tests');
  74675. smalltalk.addMethod(
  74676. smalltalk.method({
  74677. selector: "interpret:receiver:withArguments:",
  74678. protocol: 'private',
  74679. fn: function (aString,anObject,aDictionary){
  74680. var self=this;
  74681. var ctx,ast,debugger_;
  74682. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  74683. function $ASTInterpreter(){return globals.ASTInterpreter||(typeof ASTInterpreter=="undefined"?nil:ASTInterpreter)}
  74684. function $ASTDebugger(){return globals.ASTDebugger||(typeof ASTDebugger=="undefined"?nil:ASTDebugger)}
  74685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74686. return smalltalk.withContext(function($ctx1) {
  74687. //>>excludeEnd("ctx");
  74688. var $1,$2,$3,$4,$6,$7,$5,$receiver;
  74689. $1=_st($AIContext())._new();
  74690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74691. $ctx1.sendIdx["new"]=1;
  74692. //>>excludeEnd("ctx");
  74693. _st($1)._receiver_(anObject);
  74694. _st($1)._interpreter_(_st($ASTInterpreter())._new());
  74695. $2=_st($1)._yourself();
  74696. ctx=$2;
  74697. ast=self._parse_forClass_(aString,_st(anObject)._class());
  74698. $3=_st(ast)._sequenceNode();
  74699. if(($receiver = $3) == null || $receiver.isNil){
  74700. $3;
  74701. } else {
  74702. var sequence;
  74703. sequence=$receiver;
  74704. _st(_st(sequence)._temps())._do_((function(each){
  74705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74706. return smalltalk.withContext(function($ctx2) {
  74707. //>>excludeEnd("ctx");
  74708. return _st(ctx)._defineLocal_(each);
  74709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  74711. //>>excludeEnd("ctx");
  74712. }));
  74713. };
  74714. _st(aDictionary)._keysAndValuesDo_((function(key,value){
  74715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74716. return smalltalk.withContext(function($ctx2) {
  74717. //>>excludeEnd("ctx");
  74718. return _st(ctx)._localAt_put_(key,value);
  74719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74720. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  74721. //>>excludeEnd("ctx");
  74722. }));
  74723. $4=_st(ctx)._interpreter();
  74724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74725. $ctx1.sendIdx["interpreter"]=1;
  74726. //>>excludeEnd("ctx");
  74727. _st($4)._context_(ctx);
  74728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74729. $ctx1.sendIdx["context:"]=1;
  74730. //>>excludeEnd("ctx");
  74731. _st(_st(ctx)._interpreter())._node_(_st(ast)._nextChild());
  74732. debugger_=_st($ASTDebugger())._context_(ctx);
  74733. $6=debugger_;
  74734. _st($6)._proceed();
  74735. $7=_st($6)._result();
  74736. $5=$7;
  74737. return $5;
  74738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74739. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},globals.ASTDebuggerTest)});
  74740. //>>excludeEnd("ctx");
  74741. },
  74742. //>>excludeStart("ide", pragmas.excludeIdeData);
  74743. args: ["aString", "anObject", "aDictionary"],
  74744. 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",
  74745. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  74746. //>>excludeEnd("ide");
  74747. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "nextChild", "proceed", "result"]
  74748. }),
  74749. globals.ASTDebuggerTest);
  74750. smalltalk.addClass('InliningCodeGeneratorTest', globals.CodeGeneratorTest, [], 'Compiler-Tests');
  74751. smalltalk.addMethod(
  74752. smalltalk.method({
  74753. selector: "codeGeneratorClass",
  74754. protocol: 'accessing',
  74755. fn: function (){
  74756. var self=this;
  74757. function $InliningCodeGenerator(){return globals.InliningCodeGenerator||(typeof InliningCodeGenerator=="undefined"?nil:InliningCodeGenerator)}
  74758. return $InliningCodeGenerator();
  74759. },
  74760. //>>excludeStart("ide", pragmas.excludeIdeData);
  74761. args: [],
  74762. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  74763. referencedClasses: ["InliningCodeGenerator"],
  74764. //>>excludeEnd("ide");
  74765. messageSends: []
  74766. }),
  74767. globals.InliningCodeGeneratorTest);
  74768. smalltalk.addClass('ScopeVarTest', globals.TestCase, [], 'Compiler-Tests');
  74769. smalltalk.addMethod(
  74770. smalltalk.method({
  74771. selector: "testClassRefVar",
  74772. protocol: 'tests',
  74773. fn: function (){
  74774. var self=this;
  74775. var node;
  74776. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74777. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74778. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74780. return smalltalk.withContext(function($ctx1) {
  74781. //>>excludeEnd("ctx");
  74782. var $1,$2,$3,$4;
  74783. $1=_st($VariableNode())._new();
  74784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74785. $ctx1.sendIdx["new"]=1;
  74786. //>>excludeEnd("ctx");
  74787. _st($1)._value_("Object");
  74788. $2=_st($1)._yourself();
  74789. node=$2;
  74790. $3=_st($SemanticAnalyzer())._new();
  74791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74792. $ctx1.sendIdx["new"]=2;
  74793. //>>excludeEnd("ctx");
  74794. _st($3)._pushScope_(_st($MethodLexicalScope())._new());
  74795. $4=_st($3)._visit_(node);
  74796. self._assert_(_st(_st(node)._binding())._isClassRefVar());
  74797. return self;
  74798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74799. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},globals.ScopeVarTest)});
  74800. //>>excludeEnd("ctx");
  74801. },
  74802. //>>excludeStart("ide", pragmas.excludeIdeData);
  74803. args: [],
  74804. 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",
  74805. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  74806. //>>excludeEnd("ide");
  74807. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  74808. }),
  74809. globals.ScopeVarTest);
  74810. smalltalk.addMethod(
  74811. smalltalk.method({
  74812. selector: "testInstanceVar",
  74813. protocol: 'tests',
  74814. fn: function (){
  74815. var self=this;
  74816. var node,scope;
  74817. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74818. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74820. return smalltalk.withContext(function($ctx1) {
  74821. //>>excludeEnd("ctx");
  74822. var $1,$2;
  74823. $1=_st($VariableNode())._new();
  74824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74825. $ctx1.sendIdx["new"]=1;
  74826. //>>excludeEnd("ctx");
  74827. _st($1)._value_("bzzz");
  74828. $2=_st($1)._yourself();
  74829. node=$2;
  74830. scope=_st($MethodLexicalScope())._new();
  74831. _st(scope)._addIVar_("bzzz");
  74832. self._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
  74833. return self;
  74834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74835. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},globals.ScopeVarTest)});
  74836. //>>excludeEnd("ctx");
  74837. },
  74838. //>>excludeStart("ide", pragmas.excludeIdeData);
  74839. args: [],
  74840. 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",
  74841. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74842. //>>excludeEnd("ide");
  74843. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  74844. }),
  74845. globals.ScopeVarTest);
  74846. smalltalk.addMethod(
  74847. smalltalk.method({
  74848. selector: "testPseudoVar",
  74849. protocol: 'tests',
  74850. fn: function (){
  74851. var self=this;
  74852. var node,pseudoVars;
  74853. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74854. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74856. return smalltalk.withContext(function($ctx1) {
  74857. //>>excludeEnd("ctx");
  74858. var $1,$2;
  74859. pseudoVars=["self", "super", "true", "false", "nil"];
  74860. _st(pseudoVars)._do_((function(each){
  74861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74862. return smalltalk.withContext(function($ctx2) {
  74863. //>>excludeEnd("ctx");
  74864. $1=_st($VariableNode())._new();
  74865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74866. $ctx2.sendIdx["new"]=1;
  74867. //>>excludeEnd("ctx");
  74868. _st($1)._value_(each);
  74869. $2=_st($1)._yourself();
  74870. node=$2;
  74871. node;
  74872. return self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isPseudoVar());
  74873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  74875. //>>excludeEnd("ctx");
  74876. }));
  74877. return self;
  74878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74879. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},globals.ScopeVarTest)});
  74880. //>>excludeEnd("ctx");
  74881. },
  74882. //>>excludeStart("ide", pragmas.excludeIdeData);
  74883. args: [],
  74884. 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 ]",
  74885. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74886. //>>excludeEnd("ide");
  74887. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  74888. }),
  74889. globals.ScopeVarTest);
  74890. smalltalk.addMethod(
  74891. smalltalk.method({
  74892. selector: "testTempVar",
  74893. protocol: 'tests',
  74894. fn: function (){
  74895. var self=this;
  74896. var node,scope;
  74897. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74898. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74900. return smalltalk.withContext(function($ctx1) {
  74901. //>>excludeEnd("ctx");
  74902. var $1,$2;
  74903. $1=_st($VariableNode())._new();
  74904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74905. $ctx1.sendIdx["new"]=1;
  74906. //>>excludeEnd("ctx");
  74907. _st($1)._value_("bzzz");
  74908. $2=_st($1)._yourself();
  74909. node=$2;
  74910. scope=_st($MethodLexicalScope())._new();
  74911. _st(scope)._addTemp_("bzzz");
  74912. self._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
  74913. return self;
  74914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74915. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},globals.ScopeVarTest)});
  74916. //>>excludeEnd("ctx");
  74917. },
  74918. //>>excludeStart("ide", pragmas.excludeIdeData);
  74919. args: [],
  74920. 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",
  74921. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74922. //>>excludeEnd("ide");
  74923. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  74924. }),
  74925. globals.ScopeVarTest);
  74926. smalltalk.addMethod(
  74927. smalltalk.method({
  74928. selector: "testUnknownVar",
  74929. protocol: 'tests',
  74930. fn: function (){
  74931. var self=this;
  74932. var node;
  74933. function $VariableNode(){return globals.VariableNode||(typeof VariableNode=="undefined"?nil:VariableNode)}
  74934. function $MethodLexicalScope(){return globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  74935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74936. return smalltalk.withContext(function($ctx1) {
  74937. //>>excludeEnd("ctx");
  74938. var $1,$2;
  74939. $1=_st($VariableNode())._new();
  74940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74941. $ctx1.sendIdx["new"]=1;
  74942. //>>excludeEnd("ctx");
  74943. _st($1)._value_("bzzz");
  74944. $2=_st($1)._yourself();
  74945. node=$2;
  74946. self._assert_(_st(_st(_st($MethodLexicalScope())._new())._bindingFor_(node))._isNil());
  74947. return self;
  74948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74949. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},globals.ScopeVarTest)});
  74950. //>>excludeEnd("ctx");
  74951. },
  74952. //>>excludeStart("ide", pragmas.excludeIdeData);
  74953. args: [],
  74954. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  74955. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  74956. //>>excludeEnd("ide");
  74957. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  74958. }),
  74959. globals.ScopeVarTest);
  74960. smalltalk.addClass('SemanticAnalyzerTest', globals.TestCase, ['analyzer'], 'Compiler-Tests');
  74961. smalltalk.addMethod(
  74962. smalltalk.method({
  74963. selector: "setUp",
  74964. protocol: 'running',
  74965. fn: function (){
  74966. var self=this;
  74967. function $SemanticAnalyzer(){return globals.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
  74968. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  74969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74970. return smalltalk.withContext(function($ctx1) {
  74971. //>>excludeEnd("ctx");
  74972. self["@analyzer"]=_st($SemanticAnalyzer())._on_($Object());
  74973. return self;
  74974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74975. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.SemanticAnalyzerTest)});
  74976. //>>excludeEnd("ctx");
  74977. },
  74978. //>>excludeStart("ide", pragmas.excludeIdeData);
  74979. args: [],
  74980. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  74981. referencedClasses: ["SemanticAnalyzer", "Object"],
  74982. //>>excludeEnd("ide");
  74983. messageSends: ["on:"]
  74984. }),
  74985. globals.SemanticAnalyzerTest);
  74986. smalltalk.addMethod(
  74987. smalltalk.method({
  74988. selector: "testAssignment",
  74989. protocol: 'tests',
  74990. fn: function (){
  74991. var self=this;
  74992. var src,ast;
  74993. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  74994. function $InvalidAssignmentError(){return globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  74995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  74996. return smalltalk.withContext(function($ctx1) {
  74997. //>>excludeEnd("ctx");
  74998. src="foo self := 1";
  74999. ast=_st($Smalltalk())._parse_(src);
  75000. self._should_raise_((function(){
  75001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75002. return smalltalk.withContext(function($ctx2) {
  75003. //>>excludeEnd("ctx");
  75004. return _st(self["@analyzer"])._visit_(ast);
  75005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75007. //>>excludeEnd("ctx");
  75008. }),$InvalidAssignmentError());
  75009. return self;
  75010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75011. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75012. //>>excludeEnd("ctx");
  75013. },
  75014. //>>excludeStart("ide", pragmas.excludeIdeData);
  75015. args: [],
  75016. 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",
  75017. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  75018. //>>excludeEnd("ide");
  75019. messageSends: ["parse:", "should:raise:", "visit:"]
  75020. }),
  75021. globals.SemanticAnalyzerTest);
  75022. smalltalk.addMethod(
  75023. smalltalk.method({
  75024. selector: "testNonLocalReturn",
  75025. protocol: 'tests',
  75026. fn: function (){
  75027. var self=this;
  75028. var src,ast;
  75029. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75031. return smalltalk.withContext(function($ctx1) {
  75032. //>>excludeEnd("ctx");
  75033. src="foo | a | a + 1. ^ a";
  75034. ast=_st($Smalltalk())._parse_(src);
  75035. _st(self["@analyzer"])._visit_(ast);
  75036. self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
  75037. return self;
  75038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75039. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75040. //>>excludeEnd("ctx");
  75041. },
  75042. //>>excludeStart("ide", pragmas.excludeIdeData);
  75043. args: [],
  75044. 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",
  75045. referencedClasses: ["Smalltalk"],
  75046. //>>excludeEnd("ide");
  75047. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  75048. }),
  75049. globals.SemanticAnalyzerTest);
  75050. smalltalk.addMethod(
  75051. smalltalk.method({
  75052. selector: "testNonLocalReturn2",
  75053. protocol: 'tests',
  75054. fn: function (){
  75055. var self=this;
  75056. var src,ast;
  75057. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75059. return smalltalk.withContext(function($ctx1) {
  75060. //>>excludeEnd("ctx");
  75061. src="foo | a | a + 1. [ [ ^ a] ]";
  75062. ast=_st($Smalltalk())._parse_(src);
  75063. _st(self["@analyzer"])._visit_(ast);
  75064. self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
  75065. return self;
  75066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75067. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75068. //>>excludeEnd("ctx");
  75069. },
  75070. //>>excludeStart("ide", pragmas.excludeIdeData);
  75071. args: [],
  75072. 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",
  75073. referencedClasses: ["Smalltalk"],
  75074. //>>excludeEnd("ide");
  75075. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  75076. }),
  75077. globals.SemanticAnalyzerTest);
  75078. smalltalk.addMethod(
  75079. smalltalk.method({
  75080. selector: "testScope",
  75081. protocol: 'tests',
  75082. fn: function (){
  75083. var self=this;
  75084. var src,ast;
  75085. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75087. return smalltalk.withContext(function($ctx1) {
  75088. //>>excludeEnd("ctx");
  75089. var $4,$3,$2,$1;
  75090. src="foo | a | a + 1. [ | b | b := a ]";
  75091. ast=_st($Smalltalk())._parse_(src);
  75092. _st(self["@analyzer"])._visit_(ast);
  75093. $4=_st(_st(_st(ast)._nodes())._first())._nodes();
  75094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75095. $ctx1.sendIdx["nodes"]=1;
  75096. //>>excludeEnd("ctx");
  75097. $3=_st($4)._last();
  75098. $2=_st($3)._scope();
  75099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75100. $ctx1.sendIdx["scope"]=1;
  75101. //>>excludeEnd("ctx");
  75102. $1=_st($2).__eq_eq(_st(ast)._scope());
  75103. self._deny_($1);
  75104. return self;
  75105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75106. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75107. //>>excludeEnd("ctx");
  75108. },
  75109. //>>excludeStart("ide", pragmas.excludeIdeData);
  75110. args: [],
  75111. 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.",
  75112. referencedClasses: ["Smalltalk"],
  75113. //>>excludeEnd("ide");
  75114. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  75115. }),
  75116. globals.SemanticAnalyzerTest);
  75117. smalltalk.addMethod(
  75118. smalltalk.method({
  75119. selector: "testScope2",
  75120. protocol: 'tests',
  75121. fn: function (){
  75122. var self=this;
  75123. var src,ast;
  75124. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75126. return smalltalk.withContext(function($ctx1) {
  75127. //>>excludeEnd("ctx");
  75128. var $8,$7,$6,$5,$4,$3,$2,$1;
  75129. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  75130. ast=_st($Smalltalk())._parse_(src);
  75131. _st(self["@analyzer"])._visit_(ast);
  75132. $8=_st(_st(_st(ast)._nodes())._first())._nodes();
  75133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75134. $ctx1.sendIdx["nodes"]=3;
  75135. //>>excludeEnd("ctx");
  75136. $7=_st($8)._last();
  75137. $6=_st($7)._nodes();
  75138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75139. $ctx1.sendIdx["nodes"]=2;
  75140. //>>excludeEnd("ctx");
  75141. $5=_st($6)._first();
  75142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75143. $ctx1.sendIdx["first"]=2;
  75144. //>>excludeEnd("ctx");
  75145. $4=_st($5)._nodes();
  75146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75147. $ctx1.sendIdx["nodes"]=1;
  75148. //>>excludeEnd("ctx");
  75149. $3=_st($4)._first();
  75150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75151. $ctx1.sendIdx["first"]=1;
  75152. //>>excludeEnd("ctx");
  75153. $2=_st($3)._scope();
  75154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75155. $ctx1.sendIdx["scope"]=1;
  75156. //>>excludeEnd("ctx");
  75157. $1=_st($2).__eq_eq(_st(ast)._scope());
  75158. self._deny_($1);
  75159. return self;
  75160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75161. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75162. //>>excludeEnd("ctx");
  75163. },
  75164. //>>excludeStart("ide", pragmas.excludeIdeData);
  75165. args: [],
  75166. 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.",
  75167. referencedClasses: ["Smalltalk"],
  75168. //>>excludeEnd("ide");
  75169. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  75170. }),
  75171. globals.SemanticAnalyzerTest);
  75172. smalltalk.addMethod(
  75173. smalltalk.method({
  75174. selector: "testScopeLevel",
  75175. protocol: 'tests',
  75176. fn: function (){
  75177. var self=this;
  75178. var src,ast;
  75179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75181. return smalltalk.withContext(function($ctx1) {
  75182. //>>excludeEnd("ctx");
  75183. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  75184. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  75185. ast=_st($Smalltalk())._parse_(src);
  75186. _st(self["@analyzer"])._visit_(ast);
  75187. $2=_st(ast)._scope();
  75188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75189. $ctx1.sendIdx["scope"]=1;
  75190. //>>excludeEnd("ctx");
  75191. $1=_st($2)._scopeLevel();
  75192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75193. $ctx1.sendIdx["scopeLevel"]=1;
  75194. //>>excludeEnd("ctx");
  75195. self._assert_equals_($1,(1));
  75196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75197. $ctx1.sendIdx["assert:equals:"]=1;
  75198. //>>excludeEnd("ctx");
  75199. $10=_st(_st(_st(ast)._nodes())._first())._nodes();
  75200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75201. $ctx1.sendIdx["nodes"]=3;
  75202. //>>excludeEnd("ctx");
  75203. $9=_st($10)._last();
  75204. $8=_st($9)._nodes();
  75205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75206. $ctx1.sendIdx["nodes"]=2;
  75207. //>>excludeEnd("ctx");
  75208. $7=_st($8)._first();
  75209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75210. $ctx1.sendIdx["first"]=2;
  75211. //>>excludeEnd("ctx");
  75212. $6=_st($7)._nodes();
  75213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75214. $ctx1.sendIdx["nodes"]=1;
  75215. //>>excludeEnd("ctx");
  75216. $5=_st($6)._first();
  75217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75218. $ctx1.sendIdx["first"]=1;
  75219. //>>excludeEnd("ctx");
  75220. $4=_st($5)._scope();
  75221. $3=_st($4)._scopeLevel();
  75222. self._assert_equals_($3,(3));
  75223. return self;
  75224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75225. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75226. //>>excludeEnd("ctx");
  75227. },
  75228. //>>excludeStart("ide", pragmas.excludeIdeData);
  75229. args: [],
  75230. 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",
  75231. referencedClasses: ["Smalltalk"],
  75232. //>>excludeEnd("ide");
  75233. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  75234. }),
  75235. globals.SemanticAnalyzerTest);
  75236. smalltalk.addMethod(
  75237. smalltalk.method({
  75238. selector: "testUnknownVariables",
  75239. protocol: 'tests',
  75240. fn: function (){
  75241. var self=this;
  75242. var src,ast;
  75243. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75244. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75246. return smalltalk.withContext(function($ctx1) {
  75247. //>>excludeEnd("ctx");
  75248. src="foo | a | b + a";
  75249. ast=_st($Smalltalk())._parse_(src);
  75250. self._should_raise_((function(){
  75251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75252. return smalltalk.withContext(function($ctx2) {
  75253. //>>excludeEnd("ctx");
  75254. return _st(self["@analyzer"])._visit_(ast);
  75255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75257. //>>excludeEnd("ctx");
  75258. }),$UnknownVariableError());
  75259. return self;
  75260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75261. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75262. //>>excludeEnd("ctx");
  75263. },
  75264. //>>excludeStart("ide", pragmas.excludeIdeData);
  75265. args: [],
  75266. 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",
  75267. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75268. //>>excludeEnd("ide");
  75269. messageSends: ["parse:", "should:raise:", "visit:"]
  75270. }),
  75271. globals.SemanticAnalyzerTest);
  75272. smalltalk.addMethod(
  75273. smalltalk.method({
  75274. selector: "testUnknownVariablesWithScope",
  75275. protocol: 'tests',
  75276. fn: function (){
  75277. var self=this;
  75278. var src,ast;
  75279. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75280. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75282. return smalltalk.withContext(function($ctx1) {
  75283. //>>excludeEnd("ctx");
  75284. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  75285. ast=_st($Smalltalk())._parse_(src);
  75286. self._should_raise_((function(){
  75287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75288. return smalltalk.withContext(function($ctx2) {
  75289. //>>excludeEnd("ctx");
  75290. return _st(self["@analyzer"])._visit_(ast);
  75291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75293. //>>excludeEnd("ctx");
  75294. }),$UnknownVariableError());
  75295. return self;
  75296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75297. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75298. //>>excludeEnd("ctx");
  75299. },
  75300. //>>excludeStart("ide", pragmas.excludeIdeData);
  75301. args: [],
  75302. 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",
  75303. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75304. //>>excludeEnd("ide");
  75305. messageSends: ["parse:", "should:raise:", "visit:"]
  75306. }),
  75307. globals.SemanticAnalyzerTest);
  75308. smalltalk.addMethod(
  75309. smalltalk.method({
  75310. selector: "testVariableShadowing",
  75311. protocol: 'tests',
  75312. fn: function (){
  75313. var self=this;
  75314. var src,ast;
  75315. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75317. return smalltalk.withContext(function($ctx1) {
  75318. //>>excludeEnd("ctx");
  75319. src="foo | a | a + 1";
  75320. ast=_st($Smalltalk())._parse_(src);
  75321. _st(self["@analyzer"])._visit_(ast);
  75322. return self;
  75323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75324. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75325. //>>excludeEnd("ctx");
  75326. },
  75327. //>>excludeStart("ide", pragmas.excludeIdeData);
  75328. args: [],
  75329. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75330. referencedClasses: ["Smalltalk"],
  75331. //>>excludeEnd("ide");
  75332. messageSends: ["parse:", "visit:"]
  75333. }),
  75334. globals.SemanticAnalyzerTest);
  75335. smalltalk.addMethod(
  75336. smalltalk.method({
  75337. selector: "testVariableShadowing2",
  75338. protocol: 'tests',
  75339. fn: function (){
  75340. var self=this;
  75341. var src,ast;
  75342. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75343. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  75344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75345. return smalltalk.withContext(function($ctx1) {
  75346. //>>excludeEnd("ctx");
  75347. src="foo | a | a + 1. [ | a | a := 2 ]";
  75348. ast=_st($Smalltalk())._parse_(src);
  75349. self._should_raise_((function(){
  75350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75351. return smalltalk.withContext(function($ctx2) {
  75352. //>>excludeEnd("ctx");
  75353. return _st(self["@analyzer"])._visit_(ast);
  75354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75356. //>>excludeEnd("ctx");
  75357. }),$ShadowingVariableError());
  75358. return self;
  75359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75360. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75361. //>>excludeEnd("ctx");
  75362. },
  75363. //>>excludeStart("ide", pragmas.excludeIdeData);
  75364. args: [],
  75365. 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",
  75366. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  75367. //>>excludeEnd("ide");
  75368. messageSends: ["parse:", "should:raise:", "visit:"]
  75369. }),
  75370. globals.SemanticAnalyzerTest);
  75371. smalltalk.addMethod(
  75372. smalltalk.method({
  75373. selector: "testVariableShadowing3",
  75374. protocol: 'tests',
  75375. fn: function (){
  75376. var self=this;
  75377. var src,ast;
  75378. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75380. return smalltalk.withContext(function($ctx1) {
  75381. //>>excludeEnd("ctx");
  75382. src="foo | a | a + 1. [ | b | b := 2 ]";
  75383. ast=_st($Smalltalk())._parse_(src);
  75384. _st(self["@analyzer"])._visit_(ast);
  75385. return self;
  75386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75387. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75388. //>>excludeEnd("ctx");
  75389. },
  75390. //>>excludeStart("ide", pragmas.excludeIdeData);
  75391. args: [],
  75392. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75393. referencedClasses: ["Smalltalk"],
  75394. //>>excludeEnd("ide");
  75395. messageSends: ["parse:", "visit:"]
  75396. }),
  75397. globals.SemanticAnalyzerTest);
  75398. smalltalk.addMethod(
  75399. smalltalk.method({
  75400. selector: "testVariableShadowing4",
  75401. protocol: 'tests',
  75402. fn: function (){
  75403. var self=this;
  75404. var src,ast;
  75405. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75407. return smalltalk.withContext(function($ctx1) {
  75408. //>>excludeEnd("ctx");
  75409. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  75410. ast=_st($Smalltalk())._parse_(src);
  75411. _st(self["@analyzer"])._visit_(ast);
  75412. return self;
  75413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75414. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75415. //>>excludeEnd("ctx");
  75416. },
  75417. //>>excludeStart("ide", pragmas.excludeIdeData);
  75418. args: [],
  75419. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  75420. referencedClasses: ["Smalltalk"],
  75421. //>>excludeEnd("ide");
  75422. messageSends: ["parse:", "visit:"]
  75423. }),
  75424. globals.SemanticAnalyzerTest);
  75425. smalltalk.addMethod(
  75426. smalltalk.method({
  75427. selector: "testVariableShadowing5",
  75428. protocol: 'tests',
  75429. fn: function (){
  75430. var self=this;
  75431. var src,ast;
  75432. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75433. function $ShadowingVariableError(){return globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  75434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75435. return smalltalk.withContext(function($ctx1) {
  75436. //>>excludeEnd("ctx");
  75437. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  75438. ast=_st($Smalltalk())._parse_(src);
  75439. self._should_raise_((function(){
  75440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75441. return smalltalk.withContext(function($ctx2) {
  75442. //>>excludeEnd("ctx");
  75443. return _st(self["@analyzer"])._visit_(ast);
  75444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75446. //>>excludeEnd("ctx");
  75447. }),$ShadowingVariableError());
  75448. return self;
  75449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75450. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75451. //>>excludeEnd("ctx");
  75452. },
  75453. //>>excludeStart("ide", pragmas.excludeIdeData);
  75454. args: [],
  75455. 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",
  75456. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  75457. //>>excludeEnd("ide");
  75458. messageSends: ["parse:", "should:raise:", "visit:"]
  75459. }),
  75460. globals.SemanticAnalyzerTest);
  75461. smalltalk.addMethod(
  75462. smalltalk.method({
  75463. selector: "testVariablesLookup",
  75464. protocol: 'tests',
  75465. fn: function (){
  75466. var self=this;
  75467. var src,ast;
  75468. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75470. return smalltalk.withContext(function($ctx1) {
  75471. //>>excludeEnd("ctx");
  75472. 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;
  75473. src="foo | a | a + 1. [ | b | b := a ]";
  75474. ast=_st($Smalltalk())._parse_(src);
  75475. _st(self["@analyzer"])._visit_(ast);
  75476. $7=_st(ast)._nodes();
  75477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75478. $ctx1.sendIdx["nodes"]=2;
  75479. //>>excludeEnd("ctx");
  75480. $6=_st($7)._first();
  75481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75482. $ctx1.sendIdx["first"]=2;
  75483. //>>excludeEnd("ctx");
  75484. $5=_st($6)._nodes();
  75485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75486. $ctx1.sendIdx["nodes"]=1;
  75487. //>>excludeEnd("ctx");
  75488. $4=_st($5)._first();
  75489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75490. $ctx1.sendIdx["first"]=1;
  75491. //>>excludeEnd("ctx");
  75492. $3=_st($4)._receiver();
  75493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75494. $ctx1.sendIdx["receiver"]=1;
  75495. //>>excludeEnd("ctx");
  75496. $2=_st($3)._binding();
  75497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75498. $ctx1.sendIdx["binding"]=1;
  75499. //>>excludeEnd("ctx");
  75500. $1=_st($2)._isTempVar();
  75501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75502. $ctx1.sendIdx["isTempVar"]=1;
  75503. //>>excludeEnd("ctx");
  75504. self._assert_($1);
  75505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75506. $ctx1.sendIdx["assert:"]=1;
  75507. //>>excludeEnd("ctx");
  75508. $15=_st(ast)._nodes();
  75509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75510. $ctx1.sendIdx["nodes"]=4;
  75511. //>>excludeEnd("ctx");
  75512. $14=_st($15)._first();
  75513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75514. $ctx1.sendIdx["first"]=4;
  75515. //>>excludeEnd("ctx");
  75516. $13=_st($14)._nodes();
  75517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75518. $ctx1.sendIdx["nodes"]=3;
  75519. //>>excludeEnd("ctx");
  75520. $12=_st($13)._first();
  75521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75522. $ctx1.sendIdx["first"]=3;
  75523. //>>excludeEnd("ctx");
  75524. $11=_st($12)._receiver();
  75525. $10=_st($11)._binding();
  75526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75527. $ctx1.sendIdx["binding"]=2;
  75528. //>>excludeEnd("ctx");
  75529. $9=_st($10)._scope();
  75530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75531. $ctx1.sendIdx["scope"]=1;
  75532. //>>excludeEnd("ctx");
  75533. $16=_st(ast)._scope();
  75534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75535. $ctx1.sendIdx["scope"]=2;
  75536. //>>excludeEnd("ctx");
  75537. $8=_st($9).__eq_eq($16);
  75538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75539. $ctx1.sendIdx["=="]=1;
  75540. //>>excludeEnd("ctx");
  75541. self._assert_($8);
  75542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75543. $ctx1.sendIdx["assert:"]=2;
  75544. //>>excludeEnd("ctx");
  75545. $27=_st(ast)._nodes();
  75546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75547. $ctx1.sendIdx["nodes"]=8;
  75548. //>>excludeEnd("ctx");
  75549. $26=_st($27)._first();
  75550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75551. $ctx1.sendIdx["first"]=7;
  75552. //>>excludeEnd("ctx");
  75553. $25=_st($26)._nodes();
  75554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75555. $ctx1.sendIdx["nodes"]=7;
  75556. //>>excludeEnd("ctx");
  75557. $24=_st($25)._last();
  75558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75559. $ctx1.sendIdx["last"]=1;
  75560. //>>excludeEnd("ctx");
  75561. $23=_st($24)._nodes();
  75562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75563. $ctx1.sendIdx["nodes"]=6;
  75564. //>>excludeEnd("ctx");
  75565. $22=_st($23)._first();
  75566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75567. $ctx1.sendIdx["first"]=6;
  75568. //>>excludeEnd("ctx");
  75569. $21=_st($22)._nodes();
  75570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75571. $ctx1.sendIdx["nodes"]=5;
  75572. //>>excludeEnd("ctx");
  75573. $20=_st($21)._first();
  75574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75575. $ctx1.sendIdx["first"]=5;
  75576. //>>excludeEnd("ctx");
  75577. $19=_st($20)._left();
  75578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75579. $ctx1.sendIdx["left"]=1;
  75580. //>>excludeEnd("ctx");
  75581. $18=_st($19)._binding();
  75582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75583. $ctx1.sendIdx["binding"]=3;
  75584. //>>excludeEnd("ctx");
  75585. $17=_st($18)._isTempVar();
  75586. self._assert_($17);
  75587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75588. $ctx1.sendIdx["assert:"]=3;
  75589. //>>excludeEnd("ctx");
  75590. $39=_st(ast)._nodes();
  75591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75592. $ctx1.sendIdx["nodes"]=12;
  75593. //>>excludeEnd("ctx");
  75594. $38=_st($39)._first();
  75595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75596. $ctx1.sendIdx["first"]=10;
  75597. //>>excludeEnd("ctx");
  75598. $37=_st($38)._nodes();
  75599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75600. $ctx1.sendIdx["nodes"]=11;
  75601. //>>excludeEnd("ctx");
  75602. $36=_st($37)._last();
  75603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75604. $ctx1.sendIdx["last"]=2;
  75605. //>>excludeEnd("ctx");
  75606. $35=_st($36)._nodes();
  75607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75608. $ctx1.sendIdx["nodes"]=10;
  75609. //>>excludeEnd("ctx");
  75610. $34=_st($35)._first();
  75611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75612. $ctx1.sendIdx["first"]=9;
  75613. //>>excludeEnd("ctx");
  75614. $33=_st($34)._nodes();
  75615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75616. $ctx1.sendIdx["nodes"]=9;
  75617. //>>excludeEnd("ctx");
  75618. $32=_st($33)._first();
  75619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75620. $ctx1.sendIdx["first"]=8;
  75621. //>>excludeEnd("ctx");
  75622. $31=_st($32)._left();
  75623. $30=_st($31)._binding();
  75624. $29=_st($30)._scope();
  75625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75626. $ctx1.sendIdx["scope"]=3;
  75627. //>>excludeEnd("ctx");
  75628. $42=_st(_st(_st(ast)._nodes())._first())._nodes();
  75629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75630. $ctx1.sendIdx["nodes"]=13;
  75631. //>>excludeEnd("ctx");
  75632. $41=_st($42)._last();
  75633. $40=_st($41)._scope();
  75634. $28=_st($29).__eq_eq($40);
  75635. self._assert_($28);
  75636. return self;
  75637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75638. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},globals.SemanticAnalyzerTest)});
  75639. //>>excludeEnd("ctx");
  75640. },
  75641. //>>excludeStart("ide", pragmas.excludeIdeData);
  75642. args: [],
  75643. 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.",
  75644. referencedClasses: ["Smalltalk"],
  75645. //>>excludeEnd("ide");
  75646. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  75647. }),
  75648. globals.SemanticAnalyzerTest);
  75649. smalltalk.addClass('AISemanticAnalyzerTest', globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  75650. smalltalk.addMethod(
  75651. smalltalk.method({
  75652. selector: "setUp",
  75653. protocol: 'running',
  75654. fn: function (){
  75655. var self=this;
  75656. function $AISemanticAnalyzer(){return globals.AISemanticAnalyzer||(typeof AISemanticAnalyzer=="undefined"?nil:AISemanticAnalyzer)}
  75657. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  75658. function $AIContext(){return globals.AIContext||(typeof AIContext=="undefined"?nil:AIContext)}
  75659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75660. return smalltalk.withContext(function($ctx1) {
  75661. //>>excludeEnd("ctx");
  75662. var $1,$2,$4,$5,$3,$6;
  75663. $1=_st($AISemanticAnalyzer())._on_($Object());
  75664. $2=$1;
  75665. $4=_st($AIContext())._new();
  75666. _st($4)._defineLocal_("local");
  75667. _st($4)._localAt_put_("local",(3));
  75668. $5=_st($4)._yourself();
  75669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75670. $ctx1.sendIdx["yourself"]=1;
  75671. //>>excludeEnd("ctx");
  75672. $3=$5;
  75673. _st($2)._context_($3);
  75674. $6=_st($1)._yourself();
  75675. self["@analyzer"]=$6;
  75676. return self;
  75677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75678. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.AISemanticAnalyzerTest)});
  75679. //>>excludeEnd("ctx");
  75680. },
  75681. //>>excludeStart("ide", pragmas.excludeIdeData);
  75682. args: [],
  75683. 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",
  75684. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  75685. //>>excludeEnd("ide");
  75686. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  75687. }),
  75688. globals.AISemanticAnalyzerTest);
  75689. smalltalk.addMethod(
  75690. smalltalk.method({
  75691. selector: "testContextVariables",
  75692. protocol: 'tests',
  75693. fn: function (){
  75694. var self=this;
  75695. var src,ast;
  75696. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  75697. function $UnknownVariableError(){return globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  75698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75699. return smalltalk.withContext(function($ctx1) {
  75700. //>>excludeEnd("ctx");
  75701. src="foo | a | local + a";
  75702. ast=_st($Smalltalk())._parse_(src);
  75703. self._shouldnt_raise_((function(){
  75704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75705. return smalltalk.withContext(function($ctx2) {
  75706. //>>excludeEnd("ctx");
  75707. return _st(self["@analyzer"])._visit_(ast);
  75708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75710. //>>excludeEnd("ctx");
  75711. }),$UnknownVariableError());
  75712. return self;
  75713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75714. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},globals.AISemanticAnalyzerTest)});
  75715. //>>excludeEnd("ctx");
  75716. },
  75717. //>>excludeStart("ide", pragmas.excludeIdeData);
  75718. args: [],
  75719. 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",
  75720. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  75721. //>>excludeEnd("ide");
  75722. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  75723. }),
  75724. globals.AISemanticAnalyzerTest);
  75725. });
  75726. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){
  75727. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  75728. smalltalk.addPackage('SUnit-Tests');
  75729. smalltalk.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  75730. smalltalk.addClass('ExampleSetTest', globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  75731. //>>excludeStart("ide", pragmas.excludeIdeData);
  75732. 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.";
  75733. //>>excludeEnd("ide");
  75734. smalltalk.addMethod(
  75735. smalltalk.method({
  75736. selector: "setUp",
  75737. protocol: 'running',
  75738. fn: function (){
  75739. var self=this;
  75740. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  75741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75742. return smalltalk.withContext(function($ctx1) {
  75743. //>>excludeEnd("ctx");
  75744. self["@empty"]=_st($Set())._new();
  75745. self["@full"]=_st($Set())._with_with_((5),"abc");
  75746. return self;
  75747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75748. }, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ExampleSetTest)});
  75749. //>>excludeEnd("ctx");
  75750. },
  75751. //>>excludeStart("ide", pragmas.excludeIdeData);
  75752. args: [],
  75753. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  75754. referencedClasses: ["Set"],
  75755. //>>excludeEnd("ide");
  75756. messageSends: ["new", "with:with:"]
  75757. }),
  75758. globals.ExampleSetTest);
  75759. smalltalk.addMethod(
  75760. smalltalk.method({
  75761. selector: "testAdd",
  75762. protocol: 'tests',
  75763. fn: function (){
  75764. var self=this;
  75765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75766. return smalltalk.withContext(function($ctx1) {
  75767. //>>excludeEnd("ctx");
  75768. _st(self["@empty"])._add_((5));
  75769. self._assert_(_st(self["@empty"])._includes_((5)));
  75770. return self;
  75771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75772. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},globals.ExampleSetTest)});
  75773. //>>excludeEnd("ctx");
  75774. },
  75775. //>>excludeStart("ide", pragmas.excludeIdeData);
  75776. args: [],
  75777. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  75778. referencedClasses: [],
  75779. //>>excludeEnd("ide");
  75780. messageSends: ["add:", "assert:", "includes:"]
  75781. }),
  75782. globals.ExampleSetTest);
  75783. smalltalk.addMethod(
  75784. smalltalk.method({
  75785. selector: "testGrow",
  75786. protocol: 'tests',
  75787. fn: function (){
  75788. var self=this;
  75789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75790. return smalltalk.withContext(function($ctx1) {
  75791. //>>excludeEnd("ctx");
  75792. _st(self["@empty"])._addAll_((1)._to_((100)));
  75793. self._assert_equals_(_st(self["@empty"])._size(),(100));
  75794. return self;
  75795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75796. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},globals.ExampleSetTest)});
  75797. //>>excludeEnd("ctx");
  75798. },
  75799. //>>excludeStart("ide", pragmas.excludeIdeData);
  75800. args: [],
  75801. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  75802. referencedClasses: [],
  75803. //>>excludeEnd("ide");
  75804. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  75805. }),
  75806. globals.ExampleSetTest);
  75807. smalltalk.addMethod(
  75808. smalltalk.method({
  75809. selector: "testIllegal",
  75810. protocol: 'tests',
  75811. fn: function (){
  75812. var self=this;
  75813. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  75814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75815. return smalltalk.withContext(function($ctx1) {
  75816. //>>excludeEnd("ctx");
  75817. self._should_raise_((function(){
  75818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75819. return smalltalk.withContext(function($ctx2) {
  75820. //>>excludeEnd("ctx");
  75821. return _st(self["@empty"])._at_((5));
  75822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75824. //>>excludeEnd("ctx");
  75825. }),$Error());
  75826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75827. $ctx1.sendIdx["should:raise:"]=1;
  75828. //>>excludeEnd("ctx");
  75829. self._should_raise_((function(){
  75830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75831. return smalltalk.withContext(function($ctx2) {
  75832. //>>excludeEnd("ctx");
  75833. return _st(self["@empty"])._at_put_((5),"abc");
  75834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  75836. //>>excludeEnd("ctx");
  75837. }),$Error());
  75838. return self;
  75839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75840. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},globals.ExampleSetTest)});
  75841. //>>excludeEnd("ctx");
  75842. },
  75843. //>>excludeStart("ide", pragmas.excludeIdeData);
  75844. args: [],
  75845. 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",
  75846. referencedClasses: ["Error"],
  75847. //>>excludeEnd("ide");
  75848. messageSends: ["should:raise:", "at:", "at:put:"]
  75849. }),
  75850. globals.ExampleSetTest);
  75851. smalltalk.addMethod(
  75852. smalltalk.method({
  75853. selector: "testIncludes",
  75854. protocol: 'tests',
  75855. fn: function (){
  75856. var self=this;
  75857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75858. return smalltalk.withContext(function($ctx1) {
  75859. //>>excludeEnd("ctx");
  75860. var $1;
  75861. $1=_st(self["@full"])._includes_((5));
  75862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75863. $ctx1.sendIdx["includes:"]=1;
  75864. //>>excludeEnd("ctx");
  75865. self._assert_($1);
  75866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75867. $ctx1.sendIdx["assert:"]=1;
  75868. //>>excludeEnd("ctx");
  75869. self._assert_(_st(self["@full"])._includes_("abc"));
  75870. return self;
  75871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75872. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},globals.ExampleSetTest)});
  75873. //>>excludeEnd("ctx");
  75874. },
  75875. //>>excludeStart("ide", pragmas.excludeIdeData);
  75876. args: [],
  75877. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  75878. referencedClasses: [],
  75879. //>>excludeEnd("ide");
  75880. messageSends: ["assert:", "includes:"]
  75881. }),
  75882. globals.ExampleSetTest);
  75883. smalltalk.addMethod(
  75884. smalltalk.method({
  75885. selector: "testOccurrences",
  75886. protocol: 'tests',
  75887. fn: function (){
  75888. var self=this;
  75889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75890. return smalltalk.withContext(function($ctx1) {
  75891. //>>excludeEnd("ctx");
  75892. var $1,$2;
  75893. $1=_st(self["@empty"])._occurrencesOf_((0));
  75894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75895. $ctx1.sendIdx["occurrencesOf:"]=1;
  75896. //>>excludeEnd("ctx");
  75897. self._assert_equals_($1,(0));
  75898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75899. $ctx1.sendIdx["assert:equals:"]=1;
  75900. //>>excludeEnd("ctx");
  75901. $2=_st(self["@full"])._occurrencesOf_((5));
  75902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75903. $ctx1.sendIdx["occurrencesOf:"]=2;
  75904. //>>excludeEnd("ctx");
  75905. self._assert_equals_($2,(1));
  75906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75907. $ctx1.sendIdx["assert:equals:"]=2;
  75908. //>>excludeEnd("ctx");
  75909. _st(self["@full"])._add_((5));
  75910. self._assert_equals_(_st(self["@full"])._occurrencesOf_((5)),(1));
  75911. return self;
  75912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75913. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},globals.ExampleSetTest)});
  75914. //>>excludeEnd("ctx");
  75915. },
  75916. //>>excludeStart("ide", pragmas.excludeIdeData);
  75917. args: [],
  75918. 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",
  75919. referencedClasses: [],
  75920. //>>excludeEnd("ide");
  75921. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  75922. }),
  75923. globals.ExampleSetTest);
  75924. smalltalk.addMethod(
  75925. smalltalk.method({
  75926. selector: "testRemove",
  75927. protocol: 'tests',
  75928. fn: function (){
  75929. var self=this;
  75930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75931. return smalltalk.withContext(function($ctx1) {
  75932. //>>excludeEnd("ctx");
  75933. var $1;
  75934. _st(self["@full"])._remove_((5));
  75935. $1=_st(self["@full"])._includes_("abc");
  75936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75937. $ctx1.sendIdx["includes:"]=1;
  75938. //>>excludeEnd("ctx");
  75939. self._assert_($1);
  75940. self._deny_(_st(self["@full"])._includes_((5)));
  75941. return self;
  75942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75943. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},globals.ExampleSetTest)});
  75944. //>>excludeEnd("ctx");
  75945. },
  75946. //>>excludeStart("ide", pragmas.excludeIdeData);
  75947. args: [],
  75948. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  75949. referencedClasses: [],
  75950. //>>excludeEnd("ide");
  75951. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  75952. }),
  75953. globals.ExampleSetTest);
  75954. smalltalk.addClass('SUnitAsyncTest', globals.TestCase, ['flag'], 'SUnit-Tests');
  75955. smalltalk.addMethod(
  75956. smalltalk.method({
  75957. selector: "fakeError",
  75958. protocol: 'helpers',
  75959. fn: function (){
  75960. var self=this;
  75961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75962. return smalltalk.withContext(function($ctx1) {
  75963. //>>excludeEnd("ctx");
  75964. self["@flag"]="bad";
  75965. self._timeout_((30));
  75966. self["@flag"]=_st(self._async_((function(){
  75967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75968. return smalltalk.withContext(function($ctx2) {
  75969. //>>excludeEnd("ctx");
  75970. self["@flag"]="ok";
  75971. self["@flag"];
  75972. return self._error_("Intentional");
  75973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  75975. //>>excludeEnd("ctx");
  75976. })))._valueWithTimeout_((20));
  75977. return self;
  75978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75979. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},globals.SUnitAsyncTest)});
  75980. //>>excludeEnd("ctx");
  75981. },
  75982. //>>excludeStart("ide", pragmas.excludeIdeData);
  75983. args: [],
  75984. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  75985. referencedClasses: [],
  75986. //>>excludeEnd("ide");
  75987. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  75988. }),
  75989. globals.SUnitAsyncTest);
  75990. smalltalk.addMethod(
  75991. smalltalk.method({
  75992. selector: "fakeErrorFailingInTearDown",
  75993. protocol: 'helpers',
  75994. fn: function (){
  75995. var self=this;
  75996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  75997. return smalltalk.withContext(function($ctx1) {
  75998. //>>excludeEnd("ctx");
  75999. self["@flag"]="bad";
  76000. self._timeout_((30));
  76001. self["@flag"]=_st(self._async_((function(){
  76002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76003. return smalltalk.withContext(function($ctx2) {
  76004. //>>excludeEnd("ctx");
  76005. return self._error_("Intentional");
  76006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76008. //>>excludeEnd("ctx");
  76009. })))._valueWithTimeout_((20));
  76010. return self;
  76011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76012. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},globals.SUnitAsyncTest)});
  76013. //>>excludeEnd("ctx");
  76014. },
  76015. //>>excludeStart("ide", pragmas.excludeIdeData);
  76016. args: [],
  76017. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  76018. referencedClasses: [],
  76019. //>>excludeEnd("ide");
  76020. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  76021. }),
  76022. globals.SUnitAsyncTest);
  76023. smalltalk.addMethod(
  76024. smalltalk.method({
  76025. selector: "fakeFailure",
  76026. protocol: 'helpers',
  76027. fn: function (){
  76028. var self=this;
  76029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76030. return smalltalk.withContext(function($ctx1) {
  76031. //>>excludeEnd("ctx");
  76032. self["@flag"]="bad";
  76033. self._timeout_((30));
  76034. self["@flag"]=_st(self._async_((function(){
  76035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76036. return smalltalk.withContext(function($ctx2) {
  76037. //>>excludeEnd("ctx");
  76038. self["@flag"]="ok";
  76039. self["@flag"];
  76040. return self._assert_(false);
  76041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76043. //>>excludeEnd("ctx");
  76044. })))._valueWithTimeout_((20));
  76045. return self;
  76046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76047. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},globals.SUnitAsyncTest)});
  76048. //>>excludeEnd("ctx");
  76049. },
  76050. //>>excludeStart("ide", pragmas.excludeIdeData);
  76051. args: [],
  76052. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  76053. referencedClasses: [],
  76054. //>>excludeEnd("ide");
  76055. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  76056. }),
  76057. globals.SUnitAsyncTest);
  76058. smalltalk.addMethod(
  76059. smalltalk.method({
  76060. selector: "fakeMultipleTimeoutFailing",
  76061. protocol: 'helpers',
  76062. fn: function (){
  76063. var self=this;
  76064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76065. return smalltalk.withContext(function($ctx1) {
  76066. //>>excludeEnd("ctx");
  76067. var $1;
  76068. self._timeout_((100));
  76069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76070. $ctx1.sendIdx["timeout:"]=1;
  76071. //>>excludeEnd("ctx");
  76072. $1=self._async_((function(){
  76073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76074. return smalltalk.withContext(function($ctx2) {
  76075. //>>excludeEnd("ctx");
  76076. self._timeout_((20));
  76077. return _st(self._async_((function(){
  76078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76079. return smalltalk.withContext(function($ctx3) {
  76080. //>>excludeEnd("ctx");
  76081. return self._finished();
  76082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76083. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  76084. //>>excludeEnd("ctx");
  76085. })))._valueWithTimeout_((30));
  76086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76088. //>>excludeEnd("ctx");
  76089. }));
  76090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76091. $ctx1.sendIdx["async:"]=1;
  76092. //>>excludeEnd("ctx");
  76093. _st($1)._valueWithTimeout_((20));
  76094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76095. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76096. //>>excludeEnd("ctx");
  76097. return self;
  76098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76099. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},globals.SUnitAsyncTest)});
  76100. //>>excludeEnd("ctx");
  76101. },
  76102. //>>excludeStart("ide", pragmas.excludeIdeData);
  76103. args: [],
  76104. 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",
  76105. referencedClasses: [],
  76106. //>>excludeEnd("ide");
  76107. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76108. }),
  76109. globals.SUnitAsyncTest);
  76110. smalltalk.addMethod(
  76111. smalltalk.method({
  76112. selector: "fakeMultipleTimeoutPassing",
  76113. protocol: 'helpers',
  76114. fn: function (){
  76115. var self=this;
  76116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76117. return smalltalk.withContext(function($ctx1) {
  76118. //>>excludeEnd("ctx");
  76119. var $1;
  76120. self._timeout_((20));
  76121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76122. $ctx1.sendIdx["timeout:"]=1;
  76123. //>>excludeEnd("ctx");
  76124. $1=self._async_((function(){
  76125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76126. return smalltalk.withContext(function($ctx2) {
  76127. //>>excludeEnd("ctx");
  76128. self._timeout_((40));
  76129. return _st(self._async_((function(){
  76130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76131. return smalltalk.withContext(function($ctx3) {
  76132. //>>excludeEnd("ctx");
  76133. return self._finished();
  76134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76135. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  76136. //>>excludeEnd("ctx");
  76137. })))._valueWithTimeout_((20));
  76138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76140. //>>excludeEnd("ctx");
  76141. }));
  76142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76143. $ctx1.sendIdx["async:"]=1;
  76144. //>>excludeEnd("ctx");
  76145. _st($1)._valueWithTimeout_((10));
  76146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76147. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76148. //>>excludeEnd("ctx");
  76149. return self;
  76150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76151. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},globals.SUnitAsyncTest)});
  76152. //>>excludeEnd("ctx");
  76153. },
  76154. //>>excludeStart("ide", pragmas.excludeIdeData);
  76155. args: [],
  76156. 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",
  76157. referencedClasses: [],
  76158. //>>excludeEnd("ide");
  76159. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76160. }),
  76161. globals.SUnitAsyncTest);
  76162. smalltalk.addMethod(
  76163. smalltalk.method({
  76164. selector: "fakeTimeout",
  76165. protocol: 'helpers',
  76166. fn: function (){
  76167. var self=this;
  76168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76169. return smalltalk.withContext(function($ctx1) {
  76170. //>>excludeEnd("ctx");
  76171. self._timeout_((10));
  76172. _st(self._async_((function(){
  76173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76174. return smalltalk.withContext(function($ctx2) {
  76175. //>>excludeEnd("ctx");
  76176. return self._finished();
  76177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76179. //>>excludeEnd("ctx");
  76180. })))._valueWithTimeout_((20));
  76181. return self;
  76182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76183. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},globals.SUnitAsyncTest)});
  76184. //>>excludeEnd("ctx");
  76185. },
  76186. //>>excludeStart("ide", pragmas.excludeIdeData);
  76187. args: [],
  76188. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  76189. referencedClasses: [],
  76190. //>>excludeEnd("ide");
  76191. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  76192. }),
  76193. globals.SUnitAsyncTest);
  76194. smalltalk.addMethod(
  76195. smalltalk.method({
  76196. selector: "selectorSetOf:",
  76197. protocol: 'private',
  76198. fn: function (aCollection){
  76199. var self=this;
  76200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76201. return smalltalk.withContext(function($ctx1) {
  76202. //>>excludeEnd("ctx");
  76203. var $1;
  76204. $1=_st(_st(aCollection)._collect_((function(each){
  76205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76206. return smalltalk.withContext(function($ctx2) {
  76207. //>>excludeEnd("ctx");
  76208. return _st(each)._selector();
  76209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76211. //>>excludeEnd("ctx");
  76212. })))._asSet();
  76213. return $1;
  76214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76215. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},globals.SUnitAsyncTest)});
  76216. //>>excludeEnd("ctx");
  76217. },
  76218. //>>excludeStart("ide", pragmas.excludeIdeData);
  76219. args: ["aCollection"],
  76220. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  76221. referencedClasses: [],
  76222. //>>excludeEnd("ide");
  76223. messageSends: ["asSet", "collect:", "selector"]
  76224. }),
  76225. globals.SUnitAsyncTest);
  76226. smalltalk.addMethod(
  76227. smalltalk.method({
  76228. selector: "setUp",
  76229. protocol: 'running',
  76230. fn: function (){
  76231. var self=this;
  76232. self["@flag"]="ok";
  76233. return self;
  76234. },
  76235. //>>excludeStart("ide", pragmas.excludeIdeData);
  76236. args: [],
  76237. source: "setUp\x0a\x09flag := 'ok'",
  76238. referencedClasses: [],
  76239. //>>excludeEnd("ide");
  76240. messageSends: []
  76241. }),
  76242. globals.SUnitAsyncTest);
  76243. smalltalk.addMethod(
  76244. smalltalk.method({
  76245. selector: "tearDown",
  76246. protocol: 'running',
  76247. fn: function (){
  76248. var self=this;
  76249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76250. return smalltalk.withContext(function($ctx1) {
  76251. //>>excludeEnd("ctx");
  76252. self._assert_equals_("ok",self["@flag"]);
  76253. return self;
  76254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76255. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.SUnitAsyncTest)});
  76256. //>>excludeEnd("ctx");
  76257. },
  76258. //>>excludeStart("ide", pragmas.excludeIdeData);
  76259. args: [],
  76260. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  76261. referencedClasses: [],
  76262. //>>excludeEnd("ide");
  76263. messageSends: ["assert:equals:"]
  76264. }),
  76265. globals.SUnitAsyncTest);
  76266. smalltalk.addMethod(
  76267. smalltalk.method({
  76268. selector: "testAsyncErrorsAndFailures",
  76269. protocol: 'tests',
  76270. fn: function (){
  76271. var self=this;
  76272. var suite,runner,result,assertBlock;
  76273. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  76274. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  76275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76276. return smalltalk.withContext(function($ctx1) {
  76277. //>>excludeEnd("ctx");
  76278. var $1,$2,$3,$4;
  76279. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  76280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76281. return smalltalk.withContext(function($ctx2) {
  76282. //>>excludeEnd("ctx");
  76283. return _st(self._class())._selector_(each);
  76284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76285. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76286. //>>excludeEnd("ctx");
  76287. }));
  76288. runner=_st($TestSuiteRunner())._on_(suite);
  76289. self._timeout_((200));
  76290. result=_st(runner)._result();
  76291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76292. $ctx1.sendIdx["result"]=1;
  76293. //>>excludeEnd("ctx");
  76294. assertBlock=self._async_((function(){
  76295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76296. return smalltalk.withContext(function($ctx2) {
  76297. //>>excludeEnd("ctx");
  76298. $1=self._selectorSetOf_(_st(result)._errors());
  76299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76300. $ctx2.sendIdx["selectorSetOf:"]=1;
  76301. //>>excludeEnd("ctx");
  76302. $2=["fakeError"]._asSet();
  76303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76304. $ctx2.sendIdx["asSet"]=1;
  76305. //>>excludeEnd("ctx");
  76306. self._assert_equals_($1,$2);
  76307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76308. $ctx2.sendIdx["assert:equals:"]=1;
  76309. //>>excludeEnd("ctx");
  76310. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  76311. return self._finished();
  76312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76313. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76314. //>>excludeEnd("ctx");
  76315. }));
  76316. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  76317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76318. return smalltalk.withContext(function($ctx2) {
  76319. //>>excludeEnd("ctx");
  76320. $3=_st(_st(ann)._result()).__eq_eq(result);
  76321. if(smalltalk.assert($3)){
  76322. $4=_st(_st(result)._runs()).__eq(_st(result)._total());
  76323. return _st($4)._ifTrue_(assertBlock);
  76324. };
  76325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76326. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  76327. //>>excludeEnd("ctx");
  76328. }));
  76329. _st(runner)._run();
  76330. return self;
  76331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76332. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)});
  76333. //>>excludeEnd("ctx");
  76334. },
  76335. //>>excludeStart("ide", pragmas.excludeIdeData);
  76336. args: [],
  76337. 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",
  76338. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  76339. //>>excludeEnd("ide");
  76340. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  76341. }),
  76342. globals.SUnitAsyncTest);
  76343. smalltalk.addMethod(
  76344. smalltalk.method({
  76345. selector: "testAsyncNeedsTimeout",
  76346. protocol: 'tests',
  76347. fn: function (){
  76348. var self=this;
  76349. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  76350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76351. return smalltalk.withContext(function($ctx1) {
  76352. //>>excludeEnd("ctx");
  76353. self._should_raise_((function(){
  76354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76355. return smalltalk.withContext(function($ctx2) {
  76356. //>>excludeEnd("ctx");
  76357. return self._async_((function(){
  76358. }));
  76359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76360. $ctx2.sendIdx["async:"]=1;
  76361. //>>excludeEnd("ctx");
  76362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76364. //>>excludeEnd("ctx");
  76365. }),$Error());
  76366. self._timeout_((0));
  76367. self._shouldnt_raise_((function(){
  76368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76369. return smalltalk.withContext(function($ctx2) {
  76370. //>>excludeEnd("ctx");
  76371. return self._async_((function(){
  76372. }));
  76373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76374. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  76375. //>>excludeEnd("ctx");
  76376. }),$Error());
  76377. self._finished();
  76378. return self;
  76379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76380. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},globals.SUnitAsyncTest)});
  76381. //>>excludeEnd("ctx");
  76382. },
  76383. //>>excludeStart("ide", pragmas.excludeIdeData);
  76384. args: [],
  76385. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  76386. referencedClasses: ["Error"],
  76387. //>>excludeEnd("ide");
  76388. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  76389. }),
  76390. globals.SUnitAsyncTest);
  76391. smalltalk.addMethod(
  76392. smalltalk.method({
  76393. selector: "testFinishedNeedsTimeout",
  76394. protocol: 'tests',
  76395. fn: function (){
  76396. var self=this;
  76397. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  76398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76399. return smalltalk.withContext(function($ctx1) {
  76400. //>>excludeEnd("ctx");
  76401. self._should_raise_((function(){
  76402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76403. return smalltalk.withContext(function($ctx2) {
  76404. //>>excludeEnd("ctx");
  76405. return self._finished();
  76406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76407. $ctx2.sendIdx["finished"]=1;
  76408. //>>excludeEnd("ctx");
  76409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76410. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76411. //>>excludeEnd("ctx");
  76412. }),$Error());
  76413. self._timeout_((0));
  76414. self._shouldnt_raise_((function(){
  76415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76416. return smalltalk.withContext(function($ctx2) {
  76417. //>>excludeEnd("ctx");
  76418. return self._finished();
  76419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76421. //>>excludeEnd("ctx");
  76422. }),$Error());
  76423. return self;
  76424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76425. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},globals.SUnitAsyncTest)});
  76426. //>>excludeEnd("ctx");
  76427. },
  76428. //>>excludeStart("ide", pragmas.excludeIdeData);
  76429. args: [],
  76430. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  76431. referencedClasses: ["Error"],
  76432. //>>excludeEnd("ide");
  76433. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  76434. }),
  76435. globals.SUnitAsyncTest);
  76436. smalltalk.addMethod(
  76437. smalltalk.method({
  76438. selector: "testIsAsyncReturnsCorrectValues",
  76439. protocol: 'tests',
  76440. fn: function (){
  76441. var self=this;
  76442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76443. return smalltalk.withContext(function($ctx1) {
  76444. //>>excludeEnd("ctx");
  76445. var $1,$2;
  76446. $1=self._isAsync();
  76447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76448. $ctx1.sendIdx["isAsync"]=1;
  76449. //>>excludeEnd("ctx");
  76450. self._deny_($1);
  76451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76452. $ctx1.sendIdx["deny:"]=1;
  76453. //>>excludeEnd("ctx");
  76454. self._timeout_((0));
  76455. $2=self._isAsync();
  76456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76457. $ctx1.sendIdx["isAsync"]=2;
  76458. //>>excludeEnd("ctx");
  76459. self._assert_($2);
  76460. self._finished();
  76461. self._deny_(self._isAsync());
  76462. return self;
  76463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76464. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},globals.SUnitAsyncTest)});
  76465. //>>excludeEnd("ctx");
  76466. },
  76467. //>>excludeStart("ide", pragmas.excludeIdeData);
  76468. args: [],
  76469. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  76470. referencedClasses: [],
  76471. //>>excludeEnd("ide");
  76472. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  76473. }),
  76474. globals.SUnitAsyncTest);
  76475. smalltalk.addMethod(
  76476. smalltalk.method({
  76477. selector: "testPass",
  76478. protocol: 'tests',
  76479. fn: function (){
  76480. var self=this;
  76481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76482. return smalltalk.withContext(function($ctx1) {
  76483. //>>excludeEnd("ctx");
  76484. self["@flag"]="bad";
  76485. self._timeout_((10));
  76486. self["@flag"]=_st(self._async_((function(){
  76487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76488. return smalltalk.withContext(function($ctx2) {
  76489. //>>excludeEnd("ctx");
  76490. self._assert_(true);
  76491. self._finished();
  76492. self["@flag"]="ok";
  76493. return self["@flag"];
  76494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76496. //>>excludeEnd("ctx");
  76497. })))._valueWithTimeout_((5));
  76498. return self;
  76499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76500. }, function($ctx1) {$ctx1.fill(self,"testPass",{},globals.SUnitAsyncTest)});
  76501. //>>excludeEnd("ctx");
  76502. },
  76503. //>>excludeStart("ide", pragmas.excludeIdeData);
  76504. args: [],
  76505. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  76506. referencedClasses: [],
  76507. //>>excludeEnd("ide");
  76508. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  76509. }),
  76510. globals.SUnitAsyncTest);
  76511. smalltalk.addMethod(
  76512. smalltalk.method({
  76513. selector: "testTimeouts",
  76514. protocol: 'tests',
  76515. fn: function (){
  76516. var self=this;
  76517. var suite,runner,result,assertBlock;
  76518. function $TestSuiteRunner(){return globals.TestSuiteRunner||(typeof TestSuiteRunner=="undefined"?nil:TestSuiteRunner)}
  76519. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  76520. function $ResultAnnouncement(){return globals.ResultAnnouncement||(typeof ResultAnnouncement=="undefined"?nil:ResultAnnouncement)}
  76521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76522. return smalltalk.withContext(function($ctx1) {
  76523. //>>excludeEnd("ctx");
  76524. var $1,$2,$3;
  76525. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  76526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76527. return smalltalk.withContext(function($ctx2) {
  76528. //>>excludeEnd("ctx");
  76529. return _st(self._class())._selector_(each);
  76530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76532. //>>excludeEnd("ctx");
  76533. }));
  76534. runner=_st($TestSuiteRunner())._on_(suite);
  76535. self._timeout_((200));
  76536. result=_st(runner)._result();
  76537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76538. $ctx1.sendIdx["result"]=1;
  76539. //>>excludeEnd("ctx");
  76540. assertBlock=self._async_((function(){
  76541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76542. return smalltalk.withContext(function($ctx2) {
  76543. //>>excludeEnd("ctx");
  76544. $1=self._selectorSetOf_(_st(result)._errors());
  76545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76546. $ctx2.sendIdx["selectorSetOf:"]=1;
  76547. //>>excludeEnd("ctx");
  76548. self._assert_equals_($1,_st($Set())._new());
  76549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76550. $ctx2.sendIdx["assert:equals:"]=1;
  76551. //>>excludeEnd("ctx");
  76552. self._assert_equals_(self._selectorSetOf_(_st(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  76553. return self._finished();
  76554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76556. //>>excludeEnd("ctx");
  76557. }));
  76558. _st(_st(runner)._announcer())._on_do_($ResultAnnouncement(),(function(ann){
  76559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76560. return smalltalk.withContext(function($ctx2) {
  76561. //>>excludeEnd("ctx");
  76562. $2=_st(_st(ann)._result()).__eq_eq(result);
  76563. if(smalltalk.assert($2)){
  76564. $3=_st(_st(result)._runs()).__eq(_st(result)._total());
  76565. return _st($3)._ifTrue_(assertBlock);
  76566. };
  76567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76568. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  76569. //>>excludeEnd("ctx");
  76570. }));
  76571. _st(runner)._run();
  76572. return self;
  76573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76574. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},globals.SUnitAsyncTest)});
  76575. //>>excludeEnd("ctx");
  76576. },
  76577. //>>excludeStart("ide", pragmas.excludeIdeData);
  76578. args: [],
  76579. 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",
  76580. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  76581. //>>excludeEnd("ide");
  76582. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  76583. }),
  76584. globals.SUnitAsyncTest);
  76585. smalltalk.addMethod(
  76586. smalltalk.method({
  76587. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  76588. protocol: 'tests',
  76589. fn: function (){
  76590. var self=this;
  76591. var x;
  76592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76593. return smalltalk.withContext(function($ctx1) {
  76594. //>>excludeEnd("ctx");
  76595. var $1;
  76596. self["@flag"]="bad";
  76597. self._timeout_((10));
  76598. x=(0);
  76599. $1=self._async_((function(){
  76600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76601. return smalltalk.withContext(function($ctx2) {
  76602. //>>excludeEnd("ctx");
  76603. self._finished();
  76604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76605. $ctx2.sendIdx["finished"]=1;
  76606. //>>excludeEnd("ctx");
  76607. self["@flag"]="ok";
  76608. self["@flag"];
  76609. x=_st(x).__plus((1));
  76610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76611. $ctx2.sendIdx["+"]=1;
  76612. //>>excludeEnd("ctx");
  76613. x;
  76614. return self._assert_equals_(x,(1));
  76615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76616. $ctx2.sendIdx["assert:equals:"]=1;
  76617. //>>excludeEnd("ctx");
  76618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  76620. //>>excludeEnd("ctx");
  76621. }));
  76622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76623. $ctx1.sendIdx["async:"]=1;
  76624. //>>excludeEnd("ctx");
  76625. self["@flag"]=_st($1)._valueWithTimeout_((0));
  76626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76627. $ctx1.sendIdx["valueWithTimeout:"]=1;
  76628. //>>excludeEnd("ctx");
  76629. self["@flag"]=_st(self._async_((function(){
  76630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76631. return smalltalk.withContext(function($ctx2) {
  76632. //>>excludeEnd("ctx");
  76633. self._finished();
  76634. self["@flag"]="ok";
  76635. self["@flag"];
  76636. x=_st(x).__plus((1));
  76637. x;
  76638. return self._assert_equals_(x,(1));
  76639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  76641. //>>excludeEnd("ctx");
  76642. })))._valueWithTimeout_((0));
  76643. return self;
  76644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76645. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},globals.SUnitAsyncTest)});
  76646. //>>excludeEnd("ctx");
  76647. },
  76648. //>>excludeStart("ide", pragmas.excludeIdeData);
  76649. args: [],
  76650. 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.",
  76651. referencedClasses: [],
  76652. //>>excludeEnd("ide");
  76653. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  76654. }),
  76655. globals.SUnitAsyncTest);
  76656. });
  76657. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  76658. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  76659. smalltalk.addPackage('AmberCli');
  76660. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  76661. smalltalk.addClass('AmberCli', globals.Object, [], 'AmberCli');
  76662. //>>excludeStart("ide", pragmas.excludeIdeData);
  76663. 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.";
  76664. //>>excludeEnd("ide");
  76665. smalltalk.addMethod(
  76666. smalltalk.method({
  76667. selector: "commandLineSwitches",
  76668. protocol: 'commandline',
  76669. fn: function (){
  76670. var self=this;
  76671. var switches;
  76672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76673. return smalltalk.withContext(function($ctx1) {
  76674. //>>excludeEnd("ctx");
  76675. var $1;
  76676. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  76677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76678. return smalltalk.withContext(function($ctx2) {
  76679. //>>excludeEnd("ctx");
  76680. return _st(each)._selector();
  76681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76683. //>>excludeEnd("ctx");
  76684. }));
  76685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76686. $ctx1.sendIdx["collect:"]=1;
  76687. //>>excludeEnd("ctx");
  76688. switches=_st(switches)._select_((function(each){
  76689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76690. return smalltalk.withContext(function($ctx2) {
  76691. //>>excludeEnd("ctx");
  76692. return _st(each)._match_("^[^:]*:$");
  76693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76694. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  76695. //>>excludeEnd("ctx");
  76696. }));
  76697. switches=_st(switches)._collect_((function(each){
  76698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76699. return smalltalk.withContext(function($ctx2) {
  76700. //>>excludeEnd("ctx");
  76701. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  76702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  76704. //>>excludeEnd("ctx");
  76705. }));
  76706. $1=switches;
  76707. return $1;
  76708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76709. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.AmberCli.klass)});
  76710. //>>excludeEnd("ctx");
  76711. },
  76712. //>>excludeStart("ide", pragmas.excludeIdeData);
  76713. args: [],
  76714. 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",
  76715. referencedClasses: [],
  76716. //>>excludeEnd("ide");
  76717. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  76718. }),
  76719. globals.AmberCli.klass);
  76720. smalltalk.addMethod(
  76721. smalltalk.method({
  76722. selector: "config:",
  76723. protocol: 'commands',
  76724. fn: function (args){
  76725. var self=this;
  76726. function $Configurator(){return globals.Configurator||(typeof Configurator=="undefined"?nil:Configurator)}
  76727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76728. return smalltalk.withContext(function($ctx1) {
  76729. //>>excludeEnd("ctx");
  76730. _st(_st($Configurator())._new())._start();
  76731. return self;
  76732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76733. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},globals.AmberCli.klass)});
  76734. //>>excludeEnd("ctx");
  76735. },
  76736. //>>excludeStart("ide", pragmas.excludeIdeData);
  76737. args: ["args"],
  76738. source: "config: args\x0a\x09Configurator new start",
  76739. referencedClasses: ["Configurator"],
  76740. //>>excludeEnd("ide");
  76741. messageSends: ["start", "new"]
  76742. }),
  76743. globals.AmberCli.klass);
  76744. smalltalk.addMethod(
  76745. smalltalk.method({
  76746. selector: "handleArguments:",
  76747. protocol: 'commandline',
  76748. fn: function (args){
  76749. var self=this;
  76750. var selector;
  76751. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  76752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76753. return smalltalk.withContext(function($ctx1) {
  76754. //>>excludeEnd("ctx");
  76755. var $1;
  76756. $1=_st(args)._first();
  76757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76758. $ctx1.sendIdx["first"]=1;
  76759. //>>excludeEnd("ctx");
  76760. selector=self._selectorForCommandLineSwitch_($1);
  76761. _st(args)._remove_(_st(args)._first());
  76762. self._perform_withArguments_(selector,_st($Array())._with_(args));
  76763. return self;
  76764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76765. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},globals.AmberCli.klass)});
  76766. //>>excludeEnd("ctx");
  76767. },
  76768. //>>excludeStart("ide", pragmas.excludeIdeData);
  76769. args: ["args"],
  76770. 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)",
  76771. referencedClasses: ["Array"],
  76772. //>>excludeEnd("ide");
  76773. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  76774. }),
  76775. globals.AmberCli.klass);
  76776. smalltalk.addMethod(
  76777. smalltalk.method({
  76778. selector: "help:",
  76779. protocol: 'commands',
  76780. fn: function (args){
  76781. var self=this;
  76782. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  76783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76784. return smalltalk.withContext(function($ctx1) {
  76785. //>>excludeEnd("ctx");
  76786. _st($Transcript())._show_("Available commands");
  76787. _st(self._commandLineSwitches())._do_((function(each){
  76788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76789. return smalltalk.withContext(function($ctx2) {
  76790. //>>excludeEnd("ctx");
  76791. return _st(console)._log_(each);
  76792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  76794. //>>excludeEnd("ctx");
  76795. }));
  76796. return self;
  76797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76798. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},globals.AmberCli.klass)});
  76799. //>>excludeEnd("ctx");
  76800. },
  76801. //>>excludeStart("ide", pragmas.excludeIdeData);
  76802. args: ["args"],
  76803. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  76804. referencedClasses: ["Transcript"],
  76805. //>>excludeEnd("ide");
  76806. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  76807. }),
  76808. globals.AmberCli.klass);
  76809. smalltalk.addMethod(
  76810. smalltalk.method({
  76811. selector: "init:",
  76812. protocol: 'commands',
  76813. fn: function (args){
  76814. var self=this;
  76815. function $Initer(){return globals.Initer||(typeof Initer=="undefined"?nil:Initer)}
  76816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76817. return smalltalk.withContext(function($ctx1) {
  76818. //>>excludeEnd("ctx");
  76819. _st(_st($Initer())._new())._start();
  76820. return self;
  76821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76822. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},globals.AmberCli.klass)});
  76823. //>>excludeEnd("ctx");
  76824. },
  76825. //>>excludeStart("ide", pragmas.excludeIdeData);
  76826. args: ["args"],
  76827. source: "init: args\x0a\x09Initer new start",
  76828. referencedClasses: ["Initer"],
  76829. //>>excludeEnd("ide");
  76830. messageSends: ["start", "new"]
  76831. }),
  76832. globals.AmberCli.klass);
  76833. smalltalk.addMethod(
  76834. smalltalk.method({
  76835. selector: "main",
  76836. protocol: 'startup',
  76837. fn: function (){
  76838. var self=this;
  76839. var args,nodeMinorVersion;
  76840. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  76841. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  76842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76843. return smalltalk.withContext(function($ctx1) {
  76844. //>>excludeEnd("ctx");
  76845. var $5,$4,$3,$2,$1,$8,$7,$6,$9,$10,$11;
  76846. $5=_st($Smalltalk())._version();
  76847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76848. $ctx1.sendIdx["version"]=1;
  76849. //>>excludeEnd("ctx");
  76850. $4="Welcome to Amber version ".__comma($5);
  76851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76852. $ctx1.sendIdx[","]=4;
  76853. //>>excludeEnd("ctx");
  76854. $3=_st($4).__comma(" (NodeJS ");
  76855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76856. $ctx1.sendIdx[","]=3;
  76857. //>>excludeEnd("ctx");
  76858. $2=_st($3).__comma(_st(_st(process)._versions())._node());
  76859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76860. $ctx1.sendIdx[","]=2;
  76861. //>>excludeEnd("ctx");
  76862. $1=_st($2).__comma(").");
  76863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76864. $ctx1.sendIdx[","]=1;
  76865. //>>excludeEnd("ctx");
  76866. _st($Transcript())._show_($1);
  76867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76868. $ctx1.sendIdx["show:"]=1;
  76869. //>>excludeEnd("ctx");
  76870. $8=_st(process)._version();
  76871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76872. $ctx1.sendIdx["version"]=2;
  76873. //>>excludeEnd("ctx");
  76874. $7=_st($8)._tokenize_(".");
  76875. $6=_st($7)._second();
  76876. nodeMinorVersion=_st($6)._asNumber();
  76877. $9=_st(nodeMinorVersion).__lt((8));
  76878. if(smalltalk.assert($9)){
  76879. _st($Transcript())._show_("You are currently using Node.js ".__comma(_st(process)._version()));
  76880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76881. $ctx1.sendIdx["show:"]=2;
  76882. //>>excludeEnd("ctx");
  76883. _st($Transcript())._show_("Required is at least Node.js v0.8.x or greater.");
  76884. return (-1);
  76885. };
  76886. args=_st(process)._argv();
  76887. _st(args)._removeFrom_to_((1),(2));
  76888. $10=_st(args)._isEmpty();
  76889. if(smalltalk.assert($10)){
  76890. self._help_(nil);
  76891. } else {
  76892. $11=self._handleArguments_(args);
  76893. return $11;
  76894. };
  76895. return self;
  76896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76897. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},globals.AmberCli.klass)});
  76898. //>>excludeEnd("ctx");
  76899. },
  76900. //>>excludeStart("ide", pragmas.excludeIdeData);
  76901. args: [],
  76902. 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]",
  76903. referencedClasses: ["Transcript", "Smalltalk"],
  76904. //>>excludeEnd("ide");
  76905. messageSends: ["show:", ",", "version", "node", "versions", "asNumber", "second", "tokenize:", "ifTrue:", "<", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  76906. }),
  76907. globals.AmberCli.klass);
  76908. smalltalk.addMethod(
  76909. smalltalk.method({
  76910. selector: "repl:",
  76911. protocol: 'commands',
  76912. fn: function (args){
  76913. var self=this;
  76914. function $Repl(){return globals.Repl||(typeof Repl=="undefined"?nil:Repl)}
  76915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76916. return smalltalk.withContext(function($ctx1) {
  76917. //>>excludeEnd("ctx");
  76918. var $1;
  76919. $1=_st(_st($Repl())._new())._createInterface();
  76920. return $1;
  76921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76922. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},globals.AmberCli.klass)});
  76923. //>>excludeEnd("ctx");
  76924. },
  76925. //>>excludeStart("ide", pragmas.excludeIdeData);
  76926. args: ["args"],
  76927. source: "repl: args\x0a\x09^ Repl new createInterface",
  76928. referencedClasses: ["Repl"],
  76929. //>>excludeEnd("ide");
  76930. messageSends: ["createInterface", "new"]
  76931. }),
  76932. globals.AmberCli.klass);
  76933. smalltalk.addMethod(
  76934. smalltalk.method({
  76935. selector: "selectorForCommandLineSwitch:",
  76936. protocol: 'commandline',
  76937. fn: function (aSwitch){
  76938. var self=this;
  76939. var command,selector;
  76940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76941. return smalltalk.withContext(function($ctx1) {
  76942. //>>excludeEnd("ctx");
  76943. var $1,$2;
  76944. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  76945. if(smalltalk.assert($1)){
  76946. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  76947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76948. return smalltalk.withContext(function($ctx2) {
  76949. //>>excludeEnd("ctx");
  76950. return _st(_st(each)._second())._asUppercase();
  76951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  76953. //>>excludeEnd("ctx");
  76954. }))).__comma(":");
  76955. selector;
  76956. } else {
  76957. selector="help:";
  76958. selector;
  76959. };
  76960. $2=selector;
  76961. return $2;
  76962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76963. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},globals.AmberCli.klass)});
  76964. //>>excludeEnd("ctx");
  76965. },
  76966. //>>excludeStart("ide", pragmas.excludeIdeData);
  76967. args: ["aSwitch"],
  76968. 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",
  76969. referencedClasses: [],
  76970. //>>excludeEnd("ide");
  76971. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  76972. }),
  76973. globals.AmberCli.klass);
  76974. smalltalk.addMethod(
  76975. smalltalk.method({
  76976. selector: "serve:",
  76977. protocol: 'commands',
  76978. fn: function (args){
  76979. var self=this;
  76980. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  76981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76982. return smalltalk.withContext(function($ctx1) {
  76983. //>>excludeEnd("ctx");
  76984. var $1;
  76985. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  76986. return $1;
  76987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  76988. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},globals.AmberCli.klass)});
  76989. //>>excludeEnd("ctx");
  76990. },
  76991. //>>excludeStart("ide", pragmas.excludeIdeData);
  76992. args: ["args"],
  76993. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  76994. referencedClasses: ["FileServer"],
  76995. //>>excludeEnd("ide");
  76996. messageSends: ["start", "createServerWithArguments:"]
  76997. }),
  76998. globals.AmberCli.klass);
  76999. smalltalk.addMethod(
  77000. smalltalk.method({
  77001. selector: "version:",
  77002. protocol: 'commands',
  77003. fn: function (arguments){
  77004. var self=this;
  77005. return self;
  77006. },
  77007. //>>excludeStart("ide", pragmas.excludeIdeData);
  77008. args: ["arguments"],
  77009. source: "version: arguments",
  77010. referencedClasses: [],
  77011. //>>excludeEnd("ide");
  77012. messageSends: []
  77013. }),
  77014. globals.AmberCli.klass);
  77015. smalltalk.addClass('BaseFileManipulator', globals.Object, ['path', 'fs'], 'AmberCli');
  77016. smalltalk.addMethod(
  77017. smalltalk.method({
  77018. selector: "dirname",
  77019. protocol: 'private',
  77020. fn: function (){
  77021. var self=this;
  77022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77023. return smalltalk.withContext(function($ctx1) {
  77024. //>>excludeEnd("ctx");
  77025. return __dirname;
  77026. return self;
  77027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77028. }, function($ctx1) {$ctx1.fill(self,"dirname",{},globals.BaseFileManipulator)});
  77029. //>>excludeEnd("ctx");
  77030. },
  77031. //>>excludeStart("ide", pragmas.excludeIdeData);
  77032. args: [],
  77033. source: "dirname\x0a\x09<return __dirname>",
  77034. referencedClasses: [],
  77035. //>>excludeEnd("ide");
  77036. messageSends: []
  77037. }),
  77038. globals.BaseFileManipulator);
  77039. smalltalk.addMethod(
  77040. smalltalk.method({
  77041. selector: "initialize",
  77042. protocol: 'initialization',
  77043. fn: function (){
  77044. var self=this;
  77045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77046. return smalltalk.withContext(function($ctx1) {
  77047. //>>excludeEnd("ctx");
  77048. (
  77049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77050. $ctx1.supercall = true,
  77051. //>>excludeEnd("ctx");
  77052. globals.BaseFileManipulator.superclass.fn.prototype._initialize.apply(_st(self), []));
  77053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77054. $ctx1.supercall = false;
  77055. //>>excludeEnd("ctx");;
  77056. self["@path"]=_st(require)._value_("path");
  77057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77058. $ctx1.sendIdx["value:"]=1;
  77059. //>>excludeEnd("ctx");
  77060. self["@fs"]=_st(require)._value_("fs");
  77061. return self;
  77062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77063. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BaseFileManipulator)});
  77064. //>>excludeEnd("ctx");
  77065. },
  77066. //>>excludeStart("ide", pragmas.excludeIdeData);
  77067. args: [],
  77068. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  77069. referencedClasses: [],
  77070. //>>excludeEnd("ide");
  77071. messageSends: ["initialize", "value:"]
  77072. }),
  77073. globals.BaseFileManipulator);
  77074. smalltalk.addMethod(
  77075. smalltalk.method({
  77076. selector: "rootDirname",
  77077. protocol: 'private',
  77078. fn: function (){
  77079. var self=this;
  77080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77081. return smalltalk.withContext(function($ctx1) {
  77082. //>>excludeEnd("ctx");
  77083. var $1;
  77084. $1=_st(self["@path"])._join_with_(self._dirname(),"..");
  77085. return $1;
  77086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77087. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},globals.BaseFileManipulator)});
  77088. //>>excludeEnd("ctx");
  77089. },
  77090. //>>excludeStart("ide", pragmas.excludeIdeData);
  77091. args: [],
  77092. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  77093. referencedClasses: [],
  77094. //>>excludeEnd("ide");
  77095. messageSends: ["join:with:", "dirname"]
  77096. }),
  77097. globals.BaseFileManipulator);
  77098. smalltalk.addClass('Configurator', globals.BaseFileManipulator, [], 'AmberCli');
  77099. smalltalk.addMethod(
  77100. smalltalk.method({
  77101. selector: "initialize",
  77102. protocol: 'initialization',
  77103. fn: function (){
  77104. var self=this;
  77105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77106. return smalltalk.withContext(function($ctx1) {
  77107. //>>excludeEnd("ctx");
  77108. (
  77109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77110. $ctx1.supercall = true,
  77111. //>>excludeEnd("ctx");
  77112. globals.Configurator.superclass.fn.prototype._initialize.apply(_st(self), []));
  77113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77114. $ctx1.supercall = false;
  77115. //>>excludeEnd("ctx");;
  77116. return self;
  77117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77118. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Configurator)});
  77119. //>>excludeEnd("ctx");
  77120. },
  77121. //>>excludeStart("ide", pragmas.excludeIdeData);
  77122. args: [],
  77123. source: "initialize\x0a\x09super initialize",
  77124. referencedClasses: [],
  77125. //>>excludeEnd("ide");
  77126. messageSends: ["initialize"]
  77127. }),
  77128. globals.Configurator);
  77129. smalltalk.addMethod(
  77130. smalltalk.method({
  77131. selector: "start",
  77132. protocol: 'action',
  77133. fn: function (){
  77134. var self=this;
  77135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77136. return smalltalk.withContext(function($ctx1) {
  77137. //>>excludeEnd("ctx");
  77138. var $receiver;
  77139. self._writeConfigThenDo_((function(err){
  77140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77141. return smalltalk.withContext(function($ctx2) {
  77142. //>>excludeEnd("ctx");
  77143. if(($receiver = err) == null || $receiver.isNil){
  77144. return _st(process)._exit();
  77145. } else {
  77146. return _st(process)._exit_((111));
  77147. };
  77148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77149. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  77150. //>>excludeEnd("ctx");
  77151. }));
  77152. return self;
  77153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77154. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.Configurator)});
  77155. //>>excludeEnd("ctx");
  77156. },
  77157. //>>excludeStart("ide", pragmas.excludeIdeData);
  77158. args: [],
  77159. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  77160. referencedClasses: [],
  77161. //>>excludeEnd("ide");
  77162. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  77163. }),
  77164. globals.Configurator);
  77165. smalltalk.addMethod(
  77166. smalltalk.method({
  77167. selector: "writeConfigThenDo:",
  77168. protocol: 'action',
  77169. fn: function (aBlock){
  77170. var self=this;
  77171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77172. return smalltalk.withContext(function($ctx1) {
  77173. //>>excludeEnd("ctx");
  77174. _st(_st(require)._value_("amber-dev/lib/config"))._writeConfig_toFile_thenDo_(_st(process)._cwd(),"config.js",aBlock);
  77175. return self;
  77176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77177. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},globals.Configurator)});
  77178. //>>excludeEnd("ctx");
  77179. },
  77180. //>>excludeStart("ide", pragmas.excludeIdeData);
  77181. args: ["aBlock"],
  77182. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev/lib/config')\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  77183. referencedClasses: [],
  77184. //>>excludeEnd("ide");
  77185. messageSends: ["writeConfig:toFile:thenDo:", "value:", "cwd"]
  77186. }),
  77187. globals.Configurator);
  77188. smalltalk.addClass('FileServer', globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  77189. //>>excludeStart("ide", pragmas.excludeIdeData);
  77190. 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.";
  77191. //>>excludeEnd("ide");
  77192. smalltalk.addMethod(
  77193. smalltalk.method({
  77194. selector: "base64Decode:",
  77195. protocol: 'private',
  77196. fn: function (aString){
  77197. var self=this;
  77198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77199. return smalltalk.withContext(function($ctx1) {
  77200. //>>excludeEnd("ctx");
  77201. return (new Buffer(aString, 'base64').toString());
  77202. return self;
  77203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77204. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},globals.FileServer)});
  77205. //>>excludeEnd("ctx");
  77206. },
  77207. //>>excludeStart("ide", pragmas.excludeIdeData);
  77208. args: ["aString"],
  77209. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  77210. referencedClasses: [],
  77211. //>>excludeEnd("ide");
  77212. messageSends: []
  77213. }),
  77214. globals.FileServer);
  77215. smalltalk.addMethod(
  77216. smalltalk.method({
  77217. selector: "basePath",
  77218. protocol: 'accessing',
  77219. fn: function (){
  77220. var self=this;
  77221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77222. return smalltalk.withContext(function($ctx1) {
  77223. //>>excludeEnd("ctx");
  77224. var $2,$1,$receiver;
  77225. $2=self["@basePath"];
  77226. if(($receiver = $2) == null || $receiver.isNil){
  77227. $1=_st(self._class())._defaultBasePath();
  77228. } else {
  77229. $1=$2;
  77230. };
  77231. return $1;
  77232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77233. }, function($ctx1) {$ctx1.fill(self,"basePath",{},globals.FileServer)});
  77234. //>>excludeEnd("ctx");
  77235. },
  77236. //>>excludeStart("ide", pragmas.excludeIdeData);
  77237. args: [],
  77238. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  77239. referencedClasses: [],
  77240. //>>excludeEnd("ide");
  77241. messageSends: ["ifNil:", "defaultBasePath", "class"]
  77242. }),
  77243. globals.FileServer);
  77244. smalltalk.addMethod(
  77245. smalltalk.method({
  77246. selector: "basePath:",
  77247. protocol: 'accessing',
  77248. fn: function (aString){
  77249. var self=this;
  77250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77251. return smalltalk.withContext(function($ctx1) {
  77252. //>>excludeEnd("ctx");
  77253. self["@basePath"]=aString;
  77254. self._validateBasePath();
  77255. return self;
  77256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77257. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},globals.FileServer)});
  77258. //>>excludeEnd("ctx");
  77259. },
  77260. //>>excludeStart("ide", pragmas.excludeIdeData);
  77261. args: ["aString"],
  77262. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  77263. referencedClasses: [],
  77264. //>>excludeEnd("ide");
  77265. messageSends: ["validateBasePath"]
  77266. }),
  77267. globals.FileServer);
  77268. smalltalk.addMethod(
  77269. smalltalk.method({
  77270. selector: "checkDirectoryLayout",
  77271. protocol: 'initialization',
  77272. fn: function (){
  77273. var self=this;
  77274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77275. return smalltalk.withContext(function($ctx1) {
  77276. //>>excludeEnd("ctx");
  77277. var $1;
  77278. $1=_st(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  77279. if(! smalltalk.assert($1)){
  77280. _st(console)._warn_("Warning: project directory does not contain index.html.");
  77281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77282. $ctx1.sendIdx["warn:"]=1;
  77283. //>>excludeEnd("ctx");
  77284. _st(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  77285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77286. $ctx1.sendIdx["warn:"]=2;
  77287. //>>excludeEnd("ctx");
  77288. _st(console)._warn_(" You can also specify a page to be served by default,");
  77289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77290. $ctx1.sendIdx["warn:"]=3;
  77291. //>>excludeEnd("ctx");
  77292. _st(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  77293. };
  77294. return self;
  77295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77296. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},globals.FileServer)});
  77297. //>>excludeEnd("ctx");
  77298. },
  77299. //>>excludeStart("ide", pragmas.excludeIdeData);
  77300. args: [],
  77301. 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.'].",
  77302. referencedClasses: [],
  77303. //>>excludeEnd("ide");
  77304. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  77305. }),
  77306. globals.FileServer);
  77307. smalltalk.addMethod(
  77308. smalltalk.method({
  77309. selector: "fallbackPage",
  77310. protocol: 'accessing',
  77311. fn: function (){
  77312. var self=this;
  77313. var $1;
  77314. $1=self["@fallbackPage"];
  77315. return $1;
  77316. },
  77317. //>>excludeStart("ide", pragmas.excludeIdeData);
  77318. args: [],
  77319. source: "fallbackPage\x0a\x09^ fallbackPage",
  77320. referencedClasses: [],
  77321. //>>excludeEnd("ide");
  77322. messageSends: []
  77323. }),
  77324. globals.FileServer);
  77325. smalltalk.addMethod(
  77326. smalltalk.method({
  77327. selector: "fallbackPage:",
  77328. protocol: 'accessing',
  77329. fn: function (aString){
  77330. var self=this;
  77331. self["@fallbackPage"]=aString;
  77332. return self;
  77333. },
  77334. //>>excludeStart("ide", pragmas.excludeIdeData);
  77335. args: ["aString"],
  77336. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  77337. referencedClasses: [],
  77338. //>>excludeEnd("ide");
  77339. messageSends: []
  77340. }),
  77341. globals.FileServer);
  77342. smalltalk.addMethod(
  77343. smalltalk.method({
  77344. selector: "handleGETRequest:respondTo:",
  77345. protocol: 'request handling',
  77346. fn: function (aRequest,aResponse){
  77347. var self=this;
  77348. var uri,filename;
  77349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77350. return smalltalk.withContext(function($ctx1) {
  77351. //>>excludeEnd("ctx");
  77352. var $1;
  77353. uri=_st(self["@url"])._parse_(_st(aRequest)._url());
  77354. filename=_st(self["@path"])._join_with_(self._basePath(),_st(uri)._pathname());
  77355. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  77356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77357. return smalltalk.withContext(function($ctx2) {
  77358. //>>excludeEnd("ctx");
  77359. if(smalltalk.assert(aBoolean)){
  77360. $1=_st(_st(self["@fs"])._statSync_(filename))._isDirectory();
  77361. if(smalltalk.assert($1)){
  77362. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  77363. } else {
  77364. return self._respondFileNamed_to_(filename,aResponse);
  77365. };
  77366. } else {
  77367. return self._respondNotFoundTo_(aResponse);
  77368. };
  77369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77370. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  77371. //>>excludeEnd("ctx");
  77372. }));
  77373. return self;
  77374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77375. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},globals.FileServer)});
  77376. //>>excludeEnd("ctx");
  77377. },
  77378. //>>excludeStart("ide", pragmas.excludeIdeData);
  77379. args: ["aRequest", "aResponse"],
  77380. 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]]]",
  77381. referencedClasses: [],
  77382. //>>excludeEnd("ide");
  77383. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  77384. }),
  77385. globals.FileServer);
  77386. smalltalk.addMethod(
  77387. smalltalk.method({
  77388. selector: "handleOPTIONSRequest:respondTo:",
  77389. protocol: 'request handling',
  77390. fn: function (aRequest,aResponse){
  77391. var self=this;
  77392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77393. return smalltalk.withContext(function($ctx1) {
  77394. //>>excludeEnd("ctx");
  77395. _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)]));
  77396. _st(aResponse)._end();
  77397. return self;
  77398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77399. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)});
  77400. //>>excludeEnd("ctx");
  77401. },
  77402. //>>excludeStart("ide", pragmas.excludeIdeData);
  77403. args: ["aRequest", "aResponse"],
  77404. 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",
  77405. referencedClasses: [],
  77406. //>>excludeEnd("ide");
  77407. messageSends: ["writeHead:options:", "end"]
  77408. }),
  77409. globals.FileServer);
  77410. smalltalk.addMethod(
  77411. smalltalk.method({
  77412. selector: "handlePUTRequest:respondTo:",
  77413. protocol: 'request handling',
  77414. fn: function (aRequest,aResponse){
  77415. var self=this;
  77416. var file,stream;
  77417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77418. return smalltalk.withContext(function($ctx1) {
  77419. //>>excludeEnd("ctx");
  77420. var $1,$2,$3,$4;
  77421. $1=self._isAuthenticated_(aRequest);
  77422. if(! smalltalk.assert($1)){
  77423. self._respondAuthenticationRequiredTo_(aResponse);
  77424. return nil;
  77425. };
  77426. file=".".__comma(_st(aRequest)._url());
  77427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77428. $ctx1.sendIdx[","]=1;
  77429. //>>excludeEnd("ctx");
  77430. stream=_st(self["@fs"])._createWriteStream_(file);
  77431. _st(stream)._on_do_("error",(function(error){
  77432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77433. return smalltalk.withContext(function($ctx2) {
  77434. //>>excludeEnd("ctx");
  77435. $2=console;
  77436. $3="Error creating WriteStream for file ".__comma(file);
  77437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77438. $ctx2.sendIdx[","]=2;
  77439. //>>excludeEnd("ctx");
  77440. _st($2)._warn_($3);
  77441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77442. $ctx2.sendIdx["warn:"]=1;
  77443. //>>excludeEnd("ctx");
  77444. _st(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  77445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77446. $ctx2.sendIdx["warn:"]=2;
  77447. //>>excludeEnd("ctx");
  77448. _st(console)._warn_(" The exact error is: ".__comma(error));
  77449. return self._respondNotCreatedTo_(aResponse);
  77450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77451. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  77452. //>>excludeEnd("ctx");
  77453. }));
  77454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77455. $ctx1.sendIdx["on:do:"]=1;
  77456. //>>excludeEnd("ctx");
  77457. _st(stream)._on_do_("close",(function(){
  77458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77459. return smalltalk.withContext(function($ctx2) {
  77460. //>>excludeEnd("ctx");
  77461. return self._respondCreatedTo_(aResponse);
  77462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  77464. //>>excludeEnd("ctx");
  77465. }));
  77466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77467. $ctx1.sendIdx["on:do:"]=2;
  77468. //>>excludeEnd("ctx");
  77469. _st(aRequest)._setEncoding_("utf8");
  77470. _st(aRequest)._on_do_("data",(function(data){
  77471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77472. return smalltalk.withContext(function($ctx2) {
  77473. //>>excludeEnd("ctx");
  77474. return _st(stream)._write_(data);
  77475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77476. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  77477. //>>excludeEnd("ctx");
  77478. }));
  77479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77480. $ctx1.sendIdx["on:do:"]=3;
  77481. //>>excludeEnd("ctx");
  77482. _st(aRequest)._on_do_("end",(function(){
  77483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77484. return smalltalk.withContext(function($ctx2) {
  77485. //>>excludeEnd("ctx");
  77486. $4=_st(stream)._writable();
  77487. if(smalltalk.assert($4)){
  77488. return _st(stream)._end();
  77489. };
  77490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  77492. //>>excludeEnd("ctx");
  77493. }));
  77494. return self;
  77495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77496. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},globals.FileServer)});
  77497. //>>excludeEnd("ctx");
  77498. },
  77499. //>>excludeStart("ide", pragmas.excludeIdeData);
  77500. args: ["aRequest", "aResponse"],
  77501. 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]]",
  77502. referencedClasses: [],
  77503. //>>excludeEnd("ide");
  77504. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  77505. }),
  77506. globals.FileServer);
  77507. smalltalk.addMethod(
  77508. smalltalk.method({
  77509. selector: "handleRequest:respondTo:",
  77510. protocol: 'request handling',
  77511. fn: function (aRequest,aResponse){
  77512. var self=this;
  77513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77514. return smalltalk.withContext(function($ctx1) {
  77515. //>>excludeEnd("ctx");
  77516. var $2,$1,$4,$3,$5;
  77517. $2=_st(aRequest)._method();
  77518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77519. $ctx1.sendIdx["method"]=1;
  77520. //>>excludeEnd("ctx");
  77521. $1=_st($2).__eq("PUT");
  77522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77523. $ctx1.sendIdx["="]=1;
  77524. //>>excludeEnd("ctx");
  77525. if(smalltalk.assert($1)){
  77526. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  77527. };
  77528. $4=_st(aRequest)._method();
  77529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77530. $ctx1.sendIdx["method"]=2;
  77531. //>>excludeEnd("ctx");
  77532. $3=_st($4).__eq("GET");
  77533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77534. $ctx1.sendIdx["="]=2;
  77535. //>>excludeEnd("ctx");
  77536. if(smalltalk.assert($3)){
  77537. self._handleGETRequest_respondTo_(aRequest,aResponse);
  77538. };
  77539. $5=_st(_st(aRequest)._method()).__eq("OPTIONS");
  77540. if(smalltalk.assert($5)){
  77541. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  77542. };
  77543. return self;
  77544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77545. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},globals.FileServer)});
  77546. //>>excludeEnd("ctx");
  77547. },
  77548. //>>excludeStart("ide", pragmas.excludeIdeData);
  77549. args: ["aRequest", "aResponse"],
  77550. 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]",
  77551. referencedClasses: [],
  77552. //>>excludeEnd("ide");
  77553. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  77554. }),
  77555. globals.FileServer);
  77556. smalltalk.addMethod(
  77557. smalltalk.method({
  77558. selector: "host",
  77559. protocol: 'accessing',
  77560. fn: function (){
  77561. var self=this;
  77562. var $1;
  77563. $1=self["@host"];
  77564. return $1;
  77565. },
  77566. //>>excludeStart("ide", pragmas.excludeIdeData);
  77567. args: [],
  77568. source: "host\x0a\x09^ host",
  77569. referencedClasses: [],
  77570. //>>excludeEnd("ide");
  77571. messageSends: []
  77572. }),
  77573. globals.FileServer);
  77574. smalltalk.addMethod(
  77575. smalltalk.method({
  77576. selector: "host:",
  77577. protocol: 'accessing',
  77578. fn: function (hostname){
  77579. var self=this;
  77580. self["@host"]=hostname;
  77581. return self;
  77582. },
  77583. //>>excludeStart("ide", pragmas.excludeIdeData);
  77584. args: ["hostname"],
  77585. source: "host: hostname\x0a\x09host := hostname",
  77586. referencedClasses: [],
  77587. //>>excludeEnd("ide");
  77588. messageSends: []
  77589. }),
  77590. globals.FileServer);
  77591. smalltalk.addMethod(
  77592. smalltalk.method({
  77593. selector: "initialize",
  77594. protocol: 'initialization',
  77595. fn: function (){
  77596. var self=this;
  77597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77598. return smalltalk.withContext(function($ctx1) {
  77599. //>>excludeEnd("ctx");
  77600. var $1;
  77601. (
  77602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77603. $ctx1.supercall = true,
  77604. //>>excludeEnd("ctx");
  77605. globals.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []));
  77606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77607. $ctx1.supercall = false;
  77608. //>>excludeEnd("ctx");;
  77609. self["@http"]=self._require_("http");
  77610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77611. $ctx1.sendIdx["require:"]=1;
  77612. //>>excludeEnd("ctx");
  77613. self["@util"]=self._require_("util");
  77614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77615. $ctx1.sendIdx["require:"]=2;
  77616. //>>excludeEnd("ctx");
  77617. self["@url"]=self._require_("url");
  77618. $1=self._class();
  77619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77620. $ctx1.sendIdx["class"]=1;
  77621. //>>excludeEnd("ctx");
  77622. self["@host"]=_st($1)._defaultHost();
  77623. self["@port"]=_st(self._class())._defaultPort();
  77624. self["@username"]=nil;
  77625. self["@password"]=nil;
  77626. self["@fallbackPage"]=nil;
  77627. return self;
  77628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77629. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.FileServer)});
  77630. //>>excludeEnd("ctx");
  77631. },
  77632. //>>excludeStart("ide", pragmas.excludeIdeData);
  77633. args: [],
  77634. source: "initialize\x0a\x09super initialize.\x0a\x09http := self require: 'http'.\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.",
  77635. referencedClasses: [],
  77636. //>>excludeEnd("ide");
  77637. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  77638. }),
  77639. globals.FileServer);
  77640. smalltalk.addMethod(
  77641. smalltalk.method({
  77642. selector: "isAuthenticated:",
  77643. protocol: 'private',
  77644. fn: function (aRequest){
  77645. var self=this;
  77646. var header,token,auth,parts;
  77647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77648. return smalltalk.withContext(function($ctx1) {
  77649. //>>excludeEnd("ctx");
  77650. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  77651. $2=_st(self["@username"])._isNil();
  77652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77653. $ctx1.sendIdx["isNil"]=1;
  77654. //>>excludeEnd("ctx");
  77655. $1=_st($2)._and_((function(){
  77656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77657. return smalltalk.withContext(function($ctx2) {
  77658. //>>excludeEnd("ctx");
  77659. return _st(self["@password"])._isNil();
  77660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  77662. //>>excludeEnd("ctx");
  77663. }));
  77664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77665. $ctx1.sendIdx["and:"]=1;
  77666. //>>excludeEnd("ctx");
  77667. if(smalltalk.assert($1)){
  77668. return true;
  77669. };
  77670. $3=_st(_st(aRequest)._headers())._at_("authorization");
  77671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77672. $ctx1.sendIdx["at:"]=1;
  77673. //>>excludeEnd("ctx");
  77674. if(($receiver = $3) == null || $receiver.isNil){
  77675. header="";
  77676. } else {
  77677. header=$3;
  77678. };
  77679. $4=_st(header)._isEmpty();
  77680. if(smalltalk.assert($4)){
  77681. return false;
  77682. } else {
  77683. $5=_st(header)._tokenize_(" ");
  77684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77685. $ctx1.sendIdx["tokenize:"]=1;
  77686. //>>excludeEnd("ctx");
  77687. if(($receiver = $5) == null || $receiver.isNil){
  77688. token="";
  77689. } else {
  77690. token=$5;
  77691. };
  77692. token;
  77693. $6=_st(token)._at_((2));
  77694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77695. $ctx1.sendIdx["at:"]=2;
  77696. //>>excludeEnd("ctx");
  77697. auth=self._base64Decode_($6);
  77698. auth;
  77699. parts=_st(auth)._tokenize_(":");
  77700. parts;
  77701. $9=self["@username"];
  77702. $10=_st(parts)._at_((1));
  77703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77704. $ctx1.sendIdx["at:"]=3;
  77705. //>>excludeEnd("ctx");
  77706. $8=_st($9).__eq($10);
  77707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77708. $ctx1.sendIdx["="]=1;
  77709. //>>excludeEnd("ctx");
  77710. $7=_st($8)._and_((function(){
  77711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77712. return smalltalk.withContext(function($ctx2) {
  77713. //>>excludeEnd("ctx");
  77714. return _st(self["@password"]).__eq(_st(parts)._at_((2)));
  77715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77716. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  77717. //>>excludeEnd("ctx");
  77718. }));
  77719. if(smalltalk.assert($7)){
  77720. return true;
  77721. } else {
  77722. return false;
  77723. };
  77724. };
  77725. return self;
  77726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77727. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},globals.FileServer)});
  77728. //>>excludeEnd("ctx");
  77729. },
  77730. //>>excludeStart("ide", pragmas.excludeIdeData);
  77731. args: ["aRequest"],
  77732. 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].",
  77733. referencedClasses: [],
  77734. //>>excludeEnd("ide");
  77735. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  77736. }),
  77737. globals.FileServer);
  77738. smalltalk.addMethod(
  77739. smalltalk.method({
  77740. selector: "password:",
  77741. protocol: 'accessing',
  77742. fn: function (aPassword){
  77743. var self=this;
  77744. self["@password"]=aPassword;
  77745. return self;
  77746. },
  77747. //>>excludeStart("ide", pragmas.excludeIdeData);
  77748. args: ["aPassword"],
  77749. source: "password: aPassword\x0a\x09password := aPassword.",
  77750. referencedClasses: [],
  77751. //>>excludeEnd("ide");
  77752. messageSends: []
  77753. }),
  77754. globals.FileServer);
  77755. smalltalk.addMethod(
  77756. smalltalk.method({
  77757. selector: "port",
  77758. protocol: 'accessing',
  77759. fn: function (){
  77760. var self=this;
  77761. var $1;
  77762. $1=self["@port"];
  77763. return $1;
  77764. },
  77765. //>>excludeStart("ide", pragmas.excludeIdeData);
  77766. args: [],
  77767. source: "port\x0a\x09^ port",
  77768. referencedClasses: [],
  77769. //>>excludeEnd("ide");
  77770. messageSends: []
  77771. }),
  77772. globals.FileServer);
  77773. smalltalk.addMethod(
  77774. smalltalk.method({
  77775. selector: "port:",
  77776. protocol: 'accessing',
  77777. fn: function (aNumber){
  77778. var self=this;
  77779. self["@port"]=aNumber;
  77780. return self;
  77781. },
  77782. //>>excludeStart("ide", pragmas.excludeIdeData);
  77783. args: ["aNumber"],
  77784. source: "port: aNumber\x0a\x09port := aNumber",
  77785. referencedClasses: [],
  77786. //>>excludeEnd("ide");
  77787. messageSends: []
  77788. }),
  77789. globals.FileServer);
  77790. smalltalk.addMethod(
  77791. smalltalk.method({
  77792. selector: "require:",
  77793. protocol: 'private',
  77794. fn: function (aModuleString){
  77795. var self=this;
  77796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77797. return smalltalk.withContext(function($ctx1) {
  77798. //>>excludeEnd("ctx");
  77799. var $1;
  77800. $1=_st(require)._value_(aModuleString);
  77801. return $1;
  77802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77803. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},globals.FileServer)});
  77804. //>>excludeEnd("ctx");
  77805. },
  77806. //>>excludeStart("ide", pragmas.excludeIdeData);
  77807. args: ["aModuleString"],
  77808. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  77809. referencedClasses: [],
  77810. //>>excludeEnd("ide");
  77811. messageSends: ["value:"]
  77812. }),
  77813. globals.FileServer);
  77814. smalltalk.addMethod(
  77815. smalltalk.method({
  77816. selector: "respondAuthenticationRequiredTo:",
  77817. protocol: 'request handling',
  77818. fn: function (aResponse){
  77819. var self=this;
  77820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77821. return smalltalk.withContext(function($ctx1) {
  77822. //>>excludeEnd("ctx");
  77823. var $1;
  77824. _st(aResponse)._writeHead_options_((401),globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  77825. _st(aResponse)._write_("<html><body>Authentication needed</body></html>");
  77826. $1=_st(aResponse)._end();
  77827. return self;
  77828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77829. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},globals.FileServer)});
  77830. //>>excludeEnd("ctx");
  77831. },
  77832. //>>excludeStart("ide", pragmas.excludeIdeData);
  77833. args: ["aResponse"],
  77834. 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.",
  77835. referencedClasses: [],
  77836. //>>excludeEnd("ide");
  77837. messageSends: ["writeHead:options:", "write:", "end"]
  77838. }),
  77839. globals.FileServer);
  77840. smalltalk.addMethod(
  77841. smalltalk.method({
  77842. selector: "respondCreatedTo:",
  77843. protocol: 'request handling',
  77844. fn: function (aResponse){
  77845. var self=this;
  77846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77847. return smalltalk.withContext(function($ctx1) {
  77848. //>>excludeEnd("ctx");
  77849. var $1;
  77850. _st(aResponse)._writeHead_options_((201),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  77851. $1=_st(aResponse)._end();
  77852. return self;
  77853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77854. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},globals.FileServer)});
  77855. //>>excludeEnd("ctx");
  77856. },
  77857. //>>excludeStart("ide", pragmas.excludeIdeData);
  77858. args: ["aResponse"],
  77859. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  77860. referencedClasses: [],
  77861. //>>excludeEnd("ide");
  77862. messageSends: ["writeHead:options:", "end"]
  77863. }),
  77864. globals.FileServer);
  77865. smalltalk.addMethod(
  77866. smalltalk.method({
  77867. selector: "respondDirectoryNamed:from:to:",
  77868. protocol: 'request handling',
  77869. fn: function (aDirname,aUrl,aResponse){
  77870. var self=this;
  77871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77872. return smalltalk.withContext(function($ctx1) {
  77873. //>>excludeEnd("ctx");
  77874. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  77875. $2=_st(aUrl)._pathname();
  77876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77877. $ctx1.sendIdx["pathname"]=1;
  77878. //>>excludeEnd("ctx");
  77879. $1=_st($2)._endsWith_("/");
  77880. if(smalltalk.assert($1)){
  77881. $3=_st(aDirname).__comma("index.html");
  77882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77883. $ctx1.sendIdx[","]=1;
  77884. //>>excludeEnd("ctx");
  77885. self._respondFileNamed_to_($3,aResponse);
  77886. } else {
  77887. $5=_st(_st(aUrl)._pathname()).__comma("/");
  77888. $7=_st(aUrl)._search();
  77889. if(($receiver = $7) == null || $receiver.isNil){
  77890. $6="";
  77891. } else {
  77892. $6=$7;
  77893. };
  77894. $4=_st($5).__comma($6);
  77895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77896. $ctx1.sendIdx[","]=2;
  77897. //>>excludeEnd("ctx");
  77898. self._respondRedirect_to_($4,aResponse);
  77899. };
  77900. return self;
  77901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77902. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},globals.FileServer)});
  77903. //>>excludeEnd("ctx");
  77904. },
  77905. //>>excludeStart("ide", pragmas.excludeIdeData);
  77906. args: ["aDirname", "aUrl", "aResponse"],
  77907. 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]",
  77908. referencedClasses: [],
  77909. //>>excludeEnd("ide");
  77910. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  77911. }),
  77912. globals.FileServer);
  77913. smalltalk.addMethod(
  77914. smalltalk.method({
  77915. selector: "respondFileNamed:to:",
  77916. protocol: 'request handling',
  77917. fn: function (aFilename,aResponse){
  77918. var self=this;
  77919. var type,filename;
  77920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77921. return smalltalk.withContext(function($ctx1) {
  77922. //>>excludeEnd("ctx");
  77923. var $1,$2,$3,$4,$5;
  77924. filename=aFilename;
  77925. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  77926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77927. return smalltalk.withContext(function($ctx2) {
  77928. //>>excludeEnd("ctx");
  77929. $1=_st(ex)._notNil();
  77930. if(smalltalk.assert($1)){
  77931. $2=console;
  77932. $3=_st(filename).__comma(" does not exist");
  77933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77934. $ctx2.sendIdx[","]=1;
  77935. //>>excludeEnd("ctx");
  77936. _st($2)._log_($3);
  77937. return self._respondNotFoundTo_(aResponse);
  77938. } else {
  77939. type=_st(self._class())._mimeTypeFor_(filename);
  77940. type;
  77941. $4=_st(type).__eq("application/javascript");
  77942. if(smalltalk.assert($4)){
  77943. type=_st(type).__comma(";charset=utf-8");
  77944. type;
  77945. };
  77946. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  77947. _st(aResponse)._write_encoding_(file,"binary");
  77948. $5=_st(aResponse)._end();
  77949. return $5;
  77950. };
  77951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77952. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  77953. //>>excludeEnd("ctx");
  77954. }));
  77955. return self;
  77956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77957. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},globals.FileServer)});
  77958. //>>excludeEnd("ctx");
  77959. },
  77960. //>>excludeStart("ide", pragmas.excludeIdeData);
  77961. args: ["aFilename", "aResponse"],
  77962. 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]]",
  77963. referencedClasses: [],
  77964. //>>excludeEnd("ide");
  77965. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  77966. }),
  77967. globals.FileServer);
  77968. smalltalk.addMethod(
  77969. smalltalk.method({
  77970. selector: "respondInternalErrorTo:",
  77971. protocol: 'request handling',
  77972. fn: function (aResponse){
  77973. var self=this;
  77974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77975. return smalltalk.withContext(function($ctx1) {
  77976. //>>excludeEnd("ctx");
  77977. var $1;
  77978. _st(aResponse)._writeHead_options_((500),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  77979. _st(aResponse)._write_("500 Internal server error");
  77980. $1=_st(aResponse)._end();
  77981. return self;
  77982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77983. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},globals.FileServer)});
  77984. //>>excludeEnd("ctx");
  77985. },
  77986. //>>excludeStart("ide", pragmas.excludeIdeData);
  77987. args: ["aResponse"],
  77988. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  77989. referencedClasses: [],
  77990. //>>excludeEnd("ide");
  77991. messageSends: ["writeHead:options:", "write:", "end"]
  77992. }),
  77993. globals.FileServer);
  77994. smalltalk.addMethod(
  77995. smalltalk.method({
  77996. selector: "respondNotCreatedTo:",
  77997. protocol: 'request handling',
  77998. fn: function (aResponse){
  77999. var self=this;
  78000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78001. return smalltalk.withContext(function($ctx1) {
  78002. //>>excludeEnd("ctx");
  78003. var $1;
  78004. _st(aResponse)._writeHead_options_((400),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  78005. _st(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  78006. $1=_st(aResponse)._end();
  78007. return self;
  78008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78009. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},globals.FileServer)});
  78010. //>>excludeEnd("ctx");
  78011. },
  78012. //>>excludeStart("ide", pragmas.excludeIdeData);
  78013. args: ["aResponse"],
  78014. 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.",
  78015. referencedClasses: [],
  78016. //>>excludeEnd("ide");
  78017. messageSends: ["writeHead:options:", "write:", "end"]
  78018. }),
  78019. globals.FileServer);
  78020. smalltalk.addMethod(
  78021. smalltalk.method({
  78022. selector: "respondNotFoundTo:",
  78023. protocol: 'request handling',
  78024. fn: function (aResponse){
  78025. var self=this;
  78026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78027. return smalltalk.withContext(function($ctx1) {
  78028. //>>excludeEnd("ctx");
  78029. var $2,$1,$3,$4;
  78030. $2=self._fallbackPage();
  78031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78032. $ctx1.sendIdx["fallbackPage"]=1;
  78033. //>>excludeEnd("ctx");
  78034. $1=_st($2)._isNil();
  78035. if(! smalltalk.assert($1)){
  78036. $3=self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  78037. return $3;
  78038. };
  78039. _st(aResponse)._writeHead_options_((404),globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  78040. _st(aResponse)._write_("<html><body><p>404 Not found</p>");
  78041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78042. $ctx1.sendIdx["write:"]=1;
  78043. //>>excludeEnd("ctx");
  78044. _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>");
  78045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78046. $ctx1.sendIdx["write:"]=2;
  78047. //>>excludeEnd("ctx");
  78048. _st(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  78049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78050. $ctx1.sendIdx["write:"]=3;
  78051. //>>excludeEnd("ctx");
  78052. _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>");
  78053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78054. $ctx1.sendIdx["write:"]=4;
  78055. //>>excludeEnd("ctx");
  78056. _st(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  78057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78058. $ctx1.sendIdx["write:"]=5;
  78059. //>>excludeEnd("ctx");
  78060. _st(aResponse)._write_("</ul></p></body></html>");
  78061. $4=_st(aResponse)._end();
  78062. return self;
  78063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78064. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},globals.FileServer)});
  78065. //>>excludeEnd("ctx");
  78066. },
  78067. //>>excludeStart("ide", pragmas.excludeIdeData);
  78068. args: ["aResponse"],
  78069. 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",
  78070. referencedClasses: [],
  78071. //>>excludeEnd("ide");
  78072. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  78073. }),
  78074. globals.FileServer);
  78075. smalltalk.addMethod(
  78076. smalltalk.method({
  78077. selector: "respondOKTo:",
  78078. protocol: 'request handling',
  78079. fn: function (aResponse){
  78080. var self=this;
  78081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78082. return smalltalk.withContext(function($ctx1) {
  78083. //>>excludeEnd("ctx");
  78084. var $1;
  78085. _st(aResponse)._writeHead_options_((200),globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  78086. $1=_st(aResponse)._end();
  78087. return self;
  78088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78089. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},globals.FileServer)});
  78090. //>>excludeEnd("ctx");
  78091. },
  78092. //>>excludeStart("ide", pragmas.excludeIdeData);
  78093. args: ["aResponse"],
  78094. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  78095. referencedClasses: [],
  78096. //>>excludeEnd("ide");
  78097. messageSends: ["writeHead:options:", "end"]
  78098. }),
  78099. globals.FileServer);
  78100. smalltalk.addMethod(
  78101. smalltalk.method({
  78102. selector: "respondRedirect:to:",
  78103. protocol: 'request handling',
  78104. fn: function (aString,aResponse){
  78105. var self=this;
  78106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78107. return smalltalk.withContext(function($ctx1) {
  78108. //>>excludeEnd("ctx");
  78109. var $1;
  78110. _st(aResponse)._writeHead_options_((303),globals.HashedCollection._newFromPairs_(["Location",aString]));
  78111. $1=_st(aResponse)._end();
  78112. return self;
  78113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78114. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},globals.FileServer)});
  78115. //>>excludeEnd("ctx");
  78116. },
  78117. //>>excludeStart("ide", pragmas.excludeIdeData);
  78118. args: ["aString", "aResponse"],
  78119. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  78120. referencedClasses: [],
  78121. //>>excludeEnd("ide");
  78122. messageSends: ["writeHead:options:", "end"]
  78123. }),
  78124. globals.FileServer);
  78125. smalltalk.addMethod(
  78126. smalltalk.method({
  78127. selector: "start",
  78128. protocol: 'starting',
  78129. fn: function (){
  78130. var self=this;
  78131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78132. return smalltalk.withContext(function($ctx1) {
  78133. //>>excludeEnd("ctx");
  78134. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$11;
  78135. self._checkDirectoryLayout();
  78136. $1=_st(self["@http"])._createServer_((function(request,response){
  78137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78138. return smalltalk.withContext(function($ctx2) {
  78139. //>>excludeEnd("ctx");
  78140. return self._handleRequest_respondTo_(request,response);
  78141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78142. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  78143. //>>excludeEnd("ctx");
  78144. }));
  78145. _st($1)._on_do_("error",(function(error){
  78146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78147. return smalltalk.withContext(function($ctx2) {
  78148. //>>excludeEnd("ctx");
  78149. $2=console;
  78150. $3="Error starting server: ".__comma(error);
  78151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78152. $ctx2.sendIdx[","]=1;
  78153. //>>excludeEnd("ctx");
  78154. return _st($2)._log_($3);
  78155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78156. $ctx2.sendIdx["log:"]=1;
  78157. //>>excludeEnd("ctx");
  78158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78159. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  78160. //>>excludeEnd("ctx");
  78161. }));
  78162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78163. $ctx1.sendIdx["on:do:"]=1;
  78164. //>>excludeEnd("ctx");
  78165. _st($1)._on_do_("listening",(function(){
  78166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78167. return smalltalk.withContext(function($ctx2) {
  78168. //>>excludeEnd("ctx");
  78169. $4=console;
  78170. $8=self._host();
  78171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78172. $ctx2.sendIdx["host"]=1;
  78173. //>>excludeEnd("ctx");
  78174. $7="Starting file server on http://".__comma($8);
  78175. $6=_st($7).__comma(":");
  78176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78177. $ctx2.sendIdx[","]=3;
  78178. //>>excludeEnd("ctx");
  78179. $10=self._port();
  78180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78181. $ctx2.sendIdx["port"]=1;
  78182. //>>excludeEnd("ctx");
  78183. $9=_st($10)._asString();
  78184. $5=_st($6).__comma($9);
  78185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78186. $ctx2.sendIdx[","]=2;
  78187. //>>excludeEnd("ctx");
  78188. return _st($4)._log_($5);
  78189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  78191. //>>excludeEnd("ctx");
  78192. }));
  78193. $11=_st($1)._listen_host_(self._port(),self._host());
  78194. return self;
  78195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78196. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.FileServer)});
  78197. //>>excludeEnd("ctx");
  78198. },
  78199. //>>excludeStart("ide", pragmas.excludeIdeData);
  78200. args: [],
  78201. 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.",
  78202. referencedClasses: [],
  78203. //>>excludeEnd("ide");
  78204. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  78205. }),
  78206. globals.FileServer);
  78207. smalltalk.addMethod(
  78208. smalltalk.method({
  78209. selector: "startOn:",
  78210. protocol: 'starting',
  78211. fn: function (aPort){
  78212. var self=this;
  78213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78214. return smalltalk.withContext(function($ctx1) {
  78215. //>>excludeEnd("ctx");
  78216. self._port_(aPort);
  78217. self._start();
  78218. return self;
  78219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78220. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},globals.FileServer)});
  78221. //>>excludeEnd("ctx");
  78222. },
  78223. //>>excludeStart("ide", pragmas.excludeIdeData);
  78224. args: ["aPort"],
  78225. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  78226. referencedClasses: [],
  78227. //>>excludeEnd("ide");
  78228. messageSends: ["port:", "start"]
  78229. }),
  78230. globals.FileServer);
  78231. smalltalk.addMethod(
  78232. smalltalk.method({
  78233. selector: "username:",
  78234. protocol: 'accessing',
  78235. fn: function (aUsername){
  78236. var self=this;
  78237. self["@username"]=aUsername;
  78238. return self;
  78239. },
  78240. //>>excludeStart("ide", pragmas.excludeIdeData);
  78241. args: ["aUsername"],
  78242. source: "username: aUsername\x0a\x09username := aUsername.",
  78243. referencedClasses: [],
  78244. //>>excludeEnd("ide");
  78245. messageSends: []
  78246. }),
  78247. globals.FileServer);
  78248. smalltalk.addMethod(
  78249. smalltalk.method({
  78250. selector: "validateBasePath",
  78251. protocol: 'private',
  78252. fn: function (){
  78253. var self=this;
  78254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78255. return smalltalk.withContext(function($ctx1) {
  78256. //>>excludeEnd("ctx");
  78257. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  78258. $1=self["@fs"];
  78259. $2=self._basePath();
  78260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78261. $ctx1.sendIdx["basePath"]=1;
  78262. //>>excludeEnd("ctx");
  78263. _st($1)._stat_then_($2,(function(err,stat){
  78264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78265. return smalltalk.withContext(function($ctx2) {
  78266. //>>excludeEnd("ctx");
  78267. if(($receiver = err) == null || $receiver.isNil){
  78268. $3=_st(stat)._isDirectory();
  78269. if(! smalltalk.assert($3)){
  78270. $4=console;
  78271. $7=self._basePath();
  78272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78273. $ctx2.sendIdx["basePath"]=2;
  78274. //>>excludeEnd("ctx");
  78275. $6="Warning: --base-path parameter ".__comma($7);
  78276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78277. $ctx2.sendIdx[","]=2;
  78278. //>>excludeEnd("ctx");
  78279. $5=_st($6).__comma(" is not a directory.");
  78280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78281. $ctx2.sendIdx[","]=1;
  78282. //>>excludeEnd("ctx");
  78283. return _st($4)._warn_($5);
  78284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78285. $ctx2.sendIdx["warn:"]=1;
  78286. //>>excludeEnd("ctx");
  78287. };
  78288. } else {
  78289. $8=console;
  78290. $9=_st("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  78291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78292. $ctx2.sendIdx[","]=3;
  78293. //>>excludeEnd("ctx");
  78294. return _st($8)._warn_($9);
  78295. };
  78296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78297. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  78298. //>>excludeEnd("ctx");
  78299. }));
  78300. return self;
  78301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78302. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},globals.FileServer)});
  78303. //>>excludeEnd("ctx");
  78304. },
  78305. //>>excludeStart("ide", pragmas.excludeIdeData);
  78306. args: [],
  78307. 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.' ]].",
  78308. referencedClasses: [],
  78309. //>>excludeEnd("ide");
  78310. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  78311. }),
  78312. globals.FileServer);
  78313. smalltalk.addMethod(
  78314. smalltalk.method({
  78315. selector: "withBasePath:",
  78316. protocol: 'private',
  78317. fn: function (aBaseRelativePath){
  78318. var self=this;
  78319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78320. return smalltalk.withContext(function($ctx1) {
  78321. //>>excludeEnd("ctx");
  78322. var $1;
  78323. $1=_st(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  78324. return $1;
  78325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78326. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},globals.FileServer)});
  78327. //>>excludeEnd("ctx");
  78328. },
  78329. //>>excludeStart("ide", pragmas.excludeIdeData);
  78330. args: ["aBaseRelativePath"],
  78331. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  78332. referencedClasses: [],
  78333. //>>excludeEnd("ide");
  78334. messageSends: ["join:with:", "basePath"]
  78335. }),
  78336. globals.FileServer);
  78337. smalltalk.addMethod(
  78338. smalltalk.method({
  78339. selector: "writeData:toFileNamed:",
  78340. protocol: 'private',
  78341. fn: function (data,aFilename){
  78342. var self=this;
  78343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78344. return smalltalk.withContext(function($ctx1) {
  78345. //>>excludeEnd("ctx");
  78346. _st(console)._log_(aFilename);
  78347. return self;
  78348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78349. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},globals.FileServer)});
  78350. //>>excludeEnd("ctx");
  78351. },
  78352. //>>excludeStart("ide", pragmas.excludeIdeData);
  78353. args: ["data", "aFilename"],
  78354. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  78355. referencedClasses: [],
  78356. //>>excludeEnd("ide");
  78357. messageSends: ["log:"]
  78358. }),
  78359. globals.FileServer);
  78360. globals.FileServer.klass.iVarNames = ['mimeTypes'];
  78361. smalltalk.addMethod(
  78362. smalltalk.method({
  78363. selector: "commandLineSwitches",
  78364. protocol: 'accessing',
  78365. fn: function (){
  78366. var self=this;
  78367. var switches;
  78368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78369. return smalltalk.withContext(function($ctx1) {
  78370. //>>excludeEnd("ctx");
  78371. var $1;
  78372. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  78373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78374. return smalltalk.withContext(function($ctx2) {
  78375. //>>excludeEnd("ctx");
  78376. return _st(each)._selector();
  78377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78379. //>>excludeEnd("ctx");
  78380. }));
  78381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78382. $ctx1.sendIdx["collect:"]=1;
  78383. //>>excludeEnd("ctx");
  78384. switches=_st(switches)._select_((function(each){
  78385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78386. return smalltalk.withContext(function($ctx2) {
  78387. //>>excludeEnd("ctx");
  78388. return _st(each)._match_("^[^:]*:$");
  78389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  78391. //>>excludeEnd("ctx");
  78392. }));
  78393. switches=_st(switches)._collect_((function(each){
  78394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78395. return smalltalk.withContext(function($ctx2) {
  78396. //>>excludeEnd("ctx");
  78397. return _st(_st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  78398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78399. $ctx2.sendIdx["replace:with:"]=1;
  78400. //>>excludeEnd("ctx");
  78401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  78403. //>>excludeEnd("ctx");
  78404. }));
  78405. $1=switches;
  78406. return $1;
  78407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78408. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},globals.FileServer.klass)});
  78409. //>>excludeEnd("ctx");
  78410. },
  78411. //>>excludeStart("ide", pragmas.excludeIdeData);
  78412. args: [],
  78413. 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",
  78414. referencedClasses: [],
  78415. //>>excludeEnd("ide");
  78416. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  78417. }),
  78418. globals.FileServer.klass);
  78419. smalltalk.addMethod(
  78420. smalltalk.method({
  78421. selector: "createServerWithArguments:",
  78422. protocol: 'initialization',
  78423. fn: function (options){
  78424. var self=this;
  78425. var server,popFront,front,optionName,optionValue,switches;
  78426. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  78427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78428. return smalltalk.withContext(function($ctx1) {
  78429. //>>excludeEnd("ctx");
  78430. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11;
  78431. var $early={};
  78432. try {
  78433. switches=self._commandLineSwitches();
  78434. server=self._new();
  78435. _st(options)._ifEmpty_((function(){
  78436. $1=server;
  78437. throw $early=[$1];
  78438. }));
  78439. $2=_st(_st(options)._size())._even();
  78440. if(! smalltalk.assert($2)){
  78441. _st(console)._log_("Using default parameters.");
  78442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78443. $ctx1.sendIdx["log:"]=1;
  78444. //>>excludeEnd("ctx");
  78445. $3=console;
  78446. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  78447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78448. $ctx1.sendIdx[","]=1;
  78449. //>>excludeEnd("ctx");
  78450. _st($3)._log_($4);
  78451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78452. $ctx1.sendIdx["log:"]=2;
  78453. //>>excludeEnd("ctx");
  78454. $5=console;
  78455. $6="Use any of the following ones: ".__comma(switches);
  78456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78457. $ctx1.sendIdx[","]=2;
  78458. //>>excludeEnd("ctx");
  78459. _st($5)._log_($6);
  78460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78461. $ctx1.sendIdx["log:"]=3;
  78462. //>>excludeEnd("ctx");
  78463. $7=server;
  78464. return $7;
  78465. };
  78466. popFront=(function(args){
  78467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78468. return smalltalk.withContext(function($ctx2) {
  78469. //>>excludeEnd("ctx");
  78470. front=_st(args)._first();
  78471. front;
  78472. _st(args)._remove_(front);
  78473. return front;
  78474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78475. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  78476. //>>excludeEnd("ctx");
  78477. });
  78478. _st((function(){
  78479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78480. return smalltalk.withContext(function($ctx2) {
  78481. //>>excludeEnd("ctx");
  78482. return _st(options)._notEmpty();
  78483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  78485. //>>excludeEnd("ctx");
  78486. }))._whileTrue_((function(){
  78487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78488. return smalltalk.withContext(function($ctx2) {
  78489. //>>excludeEnd("ctx");
  78490. optionName=_st(popFront)._value_(options);
  78491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78492. $ctx2.sendIdx["value:"]=1;
  78493. //>>excludeEnd("ctx");
  78494. optionName;
  78495. optionValue=_st(popFront)._value_(options);
  78496. optionValue;
  78497. $8=_st(switches)._includes_(optionName);
  78498. if(smalltalk.assert($8)){
  78499. optionName=self._selectorForCommandLineSwitch_(optionName);
  78500. optionName;
  78501. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  78502. } else {
  78503. $9=console;
  78504. $10=_st(optionName).__comma(" is not a valid commandline option");
  78505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78506. $ctx2.sendIdx[","]=3;
  78507. //>>excludeEnd("ctx");
  78508. _st($9)._log_($10);
  78509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78510. $ctx2.sendIdx["log:"]=4;
  78511. //>>excludeEnd("ctx");
  78512. return _st(console)._log_("Use any of the following ones: ".__comma(switches));
  78513. };
  78514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  78516. //>>excludeEnd("ctx");
  78517. }));
  78518. $11=server;
  78519. return $11;
  78520. }
  78521. catch(e) {if(e===$early)return e[0]; throw e}
  78522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78523. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},globals.FileServer.klass)});
  78524. //>>excludeEnd("ctx");
  78525. },
  78526. //>>excludeStart("ide", pragmas.excludeIdeData);
  78527. args: ["options"],
  78528. 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.",
  78529. referencedClasses: ["Array"],
  78530. //>>excludeEnd("ide");
  78531. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  78532. }),
  78533. globals.FileServer.klass);
  78534. smalltalk.addMethod(
  78535. smalltalk.method({
  78536. selector: "defaultBasePath",
  78537. protocol: 'accessing',
  78538. fn: function (){
  78539. var self=this;
  78540. return "./";
  78541. },
  78542. //>>excludeStart("ide", pragmas.excludeIdeData);
  78543. args: [],
  78544. source: "defaultBasePath\x0a\x09^ './'",
  78545. referencedClasses: [],
  78546. //>>excludeEnd("ide");
  78547. messageSends: []
  78548. }),
  78549. globals.FileServer.klass);
  78550. smalltalk.addMethod(
  78551. smalltalk.method({
  78552. selector: "defaultHost",
  78553. protocol: 'accessing',
  78554. fn: function (){
  78555. var self=this;
  78556. return "127.0.0.1";
  78557. },
  78558. //>>excludeStart("ide", pragmas.excludeIdeData);
  78559. args: [],
  78560. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  78561. referencedClasses: [],
  78562. //>>excludeEnd("ide");
  78563. messageSends: []
  78564. }),
  78565. globals.FileServer.klass);
  78566. smalltalk.addMethod(
  78567. smalltalk.method({
  78568. selector: "defaultMimeTypes",
  78569. protocol: 'accessing',
  78570. fn: function (){
  78571. var self=this;
  78572. var $1;
  78573. $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"]);
  78574. return $1;
  78575. },
  78576. //>>excludeStart("ide", pragmas.excludeIdeData);
  78577. args: [],
  78578. 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}",
  78579. referencedClasses: [],
  78580. //>>excludeEnd("ide");
  78581. messageSends: []
  78582. }),
  78583. globals.FileServer.klass);
  78584. smalltalk.addMethod(
  78585. smalltalk.method({
  78586. selector: "defaultPort",
  78587. protocol: 'accessing',
  78588. fn: function (){
  78589. var self=this;
  78590. return (4000);
  78591. },
  78592. //>>excludeStart("ide", pragmas.excludeIdeData);
  78593. args: [],
  78594. source: "defaultPort\x0a\x09^ 4000",
  78595. referencedClasses: [],
  78596. //>>excludeEnd("ide");
  78597. messageSends: []
  78598. }),
  78599. globals.FileServer.klass);
  78600. smalltalk.addMethod(
  78601. smalltalk.method({
  78602. selector: "main",
  78603. protocol: 'initialization',
  78604. fn: function (){
  78605. var self=this;
  78606. var fileServer,args;
  78607. function $FileServer(){return globals.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  78608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78609. return smalltalk.withContext(function($ctx1) {
  78610. //>>excludeEnd("ctx");
  78611. var $1,$2;
  78612. var $early={};
  78613. try {
  78614. args=_st(process)._argv();
  78615. _st(args)._removeFrom_to_((1),(3));
  78616. _st(args)._detect_ifNone_((function(each){
  78617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78618. return smalltalk.withContext(function($ctx2) {
  78619. //>>excludeEnd("ctx");
  78620. $1=_st(each).__eq("--help");
  78621. if(smalltalk.assert($1)){
  78622. return _st($FileServer())._printHelp();
  78623. };
  78624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78626. //>>excludeEnd("ctx");
  78627. }),(function(){
  78628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78629. return smalltalk.withContext(function($ctx2) {
  78630. //>>excludeEnd("ctx");
  78631. fileServer=_st($FileServer())._createServerWithArguments_(args);
  78632. fileServer;
  78633. $2=_st(fileServer)._start();
  78634. throw $early=[$2];
  78635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  78637. //>>excludeEnd("ctx");
  78638. }));
  78639. return self;
  78640. }
  78641. catch(e) {if(e===$early)return e[0]; throw e}
  78642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78643. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},globals.FileServer.klass)});
  78644. //>>excludeEnd("ctx");
  78645. },
  78646. //>>excludeStart("ide", pragmas.excludeIdeData);
  78647. args: [],
  78648. 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]",
  78649. referencedClasses: ["FileServer"],
  78650. //>>excludeEnd("ide");
  78651. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  78652. }),
  78653. globals.FileServer.klass);
  78654. smalltalk.addMethod(
  78655. smalltalk.method({
  78656. selector: "mimeTypeFor:",
  78657. protocol: 'accessing',
  78658. fn: function (aString){
  78659. var self=this;
  78660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78661. return smalltalk.withContext(function($ctx1) {
  78662. //>>excludeEnd("ctx");
  78663. var $1;
  78664. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  78665. return "text/plain";
  78666. }));
  78667. return $1;
  78668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78669. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},globals.FileServer.klass)});
  78670. //>>excludeEnd("ctx");
  78671. },
  78672. //>>excludeStart("ide", pragmas.excludeIdeData);
  78673. args: ["aString"],
  78674. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  78675. referencedClasses: [],
  78676. //>>excludeEnd("ide");
  78677. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  78678. }),
  78679. globals.FileServer.klass);
  78680. smalltalk.addMethod(
  78681. smalltalk.method({
  78682. selector: "mimeTypes",
  78683. protocol: 'accessing',
  78684. fn: function (){
  78685. var self=this;
  78686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78687. return smalltalk.withContext(function($ctx1) {
  78688. //>>excludeEnd("ctx");
  78689. var $2,$1,$receiver;
  78690. $2=self["@mimeTypes"];
  78691. if(($receiver = $2) == null || $receiver.isNil){
  78692. self["@mimeTypes"]=self._defaultMimeTypes();
  78693. $1=self["@mimeTypes"];
  78694. } else {
  78695. $1=$2;
  78696. };
  78697. return $1;
  78698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78699. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},globals.FileServer.klass)});
  78700. //>>excludeEnd("ctx");
  78701. },
  78702. //>>excludeStart("ide", pragmas.excludeIdeData);
  78703. args: [],
  78704. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  78705. referencedClasses: [],
  78706. //>>excludeEnd("ide");
  78707. messageSends: ["ifNil:", "defaultMimeTypes"]
  78708. }),
  78709. globals.FileServer.klass);
  78710. smalltalk.addMethod(
  78711. smalltalk.method({
  78712. selector: "printHelp",
  78713. protocol: 'accessing',
  78714. fn: function (){
  78715. var self=this;
  78716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78717. return smalltalk.withContext(function($ctx1) {
  78718. //>>excludeEnd("ctx");
  78719. _st(console)._log_("Available commandline options are:");
  78720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78721. $ctx1.sendIdx["log:"]=1;
  78722. //>>excludeEnd("ctx");
  78723. _st(console)._log_("--help");
  78724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78725. $ctx1.sendIdx["log:"]=2;
  78726. //>>excludeEnd("ctx");
  78727. _st(self._commandLineSwitches())._do_((function(each){
  78728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78729. return smalltalk.withContext(function($ctx2) {
  78730. //>>excludeEnd("ctx");
  78731. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  78732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78734. //>>excludeEnd("ctx");
  78735. }));
  78736. return self;
  78737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78738. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},globals.FileServer.klass)});
  78739. //>>excludeEnd("ctx");
  78740. },
  78741. //>>excludeStart("ide", pragmas.excludeIdeData);
  78742. args: [],
  78743. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  78744. referencedClasses: [],
  78745. //>>excludeEnd("ide");
  78746. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  78747. }),
  78748. globals.FileServer.klass);
  78749. smalltalk.addMethod(
  78750. smalltalk.method({
  78751. selector: "selectorForCommandLineSwitch:",
  78752. protocol: 'accessing',
  78753. fn: function (aSwitch){
  78754. var self=this;
  78755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78756. return smalltalk.withContext(function($ctx1) {
  78757. //>>excludeEnd("ctx");
  78758. var $2,$1;
  78759. $2=_st(_st(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  78760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78761. return smalltalk.withContext(function($ctx2) {
  78762. //>>excludeEnd("ctx");
  78763. return _st(_st(each)._second())._asUppercase();
  78764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  78766. //>>excludeEnd("ctx");
  78767. }));
  78768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78769. $ctx1.sendIdx["replace:with:"]=1;
  78770. //>>excludeEnd("ctx");
  78771. $1=_st($2).__comma(":");
  78772. return $1;
  78773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78774. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},globals.FileServer.klass)});
  78775. //>>excludeEnd("ctx");
  78776. },
  78777. //>>excludeStart("ide", pragmas.excludeIdeData);
  78778. args: ["aSwitch"],
  78779. 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 ]), ':'",
  78780. referencedClasses: [],
  78781. //>>excludeEnd("ide");
  78782. messageSends: [",", "replace:with:", "asUppercase", "second"]
  78783. }),
  78784. globals.FileServer.klass);
  78785. smalltalk.addClass('Initer', globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  78786. smalltalk.addMethod(
  78787. smalltalk.method({
  78788. selector: "bowerInstallThenDo:",
  78789. protocol: 'action',
  78790. fn: function (aBlock){
  78791. var self=this;
  78792. var child;
  78793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78794. return smalltalk.withContext(function($ctx1) {
  78795. //>>excludeEnd("ctx");
  78796. var $1,$4,$3,$2;
  78797. child=_st(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  78798. $1=child;
  78799. _st($1)._on_do_("error",aBlock);
  78800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78801. $ctx1.sendIdx["on:do:"]=1;
  78802. //>>excludeEnd("ctx");
  78803. $2=_st($1)._on_do_("close",(function(code){
  78804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78805. return smalltalk.withContext(function($ctx2) {
  78806. //>>excludeEnd("ctx");
  78807. $4=_st(code).__eq((0));
  78808. if(smalltalk.assert($4)){
  78809. $3=nil;
  78810. } else {
  78811. $3=code;
  78812. };
  78813. return _st(aBlock)._value_($3);
  78814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78815. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  78816. //>>excludeEnd("ctx");
  78817. }));
  78818. return self;
  78819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78820. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78821. //>>excludeEnd("ctx");
  78822. },
  78823. //>>excludeStart("ide", pragmas.excludeIdeData);
  78824. args: ["aBlock"],
  78825. source: "bowerInstallThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'bower' named: 'bower')\x0a\x09\x09args: #('install').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  78826. referencedClasses: [],
  78827. //>>excludeEnd("ide");
  78828. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  78829. }),
  78830. globals.Initer);
  78831. smalltalk.addMethod(
  78832. smalltalk.method({
  78833. selector: "finishMessage",
  78834. protocol: 'action',
  78835. fn: function (){
  78836. var self=this;
  78837. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  78838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78839. return smalltalk.withContext(function($ctx1) {
  78840. //>>excludeEnd("ctx");
  78841. _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()));
  78842. _st((function(){
  78843. }))._valueWithTimeout_((600));
  78844. return self;
  78845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78846. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},globals.Initer)});
  78847. //>>excludeEnd("ctx");
  78848. },
  78849. //>>excludeStart("ide", pragmas.excludeIdeData);
  78850. args: [],
  78851. 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",
  78852. referencedClasses: ["String"],
  78853. //>>excludeEnd("ide");
  78854. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  78855. }),
  78856. globals.Initer);
  78857. smalltalk.addMethod(
  78858. smalltalk.method({
  78859. selector: "gruntInitThenDo:",
  78860. protocol: 'action',
  78861. fn: function (aBlock){
  78862. var self=this;
  78863. var child,sanitizedTemplatePath;
  78864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78865. return smalltalk.withContext(function($ctx1) {
  78866. //>>excludeEnd("ctx");
  78867. var $1,$4,$3,$2;
  78868. sanitizedTemplatePath=_st(_st(_st(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  78869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78870. $ctx1.sendIdx["replace:with:"]=1;
  78871. //>>excludeEnd("ctx");
  78872. child=_st(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  78873. $1=child;
  78874. _st($1)._on_do_("error",aBlock);
  78875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78876. $ctx1.sendIdx["on:do:"]=1;
  78877. //>>excludeEnd("ctx");
  78878. $2=_st($1)._on_do_("close",(function(code){
  78879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78880. return smalltalk.withContext(function($ctx2) {
  78881. //>>excludeEnd("ctx");
  78882. $4=_st(code).__eq((0));
  78883. if(smalltalk.assert($4)){
  78884. $3=nil;
  78885. } else {
  78886. $3=code;
  78887. };
  78888. return _st(aBlock)._value_($3);
  78889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78890. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  78891. //>>excludeEnd("ctx");
  78892. }));
  78893. return self;
  78894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78895. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},globals.Initer)});
  78896. //>>excludeEnd("ctx");
  78897. },
  78898. //>>excludeStart("ide", pragmas.excludeIdeData);
  78899. args: ["aBlock"],
  78900. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: 'grunt-init-amber')\x0a\x09\x09replace: '\x5c\x5c' with: '\x5c\x5c') replace: ':' with: '\x5c:'.\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-init' named: 'grunt-init')\x0a\x09\x09args: {sanitizedTemplatePath}.\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  78901. referencedClasses: [],
  78902. //>>excludeEnd("ide");
  78903. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  78904. }),
  78905. globals.Initer);
  78906. smalltalk.addMethod(
  78907. smalltalk.method({
  78908. selector: "gruntThenDo:",
  78909. protocol: 'action',
  78910. fn: function (aBlock){
  78911. var self=this;
  78912. var child;
  78913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78914. return smalltalk.withContext(function($ctx1) {
  78915. //>>excludeEnd("ctx");
  78916. var $1,$4,$3,$2;
  78917. child=_st(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  78918. $1=child;
  78919. _st($1)._on_do_("error",aBlock);
  78920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78921. $ctx1.sendIdx["on:do:"]=1;
  78922. //>>excludeEnd("ctx");
  78923. $2=_st($1)._on_do_("close",(function(code){
  78924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78925. return smalltalk.withContext(function($ctx2) {
  78926. //>>excludeEnd("ctx");
  78927. $4=_st(code).__eq((0));
  78928. if(smalltalk.assert($4)){
  78929. $3=nil;
  78930. } else {
  78931. $3=code;
  78932. };
  78933. return _st(aBlock)._value_($3);
  78934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78935. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  78936. //>>excludeEnd("ctx");
  78937. }));
  78938. return self;
  78939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78940. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  78941. //>>excludeEnd("ctx");
  78942. },
  78943. //>>excludeStart("ide", pragmas.excludeIdeData);
  78944. args: ["aBlock"],
  78945. source: "gruntThenDo: aBlock\x0a\x09| child |\x0a\x09child := childProcess\x0a\x09\x09fork: (self npmScriptForModule: 'grunt-cli' named: 'grunt')\x0a\x09\x09args: #('default' 'devel').\x0a\x09child\x0a\x09\x09on: 'error' do: aBlock;\x0a\x09\x09on: 'close' do: [ :code |\x0a\x09\x09\x09aBlock value: (code = 0 ifTrue: [ nil ] ifFalse: [ code ]) ]",
  78946. referencedClasses: [],
  78947. //>>excludeEnd("ide");
  78948. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  78949. }),
  78950. globals.Initer);
  78951. smalltalk.addMethod(
  78952. smalltalk.method({
  78953. selector: "initialize",
  78954. protocol: 'initialization',
  78955. fn: function (){
  78956. var self=this;
  78957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78958. return smalltalk.withContext(function($ctx1) {
  78959. //>>excludeEnd("ctx");
  78960. (
  78961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78962. $ctx1.supercall = true,
  78963. //>>excludeEnd("ctx");
  78964. globals.Initer.superclass.fn.prototype._initialize.apply(_st(self), []));
  78965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78966. $ctx1.supercall = false;
  78967. //>>excludeEnd("ctx");;
  78968. self["@childProcess"]=_st(require)._value_("child_process");
  78969. self["@nmPath"]=_st(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  78970. return self;
  78971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78972. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Initer)});
  78973. //>>excludeEnd("ctx");
  78974. },
  78975. //>>excludeStart("ide", pragmas.excludeIdeData);
  78976. args: [],
  78977. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  78978. referencedClasses: [],
  78979. //>>excludeEnd("ide");
  78980. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  78981. }),
  78982. globals.Initer);
  78983. smalltalk.addMethod(
  78984. smalltalk.method({
  78985. selector: "npmInstallThenDo:",
  78986. protocol: 'action',
  78987. fn: function (aBlock){
  78988. var self=this;
  78989. var child;
  78990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78991. return smalltalk.withContext(function($ctx1) {
  78992. //>>excludeEnd("ctx");
  78993. var $1;
  78994. child=_st(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  78995. $1=_st(child)._stdout();
  78996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78997. $ctx1.sendIdx["stdout"]=1;
  78998. //>>excludeEnd("ctx");
  78999. _st($1)._pipe_options_(_st(process)._stdout(),globals.HashedCollection._newFromPairs_(["end",false]));
  79000. return self;
  79001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79002. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},globals.Initer)});
  79003. //>>excludeEnd("ctx");
  79004. },
  79005. //>>excludeStart("ide", pragmas.excludeIdeData);
  79006. args: ["aBlock"],
  79007. 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 }",
  79008. referencedClasses: [],
  79009. //>>excludeEnd("ide");
  79010. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  79011. }),
  79012. globals.Initer);
  79013. smalltalk.addMethod(
  79014. smalltalk.method({
  79015. selector: "npmScriptForModule:named:",
  79016. protocol: 'npm',
  79017. fn: function (aString,anotherString){
  79018. var self=this;
  79019. var modulePath,packageJson,binSection,scriptPath;
  79020. function $JSObjectProxy(){return globals.JSObjectProxy||(typeof JSObjectProxy=="undefined"?nil:JSObjectProxy)}
  79021. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  79022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79023. return smalltalk.withContext(function($ctx1) {
  79024. //>>excludeEnd("ctx");
  79025. var $1,$3,$4,$2,$5,$6;
  79026. $1=self["@path"];
  79027. $3=_st($JSObjectProxy())._on_(require);
  79028. $4=_st(aString).__comma("/package.json");
  79029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79030. $ctx1.sendIdx[","]=1;
  79031. //>>excludeEnd("ctx");
  79032. $2=_st($3)._resolve_($4);
  79033. modulePath=_st($1)._dirname_($2);
  79034. packageJson=_st($Smalltalk())._readJSObject_(_st(require)._value_(_st(aString).__comma("/package.json")));
  79035. binSection=_st(packageJson)._at_("bin");
  79036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79037. $ctx1.sendIdx["at:"]=1;
  79038. //>>excludeEnd("ctx");
  79039. $5=_st(binSection)._isString();
  79040. if(smalltalk.assert($5)){
  79041. scriptPath=binSection;
  79042. } else {
  79043. scriptPath=_st(binSection)._at_(anotherString);
  79044. };
  79045. $6=_st(self["@path"])._join_with_(modulePath,scriptPath);
  79046. return $6;
  79047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79048. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},globals.Initer)});
  79049. //>>excludeEnd("ctx");
  79050. },
  79051. //>>excludeStart("ide", pragmas.excludeIdeData);
  79052. args: ["aString", "anotherString"],
  79053. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09(JSObjectProxy on: require)\x0a\x09\x09\x09resolve: aString, '/package.json').\x0a\x09packageJson := Smalltalk readJSObject: (\x0a\x09\x09require value: aString, '/package.json').\x0a\x09binSection := packageJson at: 'bin'.\x0a\x09scriptPath := binSection isString\x0a\x09\x09ifTrue: [ binSection ]\x0a\x09\x09ifFalse: [ binSection at: anotherString ].\x0a\x09^ path join: modulePath with: scriptPath",
  79054. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  79055. //>>excludeEnd("ide");
  79056. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  79057. }),
  79058. globals.Initer);
  79059. smalltalk.addMethod(
  79060. smalltalk.method({
  79061. selector: "start",
  79062. protocol: 'action',
  79063. fn: function (){
  79064. var self=this;
  79065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79066. return smalltalk.withContext(function($ctx1) {
  79067. //>>excludeEnd("ctx");
  79068. var $1,$2,$3,$4,$5,$6,$7,$8,$receiver;
  79069. self._gruntInitThenDo_((function(error){
  79070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79071. return smalltalk.withContext(function($ctx2) {
  79072. //>>excludeEnd("ctx");
  79073. if(($receiver = error) == null || $receiver.isNil){
  79074. return self._bowerInstallThenDo_((function(error2){
  79075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79076. return smalltalk.withContext(function($ctx3) {
  79077. //>>excludeEnd("ctx");
  79078. if(($receiver = error2) == null || $receiver.isNil){
  79079. return self._npmInstallThenDo_((function(error3){
  79080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79081. return smalltalk.withContext(function($ctx4) {
  79082. //>>excludeEnd("ctx");
  79083. if(($receiver = error3) == null || $receiver.isNil){
  79084. return self._gruntThenDo_((function(error4){
  79085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79086. return smalltalk.withContext(function($ctx5) {
  79087. //>>excludeEnd("ctx");
  79088. if(($receiver = error4) == null || $receiver.isNil){
  79089. self._finishMessage();
  79090. return _st(process)._exit();
  79091. } else {
  79092. $7=console;
  79093. _st($7)._log_("grunt exec error:");
  79094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79095. $ctx5.sendIdx["log:"]=7;
  79096. //>>excludeEnd("ctx");
  79097. $8=_st($7)._log_(error4);
  79098. $8;
  79099. return _st(process)._exit_((104));
  79100. };
  79101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79102. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  79103. //>>excludeEnd("ctx");
  79104. }));
  79105. } else {
  79106. $5=console;
  79107. _st($5)._log_("npm install exec error:");
  79108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79109. $ctx4.sendIdx["log:"]=5;
  79110. //>>excludeEnd("ctx");
  79111. $6=_st($5)._log_(error3);
  79112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79113. $ctx4.sendIdx["log:"]=6;
  79114. //>>excludeEnd("ctx");
  79115. $6;
  79116. return _st(process)._exit_((103));
  79117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79118. $ctx4.sendIdx["exit:"]=3;
  79119. //>>excludeEnd("ctx");
  79120. };
  79121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79122. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  79123. //>>excludeEnd("ctx");
  79124. }));
  79125. } else {
  79126. $3=console;
  79127. _st($3)._log_("bower install exec error:");
  79128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79129. $ctx3.sendIdx["log:"]=3;
  79130. //>>excludeEnd("ctx");
  79131. $4=_st($3)._log_(error2);
  79132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79133. $ctx3.sendIdx["log:"]=4;
  79134. //>>excludeEnd("ctx");
  79135. $4;
  79136. return _st(process)._exit_((102));
  79137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79138. $ctx3.sendIdx["exit:"]=2;
  79139. //>>excludeEnd("ctx");
  79140. };
  79141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79142. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  79143. //>>excludeEnd("ctx");
  79144. }));
  79145. } else {
  79146. $1=console;
  79147. _st($1)._log_("grunt-init exec error:");
  79148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79149. $ctx2.sendIdx["log:"]=1;
  79150. //>>excludeEnd("ctx");
  79151. $2=_st($1)._log_(error);
  79152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79153. $ctx2.sendIdx["log:"]=2;
  79154. //>>excludeEnd("ctx");
  79155. $2;
  79156. return _st(process)._exit_((101));
  79157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79158. $ctx2.sendIdx["exit:"]=1;
  79159. //>>excludeEnd("ctx");
  79160. };
  79161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79162. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  79163. //>>excludeEnd("ctx");
  79164. }));
  79165. return self;
  79166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79167. }, function($ctx1) {$ctx1.fill(self,"start",{},globals.Initer)});
  79168. //>>excludeEnd("ctx");
  79169. },
  79170. //>>excludeStart("ide", pragmas.excludeIdeData);
  79171. args: [],
  79172. source: "start\x0a\x09self gruntInitThenDo: [ :error | error\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt-init exec error:'; log: error.\x0a\x09\x09process exit: 101 ]\x0a\x09ifNil: [\x0a\x0a\x09self bowerInstallThenDo: [ :error2 | error2\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'bower install exec error:'; log: error2.\x0a\x09\x09process exit: 102 ]\x0a\x09ifNil: [\x0a\x0a\x09self npmInstallThenDo: [ :error3 | error3\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'npm install exec error:'; log: error3.\x0a\x09\x09process exit: 103 ]\x0a\x09ifNil: [\x0a\x0a\x09self gruntThenDo: [ :error4 | error4\x0a\x09ifNotNil: [\x0a\x09\x09console log: 'grunt exec error:'; log: error4.\x0a\x09\x09process exit: 104 ]\x0a\x09ifNil: [\x0a\x0a\x09self finishMessage.\x0a\x09process exit ]]]]]]]]",
  79173. referencedClasses: [],
  79174. //>>excludeEnd("ide");
  79175. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  79176. }),
  79177. globals.Initer);
  79178. smalltalk.addClass('Repl', globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  79179. //>>excludeStart("ide", pragmas.excludeIdeData);
  79180. 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.";
  79181. //>>excludeEnd("ide");
  79182. smalltalk.addMethod(
  79183. smalltalk.method({
  79184. selector: "addVariableNamed:to:",
  79185. protocol: 'private',
  79186. fn: function (aString,anObject){
  79187. var self=this;
  79188. var newClass,newObject;
  79189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79190. return smalltalk.withContext(function($ctx1) {
  79191. //>>excludeEnd("ctx");
  79192. var $1;
  79193. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  79194. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  79195. newObject=_st(newClass)._new();
  79196. self._setPreviousVariablesFor_from_(newObject,anObject);
  79197. $1=newObject;
  79198. return $1;
  79199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79200. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},globals.Repl)});
  79201. //>>excludeEnd("ctx");
  79202. },
  79203. //>>excludeStart("ide", pragmas.excludeIdeData);
  79204. args: ["aString", "anObject"],
  79205. 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",
  79206. referencedClasses: [],
  79207. //>>excludeEnd("ide");
  79208. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  79209. }),
  79210. globals.Repl);
  79211. smalltalk.addMethod(
  79212. smalltalk.method({
  79213. selector: "assignNewVariable:do:",
  79214. protocol: 'private',
  79215. fn: function (buffer,aBlock){
  79216. var self=this;
  79217. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  79218. function $ConsoleErrorHandler(){return globals.ConsoleErrorHandler||(typeof ConsoleErrorHandler=="undefined"?nil:ConsoleErrorHandler)}
  79219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79220. return smalltalk.withContext(function($ctx1) {
  79221. //>>excludeEnd("ctx");
  79222. var $3,$4,$2,$1,$receiver;
  79223. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  79224. var varName,value;
  79225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79226. return smalltalk.withContext(function($ctx2) {
  79227. //>>excludeEnd("ctx");
  79228. if(($receiver = name) == null || $receiver.isNil){
  79229. varName=self._nextResultName();
  79230. } else {
  79231. varName=name;
  79232. };
  79233. varName;
  79234. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  79235. self["@session"];
  79236. _st((function(){
  79237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79238. return smalltalk.withContext(function($ctx3) {
  79239. //>>excludeEnd("ctx");
  79240. $3=_st(varName).__comma(" := ");
  79241. if(($receiver = expr) == null || $receiver.isNil){
  79242. $4=buffer;
  79243. } else {
  79244. $4=expr;
  79245. };
  79246. $2=_st($3).__comma($4);
  79247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79248. $ctx3.sendIdx[","]=1;
  79249. //>>excludeEnd("ctx");
  79250. value=self._eval_on_($2,self["@session"]);
  79251. return value;
  79252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79253. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  79254. //>>excludeEnd("ctx");
  79255. }))._on_do_($Error(),(function(e){
  79256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79257. return smalltalk.withContext(function($ctx3) {
  79258. //>>excludeEnd("ctx");
  79259. _st(_st($ConsoleErrorHandler())._new())._logError_(e);
  79260. value=nil;
  79261. return value;
  79262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79263. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  79264. //>>excludeEnd("ctx");
  79265. }));
  79266. return _st(aBlock)._value_value_(varName,value);
  79267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79268. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  79269. //>>excludeEnd("ctx");
  79270. }));
  79271. return $1;
  79272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79273. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},globals.Repl)});
  79274. //>>excludeEnd("ctx");
  79275. },
  79276. //>>excludeStart("ide", pragmas.excludeIdeData);
  79277. args: ["buffer", "aBlock"],
  79278. 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]",
  79279. referencedClasses: ["Error", "ConsoleErrorHandler"],
  79280. //>>excludeEnd("ide");
  79281. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  79282. }),
  79283. globals.Repl);
  79284. smalltalk.addMethod(
  79285. smalltalk.method({
  79286. selector: "clearScreen",
  79287. protocol: 'actions',
  79288. fn: function (){
  79289. var self=this;
  79290. var esc,cls;
  79291. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  79292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79293. return smalltalk.withContext(function($ctx1) {
  79294. //>>excludeEnd("ctx");
  79295. var $1;
  79296. esc=_st($String())._fromCharCode_((27));
  79297. $1=_st(_st(esc).__comma("[2J")).__comma(esc);
  79298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79299. $ctx1.sendIdx[","]=2;
  79300. //>>excludeEnd("ctx");
  79301. cls=_st($1).__comma("[0;0f");
  79302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79303. $ctx1.sendIdx[","]=1;
  79304. //>>excludeEnd("ctx");
  79305. _st(_st(process)._stdout())._write_(cls);
  79306. _st(self["@interface"])._prompt();
  79307. return self;
  79308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79309. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},globals.Repl)});
  79310. //>>excludeEnd("ctx");
  79311. },
  79312. //>>excludeStart("ide", pragmas.excludeIdeData);
  79313. args: [],
  79314. 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",
  79315. referencedClasses: ["String"],
  79316. //>>excludeEnd("ide");
  79317. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  79318. }),
  79319. globals.Repl);
  79320. smalltalk.addMethod(
  79321. smalltalk.method({
  79322. selector: "close",
  79323. protocol: 'actions',
  79324. fn: function (){
  79325. var self=this;
  79326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79327. return smalltalk.withContext(function($ctx1) {
  79328. //>>excludeEnd("ctx");
  79329. _st(_st(process)._stdin())._destroy();
  79330. return self;
  79331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79332. }, function($ctx1) {$ctx1.fill(self,"close",{},globals.Repl)});
  79333. //>>excludeEnd("ctx");
  79334. },
  79335. //>>excludeStart("ide", pragmas.excludeIdeData);
  79336. args: [],
  79337. source: "close\x0a\x09process stdin destroy",
  79338. referencedClasses: [],
  79339. //>>excludeEnd("ide");
  79340. messageSends: ["destroy", "stdin"]
  79341. }),
  79342. globals.Repl);
  79343. smalltalk.addMethod(
  79344. smalltalk.method({
  79345. selector: "commands",
  79346. protocol: 'accessing',
  79347. fn: function (){
  79348. var self=this;
  79349. var $1;
  79350. $1=self["@commands"];
  79351. return $1;
  79352. },
  79353. //>>excludeStart("ide", pragmas.excludeIdeData);
  79354. args: [],
  79355. source: "commands\x0a\x09^ commands",
  79356. referencedClasses: [],
  79357. //>>excludeEnd("ide");
  79358. messageSends: []
  79359. }),
  79360. globals.Repl);
  79361. smalltalk.addMethod(
  79362. smalltalk.method({
  79363. selector: "createInterface",
  79364. protocol: 'actions',
  79365. fn: function (){
  79366. var self=this;
  79367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79368. return smalltalk.withContext(function($ctx1) {
  79369. //>>excludeEnd("ctx");
  79370. var $1;
  79371. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  79372. _st(self["@interface"])._on_do_("line",(function(buffer){
  79373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79374. return smalltalk.withContext(function($ctx2) {
  79375. //>>excludeEnd("ctx");
  79376. return self._processLine_(buffer);
  79377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79378. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  79379. //>>excludeEnd("ctx");
  79380. }));
  79381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79382. $ctx1.sendIdx["on:do:"]=1;
  79383. //>>excludeEnd("ctx");
  79384. _st(self["@interface"])._on_do_("close",(function(){
  79385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79386. return smalltalk.withContext(function($ctx2) {
  79387. //>>excludeEnd("ctx");
  79388. return self._close();
  79389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79391. //>>excludeEnd("ctx");
  79392. }));
  79393. self._printWelcome();
  79394. self._setupHotkeys();
  79395. $1=self._setPrompt();
  79396. _st(self["@interface"])._prompt();
  79397. return self;
  79398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79399. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},globals.Repl)});
  79400. //>>excludeEnd("ctx");
  79401. },
  79402. //>>excludeStart("ide", pragmas.excludeIdeData);
  79403. args: [],
  79404. 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",
  79405. referencedClasses: [],
  79406. //>>excludeEnd("ide");
  79407. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  79408. }),
  79409. globals.Repl);
  79410. smalltalk.addMethod(
  79411. smalltalk.method({
  79412. selector: "encapsulateVariable:withValue:in:",
  79413. protocol: 'private',
  79414. fn: function (aString,anObject,aClass){
  79415. var self=this;
  79416. var compiler;
  79417. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  79418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79419. return smalltalk.withContext(function($ctx1) {
  79420. //>>excludeEnd("ctx");
  79421. var $1,$4,$3,$2,$5,$6;
  79422. compiler=_st($Compiler())._new();
  79423. $1=compiler;
  79424. $4=_st(aString).__comma(": anObject ^ ");
  79425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79426. $ctx1.sendIdx[","]=3;
  79427. //>>excludeEnd("ctx");
  79428. $3=_st($4).__comma(aString);
  79429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79430. $ctx1.sendIdx[","]=2;
  79431. //>>excludeEnd("ctx");
  79432. $2=_st($3).__comma(" := anObject");
  79433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79434. $ctx1.sendIdx[","]=1;
  79435. //>>excludeEnd("ctx");
  79436. _st($1)._install_forClass_protocol_($2,aClass,"session");
  79437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79438. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  79439. //>>excludeEnd("ctx");
  79440. $5=compiler;
  79441. $6=_st(_st(aString).__comma(" ^ ")).__comma(aString);
  79442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79443. $ctx1.sendIdx[","]=4;
  79444. //>>excludeEnd("ctx");
  79445. _st($5)._install_forClass_protocol_($6,aClass,"session");
  79446. return self;
  79447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79448. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},globals.Repl)});
  79449. //>>excludeEnd("ctx");
  79450. },
  79451. //>>excludeStart("ide", pragmas.excludeIdeData);
  79452. args: ["aString", "anObject", "aClass"],
  79453. 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'.",
  79454. referencedClasses: ["Compiler"],
  79455. //>>excludeEnd("ide");
  79456. messageSends: ["new", "install:forClass:protocol:", ","]
  79457. }),
  79458. globals.Repl);
  79459. smalltalk.addMethod(
  79460. smalltalk.method({
  79461. selector: "eval:",
  79462. protocol: 'actions',
  79463. fn: function (buffer){
  79464. var self=this;
  79465. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  79466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79467. return smalltalk.withContext(function($ctx1) {
  79468. //>>excludeEnd("ctx");
  79469. var $1;
  79470. $1=self._eval_on_(buffer,_st($DoIt())._new());
  79471. return $1;
  79472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79473. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},globals.Repl)});
  79474. //>>excludeEnd("ctx");
  79475. },
  79476. //>>excludeStart("ide", pragmas.excludeIdeData);
  79477. args: ["buffer"],
  79478. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  79479. referencedClasses: ["DoIt"],
  79480. //>>excludeEnd("ide");
  79481. messageSends: ["eval:on:", "new"]
  79482. }),
  79483. globals.Repl);
  79484. smalltalk.addMethod(
  79485. smalltalk.method({
  79486. selector: "eval:on:",
  79487. protocol: 'actions',
  79488. fn: function (buffer,anObject){
  79489. var self=this;
  79490. var result;
  79491. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  79492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79493. return smalltalk.withContext(function($ctx1) {
  79494. //>>excludeEnd("ctx");
  79495. var $1,$2,$3;
  79496. $1=_st(buffer)._isEmpty();
  79497. if(! smalltalk.assert($1)){
  79498. _st((function(){
  79499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79500. return smalltalk.withContext(function($ctx2) {
  79501. //>>excludeEnd("ctx");
  79502. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  79503. return result;
  79504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79506. //>>excludeEnd("ctx");
  79507. }))._tryCatch_((function(e){
  79508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79509. return smalltalk.withContext(function($ctx2) {
  79510. //>>excludeEnd("ctx");
  79511. $2=_st(e)._isSmalltalkError();
  79512. if(smalltalk.assert($2)){
  79513. return _st(e)._resignal();
  79514. } else {
  79515. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  79516. };
  79517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79518. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  79519. //>>excludeEnd("ctx");
  79520. }));
  79521. };
  79522. $3=result;
  79523. return $3;
  79524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79525. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},globals.Repl)});
  79526. //>>excludeEnd("ctx");
  79527. },
  79528. //>>excludeStart("ide", pragmas.excludeIdeData);
  79529. args: ["buffer", "anObject"],
  79530. 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",
  79531. referencedClasses: ["Compiler"],
  79532. //>>excludeEnd("ide");
  79533. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  79534. }),
  79535. globals.Repl);
  79536. smalltalk.addMethod(
  79537. smalltalk.method({
  79538. selector: "executeCommand:",
  79539. protocol: 'private',
  79540. fn: function (aString){
  79541. var self=this;
  79542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79543. return smalltalk.withContext(function($ctx1) {
  79544. //>>excludeEnd("ctx");
  79545. var $1;
  79546. var $early={};
  79547. try {
  79548. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  79549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79550. return smalltalk.withContext(function($ctx2) {
  79551. //>>excludeEnd("ctx");
  79552. $1=_st(names)._includes_(aString);
  79553. if(smalltalk.assert($1)){
  79554. _st(cmd)._value();
  79555. throw $early=[true];
  79556. };
  79557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79558. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  79559. //>>excludeEnd("ctx");
  79560. }));
  79561. return false;
  79562. }
  79563. catch(e) {if(e===$early)return e[0]; throw e}
  79564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79565. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},globals.Repl)});
  79566. //>>excludeEnd("ctx");
  79567. },
  79568. //>>excludeStart("ide", pragmas.excludeIdeData);
  79569. args: ["aString"],
  79570. 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",
  79571. referencedClasses: [],
  79572. //>>excludeEnd("ide");
  79573. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  79574. }),
  79575. globals.Repl);
  79576. smalltalk.addMethod(
  79577. smalltalk.method({
  79578. selector: "initialize",
  79579. protocol: 'initialization',
  79580. fn: function (){
  79581. var self=this;
  79582. function $DoIt(){return globals.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  79583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79584. return smalltalk.withContext(function($ctx1) {
  79585. //>>excludeEnd("ctx");
  79586. (
  79587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79588. $ctx1.supercall = true,
  79589. //>>excludeEnd("ctx");
  79590. globals.Repl.superclass.fn.prototype._initialize.apply(_st(self), []));
  79591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79592. $ctx1.supercall = false;
  79593. //>>excludeEnd("ctx");;
  79594. self["@session"]=_st($DoIt())._new();
  79595. self["@readline"]=_st(require)._value_("readline");
  79596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79597. $ctx1.sendIdx["value:"]=1;
  79598. //>>excludeEnd("ctx");
  79599. self["@util"]=_st(require)._value_("util");
  79600. self._setupCommands();
  79601. return self;
  79602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79603. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Repl)});
  79604. //>>excludeEnd("ctx");
  79605. },
  79606. //>>excludeStart("ide", pragmas.excludeIdeData);
  79607. args: [],
  79608. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  79609. referencedClasses: ["DoIt"],
  79610. //>>excludeEnd("ide");
  79611. messageSends: ["initialize", "new", "value:", "setupCommands"]
  79612. }),
  79613. globals.Repl);
  79614. smalltalk.addMethod(
  79615. smalltalk.method({
  79616. selector: "instanceVariableNamesFor:",
  79617. protocol: 'private',
  79618. fn: function (aClass){
  79619. var self=this;
  79620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79621. return smalltalk.withContext(function($ctx1) {
  79622. //>>excludeEnd("ctx");
  79623. var $2,$3,$1,$receiver;
  79624. $2=_st(aClass)._superclass();
  79625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79626. $ctx1.sendIdx["superclass"]=1;
  79627. //>>excludeEnd("ctx");
  79628. if(($receiver = $2) == null || $receiver.isNil){
  79629. $1=_st(aClass)._instanceVariableNames();
  79630. } else {
  79631. $3=_st(aClass)._instanceVariableNames();
  79632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79633. $ctx1.sendIdx["instanceVariableNames"]=1;
  79634. //>>excludeEnd("ctx");
  79635. $1=_st($3)._copyWithAll_(self._instanceVariableNamesFor_(_st(aClass)._superclass()));
  79636. };
  79637. return $1;
  79638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79639. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},globals.Repl)});
  79640. //>>excludeEnd("ctx");
  79641. },
  79642. //>>excludeStart("ide", pragmas.excludeIdeData);
  79643. args: ["aClass"],
  79644. 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]",
  79645. referencedClasses: [],
  79646. //>>excludeEnd("ide");
  79647. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  79648. }),
  79649. globals.Repl);
  79650. smalltalk.addMethod(
  79651. smalltalk.method({
  79652. selector: "isIdentifier:",
  79653. protocol: 'private',
  79654. fn: function (aString){
  79655. var self=this;
  79656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79657. return smalltalk.withContext(function($ctx1) {
  79658. //>>excludeEnd("ctx");
  79659. var $1;
  79660. $1=_st(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  79661. return $1;
  79662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79663. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},globals.Repl)});
  79664. //>>excludeEnd("ctx");
  79665. },
  79666. //>>excludeStart("ide", pragmas.excludeIdeData);
  79667. args: ["aString"],
  79668. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  79669. referencedClasses: [],
  79670. //>>excludeEnd("ide");
  79671. messageSends: ["match:", "asRegexp"]
  79672. }),
  79673. globals.Repl);
  79674. smalltalk.addMethod(
  79675. smalltalk.method({
  79676. selector: "isVariableDefined:",
  79677. protocol: 'private',
  79678. fn: function (aString){
  79679. var self=this;
  79680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79681. return smalltalk.withContext(function($ctx1) {
  79682. //>>excludeEnd("ctx");
  79683. var $1;
  79684. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  79685. return $1;
  79686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79687. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},globals.Repl)});
  79688. //>>excludeEnd("ctx");
  79689. },
  79690. //>>excludeStart("ide", pragmas.excludeIdeData);
  79691. args: ["aString"],
  79692. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  79693. referencedClasses: [],
  79694. //>>excludeEnd("ide");
  79695. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  79696. }),
  79697. globals.Repl);
  79698. smalltalk.addMethod(
  79699. smalltalk.method({
  79700. selector: "nextResultName",
  79701. protocol: 'private',
  79702. fn: function (){
  79703. var self=this;
  79704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79705. return smalltalk.withContext(function($ctx1) {
  79706. //>>excludeEnd("ctx");
  79707. var $1,$2,$receiver;
  79708. $1=self["@resultCount"];
  79709. if(($receiver = $1) == null || $receiver.isNil){
  79710. self["@resultCount"]=(1);
  79711. } else {
  79712. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  79713. };
  79714. $2="res".__comma(_st(self["@resultCount"])._asString());
  79715. return $2;
  79716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79717. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},globals.Repl)});
  79718. //>>excludeEnd("ctx");
  79719. },
  79720. //>>excludeStart("ide", pragmas.excludeIdeData);
  79721. args: [],
  79722. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  79723. referencedClasses: [],
  79724. //>>excludeEnd("ide");
  79725. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  79726. }),
  79727. globals.Repl);
  79728. smalltalk.addMethod(
  79729. smalltalk.method({
  79730. selector: "onKeyPress:",
  79731. protocol: 'private',
  79732. fn: function (key){
  79733. var self=this;
  79734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79735. return smalltalk.withContext(function($ctx1) {
  79736. //>>excludeEnd("ctx");
  79737. var $1;
  79738. $1=_st(_st(key)._ctrl())._and_((function(){
  79739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79740. return smalltalk.withContext(function($ctx2) {
  79741. //>>excludeEnd("ctx");
  79742. return _st(_st(key)._name()).__eq("l");
  79743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  79745. //>>excludeEnd("ctx");
  79746. }));
  79747. if(smalltalk.assert($1)){
  79748. self._clearScreen();
  79749. };
  79750. return self;
  79751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79752. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},globals.Repl)});
  79753. //>>excludeEnd("ctx");
  79754. },
  79755. //>>excludeStart("ide", pragmas.excludeIdeData);
  79756. args: ["key"],
  79757. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  79758. referencedClasses: [],
  79759. //>>excludeEnd("ide");
  79760. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  79761. }),
  79762. globals.Repl);
  79763. smalltalk.addMethod(
  79764. smalltalk.method({
  79765. selector: "parseAssignment:do:",
  79766. protocol: 'private',
  79767. fn: function (aString,aBlock){
  79768. var self=this;
  79769. var assignment;
  79770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79771. return smalltalk.withContext(function($ctx1) {
  79772. //>>excludeEnd("ctx");
  79773. var $3,$2,$1;
  79774. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  79775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79776. return smalltalk.withContext(function($ctx2) {
  79777. //>>excludeEnd("ctx");
  79778. return _st(s)._trimBoth();
  79779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79780. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  79781. //>>excludeEnd("ctx");
  79782. }));
  79783. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  79784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79785. return smalltalk.withContext(function($ctx2) {
  79786. //>>excludeEnd("ctx");
  79787. $3=_st(assignment)._first();
  79788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79789. $ctx2.sendIdx["first"]=1;
  79790. //>>excludeEnd("ctx");
  79791. return self._isIdentifier_($3);
  79792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  79794. //>>excludeEnd("ctx");
  79795. }));
  79796. if(smalltalk.assert($2)){
  79797. $1=_st(aBlock)._value_value_(_st(assignment)._first(),_st(assignment)._last());
  79798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79799. $ctx1.sendIdx["value:value:"]=1;
  79800. //>>excludeEnd("ctx");
  79801. } else {
  79802. $1=_st(aBlock)._value_value_(nil,nil);
  79803. };
  79804. return $1;
  79805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79806. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},globals.Repl)});
  79807. //>>excludeEnd("ctx");
  79808. },
  79809. //>>excludeStart("ide", pragmas.excludeIdeData);
  79810. args: ["aString", "aBlock"],
  79811. 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 ]",
  79812. referencedClasses: [],
  79813. //>>excludeEnd("ide");
  79814. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  79815. }),
  79816. globals.Repl);
  79817. smalltalk.addMethod(
  79818. smalltalk.method({
  79819. selector: "presentResultNamed:withValue:",
  79820. protocol: 'private',
  79821. fn: function (varName,value){
  79822. var self=this;
  79823. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  79824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79825. return smalltalk.withContext(function($ctx1) {
  79826. //>>excludeEnd("ctx");
  79827. var $3,$2,$1,$4;
  79828. $3=_st(_st(varName).__comma(": ")).__comma(_st(_st(value)._class())._name());
  79829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79830. $ctx1.sendIdx[","]=3;
  79831. //>>excludeEnd("ctx");
  79832. $2=_st($3).__comma(" = ");
  79833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79834. $ctx1.sendIdx[","]=2;
  79835. //>>excludeEnd("ctx");
  79836. $1=_st($2).__comma(_st(value)._asString());
  79837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79838. $ctx1.sendIdx[","]=1;
  79839. //>>excludeEnd("ctx");
  79840. _st($Transcript())._show_($1);
  79841. $4=_st($Transcript())._cr();
  79842. _st(self["@interface"])._prompt();
  79843. return self;
  79844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79845. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},globals.Repl)});
  79846. //>>excludeEnd("ctx");
  79847. },
  79848. //>>excludeStart("ide", pragmas.excludeIdeData);
  79849. args: ["varName", "value"],
  79850. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  79851. referencedClasses: ["Transcript"],
  79852. //>>excludeEnd("ide");
  79853. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  79854. }),
  79855. globals.Repl);
  79856. smalltalk.addMethod(
  79857. smalltalk.method({
  79858. selector: "printWelcome",
  79859. protocol: 'actions',
  79860. fn: function (){
  79861. var self=this;
  79862. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  79863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79864. return smalltalk.withContext(function($ctx1) {
  79865. //>>excludeEnd("ctx");
  79866. var $1;
  79867. _st($Transcript())._show_("Type :q to exit.");
  79868. $1=_st($Transcript())._cr();
  79869. return self;
  79870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79871. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},globals.Repl)});
  79872. //>>excludeEnd("ctx");
  79873. },
  79874. //>>excludeStart("ide", pragmas.excludeIdeData);
  79875. args: [],
  79876. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  79877. referencedClasses: ["Transcript"],
  79878. //>>excludeEnd("ide");
  79879. messageSends: ["show:", "cr"]
  79880. }),
  79881. globals.Repl);
  79882. smalltalk.addMethod(
  79883. smalltalk.method({
  79884. selector: "processLine:",
  79885. protocol: 'private',
  79886. fn: function (buffer){
  79887. var self=this;
  79888. var show;
  79889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79890. return smalltalk.withContext(function($ctx1) {
  79891. //>>excludeEnd("ctx");
  79892. var $1,$2;
  79893. show=(function(varName,value){
  79894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79895. return smalltalk.withContext(function($ctx2) {
  79896. //>>excludeEnd("ctx");
  79897. return self._presentResultNamed_withValue_(varName,value);
  79898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79899. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  79900. //>>excludeEnd("ctx");
  79901. });
  79902. $1=self._executeCommand_(buffer);
  79903. if(! smalltalk.assert($1)){
  79904. $2=self._isVariableDefined_(buffer);
  79905. if(smalltalk.assert($2)){
  79906. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  79907. } else {
  79908. self._assignNewVariable_do_(buffer,show);
  79909. };
  79910. };
  79911. return self;
  79912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79913. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},globals.Repl)});
  79914. //>>excludeEnd("ctx");
  79915. },
  79916. //>>excludeStart("ide", pragmas.excludeIdeData);
  79917. args: ["buffer"],
  79918. 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]]",
  79919. referencedClasses: [],
  79920. //>>excludeEnd("ide");
  79921. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  79922. }),
  79923. globals.Repl);
  79924. smalltalk.addMethod(
  79925. smalltalk.method({
  79926. selector: "prompt",
  79927. protocol: 'accessing',
  79928. fn: function (){
  79929. var self=this;
  79930. return "amber >> ";
  79931. },
  79932. //>>excludeStart("ide", pragmas.excludeIdeData);
  79933. args: [],
  79934. source: "prompt\x0a\x09^ 'amber >> '",
  79935. referencedClasses: [],
  79936. //>>excludeEnd("ide");
  79937. messageSends: []
  79938. }),
  79939. globals.Repl);
  79940. smalltalk.addMethod(
  79941. smalltalk.method({
  79942. selector: "setPreviousVariablesFor:from:",
  79943. protocol: 'private',
  79944. fn: function (newObject,oldObject){
  79945. var self=this;
  79946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79947. return smalltalk.withContext(function($ctx1) {
  79948. //>>excludeEnd("ctx");
  79949. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  79950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79951. return smalltalk.withContext(function($ctx2) {
  79952. //>>excludeEnd("ctx");
  79953. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  79954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79955. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  79956. //>>excludeEnd("ctx");
  79957. }));
  79958. return self;
  79959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79960. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},globals.Repl)});
  79961. //>>excludeEnd("ctx");
  79962. },
  79963. //>>excludeStart("ide", pragmas.excludeIdeData);
  79964. args: ["newObject", "oldObject"],
  79965. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  79966. referencedClasses: [],
  79967. //>>excludeEnd("ide");
  79968. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  79969. }),
  79970. globals.Repl);
  79971. smalltalk.addMethod(
  79972. smalltalk.method({
  79973. selector: "setPrompt",
  79974. protocol: 'actions',
  79975. fn: function (){
  79976. var self=this;
  79977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79978. return smalltalk.withContext(function($ctx1) {
  79979. //>>excludeEnd("ctx");
  79980. _st(self["@interface"])._setPrompt_(self._prompt());
  79981. return self;
  79982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  79983. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},globals.Repl)});
  79984. //>>excludeEnd("ctx");
  79985. },
  79986. //>>excludeStart("ide", pragmas.excludeIdeData);
  79987. args: [],
  79988. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  79989. referencedClasses: [],
  79990. //>>excludeEnd("ide");
  79991. messageSends: ["setPrompt:", "prompt"]
  79992. }),
  79993. globals.Repl);
  79994. smalltalk.addMethod(
  79995. smalltalk.method({
  79996. selector: "setupCommands",
  79997. protocol: 'initialization',
  79998. fn: function (){
  79999. var self=this;
  80000. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  80001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80002. return smalltalk.withContext(function($ctx1) {
  80003. //>>excludeEnd("ctx");
  80004. var $2,$1;
  80005. $2=_st([":q"]).__minus_gt((function(){
  80006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80007. return smalltalk.withContext(function($ctx2) {
  80008. //>>excludeEnd("ctx");
  80009. return _st(process)._exit();
  80010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  80012. //>>excludeEnd("ctx");
  80013. }));
  80014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80015. $ctx1.sendIdx["->"]=1;
  80016. //>>excludeEnd("ctx");
  80017. $1=[$2,_st([""]).__minus_gt((function(){
  80018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80019. return smalltalk.withContext(function($ctx2) {
  80020. //>>excludeEnd("ctx");
  80021. return _st(self["@interface"])._prompt();
  80022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  80024. //>>excludeEnd("ctx");
  80025. }))];
  80026. self["@commands"]=_st($Dictionary())._from_($1);
  80027. return self;
  80028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80029. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.Repl)});
  80030. //>>excludeEnd("ctx");
  80031. },
  80032. //>>excludeStart("ide", pragmas.excludeIdeData);
  80033. args: [],
  80034. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  80035. referencedClasses: ["Dictionary"],
  80036. //>>excludeEnd("ide");
  80037. messageSends: ["from:", "->", "exit", "prompt"]
  80038. }),
  80039. globals.Repl);
  80040. smalltalk.addMethod(
  80041. smalltalk.method({
  80042. selector: "setupHotkeys",
  80043. protocol: 'initialization',
  80044. fn: function (){
  80045. var self=this;
  80046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80047. return smalltalk.withContext(function($ctx1) {
  80048. //>>excludeEnd("ctx");
  80049. var $receiver;
  80050. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  80051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80052. return smalltalk.withContext(function($ctx2) {
  80053. //>>excludeEnd("ctx");
  80054. if(($receiver = key) == null || $receiver.isNil){
  80055. return key;
  80056. } else {
  80057. return self._onKeyPress_(key);
  80058. };
  80059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80060. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  80061. //>>excludeEnd("ctx");
  80062. }));
  80063. return self;
  80064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80065. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},globals.Repl)});
  80066. //>>excludeEnd("ctx");
  80067. },
  80068. //>>excludeStart("ide", pragmas.excludeIdeData);
  80069. args: [],
  80070. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  80071. referencedClasses: [],
  80072. //>>excludeEnd("ide");
  80073. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  80074. }),
  80075. globals.Repl);
  80076. smalltalk.addMethod(
  80077. smalltalk.method({
  80078. selector: "subclass:withVariable:",
  80079. protocol: 'private',
  80080. fn: function (aClass,varName){
  80081. var self=this;
  80082. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  80083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80084. return smalltalk.withContext(function($ctx1) {
  80085. //>>excludeEnd("ctx");
  80086. var $1;
  80087. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  80088. return $1;
  80089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80090. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},globals.Repl)});
  80091. //>>excludeEnd("ctx");
  80092. },
  80093. //>>excludeStart("ide", pragmas.excludeIdeData);
  80094. args: ["aClass", "varName"],
  80095. 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'",
  80096. referencedClasses: ["ClassBuilder"],
  80097. //>>excludeEnd("ide");
  80098. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  80099. }),
  80100. globals.Repl);
  80101. smalltalk.addMethod(
  80102. smalltalk.method({
  80103. selector: "subclassNameFor:",
  80104. protocol: 'private',
  80105. fn: function (aClass){
  80106. var self=this;
  80107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80108. return smalltalk.withContext(function($ctx1) {
  80109. //>>excludeEnd("ctx");
  80110. var $3,$2,$7,$6,$5,$4,$8,$1,$receiver;
  80111. $3=_st(aClass)._name();
  80112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80113. $ctx1.sendIdx["name"]=1;
  80114. //>>excludeEnd("ctx");
  80115. $2=_st($3)._matchesOf_("\x5cd+$");
  80116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80117. $ctx1.sendIdx["matchesOf:"]=1;
  80118. //>>excludeEnd("ctx");
  80119. if(($receiver = $2) == null || $receiver.isNil){
  80120. $1=_st(_st(aClass)._name()).__comma("2");
  80121. } else {
  80122. var counter;
  80123. $7=_st(aClass)._name();
  80124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80125. $ctx1.sendIdx["name"]=2;
  80126. //>>excludeEnd("ctx");
  80127. $6=_st($7)._matchesOf_("\x5cd+$");
  80128. $5=_st($6)._first();
  80129. $4=_st($5)._asNumber();
  80130. counter=_st($4).__plus((1));
  80131. counter;
  80132. $8=_st(aClass)._name();
  80133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80134. $ctx1.sendIdx["name"]=3;
  80135. //>>excludeEnd("ctx");
  80136. $1=_st($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  80137. };
  80138. return $1;
  80139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80140. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},globals.Repl)});
  80141. //>>excludeEnd("ctx");
  80142. },
  80143. //>>excludeStart("ide", pragmas.excludeIdeData);
  80144. args: ["aClass"],
  80145. 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'].",
  80146. referencedClasses: [],
  80147. //>>excludeEnd("ide");
  80148. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  80149. }),
  80150. globals.Repl);
  80151. smalltalk.addMethod(
  80152. smalltalk.method({
  80153. selector: "main",
  80154. protocol: 'initialization',
  80155. fn: function (){
  80156. var self=this;
  80157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80158. return smalltalk.withContext(function($ctx1) {
  80159. //>>excludeEnd("ctx");
  80160. _st(self._new())._createInterface();
  80161. return self;
  80162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  80163. }, function($ctx1) {$ctx1.fill(self,"main",{},globals.Repl.klass)});
  80164. //>>excludeEnd("ctx");
  80165. },
  80166. //>>excludeStart("ide", pragmas.excludeIdeData);
  80167. args: [],
  80168. source: "main\x0a\x09self new createInterface",
  80169. referencedClasses: [],
  80170. //>>excludeEnd("ide");
  80171. messageSends: ["createInterface", "new"]
  80172. }),
  80173. globals.Repl.klass);
  80174. });
  80175. define("amber_vm/boot", ["amber/boot"], function (boot) { return boot; });
  80176. 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) {
  80177. boot.vm.initialize();
  80178. var vm = boot.vm, globals = boot.globals;
  80179. globals.AmberCli._main();
  80180. });
  80181. requirejs("amber/_init");