1
0

Kernel-Methods.js 114 KB

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