1
0

Kernel-Methods.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  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 self.apply(anObject, aCollection);
  12. ;
  13. return self},
  14. args: ["anObject", "aCollection"],
  15. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.BlockClosure);
  20. smalltalk.addMethod(
  21. "_compiledSource",
  22. smalltalk.method({
  23. selector: "compiledSource",
  24. category: 'accessing',
  25. fn: function (){
  26. var self=this;
  27. return self.toString();
  28. ;
  29. return self},
  30. args: [],
  31. source: "compiledSource\x0a\x09<return self.toString()>",
  32. messageSends: [],
  33. referencedClasses: []
  34. }),
  35. smalltalk.BlockClosure);
  36. smalltalk.addMethod(
  37. "_ensure_",
  38. smalltalk.method({
  39. selector: "ensure:",
  40. category: 'evaluating',
  41. fn: function (aBlock){
  42. var self=this;
  43. var $1;
  44. var success;
  45. success=false;
  46. $1=smalltalk.send((function(){
  47. smalltalk.send(self,"_value",[]);
  48. success=true;
  49. success;
  50. return smalltalk.send(aBlock,"_value",[]);
  51. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  52. if(! smalltalk.assert(success)){
  53. smalltalk.send(aBlock,"_value",[]);
  54. };
  55. return smalltalk.send(ex,"_signal",[]);
  56. })]);
  57. return $1;
  58. },
  59. args: ["aBlock"],
  60. source: "ensure: aBlock\x0a\x09| success |\x0a\x09success := false.\x0a\x09^[self value. success := true. aBlock value]\x0a\x09\x09on: Error\x0a\x09\x09do: [:ex |\x0a\x09\x09\x09success ifFalse: [aBlock value].\x0a\x09\x09\x09ex signal]",
  61. messageSends: ["on:do:", "ifFalse:", "value", "signal"],
  62. referencedClasses: ["Error"]
  63. }),
  64. smalltalk.BlockClosure);
  65. smalltalk.addMethod(
  66. "_new",
  67. smalltalk.method({
  68. selector: "new",
  69. category: 'evaluating',
  70. fn: function (){
  71. var self=this;
  72. return new self();
  73. ;
  74. return self},
  75. args: [],
  76. 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()>",
  77. messageSends: [],
  78. referencedClasses: []
  79. }),
  80. smalltalk.BlockClosure);
  81. smalltalk.addMethod(
  82. "_newValue_",
  83. smalltalk.method({
  84. selector: "newValue:",
  85. category: 'evaluating',
  86. fn: function (anObject){
  87. var self=this;
  88. return new self(anObject);
  89. ;
  90. return self},
  91. args: ["anObject"],
  92. 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)>",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.BlockClosure);
  97. smalltalk.addMethod(
  98. "_newValue_value_",
  99. smalltalk.method({
  100. selector: "newValue:value:",
  101. category: 'evaluating',
  102. fn: function (anObject,anObject2){
  103. var self=this;
  104. return new self(anObject, anObject2);
  105. ;
  106. return self},
  107. args: ["anObject", "anObject2"],
  108. 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)>",
  109. messageSends: [],
  110. referencedClasses: []
  111. }),
  112. smalltalk.BlockClosure);
  113. smalltalk.addMethod(
  114. "_newValue_value_value_",
  115. smalltalk.method({
  116. selector: "newValue:value:value:",
  117. category: 'evaluating',
  118. fn: function (anObject,anObject2,anObject3){
  119. var self=this;
  120. return new self(anObject, anObject2);
  121. ;
  122. return self},
  123. args: ["anObject", "anObject2", "anObject3"],
  124. 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)>",
  125. messageSends: [],
  126. referencedClasses: []
  127. }),
  128. smalltalk.BlockClosure);
  129. smalltalk.addMethod(
  130. "_numArgs",
  131. smalltalk.method({
  132. selector: "numArgs",
  133. category: 'accessing',
  134. fn: function (){
  135. var self=this;
  136. return self.length;
  137. ;
  138. return self},
  139. args: [],
  140. source: "numArgs\x0a\x09<return self.length>",
  141. messageSends: [],
  142. referencedClasses: []
  143. }),
  144. smalltalk.BlockClosure);
  145. smalltalk.addMethod(
  146. "_on_do_",
  147. smalltalk.method({
  148. selector: "on:do:",
  149. category: 'error handling',
  150. fn: function (anErrorClass,aBlock){
  151. var self=this;
  152. var $2,$1;
  153. $1=smalltalk.send(self,"_try_catch_",[self,(function(error){
  154. $2=smalltalk.send(error,"_isKindOf_",[anErrorClass]);
  155. if(smalltalk.assert($2)){
  156. return smalltalk.send(aBlock,"_value_",[error]);
  157. } else {
  158. return smalltalk.send(error,"_signal",[]);
  159. };
  160. })]);
  161. return $1;
  162. },
  163. args: ["anErrorClass", "aBlock"],
  164. source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (error isKindOf: anErrorClass) \x0a\x09 ifTrue: [aBlock value: error]\x0a\x09 ifFalse: [error signal]]",
  165. messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
  166. referencedClasses: []
  167. }),
  168. smalltalk.BlockClosure);
  169. smalltalk.addMethod(
  170. "_timeToRun",
  171. smalltalk.method({
  172. selector: "timeToRun",
  173. category: 'evaluating',
  174. fn: function (){
  175. var self=this;
  176. var $1;
  177. $1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[self]);
  178. return $1;
  179. },
  180. args: [],
  181. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  182. messageSends: ["millisecondsToRun:"],
  183. referencedClasses: ["Date"]
  184. }),
  185. smalltalk.BlockClosure);
  186. smalltalk.addMethod(
  187. "_value",
  188. smalltalk.method({
  189. selector: "value",
  190. category: 'evaluating',
  191. fn: function (){
  192. var self=this;
  193. return self();;
  194. ;
  195. return self},
  196. args: [],
  197. source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
  198. messageSends: [],
  199. referencedClasses: []
  200. }),
  201. smalltalk.BlockClosure);
  202. smalltalk.addMethod(
  203. "_value_",
  204. smalltalk.method({
  205. selector: "value:",
  206. category: 'evaluating',
  207. fn: function (anArg){
  208. var self=this;
  209. return self(anArg);;
  210. ;
  211. return self},
  212. args: ["anArg"],
  213. source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
  214. messageSends: [],
  215. referencedClasses: []
  216. }),
  217. smalltalk.BlockClosure);
  218. smalltalk.addMethod(
  219. "_value_value_",
  220. smalltalk.method({
  221. selector: "value:value:",
  222. category: 'evaluating',
  223. fn: function (firstArg,secondArg){
  224. var self=this;
  225. return self(firstArg, secondArg);;
  226. ;
  227. return self},
  228. args: ["firstArg", "secondArg"],
  229. source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
  230. messageSends: [],
  231. referencedClasses: []
  232. }),
  233. smalltalk.BlockClosure);
  234. smalltalk.addMethod(
  235. "_value_value_value_",
  236. smalltalk.method({
  237. selector: "value:value:value:",
  238. category: 'evaluating',
  239. fn: function (firstArg,secondArg,thirdArg){
  240. var self=this;
  241. return self(firstArg, secondArg, thirdArg);;
  242. ;
  243. return self},
  244. args: ["firstArg", "secondArg", "thirdArg"],
  245. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  246. messageSends: [],
  247. referencedClasses: []
  248. }),
  249. smalltalk.BlockClosure);
  250. smalltalk.addMethod(
  251. "_valueWithInterval_",
  252. smalltalk.method({
  253. selector: "valueWithInterval:",
  254. category: 'timeout/interval',
  255. fn: function (aNumber){
  256. var self=this;
  257. return setInterval(self, aNumber);
  258. ;
  259. return self},
  260. args: ["aNumber"],
  261. source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
  262. messageSends: [],
  263. referencedClasses: []
  264. }),
  265. smalltalk.BlockClosure);
  266. smalltalk.addMethod(
  267. "_valueWithPossibleArguments_",
  268. smalltalk.method({
  269. selector: "valueWithPossibleArguments:",
  270. category: 'evaluating',
  271. fn: function (aCollection){
  272. var self=this;
  273. return self.apply(null, aCollection);;
  274. ;
  275. return self},
  276. args: ["aCollection"],
  277. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  278. messageSends: [],
  279. referencedClasses: []
  280. }),
  281. smalltalk.BlockClosure);
  282. smalltalk.addMethod(
  283. "_valueWithTimeout_",
  284. smalltalk.method({
  285. selector: "valueWithTimeout:",
  286. category: 'timeout/interval',
  287. fn: function (aNumber){
  288. var self=this;
  289. return setTimeout(self, aNumber);
  290. ;
  291. return self},
  292. args: ["aNumber"],
  293. source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
  294. messageSends: [],
  295. referencedClasses: []
  296. }),
  297. smalltalk.BlockClosure);
  298. smalltalk.addMethod(
  299. "_whileFalse",
  300. smalltalk.method({
  301. selector: "whileFalse",
  302. category: 'controlling',
  303. fn: function (){
  304. var self=this;
  305. smalltalk.send(self,"_whileFalse_",[(function(){
  306. })]);
  307. return self},
  308. args: [],
  309. source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
  310. messageSends: ["whileFalse:"],
  311. referencedClasses: []
  312. }),
  313. smalltalk.BlockClosure);
  314. smalltalk.addMethod(
  315. "_whileFalse_",
  316. smalltalk.method({
  317. selector: "whileFalse:",
  318. category: 'controlling',
  319. fn: function (aBlock){
  320. var self=this;
  321. while(!self()) {aBlock()};
  322. ;
  323. return self},
  324. args: ["aBlock"],
  325. source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
  326. messageSends: [],
  327. referencedClasses: []
  328. }),
  329. smalltalk.BlockClosure);
  330. smalltalk.addMethod(
  331. "_whileTrue",
  332. smalltalk.method({
  333. selector: "whileTrue",
  334. category: 'controlling',
  335. fn: function (){
  336. var self=this;
  337. smalltalk.send(self,"_whileTrue_",[(function(){
  338. })]);
  339. return self},
  340. args: [],
  341. source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
  342. messageSends: ["whileTrue:"],
  343. referencedClasses: []
  344. }),
  345. smalltalk.BlockClosure);
  346. smalltalk.addMethod(
  347. "_whileTrue_",
  348. smalltalk.method({
  349. selector: "whileTrue:",
  350. category: 'controlling',
  351. fn: function (aBlock){
  352. var self=this;
  353. while(self()) {aBlock()};
  354. ;
  355. return self},
  356. args: ["aBlock"],
  357. source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
  358. messageSends: [],
  359. referencedClasses: []
  360. }),
  361. smalltalk.BlockClosure);
  362. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel-Methods');
  363. 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"
  364. smalltalk.addMethod(
  365. "_arguments",
  366. smalltalk.method({
  367. selector: "arguments",
  368. category: 'accessing',
  369. fn: function (){
  370. var self=this;
  371. return self.args || [];
  372. ;
  373. return self},
  374. args: [],
  375. source: "arguments\x0a\x09<return self.args || []>",
  376. messageSends: [],
  377. referencedClasses: []
  378. }),
  379. smalltalk.CompiledMethod);
  380. smalltalk.addMethod(
  381. "_category",
  382. smalltalk.method({
  383. selector: "category",
  384. category: 'accessing',
  385. fn: function (){
  386. var self=this;
  387. var $2,$1;
  388. $2=smalltalk.send(self,"_basicAt_",["category"]);
  389. if(($receiver = $2) == nil || $receiver == undefined){
  390. $1="";
  391. } else {
  392. $1=$2;
  393. };
  394. return $1;
  395. },
  396. args: [],
  397. source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
  398. messageSends: ["ifNil:", "basicAt:"],
  399. referencedClasses: []
  400. }),
  401. smalltalk.CompiledMethod);
  402. smalltalk.addMethod(
  403. "_category_",
  404. smalltalk.method({
  405. selector: "category:",
  406. category: 'accessing',
  407. fn: function (aString){
  408. var self=this;
  409. smalltalk.send(self,"_basicAt_put_",["category",aString]);
  410. return self},
  411. args: ["aString"],
  412. source: "category: aString\x0a\x09self basicAt: 'category' put: aString",
  413. messageSends: ["basicAt:put:"],
  414. referencedClasses: []
  415. }),
  416. smalltalk.CompiledMethod);
  417. smalltalk.addMethod(
  418. "_fn",
  419. smalltalk.method({
  420. selector: "fn",
  421. category: 'accessing',
  422. fn: function (){
  423. var self=this;
  424. var $1;
  425. $1=smalltalk.send(self,"_basicAt_",["fn"]);
  426. return $1;
  427. },
  428. args: [],
  429. source: "fn\x0a\x09^self basicAt: 'fn'",
  430. messageSends: ["basicAt:"],
  431. referencedClasses: []
  432. }),
  433. smalltalk.CompiledMethod);
  434. smalltalk.addMethod(
  435. "_fn_",
  436. smalltalk.method({
  437. selector: "fn:",
  438. category: 'accessing',
  439. fn: function (aBlock){
  440. var self=this;
  441. smalltalk.send(self,"_basicAt_put_",["fn",aBlock]);
  442. return self},
  443. args: ["aBlock"],
  444. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  445. messageSends: ["basicAt:put:"],
  446. referencedClasses: []
  447. }),
  448. smalltalk.CompiledMethod);
  449. smalltalk.addMethod(
  450. "_messageSends",
  451. smalltalk.method({
  452. selector: "messageSends",
  453. category: 'accessing',
  454. fn: function (){
  455. var self=this;
  456. var $1;
  457. $1=smalltalk.send(self,"_basicAt_",["messageSends"]);
  458. return $1;
  459. },
  460. args: [],
  461. source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
  462. messageSends: ["basicAt:"],
  463. referencedClasses: []
  464. }),
  465. smalltalk.CompiledMethod);
  466. smalltalk.addMethod(
  467. "_methodClass",
  468. smalltalk.method({
  469. selector: "methodClass",
  470. category: 'accessing',
  471. fn: function (){
  472. var self=this;
  473. var $1;
  474. $1=smalltalk.send(self,"_basicAt_",["methodClass"]);
  475. return $1;
  476. },
  477. args: [],
  478. source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
  479. messageSends: ["basicAt:"],
  480. referencedClasses: []
  481. }),
  482. smalltalk.CompiledMethod);
  483. smalltalk.addMethod(
  484. "_referencedClasses",
  485. smalltalk.method({
  486. selector: "referencedClasses",
  487. category: 'accessing',
  488. fn: function (){
  489. var self=this;
  490. var $1;
  491. $1=smalltalk.send(self,"_basicAt_",["referencedClasses"]);
  492. return $1;
  493. },
  494. args: [],
  495. source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
  496. messageSends: ["basicAt:"],
  497. referencedClasses: []
  498. }),
  499. smalltalk.CompiledMethod);
  500. smalltalk.addMethod(
  501. "_selector",
  502. smalltalk.method({
  503. selector: "selector",
  504. category: 'accessing',
  505. fn: function (){
  506. var self=this;
  507. var $1;
  508. $1=smalltalk.send(self,"_basicAt_",["selector"]);
  509. return $1;
  510. },
  511. args: [],
  512. source: "selector\x0a\x09^self basicAt: 'selector'",
  513. messageSends: ["basicAt:"],
  514. referencedClasses: []
  515. }),
  516. smalltalk.CompiledMethod);
  517. smalltalk.addMethod(
  518. "_selector_",
  519. smalltalk.method({
  520. selector: "selector:",
  521. category: 'accessing',
  522. fn: function (aString){
  523. var self=this;
  524. smalltalk.send(self,"_basicAt_put_",["selector",aString]);
  525. return self},
  526. args: ["aString"],
  527. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  528. messageSends: ["basicAt:put:"],
  529. referencedClasses: []
  530. }),
  531. smalltalk.CompiledMethod);
  532. smalltalk.addMethod(
  533. "_source",
  534. smalltalk.method({
  535. selector: "source",
  536. category: 'accessing',
  537. fn: function (){
  538. var self=this;
  539. var $2,$1;
  540. $2=smalltalk.send(self,"_basicAt_",["source"]);
  541. if(($receiver = $2) == nil || $receiver == undefined){
  542. $1="";
  543. } else {
  544. $1=$2;
  545. };
  546. return $1;
  547. },
  548. args: [],
  549. source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
  550. messageSends: ["ifNil:", "basicAt:"],
  551. referencedClasses: []
  552. }),
  553. smalltalk.CompiledMethod);
  554. smalltalk.addMethod(
  555. "_source_",
  556. smalltalk.method({
  557. selector: "source:",
  558. category: 'accessing',
  559. fn: function (aString){
  560. var self=this;
  561. smalltalk.send(self,"_basicAt_put_",["source",aString]);
  562. return self},
  563. args: ["aString"],
  564. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  565. messageSends: ["basicAt:put:"],
  566. referencedClasses: []
  567. }),
  568. smalltalk.CompiledMethod);
  569. smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
  570. 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:`"
  571. smalltalk.addMethod(
  572. "_arguments",
  573. smalltalk.method({
  574. selector: "arguments",
  575. category: 'accessing',
  576. fn: function (){
  577. var self=this;
  578. return self["@arguments"];
  579. },
  580. args: [],
  581. source: "arguments\x0a\x09^arguments",
  582. messageSends: [],
  583. referencedClasses: []
  584. }),
  585. smalltalk.Message);
  586. smalltalk.addMethod(
  587. "_arguments_",
  588. smalltalk.method({
  589. selector: "arguments:",
  590. category: 'accessing',
  591. fn: function (anArray){
  592. var self=this;
  593. self["@arguments"]=anArray;
  594. return self},
  595. args: ["anArray"],
  596. source: "arguments: anArray\x0a\x09arguments := anArray",
  597. messageSends: [],
  598. referencedClasses: []
  599. }),
  600. smalltalk.Message);
  601. smalltalk.addMethod(
  602. "_printString",
  603. smalltalk.method({
  604. selector: "printString",
  605. category: 'printing',
  606. fn: function (){
  607. var self=this;
  608. var $2,$1;
  609. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  610. smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_printString",[],smalltalk.Object)]);
  611. smalltalk.send(aStream,"_nextPutAll_",["("]);
  612. smalltalk.send(aStream,"_nextPutAll_",[self["@selector"]]);
  613. $2=smalltalk.send(aStream,"_nextPutAll_",[")"]);
  614. return $2;
  615. })]);
  616. return $1;
  617. },
  618. args: [],
  619. source: "printString\x0a\x09^ String streamContents: [:aStream| \x0a \x09\x09\x09\x09aStream \x0a \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a \x09\x09\x09\x09\x09nextPutAll: '(';\x0a \x09\x09\x09\x09\x09nextPutAll: selector;\x0a \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
  620. messageSends: ["streamContents:", "nextPutAll:", "printString"],
  621. referencedClasses: ["String"]
  622. }),
  623. smalltalk.Message);
  624. smalltalk.addMethod(
  625. "_selector",
  626. smalltalk.method({
  627. selector: "selector",
  628. category: 'accessing',
  629. fn: function (){
  630. var self=this;
  631. return self["@selector"];
  632. },
  633. args: [],
  634. source: "selector\x0a\x09^selector",
  635. messageSends: [],
  636. referencedClasses: []
  637. }),
  638. smalltalk.Message);
  639. smalltalk.addMethod(
  640. "_selector_",
  641. smalltalk.method({
  642. selector: "selector:",
  643. category: 'accessing',
  644. fn: function (aString){
  645. var self=this;
  646. self["@selector"]=aString;
  647. return self},
  648. args: ["aString"],
  649. source: "selector: aString\x0a\x09selector := aString",
  650. messageSends: [],
  651. referencedClasses: []
  652. }),
  653. smalltalk.Message);
  654. smalltalk.addMethod(
  655. "_sendTo_",
  656. smalltalk.method({
  657. selector: "sendTo:",
  658. category: 'printing',
  659. fn: function (anObject){
  660. var self=this;
  661. var $1;
  662. $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_send_to_arguments_",[smalltalk.send(self,"_selector",[]),anObject,smalltalk.send(self,"_arguments",[])]);
  663. return $1;
  664. },
  665. args: ["anObject"],
  666. source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
  667. messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
  668. referencedClasses: ["Smalltalk"]
  669. }),
  670. smalltalk.Message);
  671. smalltalk.addMethod(
  672. "_selector_arguments_",
  673. smalltalk.method({
  674. selector: "selector:arguments:",
  675. category: 'instance creation',
  676. fn: function (aString,anArray){
  677. var self=this;
  678. var $2,$3,$1;
  679. $2=smalltalk.send(self,"_new",[]);
  680. smalltalk.send($2,"_selector_",[aString]);
  681. smalltalk.send($2,"_arguments_",[anArray]);
  682. $3=smalltalk.send($2,"_yourself",[]);
  683. $1=$3;
  684. return $1;
  685. },
  686. args: ["aString", "anArray"],
  687. source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  688. messageSends: ["selector:", "new", "arguments:", "yourself"],
  689. referencedClasses: []
  690. }),
  691. smalltalk.Message.klass);
  692. smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
  693. 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 \x0a\x0aCurrent limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block."
  694. smalltalk.addMethod(
  695. "_asString",
  696. smalltalk.method({
  697. selector: "asString",
  698. category: 'accessing',
  699. fn: function (){
  700. var self=this;
  701. var $1;
  702. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_class",[]),"_printString",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(self,"_selector",[])]);
  703. return $1;
  704. },
  705. args: [],
  706. source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
  707. messageSends: [",", "selector", "printString", "class", "receiver"],
  708. referencedClasses: []
  709. }),
  710. smalltalk.MethodContext);
  711. smalltalk.addMethod(
  712. "_home",
  713. smalltalk.method({
  714. selector: "home",
  715. category: 'accessing',
  716. fn: function (){
  717. var self=this;
  718. return self.homeContext;
  719. ;
  720. return self},
  721. args: [],
  722. source: "home\x0a\x09<return self.homeContext>",
  723. messageSends: [],
  724. referencedClasses: []
  725. }),
  726. smalltalk.MethodContext);
  727. smalltalk.addMethod(
  728. "_pc",
  729. smalltalk.method({
  730. selector: "pc",
  731. category: 'accessing',
  732. fn: function (){
  733. var self=this;
  734. return self.pc;
  735. ;
  736. return self},
  737. args: [],
  738. source: "pc\x0a\x09<return self.pc>",
  739. messageSends: [],
  740. referencedClasses: []
  741. }),
  742. smalltalk.MethodContext);
  743. smalltalk.addMethod(
  744. "_printString",
  745. smalltalk.method({
  746. selector: "printString",
  747. category: 'accessing',
  748. fn: function (){
  749. var self=this;
  750. var $1;
  751. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_printString",[],smalltalk.Object),"__comma",["("]),"__comma",[smalltalk.send(self,"_asString",[])]),"__comma",[")"]);
  752. return $1;
  753. },
  754. args: [],
  755. source: "printString\x0a\x09^super printString, '(', self asString, ')'",
  756. messageSends: [",", "asString", "printString"],
  757. referencedClasses: []
  758. }),
  759. smalltalk.MethodContext);
  760. smalltalk.addMethod(
  761. "_receiver",
  762. smalltalk.method({
  763. selector: "receiver",
  764. category: 'accessing',
  765. fn: function (){
  766. var self=this;
  767. return self.receiver;
  768. ;
  769. return self},
  770. args: [],
  771. source: "receiver\x0a\x09<return self.receiver>",
  772. messageSends: [],
  773. referencedClasses: []
  774. }),
  775. smalltalk.MethodContext);
  776. smalltalk.addMethod(
  777. "_selector",
  778. smalltalk.method({
  779. selector: "selector",
  780. category: 'accessing',
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.convertSelector(self.selector);
  784. ;
  785. return self},
  786. args: [],
  787. source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
  788. messageSends: [],
  789. referencedClasses: []
  790. }),
  791. smalltalk.MethodContext);
  792. smalltalk.addMethod(
  793. "_temps",
  794. smalltalk.method({
  795. selector: "temps",
  796. category: 'accessing',
  797. fn: function (){
  798. var self=this;
  799. return self.temps;
  800. ;
  801. return self},
  802. args: [],
  803. source: "temps\x0a\x09<return self.temps>",
  804. messageSends: [],
  805. referencedClasses: []
  806. }),
  807. smalltalk.MethodContext);