Kernel-Methods.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. smalltalk.addPackage('Kernel-Methods');
  2. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
  3. smalltalk.BlockClosure.comment="A BlockClosure is a lexical closure.\x0aThe JavaScript representation is a function.\x0a\x0aA BlockClosure is evaluated with the `#value*` methods in the 'evaluating' protocol."
  4. smalltalk.addMethod(
  5. "_applyTo_arguments_",
  6. smalltalk.method({
  7. selector: "applyTo:arguments:",
  8. category: 'evaluating',
  9. fn: function (anObject,aCollection){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) { return self.apply(anObject, aCollection);
  12. return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},smalltalk.BlockClosure)})},
  13. args: ["anObject", "aCollection"],
  14. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  15. messageSends: [],
  16. referencedClasses: []
  17. }),
  18. smalltalk.BlockClosure);
  19. smalltalk.addMethod(
  20. "_asCompiledMethod_",
  21. smalltalk.method({
  22. selector: "asCompiledMethod:",
  23. category: 'converting',
  24. fn: function (aString){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) { return smalltalk.method({selector:aString, fn:self});;
  27. return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},smalltalk.BlockClosure)})},
  28. args: ["aString"],
  29. source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
  30. messageSends: [],
  31. referencedClasses: []
  32. }),
  33. smalltalk.BlockClosure);
  34. smalltalk.addMethod(
  35. "_compiledSource",
  36. smalltalk.method({
  37. selector: "compiledSource",
  38. category: 'accessing',
  39. fn: function (){
  40. var self=this;
  41. return smalltalk.withContext(function($ctx1) { return self.toString();
  42. return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{},smalltalk.BlockClosure)})},
  43. args: [],
  44. source: "compiledSource\x0a\x09<return self.toString()>",
  45. messageSends: [],
  46. referencedClasses: []
  47. }),
  48. smalltalk.BlockClosure);
  49. smalltalk.addMethod(
  50. "_currySelf",
  51. smalltalk.method({
  52. selector: "currySelf",
  53. category: 'converting',
  54. fn: function (){
  55. var self=this;
  56. return smalltalk.withContext(function($ctx1) {
  57. return function () {
  58. var args = [ this ];
  59. args.push.apply(args, arguments);
  60. return self.apply(null, args);
  61. }
  62. ;
  63. return self}, function($ctx1) {$ctx1.fill(self,"currySelf",{},smalltalk.BlockClosure)})},
  64. args: [],
  65. 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>",
  66. messageSends: [],
  67. referencedClasses: []
  68. }),
  69. smalltalk.BlockClosure);
  70. smalltalk.addMethod(
  71. "_ensure_",
  72. smalltalk.method({
  73. selector: "ensure:",
  74. category: 'evaluating',
  75. fn: function (aBlock){
  76. var self=this;
  77. return smalltalk.withContext(function($ctx1) { try{return self()}finally{aBlock._value()};
  78. return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  79. args: ["aBlock"],
  80. source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
  81. messageSends: [],
  82. referencedClasses: []
  83. }),
  84. smalltalk.BlockClosure);
  85. smalltalk.addMethod(
  86. "_fork",
  87. smalltalk.method({
  88. selector: "fork",
  89. category: 'timeout/interval',
  90. fn: function (){
  91. var self=this;
  92. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ForkPool || ForkPool))._default())._fork_(self);
  93. return self}, function($ctx1) {$ctx1.fill(self,"fork",{},smalltalk.BlockClosure)})},
  94. args: [],
  95. source: "fork\x0a\x09ForkPool default fork: self",
  96. messageSends: ["fork:", "default"],
  97. referencedClasses: ["ForkPool"]
  98. }),
  99. smalltalk.BlockClosure);
  100. smalltalk.addMethod(
  101. "_new",
  102. smalltalk.method({
  103. selector: "new",
  104. category: 'evaluating',
  105. fn: function (){
  106. var self=this;
  107. return smalltalk.withContext(function($ctx1) { return new self();
  108. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.BlockClosure)})},
  109. args: [],
  110. 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()>",
  111. messageSends: [],
  112. referencedClasses: []
  113. }),
  114. smalltalk.BlockClosure);
  115. smalltalk.addMethod(
  116. "_newValue_",
  117. smalltalk.method({
  118. selector: "newValue:",
  119. category: 'evaluating',
  120. fn: function (anObject){
  121. var self=this;
  122. return smalltalk.withContext(function($ctx1) { return new self(anObject);
  123. return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},smalltalk.BlockClosure)})},
  124. args: ["anObject"],
  125. source: "newValue: anObject\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(anObject)>",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.BlockClosure);
  130. smalltalk.addMethod(
  131. "_newValue_value_",
  132. smalltalk.method({
  133. selector: "newValue:value:",
  134. category: 'evaluating',
  135. fn: function (anObject,anObject2){
  136. var self=this;
  137. return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2);
  138. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},smalltalk.BlockClosure)})},
  139. args: ["anObject", "anObject2"],
  140. source: "newValue: anObject value: anObject2\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(anObject, anObject2)>",
  141. messageSends: [],
  142. referencedClasses: []
  143. }),
  144. smalltalk.BlockClosure);
  145. smalltalk.addMethod(
  146. "_newValue_value_value_",
  147. smalltalk.method({
  148. selector: "newValue:value:value:",
  149. category: 'evaluating',
  150. fn: function (anObject,anObject2,anObject3){
  151. var self=this;
  152. return smalltalk.withContext(function($ctx1) { return new self(anObject, anObject2,anObject3);
  153. return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.BlockClosure)})},
  154. args: ["anObject", "anObject2", "anObject3"],
  155. source: "newValue: anObject value: anObject2 value: anObject3\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(anObject, anObject2,anObject3)>",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. smalltalk.BlockClosure);
  160. smalltalk.addMethod(
  161. "_numArgs",
  162. smalltalk.method({
  163. selector: "numArgs",
  164. category: 'accessing',
  165. fn: function (){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) { return self.length;
  168. return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{},smalltalk.BlockClosure)})},
  169. args: [],
  170. source: "numArgs\x0a\x09<return self.length>",
  171. messageSends: [],
  172. referencedClasses: []
  173. }),
  174. smalltalk.BlockClosure);
  175. smalltalk.addMethod(
  176. "_on_do_",
  177. smalltalk.method({
  178. selector: "on:do:",
  179. category: 'error handling',
  180. fn: function (anErrorClass,aBlock){
  181. var self=this;
  182. return smalltalk.withContext(function($ctx1) { var $2,$1;
  183. $1=_st(self)._try_catch_(self,(function(error){
  184. var smalltalkError;
  185. return smalltalk.withContext(function($ctx2) { smalltalkError=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._asSmalltalkException_(error);
  186. smalltalkError;
  187. $2=_st(smalltalkError)._isKindOf_(anErrorClass);
  188. if(smalltalk.assert($2)){
  189. return _st(aBlock)._value_(smalltalkError);
  190. } else {
  191. return _st(smalltalkError)._signal();
  192. };
  193. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
  194. return $1;
  195. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
  196. args: ["anErrorClass", "aBlock"],
  197. 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 try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError signal ] ]",
  198. messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  199. referencedClasses: ["Smalltalk"]
  200. }),
  201. smalltalk.BlockClosure);
  202. smalltalk.addMethod(
  203. "_timeToRun",
  204. smalltalk.method({
  205. selector: "timeToRun",
  206. category: 'evaluating',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) { var $1;
  210. $1=_st((smalltalk.Date || Date))._millisecondsToRun_(self);
  211. return $1;
  212. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},smalltalk.BlockClosure)})},
  213. args: [],
  214. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  215. messageSends: ["millisecondsToRun:"],
  216. referencedClasses: ["Date"]
  217. }),
  218. smalltalk.BlockClosure);
  219. smalltalk.addMethod(
  220. "_value",
  221. smalltalk.method({
  222. selector: "value",
  223. category: 'evaluating',
  224. fn: function (){
  225. var self=this;
  226. return smalltalk.withContext(function($ctx1) { return self();;
  227. return self}, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.BlockClosure)})},
  228. args: [],
  229. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  230. messageSends: [],
  231. referencedClasses: []
  232. }),
  233. smalltalk.BlockClosure);
  234. smalltalk.addMethod(
  235. "_value_",
  236. smalltalk.method({
  237. selector: "value:",
  238. category: 'evaluating',
  239. fn: function (anArg){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) { return self(anArg);;
  242. return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},smalltalk.BlockClosure)})},
  243. args: ["anArg"],
  244. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  245. messageSends: [],
  246. referencedClasses: []
  247. }),
  248. smalltalk.BlockClosure);
  249. smalltalk.addMethod(
  250. "_value_value_",
  251. smalltalk.method({
  252. selector: "value:value:",
  253. category: 'evaluating',
  254. fn: function (firstArg,secondArg){
  255. var self=this;
  256. return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg);;
  257. return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},smalltalk.BlockClosure)})},
  258. args: ["firstArg", "secondArg"],
  259. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  260. messageSends: [],
  261. referencedClasses: []
  262. }),
  263. smalltalk.BlockClosure);
  264. smalltalk.addMethod(
  265. "_value_value_value_",
  266. smalltalk.method({
  267. selector: "value:value:value:",
  268. category: 'evaluating',
  269. fn: function (firstArg,secondArg,thirdArg){
  270. var self=this;
  271. return smalltalk.withContext(function($ctx1) { return self(firstArg, secondArg, thirdArg);;
  272. return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},smalltalk.BlockClosure)})},
  273. args: ["firstArg", "secondArg", "thirdArg"],
  274. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  275. messageSends: [],
  276. referencedClasses: []
  277. }),
  278. smalltalk.BlockClosure);
  279. smalltalk.addMethod(
  280. "_valueWithInterval_",
  281. smalltalk.method({
  282. selector: "valueWithInterval:",
  283. category: 'timeout/interval',
  284. fn: function (aNumber){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var interval = setInterval(self, aNumber);
  288. return smalltalk.Timeout._on_(interval);
  289. ;
  290. return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  291. args: ["aNumber"],
  292. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(interval);\x0a\x09>",
  293. messageSends: [],
  294. referencedClasses: []
  295. }),
  296. smalltalk.BlockClosure);
  297. smalltalk.addMethod(
  298. "_valueWithPossibleArguments_",
  299. smalltalk.method({
  300. selector: "valueWithPossibleArguments:",
  301. category: 'evaluating',
  302. fn: function (aCollection){
  303. var self=this;
  304. return smalltalk.withContext(function($ctx1) { return self.apply(null, aCollection);;
  305. return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},smalltalk.BlockClosure)})},
  306. args: ["aCollection"],
  307. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  308. messageSends: [],
  309. referencedClasses: []
  310. }),
  311. smalltalk.BlockClosure);
  312. smalltalk.addMethod(
  313. "_valueWithTimeout_",
  314. smalltalk.method({
  315. selector: "valueWithTimeout:",
  316. category: 'timeout/interval',
  317. fn: function (aNumber){
  318. var self=this;
  319. return smalltalk.withContext(function($ctx1) {
  320. var timeout = setTimeout(self, aNumber);
  321. return smalltalk.Timeout._on_(timeout);
  322. ;
  323. return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},smalltalk.BlockClosure)})},
  324. args: ["aNumber"],
  325. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return smalltalk.Timeout._on_(timeout);\x0a\x09>",
  326. messageSends: [],
  327. referencedClasses: []
  328. }),
  329. smalltalk.BlockClosure);
  330. smalltalk.addMethod(
  331. "_whileFalse",
  332. smalltalk.method({
  333. selector: "whileFalse",
  334. category: 'controlling',
  335. fn: function (){
  336. var self=this;
  337. return smalltalk.withContext(function($ctx1) { _st(self)._whileFalse_((function(){
  338. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  339. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{},smalltalk.BlockClosure)})},
  340. args: [],
  341. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  342. messageSends: ["whileFalse:"],
  343. referencedClasses: []
  344. }),
  345. smalltalk.BlockClosure);
  346. smalltalk.addMethod(
  347. "_whileFalse_",
  348. smalltalk.method({
  349. selector: "whileFalse:",
  350. category: 'controlling',
  351. fn: function (aBlock){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) { while(!self()) {aBlock()};
  354. return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  355. args: ["aBlock"],
  356. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  357. messageSends: [],
  358. referencedClasses: []
  359. }),
  360. smalltalk.BlockClosure);
  361. smalltalk.addMethod(
  362. "_whileTrue",
  363. smalltalk.method({
  364. selector: "whileTrue",
  365. category: 'controlling',
  366. fn: function (){
  367. var self=this;
  368. return smalltalk.withContext(function($ctx1) { _st(self)._whileTrue_((function(){
  369. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  370. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{},smalltalk.BlockClosure)})},
  371. args: [],
  372. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  373. messageSends: ["whileTrue:"],
  374. referencedClasses: []
  375. }),
  376. smalltalk.BlockClosure);
  377. smalltalk.addMethod(
  378. "_whileTrue_",
  379. smalltalk.method({
  380. selector: "whileTrue:",
  381. category: 'controlling',
  382. fn: function (aBlock){
  383. var self=this;
  384. return smalltalk.withContext(function($ctx1) { while(self()) {aBlock()};
  385. return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},smalltalk.BlockClosure)})},
  386. args: ["aBlock"],
  387. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  388. messageSends: [],
  389. referencedClasses: []
  390. }),
  391. smalltalk.BlockClosure);
  392. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  393. smalltalk.CompiledMethod.comment="CompiledMethod hold the source and compiled code of a class method.\x0a\x0aYou can get a CompiledMethod using `Behavior>>methodAt:`\x0a\x0a\x09String methodAt: 'lines'\x0a\x0aand read the source code\x0a\x0a\x09(String methodAt: 'lines') source\x0a\x0aSee referenced classes:\x0a\x0a\x09(String methodAt: 'lines') referencedClasses\x0a\x0aor messages sent from this method:\x0a\x09\x0a\x09(String methodAt: 'lines') messageSends"
  394. smalltalk.addMethod(
  395. "_arguments",
  396. smalltalk.method({
  397. selector: "arguments",
  398. category: 'accessing',
  399. fn: function (){
  400. var self=this;
  401. return smalltalk.withContext(function($ctx1) { return self.args || [];
  402. return self}, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.CompiledMethod)})},
  403. args: [],
  404. source: "arguments\x0a\x09<return self.args || []>",
  405. messageSends: [],
  406. referencedClasses: []
  407. }),
  408. smalltalk.CompiledMethod);
  409. smalltalk.addMethod(
  410. "_category",
  411. smalltalk.method({
  412. selector: "category",
  413. category: 'accessing',
  414. fn: function (){
  415. var self=this;
  416. return smalltalk.withContext(function($ctx1) { var $2,$1;
  417. $2=_st(self)._basicAt_("category");
  418. if(($receiver = $2) == nil || $receiver == undefined){
  419. $1=_st(self)._defaultCategory();
  420. } else {
  421. $1=$2;
  422. };
  423. return $1;
  424. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.CompiledMethod)})},
  425. args: [],
  426. source: "category\x0a\x09^(self basicAt: 'category') ifNil: [ self defaultCategory ]",
  427. messageSends: ["ifNil:", "defaultCategory", "basicAt:"],
  428. referencedClasses: []
  429. }),
  430. smalltalk.CompiledMethod);
  431. smalltalk.addMethod(
  432. "_category_",
  433. smalltalk.method({
  434. selector: "category:",
  435. category: 'accessing',
  436. fn: function (aString){
  437. var self=this;
  438. var oldCategory;
  439. return smalltalk.withContext(function($ctx1) { var $1;
  440. oldCategory=_st(self)._category();
  441. _st(self)._basicAt_put_("category",aString);
  442. $1=_st(self)._methodClass();
  443. if(($receiver = $1) == nil || $receiver == undefined){
  444. $1;
  445. } else {
  446. _st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
  447. _st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
  448. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._category()).__eq(oldCategory);
  449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
  450. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldCategory);
  451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  452. };
  453. return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldCategory:oldCategory},smalltalk.CompiledMethod)})},
  454. args: ["aString"],
  455. source: "category: aString\x0a\x09| oldCategory |\x0a\x09oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a\x09\x0a\x09self methodClass ifNotNil: [\x0a\x09\x09self methodClass organization addElement: aString.\x0a\x09\x0a\x09\x09(self methodClass methods\x0a\x09\x09\x09select: [ :each | each category = oldCategory ])\x0a\x09\x09\x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
  456. messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
  457. referencedClasses: []
  458. }),
  459. smalltalk.CompiledMethod);
  460. smalltalk.addMethod(
  461. "_defaultCategory",
  462. smalltalk.method({
  463. selector: "defaultCategory",
  464. category: 'defaults',
  465. fn: function (){
  466. var self=this;
  467. return smalltalk.withContext(function($ctx1) { return "as yet unclassified";
  468. }, function($ctx1) {$ctx1.fill(self,"defaultCategory",{},smalltalk.CompiledMethod)})},
  469. args: [],
  470. source: "defaultCategory\x0a\x09^ 'as yet unclassified'",
  471. messageSends: [],
  472. referencedClasses: []
  473. }),
  474. smalltalk.CompiledMethod);
  475. smalltalk.addMethod(
  476. "_fn",
  477. smalltalk.method({
  478. selector: "fn",
  479. category: 'accessing',
  480. fn: function (){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) { var $1;
  483. $1=_st(self)._basicAt_("fn");
  484. return $1;
  485. }, function($ctx1) {$ctx1.fill(self,"fn",{},smalltalk.CompiledMethod)})},
  486. args: [],
  487. source: "fn\x0a\x09^self basicAt: 'fn'",
  488. messageSends: ["basicAt:"],
  489. referencedClasses: []
  490. }),
  491. smalltalk.CompiledMethod);
  492. smalltalk.addMethod(
  493. "_fn_",
  494. smalltalk.method({
  495. selector: "fn:",
  496. category: 'accessing',
  497. fn: function (aBlock){
  498. var self=this;
  499. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("fn",aBlock);
  500. return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},smalltalk.CompiledMethod)})},
  501. args: ["aBlock"],
  502. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  503. messageSends: ["basicAt:put:"],
  504. referencedClasses: []
  505. }),
  506. smalltalk.CompiledMethod);
  507. smalltalk.addMethod(
  508. "_messageSends",
  509. smalltalk.method({
  510. selector: "messageSends",
  511. category: 'accessing',
  512. fn: function (){
  513. var self=this;
  514. return smalltalk.withContext(function($ctx1) { var $1;
  515. $1=_st(self)._basicAt_("messageSends");
  516. return $1;
  517. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},smalltalk.CompiledMethod)})},
  518. args: [],
  519. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  520. messageSends: ["basicAt:"],
  521. referencedClasses: []
  522. }),
  523. smalltalk.CompiledMethod);
  524. smalltalk.addMethod(
  525. "_methodClass",
  526. smalltalk.method({
  527. selector: "methodClass",
  528. category: 'accessing',
  529. fn: function (){
  530. var self=this;
  531. return smalltalk.withContext(function($ctx1) { var $1;
  532. $1=_st(self)._basicAt_("methodClass");
  533. return $1;
  534. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},smalltalk.CompiledMethod)})},
  535. args: [],
  536. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  537. messageSends: ["basicAt:"],
  538. referencedClasses: []
  539. }),
  540. smalltalk.CompiledMethod);
  541. smalltalk.addMethod(
  542. "_protocol",
  543. smalltalk.method({
  544. selector: "protocol",
  545. category: 'accessing',
  546. fn: function (){
  547. var self=this;
  548. return smalltalk.withContext(function($ctx1) { var $1;
  549. $1=_st(self)._category();
  550. return $1;
  551. }, function($ctx1) {$ctx1.fill(self,"protocol",{},smalltalk.CompiledMethod)})},
  552. args: [],
  553. source: "protocol\x0a\x09^ self category",
  554. messageSends: ["category"],
  555. referencedClasses: []
  556. }),
  557. smalltalk.CompiledMethod);
  558. smalltalk.addMethod(
  559. "_referencedClasses",
  560. smalltalk.method({
  561. selector: "referencedClasses",
  562. category: 'accessing',
  563. fn: function (){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) { var $1;
  566. $1=_st(self)._basicAt_("referencedClasses");
  567. return $1;
  568. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},smalltalk.CompiledMethod)})},
  569. args: [],
  570. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  571. messageSends: ["basicAt:"],
  572. referencedClasses: []
  573. }),
  574. smalltalk.CompiledMethod);
  575. smalltalk.addMethod(
  576. "_selector",
  577. smalltalk.method({
  578. selector: "selector",
  579. category: 'accessing',
  580. fn: function (){
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) { var $1;
  583. $1=_st(self)._basicAt_("selector");
  584. return $1;
  585. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.CompiledMethod)})},
  586. args: [],
  587. source: "selector\x0a\x09^self basicAt: 'selector'",
  588. messageSends: ["basicAt:"],
  589. referencedClasses: []
  590. }),
  591. smalltalk.CompiledMethod);
  592. smalltalk.addMethod(
  593. "_selector_",
  594. smalltalk.method({
  595. selector: "selector:",
  596. category: 'accessing',
  597. fn: function (aString){
  598. var self=this;
  599. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("selector",aString);
  600. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.CompiledMethod)})},
  601. args: ["aString"],
  602. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  603. messageSends: ["basicAt:put:"],
  604. referencedClasses: []
  605. }),
  606. smalltalk.CompiledMethod);
  607. smalltalk.addMethod(
  608. "_source",
  609. smalltalk.method({
  610. selector: "source",
  611. category: 'accessing',
  612. fn: function (){
  613. var self=this;
  614. return smalltalk.withContext(function($ctx1) { var $2,$1;
  615. $2=_st(self)._basicAt_("source");
  616. if(($receiver = $2) == nil || $receiver == undefined){
  617. $1="";
  618. } else {
  619. $1=$2;
  620. };
  621. return $1;
  622. }, function($ctx1) {$ctx1.fill(self,"source",{},smalltalk.CompiledMethod)})},
  623. args: [],
  624. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  625. messageSends: ["ifNil:", "basicAt:"],
  626. referencedClasses: []
  627. }),
  628. smalltalk.CompiledMethod);
  629. smalltalk.addMethod(
  630. "_source_",
  631. smalltalk.method({
  632. selector: "source:",
  633. category: 'accessing',
  634. fn: function (aString){
  635. var self=this;
  636. return smalltalk.withContext(function($ctx1) { _st(self)._basicAt_put_("source",aString);
  637. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},smalltalk.CompiledMethod)})},
  638. args: ["aString"],
  639. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  640. messageSends: ["basicAt:put:"],
  641. referencedClasses: []
  642. }),
  643. smalltalk.CompiledMethod);
  644. smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  645. smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
  646. smalltalk.addMethod(
  647. "_addWorker",
  648. smalltalk.method({
  649. selector: "addWorker",
  650. category: 'private',
  651. fn: function (){
  652. var self=this;
  653. return smalltalk.withContext(function($ctx1) { _st(self["@worker"])._valueWithTimeout_((0));
  654. self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
  655. return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{},smalltalk.ForkPool)})},
  656. args: [],
  657. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  658. messageSends: ["valueWithTimeout:", "+"],
  659. referencedClasses: []
  660. }),
  661. smalltalk.ForkPool);
  662. smalltalk.addMethod(
  663. "_defaultMaxPoolSize",
  664. smalltalk.method({
  665. selector: "defaultMaxPoolSize",
  666. category: 'defaults',
  667. fn: function (){
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) { var $1;
  670. $1=_st(_st(self)._class())._defaultMaxPoolSize();
  671. return $1;
  672. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool)})},
  673. args: [],
  674. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  675. messageSends: ["defaultMaxPoolSize", "class"],
  676. referencedClasses: []
  677. }),
  678. smalltalk.ForkPool);
  679. smalltalk.addMethod(
  680. "_fork_",
  681. smalltalk.method({
  682. selector: "fork:",
  683. category: 'actions',
  684. fn: function (aBlock){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) { var $1;
  687. $1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
  688. if(smalltalk.assert($1)){
  689. _st(self)._addWorker();
  690. };
  691. _st(self["@queue"])._back_(aBlock);
  692. return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},smalltalk.ForkPool)})},
  693. args: ["aBlock"],
  694. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
  695. messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"],
  696. referencedClasses: []
  697. }),
  698. smalltalk.ForkPool);
  699. smalltalk.addMethod(
  700. "_initialize",
  701. smalltalk.method({
  702. selector: "initialize",
  703. category: 'initialization',
  704. fn: function (){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  707. self["@poolSize"]=(0);
  708. self["@queue"]=_st((smalltalk.Queue || Queue))._new();
  709. self["@worker"]=_st(self)._makeWorker();
  710. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ForkPool)})},
  711. args: [],
  712. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  713. messageSends: ["initialize", "new", "makeWorker"],
  714. referencedClasses: ["Queue"]
  715. }),
  716. smalltalk.ForkPool);
  717. smalltalk.addMethod(
  718. "_makeWorker",
  719. smalltalk.method({
  720. selector: "makeWorker",
  721. category: 'initialization',
  722. fn: function (){
  723. var self=this;
  724. var sentinel;
  725. return smalltalk.withContext(function($ctx1) { var $2,$1;
  726. sentinel=_st((smalltalk.Object || Object))._new();
  727. $1=(function(){
  728. var block;
  729. return smalltalk.withContext(function($ctx2) { self["@poolSize"]=_st(self["@poolSize"]).__minus((1));
  730. self["@poolSize"];
  731. block=_st(self["@queue"])._frontIfAbsent_((function(){
  732. return smalltalk.withContext(function($ctx3) { return sentinel;
  733. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  734. block;
  735. $2=_st(block).__eq_eq(sentinel);
  736. if(! smalltalk.assert($2)){
  737. return _st((function(){
  738. return smalltalk.withContext(function($ctx3) { return _st(block)._value();
  739. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
  740. return smalltalk.withContext(function($ctx3) { return _st(self)._addWorker();
  741. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  742. };
  743. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
  744. return $1;
  745. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},smalltalk.ForkPool)})},
  746. args: [],
  747. source: "makeWorker\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09^[ | block |\x0a\x09\x09poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a\x09\x09block == sentinel ifFalse: [\x0a\x09\x09\x09[ block value ] ensure: [ self addWorker ]]]",
  748. messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
  749. referencedClasses: ["Object"]
  750. }),
  751. smalltalk.ForkPool);
  752. smalltalk.addMethod(
  753. "_maxPoolSize",
  754. smalltalk.method({
  755. selector: "maxPoolSize",
  756. category: 'accessing',
  757. fn: function (){
  758. var self=this;
  759. return smalltalk.withContext(function($ctx1) { var $2,$1;
  760. $2=self["@maxPoolSize"];
  761. if(($receiver = $2) == nil || $receiver == undefined){
  762. $1=_st(self)._defaultMaxPoolSize();
  763. } else {
  764. $1=$2;
  765. };
  766. return $1;
  767. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},smalltalk.ForkPool)})},
  768. args: [],
  769. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  770. messageSends: ["ifNil:", "defaultMaxPoolSize"],
  771. referencedClasses: []
  772. }),
  773. smalltalk.ForkPool);
  774. smalltalk.addMethod(
  775. "_maxPoolSize_",
  776. smalltalk.method({
  777. selector: "maxPoolSize:",
  778. category: 'accessing',
  779. fn: function (anInteger){
  780. var self=this;
  781. return smalltalk.withContext(function($ctx1) { self["@maxPoolSize"]=anInteger;
  782. return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger},smalltalk.ForkPool)})},
  783. args: ["anInteger"],
  784. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  785. messageSends: [],
  786. referencedClasses: []
  787. }),
  788. smalltalk.ForkPool);
  789. smalltalk.ForkPool.klass.iVarNames = ['default'];
  790. smalltalk.addMethod(
  791. "_default",
  792. smalltalk.method({
  793. selector: "default",
  794. category: 'accessing',
  795. fn: function (){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) { var $2,$1;
  798. $2=self["@default"];
  799. if(($receiver = $2) == nil || $receiver == undefined){
  800. self["@default"]=_st(self)._new();
  801. $1=self["@default"];
  802. } else {
  803. $1=$2;
  804. };
  805. return $1;
  806. }, function($ctx1) {$ctx1.fill(self,"default",{},smalltalk.ForkPool.klass)})},
  807. args: [],
  808. source: "default\x0a\x09^default ifNil: [ default := self new ]",
  809. messageSends: ["ifNil:", "new"],
  810. referencedClasses: []
  811. }),
  812. smalltalk.ForkPool.klass);
  813. smalltalk.addMethod(
  814. "_defaultMaxPoolSize",
  815. smalltalk.method({
  816. selector: "defaultMaxPoolSize",
  817. category: 'accessing',
  818. fn: function (){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) { return (100);
  821. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},smalltalk.ForkPool.klass)})},
  822. args: [],
  823. source: "defaultMaxPoolSize\x0a\x09^100",
  824. messageSends: [],
  825. referencedClasses: []
  826. }),
  827. smalltalk.ForkPool.klass);
  828. smalltalk.addMethod(
  829. "_resetDefault",
  830. smalltalk.method({
  831. selector: "resetDefault",
  832. category: 'accessing',
  833. fn: function (){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) { self["@default"]=nil;
  836. return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{},smalltalk.ForkPool.klass)})},
  837. args: [],
  838. source: "resetDefault\x0a\x09default := nil",
  839. messageSends: [],
  840. referencedClasses: []
  841. }),
  842. smalltalk.ForkPool.klass);
  843. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  844. smalltalk.Message.comment="Generally, the system does not use instances of Message 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:`"
  845. smalltalk.addMethod(
  846. "_arguments",
  847. smalltalk.method({
  848. selector: "arguments",
  849. category: 'accessing',
  850. fn: function (){
  851. var self=this;
  852. return smalltalk.withContext(function($ctx1) { var $1;
  853. $1=self["@arguments"];
  854. return $1;
  855. }, function($ctx1) {$ctx1.fill(self,"arguments",{},smalltalk.Message)})},
  856. args: [],
  857. source: "arguments\x0a\x09^arguments",
  858. messageSends: [],
  859. referencedClasses: []
  860. }),
  861. smalltalk.Message);
  862. smalltalk.addMethod(
  863. "_arguments_",
  864. smalltalk.method({
  865. selector: "arguments:",
  866. category: 'accessing',
  867. fn: function (anArray){
  868. var self=this;
  869. return smalltalk.withContext(function($ctx1) { self["@arguments"]=anArray;
  870. return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray},smalltalk.Message)})},
  871. args: ["anArray"],
  872. source: "arguments: anArray\x0a\x09arguments := anArray",
  873. messageSends: [],
  874. referencedClasses: []
  875. }),
  876. smalltalk.Message);
  877. smalltalk.addMethod(
  878. "_printString",
  879. smalltalk.method({
  880. selector: "printString",
  881. category: 'printing',
  882. fn: function (){
  883. var self=this;
  884. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  885. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  886. return smalltalk.withContext(function($ctx2) { $2=aStream;
  887. _st($2)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
  888. _st($2)._nextPutAll_("(");
  889. _st($2)._nextPutAll_(self["@selector"]);
  890. $3=_st($2)._nextPutAll_(")");
  891. return $3;
  892. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  893. return $1;
  894. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.Message)})},
  895. args: [],
  896. source: "printString\x0a\x09^ String streamContents: [:aStream|\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09aStream\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: super printString;\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: '(';\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: selector;\x0a\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: ')' ]",
  897. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  898. referencedClasses: ["String"]
  899. }),
  900. smalltalk.Message);
  901. smalltalk.addMethod(
  902. "_selector",
  903. smalltalk.method({
  904. selector: "selector",
  905. category: 'accessing',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) { var $1;
  909. $1=self["@selector"];
  910. return $1;
  911. }, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.Message)})},
  912. args: [],
  913. source: "selector\x0a\x09^selector",
  914. messageSends: [],
  915. referencedClasses: []
  916. }),
  917. smalltalk.Message);
  918. smalltalk.addMethod(
  919. "_selector_",
  920. smalltalk.method({
  921. selector: "selector:",
  922. category: 'accessing',
  923. fn: function (aString){
  924. var self=this;
  925. return smalltalk.withContext(function($ctx1) { self["@selector"]=aString;
  926. return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},smalltalk.Message)})},
  927. args: ["aString"],
  928. source: "selector: aString\x0a\x09selector := aString",
  929. messageSends: [],
  930. referencedClasses: []
  931. }),
  932. smalltalk.Message);
  933. smalltalk.addMethod(
  934. "_sendTo_",
  935. smalltalk.method({
  936. selector: "sendTo:",
  937. category: 'printing',
  938. fn: function (anObject){
  939. var self=this;
  940. return smalltalk.withContext(function($ctx1) { var $1;
  941. $1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
  942. return $1;
  943. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},smalltalk.Message)})},
  944. args: ["anObject"],
  945. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  946. messageSends: ["perform:withArguments:", "selector", "arguments"],
  947. referencedClasses: []
  948. }),
  949. smalltalk.Message);
  950. smalltalk.addMethod(
  951. "_selector_arguments_",
  952. smalltalk.method({
  953. selector: "selector:arguments:",
  954. category: 'instance creation',
  955. fn: function (aString,anArray){
  956. var self=this;
  957. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  958. $2=_st(self)._new();
  959. _st($2)._selector_(aString);
  960. _st($2)._arguments_(anArray);
  961. $3=_st($2)._yourself();
  962. $1=$3;
  963. return $1;
  964. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},smalltalk.Message.klass)})},
  965. args: ["aString", "anArray"],
  966. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  967. messageSends: ["selector:", "new", "arguments:", "yourself"],
  968. referencedClasses: []
  969. }),
  970. smalltalk.Message.klass);
  971. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  972. smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a\x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js"
  973. smalltalk.addMethod(
  974. "_asString",
  975. smalltalk.method({
  976. selector: "asString",
  977. category: 'converting',
  978. fn: function (){
  979. var self=this;
  980. return smalltalk.withContext(function($ctx1) { var $2,$1;
  981. $2=_st(self)._isBlockContext();
  982. if(smalltalk.assert($2)){
  983. $1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
  984. } else {
  985. $1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
  986. };
  987. return $1;
  988. }, function($ctx1) {$ctx1.fill(self,"asString",{},smalltalk.MethodContext)})},
  989. args: [],
  990. source: "asString\x0a\x09^self isBlockContext\x0a\x09\x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a\x09\x09ifFalse: [ self receiver class printString, ' >> ', self selector ]",
  991. messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"],
  992. referencedClasses: []
  993. }),
  994. smalltalk.MethodContext);
  995. smalltalk.addMethod(
  996. "_home",
  997. smalltalk.method({
  998. selector: "home",
  999. category: 'accessing',
  1000. fn: function (){
  1001. var self=this;
  1002. return smalltalk.withContext(function($ctx1) { return self.methodContext || self.homeContext;
  1003. return self}, function($ctx1) {$ctx1.fill(self,"home",{},smalltalk.MethodContext)})},
  1004. args: [],
  1005. source: "home\x0a\x09<return self.methodContext || self.homeContext>",
  1006. messageSends: [],
  1007. referencedClasses: []
  1008. }),
  1009. smalltalk.MethodContext);
  1010. smalltalk.addMethod(
  1011. "_isBlockContext",
  1012. smalltalk.method({
  1013. selector: "isBlockContext",
  1014. category: 'testing',
  1015. fn: function (){
  1016. var self=this;
  1017. return smalltalk.withContext(function($ctx1) { var $1;
  1018. $1=_st(_st(self)._selector())._isNil();
  1019. return $1;
  1020. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},smalltalk.MethodContext)})},
  1021. args: [],
  1022. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  1023. messageSends: ["isNil", "selector"],
  1024. referencedClasses: []
  1025. }),
  1026. smalltalk.MethodContext);
  1027. smalltalk.addMethod(
  1028. "_locals",
  1029. smalltalk.method({
  1030. selector: "locals",
  1031. category: 'accessing',
  1032. fn: function (){
  1033. var self=this;
  1034. return smalltalk.withContext(function($ctx1) { return self.locals;
  1035. return self}, function($ctx1) {$ctx1.fill(self,"locals",{},smalltalk.MethodContext)})},
  1036. args: [],
  1037. source: "locals\x0a\x09<return self.locals>",
  1038. messageSends: [],
  1039. referencedClasses: []
  1040. }),
  1041. smalltalk.MethodContext);
  1042. smalltalk.addMethod(
  1043. "_method",
  1044. smalltalk.method({
  1045. selector: "method",
  1046. category: 'accessing',
  1047. fn: function (){
  1048. var self=this;
  1049. return smalltalk.withContext(function($ctx1) { var $1;
  1050. $1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
  1051. return $1;
  1052. }, function($ctx1) {$ctx1.fill(self,"method",{},smalltalk.MethodContext)})},
  1053. args: [],
  1054. source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector",
  1055. messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"],
  1056. referencedClasses: []
  1057. }),
  1058. smalltalk.MethodContext);
  1059. smalltalk.addMethod(
  1060. "_methodContext",
  1061. smalltalk.method({
  1062. selector: "methodContext",
  1063. category: 'accessing',
  1064. fn: function (){
  1065. var self=this;
  1066. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1067. $1=_st(self)._isBlockContext();
  1068. if(! smalltalk.assert($1)){
  1069. $2=self;
  1070. return $2;
  1071. };
  1072. $3=_st(self)._home();
  1073. return $3;
  1074. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},smalltalk.MethodContext)})},
  1075. args: [],
  1076. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self home",
  1077. messageSends: ["ifFalse:", "isBlockContext", "home"],
  1078. referencedClasses: []
  1079. }),
  1080. smalltalk.MethodContext);
  1081. smalltalk.addMethod(
  1082. "_outerContext",
  1083. smalltalk.method({
  1084. selector: "outerContext",
  1085. category: 'accessing',
  1086. fn: function (){
  1087. var self=this;
  1088. return smalltalk.withContext(function($ctx1) { return self.homeContext;
  1089. return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{},smalltalk.MethodContext)})},
  1090. args: [],
  1091. source: "outerContext\x0a\x09<return self.homeContext>",
  1092. messageSends: [],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.MethodContext);
  1096. smalltalk.addMethod(
  1097. "_pc",
  1098. smalltalk.method({
  1099. selector: "pc",
  1100. category: 'accessing',
  1101. fn: function (){
  1102. var self=this;
  1103. return smalltalk.withContext(function($ctx1) { return self.pc;
  1104. return self}, function($ctx1) {$ctx1.fill(self,"pc",{},smalltalk.MethodContext)})},
  1105. args: [],
  1106. source: "pc\x0a\x09<return self.pc>",
  1107. messageSends: [],
  1108. referencedClasses: []
  1109. }),
  1110. smalltalk.MethodContext);
  1111. smalltalk.addMethod(
  1112. "_printString",
  1113. smalltalk.method({
  1114. selector: "printString",
  1115. category: 'accessing',
  1116. fn: function (){
  1117. var self=this;
  1118. return smalltalk.withContext(function($ctx1) { var $1;
  1119. $1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
  1120. return $1;
  1121. }, function($ctx1) {$ctx1.fill(self,"printString",{},smalltalk.MethodContext)})},
  1122. args: [],
  1123. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  1124. messageSends: [",", "asString", "printString"],
  1125. referencedClasses: []
  1126. }),
  1127. smalltalk.MethodContext);
  1128. smalltalk.addMethod(
  1129. "_receiver",
  1130. smalltalk.method({
  1131. selector: "receiver",
  1132. category: 'accessing',
  1133. fn: function (){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) { return self.receiver;
  1136. return self}, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.MethodContext)})},
  1137. args: [],
  1138. source: "receiver\x0a\x09<return self.receiver>",
  1139. messageSends: [],
  1140. referencedClasses: []
  1141. }),
  1142. smalltalk.MethodContext);
  1143. smalltalk.addMethod(
  1144. "_selector",
  1145. smalltalk.method({
  1146. selector: "selector",
  1147. category: 'accessing',
  1148. fn: function (){
  1149. var self=this;
  1150. return smalltalk.withContext(function($ctx1) {
  1151. if(self.selector) {
  1152. return smalltalk.convertSelector(self.selector);
  1153. } else {
  1154. return nil;
  1155. }
  1156. ;
  1157. return self}, function($ctx1) {$ctx1.fill(self,"selector",{},smalltalk.MethodContext)})},
  1158. args: [],
  1159. source: "selector\x0a\x09<\x0a\x09\x09if(self.selector) {\x0a\x09\x09\x09return smalltalk.convertSelector(self.selector);\x0a\x09\x09} else {\x0a\x09\x09\x09return nil;\x0a\x09\x09}\x0a\x09>",
  1160. messageSends: [],
  1161. referencedClasses: []
  1162. }),
  1163. smalltalk.MethodContext);
  1164. smalltalk.addMethod(
  1165. "_temps",
  1166. smalltalk.method({
  1167. selector: "temps",
  1168. category: 'accessing',
  1169. fn: function (){
  1170. var self=this;
  1171. return smalltalk.withContext(function($ctx1) { var $1;
  1172. _st(self)._deprecatedAPI();
  1173. $1=_st(self)._locals();
  1174. return $1;
  1175. }, function($ctx1) {$ctx1.fill(self,"temps",{},smalltalk.MethodContext)})},
  1176. args: [],
  1177. source: "temps\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09^ self locals",
  1178. messageSends: ["deprecatedAPI", "locals"],
  1179. referencedClasses: []
  1180. }),
  1181. smalltalk.MethodContext);
  1182. smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
  1183. smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a\x09| ws |\x0a\x09ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a\x09ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
  1184. smalltalk.addMethod(
  1185. "_constructor_",
  1186. smalltalk.method({
  1187. selector: "constructor:",
  1188. category: 'instance creation',
  1189. fn: function (aString){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var native=eval(aString);
  1193. return new native();
  1194. ;
  1195. return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},smalltalk.NativeFunction.klass)})},
  1196. args: ["aString"],
  1197. source: "constructor: aString\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native();\x0a\x09>",
  1198. messageSends: [],
  1199. referencedClasses: []
  1200. }),
  1201. smalltalk.NativeFunction.klass);
  1202. smalltalk.addMethod(
  1203. "_constructor_value_",
  1204. smalltalk.method({
  1205. selector: "constructor:value:",
  1206. category: 'instance creation',
  1207. fn: function (aString,anObject){
  1208. var self=this;
  1209. return smalltalk.withContext(function($ctx1) {
  1210. var native=eval(aString);
  1211. return new native(anObject);
  1212. ;
  1213. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},smalltalk.NativeFunction.klass)})},
  1214. args: ["aString", "anObject"],
  1215. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject);\x0a\x09>",
  1216. messageSends: [],
  1217. referencedClasses: []
  1218. }),
  1219. smalltalk.NativeFunction.klass);
  1220. smalltalk.addMethod(
  1221. "_constructor_value_value_",
  1222. smalltalk.method({
  1223. selector: "constructor:value:value:",
  1224. category: 'instance creation',
  1225. fn: function (aString,anObject,anObject2){
  1226. var self=this;
  1227. return smalltalk.withContext(function($ctx1) {
  1228. var native=eval(aString);
  1229. return new native(anObject,anObject2);
  1230. ;
  1231. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},smalltalk.NativeFunction.klass)})},
  1232. args: ["aString", "anObject", "anObject2"],
  1233. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2);\x0a\x09>",
  1234. messageSends: [],
  1235. referencedClasses: []
  1236. }),
  1237. smalltalk.NativeFunction.klass);
  1238. smalltalk.addMethod(
  1239. "_constructor_value_value_value_",
  1240. smalltalk.method({
  1241. selector: "constructor:value:value:value:",
  1242. category: 'instance creation',
  1243. fn: function (aString,anObject,anObject2,anObject3){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. var native=eval(aString);
  1247. return new native(anObject,anObject2, anObject3);
  1248. ;
  1249. return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},smalltalk.NativeFunction.klass)})},
  1250. args: ["aString", "anObject", "anObject2", "anObject3"],
  1251. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09var native=eval(aString);\x0a\x09\x09return new native(anObject,anObject2, anObject3);\x0a\x09>",
  1252. messageSends: [],
  1253. referencedClasses: []
  1254. }),
  1255. smalltalk.NativeFunction.klass);
  1256. smalltalk.addMethod(
  1257. "_exists_",
  1258. smalltalk.method({
  1259. selector: "exists:",
  1260. category: 'testing',
  1261. fn: function (aString){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. if(aString in window) {
  1265. return true
  1266. } else {
  1267. return false
  1268. }
  1269. ;
  1270. return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},smalltalk.NativeFunction.klass)})},
  1271. args: ["aString"],
  1272. source: "exists: aString\x0a\x09<\x0a\x09\x09if(aString in window) {\x0a\x09\x09\x09return true\x0a\x09\x09} else {\x0a\x09\x09\x09return false\x0a\x09\x09}\x0a\x09>",
  1273. messageSends: [],
  1274. referencedClasses: []
  1275. }),
  1276. smalltalk.NativeFunction.klass);