Kernel-Methods.js 114 KB

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