Kernel-Methods.js 116 KB

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