Kernel-Infrastructure.js 200 KB

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