Kernel-Methods.js 114 KB

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