Kernel-Methods.js 114 KB

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