Kernel-Methods.js 113 KB

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