1
0

Kernel-Methods.js 116 KB

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