Compiler-IR.deploy.js 52 KB

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