1
0

Compiler-Core.deploy.js 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561
  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. var $1;
  10. if(($receiver = self["@codeGeneratorClass"]) == nil || $receiver == undefined){
  11. $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
  12. } else {
  13. $1=self["@codeGeneratorClass"];
  14. };
  15. return $1;
  16. }
  17. }),
  18. smalltalk.Compiler);
  19. smalltalk.addMethod(
  20. "_codeGeneratorClass_",
  21. smalltalk.method({
  22. selector: "codeGeneratorClass:",
  23. fn: function (aClass){
  24. var self=this;
  25. self["@codeGeneratorClass"]=aClass;
  26. return self}
  27. }),
  28. smalltalk.Compiler);
  29. smalltalk.addMethod(
  30. "_compile_",
  31. smalltalk.method({
  32. selector: "compile:",
  33. fn: function (aString){
  34. var self=this;
  35. var $1;
  36. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[aString])]);
  37. return $1;
  38. }
  39. }),
  40. smalltalk.Compiler);
  41. smalltalk.addMethod(
  42. "_compile_forClass_",
  43. smalltalk.method({
  44. selector: "compile:forClass:",
  45. fn: function (aString,aClass){
  46. var self=this;
  47. var $1;
  48. smalltalk.send(self,"_currentClass_",[aClass]);
  49. smalltalk.send(self,"_source_",[aString]);
  50. $1=smalltalk.send(self,"_compile_",[aString]);
  51. return $1;
  52. }
  53. }),
  54. smalltalk.Compiler);
  55. smalltalk.addMethod(
  56. "_compileExpression_",
  57. smalltalk.method({
  58. selector: "compileExpression:",
  59. fn: function (aString){
  60. var self=this;
  61. var $1;
  62. smalltalk.send(self,"_currentClass_",[(smalltalk.DoIt || DoIt)]);
  63. smalltalk.send(self,"_source_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  64. $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[smalltalk.send(self,"_source",[])])]);
  65. return $1;
  66. }
  67. }),
  68. smalltalk.Compiler);
  69. smalltalk.addMethod(
  70. "_compileNode_",
  71. smalltalk.method({
  72. selector: "compileNode:",
  73. fn: function (aNode){
  74. var self=this;
  75. var $1;
  76. var generator;
  77. var result;
  78. generator=smalltalk.send(smalltalk.send(self,"_codeGeneratorClass",[]),"_new",[]);
  79. smalltalk.send(generator,"_source_",[smalltalk.send(self,"_source",[])]);
  80. $1=smalltalk.send(generator,"_currentClass_",[smalltalk.send(self,"_currentClass",[])]);
  81. result=smalltalk.send(generator,"_compileNode_",[aNode]);
  82. smalltalk.send(self,"_unknownVariables_",[[]]);
  83. return result;
  84. }
  85. }),
  86. smalltalk.Compiler);
  87. smalltalk.addMethod(
  88. "_currentClass",
  89. smalltalk.method({
  90. selector: "currentClass",
  91. fn: function (){
  92. var self=this;
  93. return self["@currentClass"];
  94. }
  95. }),
  96. smalltalk.Compiler);
  97. smalltalk.addMethod(
  98. "_currentClass_",
  99. smalltalk.method({
  100. selector: "currentClass:",
  101. fn: function (aClass){
  102. var self=this;
  103. self["@currentClass"]=aClass;
  104. return self}
  105. }),
  106. smalltalk.Compiler);
  107. smalltalk.addMethod(
  108. "_eval_",
  109. smalltalk.method({
  110. selector: "eval:",
  111. fn: function (aString){
  112. var self=this;
  113. return eval(aString);
  114. ;
  115. return self}
  116. }),
  117. smalltalk.Compiler);
  118. smalltalk.addMethod(
  119. "_evaluateExpression_",
  120. smalltalk.method({
  121. selector: "evaluateExpression:",
  122. fn: function (aString){
  123. var self=this;
  124. var result;
  125. smalltalk.send((smalltalk.DoIt || DoIt),"_addCompiledMethod_",[smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compileExpression_",[aString])])]);
  126. result=smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]),"_doIt",[]);
  127. smalltalk.send((smalltalk.DoIt || DoIt),"_removeCompiledMethod_",[smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_methodDictionary",[]),"_at_",["doIt"])]);
  128. return result;
  129. }
  130. }),
  131. smalltalk.Compiler);
  132. smalltalk.addMethod(
  133. "_install_forClass_category_",
  134. smalltalk.method({
  135. selector: "install:forClass:category:",
  136. fn: function (aString,aBehavior,anotherString){
  137. var self=this;
  138. var compiled;
  139. compiled=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compile_forClass_",[aString,aBehavior])]);
  140. smalltalk.send(compiled,"_category_",[anotherString]);
  141. smalltalk.send(aBehavior,"_addCompiledMethod_",[compiled]);
  142. return compiled;
  143. }
  144. }),
  145. smalltalk.Compiler);
  146. smalltalk.addMethod(
  147. "_parse_",
  148. smalltalk.method({
  149. selector: "parse:",
  150. fn: function (aString){
  151. var self=this;
  152. var $1;
  153. $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_parse_",[aString]);
  154. return $1;
  155. }
  156. }),
  157. smalltalk.Compiler);
  158. smalltalk.addMethod(
  159. "_parseExpression_",
  160. smalltalk.method({
  161. selector: "parseExpression:",
  162. fn: function (aString){
  163. var self=this;
  164. var $1;
  165. $1=smalltalk.send(self,"_parse_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
  166. return $1;
  167. }
  168. }),
  169. smalltalk.Compiler);
  170. smalltalk.addMethod(
  171. "_recompile_",
  172. smalltalk.method({
  173. selector: "recompile:",
  174. fn: function (aClass){
  175. var self=this;
  176. var $1;
  177. smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_do_",[(function(each){
  178. smalltalk.send(console,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(each,"_selector",[])])]);
  179. return smalltalk.send(self,"_install_forClass_category_",[smalltalk.send(each,"_source",[]),aClass,smalltalk.send(each,"_category",[])]);
  180. })]);
  181. smalltalk.send(self,"_setupClass_",[aClass]);
  182. $1=smalltalk.send(aClass,"_isMetaclass",[]);
  183. if(! smalltalk.assert($1)){
  184. smalltalk.send(self,"_recompile_",[smalltalk.send(aClass,"_class",[])]);
  185. };
  186. return self}
  187. }),
  188. smalltalk.Compiler);
  189. smalltalk.addMethod(
  190. "_recompileAll",
  191. smalltalk.method({
  192. selector: "recompileAll",
  193. fn: function (){
  194. var self=this;
  195. var $1;
  196. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  197. smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[each]);
  198. $1=smalltalk.send((smalltalk.Transcript || Transcript),"_cr",[]);
  199. $1;
  200. return smalltalk.send((function(){
  201. return smalltalk.send(self,"_recompile_",[each]);
  202. }),"_valueWithTimeout_",[(100)]);
  203. })]);
  204. return self}
  205. }),
  206. smalltalk.Compiler);
  207. smalltalk.addMethod(
  208. "_setupClass_",
  209. smalltalk.method({
  210. selector: "setupClass:",
  211. fn: function (aClass){
  212. var self=this;
  213. smalltalk.init(aClass);
  214. ;
  215. return self}
  216. }),
  217. smalltalk.Compiler);
  218. smalltalk.addMethod(
  219. "_source",
  220. smalltalk.method({
  221. selector: "source",
  222. fn: function (){
  223. var self=this;
  224. var $1;
  225. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  226. $1="";
  227. } else {
  228. $1=self["@source"];
  229. };
  230. return $1;
  231. }
  232. }),
  233. smalltalk.Compiler);
  234. smalltalk.addMethod(
  235. "_source_",
  236. smalltalk.method({
  237. selector: "source:",
  238. fn: function (aString){
  239. var self=this;
  240. self["@source"]=aString;
  241. return self}
  242. }),
  243. smalltalk.Compiler);
  244. smalltalk.addMethod(
  245. "_unknownVariables",
  246. smalltalk.method({
  247. selector: "unknownVariables",
  248. fn: function (){
  249. var self=this;
  250. return self["@unknownVariables"];
  251. }
  252. }),
  253. smalltalk.Compiler);
  254. smalltalk.addMethod(
  255. "_unknownVariables_",
  256. smalltalk.method({
  257. selector: "unknownVariables:",
  258. fn: function (aCollection){
  259. var self=this;
  260. self["@unknownVariables"]=aCollection;
  261. return self}
  262. }),
  263. smalltalk.Compiler);
  264. smalltalk.addMethod(
  265. "_recompile_",
  266. smalltalk.method({
  267. selector: "recompile:",
  268. fn: function (aClass){
  269. var self=this;
  270. smalltalk.send(smalltalk.send(self,"_new",[]),"_recompile_",[aClass]);
  271. return self}
  272. }),
  273. smalltalk.Compiler.klass);
  274. smalltalk.addMethod(
  275. "_recompileAll",
  276. smalltalk.method({
  277. selector: "recompileAll",
  278. fn: function (){
  279. var self=this;
  280. smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
  281. return smalltalk.send(self,"_recompile_",[each]);
  282. })]);
  283. return self}
  284. }),
  285. smalltalk.Compiler.klass);
  286. smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
  287. smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
  288. smalltalk.addMethod(
  289. "_visit_",
  290. smalltalk.method({
  291. selector: "visit:",
  292. fn: function (aNode){
  293. var self=this;
  294. var $1;
  295. $1=smalltalk.send(aNode,"_accept_",[self]);
  296. return $1;
  297. }
  298. }),
  299. smalltalk.NodeVisitor);
  300. smalltalk.addMethod(
  301. "_visitAll_",
  302. smalltalk.method({
  303. selector: "visitAll:",
  304. fn: function (aCollection){
  305. var self=this;
  306. var $1;
  307. $1=smalltalk.send(aCollection,"_do_",[(function(each){
  308. return smalltalk.send(self,"_visit_",[each]);
  309. })]);
  310. return $1;
  311. }
  312. }),
  313. smalltalk.NodeVisitor);
  314. smalltalk.addMethod(
  315. "_visitAssignmentNode_",
  316. smalltalk.method({
  317. selector: "visitAssignmentNode:",
  318. fn: function (aNode){
  319. var self=this;
  320. var $1;
  321. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  322. return $1;
  323. }
  324. }),
  325. smalltalk.NodeVisitor);
  326. smalltalk.addMethod(
  327. "_visitBlockNode_",
  328. smalltalk.method({
  329. selector: "visitBlockNode:",
  330. fn: function (aNode){
  331. var self=this;
  332. var $1;
  333. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  334. return $1;
  335. }
  336. }),
  337. smalltalk.NodeVisitor);
  338. smalltalk.addMethod(
  339. "_visitBlockSequenceNode_",
  340. smalltalk.method({
  341. selector: "visitBlockSequenceNode:",
  342. fn: function (aNode){
  343. var self=this;
  344. var $1;
  345. $1=smalltalk.send(self,"_visitSequenceNode_",[aNode]);
  346. return $1;
  347. }
  348. }),
  349. smalltalk.NodeVisitor);
  350. smalltalk.addMethod(
  351. "_visitCascadeNode_",
  352. smalltalk.method({
  353. selector: "visitCascadeNode:",
  354. fn: function (aNode){
  355. var self=this;
  356. var $1;
  357. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  358. return $1;
  359. }
  360. }),
  361. smalltalk.NodeVisitor);
  362. smalltalk.addMethod(
  363. "_visitClassReferenceNode_",
  364. smalltalk.method({
  365. selector: "visitClassReferenceNode:",
  366. fn: function (aNode){
  367. var self=this;
  368. var $1;
  369. $1=smalltalk.send(self,"_visitVariableNode_",[aNode]);
  370. return $1;
  371. }
  372. }),
  373. smalltalk.NodeVisitor);
  374. smalltalk.addMethod(
  375. "_visitDynamicArrayNode_",
  376. smalltalk.method({
  377. selector: "visitDynamicArrayNode:",
  378. fn: function (aNode){
  379. var self=this;
  380. var $1;
  381. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  382. return $1;
  383. }
  384. }),
  385. smalltalk.NodeVisitor);
  386. smalltalk.addMethod(
  387. "_visitDynamicDictionaryNode_",
  388. smalltalk.method({
  389. selector: "visitDynamicDictionaryNode:",
  390. fn: function (aNode){
  391. var self=this;
  392. var $1;
  393. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  394. return $1;
  395. }
  396. }),
  397. smalltalk.NodeVisitor);
  398. smalltalk.addMethod(
  399. "_visitJSStatementNode_",
  400. smalltalk.method({
  401. selector: "visitJSStatementNode:",
  402. fn: function (aNode){
  403. var self=this;
  404. var $1;
  405. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  406. return $1;
  407. }
  408. }),
  409. smalltalk.NodeVisitor);
  410. smalltalk.addMethod(
  411. "_visitMethodNode_",
  412. smalltalk.method({
  413. selector: "visitMethodNode:",
  414. fn: function (aNode){
  415. var self=this;
  416. var $1;
  417. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  418. return $1;
  419. }
  420. }),
  421. smalltalk.NodeVisitor);
  422. smalltalk.addMethod(
  423. "_visitNode_",
  424. smalltalk.method({
  425. selector: "visitNode:",
  426. fn: function (aNode){
  427. var self=this;
  428. var $1;
  429. $1=smalltalk.send(self,"_visitAll_",[smalltalk.send(aNode,"_nodes",[])]);
  430. return $1;
  431. }
  432. }),
  433. smalltalk.NodeVisitor);
  434. smalltalk.addMethod(
  435. "_visitReturnNode_",
  436. smalltalk.method({
  437. selector: "visitReturnNode:",
  438. fn: function (aNode){
  439. var self=this;
  440. var $1;
  441. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  442. return $1;
  443. }
  444. }),
  445. smalltalk.NodeVisitor);
  446. smalltalk.addMethod(
  447. "_visitSendNode_",
  448. smalltalk.method({
  449. selector: "visitSendNode:",
  450. fn: function (aNode){
  451. var self=this;
  452. var $1;
  453. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  454. return $1;
  455. }
  456. }),
  457. smalltalk.NodeVisitor);
  458. smalltalk.addMethod(
  459. "_visitSequenceNode_",
  460. smalltalk.method({
  461. selector: "visitSequenceNode:",
  462. fn: function (aNode){
  463. var self=this;
  464. var $1;
  465. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  466. return $1;
  467. }
  468. }),
  469. smalltalk.NodeVisitor);
  470. smalltalk.addMethod(
  471. "_visitValueNode_",
  472. smalltalk.method({
  473. selector: "visitValueNode:",
  474. fn: function (aNode){
  475. var self=this;
  476. var $1;
  477. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  478. return $1;
  479. }
  480. }),
  481. smalltalk.NodeVisitor);
  482. smalltalk.addMethod(
  483. "_visitVariableNode_",
  484. smalltalk.method({
  485. selector: "visitVariableNode:",
  486. fn: function (aNode){
  487. var self=this;
  488. var $1;
  489. $1=smalltalk.send(self,"_visitNode_",[aNode]);
  490. return $1;
  491. }
  492. }),
  493. smalltalk.NodeVisitor);
  494. smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler-Core');
  495. smalltalk.addMethod(
  496. "_classNameFor_",
  497. smalltalk.method({
  498. selector: "classNameFor:",
  499. fn: function (aClass){
  500. var self=this;
  501. var $2,$3,$1;
  502. $2=smalltalk.send(aClass,"_isMetaclass",[]);
  503. if(smalltalk.assert($2)){
  504. $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
  505. } else {
  506. $3=smalltalk.send(aClass,"_isNil",[]);
  507. if(smalltalk.assert($3)){
  508. $1="nil";
  509. } else {
  510. $1=smalltalk.send(aClass,"_name",[]);
  511. };
  512. };
  513. return $1;
  514. }
  515. }),
  516. smalltalk.AbstractCodeGenerator);
  517. smalltalk.addMethod(
  518. "_compileNode_",
  519. smalltalk.method({
  520. selector: "compileNode:",
  521. fn: function (aNode){
  522. var self=this;
  523. smalltalk.send(self,"_subclassResponsibility",[]);
  524. return self}
  525. }),
  526. smalltalk.AbstractCodeGenerator);
  527. smalltalk.addMethod(
  528. "_currentClass",
  529. smalltalk.method({
  530. selector: "currentClass",
  531. fn: function (){
  532. var self=this;
  533. return self["@currentClass"];
  534. }
  535. }),
  536. smalltalk.AbstractCodeGenerator);
  537. smalltalk.addMethod(
  538. "_currentClass_",
  539. smalltalk.method({
  540. selector: "currentClass:",
  541. fn: function (aClass){
  542. var self=this;
  543. self["@currentClass"]=aClass;
  544. return self}
  545. }),
  546. smalltalk.AbstractCodeGenerator);
  547. smalltalk.addMethod(
  548. "_pseudoVariables",
  549. smalltalk.method({
  550. selector: "pseudoVariables",
  551. fn: function (){
  552. var self=this;
  553. return ["self", "super", "true", "false", "nil", "thisContext"];
  554. }
  555. }),
  556. smalltalk.AbstractCodeGenerator);
  557. smalltalk.addMethod(
  558. "_safeVariableNameFor_",
  559. smalltalk.method({
  560. selector: "safeVariableNameFor:",
  561. fn: function (aString){
  562. var self=this;
  563. var $2,$1;
  564. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[aString]);
  565. if(smalltalk.assert($2)){
  566. $1=smalltalk.send(aString,"__comma",["_"]);
  567. } else {
  568. $1=aString;
  569. };
  570. return $1;
  571. }
  572. }),
  573. smalltalk.AbstractCodeGenerator);
  574. smalltalk.addMethod(
  575. "_source",
  576. smalltalk.method({
  577. selector: "source",
  578. fn: function (){
  579. var self=this;
  580. var $1;
  581. if(($receiver = self["@source"]) == nil || $receiver == undefined){
  582. $1="";
  583. } else {
  584. $1=self["@source"];
  585. };
  586. return $1;
  587. }
  588. }),
  589. smalltalk.AbstractCodeGenerator);
  590. smalltalk.addMethod(
  591. "_source_",
  592. smalltalk.method({
  593. selector: "source:",
  594. fn: function (aString){
  595. var self=this;
  596. self["@source"]=aString;
  597. return self}
  598. }),
  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 $2,$3,$1;
  608. var ir;
  609. var stream;
  610. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  611. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  612. $2=smalltalk.send(self,"_irTranslator",[]);
  613. smalltalk.send($2,"_visit_",[ir]);
  614. $3=smalltalk.send($2,"_contents",[]);
  615. $1=$3;
  616. return $1;
  617. }
  618. }),
  619. smalltalk.CodeGenerator);
  620. smalltalk.addMethod(
  621. "_irTranslator",
  622. smalltalk.method({
  623. selector: "irTranslator",
  624. fn: function (){
  625. var self=this;
  626. var $1;
  627. $1=smalltalk.send((smalltalk.IRJSTranslator || IRJSTranslator),"_new",[]);
  628. return $1;
  629. }
  630. }),
  631. smalltalk.CodeGenerator);
  632. smalltalk.addMethod(
  633. "_semanticAnalyzer",
  634. smalltalk.method({
  635. selector: "semanticAnalyzer",
  636. fn: function (){
  637. var self=this;
  638. var $1;
  639. $1=smalltalk.send((smalltalk.SemanticAnalyzer || SemanticAnalyzer),"_on_",[smalltalk.send(self,"_currentClass",[])]);
  640. return $1;
  641. }
  642. }),
  643. smalltalk.CodeGenerator);
  644. smalltalk.addMethod(
  645. "_translator",
  646. smalltalk.method({
  647. selector: "translator",
  648. fn: function (){
  649. var self=this;
  650. var $2,$3,$1;
  651. $2=smalltalk.send((smalltalk.IRASTTranslator || IRASTTranslator),"_new",[]);
  652. smalltalk.send($2,"_source_",[smalltalk.send(self,"_source",[])]);
  653. smalltalk.send($2,"_theClass_",[smalltalk.send(self,"_currentClass",[])]);
  654. $3=smalltalk.send($2,"_yourself",[]);
  655. $1=$3;
  656. return $1;
  657. }
  658. }),
  659. smalltalk.CodeGenerator);
  660. smalltalk.addClass('FunCodeGenerator', smalltalk.AbstractCodeGenerator, ['stream', 'nestedBlocks', 'earlyReturn', 'currentSelector', 'unknownVariables', 'tempVariables', 'messageSends', 'referencedClasses', 'classReferenced', 'argVariables'], 'Compiler-Core');
  661. smalltalk.addMethod(
  662. "_argVariables",
  663. smalltalk.method({
  664. selector: "argVariables",
  665. fn: function (){
  666. var self=this;
  667. var $1;
  668. $1=smalltalk.send(self["@argVariables"],"_copy",[]);
  669. return $1;
  670. }
  671. }),
  672. smalltalk.FunCodeGenerator);
  673. smalltalk.addMethod(
  674. "_checkClass_for_",
  675. smalltalk.method({
  676. selector: "checkClass:for:",
  677. fn: function (aClassName,receiver){
  678. var self=this;
  679. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("((($receiver = ","__comma",[receiver]),"__comma",[").klass === smalltalk."]),"__comma",[aClassName]),"__comma",[") ? "])]);
  680. return self}
  681. }),
  682. smalltalk.FunCodeGenerator);
  683. smalltalk.addMethod(
  684. "_compileNode_",
  685. smalltalk.method({
  686. selector: "compileNode:",
  687. fn: function (aNode){
  688. var self=this;
  689. var $1;
  690. self["@stream"]=smalltalk.send("","_writeStream",[]);
  691. smalltalk.send(self,"_visit_",[aNode]);
  692. $1=smalltalk.send(self["@stream"],"_contents",[]);
  693. return $1;
  694. }
  695. }),
  696. smalltalk.FunCodeGenerator);
  697. smalltalk.addMethod(
  698. "_initialize",
  699. smalltalk.method({
  700. selector: "initialize",
  701. fn: function (){
  702. var self=this;
  703. smalltalk.send(self,"_initialize",[],smalltalk.AbstractCodeGenerator);
  704. self["@stream"]=smalltalk.send("","_writeStream",[]);
  705. self["@unknownVariables"]=[];
  706. self["@tempVariables"]=[];
  707. self["@argVariables"]=[];
  708. self["@messageSends"]=[];
  709. self["@classReferenced"]=[];
  710. return self}
  711. }),
  712. smalltalk.FunCodeGenerator);
  713. smalltalk.addMethod(
  714. "_inline_receiver_argumentNodes_",
  715. smalltalk.method({
  716. selector: "inline:receiver:argumentNodes:",
  717. fn: function (aSelector,receiver,aCollection){
  718. var self=this;
  719. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  720. var inlined;
  721. inlined=false;
  722. $1=smalltalk.send(aSelector,"__eq",["ifFalse:"]);
  723. if(smalltalk.assert($1)){
  724. $2=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  725. if(smalltalk.assert($2)){
  726. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  727. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  728. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  729. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  730. inlined=true;
  731. inlined;
  732. };
  733. };
  734. $3=smalltalk.send(aSelector,"__eq",["ifTrue:"]);
  735. if(smalltalk.assert($3)){
  736. $4=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  737. if(smalltalk.assert($4)){
  738. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  739. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  740. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  741. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
  742. inlined=true;
  743. inlined;
  744. };
  745. };
  746. $5=smalltalk.send(aSelector,"__eq",["ifTrue:ifFalse:"]);
  747. if(smalltalk.assert($5)){
  748. $6=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  749. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  750. })]);
  751. if(smalltalk.assert($6)){
  752. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  753. smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
  754. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  755. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  756. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  757. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  758. inlined=true;
  759. inlined;
  760. };
  761. };
  762. $7=smalltalk.send(aSelector,"__eq",["ifFalse:ifTrue:"]);
  763. if(smalltalk.assert($7)){
  764. $8=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  765. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  766. })]);
  767. if(smalltalk.assert($8)){
  768. smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
  769. smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
  770. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  771. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  772. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  773. smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
  774. inlined=true;
  775. inlined;
  776. };
  777. };
  778. $9=smalltalk.send(aSelector,"__eq",["<"]);
  779. if(smalltalk.assert($9)){
  780. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  781. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <"]);
  782. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  783. inlined=true;
  784. inlined;
  785. };
  786. $10=smalltalk.send(aSelector,"__eq",["<="]);
  787. if(smalltalk.assert($10)){
  788. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  789. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <="]);
  790. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  791. inlined=true;
  792. inlined;
  793. };
  794. $11=smalltalk.send(aSelector,"__eq",[">"]);
  795. if(smalltalk.assert($11)){
  796. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  797. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >"]);
  798. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  799. inlined=true;
  800. inlined;
  801. };
  802. $12=smalltalk.send(aSelector,"__eq",[">="]);
  803. if(smalltalk.assert($12)){
  804. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  805. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >="]);
  806. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  807. inlined=true;
  808. inlined;
  809. };
  810. $13=smalltalk.send(aSelector,"__eq",["+"]);
  811. if(smalltalk.assert($13)){
  812. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  813. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver +"]);
  814. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  815. inlined=true;
  816. inlined;
  817. };
  818. $14=smalltalk.send(aSelector,"__eq",["-"]);
  819. if(smalltalk.assert($14)){
  820. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  821. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver -"]);
  822. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  823. inlined=true;
  824. inlined;
  825. };
  826. $15=smalltalk.send(aSelector,"__eq",["*"]);
  827. if(smalltalk.assert($15)){
  828. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  829. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver *"]);
  830. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  831. inlined=true;
  832. inlined;
  833. };
  834. $16=smalltalk.send(aSelector,"__eq",["/"]);
  835. if(smalltalk.assert($16)){
  836. smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
  837. smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver /"]);
  838. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  839. inlined=true;
  840. inlined;
  841. };
  842. return inlined;
  843. }
  844. }),
  845. smalltalk.FunCodeGenerator);
  846. smalltalk.addMethod(
  847. "_inlineLiteral_receiverNode_argumentNodes_",
  848. smalltalk.method({
  849. selector: "inlineLiteral:receiverNode:argumentNodes:",
  850. fn: function (aSelector,anObject,aCollection){
  851. var self=this;
  852. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32;
  853. var inlined;
  854. inlined=false;
  855. $1=smalltalk.send(aSelector,"__eq",["whileTrue:"]);
  856. if(smalltalk.assert($1)){
  857. $2=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  858. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  859. })]);
  860. if(smalltalk.assert($2)){
  861. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  862. smalltalk.send(self,"_visit_",[anObject]);
  863. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  864. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  865. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  866. inlined=true;
  867. inlined;
  868. };
  869. };
  870. $3=smalltalk.send(aSelector,"__eq",["whileFalse:"]);
  871. if(smalltalk.assert($3)){
  872. $4=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
  873. return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  874. })]);
  875. if(smalltalk.assert($4)){
  876. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  877. smalltalk.send(self,"_visit_",[anObject]);
  878. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
  879. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  880. smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
  881. inlined=true;
  882. inlined;
  883. };
  884. };
  885. $5=smalltalk.send(aSelector,"__eq",["whileTrue"]);
  886. if(smalltalk.assert($5)){
  887. $6=smalltalk.send(anObject,"_isBlockNode",[]);
  888. if(smalltalk.assert($6)){
  889. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
  890. smalltalk.send(self,"_visit_",[anObject]);
  891. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  892. inlined=true;
  893. inlined;
  894. };
  895. };
  896. $7=smalltalk.send(aSelector,"__eq",["whileFalse"]);
  897. if(smalltalk.assert($7)){
  898. $8=smalltalk.send(anObject,"_isBlockNode",[]);
  899. if(smalltalk.assert($8)){
  900. smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
  901. smalltalk.send(self,"_visit_",[anObject]);
  902. smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
  903. inlined=true;
  904. inlined;
  905. };
  906. };
  907. $9=smalltalk.send(aSelector,"__eq",["+"]);
  908. if(smalltalk.assert($9)){
  909. $10=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  910. if(smalltalk.assert($10)){
  911. smalltalk.send(self,"_visit_",[anObject]);
  912. smalltalk.send(self["@stream"],"_nextPutAll_",[" + "]);
  913. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  914. inlined=true;
  915. inlined;
  916. };
  917. };
  918. $11=smalltalk.send(aSelector,"__eq",["-"]);
  919. if(smalltalk.assert($11)){
  920. $12=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  921. if(smalltalk.assert($12)){
  922. smalltalk.send(self,"_visit_",[anObject]);
  923. smalltalk.send(self["@stream"],"_nextPutAll_",[" - "]);
  924. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  925. inlined=true;
  926. inlined;
  927. };
  928. };
  929. $13=smalltalk.send(aSelector,"__eq",["*"]);
  930. if(smalltalk.assert($13)){
  931. $14=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  932. if(smalltalk.assert($14)){
  933. smalltalk.send(self,"_visit_",[anObject]);
  934. smalltalk.send(self["@stream"],"_nextPutAll_",[" * "]);
  935. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  936. inlined=true;
  937. inlined;
  938. };
  939. };
  940. $15=smalltalk.send(aSelector,"__eq",["/"]);
  941. if(smalltalk.assert($15)){
  942. $16=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  943. if(smalltalk.assert($16)){
  944. smalltalk.send(self,"_visit_",[anObject]);
  945. smalltalk.send(self["@stream"],"_nextPutAll_",[" / "]);
  946. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  947. inlined=true;
  948. inlined;
  949. };
  950. };
  951. $17=smalltalk.send(aSelector,"__eq",["<"]);
  952. if(smalltalk.assert($17)){
  953. $18=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  954. if(smalltalk.assert($18)){
  955. smalltalk.send(self,"_visit_",[anObject]);
  956. smalltalk.send(self["@stream"],"_nextPutAll_",[" < "]);
  957. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  958. inlined=true;
  959. inlined;
  960. };
  961. };
  962. $19=smalltalk.send(aSelector,"__eq",["<="]);
  963. if(smalltalk.assert($19)){
  964. $20=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  965. if(smalltalk.assert($20)){
  966. smalltalk.send(self,"_visit_",[anObject]);
  967. smalltalk.send(self["@stream"],"_nextPutAll_",[" <= "]);
  968. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  969. inlined=true;
  970. inlined;
  971. };
  972. };
  973. $21=smalltalk.send(aSelector,"__eq",[">"]);
  974. if(smalltalk.assert($21)){
  975. $22=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  976. if(smalltalk.assert($22)){
  977. smalltalk.send(self,"_visit_",[anObject]);
  978. smalltalk.send(self["@stream"],"_nextPutAll_",[" > "]);
  979. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  980. inlined=true;
  981. inlined;
  982. };
  983. };
  984. $23=smalltalk.send(aSelector,"__eq",[">="]);
  985. if(smalltalk.assert($23)){
  986. $24=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
  987. if(smalltalk.assert($24)){
  988. smalltalk.send(self,"_visit_",[anObject]);
  989. smalltalk.send(self["@stream"],"_nextPutAll_",[" >= "]);
  990. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  991. inlined=true;
  992. inlined;
  993. };
  994. };
  995. $25=smalltalk.send(aSelector,"__eq",["ifNil:"]);
  996. if(smalltalk.assert($25)){
  997. $26=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  998. if(smalltalk.assert($26)){
  999. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  1000. smalltalk.send(self,"_visit_",[anObject]);
  1001. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  1002. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  1003. smalltalk.send(self["@stream"],"_nextPutAll_",["() : $receiver"]);
  1004. inlined=true;
  1005. inlined;
  1006. };
  1007. };
  1008. $27=smalltalk.send(aSelector,"__eq",["ifNotNil:"]);
  1009. if(smalltalk.assert($27)){
  1010. $28=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
  1011. if(smalltalk.assert($28)){
  1012. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  1013. smalltalk.send(self,"_visit_",[anObject]);
  1014. smalltalk.send(self["@stream"],"_nextPutAll_",[") != nil && $receiver != undefined) ? "]);
  1015. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  1016. smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil"]);
  1017. inlined=true;
  1018. inlined;
  1019. };
  1020. };
  1021. $29=smalltalk.send(aSelector,"__eq",["ifNil:ifNotNil:"]);
  1022. if(smalltalk.assert($29)){
  1023. $30=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  1024. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  1025. })]);
  1026. if(smalltalk.assert($30)){
  1027. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  1028. smalltalk.send(self,"_visit_",[anObject]);
  1029. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  1030. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  1031. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  1032. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  1033. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  1034. inlined=true;
  1035. inlined;
  1036. };
  1037. };
  1038. $31=smalltalk.send(aSelector,"__eq",["ifNotNil:ifNil:"]);
  1039. if(smalltalk.assert($31)){
  1040. $32=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
  1041. return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
  1042. })]);
  1043. if(smalltalk.assert($32)){
  1044. smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
  1045. smalltalk.send(self,"_visit_",[anObject]);
  1046. smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
  1047. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
  1048. smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
  1049. smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
  1050. smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
  1051. inlined=true;
  1052. inlined;
  1053. };
  1054. };
  1055. return inlined;
  1056. }
  1057. }),
  1058. smalltalk.FunCodeGenerator);
  1059. smalltalk.addMethod(
  1060. "_isNode_ofClass_",
  1061. smalltalk.method({
  1062. selector: "isNode:ofClass:",
  1063. fn: function (aNode,aClass){
  1064. var self=this;
  1065. var $1;
  1066. $1=smalltalk.send(smalltalk.send(aNode,"_isValueNode",[]),"_and_",[(function(){
  1067. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"_class",[]),"__eq",[aClass]),"_or_",[(function(){
  1068. return smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"__eq",["self"]),"_and_",[(function(){
  1069. return smalltalk.send(smalltalk.send(self,"_currentClass",[]),"__eq",[aClass]);
  1070. })]);
  1071. })]);
  1072. })]);
  1073. return $1;
  1074. }
  1075. }),
  1076. smalltalk.FunCodeGenerator);
  1077. smalltalk.addMethod(
  1078. "_knownVariables",
  1079. smalltalk.method({
  1080. selector: "knownVariables",
  1081. fn: function (){
  1082. var self=this;
  1083. var $2,$3,$1;
  1084. $2=smalltalk.send(self,"_pseudoVariables",[]);
  1085. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_tempVariables",[])]);
  1086. smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_argVariables",[])]);
  1087. $3=smalltalk.send($2,"_yourself",[]);
  1088. $1=$3;
  1089. return $1;
  1090. }
  1091. }),
  1092. smalltalk.FunCodeGenerator);
  1093. smalltalk.addMethod(
  1094. "_performOptimizations",
  1095. smalltalk.method({
  1096. selector: "performOptimizations",
  1097. fn: function (){
  1098. var self=this;
  1099. var $1;
  1100. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_performOptimizations",[]);
  1101. return $1;
  1102. }
  1103. }),
  1104. smalltalk.FunCodeGenerator);
  1105. smalltalk.addMethod(
  1106. "_send_to_arguments_superSend_",
  1107. smalltalk.method({
  1108. selector: "send:to:arguments:superSend:",
  1109. fn: function (aSelector,aReceiver,aCollection,aBoolean){
  1110. var self=this;
  1111. var $1;
  1112. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(str){
  1113. var tmp;
  1114. tmp=self["@stream"];
  1115. tmp;
  1116. smalltalk.send(str,"_nextPutAll_",["smalltalk.send("]);
  1117. smalltalk.send(str,"_nextPutAll_",[aReceiver]);
  1118. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", \x22","__comma",[smalltalk.send(aSelector,"_asSelector",[])]),"__comma",["\x22, ["])]);
  1119. self["@stream"]=str;
  1120. self["@stream"];
  1121. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  1122. return smalltalk.send(self,"_visit_",[each]);
  1123. }),(function(){
  1124. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  1125. })]);
  1126. self["@stream"]=tmp;
  1127. self["@stream"];
  1128. smalltalk.send(str,"_nextPutAll_",["]"]);
  1129. if(smalltalk.assert(aBoolean)){
  1130. smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(self,"_currentClass",[])])]),"__comma",[".superclass || nil"])]);
  1131. };
  1132. return smalltalk.send(str,"_nextPutAll_",[")"]);
  1133. })]);
  1134. return $1;
  1135. }
  1136. }),
  1137. smalltalk.FunCodeGenerator);
  1138. smalltalk.addMethod(
  1139. "_tempVariables",
  1140. smalltalk.method({
  1141. selector: "tempVariables",
  1142. fn: function (){
  1143. var self=this;
  1144. var $1;
  1145. $1=smalltalk.send(self["@tempVariables"],"_copy",[]);
  1146. return $1;
  1147. }
  1148. }),
  1149. smalltalk.FunCodeGenerator);
  1150. smalltalk.addMethod(
  1151. "_unknownVariables",
  1152. smalltalk.method({
  1153. selector: "unknownVariables",
  1154. fn: function (){
  1155. var self=this;
  1156. var $1;
  1157. $1=smalltalk.send(self["@unknownVariables"],"_copy",[]);
  1158. return $1;
  1159. }
  1160. }),
  1161. smalltalk.FunCodeGenerator);
  1162. smalltalk.addMethod(
  1163. "_visit_",
  1164. smalltalk.method({
  1165. selector: "visit:",
  1166. fn: function (aNode){
  1167. var self=this;
  1168. smalltalk.send(aNode,"_accept_",[self]);
  1169. return self}
  1170. }),
  1171. smalltalk.FunCodeGenerator);
  1172. smalltalk.addMethod(
  1173. "_visitAssignmentNode_",
  1174. smalltalk.method({
  1175. selector: "visitAssignmentNode:",
  1176. fn: function (aNode){
  1177. var self=this;
  1178. smalltalk.send(self["@stream"],"_nextPutAll_",["("]);
  1179. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  1180. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  1181. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  1182. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  1183. return self}
  1184. }),
  1185. smalltalk.FunCodeGenerator);
  1186. smalltalk.addMethod(
  1187. "_visitBlockNode_",
  1188. smalltalk.method({
  1189. selector: "visitBlockNode:",
  1190. fn: function (aNode){
  1191. var self=this;
  1192. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  1193. smalltalk.send(smalltalk.send(aNode,"_parameters",[]),"_do_separatedBy_",[(function(each){
  1194. smalltalk.send(self["@tempVariables"],"_add_",[each]);
  1195. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  1196. }),(function(){
  1197. return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
  1198. })]);
  1199. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  1200. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  1201. return smalltalk.send(self,"_visit_",[each]);
  1202. })]);
  1203. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  1204. return self}
  1205. }),
  1206. smalltalk.FunCodeGenerator);
  1207. smalltalk.addMethod(
  1208. "_visitBlockSequenceNode_",
  1209. smalltalk.method({
  1210. selector: "visitBlockSequenceNode:",
  1211. fn: function (aNode){
  1212. var self=this;
  1213. var $1,$2,$3;
  1214. var index;
  1215. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__plus",[(1)]);
  1216. $1=smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_isEmpty",[]);
  1217. if(smalltalk.assert($1)){
  1218. smalltalk.send(self["@stream"],"_nextPutAll_",["return nil;"]);
  1219. } else {
  1220. smalltalk.send(smalltalk.send(aNode,"_temps",[]),"_do_",[(function(each){
  1221. var temp;
  1222. temp=smalltalk.send(self,"_safeVariableNameFor_",[each]);
  1223. temp;
  1224. smalltalk.send(self["@tempVariables"],"_add_",[temp]);
  1225. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[temp]),"__comma",["=nil;"])]);
  1226. $2=smalltalk.send(self["@stream"],"_lf",[]);
  1227. return $2;
  1228. })]);
  1229. index=(0);
  1230. index;
  1231. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  1232. index=smalltalk.send(index,"__plus",[(1)]);
  1233. index;
  1234. $3=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  1235. if(smalltalk.assert($3)){
  1236. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  1237. };
  1238. smalltalk.send(self,"_visit_",[each]);
  1239. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  1240. })]);
  1241. };
  1242. self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__minus",[(1)]);
  1243. return self}
  1244. }),
  1245. smalltalk.FunCodeGenerator);
  1246. smalltalk.addMethod(
  1247. "_visitCascadeNode_",
  1248. smalltalk.method({
  1249. selector: "visitCascadeNode:",
  1250. fn: function (aNode){
  1251. var self=this;
  1252. var $1,$2;
  1253. var index;
  1254. index=(0);
  1255. $1=smalltalk.send(self["@tempVariables"],"_includes_",["$rec"]);
  1256. if(! smalltalk.assert($1)){
  1257. smalltalk.send(self["@tempVariables"],"_add_",["$rec"]);
  1258. };
  1259. smalltalk.send(self["@stream"],"_nextPutAll_",["(function($rec){"]);
  1260. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  1261. index=smalltalk.send(index,"__plus",[(1)]);
  1262. index;
  1263. $2=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
  1264. if(smalltalk.assert($2)){
  1265. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  1266. };
  1267. smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_value_",["$rec"])]);
  1268. smalltalk.send(self,"_visit_",[each]);
  1269. return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  1270. })]);
  1271. smalltalk.send(self["@stream"],"_nextPutAll_",["})("]);
  1272. smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
  1273. smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
  1274. return self}
  1275. }),
  1276. smalltalk.FunCodeGenerator);
  1277. smalltalk.addMethod(
  1278. "_visitClassReferenceNode_",
  1279. smalltalk.method({
  1280. selector: "visitClassReferenceNode:",
  1281. fn: function (aNode){
  1282. var self=this;
  1283. var $1;
  1284. $1=smalltalk.send(self["@referencedClasses"],"_includes_",[smalltalk.send(aNode,"_value",[])]);
  1285. if(! smalltalk.assert($1)){
  1286. smalltalk.send(self["@referencedClasses"],"_add_",[smalltalk.send(aNode,"_value",[])]);
  1287. };
  1288. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.","__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[" || "]),"__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[")"])]);
  1289. return self}
  1290. }),
  1291. smalltalk.FunCodeGenerator);
  1292. smalltalk.addMethod(
  1293. "_visitDynamicArrayNode_",
  1294. smalltalk.method({
  1295. selector: "visitDynamicArrayNode:",
  1296. fn: function (aNode){
  1297. var self=this;
  1298. smalltalk.send(self["@stream"],"_nextPutAll_",["["]);
  1299. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  1300. return smalltalk.send(self,"_visit_",[each]);
  1301. }),(function(){
  1302. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  1303. })]);
  1304. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  1305. return self}
  1306. }),
  1307. smalltalk.FunCodeGenerator);
  1308. smalltalk.addMethod(
  1309. "_visitDynamicDictionaryNode_",
  1310. smalltalk.method({
  1311. selector: "visitDynamicDictionaryNode:",
  1312. fn: function (aNode){
  1313. var self=this;
  1314. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  1315. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
  1316. return smalltalk.send(self,"_visit_",[each]);
  1317. }),(function(){
  1318. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  1319. })]);
  1320. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  1321. return self}
  1322. }),
  1323. smalltalk.FunCodeGenerator);
  1324. smalltalk.addMethod(
  1325. "_visitFailure_",
  1326. smalltalk.method({
  1327. selector: "visitFailure:",
  1328. fn: function (aFailure){
  1329. var self=this;
  1330. smalltalk.send(self,"_error_",[smalltalk.send(aFailure,"_asString",[])]);
  1331. return self}
  1332. }),
  1333. smalltalk.FunCodeGenerator);
  1334. smalltalk.addMethod(
  1335. "_visitJSStatementNode_",
  1336. smalltalk.method({
  1337. selector: "visitJSStatementNode:",
  1338. fn: function (aNode){
  1339. var self=this;
  1340. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(aNode,"_source",[])]);
  1341. return self}
  1342. }),
  1343. smalltalk.FunCodeGenerator);
  1344. smalltalk.addMethod(
  1345. "_visitMethodNode_",
  1346. smalltalk.method({
  1347. selector: "visitMethodNode:",
  1348. fn: function (aNode) {
  1349. var self=this;
  1350. var str=nil;
  1351. var currentSelector=nil;
  1352. (self['@currentSelector']=smalltalk.send(smalltalk.send(aNode, "_selector", []), "_asSelector", []));
  1353. (self['@nestedBlocks']=(0));
  1354. (self['@earlyReturn']=false);
  1355. (self['@messageSends']=[]);
  1356. (self['@referencedClasses']=[]);
  1357. (self['@unknownVariables']=[]);
  1358. (self['@tempVariables']=[]);
  1359. (self['@argVariables']=[]);
  1360. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: \x22", "__comma", [smalltalk.send(aNode, "_selector", [])]), "__comma", ["\x22,"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  1361. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(self, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  1362. smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
  1363. smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_separatedBy_", [(function(each){smalltalk.send(self['@argVariables'], "_add_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);
  1364. (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
  1365. (str=self['@stream']);
  1366. (self['@stream']=smalltalk.send("", "_writeStream", []));
  1367. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  1368. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})]));
  1369. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(self['@stream'], "_contents", [])]);
  1370. (self['@stream']=str);
  1371. (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["return self;"]);})(self['@stream']);
  1372. ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})]));
  1373. smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
  1374. (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(",", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", ["messageSends: "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@messageSends'], "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(self['@argVariables'], "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
  1375. smalltalk.send(self['@referencedClasses'], "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
  1376. smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
  1377. smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
  1378. return self;}
  1379. }),
  1380. smalltalk.FunCodeGenerator);
  1381. smalltalk.addMethod(
  1382. "_visitReturnNode_",
  1383. smalltalk.method({
  1384. selector: "visitReturnNode:",
  1385. fn: function (aNode) {
  1386. var self=this;
  1387. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (self['@earlyReturn']=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (self['@earlyReturn']=true);})]));
  1388. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));
  1389. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  1390. ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})]));
  1391. return self;}
  1392. }),
  1393. smalltalk.FunCodeGenerator);
  1394. smalltalk.addMethod(
  1395. "_visitSendNode_",
  1396. smalltalk.method({
  1397. selector: "visitSendNode:",
  1398. fn: function (aNode) {
  1399. var self=this;
  1400. var str=nil;
  1401. var receiver=nil;
  1402. var superSend=nil;
  1403. var inlined=nil;
  1404. (str=self['@stream']);
  1405. ((($receiver = smalltalk.send(self['@messageSends'], "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})]));
  1406. (self['@stream']=smalltalk.send("", "_writeStream", []));
  1407. smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
  1408. (superSend=smalltalk.send(smalltalk.send(self['@stream'], "_contents", []), "__eq", ["super"]));
  1409. (receiver=((($receiver = superSend).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "self";})() : (function(){return smalltalk.send(self['@stream'], "_contents", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "self";}), (function(){return smalltalk.send(self['@stream'], "_contents", []);})])));
  1410. (self['@stream']=str);
  1411. ((($receiver = smalltalk.send(self, "_performOptimizations", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));
  1412. return self;}
  1413. }),
  1414. smalltalk.FunCodeGenerator);
  1415. smalltalk.addMethod(
  1416. "_visitSequenceNode_",
  1417. smalltalk.method({
  1418. selector: "visitSequenceNode:",
  1419. fn: function (aNode) {
  1420. var self=this;
  1421. smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
  1422. (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);
  1423. smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);}), (function(){return smalltalk.send(self['@stream'], "_lf", []);})]);
  1424. return self;}
  1425. }),
  1426. smalltalk.FunCodeGenerator);
  1427. smalltalk.addMethod(
  1428. "_visitValueNode_",
  1429. smalltalk.method({
  1430. selector: "visitValueNode:",
  1431. fn: function (aNode) {
  1432. var self=this;
  1433. smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_value", []), "_asJavascript", [])]);
  1434. return self;}
  1435. }),
  1436. smalltalk.FunCodeGenerator);
  1437. smalltalk.addMethod(
  1438. "_visitVariableNode_",
  1439. smalltalk.method({
  1440. selector: "visitVariableNode:",
  1441. fn: function (aNode) {
  1442. var self=this;
  1443. var varName=nil;
  1444. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_currentClass", []), "_allInstanceVariableNames", []), "_includes_", [smalltalk.send(aNode, "_value", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);})() : (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);}), (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})]));
  1445. return self;}
  1446. }),
  1447. smalltalk.FunCodeGenerator);
  1448. smalltalk.FunCodeGenerator.klass.iVarNames = ['performOptimizations'];
  1449. smalltalk.addMethod(
  1450. "_performOptimizations",
  1451. smalltalk.method({
  1452. selector: "performOptimizations",
  1453. fn: function () {
  1454. var self=this;
  1455. return (($receiver = self['@performOptimizations']) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver;
  1456. return self;}
  1457. }),
  1458. smalltalk.FunCodeGenerator.klass);
  1459. smalltalk.addMethod(
  1460. "_performOptimizations_",
  1461. smalltalk.method({
  1462. selector: "performOptimizations:",
  1463. fn: function (aBoolean) {
  1464. var self=this;
  1465. (self['@performOptimizations']=aBoolean);
  1466. return self;}
  1467. }),
  1468. smalltalk.FunCodeGenerator.klass);