Kernel-Methods.js 113 KB

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