Kernel-Methods.js 112 KB

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