Kernel-Methods.js 114 KB

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