1
0

Compiler-Core.deploy.js 61 KB

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