123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933 |
- define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
- var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
- var $pkg = $core.addPackage("Kernel-Methods");
- $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
- $core.addClass("BlockClosure", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.BlockClosure, ["prototype", "length"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.BlockClosure.comment="I represent a lexical closure.\x0aI am is directly mapped to JavaScript Function.\x0a\x0a## API\x0a\x0a1. Evaluation\x0a\x0a My instances get evaluated with the `#value*` methods in the 'evaluating' protocol.\x0a\x0a Example: ` [ :x | x + 1 ] value: 3 \x22Answers 4\x22 `\x0a\x0a2. Control structures\x0a\x0a Blocks are used (together with `Boolean`) for control structures (methods in the `controlling` protocol).\x0a\x0a Example: `aBlock whileTrue: [ ... ]`\x0a\x0a3. Error handling\x0a\x0a I provide the `#on:do:` method for handling exceptions.\x0a\x0a Example: ` aBlock on: MessageNotUnderstood do: [ :ex | ... ] `";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "applyTo:arguments:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject", "aCollection"],
- source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self.apply(anObject, aCollection)"]]],
- messageSends: []
- }, function ($methodClass){ return function (anObject,aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self.apply(anObject, aCollection);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "asCompiledMethod:",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return $core.method({selector:aString, fn:self});"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $core.method({selector:aString, fn:self});;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "asJavaScriptObject",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "asJavaScriptObject\x0a\x09^ self",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return self;
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "asJavaScriptSource",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "asJavaScriptSource\x0a\x09<inlineJS: 'return $self.toString();'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return $self.toString();"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self.toString();;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "compiledSource",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self.toString()"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self.toString();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"compiledSource",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "currySelf",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "currySelf\x0a\x09\x22Transforms [ :selfarg :x :y | stcode ] block\x0a\x09which represents JS function (selfarg, x, y, ...) {jscode}\x0a\x09into function (x, y, ...) {jscode} that takes selfarg from 'this'.\x0a\x09IOW, it is usable as JS method and first arg takes the receiver.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return function () {\x0a\x09\x09\x09var args = [ this ];\x0a\x09\x09\x09args.push.apply(args, arguments);\x0a\x09\x09\x09return self.apply(null, args);\x0a\x09\x09}\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return function () {
- var args = [ this ];
- args.push.apply(args, arguments);
- return self.apply(null, args);
- }
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "ensure:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["try{return $self._value()}finally{aBlock._value()}"]]],
- messageSends: []
- }, function ($methodClass){ return function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- try{return $self._value()}finally{aBlock._value()};
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "fork",
- protocol: "timeout/interval",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "fork\x0a\x09ForkPool default fork: self",
- referencedClasses: ["ForkPool"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["fork:", "default"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($recv($globals.ForkPool)._default())._fork_(self);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"fork",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "new",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "new\x0a\x09\x22Use the receiver as a JS constructor.\x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<inlineJS: 'return new self()'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return new self()"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return new self();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"new",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["newWithValues:"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._newWithValues_([anObject]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject", "anObject2"],
- source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["newWithValues:"]
- }, function ($methodClass){ return function (anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._newWithValues_([anObject,anObject2]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newValue:value:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject", "anObject2", "anObject3"],
- source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["newWithValues:"]
- }, function ($methodClass){ return function (anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._newWithValues_([anObject,anObject2,anObject3]);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "newWithValues:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aCollection"],
- source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<inlineJS: '\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var object = Object.create(self.prototype);\x0a\x09\x09var result = self.apply(object, aCollection);\x0a\x09\x09return typeof result === \x22object\x22 ? result : object;\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var object = Object.create(self.prototype);
- var result = self.apply(object, aCollection);
- return typeof result === "object" ? result : object;
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "numArgs",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "numArgs\x0a\x09^ length",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.length;
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "on:do:",
- protocol: "error handling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anErrorClass", "aBlock"],
- source: "on: anErrorClass do: aBlock\x0a\x09^ Smalltalk try: self ifTrue: [ :err | err isKindOf: anErrorClass ] catch: aBlock",
- referencedClasses: ["Smalltalk"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["try:ifTrue:catch:", "isKindOf:"]
- }, function ($methodClass){ return function (anErrorClass,aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($globals.Smalltalk)._try_ifTrue_catch_(self,(function(err){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(err)._isKindOf_(anErrorClass);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
- //>>excludeEnd("ctx");
- }),aBlock);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "prototype",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "prototype\x0a\x09^ prototype",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.prototype;
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "provided",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
- referencedClasses: ["JSObjectProxy"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["on:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($globals.JSObjectProxy)._on_(self);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"provided",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "receiver\x0a\x09^ nil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return nil;
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "timeToRun",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
- referencedClasses: ["Date"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["millisecondsToRun:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($globals.Date)._millisecondsToRun_(self);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"timeToRun",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "tryCatch:",
- protocol: "error handling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "tryCatch: aBlock\x0a\x09\x22Too low-level. Try more high-level alternatives like:\x0a\x09\x09[ ... ] on: Error do: [ ... ]\x0a\x09\x09Smalltalk try: [ ... ] ifTrue: [ ... ] catch: [ ... ]\x0a\x09\x09[ ... ] tryIfTrue: [ ... ] catch: [ ... ]\x22\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- try {
- return $self._value();
- } catch(error) {
- // pass non-local returns undetected
- if (Array.isArray(error) && error.length === 1) throw error;
- return aBlock._value_(error);
- }
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "tryIfTrue:catch:",
- protocol: "error handling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anotherBlock", "aBlock"],
- source: "tryIfTrue: anotherBlock catch: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09if (!anotherBlock._value_(error)) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09try {\x0a\x09\x09\x09return $self._value();\x0a\x09\x09} catch(error) {\x0a\x09\x09\x09// pass non-local returns undetected\x0a\x09\x09\x09if (Array.isArray(error) && error.length === 1) throw error;\x0a\x09\x09\x09if (!anotherBlock._value_(error)) throw error;\x0a\x09\x09\x09return aBlock._value_(error);\x0a\x09\x09}\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (anotherBlock,aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- try {
- return $self._value();
- } catch(error) {
- // pass non-local returns undetected
- if (Array.isArray(error) && error.length === 1) throw error;
- if (!anotherBlock._value_(error)) throw error;
- return aBlock._value_(error);
- }
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"tryIfTrue:catch:",{anotherBlock:anotherBlock,aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "value\x0a\x09<inlineJS: 'return self();'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self();"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self();;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArg"],
- source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self(anArg);"]]],
- messageSends: []
- }, function ($methodClass){ return function (anArg){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self(anArg);;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArg", "secondArg"],
- source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self(firstArg, secondArg);"]]],
- messageSends: []
- }, function ($methodClass){ return function (firstArg,secondArg){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self(firstArg, secondArg);;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArg", "secondArg", "thirdArg"],
- source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self(firstArg, secondArg, thirdArg);"]]],
- messageSends: []
- }, function ($methodClass){ return function (firstArg,secondArg,thirdArg){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self(firstArg, secondArg, thirdArg);;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithInterval:",
- protocol: "timeout/interval",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNumber"],
- source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aNumber){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var interval = setInterval(self, aNumber);
- return $globals.Timeout._on_(interval);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aCollection"],
- source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return self.apply(null, aCollection);"]]],
- messageSends: []
- }, function ($methodClass){ return function (aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return self.apply(null, aCollection);;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "valueWithTimeout:",
- protocol: "timeout/interval",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aNumber"],
- source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aNumber){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var timeout = setTimeout(self, aNumber);
- return $globals.Timeout._on_(timeout);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileFalse",
- protocol: "controlling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "whileFalse\x0a\x09self whileFalse: []",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["whileFalse:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._whileFalse_((function(){
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"whileFalse",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileFalse:",
- protocol: "controlling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["while(!$core.assert($self._value())) {aBlock._value()}"]]],
- messageSends: []
- }, function ($methodClass){ return function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- while(!$core.assert($self._value())) {aBlock._value()};
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileTrue",
- protocol: "controlling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "whileTrue\x0a\x09self whileTrue: []",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["whileTrue:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._whileTrue_((function(){
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"whileTrue",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "whileTrue:",
- protocol: "controlling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["while($core.assert($self._value())) {aBlock._value()}"]]],
- messageSends: []
- }, function ($methodClass){ return function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- while($core.assert($self._value())) {aBlock._value()};
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure);
- $core.addMethod(
- $core.method({
- selector: "javaScriptConstructorFor:initializingVia:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aPrototype", "aMethodBlock"],
- source: "javaScriptConstructorFor: aPrototype initializingVia: aMethodBlock\x0a\x09<inlineJS: '\x0a\x09\x09function Ctr () {\x0a\x09\x09\x09aMethodBlock.apply(this, arguments);\x0a\x09\x09}\x0a\x09\x09Ctr.prototype = aPrototype;\x0a\x09\x09return Ctr;\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09function Ctr () {\x0a\x09\x09\x09aMethodBlock.apply(this, arguments);\x0a\x09\x09}\x0a\x09\x09Ctr.prototype = aPrototype;\x0a\x09\x09return Ctr;\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aPrototype,aMethodBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- function Ctr () {
- aMethodBlock.apply(this, arguments);
- }
- Ctr.prototype = aPrototype;
- return Ctr;
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"javaScriptConstructorFor:initializingVia:",{aPrototype:aPrototype,aMethodBlock:aMethodBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.BlockClosure.a$cls);
- $core.addClass("CompiledMethod", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.CompiledMethod, ["args", "instantiateFn", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.CompiledMethod.comment="I represent a class method of the system. I hold the source and compiled code of a class method.\x0a\x0a## API\x0aMy instances can be accessed using `Behavior >> #methodAt:`\x0a\x0a Object methodAt: 'asString'\x0a\x0aSource code access:\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aReferenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aMessages sent from an instance:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "arguments\x0a\x09^ args ifNil: [ #() ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.args;
- if($1 == null || $1.a$nil){
- return [];
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "asString\x0a\x09^ self asStringForClass: self methodClass",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["asStringForClass:", "methodClass"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._asStringForClass_($self._methodClass());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"asString",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "asStringForClass:",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aClass"],
- source: "asStringForClass: aClass\x0a\x09| result |\x0a\x09result := aClass name.\x0a\x09self methodClass = aClass \x0a\x09\x09ifFalse: [ result := result, ' (', (self methodClass ifNil: [ 'nil' ] ifNotNil: [ self methodClass name ]), ')'].\x0a\x09(self origin = aClass | (self origin = self methodClass)) \x0a\x09\x09ifFalse: [ result := result, ' /', (self origin ifNil: [ 'nil' ] ifNotNil: [ self origin name ]), '/'].\x0a\x09^ result, ' >> ', self selector symbolPrintString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["name", "ifFalse:", "=", "methodClass", ",", "ifNil:ifNotNil:", "|", "origin", "symbolPrintString", "selector"]
- }, function ($methodClass){ return function (aClass){
- var self=this,$self=this;
- var result;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3,$4,$5,$6;
- result=[$recv(aClass)._name()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["name"]=1
- //>>excludeEnd("ctx");
- ][0];
- if(!$core.assert([$recv([$self._methodClass()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodClass"]=1
- //>>excludeEnd("ctx");
- ][0]).__eq(aClass)
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["="]=1
- //>>excludeEnd("ctx");
- ][0])){
- $1=[$recv(result).__comma(" (")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=3
- //>>excludeEnd("ctx");
- ][0];
- $2=[$self._methodClass()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodClass"]=2
- //>>excludeEnd("ctx");
- ][0];
- if($2 == null || $2.a$nil){
- $3="nil";
- } else {
- $3=[$recv([$self._methodClass()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodClass"]=3
- //>>excludeEnd("ctx");
- ][0])._name()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["name"]=2
- //>>excludeEnd("ctx");
- ][0];
- }
- result=[$recv([$recv($1).__comma($3)
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=2
- //>>excludeEnd("ctx");
- ][0]).__comma(")")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=1
- //>>excludeEnd("ctx");
- ][0];
- result;
- }
- if(!$core.assert($recv([$recv([$self._origin()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["origin"]=1
- //>>excludeEnd("ctx");
- ][0]).__eq(aClass)
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["="]=2
- //>>excludeEnd("ctx");
- ][0]).__or($recv([$self._origin()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["origin"]=2
- //>>excludeEnd("ctx");
- ][0]).__eq($self._methodClass())))){
- $4=[$recv(result).__comma(" /")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=6
- //>>excludeEnd("ctx");
- ][0];
- $5=[$self._origin()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["origin"]=3
- //>>excludeEnd("ctx");
- ][0];
- if($5 == null || $5.a$nil){
- $6="nil";
- } else {
- $6=$recv($self._origin())._name();
- }
- result=[$recv([$recv($4).__comma($6)
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=5
- //>>excludeEnd("ctx");
- ][0]).__comma("/")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=4
- //>>excludeEnd("ctx");
- ][0];
- result;
- }
- return [$recv($recv(result).__comma(" >> ")).__comma($recv($self._selector())._symbolPrintString())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=7
- //>>excludeEnd("ctx");
- ][0];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"asStringForClass:",{aClass:aClass,result:result})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "basicPragmas",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "basicPragmas\x0a\x09^ pragmas ifNil: [ #() ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.pragmas;
- if($1 == null || $1.a$nil){
- return [];
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"basicPragmas",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "browse",
- protocol: "browsing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "browse\x0a\x09Finder findMethod: self",
- referencedClasses: ["Finder"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["findMethod:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($globals.Finder)._findMethod_(self);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"browse",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "category",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "category\x0a\x09^ self protocol",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["protocol"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $self._protocol();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"category",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "defaultProtocol",
- protocol: "defaults",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return "as yet unclassified";
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "fn",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "fn\x0a\x09^ fn",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.fn;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "instantiateFn",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "instantiateFn\x0a\x09^ instantiateFn",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.instantiateFn;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "instantiateFn:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "instantiateFn: anObject\x0a\x09instantiateFn := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.instantiateFn=anObject;
- return self;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isCompiledMethod",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isCompiledMethod\x0a\x09^ true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return true;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isOverridden",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $early={};
- try {
- $recv($self._methodClass())._allSubclassesDo_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- if($core.assert($recv(each)._includesSelector_($self.selector))){
- throw $early=[true];
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- return false;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isOverridden",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "isOverride",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isOverride\x0a\x09| superclass |\x0a \x0a superclass := self methodClass superclass.\x0a\x09superclass ifNil: [ ^ false ].\x0a\x09\x0a ^ (self methodClass superclass lookupSelector: self selector) notNil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- var superclass;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- superclass=[$recv([$self._methodClass()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodClass"]=1
- //>>excludeEnd("ctx");
- ][0])._superclass()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["superclass"]=1
- //>>excludeEnd("ctx");
- ][0];
- $1=superclass;
- if($1 == null || $1.a$nil){
- return false;
- } else {
- $1;
- }
- return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "messageSends",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "messageSends\x0a\x09^ messageSends",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.messageSends;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "methodClass",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "methodClass\x0a\x09^ methodClass",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.methodClass;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "origin",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "origin\x0a\x09^ owner",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.owner;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "package",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "package\x0a\x09\x22Answer the package the receiver belongs to:\x0a\x09- if it is an extension method, answer the corresponding package\x0a\x09- else answer the `methodClass` package\x22\x0a\x09\x0a\x09^ self origin ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNotNil:", "origin", "packageOfProtocol:", "protocol"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._origin();
- if($1 == null || $1.a$nil){
- return $1;
- } else {
- var class_;
- class_=$1;
- return $recv(class_)._packageOfProtocol_($self._protocol());
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"package",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "pragmas",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "pragmas\x0a\x09^ self basicPragmas collect: [ :each | Message selector: each first arguments: each second ]",
- referencedClasses: ["Message"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["collect:", "basicPragmas", "selector:arguments:", "first", "second"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._basicPragmas())._collect_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv($globals.Message)._selector_arguments_($recv(each)._first(),$recv(each)._second());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "pragmas:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArrayOfMessages"],
- source: "pragmas: anArrayOfMessages\x0a\x09pragmas := anArrayOfMessages collect: [ :each | { each selector. each arguments } ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["collect:", "selector", "arguments"]
- }, function ($methodClass){ return function (anArrayOfMessages){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self.pragmas=$recv(anArrayOfMessages)._collect_((function(each){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return [$recv(each)._selector(),$recv(each)._arguments()];
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
- //>>excludeEnd("ctx");
- }));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"pragmas:",{anArrayOfMessages:anArrayOfMessages})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "protocol",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:", "defaultProtocol"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.protocol;
- if($1 == null || $1.a$nil){
- return $self._defaultProtocol();
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"protocol",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "protocol:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "protocol: aString\x0a\x09| oldProtocol |\x0a\x09oldProtocol := self protocol.\x0a\x09protocol := aString.\x0a\x0a\x09oldProtocol ifNotNil: [\x0a\x09\x09SystemAnnouncer current announce: (MethodMoved new\x0a\x09\x09\x09method: self;\x0a\x09\x09\x09oldProtocol: oldProtocol;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09self origin ifNotNil: [ :origin |\x0a\x09\x09origin organization addElement: aString.\x0a\x09\x09origin removeProtocolIfEmpty: oldProtocol ]",
- referencedClasses: ["SystemAnnouncer", "MethodMoved"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["protocol", "ifNotNil:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "origin", "addElement:", "organization", "removeProtocolIfEmpty:"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- var oldProtocol;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2,$3,$4;
- oldProtocol=$self._protocol();
- $self.protocol=aString;
- $1=oldProtocol;
- if($1 == null || $1.a$nil){
- $1;
- } else {
- $2=$recv($globals.SystemAnnouncer)._current();
- $3=$recv($globals.MethodMoved)._new();
- $recv($3)._method_(self);
- $recv($3)._oldProtocol_(oldProtocol);
- $recv($2)._announce_($recv($3)._yourself());
- }
- $4=$self._origin();
- if($4 == null || $4.a$nil){
- $4;
- } else {
- var origin;
- origin=$4;
- $recv($recv(origin)._organization())._addElement_(aString);
- $recv(origin)._removeProtocolIfEmpty_(oldProtocol);
- }
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "referencedClasses",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "referencedClasses\x0a\x09^ referencedClasses",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.referencedClasses;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.selector;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- $self.selector=aString;
- return self;
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "sendTo:arguments:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject", "aCollection"],
- source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["applyTo:arguments:", "fn"]
- }, function ($methodClass){ return function (anObject,aCollection){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "source",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "source\x0a\x09^ source ifNil: [ '' ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.source;
- if($1 == null || $1.a$nil){
- return "";
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"source",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.CompiledMethod);
- $core.addMethod(
- $core.method({
- selector: "source:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "source: aString\x0a\x09source := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- $self.source=aString;
- return self;
- }; }),
- $globals.CompiledMethod);
- $core.addClass("ForkPool", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.ForkPool, ["poolSize", "maxPoolSize", "queue", "worker"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.ForkPool.comment="I am responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0a## API\x0a\x0aThe default instance is accessed with `#default`.\x0aThe maximum concurrent forked blocks can be set with `#maxPoolSize:`.\x0a\x0aForking is done via `BlockClosure >> #fork`";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "addWorker",
- protocol: "private",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["valueWithTimeout:", "+"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self.worker)._valueWithTimeout_((0));
- $self.poolSize=$recv($self.poolSize).__plus((1));
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"addWorker",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "defaultMaxPoolSize",
- protocol: "defaults",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["defaultMaxPoolSize", "class"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._class())._defaultMaxPoolSize();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "fork:",
- protocol: "actions",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aBlock"],
- source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
- }, function ($methodClass){ return function (aBlock){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- if($core.assert($recv($self.poolSize).__lt($self._maxPoolSize()))){
- $self._addWorker();
- }
- $recv($self.queue)._nextPut_(aBlock);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
- referencedClasses: ["Queue"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["initialize", "new", "makeWorker"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- [(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.supercall = false
- //>>excludeEnd("ctx");
- ][0];
- $self.poolSize=(0);
- $self.queue=$recv($globals.Queue)._new();
- $self.worker=$self._makeWorker();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "makeWorker",
- protocol: "initialization",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^ [ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue nextIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ] ]]",
- referencedClasses: ["Object"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- var sentinel;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- sentinel=$recv($globals.Object)._new();
- return (function(){
- var block;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- $self.poolSize=$recv($self.poolSize).__minus((1));
- block=$recv($self.queue)._nextIfAbsent_((function(){
- return sentinel;
- }));
- if(!$core.assert($recv(block).__eq_eq(sentinel))){
- return $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $recv(block)._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
- //>>excludeEnd("ctx");
- }))._ensure_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx3) {
- //>>excludeEnd("ctx");
- return $self._addWorker();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
- //>>excludeEnd("ctx");
- }));
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
- //>>excludeEnd("ctx");
- });
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "maxPoolSize",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:", "defaultMaxPoolSize"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.maxPoolSize;
- if($1 == null || $1.a$nil){
- return $self._defaultMaxPoolSize();
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool);
- $core.addMethod(
- $core.method({
- selector: "maxPoolSize:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anInteger"],
- source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anInteger){
- var self=this,$self=this;
- $self.maxPoolSize=anInteger;
- return self;
- }; }),
- $globals.ForkPool);
- $core.setSlots($globals.ForkPool.a$cls, ["default"]);
- $core.addMethod(
- $core.method({
- selector: "default",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "default\x0a\x09^ default ifNil: [ default := self new ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:", "new"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.default;
- if($1 == null || $1.a$nil){
- $self.default=$self._new();
- return $self.default;
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"default",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.ForkPool.a$cls);
- $core.addMethod(
- $core.method({
- selector: "defaultMaxPoolSize",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "defaultMaxPoolSize\x0a\x09^ 100",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return (100);
- }; }),
- $globals.ForkPool.a$cls);
- $core.addMethod(
- $core.method({
- selector: "resetDefault",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "resetDefault\x0a\x09default := nil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- $self.default=nil;
- return self;
- }; }),
- $globals.ForkPool.a$cls);
- $core.addClass("Message", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.Message, ["selector", "arguments"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.Message.comment="In general, the system does not use instances of me for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission.\x0aThis instance is sent it as an argument with the message `#doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object >> #doesNotUnderstand:`\x0a\x0a## API\x0a\x0aBesides accessing methods, `#sendTo:` provides a convenient way to send a message to an object.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "arguments\x0a\x09^ arguments",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.arguments;
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArray"],
- source: "arguments: anArray\x0a\x09arguments := anArray",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anArray){
- var self=this,$self=this;
- $self.arguments=anArray;
- return self;
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: "printing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["printOn:", "nextPutAll:", "selector"]
- }, function ($methodClass){ return function (aStream){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- [(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.supercall = false
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_("(")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=1
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_($self._selector())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=2
- //>>excludeEnd("ctx");
- ][0];
- $recv(aStream)._nextPutAll_(")");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.selector;
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "selector: aString\x0a\x09selector := aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- $self.selector=aString;
- return self;
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "sendTo:",
- protocol: "actions",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["perform:withArguments:", "selector", "arguments"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Message);
- $core.addMethod(
- $core.method({
- selector: "selector:arguments:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anArray"],
- source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["selector:", "new", "arguments:", "yourself"]
- }, function ($methodClass){ return function (aString,anArray){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._selector_(aString);
- $recv($1)._arguments_(anArray);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Message.a$cls);
- $core.addMethod(
- $core.method({
- selector: "selector:arguments:notUnderstoodBy:",
- protocol: "dnu handling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anArray", "anObject"],
- source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["doesNotUnderstand:", "selector:arguments:"]
- }, function ($methodClass){ return function (aString,anArray,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Message.a$cls);
- $core.addClass("MessageSend", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.MessageSend, ["receiver", "message"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.MessageSend.comment="I encapsulate message sends to objects. Arguments can be either predefined or supplied when the message send is performed. \x0a\x0a## API\x0a\x0aUse `#value` to perform a message send with its predefined arguments and `#value:*` if additonal arguments have to supplied.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "arguments",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "arguments\x0a\x09^ message arguments",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self.message)._arguments();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "arguments:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArray"],
- source: "arguments: anArray\x0a\x09message arguments: anArray",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments:"]
- }, function ($methodClass){ return function (anArray){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self.message)._arguments_(anArray);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "initialize",
- protocol: "initialization",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
- referencedClasses: ["Message"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["initialize", "new"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- [(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.supercall = false
- //>>excludeEnd("ctx");
- ][0];
- $self.message=$recv($globals.Message)._new();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: "printing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self receiver;\x0a\x09\x09nextPutAll: ' >> ';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
- }, function ($methodClass){ return function (aStream){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- [(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.supercall = false
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_("(")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=1
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_($self._receiver())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=2
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_(" >> ")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=3
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_($self._selector())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=4
- //>>excludeEnd("ctx");
- ][0];
- $recv(aStream)._nextPutAll_(")");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "receiver\x0a\x09^ receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.receiver;
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "receiver:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "receiver: anObject\x0a\x09receiver := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.receiver=anObject;
- return self;
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ message selector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["selector"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self.message)._selector();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "selector:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "selector: aString\x0a\x09message selector: aString",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["selector:"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $recv($self.message)._selector_(aString);
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "value\x0a\x09^ message sendTo: self receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["sendTo:", "receiver"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self.message)._sendTo_($self._receiver());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.message;
- $recv($1)._arguments_([anObject]);
- return $recv($1)._sendTo_($self._receiver());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArgument", "secondArgument"],
- source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }, function ($methodClass){ return function (firstArgument,secondArgument){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.message;
- $recv($1)._arguments_([firstArgument,secondArgument]);
- return $recv($1)._sendTo_($self._receiver());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "value:value:value:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["firstArgument", "secondArgument", "thirdArgument"],
- source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments:", "sendTo:", "receiver"]
- }, function ($methodClass){ return function (firstArgument,secondArgument,thirdArgument){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.message;
- $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
- return $recv($1)._sendTo_($self._receiver());
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addMethod(
- $core.method({
- selector: "valueWithPossibleArguments:",
- protocol: "evaluating",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anArray"],
- source: "valueWithPossibleArguments: anArray\x0a\x09self arguments: anArray.\x0a\x09^ self value",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["arguments:", "value"]
- }, function ($methodClass){ return function (anArray){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._arguments_(anArray);
- return $self._value();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{anArray:anArray})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MessageSend);
- $core.addClass("MethodContext", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.MethodContext, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.MethodContext.comment="I hold all the dynamic state associated with the execution of either a method activation resulting from a message send. I am used to build the call stack while debugging.\x0a\x0aMy instances are JavaScript `SmalltalkMethodContext` objects defined in `boot.js`.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "basicReceiver",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "basicReceiver\x0a\x09^ receiver",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.receiver;
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "evaluatedSelector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.evaluatedSelector;
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "home",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "home\x0a\x09^ homeContext ifNotNil: [ :c | c hydrated ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNotNil:", "hydrated"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.homeContext;
- if($1 == null || $1.a$nil){
- return $1;
- } else {
- var c;
- c=$1;
- return $recv(c)._hydrated();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"home",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "hydrated",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "hydrated\x0a\x09<inlineJS: 'if (!$self.selector && !$self.outerContext) $self.setup(self); return self;'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["if (!$self.selector && !$self.outerContext) $self.setup(self); return self;"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- if (!$self.selector && !$self.outerContext) $self.setup(self); return self;;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"hydrated",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "index\x0a\x09^ index ifNil: [ 0 ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.index;
- if($1 == null || $1.a$nil){
- return (0);
- } else {
- return $1;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"index",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "locals\x0a\x09^ locals",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.locals;
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ] ifNotNil: [ :c | c hydrated ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:ifNotNil:", "home", "hydrated"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.outerContext;
- if($1 == null || $1.a$nil){
- return $self._home();
- } else {
- var c;
- c=$1;
- return $recv(c)._hydrated();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
- referencedClasses: ["Smalltalk"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNotNil:", "js2st:", "core"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self.selector;
- if($1 == null || $1.a$nil){
- return $1;
- } else {
- return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "sendIndexes\x0a\x09^ sendIdx",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- return $self.sendIdx;
- }; }),
- $globals.MethodContext);
- $core.addMethod(
- $core.method({
- selector: "supercall",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "supercall\x0a\x09^ supercall = true",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["="]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self.supercall).__eq(true);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.MethodContext);
- $core.addClass("NativeFunction", $globals.Object, "Kernel-Methods");
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.NativeFunction.comment="I am a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0a## API\x0a\x0aSee the class-side `instance creation` methods for instance creation.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0a## Usage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return new nativeFunc();
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject"],
- source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return new nativeFunc(anObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject", "anObject2"],
- source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return new nativeFunc(anObject,anObject2);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorNamed:value:value:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject", "anObject2", "anObject3"],
- source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return new nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc"],
- source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return new nativeFunc();
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject"],
- source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return new nativeFunc(anObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject", "anObject2"],
- source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return new nativeFunc(anObject,anObject2);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "constructorOf:value:value:value:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
- source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return new nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "exists:",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
- referencedClasses: ["Platform"],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["includesGlobal:"]
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($globals.Platform)._includesGlobal_(aString);
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString"],
- source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals[aString];
- return nativeFunc();
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject"],
- source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return nativeFunc(anObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject", "anObject2"],
- source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return nativeFunc(anObject,anObject2);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:value:value:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "anObject", "anObject2", "anObject3"],
- source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionNamed:valueWithArgs:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aString", "args"],
- source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (aString,args){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var nativeFunc=$globals.Platform._globals()[aString];
- return Function.prototype.apply.call(nativeFunc, null, args);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionOf:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc"],
- source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return nativeFunc();
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject"],
- source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return nativeFunc(anObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject", "anObject2"],
- source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return nativeFunc(anObject,anObject2);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionOf:value:value:value:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
- source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return nativeFunc(anObject,anObject2, anObject3);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "functionOf:valueWithArgs:",
- protocol: "function calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "args"],
- source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,args){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.apply.call(nativeFunc, null, args);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "isNativeFunction:",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["return typeof anObject === \x22function\x22"]]],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return typeof anObject === "function";
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:",
- protocol: "method calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "thisObject"],
- source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,thisObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.call.call(nativeFunc, thisObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:",
- protocol: "method calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "thisObject", "anObject"],
- source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,thisObject,anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.call.call(nativeFunc, thisObject, anObject);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:value:",
- protocol: "method calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
- source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:value:value:value:",
- protocol: "method calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
- source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2,anObject3){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addMethod(
- $core.method({
- selector: "methodOf:this:valueWithArgs:",
- protocol: "method calling",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["nativeFunc", "thisObject", "args"],
- source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (nativeFunc,thisObject,args){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return Function.prototype.apply.call(nativeFunc, thisObject, args);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.NativeFunction.a$cls);
- $core.addTrait("TMethodContext", "Kernel-Methods");
- $core.addMethod(
- $core.method({
- selector: "asString",
- protocol: "converting",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "asString\x0a\x09^ self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext asString, ')' ]\x0a\x09\x09ifFalse: [ self method\x0a\x09\x09\x09ifNotNil: [ :method | method asStringForClass: self receiver class ]\x0a\x09\x09\x09ifNil: [ 'missing method ', self selector symbolPrintString ] ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "ifNotNil:ifNil:", "method", "asStringForClass:", "class", "receiver", "symbolPrintString", "selector"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- if($core.assert($self._isBlockContext())){
- return [$recv(["a block (in ".__comma($recv($self._methodContext())._asString())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=2
- //>>excludeEnd("ctx");
- ][0]).__comma(")")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx[","]=1
- //>>excludeEnd("ctx");
- ][0];
- } else {
- $1=$self._method();
- if($1 == null || $1.a$nil){
- return "missing method ".__comma($recv($self._selector())._symbolPrintString());
- } else {
- var method;
- method=$1;
- return $recv(method)._asStringForClass_($recv($self._receiver())._class());
- }
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"asString",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "basicReceiver",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "basicReceiver\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "findContextSuchThat:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["testBlock"],
- source: "findContextSuchThat: testBlock\x0a\x09\x22Search self and my sender chain for first one that satisfies `testBlock`. \x0a\x09Answer `nil` if none satisfy\x22\x0a\x0a\x09| context |\x0a\x09\x0a\x09context := self.\x0a\x09[ context isNil] whileFalse: [\x0a\x09\x09(testBlock value: context) \x0a\x09\x09\x09ifTrue: [ ^ context ].\x0a\x09\x09context := context outerContext ].\x0a\x0a\x09^ nil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
- }, function ($methodClass){ return function (testBlock){
- var self=this,$self=this;
- var context;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $early={};
- try {
- context=self;
- $recv((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- return $recv(context)._isNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
- //>>excludeEnd("ctx");
- }))._whileFalse_((function(){
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx2) {
- //>>excludeEnd("ctx");
- if($core.assert($recv(testBlock)._value_(context))){
- throw $early=[context];
- }
- context=$recv(context)._outerContext();
- return context;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
- //>>excludeEnd("ctx");
- }));
- return nil;
- }
- catch(e) {if(e===$early)return e[0]; throw e}
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "home",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "home\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"home",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "index",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "index\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"index",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "isBlockContext",
- protocol: "testing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["isNil", "selector"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- return $recv($self._selector())._isNil();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "locals",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "locals\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"locals",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "method",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "method\x0a\x09| method lookupClass receiverClass supercall |\x0a\x09\x0a\x09self methodContext ifNil: [ ^ nil ].\x0a\x0a\x09receiverClass := self methodContext receiver class.\x0a\x09method := receiverClass lookupSelector: self methodContext selector.\x0a\x09supercall := self outerContext \x0a\x09\x09ifNil: [ false ]\x0a\x09\x09ifNotNil: [ :outer | outer supercall ].\x0a\x0a\x09^ supercall\x0a\x09\x09ifFalse: [ method ]\x0a\x09\x09ifTrue: [ method methodClass superclass lookupSelector: self methodContext selector ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- var method,lookupClass,receiverClass,supercall;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1,$2;
- $1=[$self._methodContext()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodContext"]=1
- //>>excludeEnd("ctx");
- ][0];
- if($1 == null || $1.a$nil){
- return nil;
- } else {
- $1;
- }
- receiverClass=$recv($recv([$self._methodContext()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodContext"]=2
- //>>excludeEnd("ctx");
- ][0])._receiver())._class();
- method=[$recv(receiverClass)._lookupSelector_([$recv([$self._methodContext()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["methodContext"]=3
- //>>excludeEnd("ctx");
- ][0])._selector()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["selector"]=1
- //>>excludeEnd("ctx");
- ][0])
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["lookupSelector:"]=1
- //>>excludeEnd("ctx");
- ][0];
- $2=$self._outerContext();
- if($2 == null || $2.a$nil){
- supercall=false;
- } else {
- var outer;
- outer=$2;
- supercall=$recv(outer)._supercall();
- }
- if($core.assert(supercall)){
- return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
- } else {
- return method;
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "methodContext",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- if(!$core.assert($self._isBlockContext())){
- return self;
- }
- $1=$self._outerContext();
- if($1 == null || $1.a$nil){
- return $1;
- } else {
- var outer;
- outer=$1;
- return $recv(outer)._methodContext();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"methodContext",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "outerContext",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "outerContext\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "printOn:",
- protocol: "printing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["aStream"],
- source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["printOn:", "nextPutAll:", "asString"]
- }, function ($methodClass){ return function (aStream){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- [(
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- $ctx1.supercall = true,
- //>>excludeEnd("ctx");
- ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.supercall = false
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_("(")
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=1
- //>>excludeEnd("ctx");
- ][0];
- [$recv(aStream)._nextPutAll_($self._asString())
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["nextPutAll:"]=2
- //>>excludeEnd("ctx");
- ][0];
- $recv(aStream)._nextPutAll_(")");
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "receiver",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- if($core.assert($self._isBlockContext())){
- $1=$recv([$self._outerContext()
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- ,$ctx1.sendIdx["outerContext"]=1
- //>>excludeEnd("ctx");
- ][0])._notNil();
- } else {
- $1=false;
- }
- if($core.assert($1)){
- return $recv($self._outerContext())._receiver();
- } else {
- return $self._basicReceiver();
- }
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "selector",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "selector\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"selector",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "sendIndexes",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "sendIndexes\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addMethod(
- $core.method({
- selector: "supercall",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "supercall\x0a\x09self subclassResponsibility",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["subclassResponsibility"]
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- $self._subclassResponsibility();
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.TMethodContext);
- $core.addClass("Timeout", $globals.Object, "Kernel-Methods");
- $core.setSlots($globals.Timeout, ["rawTimeout"]);
- //>>excludeStart("ide", pragmas.excludeIdeData);
- $globals.Timeout.comment="I am wrapping the returns from `set{Timeout,Interval}`.\x0a\x0a## Motivation\x0a\x0aNumber suffices in browsers, but node.js returns an object.";
- //>>excludeEnd("ide");
- $core.addMethod(
- $core.method({
- selector: "clearInterval",
- protocol: "timeout/interval",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var interval = $self.rawTimeout;
- clearInterval(interval);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"clearInterval",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "clearTimeout",
- protocol: "timeout/interval",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: [],
- source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09"]]],
- messageSends: []
- }, function ($methodClass){ return function (){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var timeout = $self.rawTimeout;
- clearTimeout(timeout);
- ;
- return self;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "rawTimeout:",
- protocol: "accessing",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: []
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- $self.rawTimeout=anObject;
- return self;
- }; }),
- $globals.Timeout);
- $core.addMethod(
- $core.method({
- selector: "on:",
- protocol: "instance creation",
- //>>excludeStart("ide", pragmas.excludeIdeData);
- args: ["anObject"],
- source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
- referencedClasses: [],
- //>>excludeEnd("ide");
- pragmas: [],
- messageSends: ["rawTimeout:", "new", "yourself"]
- }, function ($methodClass){ return function (anObject){
- var self=this,$self=this;
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- return $core.withContext(function($ctx1) {
- //>>excludeEnd("ctx");
- var $1;
- $1=$self._new();
- $recv($1)._rawTimeout_(anObject);
- return $recv($1)._yourself();
- //>>excludeStart("ctx", pragmas.excludeDebugContexts);
- }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject})});
- //>>excludeEnd("ctx");
- }; }),
- $globals.Timeout.a$cls);
- $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
- });
|