Kernel-Methods.js 119 KB

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