2
0

Kernel-Methods.js 22 KB

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