Kernel-Methods.js 115 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515
  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. $globals.ForkPool.a$cls.iVarNames = ["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: "asString",
  1976. protocol: "converting",
  1977. fn: function (){
  1978. var self=this,$self=this;
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. return $core.withContext(function($ctx1) {
  1981. //>>excludeEnd("ctx");
  1982. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  1983. $2=$self._isBlockContext();
  1984. if($core.assert($2)){
  1985. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. $ctx1.sendIdx[","]=2;
  1988. //>>excludeEnd("ctx");
  1989. $1=$recv($3).__comma(")");
  1990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1991. $ctx1.sendIdx[","]=1;
  1992. //>>excludeEnd("ctx");
  1993. } else {
  1994. var methodClass;
  1995. methodClass=$recv($self._method())._methodClass();
  1996. $5=methodClass;
  1997. $7=$self._receiver();
  1998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1999. $ctx1.sendIdx["receiver"]=1;
  2000. //>>excludeEnd("ctx");
  2001. $6=$recv($7)._class();
  2002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2003. $ctx1.sendIdx["class"]=1;
  2004. //>>excludeEnd("ctx");
  2005. $4=$recv($5).__eq($6);
  2006. if($core.assert($4)){
  2007. $11=$self._receiver();
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. $ctx1.sendIdx["receiver"]=2;
  2010. //>>excludeEnd("ctx");
  2011. $10=$recv($11)._class();
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. $ctx1.sendIdx["class"]=2;
  2014. //>>excludeEnd("ctx");
  2015. $9=$recv($10)._name();
  2016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2017. $ctx1.sendIdx["name"]=1;
  2018. //>>excludeEnd("ctx");
  2019. $8=$recv($9).__comma(" >> ");
  2020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2021. $ctx1.sendIdx[","]=4;
  2022. //>>excludeEnd("ctx");
  2023. $12=$self._selector();
  2024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2025. $ctx1.sendIdx["selector"]=1;
  2026. //>>excludeEnd("ctx");
  2027. $1=$recv($8).__comma($12);
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. $ctx1.sendIdx[","]=3;
  2030. //>>excludeEnd("ctx");
  2031. } else {
  2032. $16=$recv($recv($self._receiver())._class())._name();
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. $ctx1.sendIdx["name"]=2;
  2035. //>>excludeEnd("ctx");
  2036. $15=$recv($16).__comma("(");
  2037. $14=$recv($15).__comma($recv(methodClass)._name());
  2038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2039. $ctx1.sendIdx[","]=7;
  2040. //>>excludeEnd("ctx");
  2041. $13=$recv($14).__comma(") >> ");
  2042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2043. $ctx1.sendIdx[","]=6;
  2044. //>>excludeEnd("ctx");
  2045. $1=$recv($13).__comma($self._selector());
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. $ctx1.sendIdx[","]=5;
  2048. //>>excludeEnd("ctx");
  2049. }
  2050. }
  2051. return $1;
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  2054. //>>excludeEnd("ctx");
  2055. },
  2056. //>>excludeStart("ide", pragmas.excludeIdeData);
  2057. args: [],
  2058. 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 ] ]",
  2059. referencedClasses: [],
  2060. //>>excludeEnd("ide");
  2061. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  2062. }),
  2063. $globals.MethodContext);
  2064. $core.addMethod(
  2065. $core.method({
  2066. selector: "basicReceiver",
  2067. protocol: "accessing",
  2068. fn: function (){
  2069. var self=this,$self=this;
  2070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2071. return $core.withContext(function($ctx1) {
  2072. //>>excludeEnd("ctx");
  2073. return self.receiver;
  2074. return self;
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  2077. //>>excludeEnd("ctx");
  2078. },
  2079. //>>excludeStart("ide", pragmas.excludeIdeData);
  2080. args: [],
  2081. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  2082. referencedClasses: [],
  2083. //>>excludeEnd("ide");
  2084. messageSends: []
  2085. }),
  2086. $globals.MethodContext);
  2087. $core.addMethod(
  2088. $core.method({
  2089. selector: "evaluatedSelector",
  2090. protocol: "accessing",
  2091. fn: function (){
  2092. var self=this,$self=this;
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. return $core.withContext(function($ctx1) {
  2095. //>>excludeEnd("ctx");
  2096. return self.evaluatedSelector;
  2097. return self;
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  2100. //>>excludeEnd("ctx");
  2101. },
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: [],
  2104. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. messageSends: []
  2108. }),
  2109. $globals.MethodContext);
  2110. $core.addMethod(
  2111. $core.method({
  2112. selector: "findContextSuchThat:",
  2113. protocol: "accessing",
  2114. fn: function (testBlock){
  2115. var self=this,$self=this;
  2116. var context;
  2117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2118. return $core.withContext(function($ctx1) {
  2119. //>>excludeEnd("ctx");
  2120. var $1;
  2121. var $early={};
  2122. try {
  2123. context=self;
  2124. $recv((function(){
  2125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2126. return $core.withContext(function($ctx2) {
  2127. //>>excludeEnd("ctx");
  2128. return $recv(context)._isNil();
  2129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2131. //>>excludeEnd("ctx");
  2132. }))._whileFalse_((function(){
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. return $core.withContext(function($ctx2) {
  2135. //>>excludeEnd("ctx");
  2136. $1=$recv(testBlock)._value_(context);
  2137. if($core.assert($1)){
  2138. throw $early=[context];
  2139. }
  2140. context=$recv(context)._outerContext();
  2141. return context;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2144. //>>excludeEnd("ctx");
  2145. }));
  2146. return nil;
  2147. }
  2148. catch(e) {if(e===$early)return e[0]; throw e}
  2149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2150. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  2151. //>>excludeEnd("ctx");
  2152. },
  2153. //>>excludeStart("ide", pragmas.excludeIdeData);
  2154. args: ["testBlock"],
  2155. 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",
  2156. referencedClasses: [],
  2157. //>>excludeEnd("ide");
  2158. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  2159. }),
  2160. $globals.MethodContext);
  2161. $core.addMethod(
  2162. $core.method({
  2163. selector: "home",
  2164. protocol: "accessing",
  2165. fn: function (){
  2166. var self=this,$self=this;
  2167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2168. return $core.withContext(function($ctx1) {
  2169. //>>excludeEnd("ctx");
  2170. return self.homeContext;
  2171. return self;
  2172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2173. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  2174. //>>excludeEnd("ctx");
  2175. },
  2176. //>>excludeStart("ide", pragmas.excludeIdeData);
  2177. args: [],
  2178. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  2179. referencedClasses: [],
  2180. //>>excludeEnd("ide");
  2181. messageSends: []
  2182. }),
  2183. $globals.MethodContext);
  2184. $core.addMethod(
  2185. $core.method({
  2186. selector: "index",
  2187. protocol: "accessing",
  2188. fn: function (){
  2189. var self=this,$self=this;
  2190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2191. return $core.withContext(function($ctx1) {
  2192. //>>excludeEnd("ctx");
  2193. return self.index || 0;
  2194. return self;
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  2197. //>>excludeEnd("ctx");
  2198. },
  2199. //>>excludeStart("ide", pragmas.excludeIdeData);
  2200. args: [],
  2201. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  2202. referencedClasses: [],
  2203. //>>excludeEnd("ide");
  2204. messageSends: []
  2205. }),
  2206. $globals.MethodContext);
  2207. $core.addMethod(
  2208. $core.method({
  2209. selector: "isBlockContext",
  2210. protocol: "testing",
  2211. fn: function (){
  2212. var self=this,$self=this;
  2213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2214. return $core.withContext(function($ctx1) {
  2215. //>>excludeEnd("ctx");
  2216. return $recv($self._selector())._isNil();
  2217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2218. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  2219. //>>excludeEnd("ctx");
  2220. },
  2221. //>>excludeStart("ide", pragmas.excludeIdeData);
  2222. args: [],
  2223. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  2224. referencedClasses: [],
  2225. //>>excludeEnd("ide");
  2226. messageSends: ["isNil", "selector"]
  2227. }),
  2228. $globals.MethodContext);
  2229. $core.addMethod(
  2230. $core.method({
  2231. selector: "locals",
  2232. protocol: "accessing",
  2233. fn: function (){
  2234. var self=this,$self=this;
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. return $core.withContext(function($ctx1) {
  2237. //>>excludeEnd("ctx");
  2238. return self.locals || {};
  2239. return self;
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  2242. //>>excludeEnd("ctx");
  2243. },
  2244. //>>excludeStart("ide", pragmas.excludeIdeData);
  2245. args: [],
  2246. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  2247. referencedClasses: [],
  2248. //>>excludeEnd("ide");
  2249. messageSends: []
  2250. }),
  2251. $globals.MethodContext);
  2252. $core.addMethod(
  2253. $core.method({
  2254. selector: "method",
  2255. protocol: "accessing",
  2256. fn: function (){
  2257. var self=this,$self=this;
  2258. var method,lookupClass,receiverClass,supercall;
  2259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2260. return $core.withContext(function($ctx1) {
  2261. //>>excludeEnd("ctx");
  2262. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  2263. $1=$self._methodContext();
  2264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2265. $ctx1.sendIdx["methodContext"]=1;
  2266. //>>excludeEnd("ctx");
  2267. if(($receiver = $1) == null || $receiver.a$nil){
  2268. return nil;
  2269. } else {
  2270. $1;
  2271. }
  2272. $3=$self._methodContext();
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. $ctx1.sendIdx["methodContext"]=2;
  2275. //>>excludeEnd("ctx");
  2276. $2=$recv($3)._receiver();
  2277. receiverClass=$recv($2)._class();
  2278. $4=receiverClass;
  2279. $6=$self._methodContext();
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. $ctx1.sendIdx["methodContext"]=3;
  2282. //>>excludeEnd("ctx");
  2283. $5=$recv($6)._selector();
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. $ctx1.sendIdx["selector"]=1;
  2286. //>>excludeEnd("ctx");
  2287. method=$recv($4)._lookupSelector_($5);
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. $ctx1.sendIdx["lookupSelector:"]=1;
  2290. //>>excludeEnd("ctx");
  2291. $7=$self._outerContext();
  2292. if(($receiver = $7) == null || $receiver.a$nil){
  2293. supercall=false;
  2294. } else {
  2295. var outer;
  2296. outer=$receiver;
  2297. supercall=$recv(outer)._supercall();
  2298. }
  2299. $8=supercall;
  2300. if($core.assert($8)){
  2301. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  2302. } else {
  2303. return method;
  2304. }
  2305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2306. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  2307. //>>excludeEnd("ctx");
  2308. },
  2309. //>>excludeStart("ide", pragmas.excludeIdeData);
  2310. args: [],
  2311. 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 ]",
  2312. referencedClasses: [],
  2313. //>>excludeEnd("ide");
  2314. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  2315. }),
  2316. $globals.MethodContext);
  2317. $core.addMethod(
  2318. $core.method({
  2319. selector: "methodContext",
  2320. protocol: "accessing",
  2321. fn: function (){
  2322. var self=this,$self=this;
  2323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2324. return $core.withContext(function($ctx1) {
  2325. //>>excludeEnd("ctx");
  2326. var $1,$2,$receiver;
  2327. $1=$self._isBlockContext();
  2328. if(!$core.assert($1)){
  2329. return self;
  2330. }
  2331. $2=$self._outerContext();
  2332. if(($receiver = $2) == null || $receiver.a$nil){
  2333. return $2;
  2334. } else {
  2335. var outer;
  2336. outer=$receiver;
  2337. return $recv(outer)._methodContext();
  2338. }
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  2341. //>>excludeEnd("ctx");
  2342. },
  2343. //>>excludeStart("ide", pragmas.excludeIdeData);
  2344. args: [],
  2345. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  2346. referencedClasses: [],
  2347. //>>excludeEnd("ide");
  2348. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  2349. }),
  2350. $globals.MethodContext);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "outerContext",
  2354. protocol: "accessing",
  2355. fn: function (){
  2356. var self=this,$self=this;
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. return $core.withContext(function($ctx1) {
  2359. //>>excludeEnd("ctx");
  2360. return self.outerContext || self.homeContext;
  2361. return self;
  2362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2363. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  2364. //>>excludeEnd("ctx");
  2365. },
  2366. //>>excludeStart("ide", pragmas.excludeIdeData);
  2367. args: [],
  2368. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  2369. referencedClasses: [],
  2370. //>>excludeEnd("ide");
  2371. messageSends: []
  2372. }),
  2373. $globals.MethodContext);
  2374. $core.addMethod(
  2375. $core.method({
  2376. selector: "printOn:",
  2377. protocol: "printing",
  2378. fn: function (aStream){
  2379. var self=this,$self=this;
  2380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2381. return $core.withContext(function($ctx1) {
  2382. //>>excludeEnd("ctx");
  2383. (
  2384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2385. $ctx1.supercall = true,
  2386. //>>excludeEnd("ctx");
  2387. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2389. $ctx1.supercall = false;
  2390. //>>excludeEnd("ctx");;
  2391. $recv(aStream)._nextPutAll_("(");
  2392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2393. $ctx1.sendIdx["nextPutAll:"]=1;
  2394. //>>excludeEnd("ctx");
  2395. $recv(aStream)._nextPutAll_($self._asString());
  2396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2397. $ctx1.sendIdx["nextPutAll:"]=2;
  2398. //>>excludeEnd("ctx");
  2399. $recv(aStream)._nextPutAll_(")");
  2400. return self;
  2401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2402. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  2403. //>>excludeEnd("ctx");
  2404. },
  2405. //>>excludeStart("ide", pragmas.excludeIdeData);
  2406. args: ["aStream"],
  2407. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  2408. referencedClasses: [],
  2409. //>>excludeEnd("ide");
  2410. messageSends: ["printOn:", "nextPutAll:", "asString"]
  2411. }),
  2412. $globals.MethodContext);
  2413. $core.addMethod(
  2414. $core.method({
  2415. selector: "receiver",
  2416. protocol: "accessing",
  2417. fn: function (){
  2418. var self=this,$self=this;
  2419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2420. return $core.withContext(function($ctx1) {
  2421. //>>excludeEnd("ctx");
  2422. var $2,$1;
  2423. $1=$recv($self._isBlockContext())._and_((function(){
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. return $core.withContext(function($ctx2) {
  2426. //>>excludeEnd("ctx");
  2427. $2=$self._outerContext();
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. $ctx2.sendIdx["outerContext"]=1;
  2430. //>>excludeEnd("ctx");
  2431. return $recv($2)._notNil();
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2434. //>>excludeEnd("ctx");
  2435. }));
  2436. if($core.assert($1)){
  2437. return $recv($self._outerContext())._receiver();
  2438. } else {
  2439. return $self._basicReceiver();
  2440. }
  2441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2442. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  2443. //>>excludeEnd("ctx");
  2444. },
  2445. //>>excludeStart("ide", pragmas.excludeIdeData);
  2446. args: [],
  2447. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  2448. referencedClasses: [],
  2449. //>>excludeEnd("ide");
  2450. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  2451. }),
  2452. $globals.MethodContext);
  2453. $core.addMethod(
  2454. $core.method({
  2455. selector: "selector",
  2456. protocol: "accessing",
  2457. fn: function (){
  2458. var self=this,$self=this;
  2459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2460. return $core.withContext(function($ctx1) {
  2461. //>>excludeEnd("ctx");
  2462. if(self.selector) {
  2463. return $core.js2st(self.selector);
  2464. } else {
  2465. return nil;
  2466. }
  2467. ;
  2468. return self;
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  2471. //>>excludeEnd("ctx");
  2472. },
  2473. //>>excludeStart("ide", pragmas.excludeIdeData);
  2474. args: [],
  2475. 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'>",
  2476. referencedClasses: [],
  2477. //>>excludeEnd("ide");
  2478. messageSends: []
  2479. }),
  2480. $globals.MethodContext);
  2481. $core.addMethod(
  2482. $core.method({
  2483. selector: "sendIndexAt:",
  2484. protocol: "accessing",
  2485. fn: function (aSelector){
  2486. var self=this,$self=this;
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. return $core.withContext(function($ctx1) {
  2489. //>>excludeEnd("ctx");
  2490. return self.sendIdx[aSelector] || 0;
  2491. return self;
  2492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2493. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  2494. //>>excludeEnd("ctx");
  2495. },
  2496. //>>excludeStart("ide", pragmas.excludeIdeData);
  2497. args: ["aSelector"],
  2498. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  2499. referencedClasses: [],
  2500. //>>excludeEnd("ide");
  2501. messageSends: []
  2502. }),
  2503. $globals.MethodContext);
  2504. $core.addMethod(
  2505. $core.method({
  2506. selector: "sendIndexes",
  2507. protocol: "accessing",
  2508. fn: function (){
  2509. var self=this,$self=this;
  2510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2511. return $core.withContext(function($ctx1) {
  2512. //>>excludeEnd("ctx");
  2513. return self.sendIdx;
  2514. return self;
  2515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2516. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  2517. //>>excludeEnd("ctx");
  2518. },
  2519. //>>excludeStart("ide", pragmas.excludeIdeData);
  2520. args: [],
  2521. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  2522. referencedClasses: [],
  2523. //>>excludeEnd("ide");
  2524. messageSends: []
  2525. }),
  2526. $globals.MethodContext);
  2527. $core.addMethod(
  2528. $core.method({
  2529. selector: "stubHere",
  2530. protocol: "accessing",
  2531. fn: function (){
  2532. var self=this,$self=this;
  2533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2534. return $core.withContext(function($ctx1) {
  2535. //>>excludeEnd("ctx");
  2536. self.homeContext = undefined;
  2537. return self;
  2538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2539. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  2540. //>>excludeEnd("ctx");
  2541. },
  2542. //>>excludeStart("ide", pragmas.excludeIdeData);
  2543. args: [],
  2544. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  2545. referencedClasses: [],
  2546. //>>excludeEnd("ide");
  2547. messageSends: []
  2548. }),
  2549. $globals.MethodContext);
  2550. $core.addMethod(
  2551. $core.method({
  2552. selector: "stubToAtMost:",
  2553. protocol: "error handling",
  2554. fn: function (anInteger){
  2555. var self=this,$self=this;
  2556. var context;
  2557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2558. return $core.withContext(function($ctx1) {
  2559. //>>excludeEnd("ctx");
  2560. var $1,$2,$receiver;
  2561. context=self;
  2562. $recv(anInteger)._timesRepeat_((function(){
  2563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2564. return $core.withContext(function($ctx2) {
  2565. //>>excludeEnd("ctx");
  2566. $1=context;
  2567. if(($receiver = $1) == null || $receiver.a$nil){
  2568. context=$1;
  2569. } else {
  2570. context=$recv(context)._home();
  2571. }
  2572. return context;
  2573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2575. //>>excludeEnd("ctx");
  2576. }));
  2577. $2=context;
  2578. if(($receiver = $2) == null || $receiver.a$nil){
  2579. $2;
  2580. } else {
  2581. $recv(context)._stubHere();
  2582. }
  2583. return self;
  2584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2585. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  2586. //>>excludeEnd("ctx");
  2587. },
  2588. //>>excludeStart("ide", pragmas.excludeIdeData);
  2589. args: ["anInteger"],
  2590. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  2591. referencedClasses: [],
  2592. //>>excludeEnd("ide");
  2593. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  2594. }),
  2595. $globals.MethodContext);
  2596. $core.addMethod(
  2597. $core.method({
  2598. selector: "supercall",
  2599. protocol: "accessing",
  2600. fn: function (){
  2601. var self=this,$self=this;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. return self.supercall == true;
  2606. return self;
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  2609. //>>excludeEnd("ctx");
  2610. },
  2611. //>>excludeStart("ide", pragmas.excludeIdeData);
  2612. args: [],
  2613. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  2614. referencedClasses: [],
  2615. //>>excludeEnd("ide");
  2616. messageSends: []
  2617. }),
  2618. $globals.MethodContext);
  2619. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  2620. //>>excludeStart("ide", pragmas.excludeIdeData);
  2621. $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' ]";
  2622. //>>excludeEnd("ide");
  2623. $core.addMethod(
  2624. $core.method({
  2625. selector: "constructorNamed:",
  2626. protocol: "instance creation",
  2627. fn: function (aString){
  2628. var self=this,$self=this;
  2629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2630. return $core.withContext(function($ctx1) {
  2631. //>>excludeEnd("ctx");
  2632. var nativeFunc=$globals.Platform._globals()[aString];
  2633. return new nativeFunc();
  2634. ;
  2635. return self;
  2636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2637. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  2638. //>>excludeEnd("ctx");
  2639. },
  2640. //>>excludeStart("ide", pragmas.excludeIdeData);
  2641. args: ["aString"],
  2642. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  2643. referencedClasses: [],
  2644. //>>excludeEnd("ide");
  2645. messageSends: []
  2646. }),
  2647. $globals.NativeFunction.a$cls);
  2648. $core.addMethod(
  2649. $core.method({
  2650. selector: "constructorNamed:value:",
  2651. protocol: "instance creation",
  2652. fn: function (aString,anObject){
  2653. var self=this,$self=this;
  2654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2655. return $core.withContext(function($ctx1) {
  2656. //>>excludeEnd("ctx");
  2657. var nativeFunc=$globals.Platform._globals()[aString];
  2658. return new nativeFunc(anObject);
  2659. ;
  2660. return self;
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  2663. //>>excludeEnd("ctx");
  2664. },
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: ["aString", "anObject"],
  2667. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. messageSends: []
  2671. }),
  2672. $globals.NativeFunction.a$cls);
  2673. $core.addMethod(
  2674. $core.method({
  2675. selector: "constructorNamed:value:value:",
  2676. protocol: "instance creation",
  2677. fn: function (aString,anObject,anObject2){
  2678. var self=this,$self=this;
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. return $core.withContext(function($ctx1) {
  2681. //>>excludeEnd("ctx");
  2682. var nativeFunc=$globals.Platform._globals[aString];
  2683. return new nativeFunc(anObject,anObject2);
  2684. ;
  2685. return self;
  2686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2687. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  2688. //>>excludeEnd("ctx");
  2689. },
  2690. //>>excludeStart("ide", pragmas.excludeIdeData);
  2691. args: ["aString", "anObject", "anObject2"],
  2692. 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'>",
  2693. referencedClasses: [],
  2694. //>>excludeEnd("ide");
  2695. messageSends: []
  2696. }),
  2697. $globals.NativeFunction.a$cls);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "constructorNamed:value:value:value:",
  2701. protocol: "instance creation",
  2702. fn: function (aString,anObject,anObject2,anObject3){
  2703. var self=this,$self=this;
  2704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2705. return $core.withContext(function($ctx1) {
  2706. //>>excludeEnd("ctx");
  2707. var nativeFunc=$globals.Platform._globals[aString];
  2708. return new nativeFunc(anObject,anObject2, anObject3);
  2709. ;
  2710. return self;
  2711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2712. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  2713. //>>excludeEnd("ctx");
  2714. },
  2715. //>>excludeStart("ide", pragmas.excludeIdeData);
  2716. args: ["aString", "anObject", "anObject2", "anObject3"],
  2717. 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'>",
  2718. referencedClasses: [],
  2719. //>>excludeEnd("ide");
  2720. messageSends: []
  2721. }),
  2722. $globals.NativeFunction.a$cls);
  2723. $core.addMethod(
  2724. $core.method({
  2725. selector: "constructorOf:",
  2726. protocol: "instance creation",
  2727. fn: function (nativeFunc){
  2728. var self=this,$self=this;
  2729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2730. return $core.withContext(function($ctx1) {
  2731. //>>excludeEnd("ctx");
  2732. return new nativeFunc();
  2733. ;
  2734. return self;
  2735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2736. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  2737. //>>excludeEnd("ctx");
  2738. },
  2739. //>>excludeStart("ide", pragmas.excludeIdeData);
  2740. args: ["nativeFunc"],
  2741. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  2742. referencedClasses: [],
  2743. //>>excludeEnd("ide");
  2744. messageSends: []
  2745. }),
  2746. $globals.NativeFunction.a$cls);
  2747. $core.addMethod(
  2748. $core.method({
  2749. selector: "constructorOf:value:",
  2750. protocol: "instance creation",
  2751. fn: function (nativeFunc,anObject){
  2752. var self=this,$self=this;
  2753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2754. return $core.withContext(function($ctx1) {
  2755. //>>excludeEnd("ctx");
  2756. return new nativeFunc(anObject);
  2757. ;
  2758. return self;
  2759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2760. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  2761. //>>excludeEnd("ctx");
  2762. },
  2763. //>>excludeStart("ide", pragmas.excludeIdeData);
  2764. args: ["nativeFunc", "anObject"],
  2765. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  2766. referencedClasses: [],
  2767. //>>excludeEnd("ide");
  2768. messageSends: []
  2769. }),
  2770. $globals.NativeFunction.a$cls);
  2771. $core.addMethod(
  2772. $core.method({
  2773. selector: "constructorOf:value:value:",
  2774. protocol: "instance creation",
  2775. fn: function (nativeFunc,anObject,anObject2){
  2776. var self=this,$self=this;
  2777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2778. return $core.withContext(function($ctx1) {
  2779. //>>excludeEnd("ctx");
  2780. return new nativeFunc(anObject,anObject2);
  2781. ;
  2782. return self;
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  2785. //>>excludeEnd("ctx");
  2786. },
  2787. //>>excludeStart("ide", pragmas.excludeIdeData);
  2788. args: ["nativeFunc", "anObject", "anObject2"],
  2789. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  2790. referencedClasses: [],
  2791. //>>excludeEnd("ide");
  2792. messageSends: []
  2793. }),
  2794. $globals.NativeFunction.a$cls);
  2795. $core.addMethod(
  2796. $core.method({
  2797. selector: "constructorOf:value:value:value:",
  2798. protocol: "instance creation",
  2799. fn: function (nativeFunc,anObject,anObject2,anObject3){
  2800. var self=this,$self=this;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. return $core.withContext(function($ctx1) {
  2803. //>>excludeEnd("ctx");
  2804. return new nativeFunc(anObject,anObject2, anObject3);
  2805. ;
  2806. return self;
  2807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2808. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  2809. //>>excludeEnd("ctx");
  2810. },
  2811. //>>excludeStart("ide", pragmas.excludeIdeData);
  2812. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  2813. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  2814. referencedClasses: [],
  2815. //>>excludeEnd("ide");
  2816. messageSends: []
  2817. }),
  2818. $globals.NativeFunction.a$cls);
  2819. $core.addMethod(
  2820. $core.method({
  2821. selector: "exists:",
  2822. protocol: "testing",
  2823. fn: function (aString){
  2824. var self=this,$self=this;
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. return $core.withContext(function($ctx1) {
  2827. //>>excludeEnd("ctx");
  2828. return $recv($globals.Platform)._includesGlobal_(aString);
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  2831. //>>excludeEnd("ctx");
  2832. },
  2833. //>>excludeStart("ide", pragmas.excludeIdeData);
  2834. args: ["aString"],
  2835. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  2836. referencedClasses: ["Platform"],
  2837. //>>excludeEnd("ide");
  2838. messageSends: ["includesGlobal:"]
  2839. }),
  2840. $globals.NativeFunction.a$cls);
  2841. $core.addMethod(
  2842. $core.method({
  2843. selector: "functionNamed:",
  2844. protocol: "function calling",
  2845. fn: function (aString){
  2846. var self=this,$self=this;
  2847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2848. return $core.withContext(function($ctx1) {
  2849. //>>excludeEnd("ctx");
  2850. var nativeFunc=$globals.Platform._globals[aString];
  2851. return nativeFunc();
  2852. ;
  2853. return self;
  2854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2855. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  2856. //>>excludeEnd("ctx");
  2857. },
  2858. //>>excludeStart("ide", pragmas.excludeIdeData);
  2859. args: ["aString"],
  2860. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  2861. referencedClasses: [],
  2862. //>>excludeEnd("ide");
  2863. messageSends: []
  2864. }),
  2865. $globals.NativeFunction.a$cls);
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "functionNamed:value:",
  2869. protocol: "function calling",
  2870. fn: function (aString,anObject){
  2871. var self=this,$self=this;
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. return $core.withContext(function($ctx1) {
  2874. //>>excludeEnd("ctx");
  2875. var nativeFunc=$globals.Platform._globals()[aString];
  2876. return nativeFunc(anObject);
  2877. ;
  2878. return self;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  2881. //>>excludeEnd("ctx");
  2882. },
  2883. //>>excludeStart("ide", pragmas.excludeIdeData);
  2884. args: ["aString", "anObject"],
  2885. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  2886. referencedClasses: [],
  2887. //>>excludeEnd("ide");
  2888. messageSends: []
  2889. }),
  2890. $globals.NativeFunction.a$cls);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "functionNamed:value:value:",
  2894. protocol: "function calling",
  2895. fn: function (aString,anObject,anObject2){
  2896. var self=this,$self=this;
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. return $core.withContext(function($ctx1) {
  2899. //>>excludeEnd("ctx");
  2900. var nativeFunc=$globals.Platform._globals()[aString];
  2901. return nativeFunc(anObject,anObject2);
  2902. ;
  2903. return self;
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  2906. //>>excludeEnd("ctx");
  2907. },
  2908. //>>excludeStart("ide", pragmas.excludeIdeData);
  2909. args: ["aString", "anObject", "anObject2"],
  2910. 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'>",
  2911. referencedClasses: [],
  2912. //>>excludeEnd("ide");
  2913. messageSends: []
  2914. }),
  2915. $globals.NativeFunction.a$cls);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "functionNamed:value:value:value:",
  2919. protocol: "function calling",
  2920. fn: function (aString,anObject,anObject2,anObject3){
  2921. var self=this,$self=this;
  2922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2923. return $core.withContext(function($ctx1) {
  2924. //>>excludeEnd("ctx");
  2925. var nativeFunc=$globals.Platform._globals()[aString];
  2926. return nativeFunc(anObject,anObject2, anObject3);
  2927. ;
  2928. return self;
  2929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2930. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  2931. //>>excludeEnd("ctx");
  2932. },
  2933. //>>excludeStart("ide", pragmas.excludeIdeData);
  2934. args: ["aString", "anObject", "anObject2", "anObject3"],
  2935. 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'>",
  2936. referencedClasses: [],
  2937. //>>excludeEnd("ide");
  2938. messageSends: []
  2939. }),
  2940. $globals.NativeFunction.a$cls);
  2941. $core.addMethod(
  2942. $core.method({
  2943. selector: "functionNamed:valueWithArgs:",
  2944. protocol: "function calling",
  2945. fn: function (aString,args){
  2946. var self=this,$self=this;
  2947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2948. return $core.withContext(function($ctx1) {
  2949. //>>excludeEnd("ctx");
  2950. var nativeFunc=$globals.Platform._globals()[aString];
  2951. return Function.prototype.apply.call(nativeFunc, null, args);
  2952. ;
  2953. return self;
  2954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2955. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  2956. //>>excludeEnd("ctx");
  2957. },
  2958. //>>excludeStart("ide", pragmas.excludeIdeData);
  2959. args: ["aString", "args"],
  2960. 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'>",
  2961. referencedClasses: [],
  2962. //>>excludeEnd("ide");
  2963. messageSends: []
  2964. }),
  2965. $globals.NativeFunction.a$cls);
  2966. $core.addMethod(
  2967. $core.method({
  2968. selector: "functionOf:",
  2969. protocol: "function calling",
  2970. fn: function (nativeFunc){
  2971. var self=this,$self=this;
  2972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2973. return $core.withContext(function($ctx1) {
  2974. //>>excludeEnd("ctx");
  2975. return nativeFunc();
  2976. ;
  2977. return self;
  2978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2979. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  2980. //>>excludeEnd("ctx");
  2981. },
  2982. //>>excludeStart("ide", pragmas.excludeIdeData);
  2983. args: ["nativeFunc"],
  2984. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  2985. referencedClasses: [],
  2986. //>>excludeEnd("ide");
  2987. messageSends: []
  2988. }),
  2989. $globals.NativeFunction.a$cls);
  2990. $core.addMethod(
  2991. $core.method({
  2992. selector: "functionOf:value:",
  2993. protocol: "function calling",
  2994. fn: function (nativeFunc,anObject){
  2995. var self=this,$self=this;
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. return $core.withContext(function($ctx1) {
  2998. //>>excludeEnd("ctx");
  2999. return nativeFunc(anObject);
  3000. ;
  3001. return self;
  3002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3003. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  3004. //>>excludeEnd("ctx");
  3005. },
  3006. //>>excludeStart("ide", pragmas.excludeIdeData);
  3007. args: ["nativeFunc", "anObject"],
  3008. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  3009. referencedClasses: [],
  3010. //>>excludeEnd("ide");
  3011. messageSends: []
  3012. }),
  3013. $globals.NativeFunction.a$cls);
  3014. $core.addMethod(
  3015. $core.method({
  3016. selector: "functionOf:value:value:",
  3017. protocol: "function calling",
  3018. fn: function (nativeFunc,anObject,anObject2){
  3019. var self=this,$self=this;
  3020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3021. return $core.withContext(function($ctx1) {
  3022. //>>excludeEnd("ctx");
  3023. return nativeFunc(anObject,anObject2);
  3024. ;
  3025. return self;
  3026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3027. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  3028. //>>excludeEnd("ctx");
  3029. },
  3030. //>>excludeStart("ide", pragmas.excludeIdeData);
  3031. args: ["nativeFunc", "anObject", "anObject2"],
  3032. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  3033. referencedClasses: [],
  3034. //>>excludeEnd("ide");
  3035. messageSends: []
  3036. }),
  3037. $globals.NativeFunction.a$cls);
  3038. $core.addMethod(
  3039. $core.method({
  3040. selector: "functionOf:value:value:value:",
  3041. protocol: "function calling",
  3042. fn: function (nativeFunc,anObject,anObject2,anObject3){
  3043. var self=this,$self=this;
  3044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3045. return $core.withContext(function($ctx1) {
  3046. //>>excludeEnd("ctx");
  3047. return nativeFunc(anObject,anObject2, anObject3);
  3048. ;
  3049. return self;
  3050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3051. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  3052. //>>excludeEnd("ctx");
  3053. },
  3054. //>>excludeStart("ide", pragmas.excludeIdeData);
  3055. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  3056. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  3057. referencedClasses: [],
  3058. //>>excludeEnd("ide");
  3059. messageSends: []
  3060. }),
  3061. $globals.NativeFunction.a$cls);
  3062. $core.addMethod(
  3063. $core.method({
  3064. selector: "functionOf:valueWithArgs:",
  3065. protocol: "function calling",
  3066. fn: function (nativeFunc,args){
  3067. var self=this,$self=this;
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. return $core.withContext(function($ctx1) {
  3070. //>>excludeEnd("ctx");
  3071. return Function.prototype.apply.call(nativeFunc, null, args);
  3072. ;
  3073. return self;
  3074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3075. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  3076. //>>excludeEnd("ctx");
  3077. },
  3078. //>>excludeStart("ide", pragmas.excludeIdeData);
  3079. args: ["nativeFunc", "args"],
  3080. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  3081. referencedClasses: [],
  3082. //>>excludeEnd("ide");
  3083. messageSends: []
  3084. }),
  3085. $globals.NativeFunction.a$cls);
  3086. $core.addMethod(
  3087. $core.method({
  3088. selector: "isNativeFunction:",
  3089. protocol: "testing",
  3090. fn: function (anObject){
  3091. var self=this,$self=this;
  3092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3093. return $core.withContext(function($ctx1) {
  3094. //>>excludeEnd("ctx");
  3095. return typeof anObject === "function";
  3096. return self;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  3099. //>>excludeEnd("ctx");
  3100. },
  3101. //>>excludeStart("ide", pragmas.excludeIdeData);
  3102. args: ["anObject"],
  3103. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  3104. referencedClasses: [],
  3105. //>>excludeEnd("ide");
  3106. messageSends: []
  3107. }),
  3108. $globals.NativeFunction.a$cls);
  3109. $core.addMethod(
  3110. $core.method({
  3111. selector: "methodOf:this:",
  3112. protocol: "method calling",
  3113. fn: function (nativeFunc,thisObject){
  3114. var self=this,$self=this;
  3115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3116. return $core.withContext(function($ctx1) {
  3117. //>>excludeEnd("ctx");
  3118. return Function.prototype.call.call(nativeFunc, thisObject);
  3119. ;
  3120. return self;
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  3123. //>>excludeEnd("ctx");
  3124. },
  3125. //>>excludeStart("ide", pragmas.excludeIdeData);
  3126. args: ["nativeFunc", "thisObject"],
  3127. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  3128. referencedClasses: [],
  3129. //>>excludeEnd("ide");
  3130. messageSends: []
  3131. }),
  3132. $globals.NativeFunction.a$cls);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "methodOf:this:value:",
  3136. protocol: "method calling",
  3137. fn: function (nativeFunc,thisObject,anObject){
  3138. var self=this,$self=this;
  3139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3140. return $core.withContext(function($ctx1) {
  3141. //>>excludeEnd("ctx");
  3142. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  3143. ;
  3144. return self;
  3145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3146. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  3147. //>>excludeEnd("ctx");
  3148. },
  3149. //>>excludeStart("ide", pragmas.excludeIdeData);
  3150. args: ["nativeFunc", "thisObject", "anObject"],
  3151. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  3152. referencedClasses: [],
  3153. //>>excludeEnd("ide");
  3154. messageSends: []
  3155. }),
  3156. $globals.NativeFunction.a$cls);
  3157. $core.addMethod(
  3158. $core.method({
  3159. selector: "methodOf:this:value:value:",
  3160. protocol: "method calling",
  3161. fn: function (nativeFunc,thisObject,anObject,anObject2){
  3162. var self=this,$self=this;
  3163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3164. return $core.withContext(function($ctx1) {
  3165. //>>excludeEnd("ctx");
  3166. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  3167. ;
  3168. return self;
  3169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3170. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  3171. //>>excludeEnd("ctx");
  3172. },
  3173. //>>excludeStart("ide", pragmas.excludeIdeData);
  3174. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  3175. 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'>",
  3176. referencedClasses: [],
  3177. //>>excludeEnd("ide");
  3178. messageSends: []
  3179. }),
  3180. $globals.NativeFunction.a$cls);
  3181. $core.addMethod(
  3182. $core.method({
  3183. selector: "methodOf:this:value:value:value:",
  3184. protocol: "method calling",
  3185. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  3186. var self=this,$self=this;
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. return $core.withContext(function($ctx1) {
  3189. //>>excludeEnd("ctx");
  3190. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  3191. ;
  3192. return self;
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  3195. //>>excludeEnd("ctx");
  3196. },
  3197. //>>excludeStart("ide", pragmas.excludeIdeData);
  3198. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  3199. 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'>",
  3200. referencedClasses: [],
  3201. //>>excludeEnd("ide");
  3202. messageSends: []
  3203. }),
  3204. $globals.NativeFunction.a$cls);
  3205. $core.addMethod(
  3206. $core.method({
  3207. selector: "methodOf:this:valueWithArgs:",
  3208. protocol: "method calling",
  3209. fn: function (nativeFunc,thisObject,args){
  3210. var self=this,$self=this;
  3211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3212. return $core.withContext(function($ctx1) {
  3213. //>>excludeEnd("ctx");
  3214. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  3215. ;
  3216. return self;
  3217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3218. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  3219. //>>excludeEnd("ctx");
  3220. },
  3221. //>>excludeStart("ide", pragmas.excludeIdeData);
  3222. args: ["nativeFunc", "thisObject", "args"],
  3223. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  3224. referencedClasses: [],
  3225. //>>excludeEnd("ide");
  3226. messageSends: []
  3227. }),
  3228. $globals.NativeFunction.a$cls);
  3229. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  3230. //>>excludeStart("ide", pragmas.excludeIdeData);
  3231. $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.";
  3232. //>>excludeEnd("ide");
  3233. $core.addMethod(
  3234. $core.method({
  3235. selector: "clearInterval",
  3236. protocol: "timeout/interval",
  3237. fn: function (){
  3238. var self=this,$self=this;
  3239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3240. return $core.withContext(function($ctx1) {
  3241. //>>excludeEnd("ctx");
  3242. var interval = $self["@rawTimeout"];
  3243. clearInterval(interval);
  3244. ;
  3245. return self;
  3246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3247. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  3248. //>>excludeEnd("ctx");
  3249. },
  3250. //>>excludeStart("ide", pragmas.excludeIdeData);
  3251. args: [],
  3252. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  3253. referencedClasses: [],
  3254. //>>excludeEnd("ide");
  3255. messageSends: []
  3256. }),
  3257. $globals.Timeout);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "clearTimeout",
  3261. protocol: "timeout/interval",
  3262. fn: function (){
  3263. var self=this,$self=this;
  3264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3265. return $core.withContext(function($ctx1) {
  3266. //>>excludeEnd("ctx");
  3267. var timeout = $self["@rawTimeout"];
  3268. clearTimeout(timeout);
  3269. ;
  3270. return self;
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  3273. //>>excludeEnd("ctx");
  3274. },
  3275. //>>excludeStart("ide", pragmas.excludeIdeData);
  3276. args: [],
  3277. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  3278. referencedClasses: [],
  3279. //>>excludeEnd("ide");
  3280. messageSends: []
  3281. }),
  3282. $globals.Timeout);
  3283. $core.addMethod(
  3284. $core.method({
  3285. selector: "rawTimeout:",
  3286. protocol: "accessing",
  3287. fn: function (anObject){
  3288. var self=this,$self=this;
  3289. $self["@rawTimeout"]=anObject;
  3290. return self;
  3291. },
  3292. //>>excludeStart("ide", pragmas.excludeIdeData);
  3293. args: ["anObject"],
  3294. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  3295. referencedClasses: [],
  3296. //>>excludeEnd("ide");
  3297. messageSends: []
  3298. }),
  3299. $globals.Timeout);
  3300. $core.addMethod(
  3301. $core.method({
  3302. selector: "on:",
  3303. protocol: "instance creation",
  3304. fn: function (anObject){
  3305. var self=this,$self=this;
  3306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3307. return $core.withContext(function($ctx1) {
  3308. //>>excludeEnd("ctx");
  3309. var $1;
  3310. $1=$self._new();
  3311. $recv($1)._rawTimeout_(anObject);
  3312. return $recv($1)._yourself();
  3313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3314. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  3315. //>>excludeEnd("ctx");
  3316. },
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: ["anObject"],
  3319. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. messageSends: ["rawTimeout:", "new", "yourself"]
  3323. }),
  3324. $globals.Timeout.a$cls);
  3325. });