Compiler-IR.deploy.js 55 KB

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