Kernel-Methods.js 111 KB

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