Kernel-Methods.js 132 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Methods");
  4. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  5. $core.addClass("BlockClosure", $globals.Object, "Kernel-Methods");
  6. $core.setSlots($globals.BlockClosure, ["prototype", "length"]);
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $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 | ... ] `";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "applyTo:arguments:",
  13. protocol: "evaluating",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anObject", "aCollection"],
  16. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [["inlineJS:", ["return self.apply(anObject, aCollection)"]]],
  20. messageSends: []
  21. }, function ($methodClass){ return function (anObject,aCollection){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. return self.apply(anObject, aCollection);
  27. return self;
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  30. //>>excludeEnd("ctx");
  31. }; }),
  32. $globals.BlockClosure);
  33. $core.addMethod(
  34. $core.method({
  35. selector: "asCompiledMethod:",
  36. protocol: "converting",
  37. //>>excludeStart("ide", pragmas.excludeIdeData);
  38. args: ["aString"],
  39. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  40. referencedClasses: [],
  41. //>>excludeEnd("ide");
  42. pragmas: [["inlineJS:", ["return $core.method({selector:aString, fn:self});"]]],
  43. messageSends: []
  44. }, function ($methodClass){ return function (aString){
  45. var self=this,$self=this;
  46. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47. return $core.withContext(function($ctx1) {
  48. //>>excludeEnd("ctx");
  49. return $core.method({selector:aString, fn:self});;
  50. return self;
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString})});
  53. //>>excludeEnd("ctx");
  54. }; }),
  55. $globals.BlockClosure);
  56. $core.addMethod(
  57. $core.method({
  58. selector: "asJavaScriptObject",
  59. protocol: "converting",
  60. //>>excludeStart("ide", pragmas.excludeIdeData);
  61. args: [],
  62. source: "asJavaScriptObject\x0a\x09^ self",
  63. referencedClasses: [],
  64. //>>excludeEnd("ide");
  65. pragmas: [],
  66. messageSends: []
  67. }, function ($methodClass){ return function (){
  68. var self=this,$self=this;
  69. return self;
  70. }; }),
  71. $globals.BlockClosure);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "asJavaScriptSource",
  75. protocol: "converting",
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "asJavaScriptSource\x0a\x09<inlineJS: 'return $self.toString();'>",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. pragmas: [["inlineJS:", ["return $self.toString();"]]],
  82. messageSends: []
  83. }, function ($methodClass){ return function (){
  84. var self=this,$self=this;
  85. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  86. return $core.withContext(function($ctx1) {
  87. //>>excludeEnd("ctx");
  88. return $self.toString();;
  89. return self;
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  92. //>>excludeEnd("ctx");
  93. }; }),
  94. $globals.BlockClosure);
  95. $core.addMethod(
  96. $core.method({
  97. selector: "compiledSource",
  98. protocol: "accessing",
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: [],
  101. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. pragmas: [["inlineJS:", ["return self.toString()"]]],
  105. messageSends: []
  106. }, function ($methodClass){ return function (){
  107. var self=this,$self=this;
  108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  109. return $core.withContext(function($ctx1) {
  110. //>>excludeEnd("ctx");
  111. return self.toString();
  112. return self;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{})});
  115. //>>excludeEnd("ctx");
  116. }; }),
  117. $globals.BlockClosure);
  118. $core.addMethod(
  119. $core.method({
  120. selector: "currySelf",
  121. protocol: "converting",
  122. //>>excludeStart("ide", pragmas.excludeIdeData);
  123. args: [],
  124. 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'>",
  125. referencedClasses: [],
  126. //>>excludeEnd("ide");
  127. 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"]]],
  128. messageSends: []
  129. }, function ($methodClass){ return function (){
  130. var self=this,$self=this;
  131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  132. return $core.withContext(function($ctx1) {
  133. //>>excludeEnd("ctx");
  134. return function () {
  135. var args = [ this ];
  136. args.push.apply(args, arguments);
  137. return self.apply(null, args);
  138. }
  139. ;
  140. return self;
  141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  142. }, function($ctx1) {$ctx1.fill(self,"currySelf",{})});
  143. //>>excludeEnd("ctx");
  144. }; }),
  145. $globals.BlockClosure);
  146. $core.addMethod(
  147. $core.method({
  148. selector: "ensure:",
  149. protocol: "evaluating",
  150. //>>excludeStart("ide", pragmas.excludeIdeData);
  151. args: ["aBlock"],
  152. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  153. referencedClasses: [],
  154. //>>excludeEnd("ide");
  155. pragmas: [["inlineJS:", ["try{return $self._value()}finally{aBlock._value()}"]]],
  156. messageSends: []
  157. }, function ($methodClass){ return function (aBlock){
  158. var self=this,$self=this;
  159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  160. return $core.withContext(function($ctx1) {
  161. //>>excludeEnd("ctx");
  162. try{return $self._value()}finally{aBlock._value()};
  163. return self;
  164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  165. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock})});
  166. //>>excludeEnd("ctx");
  167. }; }),
  168. $globals.BlockClosure);
  169. $core.addMethod(
  170. $core.method({
  171. selector: "fork",
  172. protocol: "timeout/interval",
  173. //>>excludeStart("ide", pragmas.excludeIdeData);
  174. args: [],
  175. source: "fork\x0a\x09ForkPool default fork: self",
  176. referencedClasses: ["ForkPool"],
  177. //>>excludeEnd("ide");
  178. pragmas: [],
  179. messageSends: ["fork:", "default"]
  180. }, function ($methodClass){ return function (){
  181. var self=this,$self=this;
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. return $core.withContext(function($ctx1) {
  184. //>>excludeEnd("ctx");
  185. $recv($recv($globals.ForkPool)._default())._fork_(self);
  186. return self;
  187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  188. }, function($ctx1) {$ctx1.fill(self,"fork",{})});
  189. //>>excludeEnd("ctx");
  190. }; }),
  191. $globals.BlockClosure);
  192. $core.addMethod(
  193. $core.method({
  194. selector: "new",
  195. protocol: "evaluating",
  196. //>>excludeStart("ide", pragmas.excludeIdeData);
  197. args: [],
  198. 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()'>",
  199. referencedClasses: [],
  200. //>>excludeEnd("ide");
  201. pragmas: [["inlineJS:", ["return new self()"]]],
  202. messageSends: []
  203. }, function ($methodClass){ return function (){
  204. var self=this,$self=this;
  205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  206. return $core.withContext(function($ctx1) {
  207. //>>excludeEnd("ctx");
  208. return new self();
  209. return self;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. }, function($ctx1) {$ctx1.fill(self,"new",{})});
  212. //>>excludeEnd("ctx");
  213. }; }),
  214. $globals.BlockClosure);
  215. $core.addMethod(
  216. $core.method({
  217. selector: "newValue:",
  218. protocol: "evaluating",
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. pragmas: [],
  225. messageSends: ["newWithValues:"]
  226. }, function ($methodClass){ return function (anObject){
  227. var self=this,$self=this;
  228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  229. return $core.withContext(function($ctx1) {
  230. //>>excludeEnd("ctx");
  231. return $self._newWithValues_([anObject]);
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject})});
  234. //>>excludeEnd("ctx");
  235. }; }),
  236. $globals.BlockClosure);
  237. $core.addMethod(
  238. $core.method({
  239. selector: "newValue:value:",
  240. protocol: "evaluating",
  241. //>>excludeStart("ide", pragmas.excludeIdeData);
  242. args: ["anObject", "anObject2"],
  243. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  244. referencedClasses: [],
  245. //>>excludeEnd("ide");
  246. pragmas: [],
  247. messageSends: ["newWithValues:"]
  248. }, function ($methodClass){ return function (anObject,anObject2){
  249. var self=this,$self=this;
  250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  251. return $core.withContext(function($ctx1) {
  252. //>>excludeEnd("ctx");
  253. return $self._newWithValues_([anObject,anObject2]);
  254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  255. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2})});
  256. //>>excludeEnd("ctx");
  257. }; }),
  258. $globals.BlockClosure);
  259. $core.addMethod(
  260. $core.method({
  261. selector: "newValue:value:value:",
  262. protocol: "evaluating",
  263. //>>excludeStart("ide", pragmas.excludeIdeData);
  264. args: ["anObject", "anObject2", "anObject3"],
  265. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  266. referencedClasses: [],
  267. //>>excludeEnd("ide");
  268. pragmas: [],
  269. messageSends: ["newWithValues:"]
  270. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  271. var self=this,$self=this;
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. return $core.withContext(function($ctx1) {
  274. //>>excludeEnd("ctx");
  275. return $self._newWithValues_([anObject,anObject2,anObject3]);
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  278. //>>excludeEnd("ctx");
  279. }; }),
  280. $globals.BlockClosure);
  281. $core.addMethod(
  282. $core.method({
  283. selector: "newWithValues:",
  284. protocol: "evaluating",
  285. //>>excludeStart("ide", pragmas.excludeIdeData);
  286. args: ["aCollection"],
  287. 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'>",
  288. referencedClasses: [],
  289. //>>excludeEnd("ide");
  290. 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"]]],
  291. messageSends: []
  292. }, function ($methodClass){ return function (aCollection){
  293. var self=this,$self=this;
  294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  295. return $core.withContext(function($ctx1) {
  296. //>>excludeEnd("ctx");
  297. var object = Object.create(self.prototype);
  298. var result = self.apply(object, aCollection);
  299. return typeof result === "object" ? result : object;
  300. ;
  301. return self;
  302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  303. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection})});
  304. //>>excludeEnd("ctx");
  305. }; }),
  306. $globals.BlockClosure);
  307. $core.addMethod(
  308. $core.method({
  309. selector: "numArgs",
  310. protocol: "accessing",
  311. //>>excludeStart("ide", pragmas.excludeIdeData);
  312. args: [],
  313. source: "numArgs\x0a\x09^ length",
  314. referencedClasses: [],
  315. //>>excludeEnd("ide");
  316. pragmas: [],
  317. messageSends: []
  318. }, function ($methodClass){ return function (){
  319. var self=this,$self=this;
  320. return $self.length;
  321. }; }),
  322. $globals.BlockClosure);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "on:do:",
  326. protocol: "error handling",
  327. //>>excludeStart("ide", pragmas.excludeIdeData);
  328. args: ["anErrorClass", "aBlock"],
  329. source: "on: anErrorClass do: aBlock\x0a\x09^ Smalltalk try: self ifTrue: [ :err | err isKindOf: anErrorClass ] catch: aBlock",
  330. referencedClasses: ["Smalltalk"],
  331. //>>excludeEnd("ide");
  332. pragmas: [],
  333. messageSends: ["try:ifTrue:catch:", "isKindOf:"]
  334. }, function ($methodClass){ return function (anErrorClass,aBlock){
  335. var self=this,$self=this;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return $core.withContext(function($ctx1) {
  338. //>>excludeEnd("ctx");
  339. return $recv($globals.Smalltalk)._try_ifTrue_catch_(self,(function(err){
  340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  341. return $core.withContext(function($ctx2) {
  342. //>>excludeEnd("ctx");
  343. return $recv(err)._isKindOf_(anErrorClass);
  344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  345. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  346. //>>excludeEnd("ctx");
  347. }),aBlock);
  348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  349. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock})});
  350. //>>excludeEnd("ctx");
  351. }; }),
  352. $globals.BlockClosure);
  353. $core.addMethod(
  354. $core.method({
  355. selector: "prototype",
  356. protocol: "accessing",
  357. //>>excludeStart("ide", pragmas.excludeIdeData);
  358. args: [],
  359. source: "prototype\x0a\x09^ prototype",
  360. referencedClasses: [],
  361. //>>excludeEnd("ide");
  362. pragmas: [],
  363. messageSends: []
  364. }, function ($methodClass){ return function (){
  365. var self=this,$self=this;
  366. return $self.prototype;
  367. }; }),
  368. $globals.BlockClosure);
  369. $core.addMethod(
  370. $core.method({
  371. selector: "provided",
  372. protocol: "converting",
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. args: [],
  375. 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",
  376. referencedClasses: ["JSObjectProxy"],
  377. //>>excludeEnd("ide");
  378. pragmas: [],
  379. messageSends: ["on:"]
  380. }, function ($methodClass){ return function (){
  381. var self=this,$self=this;
  382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  383. return $core.withContext(function($ctx1) {
  384. //>>excludeEnd("ctx");
  385. return $recv($globals.JSObjectProxy)._on_(self);
  386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  387. }, function($ctx1) {$ctx1.fill(self,"provided",{})});
  388. //>>excludeEnd("ctx");
  389. }; }),
  390. $globals.BlockClosure);
  391. $core.addMethod(
  392. $core.method({
  393. selector: "receiver",
  394. protocol: "accessing",
  395. //>>excludeStart("ide", pragmas.excludeIdeData);
  396. args: [],
  397. source: "receiver\x0a\x09^ nil",
  398. referencedClasses: [],
  399. //>>excludeEnd("ide");
  400. pragmas: [],
  401. messageSends: []
  402. }, function ($methodClass){ return function (){
  403. var self=this,$self=this;
  404. return nil;
  405. }; }),
  406. $globals.BlockClosure);
  407. $core.addMethod(
  408. $core.method({
  409. selector: "timeToRun",
  410. protocol: "evaluating",
  411. //>>excludeStart("ide", pragmas.excludeIdeData);
  412. args: [],
  413. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  414. referencedClasses: ["Date"],
  415. //>>excludeEnd("ide");
  416. pragmas: [],
  417. messageSends: ["millisecondsToRun:"]
  418. }, function ($methodClass){ return function (){
  419. var self=this,$self=this;
  420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  421. return $core.withContext(function($ctx1) {
  422. //>>excludeEnd("ctx");
  423. return $recv($globals.Date)._millisecondsToRun_(self);
  424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  425. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{})});
  426. //>>excludeEnd("ctx");
  427. }; }),
  428. $globals.BlockClosure);
  429. $core.addMethod(
  430. $core.method({
  431. selector: "tryCatch:",
  432. protocol: "error handling",
  433. //>>excludeStart("ide", pragmas.excludeIdeData);
  434. args: ["aBlock"],
  435. 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'>",
  436. referencedClasses: [],
  437. //>>excludeEnd("ide");
  438. 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"]]],
  439. messageSends: []
  440. }, function ($methodClass){ return function (aBlock){
  441. var self=this,$self=this;
  442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  443. return $core.withContext(function($ctx1) {
  444. //>>excludeEnd("ctx");
  445. try {
  446. return $self._value();
  447. } catch(error) {
  448. // pass non-local returns undetected
  449. if (Array.isArray(error) && error.length === 1) throw error;
  450. return aBlock._value_(error);
  451. }
  452. ;
  453. return self;
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock})});
  456. //>>excludeEnd("ctx");
  457. }; }),
  458. $globals.BlockClosure);
  459. $core.addMethod(
  460. $core.method({
  461. selector: "tryIfTrue:catch:",
  462. protocol: "error handling",
  463. //>>excludeStart("ide", pragmas.excludeIdeData);
  464. args: ["anotherBlock", "aBlock"],
  465. 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'>",
  466. referencedClasses: [],
  467. //>>excludeEnd("ide");
  468. 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"]]],
  469. messageSends: []
  470. }, function ($methodClass){ return function (anotherBlock,aBlock){
  471. var self=this,$self=this;
  472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  473. return $core.withContext(function($ctx1) {
  474. //>>excludeEnd("ctx");
  475. try {
  476. return $self._value();
  477. } catch(error) {
  478. // pass non-local returns undetected
  479. if (Array.isArray(error) && error.length === 1) throw error;
  480. if (!anotherBlock._value_(error)) throw error;
  481. return aBlock._value_(error);
  482. }
  483. ;
  484. return self;
  485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  486. }, function($ctx1) {$ctx1.fill(self,"tryIfTrue:catch:",{anotherBlock:anotherBlock,aBlock:aBlock})});
  487. //>>excludeEnd("ctx");
  488. }; }),
  489. $globals.BlockClosure);
  490. $core.addMethod(
  491. $core.method({
  492. selector: "value",
  493. protocol: "evaluating",
  494. //>>excludeStart("ide", pragmas.excludeIdeData);
  495. args: [],
  496. source: "value\x0a\x09<inlineJS: 'return self();'>",
  497. referencedClasses: [],
  498. //>>excludeEnd("ide");
  499. pragmas: [["inlineJS:", ["return self();"]]],
  500. messageSends: []
  501. }, function ($methodClass){ return function (){
  502. var self=this,$self=this;
  503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  504. return $core.withContext(function($ctx1) {
  505. //>>excludeEnd("ctx");
  506. return self();;
  507. return self;
  508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  509. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  510. //>>excludeEnd("ctx");
  511. }; }),
  512. $globals.BlockClosure);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "value:",
  516. protocol: "evaluating",
  517. //>>excludeStart("ide", pragmas.excludeIdeData);
  518. args: ["anArg"],
  519. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  520. referencedClasses: [],
  521. //>>excludeEnd("ide");
  522. pragmas: [["inlineJS:", ["return self(anArg);"]]],
  523. messageSends: []
  524. }, function ($methodClass){ return function (anArg){
  525. var self=this,$self=this;
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx1) {
  528. //>>excludeEnd("ctx");
  529. return self(anArg);;
  530. return self;
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg})});
  533. //>>excludeEnd("ctx");
  534. }; }),
  535. $globals.BlockClosure);
  536. $core.addMethod(
  537. $core.method({
  538. selector: "value:value:",
  539. protocol: "evaluating",
  540. //>>excludeStart("ide", pragmas.excludeIdeData);
  541. args: ["firstArg", "secondArg"],
  542. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  543. referencedClasses: [],
  544. //>>excludeEnd("ide");
  545. pragmas: [["inlineJS:", ["return self(firstArg, secondArg);"]]],
  546. messageSends: []
  547. }, function ($methodClass){ return function (firstArg,secondArg){
  548. var self=this,$self=this;
  549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  550. return $core.withContext(function($ctx1) {
  551. //>>excludeEnd("ctx");
  552. return self(firstArg, secondArg);;
  553. return self;
  554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  555. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg})});
  556. //>>excludeEnd("ctx");
  557. }; }),
  558. $globals.BlockClosure);
  559. $core.addMethod(
  560. $core.method({
  561. selector: "value:value:value:",
  562. protocol: "evaluating",
  563. //>>excludeStart("ide", pragmas.excludeIdeData);
  564. args: ["firstArg", "secondArg", "thirdArg"],
  565. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  566. referencedClasses: [],
  567. //>>excludeEnd("ide");
  568. pragmas: [["inlineJS:", ["return self(firstArg, secondArg, thirdArg);"]]],
  569. messageSends: []
  570. }, function ($methodClass){ return function (firstArg,secondArg,thirdArg){
  571. var self=this,$self=this;
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. return $core.withContext(function($ctx1) {
  574. //>>excludeEnd("ctx");
  575. return self(firstArg, secondArg, thirdArg);;
  576. return self;
  577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  578. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg})});
  579. //>>excludeEnd("ctx");
  580. }; }),
  581. $globals.BlockClosure);
  582. $core.addMethod(
  583. $core.method({
  584. selector: "valueWithInterval:",
  585. protocol: "timeout/interval",
  586. //>>excludeStart("ide", pragmas.excludeIdeData);
  587. args: ["aNumber"],
  588. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  589. referencedClasses: [],
  590. //>>excludeEnd("ide");
  591. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09"]]],
  592. messageSends: []
  593. }, function ($methodClass){ return function (aNumber){
  594. var self=this,$self=this;
  595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  596. return $core.withContext(function($ctx1) {
  597. //>>excludeEnd("ctx");
  598. var interval = setInterval(self, aNumber);
  599. return $globals.Timeout._on_(interval);
  600. ;
  601. return self;
  602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  603. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber})});
  604. //>>excludeEnd("ctx");
  605. }; }),
  606. $globals.BlockClosure);
  607. $core.addMethod(
  608. $core.method({
  609. selector: "valueWithPossibleArguments:",
  610. protocol: "evaluating",
  611. //>>excludeStart("ide", pragmas.excludeIdeData);
  612. args: ["aCollection"],
  613. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  614. referencedClasses: [],
  615. //>>excludeEnd("ide");
  616. pragmas: [["inlineJS:", ["return self.apply(null, aCollection);"]]],
  617. messageSends: []
  618. }, function ($methodClass){ return function (aCollection){
  619. var self=this,$self=this;
  620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  621. return $core.withContext(function($ctx1) {
  622. //>>excludeEnd("ctx");
  623. return self.apply(null, aCollection);;
  624. return self;
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection})});
  627. //>>excludeEnd("ctx");
  628. }; }),
  629. $globals.BlockClosure);
  630. $core.addMethod(
  631. $core.method({
  632. selector: "valueWithTimeout:",
  633. protocol: "timeout/interval",
  634. //>>excludeStart("ide", pragmas.excludeIdeData);
  635. args: ["aNumber"],
  636. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  637. referencedClasses: [],
  638. //>>excludeEnd("ide");
  639. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09"]]],
  640. messageSends: []
  641. }, function ($methodClass){ return function (aNumber){
  642. var self=this,$self=this;
  643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  644. return $core.withContext(function($ctx1) {
  645. //>>excludeEnd("ctx");
  646. var timeout = setTimeout(self, aNumber);
  647. return $globals.Timeout._on_(timeout);
  648. ;
  649. return self;
  650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  651. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber})});
  652. //>>excludeEnd("ctx");
  653. }; }),
  654. $globals.BlockClosure);
  655. $core.addMethod(
  656. $core.method({
  657. selector: "whileFalse",
  658. protocol: "controlling",
  659. //>>excludeStart("ide", pragmas.excludeIdeData);
  660. args: [],
  661. source: "whileFalse\x0a\x09self whileFalse: []",
  662. referencedClasses: [],
  663. //>>excludeEnd("ide");
  664. pragmas: [],
  665. messageSends: ["whileFalse:"]
  666. }, function ($methodClass){ return function (){
  667. var self=this,$self=this;
  668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  669. return $core.withContext(function($ctx1) {
  670. //>>excludeEnd("ctx");
  671. $self._whileFalse_((function(){
  672. }));
  673. return self;
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{})});
  676. //>>excludeEnd("ctx");
  677. }; }),
  678. $globals.BlockClosure);
  679. $core.addMethod(
  680. $core.method({
  681. selector: "whileFalse:",
  682. protocol: "controlling",
  683. //>>excludeStart("ide", pragmas.excludeIdeData);
  684. args: ["aBlock"],
  685. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  686. referencedClasses: [],
  687. //>>excludeEnd("ide");
  688. pragmas: [["inlineJS:", ["while(!$core.assert($self._value())) {aBlock._value()}"]]],
  689. messageSends: []
  690. }, function ($methodClass){ return function (aBlock){
  691. var self=this,$self=this;
  692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  693. return $core.withContext(function($ctx1) {
  694. //>>excludeEnd("ctx");
  695. while(!$core.assert($self._value())) {aBlock._value()};
  696. return self;
  697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  698. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock})});
  699. //>>excludeEnd("ctx");
  700. }; }),
  701. $globals.BlockClosure);
  702. $core.addMethod(
  703. $core.method({
  704. selector: "whileTrue",
  705. protocol: "controlling",
  706. //>>excludeStart("ide", pragmas.excludeIdeData);
  707. args: [],
  708. source: "whileTrue\x0a\x09self whileTrue: []",
  709. referencedClasses: [],
  710. //>>excludeEnd("ide");
  711. pragmas: [],
  712. messageSends: ["whileTrue:"]
  713. }, function ($methodClass){ return function (){
  714. var self=this,$self=this;
  715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  716. return $core.withContext(function($ctx1) {
  717. //>>excludeEnd("ctx");
  718. $self._whileTrue_((function(){
  719. }));
  720. return self;
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{})});
  723. //>>excludeEnd("ctx");
  724. }; }),
  725. $globals.BlockClosure);
  726. $core.addMethod(
  727. $core.method({
  728. selector: "whileTrue:",
  729. protocol: "controlling",
  730. //>>excludeStart("ide", pragmas.excludeIdeData);
  731. args: ["aBlock"],
  732. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  733. referencedClasses: [],
  734. //>>excludeEnd("ide");
  735. pragmas: [["inlineJS:", ["while($core.assert($self._value())) {aBlock._value()}"]]],
  736. messageSends: []
  737. }, function ($methodClass){ return function (aBlock){
  738. var self=this,$self=this;
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. return $core.withContext(function($ctx1) {
  741. //>>excludeEnd("ctx");
  742. while($core.assert($self._value())) {aBlock._value()};
  743. return self;
  744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  745. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock})});
  746. //>>excludeEnd("ctx");
  747. }; }),
  748. $globals.BlockClosure);
  749. $core.addMethod(
  750. $core.method({
  751. selector: "javaScriptConstructorFor:initializingVia:",
  752. protocol: "instance creation",
  753. //>>excludeStart("ide", pragmas.excludeIdeData);
  754. args: ["aPrototype", "aMethodBlock"],
  755. 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'>",
  756. referencedClasses: [],
  757. //>>excludeEnd("ide");
  758. 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"]]],
  759. messageSends: []
  760. }, function ($methodClass){ return function (aPrototype,aMethodBlock){
  761. var self=this,$self=this;
  762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  763. return $core.withContext(function($ctx1) {
  764. //>>excludeEnd("ctx");
  765. function Ctr () {
  766. aMethodBlock.apply(this, arguments);
  767. }
  768. Ctr.prototype = aPrototype;
  769. return Ctr;
  770. ;
  771. return self;
  772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  773. }, function($ctx1) {$ctx1.fill(self,"javaScriptConstructorFor:initializingVia:",{aPrototype:aPrototype,aMethodBlock:aMethodBlock})});
  774. //>>excludeEnd("ctx");
  775. }; }),
  776. $globals.BlockClosure.a$cls);
  777. $core.addClass("CompiledMethod", $globals.Object, "Kernel-Methods");
  778. $core.setSlots($globals.CompiledMethod, ["args", "instantiateFn", "fn", "messageSends", "pragmas", "owner", "methodClass", "protocol", "referencedClasses", "selector", "source"]);
  779. //>>excludeStart("ide", pragmas.excludeIdeData);
  780. $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";
  781. //>>excludeEnd("ide");
  782. $core.addMethod(
  783. $core.method({
  784. selector: "arguments",
  785. protocol: "accessing",
  786. //>>excludeStart("ide", pragmas.excludeIdeData);
  787. args: [],
  788. source: "arguments\x0a\x09^ args ifNil: [ #() ]",
  789. referencedClasses: [],
  790. //>>excludeEnd("ide");
  791. pragmas: [],
  792. messageSends: ["ifNil:"]
  793. }, function ($methodClass){ return function (){
  794. var self=this,$self=this;
  795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  796. return $core.withContext(function($ctx1) {
  797. //>>excludeEnd("ctx");
  798. var $1;
  799. $1=$self.args;
  800. if($1 == null || $1.a$nil){
  801. return [];
  802. } else {
  803. return $1;
  804. }
  805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  806. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  807. //>>excludeEnd("ctx");
  808. }; }),
  809. $globals.CompiledMethod);
  810. $core.addMethod(
  811. $core.method({
  812. selector: "asString",
  813. protocol: "converting",
  814. //>>excludeStart("ide", pragmas.excludeIdeData);
  815. args: [],
  816. source: "asString\x0a\x09^ self asStringForClass: self methodClass",
  817. referencedClasses: [],
  818. //>>excludeEnd("ide");
  819. pragmas: [],
  820. messageSends: ["asStringForClass:", "methodClass"]
  821. }, function ($methodClass){ return function (){
  822. var self=this,$self=this;
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. return $core.withContext(function($ctx1) {
  825. //>>excludeEnd("ctx");
  826. return $self._asStringForClass_($self._methodClass());
  827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  828. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  829. //>>excludeEnd("ctx");
  830. }; }),
  831. $globals.CompiledMethod);
  832. $core.addMethod(
  833. $core.method({
  834. selector: "asStringForClass:",
  835. protocol: "converting",
  836. //>>excludeStart("ide", pragmas.excludeIdeData);
  837. args: ["aClass"],
  838. 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",
  839. referencedClasses: [],
  840. //>>excludeEnd("ide");
  841. pragmas: [],
  842. messageSends: ["name", "ifFalse:", "=", "methodClass", ",", "ifNil:ifNotNil:", "|", "origin", "symbolPrintString", "selector"]
  843. }, function ($methodClass){ return function (aClass){
  844. var self=this,$self=this;
  845. var result;
  846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  847. return $core.withContext(function($ctx1) {
  848. //>>excludeEnd("ctx");
  849. var $1,$2,$3,$4,$5,$6;
  850. result=[$recv(aClass)._name()
  851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  852. ,$ctx1.sendIdx["name"]=1
  853. //>>excludeEnd("ctx");
  854. ][0];
  855. if(!$core.assert([$recv([$self._methodClass()
  856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  857. ,$ctx1.sendIdx["methodClass"]=1
  858. //>>excludeEnd("ctx");
  859. ][0]).__eq(aClass)
  860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  861. ,$ctx1.sendIdx["="]=1
  862. //>>excludeEnd("ctx");
  863. ][0])){
  864. $1=[$recv(result).__comma(" (")
  865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  866. ,$ctx1.sendIdx[","]=3
  867. //>>excludeEnd("ctx");
  868. ][0];
  869. $2=[$self._methodClass()
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. ,$ctx1.sendIdx["methodClass"]=2
  872. //>>excludeEnd("ctx");
  873. ][0];
  874. if($2 == null || $2.a$nil){
  875. $3="nil";
  876. } else {
  877. $3=[$recv([$self._methodClass()
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. ,$ctx1.sendIdx["methodClass"]=3
  880. //>>excludeEnd("ctx");
  881. ][0])._name()
  882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  883. ,$ctx1.sendIdx["name"]=2
  884. //>>excludeEnd("ctx");
  885. ][0];
  886. }
  887. result=[$recv([$recv($1).__comma($3)
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. ,$ctx1.sendIdx[","]=2
  890. //>>excludeEnd("ctx");
  891. ][0]).__comma(")")
  892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  893. ,$ctx1.sendIdx[","]=1
  894. //>>excludeEnd("ctx");
  895. ][0];
  896. result;
  897. }
  898. if(!$core.assert($recv([$recv([$self._origin()
  899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  900. ,$ctx1.sendIdx["origin"]=1
  901. //>>excludeEnd("ctx");
  902. ][0]).__eq(aClass)
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. ,$ctx1.sendIdx["="]=2
  905. //>>excludeEnd("ctx");
  906. ][0]).__or($recv([$self._origin()
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. ,$ctx1.sendIdx["origin"]=2
  909. //>>excludeEnd("ctx");
  910. ][0]).__eq($self._methodClass())))){
  911. $4=[$recv(result).__comma(" /")
  912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  913. ,$ctx1.sendIdx[","]=6
  914. //>>excludeEnd("ctx");
  915. ][0];
  916. $5=[$self._origin()
  917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  918. ,$ctx1.sendIdx["origin"]=3
  919. //>>excludeEnd("ctx");
  920. ][0];
  921. if($5 == null || $5.a$nil){
  922. $6="nil";
  923. } else {
  924. $6=$recv($self._origin())._name();
  925. }
  926. result=[$recv([$recv($4).__comma($6)
  927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  928. ,$ctx1.sendIdx[","]=5
  929. //>>excludeEnd("ctx");
  930. ][0]).__comma("/")
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. ,$ctx1.sendIdx[","]=4
  933. //>>excludeEnd("ctx");
  934. ][0];
  935. result;
  936. }
  937. return [$recv($recv(result).__comma(" >> ")).__comma($recv($self._selector())._symbolPrintString())
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. ,$ctx1.sendIdx[","]=7
  940. //>>excludeEnd("ctx");
  941. ][0];
  942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  943. }, function($ctx1) {$ctx1.fill(self,"asStringForClass:",{aClass:aClass,result:result})});
  944. //>>excludeEnd("ctx");
  945. }; }),
  946. $globals.CompiledMethod);
  947. $core.addMethod(
  948. $core.method({
  949. selector: "basicPragmas",
  950. protocol: "accessing",
  951. //>>excludeStart("ide", pragmas.excludeIdeData);
  952. args: [],
  953. source: "basicPragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  954. referencedClasses: [],
  955. //>>excludeEnd("ide");
  956. pragmas: [],
  957. messageSends: ["ifNil:"]
  958. }, function ($methodClass){ return function (){
  959. var self=this,$self=this;
  960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  961. return $core.withContext(function($ctx1) {
  962. //>>excludeEnd("ctx");
  963. var $1;
  964. $1=$self.pragmas;
  965. if($1 == null || $1.a$nil){
  966. return [];
  967. } else {
  968. return $1;
  969. }
  970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  971. }, function($ctx1) {$ctx1.fill(self,"basicPragmas",{})});
  972. //>>excludeEnd("ctx");
  973. }; }),
  974. $globals.CompiledMethod);
  975. $core.addMethod(
  976. $core.method({
  977. selector: "browse",
  978. protocol: "browsing",
  979. //>>excludeStart("ide", pragmas.excludeIdeData);
  980. args: [],
  981. source: "browse\x0a\x09Finder findMethod: self",
  982. referencedClasses: ["Finder"],
  983. //>>excludeEnd("ide");
  984. pragmas: [],
  985. messageSends: ["findMethod:"]
  986. }, function ($methodClass){ return function (){
  987. var self=this,$self=this;
  988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  989. return $core.withContext(function($ctx1) {
  990. //>>excludeEnd("ctx");
  991. $recv($globals.Finder)._findMethod_(self);
  992. return self;
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. }, function($ctx1) {$ctx1.fill(self,"browse",{})});
  995. //>>excludeEnd("ctx");
  996. }; }),
  997. $globals.CompiledMethod);
  998. $core.addMethod(
  999. $core.method({
  1000. selector: "category",
  1001. protocol: "accessing",
  1002. //>>excludeStart("ide", pragmas.excludeIdeData);
  1003. args: [],
  1004. source: "category\x0a\x09^ self protocol",
  1005. referencedClasses: [],
  1006. //>>excludeEnd("ide");
  1007. pragmas: [],
  1008. messageSends: ["protocol"]
  1009. }, function ($methodClass){ return function (){
  1010. var self=this,$self=this;
  1011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1012. return $core.withContext(function($ctx1) {
  1013. //>>excludeEnd("ctx");
  1014. return $self._protocol();
  1015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1016. }, function($ctx1) {$ctx1.fill(self,"category",{})});
  1017. //>>excludeEnd("ctx");
  1018. }; }),
  1019. $globals.CompiledMethod);
  1020. $core.addMethod(
  1021. $core.method({
  1022. selector: "defaultProtocol",
  1023. protocol: "defaults",
  1024. //>>excludeStart("ide", pragmas.excludeIdeData);
  1025. args: [],
  1026. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  1027. referencedClasses: [],
  1028. //>>excludeEnd("ide");
  1029. pragmas: [],
  1030. messageSends: []
  1031. }, function ($methodClass){ return function (){
  1032. var self=this,$self=this;
  1033. return "as yet unclassified";
  1034. }; }),
  1035. $globals.CompiledMethod);
  1036. $core.addMethod(
  1037. $core.method({
  1038. selector: "fn",
  1039. protocol: "accessing",
  1040. //>>excludeStart("ide", pragmas.excludeIdeData);
  1041. args: [],
  1042. source: "fn\x0a\x09^ fn",
  1043. referencedClasses: [],
  1044. //>>excludeEnd("ide");
  1045. pragmas: [],
  1046. messageSends: []
  1047. }, function ($methodClass){ return function (){
  1048. var self=this,$self=this;
  1049. return $self.fn;
  1050. }; }),
  1051. $globals.CompiledMethod);
  1052. $core.addMethod(
  1053. $core.method({
  1054. selector: "instantiateFn",
  1055. protocol: "accessing",
  1056. //>>excludeStart("ide", pragmas.excludeIdeData);
  1057. args: [],
  1058. source: "instantiateFn\x0a\x09^ instantiateFn",
  1059. referencedClasses: [],
  1060. //>>excludeEnd("ide");
  1061. pragmas: [],
  1062. messageSends: []
  1063. }, function ($methodClass){ return function (){
  1064. var self=this,$self=this;
  1065. return $self.instantiateFn;
  1066. }; }),
  1067. $globals.CompiledMethod);
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "instantiateFn:",
  1071. protocol: "accessing",
  1072. //>>excludeStart("ide", pragmas.excludeIdeData);
  1073. args: ["anObject"],
  1074. source: "instantiateFn: anObject\x0a\x09instantiateFn := anObject",
  1075. referencedClasses: [],
  1076. //>>excludeEnd("ide");
  1077. pragmas: [],
  1078. messageSends: []
  1079. }, function ($methodClass){ return function (anObject){
  1080. var self=this,$self=this;
  1081. $self.instantiateFn=anObject;
  1082. return self;
  1083. }; }),
  1084. $globals.CompiledMethod);
  1085. $core.addMethod(
  1086. $core.method({
  1087. selector: "isCompiledMethod",
  1088. protocol: "testing",
  1089. //>>excludeStart("ide", pragmas.excludeIdeData);
  1090. args: [],
  1091. source: "isCompiledMethod\x0a\x09^ true",
  1092. referencedClasses: [],
  1093. //>>excludeEnd("ide");
  1094. pragmas: [],
  1095. messageSends: []
  1096. }, function ($methodClass){ return function (){
  1097. var self=this,$self=this;
  1098. return true;
  1099. }; }),
  1100. $globals.CompiledMethod);
  1101. $core.addMethod(
  1102. $core.method({
  1103. selector: "isOverridden",
  1104. protocol: "testing",
  1105. //>>excludeStart("ide", pragmas.excludeIdeData);
  1106. args: [],
  1107. source: "isOverridden\x0a self methodClass allSubclassesDo: [ :each |\x0a\x09 (each includesSelector: selector)\x0a \x09ifTrue: [ ^ true ] ].\x0a\x09^ false",
  1108. referencedClasses: [],
  1109. //>>excludeEnd("ide");
  1110. pragmas: [],
  1111. messageSends: ["allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  1112. }, function ($methodClass){ return function (){
  1113. var self=this,$self=this;
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. return $core.withContext(function($ctx1) {
  1116. //>>excludeEnd("ctx");
  1117. var $early={};
  1118. try {
  1119. $recv($self._methodClass())._allSubclassesDo_((function(each){
  1120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1121. return $core.withContext(function($ctx2) {
  1122. //>>excludeEnd("ctx");
  1123. if($core.assert($recv(each)._includesSelector_($self.selector))){
  1124. throw $early=[true];
  1125. }
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1128. //>>excludeEnd("ctx");
  1129. }));
  1130. return false;
  1131. }
  1132. catch(e) {if(e===$early)return e[0]; throw e}
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{})});
  1135. //>>excludeEnd("ctx");
  1136. }; }),
  1137. $globals.CompiledMethod);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "isOverride",
  1141. protocol: "testing",
  1142. //>>excludeStart("ide", pragmas.excludeIdeData);
  1143. args: [],
  1144. 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",
  1145. referencedClasses: [],
  1146. //>>excludeEnd("ide");
  1147. pragmas: [],
  1148. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  1149. }, function ($methodClass){ return function (){
  1150. var self=this,$self=this;
  1151. var superclass;
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return $core.withContext(function($ctx1) {
  1154. //>>excludeEnd("ctx");
  1155. var $1;
  1156. superclass=[$recv([$self._methodClass()
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. ,$ctx1.sendIdx["methodClass"]=1
  1159. //>>excludeEnd("ctx");
  1160. ][0])._superclass()
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. ,$ctx1.sendIdx["superclass"]=1
  1163. //>>excludeEnd("ctx");
  1164. ][0];
  1165. $1=superclass;
  1166. if($1 == null || $1.a$nil){
  1167. return false;
  1168. } else {
  1169. $1;
  1170. }
  1171. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  1172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1173. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass})});
  1174. //>>excludeEnd("ctx");
  1175. }; }),
  1176. $globals.CompiledMethod);
  1177. $core.addMethod(
  1178. $core.method({
  1179. selector: "messageSends",
  1180. protocol: "accessing",
  1181. //>>excludeStart("ide", pragmas.excludeIdeData);
  1182. args: [],
  1183. source: "messageSends\x0a\x09^ messageSends",
  1184. referencedClasses: [],
  1185. //>>excludeEnd("ide");
  1186. pragmas: [],
  1187. messageSends: []
  1188. }, function ($methodClass){ return function (){
  1189. var self=this,$self=this;
  1190. return $self.messageSends;
  1191. }; }),
  1192. $globals.CompiledMethod);
  1193. $core.addMethod(
  1194. $core.method({
  1195. selector: "methodClass",
  1196. protocol: "accessing",
  1197. //>>excludeStart("ide", pragmas.excludeIdeData);
  1198. args: [],
  1199. source: "methodClass\x0a\x09^ methodClass",
  1200. referencedClasses: [],
  1201. //>>excludeEnd("ide");
  1202. pragmas: [],
  1203. messageSends: []
  1204. }, function ($methodClass){ return function (){
  1205. var self=this,$self=this;
  1206. return $self.methodClass;
  1207. }; }),
  1208. $globals.CompiledMethod);
  1209. $core.addMethod(
  1210. $core.method({
  1211. selector: "origin",
  1212. protocol: "accessing",
  1213. //>>excludeStart("ide", pragmas.excludeIdeData);
  1214. args: [],
  1215. source: "origin\x0a\x09^ owner",
  1216. referencedClasses: [],
  1217. //>>excludeEnd("ide");
  1218. pragmas: [],
  1219. messageSends: []
  1220. }, function ($methodClass){ return function (){
  1221. var self=this,$self=this;
  1222. return $self.owner;
  1223. }; }),
  1224. $globals.CompiledMethod);
  1225. $core.addMethod(
  1226. $core.method({
  1227. selector: "package",
  1228. protocol: "accessing",
  1229. //>>excludeStart("ide", pragmas.excludeIdeData);
  1230. args: [],
  1231. 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 ]",
  1232. referencedClasses: [],
  1233. //>>excludeEnd("ide");
  1234. pragmas: [],
  1235. messageSends: ["ifNotNil:", "origin", "packageOfProtocol:", "protocol"]
  1236. }, function ($methodClass){ return function (){
  1237. var self=this,$self=this;
  1238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1239. return $core.withContext(function($ctx1) {
  1240. //>>excludeEnd("ctx");
  1241. var $1;
  1242. $1=$self._origin();
  1243. if($1 == null || $1.a$nil){
  1244. return $1;
  1245. } else {
  1246. var class_;
  1247. class_=$1;
  1248. return $recv(class_)._packageOfProtocol_($self._protocol());
  1249. }
  1250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1251. }, function($ctx1) {$ctx1.fill(self,"package",{})});
  1252. //>>excludeEnd("ctx");
  1253. }; }),
  1254. $globals.CompiledMethod);
  1255. $core.addMethod(
  1256. $core.method({
  1257. selector: "pragmas",
  1258. protocol: "accessing",
  1259. //>>excludeStart("ide", pragmas.excludeIdeData);
  1260. args: [],
  1261. source: "pragmas\x0a\x09^ self basicPragmas collect: [ :each | Message selector: each first arguments: each second ]",
  1262. referencedClasses: ["Message"],
  1263. //>>excludeEnd("ide");
  1264. pragmas: [],
  1265. messageSends: ["collect:", "basicPragmas", "selector:arguments:", "first", "second"]
  1266. }, function ($methodClass){ return function (){
  1267. var self=this,$self=this;
  1268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1269. return $core.withContext(function($ctx1) {
  1270. //>>excludeEnd("ctx");
  1271. return $recv($self._basicPragmas())._collect_((function(each){
  1272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1273. return $core.withContext(function($ctx2) {
  1274. //>>excludeEnd("ctx");
  1275. return $recv($globals.Message)._selector_arguments_($recv(each)._first(),$recv(each)._second());
  1276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1278. //>>excludeEnd("ctx");
  1279. }));
  1280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1281. }, function($ctx1) {$ctx1.fill(self,"pragmas",{})});
  1282. //>>excludeEnd("ctx");
  1283. }; }),
  1284. $globals.CompiledMethod);
  1285. $core.addMethod(
  1286. $core.method({
  1287. selector: "pragmas:",
  1288. protocol: "accessing",
  1289. //>>excludeStart("ide", pragmas.excludeIdeData);
  1290. args: ["anArrayOfMessages"],
  1291. source: "pragmas: anArrayOfMessages\x0a\x09pragmas := anArrayOfMessages collect: [ :each | { each selector. each arguments } ]",
  1292. referencedClasses: [],
  1293. //>>excludeEnd("ide");
  1294. pragmas: [],
  1295. messageSends: ["collect:", "selector", "arguments"]
  1296. }, function ($methodClass){ return function (anArrayOfMessages){
  1297. var self=this,$self=this;
  1298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1299. return $core.withContext(function($ctx1) {
  1300. //>>excludeEnd("ctx");
  1301. $self.pragmas=$recv(anArrayOfMessages)._collect_((function(each){
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. return $core.withContext(function($ctx2) {
  1304. //>>excludeEnd("ctx");
  1305. return [$recv(each)._selector(),$recv(each)._arguments()];
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1308. //>>excludeEnd("ctx");
  1309. }));
  1310. return self;
  1311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1312. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{anArrayOfMessages:anArrayOfMessages})});
  1313. //>>excludeEnd("ctx");
  1314. }; }),
  1315. $globals.CompiledMethod);
  1316. $core.addMethod(
  1317. $core.method({
  1318. selector: "protocol",
  1319. protocol: "accessing",
  1320. //>>excludeStart("ide", pragmas.excludeIdeData);
  1321. args: [],
  1322. source: "protocol\x0a\x09^ protocol ifNil: [ self defaultProtocol ]",
  1323. referencedClasses: [],
  1324. //>>excludeEnd("ide");
  1325. pragmas: [],
  1326. messageSends: ["ifNil:", "defaultProtocol"]
  1327. }, function ($methodClass){ return function (){
  1328. var self=this,$self=this;
  1329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1330. return $core.withContext(function($ctx1) {
  1331. //>>excludeEnd("ctx");
  1332. var $1;
  1333. $1=$self.protocol;
  1334. if($1 == null || $1.a$nil){
  1335. return $self._defaultProtocol();
  1336. } else {
  1337. return $1;
  1338. }
  1339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1340. }, function($ctx1) {$ctx1.fill(self,"protocol",{})});
  1341. //>>excludeEnd("ctx");
  1342. }; }),
  1343. $globals.CompiledMethod);
  1344. $core.addMethod(
  1345. $core.method({
  1346. selector: "protocol:",
  1347. protocol: "accessing",
  1348. //>>excludeStart("ide", pragmas.excludeIdeData);
  1349. args: ["aString"],
  1350. 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 ]",
  1351. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  1352. //>>excludeEnd("ide");
  1353. pragmas: [],
  1354. messageSends: ["protocol", "ifNotNil:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "origin", "addElement:", "organization", "removeProtocolIfEmpty:"]
  1355. }, function ($methodClass){ return function (aString){
  1356. var self=this,$self=this;
  1357. var oldProtocol;
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. return $core.withContext(function($ctx1) {
  1360. //>>excludeEnd("ctx");
  1361. var $1,$2,$3,$4;
  1362. oldProtocol=$self._protocol();
  1363. $self.protocol=aString;
  1364. $1=oldProtocol;
  1365. if($1 == null || $1.a$nil){
  1366. $1;
  1367. } else {
  1368. $2=$recv($globals.SystemAnnouncer)._current();
  1369. $3=$recv($globals.MethodMoved)._new();
  1370. $recv($3)._method_(self);
  1371. $recv($3)._oldProtocol_(oldProtocol);
  1372. $recv($2)._announce_($recv($3)._yourself());
  1373. }
  1374. $4=$self._origin();
  1375. if($4 == null || $4.a$nil){
  1376. $4;
  1377. } else {
  1378. var origin;
  1379. origin=$4;
  1380. $recv($recv(origin)._organization())._addElement_(aString);
  1381. $recv(origin)._removeProtocolIfEmpty_(oldProtocol);
  1382. }
  1383. return self;
  1384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1385. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol})});
  1386. //>>excludeEnd("ctx");
  1387. }; }),
  1388. $globals.CompiledMethod);
  1389. $core.addMethod(
  1390. $core.method({
  1391. selector: "referencedClasses",
  1392. protocol: "accessing",
  1393. //>>excludeStart("ide", pragmas.excludeIdeData);
  1394. args: [],
  1395. source: "referencedClasses\x0a\x09^ referencedClasses",
  1396. referencedClasses: [],
  1397. //>>excludeEnd("ide");
  1398. pragmas: [],
  1399. messageSends: []
  1400. }, function ($methodClass){ return function (){
  1401. var self=this,$self=this;
  1402. return $self.referencedClasses;
  1403. }; }),
  1404. $globals.CompiledMethod);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "selector",
  1408. protocol: "accessing",
  1409. //>>excludeStart("ide", pragmas.excludeIdeData);
  1410. args: [],
  1411. source: "selector\x0a\x09^ selector",
  1412. referencedClasses: [],
  1413. //>>excludeEnd("ide");
  1414. pragmas: [],
  1415. messageSends: []
  1416. }, function ($methodClass){ return function (){
  1417. var self=this,$self=this;
  1418. return $self.selector;
  1419. }; }),
  1420. $globals.CompiledMethod);
  1421. $core.addMethod(
  1422. $core.method({
  1423. selector: "selector:",
  1424. protocol: "accessing",
  1425. //>>excludeStart("ide", pragmas.excludeIdeData);
  1426. args: ["aString"],
  1427. source: "selector: aString\x0a\x09selector := aString",
  1428. referencedClasses: [],
  1429. //>>excludeEnd("ide");
  1430. pragmas: [],
  1431. messageSends: []
  1432. }, function ($methodClass){ return function (aString){
  1433. var self=this,$self=this;
  1434. $self.selector=aString;
  1435. return self;
  1436. }; }),
  1437. $globals.CompiledMethod);
  1438. $core.addMethod(
  1439. $core.method({
  1440. selector: "sendTo:arguments:",
  1441. protocol: "evaluating",
  1442. //>>excludeStart("ide", pragmas.excludeIdeData);
  1443. args: ["anObject", "aCollection"],
  1444. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  1445. referencedClasses: [],
  1446. //>>excludeEnd("ide");
  1447. pragmas: [],
  1448. messageSends: ["applyTo:arguments:", "fn"]
  1449. }, function ($methodClass){ return function (anObject,aCollection){
  1450. var self=this,$self=this;
  1451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1452. return $core.withContext(function($ctx1) {
  1453. //>>excludeEnd("ctx");
  1454. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  1455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1456. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection})});
  1457. //>>excludeEnd("ctx");
  1458. }; }),
  1459. $globals.CompiledMethod);
  1460. $core.addMethod(
  1461. $core.method({
  1462. selector: "source",
  1463. protocol: "accessing",
  1464. //>>excludeStart("ide", pragmas.excludeIdeData);
  1465. args: [],
  1466. source: "source\x0a\x09^ source ifNil: [ '' ]",
  1467. referencedClasses: [],
  1468. //>>excludeEnd("ide");
  1469. pragmas: [],
  1470. messageSends: ["ifNil:"]
  1471. }, function ($methodClass){ return function (){
  1472. var self=this,$self=this;
  1473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1474. return $core.withContext(function($ctx1) {
  1475. //>>excludeEnd("ctx");
  1476. var $1;
  1477. $1=$self.source;
  1478. if($1 == null || $1.a$nil){
  1479. return "";
  1480. } else {
  1481. return $1;
  1482. }
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. }, function($ctx1) {$ctx1.fill(self,"source",{})});
  1485. //>>excludeEnd("ctx");
  1486. }; }),
  1487. $globals.CompiledMethod);
  1488. $core.addMethod(
  1489. $core.method({
  1490. selector: "source:",
  1491. protocol: "accessing",
  1492. //>>excludeStart("ide", pragmas.excludeIdeData);
  1493. args: ["aString"],
  1494. source: "source: aString\x0a\x09source := aString",
  1495. referencedClasses: [],
  1496. //>>excludeEnd("ide");
  1497. pragmas: [],
  1498. messageSends: []
  1499. }, function ($methodClass){ return function (aString){
  1500. var self=this,$self=this;
  1501. $self.source=aString;
  1502. return self;
  1503. }; }),
  1504. $globals.CompiledMethod);
  1505. $core.addClass("ForkPool", $globals.Object, "Kernel-Methods");
  1506. $core.setSlots($globals.ForkPool, ["poolSize", "maxPoolSize", "queue", "worker"]);
  1507. //>>excludeStart("ide", pragmas.excludeIdeData);
  1508. $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`";
  1509. //>>excludeEnd("ide");
  1510. $core.addMethod(
  1511. $core.method({
  1512. selector: "addWorker",
  1513. protocol: "private",
  1514. //>>excludeStart("ide", pragmas.excludeIdeData);
  1515. args: [],
  1516. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  1517. referencedClasses: [],
  1518. //>>excludeEnd("ide");
  1519. pragmas: [],
  1520. messageSends: ["valueWithTimeout:", "+"]
  1521. }, function ($methodClass){ return function (){
  1522. var self=this,$self=this;
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. return $core.withContext(function($ctx1) {
  1525. //>>excludeEnd("ctx");
  1526. $recv($self.worker)._valueWithTimeout_((0));
  1527. $self.poolSize=$recv($self.poolSize).__plus((1));
  1528. return self;
  1529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1530. }, function($ctx1) {$ctx1.fill(self,"addWorker",{})});
  1531. //>>excludeEnd("ctx");
  1532. }; }),
  1533. $globals.ForkPool);
  1534. $core.addMethod(
  1535. $core.method({
  1536. selector: "defaultMaxPoolSize",
  1537. protocol: "defaults",
  1538. //>>excludeStart("ide", pragmas.excludeIdeData);
  1539. args: [],
  1540. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  1541. referencedClasses: [],
  1542. //>>excludeEnd("ide");
  1543. pragmas: [],
  1544. messageSends: ["defaultMaxPoolSize", "class"]
  1545. }, function ($methodClass){ return function (){
  1546. var self=this,$self=this;
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. return $core.withContext(function($ctx1) {
  1549. //>>excludeEnd("ctx");
  1550. return $recv($self._class())._defaultMaxPoolSize();
  1551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1552. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{})});
  1553. //>>excludeEnd("ctx");
  1554. }; }),
  1555. $globals.ForkPool);
  1556. $core.addMethod(
  1557. $core.method({
  1558. selector: "fork:",
  1559. protocol: "actions",
  1560. //>>excludeStart("ide", pragmas.excludeIdeData);
  1561. args: ["aBlock"],
  1562. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  1563. referencedClasses: [],
  1564. //>>excludeEnd("ide");
  1565. pragmas: [],
  1566. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  1567. }, function ($methodClass){ return function (aBlock){
  1568. var self=this,$self=this;
  1569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1570. return $core.withContext(function($ctx1) {
  1571. //>>excludeEnd("ctx");
  1572. if($core.assert($recv($self.poolSize).__lt($self._maxPoolSize()))){
  1573. $self._addWorker();
  1574. }
  1575. $recv($self.queue)._nextPut_(aBlock);
  1576. return self;
  1577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1578. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock})});
  1579. //>>excludeEnd("ctx");
  1580. }; }),
  1581. $globals.ForkPool);
  1582. $core.addMethod(
  1583. $core.method({
  1584. selector: "initialize",
  1585. protocol: "initialization",
  1586. //>>excludeStart("ide", pragmas.excludeIdeData);
  1587. args: [],
  1588. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  1589. referencedClasses: ["Queue"],
  1590. //>>excludeEnd("ide");
  1591. pragmas: [],
  1592. messageSends: ["initialize", "new", "makeWorker"]
  1593. }, function ($methodClass){ return function (){
  1594. var self=this,$self=this;
  1595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1596. return $core.withContext(function($ctx1) {
  1597. //>>excludeEnd("ctx");
  1598. [(
  1599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1600. $ctx1.supercall = true,
  1601. //>>excludeEnd("ctx");
  1602. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. ,$ctx1.supercall = false
  1605. //>>excludeEnd("ctx");
  1606. ][0];
  1607. $self.poolSize=(0);
  1608. $self.queue=$recv($globals.Queue)._new();
  1609. $self.worker=$self._makeWorker();
  1610. return self;
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  1613. //>>excludeEnd("ctx");
  1614. }; }),
  1615. $globals.ForkPool);
  1616. $core.addMethod(
  1617. $core.method({
  1618. selector: "makeWorker",
  1619. protocol: "initialization",
  1620. //>>excludeStart("ide", pragmas.excludeIdeData);
  1621. args: [],
  1622. 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 ] ]]",
  1623. referencedClasses: ["Object"],
  1624. //>>excludeEnd("ide");
  1625. pragmas: [],
  1626. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  1627. }, function ($methodClass){ return function (){
  1628. var self=this,$self=this;
  1629. var sentinel;
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. return $core.withContext(function($ctx1) {
  1632. //>>excludeEnd("ctx");
  1633. sentinel=$recv($globals.Object)._new();
  1634. return (function(){
  1635. var block;
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. return $core.withContext(function($ctx2) {
  1638. //>>excludeEnd("ctx");
  1639. $self.poolSize=$recv($self.poolSize).__minus((1));
  1640. block=$recv($self.queue)._nextIfAbsent_((function(){
  1641. return sentinel;
  1642. }));
  1643. if(!$core.assert($recv(block).__eq_eq(sentinel))){
  1644. return $recv((function(){
  1645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1646. return $core.withContext(function($ctx3) {
  1647. //>>excludeEnd("ctx");
  1648. return $recv(block)._value();
  1649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1650. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  1651. //>>excludeEnd("ctx");
  1652. }))._ensure_((function(){
  1653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1654. return $core.withContext(function($ctx3) {
  1655. //>>excludeEnd("ctx");
  1656. return $self._addWorker();
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  1659. //>>excludeEnd("ctx");
  1660. }));
  1661. }
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  1664. //>>excludeEnd("ctx");
  1665. });
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel})});
  1668. //>>excludeEnd("ctx");
  1669. }; }),
  1670. $globals.ForkPool);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "maxPoolSize",
  1674. protocol: "accessing",
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: [],
  1677. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. pragmas: [],
  1681. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  1682. }, function ($methodClass){ return function (){
  1683. var self=this,$self=this;
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. return $core.withContext(function($ctx1) {
  1686. //>>excludeEnd("ctx");
  1687. var $1;
  1688. $1=$self.maxPoolSize;
  1689. if($1 == null || $1.a$nil){
  1690. return $self._defaultMaxPoolSize();
  1691. } else {
  1692. return $1;
  1693. }
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{})});
  1696. //>>excludeEnd("ctx");
  1697. }; }),
  1698. $globals.ForkPool);
  1699. $core.addMethod(
  1700. $core.method({
  1701. selector: "maxPoolSize:",
  1702. protocol: "accessing",
  1703. //>>excludeStart("ide", pragmas.excludeIdeData);
  1704. args: ["anInteger"],
  1705. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  1706. referencedClasses: [],
  1707. //>>excludeEnd("ide");
  1708. pragmas: [],
  1709. messageSends: []
  1710. }, function ($methodClass){ return function (anInteger){
  1711. var self=this,$self=this;
  1712. $self.maxPoolSize=anInteger;
  1713. return self;
  1714. }; }),
  1715. $globals.ForkPool);
  1716. $core.setSlots($globals.ForkPool.a$cls, ["default"]);
  1717. $core.addMethod(
  1718. $core.method({
  1719. selector: "default",
  1720. protocol: "accessing",
  1721. //>>excludeStart("ide", pragmas.excludeIdeData);
  1722. args: [],
  1723. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  1724. referencedClasses: [],
  1725. //>>excludeEnd("ide");
  1726. pragmas: [],
  1727. messageSends: ["ifNil:", "new"]
  1728. }, function ($methodClass){ return function (){
  1729. var self=this,$self=this;
  1730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1731. return $core.withContext(function($ctx1) {
  1732. //>>excludeEnd("ctx");
  1733. var $1;
  1734. $1=$self.default;
  1735. if($1 == null || $1.a$nil){
  1736. $self.default=$self._new();
  1737. return $self.default;
  1738. } else {
  1739. return $1;
  1740. }
  1741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1742. }, function($ctx1) {$ctx1.fill(self,"default",{})});
  1743. //>>excludeEnd("ctx");
  1744. }; }),
  1745. $globals.ForkPool.a$cls);
  1746. $core.addMethod(
  1747. $core.method({
  1748. selector: "defaultMaxPoolSize",
  1749. protocol: "accessing",
  1750. //>>excludeStart("ide", pragmas.excludeIdeData);
  1751. args: [],
  1752. source: "defaultMaxPoolSize\x0a\x09^ 100",
  1753. referencedClasses: [],
  1754. //>>excludeEnd("ide");
  1755. pragmas: [],
  1756. messageSends: []
  1757. }, function ($methodClass){ return function (){
  1758. var self=this,$self=this;
  1759. return (100);
  1760. }; }),
  1761. $globals.ForkPool.a$cls);
  1762. $core.addMethod(
  1763. $core.method({
  1764. selector: "resetDefault",
  1765. protocol: "accessing",
  1766. //>>excludeStart("ide", pragmas.excludeIdeData);
  1767. args: [],
  1768. source: "resetDefault\x0a\x09default := nil",
  1769. referencedClasses: [],
  1770. //>>excludeEnd("ide");
  1771. pragmas: [],
  1772. messageSends: []
  1773. }, function ($methodClass){ return function (){
  1774. var self=this,$self=this;
  1775. $self.default=nil;
  1776. return self;
  1777. }; }),
  1778. $globals.ForkPool.a$cls);
  1779. $core.addClass("Message", $globals.Object, "Kernel-Methods");
  1780. $core.setSlots($globals.Message, ["selector", "arguments"]);
  1781. //>>excludeStart("ide", pragmas.excludeIdeData);
  1782. $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.";
  1783. //>>excludeEnd("ide");
  1784. $core.addMethod(
  1785. $core.method({
  1786. selector: "arguments",
  1787. protocol: "accessing",
  1788. //>>excludeStart("ide", pragmas.excludeIdeData);
  1789. args: [],
  1790. source: "arguments\x0a\x09^ arguments",
  1791. referencedClasses: [],
  1792. //>>excludeEnd("ide");
  1793. pragmas: [],
  1794. messageSends: []
  1795. }, function ($methodClass){ return function (){
  1796. var self=this,$self=this;
  1797. return $self.arguments;
  1798. }; }),
  1799. $globals.Message);
  1800. $core.addMethod(
  1801. $core.method({
  1802. selector: "arguments:",
  1803. protocol: "accessing",
  1804. //>>excludeStart("ide", pragmas.excludeIdeData);
  1805. args: ["anArray"],
  1806. source: "arguments: anArray\x0a\x09arguments := anArray",
  1807. referencedClasses: [],
  1808. //>>excludeEnd("ide");
  1809. pragmas: [],
  1810. messageSends: []
  1811. }, function ($methodClass){ return function (anArray){
  1812. var self=this,$self=this;
  1813. $self.arguments=anArray;
  1814. return self;
  1815. }; }),
  1816. $globals.Message);
  1817. $core.addMethod(
  1818. $core.method({
  1819. selector: "printOn:",
  1820. protocol: "printing",
  1821. //>>excludeStart("ide", pragmas.excludeIdeData);
  1822. args: ["aStream"],
  1823. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  1824. referencedClasses: [],
  1825. //>>excludeEnd("ide");
  1826. pragmas: [],
  1827. messageSends: ["printOn:", "nextPutAll:", "selector"]
  1828. }, function ($methodClass){ return function (aStream){
  1829. var self=this,$self=this;
  1830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1831. return $core.withContext(function($ctx1) {
  1832. //>>excludeEnd("ctx");
  1833. [(
  1834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1835. $ctx1.supercall = true,
  1836. //>>excludeEnd("ctx");
  1837. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. ,$ctx1.supercall = false
  1840. //>>excludeEnd("ctx");
  1841. ][0];
  1842. [$recv(aStream)._nextPutAll_("(")
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. ,$ctx1.sendIdx["nextPutAll:"]=1
  1845. //>>excludeEnd("ctx");
  1846. ][0];
  1847. [$recv(aStream)._nextPutAll_($self._selector())
  1848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1849. ,$ctx1.sendIdx["nextPutAll:"]=2
  1850. //>>excludeEnd("ctx");
  1851. ][0];
  1852. $recv(aStream)._nextPutAll_(")");
  1853. return self;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  1856. //>>excludeEnd("ctx");
  1857. }; }),
  1858. $globals.Message);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "selector",
  1862. protocol: "accessing",
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: [],
  1865. source: "selector\x0a\x09^ selector",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. pragmas: [],
  1869. messageSends: []
  1870. }, function ($methodClass){ return function (){
  1871. var self=this,$self=this;
  1872. return $self.selector;
  1873. }; }),
  1874. $globals.Message);
  1875. $core.addMethod(
  1876. $core.method({
  1877. selector: "selector:",
  1878. protocol: "accessing",
  1879. //>>excludeStart("ide", pragmas.excludeIdeData);
  1880. args: ["aString"],
  1881. source: "selector: aString\x0a\x09selector := aString",
  1882. referencedClasses: [],
  1883. //>>excludeEnd("ide");
  1884. pragmas: [],
  1885. messageSends: []
  1886. }, function ($methodClass){ return function (aString){
  1887. var self=this,$self=this;
  1888. $self.selector=aString;
  1889. return self;
  1890. }; }),
  1891. $globals.Message);
  1892. $core.addMethod(
  1893. $core.method({
  1894. selector: "sendTo:",
  1895. protocol: "actions",
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: ["anObject"],
  1898. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  1899. referencedClasses: [],
  1900. //>>excludeEnd("ide");
  1901. pragmas: [],
  1902. messageSends: ["perform:withArguments:", "selector", "arguments"]
  1903. }, function ($methodClass){ return function (anObject){
  1904. var self=this,$self=this;
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. return $core.withContext(function($ctx1) {
  1907. //>>excludeEnd("ctx");
  1908. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject})});
  1911. //>>excludeEnd("ctx");
  1912. }; }),
  1913. $globals.Message);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "selector:arguments:",
  1917. protocol: "instance creation",
  1918. //>>excludeStart("ide", pragmas.excludeIdeData);
  1919. args: ["aString", "anArray"],
  1920. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  1921. referencedClasses: [],
  1922. //>>excludeEnd("ide");
  1923. pragmas: [],
  1924. messageSends: ["selector:", "new", "arguments:", "yourself"]
  1925. }, function ($methodClass){ return function (aString,anArray){
  1926. var self=this,$self=this;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. return $core.withContext(function($ctx1) {
  1929. //>>excludeEnd("ctx");
  1930. var $1;
  1931. $1=$self._new();
  1932. $recv($1)._selector_(aString);
  1933. $recv($1)._arguments_(anArray);
  1934. return $recv($1)._yourself();
  1935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1936. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray})});
  1937. //>>excludeEnd("ctx");
  1938. }; }),
  1939. $globals.Message.a$cls);
  1940. $core.addMethod(
  1941. $core.method({
  1942. selector: "selector:arguments:notUnderstoodBy:",
  1943. protocol: "dnu handling",
  1944. //>>excludeStart("ide", pragmas.excludeIdeData);
  1945. args: ["aString", "anArray", "anObject"],
  1946. 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)",
  1947. referencedClasses: [],
  1948. //>>excludeEnd("ide");
  1949. pragmas: [],
  1950. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  1951. }, function ($methodClass){ return function (aString,anArray,anObject){
  1952. var self=this,$self=this;
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. return $core.withContext(function($ctx1) {
  1955. //>>excludeEnd("ctx");
  1956. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject})});
  1959. //>>excludeEnd("ctx");
  1960. }; }),
  1961. $globals.Message.a$cls);
  1962. $core.addClass("MessageSend", $globals.Object, "Kernel-Methods");
  1963. $core.setSlots($globals.MessageSend, ["receiver", "message"]);
  1964. //>>excludeStart("ide", pragmas.excludeIdeData);
  1965. $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.";
  1966. //>>excludeEnd("ide");
  1967. $core.addMethod(
  1968. $core.method({
  1969. selector: "arguments",
  1970. protocol: "accessing",
  1971. //>>excludeStart("ide", pragmas.excludeIdeData);
  1972. args: [],
  1973. source: "arguments\x0a\x09^ message arguments",
  1974. referencedClasses: [],
  1975. //>>excludeEnd("ide");
  1976. pragmas: [],
  1977. messageSends: ["arguments"]
  1978. }, function ($methodClass){ return function (){
  1979. var self=this,$self=this;
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. return $core.withContext(function($ctx1) {
  1982. //>>excludeEnd("ctx");
  1983. return $recv($self.message)._arguments();
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"arguments",{})});
  1986. //>>excludeEnd("ctx");
  1987. }; }),
  1988. $globals.MessageSend);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "arguments:",
  1992. protocol: "accessing",
  1993. //>>excludeStart("ide", pragmas.excludeIdeData);
  1994. args: ["anArray"],
  1995. source: "arguments: anArray\x0a\x09message arguments: anArray",
  1996. referencedClasses: [],
  1997. //>>excludeEnd("ide");
  1998. pragmas: [],
  1999. messageSends: ["arguments:"]
  2000. }, function ($methodClass){ return function (anArray){
  2001. var self=this,$self=this;
  2002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2003. return $core.withContext(function($ctx1) {
  2004. //>>excludeEnd("ctx");
  2005. $recv($self.message)._arguments_(anArray);
  2006. return self;
  2007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2008. }, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray})});
  2009. //>>excludeEnd("ctx");
  2010. }; }),
  2011. $globals.MessageSend);
  2012. $core.addMethod(
  2013. $core.method({
  2014. selector: "initialize",
  2015. protocol: "initialization",
  2016. //>>excludeStart("ide", pragmas.excludeIdeData);
  2017. args: [],
  2018. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  2019. referencedClasses: ["Message"],
  2020. //>>excludeEnd("ide");
  2021. pragmas: [],
  2022. messageSends: ["initialize", "new"]
  2023. }, function ($methodClass){ return function (){
  2024. var self=this,$self=this;
  2025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2026. return $core.withContext(function($ctx1) {
  2027. //>>excludeEnd("ctx");
  2028. [(
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. $ctx1.supercall = true,
  2031. //>>excludeEnd("ctx");
  2032. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. ,$ctx1.supercall = false
  2035. //>>excludeEnd("ctx");
  2036. ][0];
  2037. $self.message=$recv($globals.Message)._new();
  2038. return self;
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  2041. //>>excludeEnd("ctx");
  2042. }; }),
  2043. $globals.MessageSend);
  2044. $core.addMethod(
  2045. $core.method({
  2046. selector: "printOn:",
  2047. protocol: "printing",
  2048. //>>excludeStart("ide", pragmas.excludeIdeData);
  2049. args: ["aStream"],
  2050. 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: ')'",
  2051. referencedClasses: [],
  2052. //>>excludeEnd("ide");
  2053. pragmas: [],
  2054. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  2055. }, function ($methodClass){ return function (aStream){
  2056. var self=this,$self=this;
  2057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2058. return $core.withContext(function($ctx1) {
  2059. //>>excludeEnd("ctx");
  2060. [(
  2061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2062. $ctx1.supercall = true,
  2063. //>>excludeEnd("ctx");
  2064. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2066. ,$ctx1.supercall = false
  2067. //>>excludeEnd("ctx");
  2068. ][0];
  2069. [$recv(aStream)._nextPutAll_("(")
  2070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2071. ,$ctx1.sendIdx["nextPutAll:"]=1
  2072. //>>excludeEnd("ctx");
  2073. ][0];
  2074. [$recv(aStream)._nextPutAll_($self._receiver())
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. ,$ctx1.sendIdx["nextPutAll:"]=2
  2077. //>>excludeEnd("ctx");
  2078. ][0];
  2079. [$recv(aStream)._nextPutAll_(" >> ")
  2080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2081. ,$ctx1.sendIdx["nextPutAll:"]=3
  2082. //>>excludeEnd("ctx");
  2083. ][0];
  2084. [$recv(aStream)._nextPutAll_($self._selector())
  2085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2086. ,$ctx1.sendIdx["nextPutAll:"]=4
  2087. //>>excludeEnd("ctx");
  2088. ][0];
  2089. $recv(aStream)._nextPutAll_(")");
  2090. return self;
  2091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2092. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2093. //>>excludeEnd("ctx");
  2094. }; }),
  2095. $globals.MessageSend);
  2096. $core.addMethod(
  2097. $core.method({
  2098. selector: "receiver",
  2099. protocol: "accessing",
  2100. //>>excludeStart("ide", pragmas.excludeIdeData);
  2101. args: [],
  2102. source: "receiver\x0a\x09^ receiver",
  2103. referencedClasses: [],
  2104. //>>excludeEnd("ide");
  2105. pragmas: [],
  2106. messageSends: []
  2107. }, function ($methodClass){ return function (){
  2108. var self=this,$self=this;
  2109. return $self.receiver;
  2110. }; }),
  2111. $globals.MessageSend);
  2112. $core.addMethod(
  2113. $core.method({
  2114. selector: "receiver:",
  2115. protocol: "accessing",
  2116. //>>excludeStart("ide", pragmas.excludeIdeData);
  2117. args: ["anObject"],
  2118. source: "receiver: anObject\x0a\x09receiver := anObject",
  2119. referencedClasses: [],
  2120. //>>excludeEnd("ide");
  2121. pragmas: [],
  2122. messageSends: []
  2123. }, function ($methodClass){ return function (anObject){
  2124. var self=this,$self=this;
  2125. $self.receiver=anObject;
  2126. return self;
  2127. }; }),
  2128. $globals.MessageSend);
  2129. $core.addMethod(
  2130. $core.method({
  2131. selector: "selector",
  2132. protocol: "accessing",
  2133. //>>excludeStart("ide", pragmas.excludeIdeData);
  2134. args: [],
  2135. source: "selector\x0a\x09^ message selector",
  2136. referencedClasses: [],
  2137. //>>excludeEnd("ide");
  2138. pragmas: [],
  2139. messageSends: ["selector"]
  2140. }, function ($methodClass){ return function (){
  2141. var self=this,$self=this;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx1) {
  2144. //>>excludeEnd("ctx");
  2145. return $recv($self.message)._selector();
  2146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2147. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  2148. //>>excludeEnd("ctx");
  2149. }; }),
  2150. $globals.MessageSend);
  2151. $core.addMethod(
  2152. $core.method({
  2153. selector: "selector:",
  2154. protocol: "accessing",
  2155. //>>excludeStart("ide", pragmas.excludeIdeData);
  2156. args: ["aString"],
  2157. source: "selector: aString\x0a\x09message selector: aString",
  2158. referencedClasses: [],
  2159. //>>excludeEnd("ide");
  2160. pragmas: [],
  2161. messageSends: ["selector:"]
  2162. }, function ($methodClass){ return function (aString){
  2163. var self=this,$self=this;
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. return $core.withContext(function($ctx1) {
  2166. //>>excludeEnd("ctx");
  2167. $recv($self.message)._selector_(aString);
  2168. return self;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString})});
  2171. //>>excludeEnd("ctx");
  2172. }; }),
  2173. $globals.MessageSend);
  2174. $core.addMethod(
  2175. $core.method({
  2176. selector: "value",
  2177. protocol: "evaluating",
  2178. //>>excludeStart("ide", pragmas.excludeIdeData);
  2179. args: [],
  2180. source: "value\x0a\x09^ message sendTo: self receiver",
  2181. referencedClasses: [],
  2182. //>>excludeEnd("ide");
  2183. pragmas: [],
  2184. messageSends: ["sendTo:", "receiver"]
  2185. }, function ($methodClass){ return function (){
  2186. var self=this,$self=this;
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. return $core.withContext(function($ctx1) {
  2189. //>>excludeEnd("ctx");
  2190. return $recv($self.message)._sendTo_($self._receiver());
  2191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2192. }, function($ctx1) {$ctx1.fill(self,"value",{})});
  2193. //>>excludeEnd("ctx");
  2194. }; }),
  2195. $globals.MessageSend);
  2196. $core.addMethod(
  2197. $core.method({
  2198. selector: "value:",
  2199. protocol: "evaluating",
  2200. //>>excludeStart("ide", pragmas.excludeIdeData);
  2201. args: ["anObject"],
  2202. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  2203. referencedClasses: [],
  2204. //>>excludeEnd("ide");
  2205. pragmas: [],
  2206. messageSends: ["arguments:", "sendTo:", "receiver"]
  2207. }, function ($methodClass){ return function (anObject){
  2208. var self=this,$self=this;
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. return $core.withContext(function($ctx1) {
  2211. //>>excludeEnd("ctx");
  2212. var $1;
  2213. $1=$self.message;
  2214. $recv($1)._arguments_([anObject]);
  2215. return $recv($1)._sendTo_($self._receiver());
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  2218. //>>excludeEnd("ctx");
  2219. }; }),
  2220. $globals.MessageSend);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "value:value:",
  2224. protocol: "evaluating",
  2225. //>>excludeStart("ide", pragmas.excludeIdeData);
  2226. args: ["firstArgument", "secondArgument"],
  2227. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  2228. referencedClasses: [],
  2229. //>>excludeEnd("ide");
  2230. pragmas: [],
  2231. messageSends: ["arguments:", "sendTo:", "receiver"]
  2232. }, function ($methodClass){ return function (firstArgument,secondArgument){
  2233. var self=this,$self=this;
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. return $core.withContext(function($ctx1) {
  2236. //>>excludeEnd("ctx");
  2237. var $1;
  2238. $1=$self.message;
  2239. $recv($1)._arguments_([firstArgument,secondArgument]);
  2240. return $recv($1)._sendTo_($self._receiver());
  2241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2242. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument})});
  2243. //>>excludeEnd("ctx");
  2244. }; }),
  2245. $globals.MessageSend);
  2246. $core.addMethod(
  2247. $core.method({
  2248. selector: "value:value:value:",
  2249. protocol: "evaluating",
  2250. //>>excludeStart("ide", pragmas.excludeIdeData);
  2251. args: ["firstArgument", "secondArgument", "thirdArgument"],
  2252. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  2253. referencedClasses: [],
  2254. //>>excludeEnd("ide");
  2255. pragmas: [],
  2256. messageSends: ["arguments:", "sendTo:", "receiver"]
  2257. }, function ($methodClass){ return function (firstArgument,secondArgument,thirdArgument){
  2258. var self=this,$self=this;
  2259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2260. return $core.withContext(function($ctx1) {
  2261. //>>excludeEnd("ctx");
  2262. var $1;
  2263. $1=$self.message;
  2264. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  2265. return $recv($1)._sendTo_($self._receiver());
  2266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2267. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument})});
  2268. //>>excludeEnd("ctx");
  2269. }; }),
  2270. $globals.MessageSend);
  2271. $core.addMethod(
  2272. $core.method({
  2273. selector: "valueWithPossibleArguments:",
  2274. protocol: "evaluating",
  2275. //>>excludeStart("ide", pragmas.excludeIdeData);
  2276. args: ["anArray"],
  2277. source: "valueWithPossibleArguments: anArray\x0a\x09self arguments: anArray.\x0a\x09^ self value",
  2278. referencedClasses: [],
  2279. //>>excludeEnd("ide");
  2280. pragmas: [],
  2281. messageSends: ["arguments:", "value"]
  2282. }, function ($methodClass){ return function (anArray){
  2283. var self=this,$self=this;
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx1) {
  2286. //>>excludeEnd("ctx");
  2287. $self._arguments_(anArray);
  2288. return $self._value();
  2289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2290. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{anArray:anArray})});
  2291. //>>excludeEnd("ctx");
  2292. }; }),
  2293. $globals.MessageSend);
  2294. $core.addClass("MethodContext", $globals.Object, "Kernel-Methods");
  2295. $core.setSlots($globals.MethodContext, ["receiver", "evaluatedSelector", "homeContext", "index", "locals", "outerContext", "selector", "sendIdx", "supercall"]);
  2296. //>>excludeStart("ide", pragmas.excludeIdeData);
  2297. $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`.";
  2298. //>>excludeEnd("ide");
  2299. $core.addMethod(
  2300. $core.method({
  2301. selector: "basicReceiver",
  2302. protocol: "accessing",
  2303. //>>excludeStart("ide", pragmas.excludeIdeData);
  2304. args: [],
  2305. source: "basicReceiver\x0a\x09^ receiver",
  2306. referencedClasses: [],
  2307. //>>excludeEnd("ide");
  2308. pragmas: [],
  2309. messageSends: []
  2310. }, function ($methodClass){ return function (){
  2311. var self=this,$self=this;
  2312. return $self.receiver;
  2313. }; }),
  2314. $globals.MethodContext);
  2315. $core.addMethod(
  2316. $core.method({
  2317. selector: "evaluatedSelector",
  2318. protocol: "accessing",
  2319. //>>excludeStart("ide", pragmas.excludeIdeData);
  2320. args: [],
  2321. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  2322. referencedClasses: [],
  2323. //>>excludeEnd("ide");
  2324. pragmas: [],
  2325. messageSends: []
  2326. }, function ($methodClass){ return function (){
  2327. var self=this,$self=this;
  2328. return $self.evaluatedSelector;
  2329. }; }),
  2330. $globals.MethodContext);
  2331. $core.addMethod(
  2332. $core.method({
  2333. selector: "home",
  2334. protocol: "accessing",
  2335. //>>excludeStart("ide", pragmas.excludeIdeData);
  2336. args: [],
  2337. source: "home\x0a\x09^ homeContext ifNotNil: [ :c | c hydrated ]",
  2338. referencedClasses: [],
  2339. //>>excludeEnd("ide");
  2340. pragmas: [],
  2341. messageSends: ["ifNotNil:", "hydrated"]
  2342. }, function ($methodClass){ return function (){
  2343. var self=this,$self=this;
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. return $core.withContext(function($ctx1) {
  2346. //>>excludeEnd("ctx");
  2347. var $1;
  2348. $1=$self.homeContext;
  2349. if($1 == null || $1.a$nil){
  2350. return $1;
  2351. } else {
  2352. var c;
  2353. c=$1;
  2354. return $recv(c)._hydrated();
  2355. }
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx1) {$ctx1.fill(self,"home",{})});
  2358. //>>excludeEnd("ctx");
  2359. }; }),
  2360. $globals.MethodContext);
  2361. $core.addMethod(
  2362. $core.method({
  2363. selector: "hydrated",
  2364. protocol: "accessing",
  2365. //>>excludeStart("ide", pragmas.excludeIdeData);
  2366. args: [],
  2367. source: "hydrated\x0a\x09<inlineJS: 'if (!$self.selector && !$self.outerContext) $self.setup(self); return self;'>",
  2368. referencedClasses: [],
  2369. //>>excludeEnd("ide");
  2370. pragmas: [["inlineJS:", ["if (!$self.selector && !$self.outerContext) $self.setup(self); return self;"]]],
  2371. messageSends: []
  2372. }, function ($methodClass){ return function (){
  2373. var self=this,$self=this;
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. return $core.withContext(function($ctx1) {
  2376. //>>excludeEnd("ctx");
  2377. if (!$self.selector && !$self.outerContext) $self.setup(self); return self;;
  2378. return self;
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. }, function($ctx1) {$ctx1.fill(self,"hydrated",{})});
  2381. //>>excludeEnd("ctx");
  2382. }; }),
  2383. $globals.MethodContext);
  2384. $core.addMethod(
  2385. $core.method({
  2386. selector: "index",
  2387. protocol: "accessing",
  2388. //>>excludeStart("ide", pragmas.excludeIdeData);
  2389. args: [],
  2390. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  2391. referencedClasses: [],
  2392. //>>excludeEnd("ide");
  2393. pragmas: [],
  2394. messageSends: ["ifNil:"]
  2395. }, function ($methodClass){ return function (){
  2396. var self=this,$self=this;
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. return $core.withContext(function($ctx1) {
  2399. //>>excludeEnd("ctx");
  2400. var $1;
  2401. $1=$self.index;
  2402. if($1 == null || $1.a$nil){
  2403. return (0);
  2404. } else {
  2405. return $1;
  2406. }
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  2409. //>>excludeEnd("ctx");
  2410. }; }),
  2411. $globals.MethodContext);
  2412. $core.addMethod(
  2413. $core.method({
  2414. selector: "locals",
  2415. protocol: "accessing",
  2416. //>>excludeStart("ide", pragmas.excludeIdeData);
  2417. args: [],
  2418. source: "locals\x0a\x09^ locals",
  2419. referencedClasses: [],
  2420. //>>excludeEnd("ide");
  2421. pragmas: [],
  2422. messageSends: []
  2423. }, function ($methodClass){ return function (){
  2424. var self=this,$self=this;
  2425. return $self.locals;
  2426. }; }),
  2427. $globals.MethodContext);
  2428. $core.addMethod(
  2429. $core.method({
  2430. selector: "outerContext",
  2431. protocol: "accessing",
  2432. //>>excludeStart("ide", pragmas.excludeIdeData);
  2433. args: [],
  2434. source: "outerContext\x0a\x09^ outerContext ifNil: [ self home ] ifNotNil: [ :c | c hydrated ]",
  2435. referencedClasses: [],
  2436. //>>excludeEnd("ide");
  2437. pragmas: [],
  2438. messageSends: ["ifNil:ifNotNil:", "home", "hydrated"]
  2439. }, function ($methodClass){ return function (){
  2440. var self=this,$self=this;
  2441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2442. return $core.withContext(function($ctx1) {
  2443. //>>excludeEnd("ctx");
  2444. var $1;
  2445. $1=$self.outerContext;
  2446. if($1 == null || $1.a$nil){
  2447. return $self._home();
  2448. } else {
  2449. var c;
  2450. c=$1;
  2451. return $recv(c)._hydrated();
  2452. }
  2453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2454. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  2455. //>>excludeEnd("ctx");
  2456. }; }),
  2457. $globals.MethodContext);
  2458. $core.addMethod(
  2459. $core.method({
  2460. selector: "selector",
  2461. protocol: "accessing",
  2462. //>>excludeStart("ide", pragmas.excludeIdeData);
  2463. args: [],
  2464. source: "selector\x0a\x09^ selector ifNotNil: [ Smalltalk core js2st: selector ]",
  2465. referencedClasses: ["Smalltalk"],
  2466. //>>excludeEnd("ide");
  2467. pragmas: [],
  2468. messageSends: ["ifNotNil:", "js2st:", "core"]
  2469. }, function ($methodClass){ return function (){
  2470. var self=this,$self=this;
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx1) {
  2473. //>>excludeEnd("ctx");
  2474. var $1;
  2475. $1=$self.selector;
  2476. if($1 == null || $1.a$nil){
  2477. return $1;
  2478. } else {
  2479. return $recv($recv($globals.Smalltalk)._core())._js2st_($self.selector);
  2480. }
  2481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2482. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  2483. //>>excludeEnd("ctx");
  2484. }; }),
  2485. $globals.MethodContext);
  2486. $core.addMethod(
  2487. $core.method({
  2488. selector: "sendIndexes",
  2489. protocol: "accessing",
  2490. //>>excludeStart("ide", pragmas.excludeIdeData);
  2491. args: [],
  2492. source: "sendIndexes\x0a\x09^ sendIdx",
  2493. referencedClasses: [],
  2494. //>>excludeEnd("ide");
  2495. pragmas: [],
  2496. messageSends: []
  2497. }, function ($methodClass){ return function (){
  2498. var self=this,$self=this;
  2499. return $self.sendIdx;
  2500. }; }),
  2501. $globals.MethodContext);
  2502. $core.addMethod(
  2503. $core.method({
  2504. selector: "supercall",
  2505. protocol: "accessing",
  2506. //>>excludeStart("ide", pragmas.excludeIdeData);
  2507. args: [],
  2508. source: "supercall\x0a\x09^ supercall = true",
  2509. referencedClasses: [],
  2510. //>>excludeEnd("ide");
  2511. pragmas: [],
  2512. messageSends: ["="]
  2513. }, function ($methodClass){ return function (){
  2514. var self=this,$self=this;
  2515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2516. return $core.withContext(function($ctx1) {
  2517. //>>excludeEnd("ctx");
  2518. return $recv($self.supercall).__eq(true);
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  2521. //>>excludeEnd("ctx");
  2522. }; }),
  2523. $globals.MethodContext);
  2524. $core.addClass("NativeFunction", $globals.Object, "Kernel-Methods");
  2525. //>>excludeStart("ide", pragmas.excludeIdeData);
  2526. $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' ]";
  2527. //>>excludeEnd("ide");
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "constructorNamed:",
  2531. protocol: "instance creation",
  2532. //>>excludeStart("ide", pragmas.excludeIdeData);
  2533. args: ["aString"],
  2534. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  2535. referencedClasses: [],
  2536. //>>excludeEnd("ide");
  2537. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  2538. messageSends: []
  2539. }, function ($methodClass){ return function (aString){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. var nativeFunc=$globals.Platform._globals()[aString];
  2545. return new nativeFunc();
  2546. ;
  2547. return self;
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString})});
  2550. //>>excludeEnd("ctx");
  2551. }; }),
  2552. $globals.NativeFunction.a$cls);
  2553. $core.addMethod(
  2554. $core.method({
  2555. selector: "constructorNamed:value:",
  2556. protocol: "instance creation",
  2557. //>>excludeStart("ide", pragmas.excludeIdeData);
  2558. args: ["aString", "anObject"],
  2559. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  2560. referencedClasses: [],
  2561. //>>excludeEnd("ide");
  2562. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  2563. messageSends: []
  2564. }, function ($methodClass){ return function (aString,anObject){
  2565. var self=this,$self=this;
  2566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2567. return $core.withContext(function($ctx1) {
  2568. //>>excludeEnd("ctx");
  2569. var nativeFunc=$globals.Platform._globals()[aString];
  2570. return new nativeFunc(anObject);
  2571. ;
  2572. return self;
  2573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2574. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject})});
  2575. //>>excludeEnd("ctx");
  2576. }; }),
  2577. $globals.NativeFunction.a$cls);
  2578. $core.addMethod(
  2579. $core.method({
  2580. selector: "constructorNamed:value:value:",
  2581. protocol: "instance creation",
  2582. //>>excludeStart("ide", pragmas.excludeIdeData);
  2583. args: ["aString", "anObject", "anObject2"],
  2584. 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'>",
  2585. referencedClasses: [],
  2586. //>>excludeEnd("ide");
  2587. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  2588. messageSends: []
  2589. }, function ($methodClass){ return function (aString,anObject,anObject2){
  2590. var self=this,$self=this;
  2591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2592. return $core.withContext(function($ctx1) {
  2593. //>>excludeEnd("ctx");
  2594. var nativeFunc=$globals.Platform._globals()[aString];
  2595. return new nativeFunc(anObject,anObject2);
  2596. ;
  2597. return self;
  2598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2599. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  2600. //>>excludeEnd("ctx");
  2601. }; }),
  2602. $globals.NativeFunction.a$cls);
  2603. $core.addMethod(
  2604. $core.method({
  2605. selector: "constructorNamed:value:value:value:",
  2606. protocol: "instance creation",
  2607. //>>excludeStart("ide", pragmas.excludeIdeData);
  2608. args: ["aString", "anObject", "anObject2", "anObject3"],
  2609. 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'>",
  2610. referencedClasses: [],
  2611. //>>excludeEnd("ide");
  2612. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  2613. messageSends: []
  2614. }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
  2615. var self=this,$self=this;
  2616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2617. return $core.withContext(function($ctx1) {
  2618. //>>excludeEnd("ctx");
  2619. var nativeFunc=$globals.Platform._globals()[aString];
  2620. return new nativeFunc(anObject,anObject2, anObject3);
  2621. ;
  2622. return self;
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  2625. //>>excludeEnd("ctx");
  2626. }; }),
  2627. $globals.NativeFunction.a$cls);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "constructorOf:",
  2631. protocol: "instance creation",
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: ["nativeFunc"],
  2634. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc();\x0a\x09"]]],
  2638. messageSends: []
  2639. }, function ($methodClass){ return function (nativeFunc){
  2640. var self=this,$self=this;
  2641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2642. return $core.withContext(function($ctx1) {
  2643. //>>excludeEnd("ctx");
  2644. return new nativeFunc();
  2645. ;
  2646. return self;
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc})});
  2649. //>>excludeEnd("ctx");
  2650. }; }),
  2651. $globals.NativeFunction.a$cls);
  2652. $core.addMethod(
  2653. $core.method({
  2654. selector: "constructorOf:value:",
  2655. protocol: "instance creation",
  2656. //>>excludeStart("ide", pragmas.excludeIdeData);
  2657. args: ["nativeFunc", "anObject"],
  2658. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  2659. referencedClasses: [],
  2660. //>>excludeEnd("ide");
  2661. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09"]]],
  2662. messageSends: []
  2663. }, function ($methodClass){ return function (nativeFunc,anObject){
  2664. var self=this,$self=this;
  2665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2666. return $core.withContext(function($ctx1) {
  2667. //>>excludeEnd("ctx");
  2668. return new nativeFunc(anObject);
  2669. ;
  2670. return self;
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  2673. //>>excludeEnd("ctx");
  2674. }; }),
  2675. $globals.NativeFunction.a$cls);
  2676. $core.addMethod(
  2677. $core.method({
  2678. selector: "constructorOf:value:value:",
  2679. protocol: "instance creation",
  2680. //>>excludeStart("ide", pragmas.excludeIdeData);
  2681. args: ["nativeFunc", "anObject", "anObject2"],
  2682. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  2683. referencedClasses: [],
  2684. //>>excludeEnd("ide");
  2685. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09"]]],
  2686. messageSends: []
  2687. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
  2688. var self=this,$self=this;
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. return $core.withContext(function($ctx1) {
  2691. //>>excludeEnd("ctx");
  2692. return new nativeFunc(anObject,anObject2);
  2693. ;
  2694. return self;
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  2697. //>>excludeEnd("ctx");
  2698. }; }),
  2699. $globals.NativeFunction.a$cls);
  2700. $core.addMethod(
  2701. $core.method({
  2702. selector: "constructorOf:value:value:value:",
  2703. protocol: "instance creation",
  2704. //>>excludeStart("ide", pragmas.excludeIdeData);
  2705. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  2706. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  2707. referencedClasses: [],
  2708. //>>excludeEnd("ide");
  2709. pragmas: [["inlineJS:", ["\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  2710. messageSends: []
  2711. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
  2712. var self=this,$self=this;
  2713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2714. return $core.withContext(function($ctx1) {
  2715. //>>excludeEnd("ctx");
  2716. return new nativeFunc(anObject,anObject2, anObject3);
  2717. ;
  2718. return self;
  2719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2720. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  2721. //>>excludeEnd("ctx");
  2722. }; }),
  2723. $globals.NativeFunction.a$cls);
  2724. $core.addMethod(
  2725. $core.method({
  2726. selector: "exists:",
  2727. protocol: "testing",
  2728. //>>excludeStart("ide", pragmas.excludeIdeData);
  2729. args: ["aString"],
  2730. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  2731. referencedClasses: ["Platform"],
  2732. //>>excludeEnd("ide");
  2733. pragmas: [],
  2734. messageSends: ["includesGlobal:"]
  2735. }, function ($methodClass){ return function (aString){
  2736. var self=this,$self=this;
  2737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2738. return $core.withContext(function($ctx1) {
  2739. //>>excludeEnd("ctx");
  2740. return $recv($globals.Platform)._includesGlobal_(aString);
  2741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2742. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString})});
  2743. //>>excludeEnd("ctx");
  2744. }; }),
  2745. $globals.NativeFunction.a$cls);
  2746. $core.addMethod(
  2747. $core.method({
  2748. selector: "functionNamed:",
  2749. protocol: "function calling",
  2750. //>>excludeStart("ide", pragmas.excludeIdeData);
  2751. args: ["aString"],
  2752. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  2753. referencedClasses: [],
  2754. //>>excludeEnd("ide");
  2755. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  2756. messageSends: []
  2757. }, function ($methodClass){ return function (aString){
  2758. var self=this,$self=this;
  2759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2760. return $core.withContext(function($ctx1) {
  2761. //>>excludeEnd("ctx");
  2762. var nativeFunc=$globals.Platform._globals[aString];
  2763. return nativeFunc();
  2764. ;
  2765. return self;
  2766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2767. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString})});
  2768. //>>excludeEnd("ctx");
  2769. }; }),
  2770. $globals.NativeFunction.a$cls);
  2771. $core.addMethod(
  2772. $core.method({
  2773. selector: "functionNamed:value:",
  2774. protocol: "function calling",
  2775. //>>excludeStart("ide", pragmas.excludeIdeData);
  2776. args: ["aString", "anObject"],
  2777. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  2778. referencedClasses: [],
  2779. //>>excludeEnd("ide");
  2780. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  2781. messageSends: []
  2782. }, function ($methodClass){ return function (aString,anObject){
  2783. var self=this,$self=this;
  2784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2785. return $core.withContext(function($ctx1) {
  2786. //>>excludeEnd("ctx");
  2787. var nativeFunc=$globals.Platform._globals()[aString];
  2788. return nativeFunc(anObject);
  2789. ;
  2790. return self;
  2791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2792. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject})});
  2793. //>>excludeEnd("ctx");
  2794. }; }),
  2795. $globals.NativeFunction.a$cls);
  2796. $core.addMethod(
  2797. $core.method({
  2798. selector: "functionNamed:value:value:",
  2799. protocol: "function calling",
  2800. //>>excludeStart("ide", pragmas.excludeIdeData);
  2801. args: ["aString", "anObject", "anObject2"],
  2802. 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'>",
  2803. referencedClasses: [],
  2804. //>>excludeEnd("ide");
  2805. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  2806. messageSends: []
  2807. }, function ($methodClass){ return function (aString,anObject,anObject2){
  2808. var self=this,$self=this;
  2809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2810. return $core.withContext(function($ctx1) {
  2811. //>>excludeEnd("ctx");
  2812. var nativeFunc=$globals.Platform._globals()[aString];
  2813. return nativeFunc(anObject,anObject2);
  2814. ;
  2815. return self;
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2})});
  2818. //>>excludeEnd("ctx");
  2819. }; }),
  2820. $globals.NativeFunction.a$cls);
  2821. $core.addMethod(
  2822. $core.method({
  2823. selector: "functionNamed:value:value:value:",
  2824. protocol: "function calling",
  2825. //>>excludeStart("ide", pragmas.excludeIdeData);
  2826. args: ["aString", "anObject", "anObject2", "anObject3"],
  2827. 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'>",
  2828. referencedClasses: [],
  2829. //>>excludeEnd("ide");
  2830. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  2831. messageSends: []
  2832. }, function ($methodClass){ return function (aString,anObject,anObject2,anObject3){
  2833. var self=this,$self=this;
  2834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2835. return $core.withContext(function($ctx1) {
  2836. //>>excludeEnd("ctx");
  2837. var nativeFunc=$globals.Platform._globals()[aString];
  2838. return nativeFunc(anObject,anObject2, anObject3);
  2839. ;
  2840. return self;
  2841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2842. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  2843. //>>excludeEnd("ctx");
  2844. }; }),
  2845. $globals.NativeFunction.a$cls);
  2846. $core.addMethod(
  2847. $core.method({
  2848. selector: "functionNamed:valueWithArgs:",
  2849. protocol: "function calling",
  2850. //>>excludeStart("ide", pragmas.excludeIdeData);
  2851. args: ["aString", "args"],
  2852. 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'>",
  2853. referencedClasses: [],
  2854. //>>excludeEnd("ide");
  2855. pragmas: [["inlineJS:", ["\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  2856. messageSends: []
  2857. }, function ($methodClass){ return function (aString,args){
  2858. var self=this,$self=this;
  2859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2860. return $core.withContext(function($ctx1) {
  2861. //>>excludeEnd("ctx");
  2862. var nativeFunc=$globals.Platform._globals()[aString];
  2863. return Function.prototype.apply.call(nativeFunc, null, args);
  2864. ;
  2865. return self;
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args})});
  2868. //>>excludeEnd("ctx");
  2869. }; }),
  2870. $globals.NativeFunction.a$cls);
  2871. $core.addMethod(
  2872. $core.method({
  2873. selector: "functionOf:",
  2874. protocol: "function calling",
  2875. //>>excludeStart("ide", pragmas.excludeIdeData);
  2876. args: ["nativeFunc"],
  2877. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  2878. referencedClasses: [],
  2879. //>>excludeEnd("ide");
  2880. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc();\x0a\x09"]]],
  2881. messageSends: []
  2882. }, function ($methodClass){ return function (nativeFunc){
  2883. var self=this,$self=this;
  2884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2885. return $core.withContext(function($ctx1) {
  2886. //>>excludeEnd("ctx");
  2887. return nativeFunc();
  2888. ;
  2889. return self;
  2890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2891. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc})});
  2892. //>>excludeEnd("ctx");
  2893. }; }),
  2894. $globals.NativeFunction.a$cls);
  2895. $core.addMethod(
  2896. $core.method({
  2897. selector: "functionOf:value:",
  2898. protocol: "function calling",
  2899. //>>excludeStart("ide", pragmas.excludeIdeData);
  2900. args: ["nativeFunc", "anObject"],
  2901. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  2902. referencedClasses: [],
  2903. //>>excludeEnd("ide");
  2904. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject);\x0a\x09"]]],
  2905. messageSends: []
  2906. }, function ($methodClass){ return function (nativeFunc,anObject){
  2907. var self=this,$self=this;
  2908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2909. return $core.withContext(function($ctx1) {
  2910. //>>excludeEnd("ctx");
  2911. return nativeFunc(anObject);
  2912. ;
  2913. return self;
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject})});
  2916. //>>excludeEnd("ctx");
  2917. }; }),
  2918. $globals.NativeFunction.a$cls);
  2919. $core.addMethod(
  2920. $core.method({
  2921. selector: "functionOf:value:value:",
  2922. protocol: "function calling",
  2923. //>>excludeStart("ide", pragmas.excludeIdeData);
  2924. args: ["nativeFunc", "anObject", "anObject2"],
  2925. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  2926. referencedClasses: [],
  2927. //>>excludeEnd("ide");
  2928. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09"]]],
  2929. messageSends: []
  2930. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2){
  2931. var self=this,$self=this;
  2932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2933. return $core.withContext(function($ctx1) {
  2934. //>>excludeEnd("ctx");
  2935. return nativeFunc(anObject,anObject2);
  2936. ;
  2937. return self;
  2938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2939. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2})});
  2940. //>>excludeEnd("ctx");
  2941. }; }),
  2942. $globals.NativeFunction.a$cls);
  2943. $core.addMethod(
  2944. $core.method({
  2945. selector: "functionOf:value:value:value:",
  2946. protocol: "function calling",
  2947. //>>excludeStart("ide", pragmas.excludeIdeData);
  2948. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  2949. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  2950. referencedClasses: [],
  2951. //>>excludeEnd("ide");
  2952. pragmas: [["inlineJS:", ["\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09"]]],
  2953. messageSends: []
  2954. }, function ($methodClass){ return function (nativeFunc,anObject,anObject2,anObject3){
  2955. var self=this,$self=this;
  2956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2957. return $core.withContext(function($ctx1) {
  2958. //>>excludeEnd("ctx");
  2959. return nativeFunc(anObject,anObject2, anObject3);
  2960. ;
  2961. return self;
  2962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2963. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  2964. //>>excludeEnd("ctx");
  2965. }; }),
  2966. $globals.NativeFunction.a$cls);
  2967. $core.addMethod(
  2968. $core.method({
  2969. selector: "functionOf:valueWithArgs:",
  2970. protocol: "function calling",
  2971. //>>excludeStart("ide", pragmas.excludeIdeData);
  2972. args: ["nativeFunc", "args"],
  2973. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  2974. referencedClasses: [],
  2975. //>>excludeEnd("ide");
  2976. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09"]]],
  2977. messageSends: []
  2978. }, function ($methodClass){ return function (nativeFunc,args){
  2979. var self=this,$self=this;
  2980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2981. return $core.withContext(function($ctx1) {
  2982. //>>excludeEnd("ctx");
  2983. return Function.prototype.apply.call(nativeFunc, null, args);
  2984. ;
  2985. return self;
  2986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2987. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args})});
  2988. //>>excludeEnd("ctx");
  2989. }; }),
  2990. $globals.NativeFunction.a$cls);
  2991. $core.addMethod(
  2992. $core.method({
  2993. selector: "isNativeFunction:",
  2994. protocol: "testing",
  2995. //>>excludeStart("ide", pragmas.excludeIdeData);
  2996. args: ["anObject"],
  2997. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  2998. referencedClasses: [],
  2999. //>>excludeEnd("ide");
  3000. pragmas: [["inlineJS:", ["return typeof anObject === \x22function\x22"]]],
  3001. messageSends: []
  3002. }, function ($methodClass){ return function (anObject){
  3003. var self=this,$self=this;
  3004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3005. return $core.withContext(function($ctx1) {
  3006. //>>excludeEnd("ctx");
  3007. return typeof anObject === "function";
  3008. return self;
  3009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3010. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject})});
  3011. //>>excludeEnd("ctx");
  3012. }; }),
  3013. $globals.NativeFunction.a$cls);
  3014. $core.addMethod(
  3015. $core.method({
  3016. selector: "methodOf:this:",
  3017. protocol: "method calling",
  3018. //>>excludeStart("ide", pragmas.excludeIdeData);
  3019. args: ["nativeFunc", "thisObject"],
  3020. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  3021. referencedClasses: [],
  3022. //>>excludeEnd("ide");
  3023. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09"]]],
  3024. messageSends: []
  3025. }, function ($methodClass){ return function (nativeFunc,thisObject){
  3026. var self=this,$self=this;
  3027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3028. return $core.withContext(function($ctx1) {
  3029. //>>excludeEnd("ctx");
  3030. return Function.prototype.call.call(nativeFunc, thisObject);
  3031. ;
  3032. return self;
  3033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3034. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject})});
  3035. //>>excludeEnd("ctx");
  3036. }; }),
  3037. $globals.NativeFunction.a$cls);
  3038. $core.addMethod(
  3039. $core.method({
  3040. selector: "methodOf:this:value:",
  3041. protocol: "method calling",
  3042. //>>excludeStart("ide", pragmas.excludeIdeData);
  3043. args: ["nativeFunc", "thisObject", "anObject"],
  3044. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  3045. referencedClasses: [],
  3046. //>>excludeEnd("ide");
  3047. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09"]]],
  3048. messageSends: []
  3049. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject){
  3050. var self=this,$self=this;
  3051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3052. return $core.withContext(function($ctx1) {
  3053. //>>excludeEnd("ctx");
  3054. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  3055. ;
  3056. return self;
  3057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3058. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject})});
  3059. //>>excludeEnd("ctx");
  3060. }; }),
  3061. $globals.NativeFunction.a$cls);
  3062. $core.addMethod(
  3063. $core.method({
  3064. selector: "methodOf:this:value:value:",
  3065. protocol: "method calling",
  3066. //>>excludeStart("ide", pragmas.excludeIdeData);
  3067. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  3068. 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'>",
  3069. referencedClasses: [],
  3070. //>>excludeEnd("ide");
  3071. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09"]]],
  3072. messageSends: []
  3073. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2){
  3074. var self=this,$self=this;
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. return $core.withContext(function($ctx1) {
  3077. //>>excludeEnd("ctx");
  3078. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  3079. ;
  3080. return self;
  3081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3082. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2})});
  3083. //>>excludeEnd("ctx");
  3084. }; }),
  3085. $globals.NativeFunction.a$cls);
  3086. $core.addMethod(
  3087. $core.method({
  3088. selector: "methodOf:this:value:value:value:",
  3089. protocol: "method calling",
  3090. //>>excludeStart("ide", pragmas.excludeIdeData);
  3091. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  3092. 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'>",
  3093. referencedClasses: [],
  3094. //>>excludeEnd("ide");
  3095. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09"]]],
  3096. messageSends: []
  3097. }, function ($methodClass){ return function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  3098. var self=this,$self=this;
  3099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3100. return $core.withContext(function($ctx1) {
  3101. //>>excludeEnd("ctx");
  3102. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  3103. ;
  3104. return self;
  3105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3106. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  3107. //>>excludeEnd("ctx");
  3108. }; }),
  3109. $globals.NativeFunction.a$cls);
  3110. $core.addMethod(
  3111. $core.method({
  3112. selector: "methodOf:this:valueWithArgs:",
  3113. protocol: "method calling",
  3114. //>>excludeStart("ide", pragmas.excludeIdeData);
  3115. args: ["nativeFunc", "thisObject", "args"],
  3116. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  3117. referencedClasses: [],
  3118. //>>excludeEnd("ide");
  3119. pragmas: [["inlineJS:", ["\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09"]]],
  3120. messageSends: []
  3121. }, function ($methodClass){ return function (nativeFunc,thisObject,args){
  3122. var self=this,$self=this;
  3123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3124. return $core.withContext(function($ctx1) {
  3125. //>>excludeEnd("ctx");
  3126. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  3127. ;
  3128. return self;
  3129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3130. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args})});
  3131. //>>excludeEnd("ctx");
  3132. }; }),
  3133. $globals.NativeFunction.a$cls);
  3134. $core.addTrait("TMethodContext", "Kernel-Methods");
  3135. $core.addMethod(
  3136. $core.method({
  3137. selector: "asString",
  3138. protocol: "converting",
  3139. //>>excludeStart("ide", pragmas.excludeIdeData);
  3140. args: [],
  3141. 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 ] ]",
  3142. referencedClasses: [],
  3143. //>>excludeEnd("ide");
  3144. pragmas: [],
  3145. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "ifNotNil:ifNil:", "method", "asStringForClass:", "class", "receiver", "symbolPrintString", "selector"]
  3146. }, function ($methodClass){ return function (){
  3147. var self=this,$self=this;
  3148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3149. return $core.withContext(function($ctx1) {
  3150. //>>excludeEnd("ctx");
  3151. var $1;
  3152. if($core.assert($self._isBlockContext())){
  3153. return [$recv(["a block (in ".__comma($recv($self._methodContext())._asString())
  3154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3155. ,$ctx1.sendIdx[","]=2
  3156. //>>excludeEnd("ctx");
  3157. ][0]).__comma(")")
  3158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3159. ,$ctx1.sendIdx[","]=1
  3160. //>>excludeEnd("ctx");
  3161. ][0];
  3162. } else {
  3163. $1=$self._method();
  3164. if($1 == null || $1.a$nil){
  3165. return "missing method ".__comma($recv($self._selector())._symbolPrintString());
  3166. } else {
  3167. var method;
  3168. method=$1;
  3169. return $recv(method)._asStringForClass_($recv($self._receiver())._class());
  3170. }
  3171. }
  3172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3173. }, function($ctx1) {$ctx1.fill(self,"asString",{})});
  3174. //>>excludeEnd("ctx");
  3175. }; }),
  3176. $globals.TMethodContext);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "basicReceiver",
  3180. protocol: "accessing",
  3181. //>>excludeStart("ide", pragmas.excludeIdeData);
  3182. args: [],
  3183. source: "basicReceiver\x0a\x09self subclassResponsibility",
  3184. referencedClasses: [],
  3185. //>>excludeEnd("ide");
  3186. pragmas: [],
  3187. messageSends: ["subclassResponsibility"]
  3188. }, function ($methodClass){ return function (){
  3189. var self=this,$self=this;
  3190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3191. return $core.withContext(function($ctx1) {
  3192. //>>excludeEnd("ctx");
  3193. $self._subclassResponsibility();
  3194. return self;
  3195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3196. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{})});
  3197. //>>excludeEnd("ctx");
  3198. }; }),
  3199. $globals.TMethodContext);
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "findContextSuchThat:",
  3203. protocol: "accessing",
  3204. //>>excludeStart("ide", pragmas.excludeIdeData);
  3205. args: ["testBlock"],
  3206. 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",
  3207. referencedClasses: [],
  3208. //>>excludeEnd("ide");
  3209. pragmas: [],
  3210. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  3211. }, function ($methodClass){ return function (testBlock){
  3212. var self=this,$self=this;
  3213. var context;
  3214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3215. return $core.withContext(function($ctx1) {
  3216. //>>excludeEnd("ctx");
  3217. var $early={};
  3218. try {
  3219. context=self;
  3220. $recv((function(){
  3221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3222. return $core.withContext(function($ctx2) {
  3223. //>>excludeEnd("ctx");
  3224. return $recv(context)._isNil();
  3225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3227. //>>excludeEnd("ctx");
  3228. }))._whileFalse_((function(){
  3229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3230. return $core.withContext(function($ctx2) {
  3231. //>>excludeEnd("ctx");
  3232. if($core.assert($recv(testBlock)._value_(context))){
  3233. throw $early=[context];
  3234. }
  3235. context=$recv(context)._outerContext();
  3236. return context;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3239. //>>excludeEnd("ctx");
  3240. }));
  3241. return nil;
  3242. }
  3243. catch(e) {if(e===$early)return e[0]; throw e}
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context})});
  3246. //>>excludeEnd("ctx");
  3247. }; }),
  3248. $globals.TMethodContext);
  3249. $core.addMethod(
  3250. $core.method({
  3251. selector: "home",
  3252. protocol: "accessing",
  3253. //>>excludeStart("ide", pragmas.excludeIdeData);
  3254. args: [],
  3255. source: "home\x0a\x09self subclassResponsibility",
  3256. referencedClasses: [],
  3257. //>>excludeEnd("ide");
  3258. pragmas: [],
  3259. messageSends: ["subclassResponsibility"]
  3260. }, function ($methodClass){ return function (){
  3261. var self=this,$self=this;
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. return $core.withContext(function($ctx1) {
  3264. //>>excludeEnd("ctx");
  3265. $self._subclassResponsibility();
  3266. return self;
  3267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3268. }, function($ctx1) {$ctx1.fill(self,"home",{})});
  3269. //>>excludeEnd("ctx");
  3270. }; }),
  3271. $globals.TMethodContext);
  3272. $core.addMethod(
  3273. $core.method({
  3274. selector: "index",
  3275. protocol: "accessing",
  3276. //>>excludeStart("ide", pragmas.excludeIdeData);
  3277. args: [],
  3278. source: "index\x0a\x09self subclassResponsibility",
  3279. referencedClasses: [],
  3280. //>>excludeEnd("ide");
  3281. pragmas: [],
  3282. messageSends: ["subclassResponsibility"]
  3283. }, function ($methodClass){ return function (){
  3284. var self=this,$self=this;
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. return $core.withContext(function($ctx1) {
  3287. //>>excludeEnd("ctx");
  3288. $self._subclassResponsibility();
  3289. return self;
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. }, function($ctx1) {$ctx1.fill(self,"index",{})});
  3292. //>>excludeEnd("ctx");
  3293. }; }),
  3294. $globals.TMethodContext);
  3295. $core.addMethod(
  3296. $core.method({
  3297. selector: "isBlockContext",
  3298. protocol: "testing",
  3299. //>>excludeStart("ide", pragmas.excludeIdeData);
  3300. args: [],
  3301. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  3302. referencedClasses: [],
  3303. //>>excludeEnd("ide");
  3304. pragmas: [],
  3305. messageSends: ["isNil", "selector"]
  3306. }, function ($methodClass){ return function (){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. return $recv($self._selector())._isNil();
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{})});
  3314. //>>excludeEnd("ctx");
  3315. }; }),
  3316. $globals.TMethodContext);
  3317. $core.addMethod(
  3318. $core.method({
  3319. selector: "locals",
  3320. protocol: "accessing",
  3321. //>>excludeStart("ide", pragmas.excludeIdeData);
  3322. args: [],
  3323. source: "locals\x0a\x09self subclassResponsibility",
  3324. referencedClasses: [],
  3325. //>>excludeEnd("ide");
  3326. pragmas: [],
  3327. messageSends: ["subclassResponsibility"]
  3328. }, function ($methodClass){ return function (){
  3329. var self=this,$self=this;
  3330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3331. return $core.withContext(function($ctx1) {
  3332. //>>excludeEnd("ctx");
  3333. $self._subclassResponsibility();
  3334. return self;
  3335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3336. }, function($ctx1) {$ctx1.fill(self,"locals",{})});
  3337. //>>excludeEnd("ctx");
  3338. }; }),
  3339. $globals.TMethodContext);
  3340. $core.addMethod(
  3341. $core.method({
  3342. selector: "method",
  3343. protocol: "accessing",
  3344. //>>excludeStart("ide", pragmas.excludeIdeData);
  3345. args: [],
  3346. 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 ]",
  3347. referencedClasses: [],
  3348. //>>excludeEnd("ide");
  3349. pragmas: [],
  3350. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  3351. }, function ($methodClass){ return function (){
  3352. var self=this,$self=this;
  3353. var method,lookupClass,receiverClass,supercall;
  3354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3355. return $core.withContext(function($ctx1) {
  3356. //>>excludeEnd("ctx");
  3357. var $1,$2;
  3358. $1=[$self._methodContext()
  3359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3360. ,$ctx1.sendIdx["methodContext"]=1
  3361. //>>excludeEnd("ctx");
  3362. ][0];
  3363. if($1 == null || $1.a$nil){
  3364. return nil;
  3365. } else {
  3366. $1;
  3367. }
  3368. receiverClass=$recv($recv([$self._methodContext()
  3369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3370. ,$ctx1.sendIdx["methodContext"]=2
  3371. //>>excludeEnd("ctx");
  3372. ][0])._receiver())._class();
  3373. method=[$recv(receiverClass)._lookupSelector_([$recv([$self._methodContext()
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. ,$ctx1.sendIdx["methodContext"]=3
  3376. //>>excludeEnd("ctx");
  3377. ][0])._selector()
  3378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3379. ,$ctx1.sendIdx["selector"]=1
  3380. //>>excludeEnd("ctx");
  3381. ][0])
  3382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3383. ,$ctx1.sendIdx["lookupSelector:"]=1
  3384. //>>excludeEnd("ctx");
  3385. ][0];
  3386. $2=$self._outerContext();
  3387. if($2 == null || $2.a$nil){
  3388. supercall=false;
  3389. } else {
  3390. var outer;
  3391. outer=$2;
  3392. supercall=$recv(outer)._supercall();
  3393. }
  3394. if($core.assert(supercall)){
  3395. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  3396. } else {
  3397. return method;
  3398. }
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall})});
  3401. //>>excludeEnd("ctx");
  3402. }; }),
  3403. $globals.TMethodContext);
  3404. $core.addMethod(
  3405. $core.method({
  3406. selector: "methodContext",
  3407. protocol: "accessing",
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: [],
  3410. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. pragmas: [],
  3414. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  3415. }, function ($methodClass){ return function (){
  3416. var self=this,$self=this;
  3417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3418. return $core.withContext(function($ctx1) {
  3419. //>>excludeEnd("ctx");
  3420. var $1;
  3421. if(!$core.assert($self._isBlockContext())){
  3422. return self;
  3423. }
  3424. $1=$self._outerContext();
  3425. if($1 == null || $1.a$nil){
  3426. return $1;
  3427. } else {
  3428. var outer;
  3429. outer=$1;
  3430. return $recv(outer)._methodContext();
  3431. }
  3432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3433. }, function($ctx1) {$ctx1.fill(self,"methodContext",{})});
  3434. //>>excludeEnd("ctx");
  3435. }; }),
  3436. $globals.TMethodContext);
  3437. $core.addMethod(
  3438. $core.method({
  3439. selector: "outerContext",
  3440. protocol: "accessing",
  3441. //>>excludeStart("ide", pragmas.excludeIdeData);
  3442. args: [],
  3443. source: "outerContext\x0a\x09self subclassResponsibility",
  3444. referencedClasses: [],
  3445. //>>excludeEnd("ide");
  3446. pragmas: [],
  3447. messageSends: ["subclassResponsibility"]
  3448. }, function ($methodClass){ return function (){
  3449. var self=this,$self=this;
  3450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3451. return $core.withContext(function($ctx1) {
  3452. //>>excludeEnd("ctx");
  3453. $self._subclassResponsibility();
  3454. return self;
  3455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3456. }, function($ctx1) {$ctx1.fill(self,"outerContext",{})});
  3457. //>>excludeEnd("ctx");
  3458. }; }),
  3459. $globals.TMethodContext);
  3460. $core.addMethod(
  3461. $core.method({
  3462. selector: "printOn:",
  3463. protocol: "printing",
  3464. //>>excludeStart("ide", pragmas.excludeIdeData);
  3465. args: ["aStream"],
  3466. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  3467. referencedClasses: [],
  3468. //>>excludeEnd("ide");
  3469. pragmas: [],
  3470. messageSends: ["printOn:", "nextPutAll:", "asString"]
  3471. }, function ($methodClass){ return function (aStream){
  3472. var self=this,$self=this;
  3473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3474. return $core.withContext(function($ctx1) {
  3475. //>>excludeEnd("ctx");
  3476. [(
  3477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3478. $ctx1.supercall = true,
  3479. //>>excludeEnd("ctx");
  3480. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  3481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3482. ,$ctx1.supercall = false
  3483. //>>excludeEnd("ctx");
  3484. ][0];
  3485. [$recv(aStream)._nextPutAll_("(")
  3486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3487. ,$ctx1.sendIdx["nextPutAll:"]=1
  3488. //>>excludeEnd("ctx");
  3489. ][0];
  3490. [$recv(aStream)._nextPutAll_($self._asString())
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. ,$ctx1.sendIdx["nextPutAll:"]=2
  3493. //>>excludeEnd("ctx");
  3494. ][0];
  3495. $recv(aStream)._nextPutAll_(")");
  3496. return self;
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  3499. //>>excludeEnd("ctx");
  3500. }; }),
  3501. $globals.TMethodContext);
  3502. $core.addMethod(
  3503. $core.method({
  3504. selector: "receiver",
  3505. protocol: "accessing",
  3506. //>>excludeStart("ide", pragmas.excludeIdeData);
  3507. args: [],
  3508. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  3509. referencedClasses: [],
  3510. //>>excludeEnd("ide");
  3511. pragmas: [],
  3512. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  3513. }, function ($methodClass){ return function (){
  3514. var self=this,$self=this;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx1) {
  3517. //>>excludeEnd("ctx");
  3518. var $1;
  3519. if($core.assert($self._isBlockContext())){
  3520. $1=$recv([$self._outerContext()
  3521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3522. ,$ctx1.sendIdx["outerContext"]=1
  3523. //>>excludeEnd("ctx");
  3524. ][0])._notNil();
  3525. } else {
  3526. $1=false;
  3527. }
  3528. if($core.assert($1)){
  3529. return $recv($self._outerContext())._receiver();
  3530. } else {
  3531. return $self._basicReceiver();
  3532. }
  3533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3534. }, function($ctx1) {$ctx1.fill(self,"receiver",{})});
  3535. //>>excludeEnd("ctx");
  3536. }; }),
  3537. $globals.TMethodContext);
  3538. $core.addMethod(
  3539. $core.method({
  3540. selector: "selector",
  3541. protocol: "accessing",
  3542. //>>excludeStart("ide", pragmas.excludeIdeData);
  3543. args: [],
  3544. source: "selector\x0a\x09self subclassResponsibility",
  3545. referencedClasses: [],
  3546. //>>excludeEnd("ide");
  3547. pragmas: [],
  3548. messageSends: ["subclassResponsibility"]
  3549. }, function ($methodClass){ return function (){
  3550. var self=this,$self=this;
  3551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3552. return $core.withContext(function($ctx1) {
  3553. //>>excludeEnd("ctx");
  3554. $self._subclassResponsibility();
  3555. return self;
  3556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3557. }, function($ctx1) {$ctx1.fill(self,"selector",{})});
  3558. //>>excludeEnd("ctx");
  3559. }; }),
  3560. $globals.TMethodContext);
  3561. $core.addMethod(
  3562. $core.method({
  3563. selector: "sendIndexes",
  3564. protocol: "accessing",
  3565. //>>excludeStart("ide", pragmas.excludeIdeData);
  3566. args: [],
  3567. source: "sendIndexes\x0a\x09self subclassResponsibility",
  3568. referencedClasses: [],
  3569. //>>excludeEnd("ide");
  3570. pragmas: [],
  3571. messageSends: ["subclassResponsibility"]
  3572. }, function ($methodClass){ return function (){
  3573. var self=this,$self=this;
  3574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3575. return $core.withContext(function($ctx1) {
  3576. //>>excludeEnd("ctx");
  3577. $self._subclassResponsibility();
  3578. return self;
  3579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3580. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{})});
  3581. //>>excludeEnd("ctx");
  3582. }; }),
  3583. $globals.TMethodContext);
  3584. $core.addMethod(
  3585. $core.method({
  3586. selector: "supercall",
  3587. protocol: "accessing",
  3588. //>>excludeStart("ide", pragmas.excludeIdeData);
  3589. args: [],
  3590. source: "supercall\x0a\x09self subclassResponsibility",
  3591. referencedClasses: [],
  3592. //>>excludeEnd("ide");
  3593. pragmas: [],
  3594. messageSends: ["subclassResponsibility"]
  3595. }, function ($methodClass){ return function (){
  3596. var self=this,$self=this;
  3597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3598. return $core.withContext(function($ctx1) {
  3599. //>>excludeEnd("ctx");
  3600. $self._subclassResponsibility();
  3601. return self;
  3602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3603. }, function($ctx1) {$ctx1.fill(self,"supercall",{})});
  3604. //>>excludeEnd("ctx");
  3605. }; }),
  3606. $globals.TMethodContext);
  3607. $core.addClass("Timeout", $globals.Object, "Kernel-Methods");
  3608. $core.setSlots($globals.Timeout, ["rawTimeout"]);
  3609. //>>excludeStart("ide", pragmas.excludeIdeData);
  3610. $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.";
  3611. //>>excludeEnd("ide");
  3612. $core.addMethod(
  3613. $core.method({
  3614. selector: "clearInterval",
  3615. protocol: "timeout/interval",
  3616. //>>excludeStart("ide", pragmas.excludeIdeData);
  3617. args: [],
  3618. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  3619. referencedClasses: [],
  3620. //>>excludeEnd("ide");
  3621. pragmas: [["inlineJS:", ["\x0a\x09\x09var interval = $self.rawTimeout;\x0a\x09\x09clearInterval(interval);\x0a\x09"]]],
  3622. messageSends: []
  3623. }, function ($methodClass){ return function (){
  3624. var self=this,$self=this;
  3625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3626. return $core.withContext(function($ctx1) {
  3627. //>>excludeEnd("ctx");
  3628. var interval = $self.rawTimeout;
  3629. clearInterval(interval);
  3630. ;
  3631. return self;
  3632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3633. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{})});
  3634. //>>excludeEnd("ctx");
  3635. }; }),
  3636. $globals.Timeout);
  3637. $core.addMethod(
  3638. $core.method({
  3639. selector: "clearTimeout",
  3640. protocol: "timeout/interval",
  3641. //>>excludeStart("ide", pragmas.excludeIdeData);
  3642. args: [],
  3643. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  3644. referencedClasses: [],
  3645. //>>excludeEnd("ide");
  3646. pragmas: [["inlineJS:", ["\x0a\x09\x09var timeout = $self.rawTimeout;\x0a\x09\x09clearTimeout(timeout);\x0a\x09"]]],
  3647. messageSends: []
  3648. }, function ($methodClass){ return function (){
  3649. var self=this,$self=this;
  3650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3651. return $core.withContext(function($ctx1) {
  3652. //>>excludeEnd("ctx");
  3653. var timeout = $self.rawTimeout;
  3654. clearTimeout(timeout);
  3655. ;
  3656. return self;
  3657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3658. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{})});
  3659. //>>excludeEnd("ctx");
  3660. }; }),
  3661. $globals.Timeout);
  3662. $core.addMethod(
  3663. $core.method({
  3664. selector: "rawTimeout:",
  3665. protocol: "accessing",
  3666. //>>excludeStart("ide", pragmas.excludeIdeData);
  3667. args: ["anObject"],
  3668. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  3669. referencedClasses: [],
  3670. //>>excludeEnd("ide");
  3671. pragmas: [],
  3672. messageSends: []
  3673. }, function ($methodClass){ return function (anObject){
  3674. var self=this,$self=this;
  3675. $self.rawTimeout=anObject;
  3676. return self;
  3677. }; }),
  3678. $globals.Timeout);
  3679. $core.addMethod(
  3680. $core.method({
  3681. selector: "on:",
  3682. protocol: "instance creation",
  3683. //>>excludeStart("ide", pragmas.excludeIdeData);
  3684. args: ["anObject"],
  3685. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  3686. referencedClasses: [],
  3687. //>>excludeEnd("ide");
  3688. pragmas: [],
  3689. messageSends: ["rawTimeout:", "new", "yourself"]
  3690. }, function ($methodClass){ return function (anObject){
  3691. var self=this,$self=this;
  3692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3693. return $core.withContext(function($ctx1) {
  3694. //>>excludeEnd("ctx");
  3695. var $1;
  3696. $1=$self._new();
  3697. $recv($1)._rawTimeout_(anObject);
  3698. return $recv($1)._yourself();
  3699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3700. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject})});
  3701. //>>excludeEnd("ctx");
  3702. }; }),
  3703. $globals.Timeout.a$cls);
  3704. $core.setTraitComposition([{trait: $globals.TMethodContext}], $globals.MethodContext);
  3705. });