Compiler-Core.deploy.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. smalltalk.addPackage('Compiler-Core');
  2. smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  3. smalltalk.addMethod(
  4. "_codeGeneratorClass",
  5. smalltalk.method({
  6. selector: "codeGeneratorClass",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $2,$1;
  10. $2=self["@codeGeneratorClass"];
  11. if(($receiver = $2) == nil || $receiver == undefined){
  12. $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
  13. } else {
  14. $1=$2;
  15. };
  16. return $1;
  17. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{}, smalltalk.Compiler)})},
  18. messageSends: ["ifNil:"]}),
  19. smalltalk.Compiler);
  20. smalltalk.addMethod(
  21. "_codeGeneratorClass_",
  22. smalltalk.method({
  23. selector: "codeGeneratorClass:",
  24. fn: function (aClass){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) { self["@codeGeneratorClass"]=aClass;
  27. return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass}, smalltalk.Compiler)})},
  28. messageSends: []}),
  29. smalltalk.Compiler);
  30. smalltalk.addMethod(
  31. "_compile_",
  32. smalltalk.method({
  33. selector: "compile:",
  34. fn: function (aString){
  35. var self=this;
  36. return smalltalk.withContext(function($ctx1) { var $1;
  37. $1=_st(self)._compileNode_(_st(self)._parse_(aString));
  38. return $1;
  39. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.Compiler)})},
  40. messageSends: ["compileNode:", "parse:"]}),
  41. smalltalk.Compiler);
  42. smalltalk.addMethod(
  43. "_compile_forClass_",
  44. smalltalk.method({
  45. selector: "compile:forClass:",
  46. fn: function (aString,aClass){
  47. var self=this;
  48. return smalltalk.withContext(function($ctx1) { var $1;
  49. _st(self)._currentClass_(aClass);
  50. _st(self)._source_(aString);
  51. $1=_st(self)._compile_(aString);
  52. return $1;
  53. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass}, smalltalk.Compiler)})},
  54. messageSends: ["currentClass:", "source:", "compile:"]}),
  55. smalltalk.Compiler);
  56. smalltalk.addMethod(
  57. "_compileExpression_",
  58. smalltalk.method({
  59. selector: "compileExpression:",
  60. fn: function (aString){
  61. var self=this;
  62. return smalltalk.withContext(function($ctx1) { var $1;
  63. _st(self)._currentClass_((smalltalk.DoIt || DoIt));
  64. _st(self)._source_(_st(_st("doIt ^[").__comma(aString)).__comma("] value"));
  65. $1=_st(self)._compileNode_(_st(self)._parse_(_st(self)._source()));
  66. return $1;
  67. }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString}, smalltalk.Compiler)})},
  68. messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"]}),
  69. smalltalk.Compiler);
  70. smalltalk.addMethod(
  71. "_compileNode_",
  72. smalltalk.method({
  73. selector: "compileNode:",
  74. fn: function (aNode){
  75. var self=this;
  76. var generator,result;
  77. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  78. generator=_st(_st(self)._codeGeneratorClass())._new();
  79. $1=generator;
  80. _st($1)._source_(_st(self)._source());
  81. $2=_st($1)._currentClass_(_st(self)._currentClass());
  82. result=_st(generator)._compileNode_(aNode);
  83. _st(self)._unknownVariables_([]);
  84. $3=result;
  85. return $3;
  86. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result}, smalltalk.Compiler)})},
  87. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"]}),
  88. smalltalk.Compiler);
  89. smalltalk.addMethod(
  90. "_currentClass",
  91. smalltalk.method({
  92. selector: "currentClass",
  93. fn: function (){
  94. var self=this;
  95. return smalltalk.withContext(function($ctx1) { var $1;
  96. $1=self["@currentClass"];
  97. return $1;
  98. }, function($ctx1) {$ctx1.fill(self,"currentClass",{}, smalltalk.Compiler)})},
  99. messageSends: []}),
  100. smalltalk.Compiler);
  101. smalltalk.addMethod(
  102. "_currentClass_",
  103. smalltalk.method({
  104. selector: "currentClass:",
  105. fn: function (aClass){
  106. var self=this;
  107. return smalltalk.withContext(function($ctx1) { self["@currentClass"]=aClass;
  108. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass}, smalltalk.Compiler)})},
  109. messageSends: []}),
  110. smalltalk.Compiler);
  111. smalltalk.addMethod(
  112. "_eval_",
  113. smalltalk.method({
  114. selector: "eval:",
  115. fn: function (aString){
  116. var self=this;
  117. return smalltalk.withContext(function($ctx1) { return eval(aString);
  118. return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString}, smalltalk.Compiler)})},
  119. messageSends: []}),
  120. smalltalk.Compiler);
  121. smalltalk.addMethod(
  122. "_evaluateExpression_",
  123. smalltalk.method({
  124. selector: "evaluateExpression:",
  125. fn: function (aString){
  126. var self=this;
  127. var result,method;
  128. return smalltalk.withContext(function($ctx1) { var $1;
  129. method=_st(self)._eval_(_st(self)._compileExpression_(aString));
  130. _st(method)._category_("doIt");
  131. _st((smalltalk.DoIt || DoIt))._addCompiledMethod_(method);
  132. result=_st(_st((smalltalk.DoIt || DoIt))._new())._doIt();
  133. _st((smalltalk.DoIt || DoIt))._removeCompiledMethod_(method);
  134. $1=result;
  135. return $1;
  136. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString,result:result,method:method}, smalltalk.Compiler)})},
  137. messageSends: ["eval:", "compileExpression:", "category:", "addCompiledMethod:", "doIt", "new", "removeCompiledMethod:"]}),
  138. smalltalk.Compiler);
  139. smalltalk.addMethod(
  140. "_install_forClass_category_",
  141. smalltalk.method({
  142. selector: "install:forClass:category:",
  143. fn: function (aString,aBehavior,anotherString){
  144. var self=this;
  145. return smalltalk.withContext(function($ctx1) { var $1;
  146. $1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installMethod_forClass_category_(_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
  147. return $1;
  148. }, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString}, smalltalk.Compiler)})},
  149. messageSends: ["installMethod:forClass:category:", "eval:", "compile:forClass:", "new"]}),
  150. smalltalk.Compiler);
  151. smalltalk.addMethod(
  152. "_parse_",
  153. smalltalk.method({
  154. selector: "parse:",
  155. fn: function (aString){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) { var $1;
  158. $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
  159. return $1;
  160. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString}, smalltalk.Compiler)})},
  161. messageSends: ["parse:", "current"]}),
  162. smalltalk.Compiler);
  163. smalltalk.addMethod(
  164. "_parseExpression_",
  165. smalltalk.method({
  166. selector: "parseExpression:",
  167. fn: function (aString){
  168. var self=this;
  169. return smalltalk.withContext(function($ctx1) { var $1;
  170. $1=_st(self)._parse_(_st(_st("doIt ^[").__comma(aString)).__comma("] value"));
  171. return $1;
  172. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString}, smalltalk.Compiler)})},
  173. messageSends: ["parse:", ","]}),
  174. smalltalk.Compiler);
  175. smalltalk.addMethod(
  176. "_recompile_",
  177. smalltalk.method({
  178. selector: "recompile:",
  179. fn: function (aClass){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) { var $1;
  182. _st(_st(aClass)._methodDictionary())._do_((function(each){
  183. return smalltalk.withContext(function($ctx2) { _st(console)._log_(_st(_st(_st(aClass)._name()).__comma(" >> ")).__comma(_st(each)._selector()));
  184. return _st(self)._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
  185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  186. $1=_st(aClass)._isMetaclass();
  187. if(! smalltalk.assert($1)){
  188. _st(self)._recompile_(_st(aClass)._class());
  189. };
  190. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass}, smalltalk.Compiler)})},
  191. messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "ifFalse:", "recompile:", "class", "isMetaclass"]}),
  192. smalltalk.Compiler);
  193. smalltalk.addMethod(
  194. "_recompileAll",
  195. smalltalk.method({
  196. selector: "recompileAll",
  197. fn: function (){
  198. var self=this;
  199. return smalltalk.withContext(function($ctx1) { var $1,$2;
  200. _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes())._do_((function(each){
  201. return smalltalk.withContext(function($ctx2) { $1=(smalltalk.Transcript || Transcript);
  202. _st($1)._show_(each);
  203. $2=_st($1)._cr();
  204. $2;
  205. return _st((function(){
  206. return smalltalk.withContext(function($ctx3) { return _st(self)._recompile_(each);
  207. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((100));
  208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  209. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{}, smalltalk.Compiler)})},
  210. messageSends: ["do:", "show:", "cr", "valueWithTimeout:", "recompile:", "classes", "current"]}),
  211. smalltalk.Compiler);
  212. smalltalk.addMethod(
  213. "_source",
  214. smalltalk.method({
  215. selector: "source",
  216. fn: function (){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) { var $2,$1;
  219. $2=self["@source"];
  220. if(($receiver = $2) == nil || $receiver == undefined){
  221. $1="";
  222. } else {
  223. $1=$2;
  224. };
  225. return $1;
  226. }, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.Compiler)})},
  227. messageSends: ["ifNil:"]}),
  228. smalltalk.Compiler);
  229. smalltalk.addMethod(
  230. "_source_",
  231. smalltalk.method({
  232. selector: "source:",
  233. fn: function (aString){
  234. var self=this;
  235. return smalltalk.withContext(function($ctx1) { self["@source"]=aString;
  236. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.Compiler)})},
  237. messageSends: []}),
  238. smalltalk.Compiler);
  239. smalltalk.addMethod(
  240. "_unknownVariables",
  241. smalltalk.method({
  242. selector: "unknownVariables",
  243. fn: function (){
  244. var self=this;
  245. return smalltalk.withContext(function($ctx1) { var $1;
  246. $1=self["@unknownVariables"];
  247. return $1;
  248. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{}, smalltalk.Compiler)})},
  249. messageSends: []}),
  250. smalltalk.Compiler);
  251. smalltalk.addMethod(
  252. "_unknownVariables_",
  253. smalltalk.method({
  254. selector: "unknownVariables:",
  255. fn: function (aCollection){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) { self["@unknownVariables"]=aCollection;
  258. return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection}, smalltalk.Compiler)})},
  259. messageSends: []}),
  260. smalltalk.Compiler);
  261. smalltalk.addMethod(
  262. "_recompile_",
  263. smalltalk.method({
  264. selector: "recompile:",
  265. fn: function (aClass){
  266. var self=this;
  267. return smalltalk.withContext(function($ctx1) { _st(_st(self)._new())._recompile_(aClass);
  268. return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass}, smalltalk.Compiler.klass)})},
  269. messageSends: ["recompile:", "new"]}),
  270. smalltalk.Compiler.klass);
  271. smalltalk.addMethod(
  272. "_recompileAll",
  273. smalltalk.method({
  274. selector: "recompileAll",
  275. fn: function (){
  276. var self=this;
  277. return smalltalk.withContext(function($ctx1) { _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes())._do_((function(each){
  278. return smalltalk.withContext(function($ctx2) { return _st(self)._recompile_(each);
  279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  280. return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{}, smalltalk.Compiler.klass)})},
  281. messageSends: ["do:", "recompile:", "classes", "current"]}),
  282. smalltalk.Compiler.klass);
  283. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  284. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  285. smalltalk.addMethod(
  286. "_visit_",
  287. smalltalk.method({
  288. selector: "visit:",
  289. fn: function (aNode){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) { var $1;
  292. $1=_st(aNode)._accept_(self);
  293. return $1;
  294. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  295. messageSends: ["accept:"]}),
  296. smalltalk.NodeVisitor);
  297. smalltalk.addMethod(
  298. "_visitAll_",
  299. smalltalk.method({
  300. selector: "visitAll:",
  301. fn: function (aCollection){
  302. var self=this;
  303. return smalltalk.withContext(function($ctx1) { var $1;
  304. $1=_st(aCollection)._collect_((function(each){
  305. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(each);
  306. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  307. return $1;
  308. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection}, smalltalk.NodeVisitor)})},
  309. messageSends: ["collect:", "visit:"]}),
  310. smalltalk.NodeVisitor);
  311. smalltalk.addMethod(
  312. "_visitAssignmentNode_",
  313. smalltalk.method({
  314. selector: "visitAssignmentNode:",
  315. fn: function (aNode){
  316. var self=this;
  317. return smalltalk.withContext(function($ctx1) { var $1;
  318. $1=_st(self)._visitNode_(aNode);
  319. return $1;
  320. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  321. messageSends: ["visitNode:"]}),
  322. smalltalk.NodeVisitor);
  323. smalltalk.addMethod(
  324. "_visitBlockNode_",
  325. smalltalk.method({
  326. selector: "visitBlockNode:",
  327. fn: function (aNode){
  328. var self=this;
  329. return smalltalk.withContext(function($ctx1) { var $1;
  330. $1=_st(self)._visitNode_(aNode);
  331. return $1;
  332. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  333. messageSends: ["visitNode:"]}),
  334. smalltalk.NodeVisitor);
  335. smalltalk.addMethod(
  336. "_visitBlockSequenceNode_",
  337. smalltalk.method({
  338. selector: "visitBlockSequenceNode:",
  339. fn: function (aNode){
  340. var self=this;
  341. return smalltalk.withContext(function($ctx1) { var $1;
  342. $1=_st(self)._visitSequenceNode_(aNode);
  343. return $1;
  344. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  345. messageSends: ["visitSequenceNode:"]}),
  346. smalltalk.NodeVisitor);
  347. smalltalk.addMethod(
  348. "_visitCascadeNode_",
  349. smalltalk.method({
  350. selector: "visitCascadeNode:",
  351. fn: function (aNode){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) { var $1;
  354. $1=_st(self)._visitNode_(aNode);
  355. return $1;
  356. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  357. messageSends: ["visitNode:"]}),
  358. smalltalk.NodeVisitor);
  359. smalltalk.addMethod(
  360. "_visitClassReferenceNode_",
  361. smalltalk.method({
  362. selector: "visitClassReferenceNode:",
  363. fn: function (aNode){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) { var $1;
  366. $1=_st(self)._visitVariableNode_(aNode);
  367. return $1;
  368. }, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  369. messageSends: ["visitVariableNode:"]}),
  370. smalltalk.NodeVisitor);
  371. smalltalk.addMethod(
  372. "_visitDynamicArrayNode_",
  373. smalltalk.method({
  374. selector: "visitDynamicArrayNode:",
  375. fn: function (aNode){
  376. var self=this;
  377. return smalltalk.withContext(function($ctx1) { var $1;
  378. $1=_st(self)._visitNode_(aNode);
  379. return $1;
  380. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  381. messageSends: ["visitNode:"]}),
  382. smalltalk.NodeVisitor);
  383. smalltalk.addMethod(
  384. "_visitDynamicDictionaryNode_",
  385. smalltalk.method({
  386. selector: "visitDynamicDictionaryNode:",
  387. fn: function (aNode){
  388. var self=this;
  389. return smalltalk.withContext(function($ctx1) { var $1;
  390. $1=_st(self)._visitNode_(aNode);
  391. return $1;
  392. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  393. messageSends: ["visitNode:"]}),
  394. smalltalk.NodeVisitor);
  395. smalltalk.addMethod(
  396. "_visitJSStatementNode_",
  397. smalltalk.method({
  398. selector: "visitJSStatementNode:",
  399. fn: function (aNode){
  400. var self=this;
  401. return smalltalk.withContext(function($ctx1) { var $1;
  402. $1=_st(self)._visitNode_(aNode);
  403. return $1;
  404. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  405. messageSends: ["visitNode:"]}),
  406. smalltalk.NodeVisitor);
  407. smalltalk.addMethod(
  408. "_visitMethodNode_",
  409. smalltalk.method({
  410. selector: "visitMethodNode:",
  411. fn: function (aNode){
  412. var self=this;
  413. return smalltalk.withContext(function($ctx1) { var $1;
  414. $1=_st(self)._visitNode_(aNode);
  415. return $1;
  416. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  417. messageSends: ["visitNode:"]}),
  418. smalltalk.NodeVisitor);
  419. smalltalk.addMethod(
  420. "_visitNode_",
  421. smalltalk.method({
  422. selector: "visitNode:",
  423. fn: function (aNode){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) { var $1;
  426. $1=_st(self)._visitAll_(_st(aNode)._nodes());
  427. return $1;
  428. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  429. messageSends: ["visitAll:", "nodes"]}),
  430. smalltalk.NodeVisitor);
  431. smalltalk.addMethod(
  432. "_visitReturnNode_",
  433. smalltalk.method({
  434. selector: "visitReturnNode:",
  435. fn: function (aNode){
  436. var self=this;
  437. return smalltalk.withContext(function($ctx1) { var $1;
  438. $1=_st(self)._visitNode_(aNode);
  439. return $1;
  440. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  441. messageSends: ["visitNode:"]}),
  442. smalltalk.NodeVisitor);
  443. smalltalk.addMethod(
  444. "_visitSendNode_",
  445. smalltalk.method({
  446. selector: "visitSendNode:",
  447. fn: function (aNode){
  448. var self=this;
  449. return smalltalk.withContext(function($ctx1) { var $1;
  450. $1=_st(self)._visitNode_(aNode);
  451. return $1;
  452. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  453. messageSends: ["visitNode:"]}),
  454. smalltalk.NodeVisitor);
  455. smalltalk.addMethod(
  456. "_visitSequenceNode_",
  457. smalltalk.method({
  458. selector: "visitSequenceNode:",
  459. fn: function (aNode){
  460. var self=this;
  461. return smalltalk.withContext(function($ctx1) { var $1;
  462. $1=_st(self)._visitNode_(aNode);
  463. return $1;
  464. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  465. messageSends: ["visitNode:"]}),
  466. smalltalk.NodeVisitor);
  467. smalltalk.addMethod(
  468. "_visitValueNode_",
  469. smalltalk.method({
  470. selector: "visitValueNode:",
  471. fn: function (aNode){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) { var $1;
  474. $1=_st(self)._visitNode_(aNode);
  475. return $1;
  476. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  477. messageSends: ["visitNode:"]}),
  478. smalltalk.NodeVisitor);
  479. smalltalk.addMethod(
  480. "_visitVariableNode_",
  481. smalltalk.method({
  482. selector: "visitVariableNode:",
  483. fn: function (aNode){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) { var $1;
  486. $1=_st(self)._visitNode_(aNode);
  487. return $1;
  488. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
  489. messageSends: ["visitNode:"]}),
  490. smalltalk.NodeVisitor);
  491. smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler-Core');
  492. smalltalk.addMethod(
  493. "_classNameFor_",
  494. smalltalk.method({
  495. selector: "classNameFor:",
  496. fn: function (aClass){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  499. $2=_st(aClass)._isMetaclass();
  500. if(smalltalk.assert($2)){
  501. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  502. } else {
  503. $3=_st(aClass)._isNil();
  504. if(smalltalk.assert($3)){
  505. $1="nil";
  506. } else {
  507. $1=_st(aClass)._name();
  508. };
  509. };
  510. return $1;
  511. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass}, smalltalk.AbstractCodeGenerator)})},
  512. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  513. smalltalk.AbstractCodeGenerator);
  514. smalltalk.addMethod(
  515. "_compileNode_",
  516. smalltalk.method({
  517. selector: "compileNode:",
  518. fn: function (aNode){
  519. var self=this;
  520. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  521. return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode}, smalltalk.AbstractCodeGenerator)})},
  522. messageSends: ["subclassResponsibility"]}),
  523. smalltalk.AbstractCodeGenerator);
  524. smalltalk.addMethod(
  525. "_currentClass",
  526. smalltalk.method({
  527. selector: "currentClass",
  528. fn: function (){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) { var $1;
  531. $1=self["@currentClass"];
  532. return $1;
  533. }, function($ctx1) {$ctx1.fill(self,"currentClass",{}, smalltalk.AbstractCodeGenerator)})},
  534. messageSends: []}),
  535. smalltalk.AbstractCodeGenerator);
  536. smalltalk.addMethod(
  537. "_currentClass_",
  538. smalltalk.method({
  539. selector: "currentClass:",
  540. fn: function (aClass){
  541. var self=this;
  542. return smalltalk.withContext(function($ctx1) { self["@currentClass"]=aClass;
  543. return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass}, smalltalk.AbstractCodeGenerator)})},
  544. messageSends: []}),
  545. smalltalk.AbstractCodeGenerator);
  546. smalltalk.addMethod(
  547. "_pseudoVariables",
  548. smalltalk.method({
  549. selector: "pseudoVariables",
  550. fn: function (){
  551. var self=this;
  552. return smalltalk.withContext(function($ctx1) { return ["self", "super", "true", "false", "nil", "thisContext"];
  553. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{}, smalltalk.AbstractCodeGenerator)})},
  554. messageSends: []}),
  555. smalltalk.AbstractCodeGenerator);
  556. smalltalk.addMethod(
  557. "_safeVariableNameFor_",
  558. smalltalk.method({
  559. selector: "safeVariableNameFor:",
  560. fn: function (aString){
  561. var self=this;
  562. return smalltalk.withContext(function($ctx1) { var $2,$1;
  563. $2=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._reservedWords())._includes_(aString);
  564. if(smalltalk.assert($2)){
  565. $1=_st(aString).__comma("_");
  566. } else {
  567. $1=aString;
  568. };
  569. return $1;
  570. }, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString}, smalltalk.AbstractCodeGenerator)})},
  571. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"]}),
  572. smalltalk.AbstractCodeGenerator);
  573. smalltalk.addMethod(
  574. "_source",
  575. smalltalk.method({
  576. selector: "source",
  577. fn: function (){
  578. var self=this;
  579. return smalltalk.withContext(function($ctx1) { var $2,$1;
  580. $2=self["@source"];
  581. if(($receiver = $2) == nil || $receiver == undefined){
  582. $1="";
  583. } else {
  584. $1=$2;
  585. };
  586. return $1;
  587. }, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.AbstractCodeGenerator)})},
  588. messageSends: ["ifNil:"]}),
  589. smalltalk.AbstractCodeGenerator);
  590. smalltalk.addMethod(
  591. "_source_",
  592. smalltalk.method({
  593. selector: "source:",
  594. fn: function (aString){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) { self["@source"]=aString;
  597. return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.AbstractCodeGenerator)})},
  598. messageSends: []}),
  599. smalltalk.AbstractCodeGenerator);
  600. smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
  601. smalltalk.addMethod(
  602. "_compileNode_",
  603. smalltalk.method({
  604. selector: "compileNode:",
  605. fn: function (aNode){
  606. var self=this;
  607. var ir,stream;
  608. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  609. _st(_st(self)._semanticAnalyzer())._visit_(aNode);
  610. ir=_st(_st(self)._translator())._visit_(aNode);
  611. $2=_st(self)._irTranslator();
  612. _st($2)._visit_(ir);
  613. $3=_st($2)._contents();
  614. $1=$3;
  615. return $1;
  616. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream}, smalltalk.CodeGenerator)})},
  617. messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"]}),
  618. smalltalk.CodeGenerator);
  619. smalltalk.addMethod(
  620. "_irTranslator",
  621. smalltalk.method({
  622. selector: "irTranslator",
  623. fn: function (){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) { var $1;
  626. $1=_st((smalltalk.IRJSTranslator || IRJSTranslator))._new();
  627. return $1;
  628. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{}, smalltalk.CodeGenerator)})},
  629. messageSends: ["new"]}),
  630. smalltalk.CodeGenerator);
  631. smalltalk.addMethod(
  632. "_semanticAnalyzer",
  633. smalltalk.method({
  634. selector: "semanticAnalyzer",
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) { var $1;
  638. $1=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(_st(self)._currentClass());
  639. return $1;
  640. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{}, smalltalk.CodeGenerator)})},
  641. messageSends: ["on:", "currentClass"]}),
  642. smalltalk.CodeGenerator);
  643. smalltalk.addMethod(
  644. "_translator",
  645. smalltalk.method({
  646. selector: "translator",
  647. fn: function (){
  648. var self=this;
  649. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  650. $2=_st((smalltalk.IRASTTranslator || IRASTTranslator))._new();
  651. _st($2)._source_(_st(self)._source());
  652. _st($2)._theClass_(_st(self)._currentClass());
  653. $3=_st($2)._yourself();
  654. $1=$3;
  655. return $1;
  656. }, function($ctx1) {$ctx1.fill(self,"translator",{}, smalltalk.CodeGenerator)})},
  657. messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"]}),
  658. smalltalk.CodeGenerator);