Compiler-Core.deploy.js 24 KB

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