Kernel-Methods.js 114 KB

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