Compiler-IR.deploy.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326
  1. smalltalk.addPackage('Compiler-IR', {});
  2. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  3. smalltalk.addMethod(
  4. "_alias_",
  5. smalltalk.method({
  6. selector: "alias:",
  7. fn: function (aNode){
  8. var self=this;
  9. var $1,$2,$3,$4,$5,$6;
  10. var variable;
  11. $1=smalltalk.send(aNode,"_isValueNode",[]);
  12. if(smalltalk.assert($1)){
  13. $2=smalltalk.send(self,"_visit_",[aNode]);
  14. return $2;
  15. };
  16. $3=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  17. smalltalk.send($3,"_variable_",[smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar),"_new",[]),"_name_",[smalltalk.send("$","__comma",[smalltalk.send(self,"_nextAlias",[])])])]);
  18. $4=smalltalk.send($3,"_yourself",[]);
  19. variable=$4;
  20. $5=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  21. smalltalk.send($5,"_add_",[variable]);
  22. smalltalk.send($5,"_add_",[smalltalk.send(self,"_visit_",[aNode])]);
  23. $6=smalltalk.send($5,"_yourself",[]);
  24. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$6]);
  25. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_internalVariables",[]),"_add_",[variable]);
  26. return variable;
  27. }
  28. }),
  29. smalltalk.IRASTTranslator);
  30. smalltalk.addMethod(
  31. "_method",
  32. smalltalk.method({
  33. selector: "method",
  34. fn: function (){
  35. var self=this;
  36. return self["@method"];
  37. }
  38. }),
  39. smalltalk.IRASTTranslator);
  40. smalltalk.addMethod(
  41. "_method_",
  42. smalltalk.method({
  43. selector: "method:",
  44. fn: function (anIRMethod){
  45. var self=this;
  46. self["@method"]=anIRMethod;
  47. return self}
  48. }),
  49. smalltalk.IRASTTranslator);
  50. smalltalk.addMethod(
  51. "_nextAlias",
  52. smalltalk.method({
  53. selector: "nextAlias",
  54. fn: function (){
  55. var self=this;
  56. var $1;
  57. if(($receiver = self["@nextAlias"]) == nil || $receiver == undefined){
  58. self["@nextAlias"]=(0);
  59. self["@nextAlias"];
  60. } else {
  61. self["@nextAlias"];
  62. };
  63. self["@nextAlias"]=smalltalk.send(self["@nextAlias"],"__plus",[(1)]);
  64. $1=smalltalk.send(self["@nextAlias"],"_asString",[]);
  65. return $1;
  66. }
  67. }),
  68. smalltalk.IRASTTranslator);
  69. smalltalk.addMethod(
  70. "_sequence",
  71. smalltalk.method({
  72. selector: "sequence",
  73. fn: function (){
  74. var self=this;
  75. return self["@sequence"];
  76. }
  77. }),
  78. smalltalk.IRASTTranslator);
  79. smalltalk.addMethod(
  80. "_sequence_",
  81. smalltalk.method({
  82. selector: "sequence:",
  83. fn: function (anIRSequence){
  84. var self=this;
  85. self["@sequence"]=anIRSequence;
  86. return self}
  87. }),
  88. smalltalk.IRASTTranslator);
  89. smalltalk.addMethod(
  90. "_source",
  91. smalltalk.method({
  92. selector: "source",
  93. fn: function (){
  94. var self=this;
  95. return self["@source"];
  96. }
  97. }),
  98. smalltalk.IRASTTranslator);
  99. smalltalk.addMethod(
  100. "_source_",
  101. smalltalk.method({
  102. selector: "source:",
  103. fn: function (aString){
  104. var self=this;
  105. self["@source"]=aString;
  106. return self}
  107. }),
  108. smalltalk.IRASTTranslator);
  109. smalltalk.addMethod(
  110. "_theClass",
  111. smalltalk.method({
  112. selector: "theClass",
  113. fn: function (){
  114. var self=this;
  115. return self["@theClass"];
  116. }
  117. }),
  118. smalltalk.IRASTTranslator);
  119. smalltalk.addMethod(
  120. "_theClass_",
  121. smalltalk.method({
  122. selector: "theClass:",
  123. fn: function (aClass){
  124. var self=this;
  125. self["@theClass"]=aClass;
  126. return self}
  127. }),
  128. smalltalk.IRASTTranslator);
  129. smalltalk.addMethod(
  130. "_visitAssignmentNode_",
  131. smalltalk.method({
  132. selector: "visitAssignmentNode:",
  133. fn: function (aNode){
  134. var self=this;
  135. var $1,$2;
  136. var left;
  137. var right;
  138. var assignment;
  139. right=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  140. left=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  141. $1=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  142. smalltalk.send($1,"_add_",[left]);
  143. smalltalk.send($1,"_add_",[right]);
  144. $2=smalltalk.send($1,"_yourself",[]);
  145. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$2]);
  146. return left;
  147. }
  148. }),
  149. smalltalk.IRASTTranslator);
  150. smalltalk.addMethod(
  151. "_visitBlockNode_",
  152. smalltalk.method({
  153. selector: "visitBlockNode:",
  154. fn: function (aNode){
  155. var self=this;
  156. var $1,$2,$3,$4;
  157. var closure;
  158. $1=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  159. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_parameters",[])]);
  160. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  161. $2=smalltalk.send($1,"_yourself",[]);
  162. closure=$2;
  163. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  164. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  165. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  166. $4=smalltalk.send($3,"_yourself",[]);
  167. return smalltalk.send(closure,"_add_",[$4]);
  168. })]);
  169. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  170. return smalltalk.send(closure,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  171. })]);
  172. return closure;
  173. }
  174. }),
  175. smalltalk.IRASTTranslator);
  176. smalltalk.addMethod(
  177. "_visitBlockSequenceNode_",
  178. smalltalk.method({
  179. selector: "visitBlockSequenceNode:",
  180. fn: function (aNode){
  181. var self=this;
  182. var $2,$3,$4,$1;
  183. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]),(function(){
  184. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_ifNotEmpty_",[(function(){
  185. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  186. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  187. })]);
  188. $2=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[]),"_isReturnNode",[]);
  189. if(smalltalk.assert($2)){
  190. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  191. } else {
  192. $3=smalltalk.send((smalltalk.IRBlockReturn || IRBlockReturn),"_new",[]);
  193. smalltalk.send($3,"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  194. $4=smalltalk.send($3,"_yourself",[]);
  195. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$4]);
  196. };
  197. })]);
  198. })]);
  199. return $1;
  200. }
  201. }),
  202. smalltalk.IRASTTranslator);
  203. smalltalk.addMethod(
  204. "_visitCascadeNode_",
  205. smalltalk.method({
  206. selector: "visitCascadeNode:",
  207. fn: function (aNode){
  208. var self=this;
  209. var $1,$2;
  210. var alias;
  211. $1=smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_isValueNode",[]);
  212. if(! smalltalk.assert($1)){
  213. alias=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  214. alias;
  215. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  216. return smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_binding_",[smalltalk.send(alias,"_variable",[])])]);
  217. })]);
  218. };
  219. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  220. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  221. })]);
  222. $2=smalltalk.send(self,"_alias_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])]);
  223. return $2;
  224. }
  225. }),
  226. smalltalk.IRASTTranslator);
  227. smalltalk.addMethod(
  228. "_visitDynamicArrayNode_",
  229. smalltalk.method({
  230. selector: "visitDynamicArrayNode:",
  231. fn: function (aNode){
  232. var self=this;
  233. var array;
  234. array=smalltalk.send((smalltalk.IRDynamicArray || IRDynamicArray),"_new",[]);
  235. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  236. return smalltalk.send(array,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  237. })]);
  238. return array;
  239. }
  240. }),
  241. smalltalk.IRASTTranslator);
  242. smalltalk.addMethod(
  243. "_visitDynamicDictionaryNode_",
  244. smalltalk.method({
  245. selector: "visitDynamicDictionaryNode:",
  246. fn: function (aNode){
  247. var self=this;
  248. var dictionary;
  249. dictionary=smalltalk.send((smalltalk.IRDynamicDictionary || IRDynamicDictionary),"_new",[]);
  250. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  251. return smalltalk.send(dictionary,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  252. })]);
  253. return dictionary;
  254. }
  255. }),
  256. smalltalk.IRASTTranslator);
  257. smalltalk.addMethod(
  258. "_visitJSStatementNode_",
  259. smalltalk.method({
  260. selector: "visitJSStatementNode:",
  261. fn: function (aNode){
  262. var self=this;
  263. var $2,$3,$1;
  264. $2=smalltalk.send((smalltalk.IRVerbatim || IRVerbatim),"_new",[]);
  265. smalltalk.send($2,"_source_",[smalltalk.send(aNode,"_source",[])]);
  266. $3=smalltalk.send($2,"_yourself",[]);
  267. $1=$3;
  268. return $1;
  269. }
  270. }),
  271. smalltalk.IRASTTranslator);
  272. smalltalk.addMethod(
  273. "_visitMethodNode_",
  274. smalltalk.method({
  275. selector: "visitMethodNode:",
  276. fn: function (aNode){
  277. var self=this;
  278. var $1,$2,$3,$4,$5,$6,$7,$8;
  279. $1=smalltalk.send((smalltalk.IRMethod || IRMethod),"_new",[]);
  280. smalltalk.send($1,"_source_",[smalltalk.send(self,"_source",[])]);
  281. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_arguments",[])]);
  282. smalltalk.send($1,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  283. smalltalk.send($1,"_messageSends_",[smalltalk.send(aNode,"_messageSends",[])]);
  284. smalltalk.send($1,"_classReferences_",[smalltalk.send(aNode,"_classReferences",[])]);
  285. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  286. $2=smalltalk.send($1,"_yourself",[]);
  287. smalltalk.send(self,"_method_",[$2]);
  288. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  289. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  290. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  291. $4=smalltalk.send($3,"_yourself",[]);
  292. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[$4]);
  293. })]);
  294. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  295. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  296. })]);
  297. $5=smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_hasLocalReturn",[]);
  298. if(! smalltalk.assert($5)){
  299. $6=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  300. smalltalk.send($6,"_variable_",[smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_pseudoVars",[]),"_at_",["self"])]);
  301. $7=smalltalk.send($6,"_yourself",[]);
  302. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[])]),"_add_",[$7]);
  303. };
  304. $8=smalltalk.send(self,"_method",[]);
  305. return $8;
  306. }
  307. }),
  308. smalltalk.IRASTTranslator);
  309. smalltalk.addMethod(
  310. "_visitReturnNode_",
  311. smalltalk.method({
  312. selector: "visitReturnNode:",
  313. fn: function (aNode){
  314. var self=this;
  315. var $1;
  316. var return_;
  317. $1=smalltalk.send(aNode,"_nonLocalReturn",[]);
  318. if(smalltalk.assert($1)){
  319. return_=smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn),"_new",[]);
  320. } else {
  321. return_=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  322. };
  323. smalltalk.send(return_,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  324. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  325. return smalltalk.send(return_,"_add_",[smalltalk.send(self,"_alias_",[each])]);
  326. })]);
  327. return return_;
  328. }
  329. }),
  330. smalltalk.IRASTTranslator);
  331. smalltalk.addMethod(
  332. "_visitSendNode_",
  333. smalltalk.method({
  334. selector: "visitSendNode:",
  335. fn: function (aNode){
  336. var self=this;
  337. var $1,$2,$3,$4;
  338. var send;
  339. var receiver;
  340. var arguments;
  341. send=smalltalk.send((smalltalk.IRSend || IRSend),"_new",[]);
  342. smalltalk.send(send,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  343. $1=smalltalk.send(send,"_index_",[smalltalk.send(aNode,"_index",[])]);
  344. $2=smalltalk.send(aNode,"_superSend",[]);
  345. if(smalltalk.assert($2)){
  346. smalltalk.send(send,"_classSend_",[smalltalk.send(smalltalk.send(self,"_theClass",[]),"_superclass",[])]);
  347. };
  348. $3=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_shouldBeInlined",[]),"_or_",[(function(){
  349. return smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_shouldBeAliased",[]);
  350. })]);
  351. if(smalltalk.assert($3)){
  352. receiver=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  353. } else {
  354. receiver=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
  355. };
  356. arguments=smalltalk.send(smalltalk.send(aNode,"_arguments",[]),"_collect_",[(function(each){
  357. $4=smalltalk.send(each,"_shouldBeInlined",[]);
  358. if(smalltalk.assert($4)){
  359. return smalltalk.send(self,"_alias_",[each]);
  360. } else {
  361. return smalltalk.send(self,"_visit_",[each]);
  362. };
  363. })]);
  364. smalltalk.send(send,"_add_",[receiver]);
  365. smalltalk.send(arguments,"_do_",[(function(each){
  366. return smalltalk.send(send,"_add_",[each]);
  367. })]);
  368. return send;
  369. }
  370. }),
  371. smalltalk.IRASTTranslator);
  372. smalltalk.addMethod(
  373. "_visitSequenceNode_",
  374. smalltalk.method({
  375. selector: "visitSequenceNode:",
  376. fn: function (aNode){
  377. var self=this;
  378. var $2,$1;
  379. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRSequence || IRSequence),"_new",[]),(function(){
  380. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  381. var instruction;
  382. instruction=smalltalk.send(self,"_visit_",[each]);
  383. instruction;
  384. $2=smalltalk.send(instruction,"_isVariable",[]);
  385. if(! smalltalk.assert($2)){
  386. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[instruction]);
  387. };
  388. })]);
  389. })]);
  390. return $1;
  391. }
  392. }),
  393. smalltalk.IRASTTranslator);
  394. smalltalk.addMethod(
  395. "_visitValueNode_",
  396. smalltalk.method({
  397. selector: "visitValueNode:",
  398. fn: function (aNode){
  399. var self=this;
  400. var $2,$3,$1;
  401. $2=smalltalk.send((smalltalk.IRValue || IRValue),"_new",[]);
  402. smalltalk.send($2,"_value_",[smalltalk.send(aNode,"_value",[])]);
  403. $3=smalltalk.send($2,"_yourself",[]);
  404. $1=$3;
  405. return $1;
  406. }
  407. }),
  408. smalltalk.IRASTTranslator);
  409. smalltalk.addMethod(
  410. "_visitVariableNode_",
  411. smalltalk.method({
  412. selector: "visitVariableNode:",
  413. fn: function (aNode){
  414. var self=this;
  415. var $2,$3,$1;
  416. $2=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  417. smalltalk.send($2,"_variable_",[smalltalk.send(aNode,"_binding",[])]);
  418. $3=smalltalk.send($2,"_yourself",[]);
  419. $1=$3;
  420. return $1;
  421. }
  422. }),
  423. smalltalk.IRASTTranslator);
  424. smalltalk.addMethod(
  425. "_withSequence_do_",
  426. smalltalk.method({
  427. selector: "withSequence:do:",
  428. fn: function (aSequence,aBlock){
  429. var self=this;
  430. var outerSequence;
  431. outerSequence=smalltalk.send(self,"_sequence",[]);
  432. smalltalk.send(self,"_sequence_",[aSequence]);
  433. smalltalk.send(aBlock,"_value",[]);
  434. smalltalk.send(self,"_sequence_",[outerSequence]);
  435. return aSequence;
  436. }
  437. }),
  438. smalltalk.IRASTTranslator);
  439. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  440. smalltalk.addMethod(
  441. "_accept_",
  442. smalltalk.method({
  443. selector: "accept:",
  444. fn: function (aVisitor){
  445. var self=this;
  446. var $1;
  447. $1=smalltalk.send(aVisitor,"_visitIRInstruction_",[self]);
  448. return $1;
  449. }
  450. }),
  451. smalltalk.IRInstruction);
  452. smalltalk.addMethod(
  453. "_add_",
  454. smalltalk.method({
  455. selector: "add:",
  456. fn: function (anObject){
  457. var self=this;
  458. var $1;
  459. smalltalk.send(anObject,"_parent_",[self]);
  460. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_add_",[anObject]);
  461. return $1;
  462. }
  463. }),
  464. smalltalk.IRInstruction);
  465. smalltalk.addMethod(
  466. "_canBeAssigned",
  467. smalltalk.method({
  468. selector: "canBeAssigned",
  469. fn: function (){
  470. var self=this;
  471. return true;
  472. }
  473. }),
  474. smalltalk.IRInstruction);
  475. smalltalk.addMethod(
  476. "_instructions",
  477. smalltalk.method({
  478. selector: "instructions",
  479. fn: function (){
  480. var self=this;
  481. var $1;
  482. if(($receiver = self["@instructions"]) == nil || $receiver == undefined){
  483. self["@instructions"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  484. $1=self["@instructions"];
  485. } else {
  486. $1=self["@instructions"];
  487. };
  488. return $1;
  489. }
  490. }),
  491. smalltalk.IRInstruction);
  492. smalltalk.addMethod(
  493. "_isClosure",
  494. smalltalk.method({
  495. selector: "isClosure",
  496. fn: function (){
  497. var self=this;
  498. return false;
  499. }
  500. }),
  501. smalltalk.IRInstruction);
  502. smalltalk.addMethod(
  503. "_isInlined",
  504. smalltalk.method({
  505. selector: "isInlined",
  506. fn: function (){
  507. var self=this;
  508. return false;
  509. }
  510. }),
  511. smalltalk.IRInstruction);
  512. smalltalk.addMethod(
  513. "_isLocalReturn",
  514. smalltalk.method({
  515. selector: "isLocalReturn",
  516. fn: function (){
  517. var self=this;
  518. return false;
  519. }
  520. }),
  521. smalltalk.IRInstruction);
  522. smalltalk.addMethod(
  523. "_isReturn",
  524. smalltalk.method({
  525. selector: "isReturn",
  526. fn: function (){
  527. var self=this;
  528. return false;
  529. }
  530. }),
  531. smalltalk.IRInstruction);
  532. smalltalk.addMethod(
  533. "_isSend",
  534. smalltalk.method({
  535. selector: "isSend",
  536. fn: function (){
  537. var self=this;
  538. return false;
  539. }
  540. }),
  541. smalltalk.IRInstruction);
  542. smalltalk.addMethod(
  543. "_isSequence",
  544. smalltalk.method({
  545. selector: "isSequence",
  546. fn: function (){
  547. var self=this;
  548. return false;
  549. }
  550. }),
  551. smalltalk.IRInstruction);
  552. smalltalk.addMethod(
  553. "_isTempDeclaration",
  554. smalltalk.method({
  555. selector: "isTempDeclaration",
  556. fn: function (){
  557. var self=this;
  558. return false;
  559. }
  560. }),
  561. smalltalk.IRInstruction);
  562. smalltalk.addMethod(
  563. "_isVariable",
  564. smalltalk.method({
  565. selector: "isVariable",
  566. fn: function (){
  567. var self=this;
  568. return false;
  569. }
  570. }),
  571. smalltalk.IRInstruction);
  572. smalltalk.addMethod(
  573. "_parent",
  574. smalltalk.method({
  575. selector: "parent",
  576. fn: function (){
  577. var self=this;
  578. return self["@parent"];
  579. }
  580. }),
  581. smalltalk.IRInstruction);
  582. smalltalk.addMethod(
  583. "_parent_",
  584. smalltalk.method({
  585. selector: "parent:",
  586. fn: function (anIRInstruction){
  587. var self=this;
  588. self["@parent"]=anIRInstruction;
  589. return self}
  590. }),
  591. smalltalk.IRInstruction);
  592. smalltalk.addMethod(
  593. "_remove",
  594. smalltalk.method({
  595. selector: "remove",
  596. fn: function (){
  597. var self=this;
  598. smalltalk.send(smalltalk.send(self,"_parent",[]),"_remove_",[self]);
  599. return self}
  600. }),
  601. smalltalk.IRInstruction);
  602. smalltalk.addMethod(
  603. "_remove_",
  604. smalltalk.method({
  605. selector: "remove:",
  606. fn: function (anIRInstruction){
  607. var self=this;
  608. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_remove_",[anIRInstruction]);
  609. return self}
  610. }),
  611. smalltalk.IRInstruction);
  612. smalltalk.addMethod(
  613. "_replace_with_",
  614. smalltalk.method({
  615. selector: "replace:with:",
  616. fn: function (anIRInstruction,anotherIRInstruction){
  617. var self=this;
  618. smalltalk.send(anotherIRInstruction,"_parent_",[self]);
  619. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_at_put_",[smalltalk.send(smalltalk.send(self,"_instructions",[]),"_indexOf_",[anIRInstruction]),anotherIRInstruction]);
  620. return self}
  621. }),
  622. smalltalk.IRInstruction);
  623. smalltalk.addMethod(
  624. "_replaceWith_",
  625. smalltalk.method({
  626. selector: "replaceWith:",
  627. fn: function (anIRInstruction){
  628. var self=this;
  629. smalltalk.send(smalltalk.send(self,"_parent",[]),"_replace_with_",[self,anIRInstruction]);
  630. return self}
  631. }),
  632. smalltalk.IRInstruction);
  633. smalltalk.addMethod(
  634. "_on_",
  635. smalltalk.method({
  636. selector: "on:",
  637. fn: function (aBuilder){
  638. var self=this;
  639. var $2,$3,$1;
  640. $2=smalltalk.send(self,"_new",[]);
  641. smalltalk.send($2,"_builder_",[aBuilder]);
  642. $3=smalltalk.send($2,"_yourself",[]);
  643. $1=$3;
  644. return $1;
  645. }
  646. }),
  647. smalltalk.IRInstruction.klass);
  648. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  649. smalltalk.addMethod(
  650. "_accept_",
  651. smalltalk.method({
  652. selector: "accept:",
  653. fn: function (aVisitor){
  654. var self=this;
  655. var $1;
  656. $1=smalltalk.send(aVisitor,"_visitIRAssignment_",[self]);
  657. return $1;
  658. }
  659. }),
  660. smalltalk.IRAssignment);
  661. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  662. smalltalk.addMethod(
  663. "_accept_",
  664. smalltalk.method({
  665. selector: "accept:",
  666. fn: function (aVisitor){
  667. var self=this;
  668. var $1;
  669. $1=smalltalk.send(aVisitor,"_visitIRDynamicArray_",[self]);
  670. return $1;
  671. }
  672. }),
  673. smalltalk.IRDynamicArray);
  674. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  675. smalltalk.addMethod(
  676. "_accept_",
  677. smalltalk.method({
  678. selector: "accept:",
  679. fn: function (aVisitor){
  680. var self=this;
  681. var $1;
  682. $1=smalltalk.send(aVisitor,"_visitIRDynamicDictionary_",[self]);
  683. return $1;
  684. }
  685. }),
  686. smalltalk.IRDynamicDictionary);
  687. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  688. smalltalk.addMethod(
  689. "_scope",
  690. smalltalk.method({
  691. selector: "scope",
  692. fn: function (){
  693. var self=this;
  694. return self["@scope"];
  695. }
  696. }),
  697. smalltalk.IRScopedInstruction);
  698. smalltalk.addMethod(
  699. "_scope_",
  700. smalltalk.method({
  701. selector: "scope:",
  702. fn: function (aScope){
  703. var self=this;
  704. self["@scope"]=aScope;
  705. return self}
  706. }),
  707. smalltalk.IRScopedInstruction);
  708. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  709. smalltalk.addMethod(
  710. "_accept_",
  711. smalltalk.method({
  712. selector: "accept:",
  713. fn: function (aVisitor){
  714. var self=this;
  715. var $1;
  716. $1=smalltalk.send(aVisitor,"_visitIRClosure_",[self]);
  717. return $1;
  718. }
  719. }),
  720. smalltalk.IRClosure);
  721. smalltalk.addMethod(
  722. "_arguments",
  723. smalltalk.method({
  724. selector: "arguments",
  725. fn: function (){
  726. var self=this;
  727. var $1;
  728. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  729. $1=[];
  730. } else {
  731. $1=self["@arguments"];
  732. };
  733. return $1;
  734. }
  735. }),
  736. smalltalk.IRClosure);
  737. smalltalk.addMethod(
  738. "_arguments_",
  739. smalltalk.method({
  740. selector: "arguments:",
  741. fn: function (aCollection){
  742. var self=this;
  743. self["@arguments"]=aCollection;
  744. return self}
  745. }),
  746. smalltalk.IRClosure);
  747. smalltalk.addMethod(
  748. "_isClosure",
  749. smalltalk.method({
  750. selector: "isClosure",
  751. fn: function (){
  752. var self=this;
  753. return true;
  754. }
  755. }),
  756. smalltalk.IRClosure);
  757. smalltalk.addMethod(
  758. "_scope_",
  759. smalltalk.method({
  760. selector: "scope:",
  761. fn: function (aScope){
  762. var self=this;
  763. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  764. smalltalk.send(aScope,"_instruction_",[self]);
  765. return self}
  766. }),
  767. smalltalk.IRClosure);
  768. smalltalk.addMethod(
  769. "_sequence",
  770. smalltalk.method({
  771. selector: "sequence",
  772. fn: function (){
  773. var self=this;
  774. var $1;
  775. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_last",[]);
  776. return $1;
  777. }
  778. }),
  779. smalltalk.IRClosure);
  780. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  781. smalltalk.addMethod(
  782. "_accept_",
  783. smalltalk.method({
  784. selector: "accept:",
  785. fn: function (aVisitor){
  786. var self=this;
  787. var $1;
  788. $1=smalltalk.send(aVisitor,"_visitIRMethod_",[self]);
  789. return $1;
  790. }
  791. }),
  792. smalltalk.IRMethod);
  793. smalltalk.addMethod(
  794. "_arguments",
  795. smalltalk.method({
  796. selector: "arguments",
  797. fn: function (){
  798. var self=this;
  799. return self["@arguments"];
  800. }
  801. }),
  802. smalltalk.IRMethod);
  803. smalltalk.addMethod(
  804. "_arguments_",
  805. smalltalk.method({
  806. selector: "arguments:",
  807. fn: function (aCollection){
  808. var self=this;
  809. self["@arguments"]=aCollection;
  810. return self}
  811. }),
  812. smalltalk.IRMethod);
  813. smalltalk.addMethod(
  814. "_classReferences",
  815. smalltalk.method({
  816. selector: "classReferences",
  817. fn: function (){
  818. var self=this;
  819. return self["@classReferences"];
  820. }
  821. }),
  822. smalltalk.IRMethod);
  823. smalltalk.addMethod(
  824. "_classReferences_",
  825. smalltalk.method({
  826. selector: "classReferences:",
  827. fn: function (aCollection){
  828. var self=this;
  829. self["@classReferences"]=aCollection;
  830. return self}
  831. }),
  832. smalltalk.IRMethod);
  833. smalltalk.addMethod(
  834. "_internalVariables",
  835. smalltalk.method({
  836. selector: "internalVariables",
  837. fn: function (){
  838. var self=this;
  839. var $1;
  840. if(($receiver = self["@internalVariables"]) == nil || $receiver == undefined){
  841. self["@internalVariables"]=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  842. $1=self["@internalVariables"];
  843. } else {
  844. $1=self["@internalVariables"];
  845. };
  846. return $1;
  847. }
  848. }),
  849. smalltalk.IRMethod);
  850. smalltalk.addMethod(
  851. "_messageSends",
  852. smalltalk.method({
  853. selector: "messageSends",
  854. fn: function (){
  855. var self=this;
  856. return self["@messageSends"];
  857. }
  858. }),
  859. smalltalk.IRMethod);
  860. smalltalk.addMethod(
  861. "_messageSends_",
  862. smalltalk.method({
  863. selector: "messageSends:",
  864. fn: function (aCollection){
  865. var self=this;
  866. self["@messageSends"]=aCollection;
  867. return self}
  868. }),
  869. smalltalk.IRMethod);
  870. smalltalk.addMethod(
  871. "_scope_",
  872. smalltalk.method({
  873. selector: "scope:",
  874. fn: function (aScope){
  875. var self=this;
  876. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  877. smalltalk.send(aScope,"_instruction_",[self]);
  878. return self}
  879. }),
  880. smalltalk.IRMethod);
  881. smalltalk.addMethod(
  882. "_selector",
  883. smalltalk.method({
  884. selector: "selector",
  885. fn: function (){
  886. var self=this;
  887. return self["@selector"];
  888. }
  889. }),
  890. smalltalk.IRMethod);
  891. smalltalk.addMethod(
  892. "_selector_",
  893. smalltalk.method({
  894. selector: "selector:",
  895. fn: function (aString){
  896. var self=this;
  897. self["@selector"]=aString;
  898. return self}
  899. }),
  900. smalltalk.IRMethod);
  901. smalltalk.addMethod(
  902. "_source",
  903. smalltalk.method({
  904. selector: "source",
  905. fn: function (){
  906. var self=this;
  907. return self["@source"];
  908. }
  909. }),
  910. smalltalk.IRMethod);
  911. smalltalk.addMethod(
  912. "_source_",
  913. smalltalk.method({
  914. selector: "source:",
  915. fn: function (aString){
  916. var self=this;
  917. self["@source"]=aString;
  918. return self}
  919. }),
  920. smalltalk.IRMethod);
  921. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  922. smalltalk.addMethod(
  923. "_accept_",
  924. smalltalk.method({
  925. selector: "accept:",
  926. fn: function (aVisitor){
  927. var self=this;
  928. var $1;
  929. $1=smalltalk.send(aVisitor,"_visitIRReturn_",[self]);
  930. return $1;
  931. }
  932. }),
  933. smalltalk.IRReturn);
  934. smalltalk.addMethod(
  935. "_canBeAssigned",
  936. smalltalk.method({
  937. selector: "canBeAssigned",
  938. fn: function (){
  939. var self=this;
  940. return false;
  941. }
  942. }),
  943. smalltalk.IRReturn);
  944. smalltalk.addMethod(
  945. "_isBlockReturn",
  946. smalltalk.method({
  947. selector: "isBlockReturn",
  948. fn: function (){
  949. var self=this;
  950. return false;
  951. }
  952. }),
  953. smalltalk.IRReturn);
  954. smalltalk.addMethod(
  955. "_isLocalReturn",
  956. smalltalk.method({
  957. selector: "isLocalReturn",
  958. fn: function (){
  959. var self=this;
  960. return true;
  961. }
  962. }),
  963. smalltalk.IRReturn);
  964. smalltalk.addMethod(
  965. "_isNonLocalReturn",
  966. smalltalk.method({
  967. selector: "isNonLocalReturn",
  968. fn: function (){
  969. var self=this;
  970. var $1;
  971. $1=smalltalk.send(smalltalk.send(self,"_isLocalReturn",[]),"_not",[]);
  972. return $1;
  973. }
  974. }),
  975. smalltalk.IRReturn);
  976. smalltalk.addMethod(
  977. "_isReturn",
  978. smalltalk.method({
  979. selector: "isReturn",
  980. fn: function (){
  981. var self=this;
  982. return true;
  983. }
  984. }),
  985. smalltalk.IRReturn);
  986. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  987. smalltalk.addMethod(
  988. "_accept_",
  989. smalltalk.method({
  990. selector: "accept:",
  991. fn: function (aVisitor){
  992. var self=this;
  993. var $1;
  994. $1=smalltalk.send(aVisitor,"_visitIRBlockReturn_",[self]);
  995. return $1;
  996. }
  997. }),
  998. smalltalk.IRBlockReturn);
  999. smalltalk.addMethod(
  1000. "_isBlockReturn",
  1001. smalltalk.method({
  1002. selector: "isBlockReturn",
  1003. fn: function (){
  1004. var self=this;
  1005. return true;
  1006. }
  1007. }),
  1008. smalltalk.IRBlockReturn);
  1009. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  1010. smalltalk.addMethod(
  1011. "_accept_",
  1012. smalltalk.method({
  1013. selector: "accept:",
  1014. fn: function (aVisitor){
  1015. var self=this;
  1016. var $1;
  1017. $1=smalltalk.send(aVisitor,"_visitIRNonLocalReturn_",[self]);
  1018. return $1;
  1019. }
  1020. }),
  1021. smalltalk.IRNonLocalReturn);
  1022. smalltalk.addMethod(
  1023. "_isLocalReturn",
  1024. smalltalk.method({
  1025. selector: "isLocalReturn",
  1026. fn: function (){
  1027. var self=this;
  1028. return false;
  1029. }
  1030. }),
  1031. smalltalk.IRNonLocalReturn);
  1032. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1033. smalltalk.addMethod(
  1034. "_accept_",
  1035. smalltalk.method({
  1036. selector: "accept:",
  1037. fn: function (aVisitor){
  1038. var self=this;
  1039. var $1;
  1040. $1=smalltalk.send(aVisitor,"_visitIRSend_",[self]);
  1041. return $1;
  1042. }
  1043. }),
  1044. smalltalk.IRSend);
  1045. smalltalk.addMethod(
  1046. "_classSend",
  1047. smalltalk.method({
  1048. selector: "classSend",
  1049. fn: function (){
  1050. var self=this;
  1051. return self["@classSend"];
  1052. }
  1053. }),
  1054. smalltalk.IRSend);
  1055. smalltalk.addMethod(
  1056. "_classSend_",
  1057. smalltalk.method({
  1058. selector: "classSend:",
  1059. fn: function (aClass){
  1060. var self=this;
  1061. self["@classSend"]=aClass;
  1062. return self}
  1063. }),
  1064. smalltalk.IRSend);
  1065. smalltalk.addMethod(
  1066. "_index",
  1067. smalltalk.method({
  1068. selector: "index",
  1069. fn: function (){
  1070. var self=this;
  1071. return self["@index"];
  1072. }
  1073. }),
  1074. smalltalk.IRSend);
  1075. smalltalk.addMethod(
  1076. "_index_",
  1077. smalltalk.method({
  1078. selector: "index:",
  1079. fn: function (anInteger){
  1080. var self=this;
  1081. self["@index"]=anInteger;
  1082. return self}
  1083. }),
  1084. smalltalk.IRSend);
  1085. smalltalk.addMethod(
  1086. "_isSend",
  1087. smalltalk.method({
  1088. selector: "isSend",
  1089. fn: function (){
  1090. var self=this;
  1091. return true;
  1092. }
  1093. }),
  1094. smalltalk.IRSend);
  1095. smalltalk.addMethod(
  1096. "_selector",
  1097. smalltalk.method({
  1098. selector: "selector",
  1099. fn: function (){
  1100. var self=this;
  1101. return self["@selector"];
  1102. }
  1103. }),
  1104. smalltalk.IRSend);
  1105. smalltalk.addMethod(
  1106. "_selector_",
  1107. smalltalk.method({
  1108. selector: "selector:",
  1109. fn: function (aString){
  1110. var self=this;
  1111. self["@selector"]=aString;
  1112. return self}
  1113. }),
  1114. smalltalk.IRSend);
  1115. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  1116. smalltalk.addMethod(
  1117. "_accept_",
  1118. smalltalk.method({
  1119. selector: "accept:",
  1120. fn: function (aVisitor){
  1121. var self=this;
  1122. var $1;
  1123. $1=smalltalk.send(aVisitor,"_visitIRSequence_",[self]);
  1124. return $1;
  1125. }
  1126. }),
  1127. smalltalk.IRSequence);
  1128. smalltalk.addMethod(
  1129. "_isSequence",
  1130. smalltalk.method({
  1131. selector: "isSequence",
  1132. fn: function (){
  1133. var self=this;
  1134. return true;
  1135. }
  1136. }),
  1137. smalltalk.IRSequence);
  1138. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  1139. smalltalk.addMethod(
  1140. "_accept_",
  1141. smalltalk.method({
  1142. selector: "accept:",
  1143. fn: function (aVisitor){
  1144. var self=this;
  1145. var $1;
  1146. $1=smalltalk.send(aVisitor,"_visitIRBlockSequence_",[self]);
  1147. return $1;
  1148. }
  1149. }),
  1150. smalltalk.IRBlockSequence);
  1151. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  1152. smalltalk.addMethod(
  1153. "_accept_",
  1154. smalltalk.method({
  1155. selector: "accept:",
  1156. fn: function (aVisitor){
  1157. var self=this;
  1158. var $1;
  1159. $1=smalltalk.send(aVisitor,"_visitIRTempDeclaration_",[self]);
  1160. return $1;
  1161. }
  1162. }),
  1163. smalltalk.IRTempDeclaration);
  1164. smalltalk.addMethod(
  1165. "_isTempDeclaration",
  1166. smalltalk.method({
  1167. selector: "isTempDeclaration",
  1168. fn: function (){
  1169. var self=this;
  1170. return true;
  1171. }
  1172. }),
  1173. smalltalk.IRTempDeclaration);
  1174. smalltalk.addMethod(
  1175. "_name",
  1176. smalltalk.method({
  1177. selector: "name",
  1178. fn: function (){
  1179. var self=this;
  1180. return self["@name"];
  1181. }
  1182. }),
  1183. smalltalk.IRTempDeclaration);
  1184. smalltalk.addMethod(
  1185. "_name_",
  1186. smalltalk.method({
  1187. selector: "name:",
  1188. fn: function (aString){
  1189. var self=this;
  1190. self["@name"]=aString;
  1191. return self}
  1192. }),
  1193. smalltalk.IRTempDeclaration);
  1194. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  1195. smalltalk.addMethod(
  1196. "_accept_",
  1197. smalltalk.method({
  1198. selector: "accept:",
  1199. fn: function (aVisitor){
  1200. var self=this;
  1201. var $1;
  1202. $1=smalltalk.send(aVisitor,"_visitIRValue_",[self]);
  1203. return $1;
  1204. }
  1205. }),
  1206. smalltalk.IRValue);
  1207. smalltalk.addMethod(
  1208. "_value",
  1209. smalltalk.method({
  1210. selector: "value",
  1211. fn: function (){
  1212. var self=this;
  1213. return self["@value"];
  1214. }
  1215. }),
  1216. smalltalk.IRValue);
  1217. smalltalk.addMethod(
  1218. "_value_",
  1219. smalltalk.method({
  1220. selector: "value:",
  1221. fn: function (aString){
  1222. var self=this;
  1223. self["@value"]=aString;
  1224. return self}
  1225. }),
  1226. smalltalk.IRValue);
  1227. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  1228. smalltalk.addMethod(
  1229. "_accept_",
  1230. smalltalk.method({
  1231. selector: "accept:",
  1232. fn: function (aVisitor){
  1233. var self=this;
  1234. var $1;
  1235. $1=smalltalk.send(aVisitor,"_visitIRVariable_",[self]);
  1236. return $1;
  1237. }
  1238. }),
  1239. smalltalk.IRVariable);
  1240. smalltalk.addMethod(
  1241. "_isVariable",
  1242. smalltalk.method({
  1243. selector: "isVariable",
  1244. fn: function (){
  1245. var self=this;
  1246. return true;
  1247. }
  1248. }),
  1249. smalltalk.IRVariable);
  1250. smalltalk.addMethod(
  1251. "_variable",
  1252. smalltalk.method({
  1253. selector: "variable",
  1254. fn: function (){
  1255. var self=this;
  1256. return self["@variable"];
  1257. }
  1258. }),
  1259. smalltalk.IRVariable);
  1260. smalltalk.addMethod(
  1261. "_variable_",
  1262. smalltalk.method({
  1263. selector: "variable:",
  1264. fn: function (aScopeVariable){
  1265. var self=this;
  1266. self["@variable"]=aScopeVariable;
  1267. return self}
  1268. }),
  1269. smalltalk.IRVariable);
  1270. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  1271. smalltalk.addMethod(
  1272. "_accept_",
  1273. smalltalk.method({
  1274. selector: "accept:",
  1275. fn: function (aVisitor){
  1276. var self=this;
  1277. var $1;
  1278. $1=smalltalk.send(aVisitor,"_visitIRVerbatim_",[self]);
  1279. return $1;
  1280. }
  1281. }),
  1282. smalltalk.IRVerbatim);
  1283. smalltalk.addMethod(
  1284. "_source",
  1285. smalltalk.method({
  1286. selector: "source",
  1287. fn: function (){
  1288. var self=this;
  1289. return self["@source"];
  1290. }
  1291. }),
  1292. smalltalk.IRVerbatim);
  1293. smalltalk.addMethod(
  1294. "_source_",
  1295. smalltalk.method({
  1296. selector: "source:",
  1297. fn: function (aString){
  1298. var self=this;
  1299. self["@source"]=aString;
  1300. return self}
  1301. }),
  1302. smalltalk.IRVerbatim);
  1303. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  1304. smalltalk.addMethod(
  1305. "_visit_",
  1306. smalltalk.method({
  1307. selector: "visit:",
  1308. fn: function (anIRInstruction){
  1309. var self=this;
  1310. var $1;
  1311. $1=smalltalk.send(anIRInstruction,"_accept_",[self]);
  1312. return $1;
  1313. }
  1314. }),
  1315. smalltalk.IRVisitor);
  1316. smalltalk.addMethod(
  1317. "_visitIRAssignment_",
  1318. smalltalk.method({
  1319. selector: "visitIRAssignment:",
  1320. fn: function (anIRAssignment){
  1321. var self=this;
  1322. var $1;
  1323. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRAssignment]);
  1324. return $1;
  1325. }
  1326. }),
  1327. smalltalk.IRVisitor);
  1328. smalltalk.addMethod(
  1329. "_visitIRBlockReturn_",
  1330. smalltalk.method({
  1331. selector: "visitIRBlockReturn:",
  1332. fn: function (anIRBlockReturn){
  1333. var self=this;
  1334. var $1;
  1335. $1=smalltalk.send(self,"_visitIRReturn_",[anIRBlockReturn]);
  1336. return $1;
  1337. }
  1338. }),
  1339. smalltalk.IRVisitor);
  1340. smalltalk.addMethod(
  1341. "_visitIRBlockSequence_",
  1342. smalltalk.method({
  1343. selector: "visitIRBlockSequence:",
  1344. fn: function (anIRBlockSequence){
  1345. var self=this;
  1346. var $1;
  1347. $1=smalltalk.send(self,"_visitIRSequence_",[anIRBlockSequence]);
  1348. return $1;
  1349. }
  1350. }),
  1351. smalltalk.IRVisitor);
  1352. smalltalk.addMethod(
  1353. "_visitIRClosure_",
  1354. smalltalk.method({
  1355. selector: "visitIRClosure:",
  1356. fn: function (anIRClosure){
  1357. var self=this;
  1358. var $1;
  1359. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRClosure]);
  1360. return $1;
  1361. }
  1362. }),
  1363. smalltalk.IRVisitor);
  1364. smalltalk.addMethod(
  1365. "_visitIRDynamicArray_",
  1366. smalltalk.method({
  1367. selector: "visitIRDynamicArray:",
  1368. fn: function (anIRDynamicArray){
  1369. var self=this;
  1370. var $1;
  1371. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicArray]);
  1372. return $1;
  1373. }
  1374. }),
  1375. smalltalk.IRVisitor);
  1376. smalltalk.addMethod(
  1377. "_visitIRDynamicDictionary_",
  1378. smalltalk.method({
  1379. selector: "visitIRDynamicDictionary:",
  1380. fn: function (anIRDynamicDictionary){
  1381. var self=this;
  1382. var $1;
  1383. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicDictionary]);
  1384. return $1;
  1385. }
  1386. }),
  1387. smalltalk.IRVisitor);
  1388. smalltalk.addMethod(
  1389. "_visitIRInlinedClosure_",
  1390. smalltalk.method({
  1391. selector: "visitIRInlinedClosure:",
  1392. fn: function (anIRInlinedClosure){
  1393. var self=this;
  1394. var $1;
  1395. $1=smalltalk.send(self,"_visitIRClosure_",[anIRInlinedClosure]);
  1396. return $1;
  1397. }
  1398. }),
  1399. smalltalk.IRVisitor);
  1400. smalltalk.addMethod(
  1401. "_visitIRInlinedSequence_",
  1402. smalltalk.method({
  1403. selector: "visitIRInlinedSequence:",
  1404. fn: function (anIRInlinedSequence){
  1405. var self=this;
  1406. var $1;
  1407. $1=smalltalk.send(self,"_visitIRSequence_",[anIRInlinedSequence]);
  1408. return $1;
  1409. }
  1410. }),
  1411. smalltalk.IRVisitor);
  1412. smalltalk.addMethod(
  1413. "_visitIRInstruction_",
  1414. smalltalk.method({
  1415. selector: "visitIRInstruction:",
  1416. fn: function (anIRInstruction){
  1417. var self=this;
  1418. smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_do_",[(function(each){
  1419. return smalltalk.send(self,"_visit_",[each]);
  1420. })]);
  1421. return anIRInstruction;
  1422. }
  1423. }),
  1424. smalltalk.IRVisitor);
  1425. smalltalk.addMethod(
  1426. "_visitIRMethod_",
  1427. smalltalk.method({
  1428. selector: "visitIRMethod:",
  1429. fn: function (anIRMethod){
  1430. var self=this;
  1431. var $1;
  1432. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRMethod]);
  1433. return $1;
  1434. }
  1435. }),
  1436. smalltalk.IRVisitor);
  1437. smalltalk.addMethod(
  1438. "_visitIRNonLocalReturn_",
  1439. smalltalk.method({
  1440. selector: "visitIRNonLocalReturn:",
  1441. fn: function (anIRNonLocalReturn){
  1442. var self=this;
  1443. var $1;
  1444. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturn]);
  1445. return $1;
  1446. }
  1447. }),
  1448. smalltalk.IRVisitor);
  1449. smalltalk.addMethod(
  1450. "_visitIRNonLocalReturnHandling_",
  1451. smalltalk.method({
  1452. selector: "visitIRNonLocalReturnHandling:",
  1453. fn: function (anIRNonLocalReturnHandling){
  1454. var self=this;
  1455. var $1;
  1456. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturnHandling]);
  1457. return $1;
  1458. }
  1459. }),
  1460. smalltalk.IRVisitor);
  1461. smalltalk.addMethod(
  1462. "_visitIRReturn_",
  1463. smalltalk.method({
  1464. selector: "visitIRReturn:",
  1465. fn: function (anIRReturn){
  1466. var self=this;
  1467. var $1;
  1468. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRReturn]);
  1469. return $1;
  1470. }
  1471. }),
  1472. smalltalk.IRVisitor);
  1473. smalltalk.addMethod(
  1474. "_visitIRSend_",
  1475. smalltalk.method({
  1476. selector: "visitIRSend:",
  1477. fn: function (anIRSend){
  1478. var self=this;
  1479. var $1;
  1480. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSend]);
  1481. return $1;
  1482. }
  1483. }),
  1484. smalltalk.IRVisitor);
  1485. smalltalk.addMethod(
  1486. "_visitIRSequence_",
  1487. smalltalk.method({
  1488. selector: "visitIRSequence:",
  1489. fn: function (anIRSequence){
  1490. var self=this;
  1491. var $1;
  1492. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSequence]);
  1493. return $1;
  1494. }
  1495. }),
  1496. smalltalk.IRVisitor);
  1497. smalltalk.addMethod(
  1498. "_visitIRTempDeclaration_",
  1499. smalltalk.method({
  1500. selector: "visitIRTempDeclaration:",
  1501. fn: function (anIRTempDeclaration){
  1502. var self=this;
  1503. var $1;
  1504. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRTempDeclaration]);
  1505. return $1;
  1506. }
  1507. }),
  1508. smalltalk.IRVisitor);
  1509. smalltalk.addMethod(
  1510. "_visitIRValue_",
  1511. smalltalk.method({
  1512. selector: "visitIRValue:",
  1513. fn: function (anIRValue){
  1514. var self=this;
  1515. var $1;
  1516. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRValue]);
  1517. return $1;
  1518. }
  1519. }),
  1520. smalltalk.IRVisitor);
  1521. smalltalk.addMethod(
  1522. "_visitIRVariable_",
  1523. smalltalk.method({
  1524. selector: "visitIRVariable:",
  1525. fn: function (anIRVariable){
  1526. var self=this;
  1527. var $1;
  1528. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVariable]);
  1529. return $1;
  1530. }
  1531. }),
  1532. smalltalk.IRVisitor);
  1533. smalltalk.addMethod(
  1534. "_visitIRVerbatim_",
  1535. smalltalk.method({
  1536. selector: "visitIRVerbatim:",
  1537. fn: function (anIRVerbatim){
  1538. var self=this;
  1539. var $1;
  1540. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVerbatim]);
  1541. return $1;
  1542. }
  1543. }),
  1544. smalltalk.IRVisitor);
  1545. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  1546. smalltalk.addMethod(
  1547. "_contents",
  1548. smalltalk.method({
  1549. selector: "contents",
  1550. fn: function (){
  1551. var self=this;
  1552. var $1;
  1553. $1=smalltalk.send(smalltalk.send(self,"_stream",[]),"_contents",[]);
  1554. return $1;
  1555. }
  1556. }),
  1557. smalltalk.IRJSTranslator);
  1558. smalltalk.addMethod(
  1559. "_initialize",
  1560. smalltalk.method({
  1561. selector: "initialize",
  1562. fn: function (){
  1563. var self=this;
  1564. smalltalk.send(self,"_initialize",[],smalltalk.IRVisitor);
  1565. self["@stream"]=smalltalk.send((smalltalk.JSStream || JSStream),"_new",[]);
  1566. return self}
  1567. }),
  1568. smalltalk.IRJSTranslator);
  1569. smalltalk.addMethod(
  1570. "_stream",
  1571. smalltalk.method({
  1572. selector: "stream",
  1573. fn: function (){
  1574. var self=this;
  1575. return self["@stream"];
  1576. }
  1577. }),
  1578. smalltalk.IRJSTranslator);
  1579. smalltalk.addMethod(
  1580. "_stream_",
  1581. smalltalk.method({
  1582. selector: "stream:",
  1583. fn: function (aStream){
  1584. var self=this;
  1585. self["@stream"]=aStream;
  1586. return self}
  1587. }),
  1588. smalltalk.IRJSTranslator);
  1589. smalltalk.addMethod(
  1590. "_visitIRAssignment_",
  1591. smalltalk.method({
  1592. selector: "visitIRAssignment:",
  1593. fn: function (anIRAssignment){
  1594. var self=this;
  1595. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_first",[])]);
  1596. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAssignment",[]);
  1597. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  1598. return self}
  1599. }),
  1600. smalltalk.IRJSTranslator);
  1601. smalltalk.addMethod(
  1602. "_visitIRClosure_",
  1603. smalltalk.method({
  1604. selector: "visitIRClosure:",
  1605. fn: function (anIRClosure){
  1606. var self=this;
  1607. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutClosureWith_arguments_",[(function(){
  1608. return smalltalk.send(self,"_visitIRClosure_",[anIRClosure],smalltalk.IRVisitor);
  1609. }),smalltalk.send(anIRClosure,"_arguments",[])]);
  1610. return self}
  1611. }),
  1612. smalltalk.IRJSTranslator);
  1613. smalltalk.addMethod(
  1614. "_visitIRDynamicArray_",
  1615. smalltalk.method({
  1616. selector: "visitIRDynamicArray:",
  1617. fn: function (anIRDynamicArray){
  1618. var self=this;
  1619. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["["]);
  1620. smalltalk.send(smalltalk.send(anIRDynamicArray,"_instructions",[]),"_do_separatedBy_",[(function(each){
  1621. return smalltalk.send(self,"_visit_",[each]);
  1622. }),(function(){
  1623. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  1624. })]);
  1625. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  1626. return self}
  1627. }),
  1628. smalltalk.IRJSTranslator);
  1629. smalltalk.addMethod(
  1630. "_visitIRDynamicDictionary_",
  1631. smalltalk.method({
  1632. selector: "visitIRDynamicDictionary:",
  1633. fn: function (anIRDynamicDictionary){
  1634. var self=this;
  1635. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  1636. smalltalk.send(smalltalk.send(anIRDynamicDictionary,"_instructions",[]),"_do_separatedBy_",[(function(each){
  1637. return smalltalk.send(self,"_visit_",[each]);
  1638. }),(function(){
  1639. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  1640. })]);
  1641. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["])"]);
  1642. return self}
  1643. }),
  1644. smalltalk.IRJSTranslator);
  1645. smalltalk.addMethod(
  1646. "_visitIRMethod_",
  1647. smalltalk.method({
  1648. selector: "visitIRMethod:",
  1649. fn: function (anIRMethod){
  1650. var self=this;
  1651. var $1,$2;
  1652. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutMethodDeclaration_with_",[anIRMethod,(function(){
  1653. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutFunctionWith_arguments_",[(function(){
  1654. $1=smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_notEmpty",[]);
  1655. if(smalltalk.assert($1)){
  1656. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVars_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_asArray",[]),"_collect_",[(function(each){
  1657. return smalltalk.send(smalltalk.send(each,"_variable",[]),"_alias",[]);
  1658. })])]);
  1659. };
  1660. $2=smalltalk.send(smalltalk.send(anIRMethod,"_scope",[]),"_hasNonLocalReturn",[]);
  1661. if(smalltalk.assert($2)){
  1662. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnHandlingWith_",[(function(){
  1663. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  1664. })]);
  1665. } else {
  1666. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  1667. };
  1668. }),smalltalk.send(anIRMethod,"_arguments",[])]);
  1669. })]);
  1670. return self}
  1671. }),
  1672. smalltalk.IRJSTranslator);
  1673. smalltalk.addMethod(
  1674. "_visitIRNonLocalReturn_",
  1675. smalltalk.method({
  1676. selector: "visitIRNonLocalReturn:",
  1677. fn: function (anIRNonLocalReturn){
  1678. var self=this;
  1679. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  1680. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  1681. })]);
  1682. return self}
  1683. }),
  1684. smalltalk.IRJSTranslator);
  1685. smalltalk.addMethod(
  1686. "_visitIRReturn_",
  1687. smalltalk.method({
  1688. selector: "visitIRReturn:",
  1689. fn: function (anIRReturn){
  1690. var self=this;
  1691. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturnWith_",[(function(){
  1692. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  1693. })]);
  1694. return self}
  1695. }),
  1696. smalltalk.IRJSTranslator);
  1697. smalltalk.addMethod(
  1698. "_visitIRSend_",
  1699. smalltalk.method({
  1700. selector: "visitIRSend:",
  1701. fn: function (anIRSend){
  1702. var self=this;
  1703. var $1;
  1704. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
  1705. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
  1706. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_selector",[]),"_asSelector",[])]),"__comma",["\x22,["])]);
  1707. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_allButFirst",[]),"_do_separatedBy_",[(function(each){
  1708. return smalltalk.send(self,"_visit_",[each]);
  1709. }),(function(){
  1710. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  1711. })]);
  1712. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["]"]);
  1713. $1=smalltalk.send(anIRSend,"_classSend",[]);
  1714. if(($receiver = $1) == nil || $receiver == undefined){
  1715. $1;
  1716. } else {
  1717. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(",","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_classSend",[]),"_asJavascript",[])])]);
  1718. };
  1719. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  1720. return self}
  1721. }),
  1722. smalltalk.IRJSTranslator);
  1723. smalltalk.addMethod(
  1724. "_visitIRSequence_",
  1725. smalltalk.method({
  1726. selector: "visitIRSequence:",
  1727. fn: function (anIRSequence){
  1728. var self=this;
  1729. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutSequenceWith_",[(function(){
  1730. return smalltalk.send(smalltalk.send(anIRSequence,"_instructions",[]),"_do_",[(function(each){
  1731. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[smalltalk.send(self,"_visit_",[each])]);
  1732. })]);
  1733. })]);
  1734. return self}
  1735. }),
  1736. smalltalk.IRJSTranslator);
  1737. smalltalk.addMethod(
  1738. "_visitIRTempDeclaration_",
  1739. smalltalk.method({
  1740. selector: "visitIRTempDeclaration:",
  1741. fn: function (anIRTempDeclaration){
  1742. var self=this;
  1743. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVar_",[smalltalk.send(smalltalk.send(anIRTempDeclaration,"_name",[]),"_asVariableName",[])]);
  1744. return self}
  1745. }),
  1746. smalltalk.IRJSTranslator);
  1747. smalltalk.addMethod(
  1748. "_visitIRValue_",
  1749. smalltalk.method({
  1750. selector: "visitIRValue:",
  1751. fn: function (anIRValue){
  1752. var self=this;
  1753. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRValue,"_value",[]),"_asJavascript",[])]);
  1754. return self}
  1755. }),
  1756. smalltalk.IRJSTranslator);
  1757. smalltalk.addMethod(
  1758. "_visitIRVariable_",
  1759. smalltalk.method({
  1760. selector: "visitIRVariable:",
  1761. fn: function (anIRVariable){
  1762. var self=this;
  1763. var $1;
  1764. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_name",[]),"__eq",["thisContext"]);
  1765. if(smalltalk.assert($1)){
  1766. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.getThisContext()"]);
  1767. } else {
  1768. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_alias",[])]);
  1769. };
  1770. return self}
  1771. }),
  1772. smalltalk.IRJSTranslator);
  1773. smalltalk.addMethod(
  1774. "_visitIRVerbatim_",
  1775. smalltalk.method({
  1776. selector: "visitIRVerbatim:",
  1777. fn: function (anIRVerbatim){
  1778. var self=this;
  1779. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  1780. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(anIRVerbatim,"_source",[])]);
  1781. })]);
  1782. return self}
  1783. }),
  1784. smalltalk.IRJSTranslator);
  1785. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  1786. smalltalk.addMethod(
  1787. "_contents",
  1788. smalltalk.method({
  1789. selector: "contents",
  1790. fn: function (){
  1791. var self=this;
  1792. var $1;
  1793. $1=smalltalk.send(self["@stream"],"_contents",[]);
  1794. return $1;
  1795. }
  1796. }),
  1797. smalltalk.JSStream);
  1798. smalltalk.addMethod(
  1799. "_initialize",
  1800. smalltalk.method({
  1801. selector: "initialize",
  1802. fn: function (){
  1803. var self=this;
  1804. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  1805. self["@stream"]=smalltalk.send("","_writeStream",[]);
  1806. return self}
  1807. }),
  1808. smalltalk.JSStream);
  1809. smalltalk.addMethod(
  1810. "_lf",
  1811. smalltalk.method({
  1812. selector: "lf",
  1813. fn: function (){
  1814. var self=this;
  1815. smalltalk.send(self["@stream"],"_lf",[]);
  1816. return self}
  1817. }),
  1818. smalltalk.JSStream);
  1819. smalltalk.addMethod(
  1820. "_nextPut_",
  1821. smalltalk.method({
  1822. selector: "nextPut:",
  1823. fn: function (aString){
  1824. var self=this;
  1825. smalltalk.send(self["@stream"],"_nextPut_",[aString]);
  1826. return self}
  1827. }),
  1828. smalltalk.JSStream);
  1829. smalltalk.addMethod(
  1830. "_nextPutAll_",
  1831. smalltalk.method({
  1832. selector: "nextPutAll:",
  1833. fn: function (aString){
  1834. var self=this;
  1835. smalltalk.send(self["@stream"],"_nextPutAll_",[aString]);
  1836. return self}
  1837. }),
  1838. smalltalk.JSStream);
  1839. smalltalk.addMethod(
  1840. "_nextPutAssignment",
  1841. smalltalk.method({
  1842. selector: "nextPutAssignment",
  1843. fn: function (){
  1844. var self=this;
  1845. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  1846. return self}
  1847. }),
  1848. smalltalk.JSStream);
  1849. smalltalk.addMethod(
  1850. "_nextPutClosureWith_arguments_",
  1851. smalltalk.method({
  1852. selector: "nextPutClosureWith:arguments:",
  1853. fn: function (aBlock,anArray){
  1854. var self=this;
  1855. var $1;
  1856. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  1857. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  1858. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  1859. }),(function(){
  1860. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  1861. })]);
  1862. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  1863. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1864. smalltalk.send(aBlock,"_value",[]);
  1865. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  1866. return self}
  1867. }),
  1868. smalltalk.JSStream);
  1869. smalltalk.addMethod(
  1870. "_nextPutFunctionWith_arguments_",
  1871. smalltalk.method({
  1872. selector: "nextPutFunctionWith:arguments:",
  1873. fn: function (aBlock,anArray){
  1874. var self=this;
  1875. var $1,$2;
  1876. smalltalk.send(self["@stream"],"_nextPutAll_",["fn: function("]);
  1877. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  1878. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  1879. }),(function(){
  1880. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  1881. })]);
  1882. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  1883. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1884. smalltalk.send(self["@stream"],"_nextPutAll_",["var self=this;"]);
  1885. $2=smalltalk.send(self["@stream"],"_lf",[]);
  1886. smalltalk.send(aBlock,"_value",[]);
  1887. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  1888. return self}
  1889. }),
  1890. smalltalk.JSStream);
  1891. smalltalk.addMethod(
  1892. "_nextPutIf_with_",
  1893. smalltalk.method({
  1894. selector: "nextPutIf:with:",
  1895. fn: function (aBlock,anotherBlock){
  1896. var self=this;
  1897. var $1;
  1898. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  1899. smalltalk.send(aBlock,"_value",[]);
  1900. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  1901. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1902. smalltalk.send(anotherBlock,"_value",[]);
  1903. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  1904. return self}
  1905. }),
  1906. smalltalk.JSStream);
  1907. smalltalk.addMethod(
  1908. "_nextPutIfElse_with_with_",
  1909. smalltalk.method({
  1910. selector: "nextPutIfElse:with:with:",
  1911. fn: function (aBlock,ifBlock,elseBlock){
  1912. var self=this;
  1913. var $1,$2;
  1914. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  1915. smalltalk.send(aBlock,"_value",[]);
  1916. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  1917. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1918. smalltalk.send(ifBlock,"_value",[]);
  1919. smalltalk.send(self["@stream"],"_nextPutAll_",["} else {"]);
  1920. $2=smalltalk.send(self["@stream"],"_lf",[]);
  1921. smalltalk.send(elseBlock,"_value",[]);
  1922. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  1923. return self}
  1924. }),
  1925. smalltalk.JSStream);
  1926. smalltalk.addMethod(
  1927. "_nextPutMethodDeclaration_with_",
  1928. smalltalk.method({
  1929. selector: "nextPutMethodDeclaration:with:",
  1930. fn: function (aMethod,aBlock){
  1931. var self=this;
  1932. var $1,$2,$3;
  1933. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
  1934. smalltalk.send(self["@stream"],"_lf",[]);
  1935. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
  1936. smalltalk.send(self["@stream"],"_lf",[]);
  1937. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
  1938. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1939. smalltalk.send(aBlock,"_value",[]);
  1940. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
  1941. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
  1942. smalltalk.send(self["@stream"],"_lf",[]);
  1943. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
  1944. return smalltalk.send(each,"_value",[]);
  1945. })]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
  1946. smalltalk.send(self["@stream"],"_lf",[]);
  1947. $2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
  1948. smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
  1949. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
  1950. }),(function(){
  1951. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  1952. })]);
  1953. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  1954. $3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  1955. return self}
  1956. }),
  1957. smalltalk.JSStream);
  1958. smalltalk.addMethod(
  1959. "_nextPutNonLocalReturnHandlingWith_",
  1960. smalltalk.method({
  1961. selector: "nextPutNonLocalReturnHandlingWith:",
  1962. fn: function (aBlock){
  1963. var self=this;
  1964. var $1,$2;
  1965. smalltalk.send(self["@stream"],"_nextPutAll_",["var $early={};"]);
  1966. smalltalk.send(self["@stream"],"_lf",[]);
  1967. smalltalk.send(self["@stream"],"_nextPutAll_",["try {"]);
  1968. $1=smalltalk.send(self["@stream"],"_lf",[]);
  1969. smalltalk.send(aBlock,"_value",[]);
  1970. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  1971. smalltalk.send(self["@stream"],"_lf",[]);
  1972. smalltalk.send(self["@stream"],"_nextPutAll_",["catch(e) {if(e===$early)return e[0]; throw e}"]);
  1973. $2=smalltalk.send(self["@stream"],"_lf",[]);
  1974. return self}
  1975. }),
  1976. smalltalk.JSStream);
  1977. smalltalk.addMethod(
  1978. "_nextPutNonLocalReturnWith_",
  1979. smalltalk.method({
  1980. selector: "nextPutNonLocalReturnWith:",
  1981. fn: function (aBlock){
  1982. var self=this;
  1983. smalltalk.send(self["@stream"],"_nextPutAll_",["throw $early=["]);
  1984. smalltalk.send(aBlock,"_value",[]);
  1985. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  1986. return self}
  1987. }),
  1988. smalltalk.JSStream);
  1989. smalltalk.addMethod(
  1990. "_nextPutReturn",
  1991. smalltalk.method({
  1992. selector: "nextPutReturn",
  1993. fn: function (){
  1994. var self=this;
  1995. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  1996. return self}
  1997. }),
  1998. smalltalk.JSStream);
  1999. smalltalk.addMethod(
  2000. "_nextPutReturnWith_",
  2001. smalltalk.method({
  2002. selector: "nextPutReturnWith:",
  2003. fn: function (aBlock){
  2004. var self=this;
  2005. smalltalk.send(self,"_nextPutReturn",[]);
  2006. smalltalk.send(aBlock,"_value",[]);
  2007. return self}
  2008. }),
  2009. smalltalk.JSStream);
  2010. smalltalk.addMethod(
  2011. "_nextPutSendTo_selector_arguments_",
  2012. smalltalk.method({
  2013. selector: "nextPutSendTo:selector:arguments:",
  2014. fn: function (receiver,selector,arguments){
  2015. var self=this;
  2016. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.send("]);
  2017. smalltalk.send(receiver,"_emitOn_",[self]);
  2018. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(selector,"_asSelector",[])]),"__comma",["\x22,["])]);
  2019. smalltalk.send(arguments,"_do_separatedBy_",[(function(each){
  2020. return smalltalk.send(each,"_emitOn_",[self]);
  2021. }),(function(){
  2022. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2023. })]);
  2024. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  2025. return self}
  2026. }),
  2027. smalltalk.JSStream);
  2028. smalltalk.addMethod(
  2029. "_nextPutSequenceWith_",
  2030. smalltalk.method({
  2031. selector: "nextPutSequenceWith:",
  2032. fn: function (aBlock){
  2033. var self=this;
  2034. smalltalk.send(aBlock,"_value",[]);
  2035. return self}
  2036. }),
  2037. smalltalk.JSStream);
  2038. smalltalk.addMethod(
  2039. "_nextPutStatement_with_",
  2040. smalltalk.method({
  2041. selector: "nextPutStatement:with:",
  2042. fn: function (anInteger,aBlock){
  2043. var self=this;
  2044. var $1,$2;
  2045. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("case ","__comma",[smalltalk.send(anInteger,"_asString",[])]),"__comma",[":"])]);
  2046. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2047. smalltalk.send(self,"_nextPutStatementWith_",[aBlock]);
  2048. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=","__comma",[smalltalk.send(smalltalk.send(anInteger,"__plus",[(1)]),"_asString",[])]),"__comma",[";"])]);
  2049. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2050. return self}
  2051. }),
  2052. smalltalk.JSStream);
  2053. smalltalk.addMethod(
  2054. "_nextPutStatementWith_",
  2055. smalltalk.method({
  2056. selector: "nextPutStatementWith:",
  2057. fn: function (aBlock){
  2058. var self=this;
  2059. var $1;
  2060. smalltalk.send(aBlock,"_value",[]);
  2061. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2062. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2063. return self}
  2064. }),
  2065. smalltalk.JSStream);
  2066. smalltalk.addMethod(
  2067. "_nextPutVar_",
  2068. smalltalk.method({
  2069. selector: "nextPutVar:",
  2070. fn: function (aString){
  2071. var self=this;
  2072. var $1;
  2073. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[aString]),"__comma",[";"])]);
  2074. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2075. return self}
  2076. }),
  2077. smalltalk.JSStream);
  2078. smalltalk.addMethod(
  2079. "_nextPutVars_",
  2080. smalltalk.method({
  2081. selector: "nextPutVars:",
  2082. fn: function (aCollection){
  2083. var self=this;
  2084. var $1;
  2085. smalltalk.send(self["@stream"],"_nextPutAll_",["var "]);
  2086. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  2087. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  2088. }),(function(){
  2089. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2090. })]);
  2091. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2092. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2093. return self}
  2094. }),
  2095. smalltalk.JSStream);
  2096. smalltalk.addMethod(
  2097. "_appendToInstruction_",
  2098. smalltalk.method({
  2099. selector: "appendToInstruction:",
  2100. fn: function (anIRInstruction){
  2101. var self=this;
  2102. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  2103. return self}
  2104. }),
  2105. smalltalk.BlockClosure);
  2106. smalltalk.addMethod(
  2107. "_asVariableName",
  2108. smalltalk.method({
  2109. selector: "asVariableName",
  2110. fn: function (){
  2111. var self=this;
  2112. var $2,$1;
  2113. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[self]);
  2114. if(smalltalk.assert($2)){
  2115. $1=smalltalk.send(self,"__comma",["_"]);
  2116. } else {
  2117. $1=self;
  2118. };
  2119. return $1;
  2120. }
  2121. }),
  2122. smalltalk.String);