Kernel-Methods.js 119 KB

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