Kernel-Methods.js 115 KB

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