1
0

Compiler-IR.js 94 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177
  1. smalltalk.addPackage('Compiler-IR', {});
  2. smalltalk.addClass('IRASTTranslator', smalltalk.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  3. smalltalk.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.\x0aI rely on a builder object, instance of IRBuilder."
  4. smalltalk.addMethod(
  5. "_alias_",
  6. smalltalk.method({
  7. selector: "alias:",
  8. category: 'visiting',
  9. fn: function (aNode){
  10. var self=this;
  11. var $1,$2,$3,$4,$5,$6;
  12. var variable;
  13. $1=smalltalk.send(aNode,"_isImmutable",[]);
  14. if(smalltalk.assert($1)){
  15. $2=smalltalk.send(self,"_visit_",[aNode]);
  16. return $2;
  17. };
  18. $3=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  19. smalltalk.send($3,"_variable_",[smalltalk.send(smalltalk.send((smalltalk.AliasVar || AliasVar),"_new",[]),"_name_",[smalltalk.send("$","__comma",[smalltalk.send(self,"_nextAlias",[])])])]);
  20. $4=smalltalk.send($3,"_yourself",[]);
  21. variable=$4;
  22. $5=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  23. smalltalk.send($5,"_add_",[variable]);
  24. smalltalk.send($5,"_add_",[smalltalk.send(self,"_visit_",[aNode])]);
  25. $6=smalltalk.send($5,"_yourself",[]);
  26. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$6]);
  27. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_internalVariables",[]),"_add_",[variable]);
  28. return variable;
  29. },
  30. args: ["aNode"],
  31. source: "alias: aNode\x0a\x09| variable |\x0a\x0a\x09aNode isImmutable ifTrue: [ ^ self visit: aNode ].\x0a\x0a\x09variable := IRVariable new \x0a\x09\x09variable: (AliasVar new name: '$', self nextAlias); \x0a\x09\x09yourself.\x0a\x0a\x09self sequence add: (IRAssignment new\x0a\x09\x09add: variable;\x0a\x09\x09add: (self visit: aNode);\x0a\x09\x09yourself).\x0a\x0a\x09self method internalVariables add: variable.\x0a\x0a\x09^ variable",
  32. messageSends: ["ifTrue:", "visit:", "isImmutable", "variable:", "name:", ",", "nextAlias", "new", "yourself", "add:", "sequence", "internalVariables", "method"],
  33. referencedClasses: ["AliasVar", "IRVariable", "IRAssignment"]
  34. }),
  35. smalltalk.IRASTTranslator);
  36. smalltalk.addMethod(
  37. "_method",
  38. smalltalk.method({
  39. selector: "method",
  40. category: 'accessing',
  41. fn: function (){
  42. var self=this;
  43. return self["@method"];
  44. },
  45. args: [],
  46. source: "method\x0a\x09^ method",
  47. messageSends: [],
  48. referencedClasses: []
  49. }),
  50. smalltalk.IRASTTranslator);
  51. smalltalk.addMethod(
  52. "_method_",
  53. smalltalk.method({
  54. selector: "method:",
  55. category: 'accessing',
  56. fn: function (anIRMethod){
  57. var self=this;
  58. self["@method"]=anIRMethod;
  59. return self},
  60. args: ["anIRMethod"],
  61. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  62. messageSends: [],
  63. referencedClasses: []
  64. }),
  65. smalltalk.IRASTTranslator);
  66. smalltalk.addMethod(
  67. "_nextAlias",
  68. smalltalk.method({
  69. selector: "nextAlias",
  70. category: 'accessing',
  71. fn: function (){
  72. var self=this;
  73. var $1;
  74. if(($receiver = self["@nextAlias"]) == nil || $receiver == undefined){
  75. self["@nextAlias"]=(0);
  76. self["@nextAlias"];
  77. } else {
  78. self["@nextAlias"];
  79. };
  80. self["@nextAlias"]=smalltalk.send(self["@nextAlias"],"__plus",[(1)]);
  81. $1=smalltalk.send(self["@nextAlias"],"_asString",[]);
  82. return $1;
  83. },
  84. args: [],
  85. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  86. messageSends: ["ifNil:", "+", "asString"],
  87. referencedClasses: []
  88. }),
  89. smalltalk.IRASTTranslator);
  90. smalltalk.addMethod(
  91. "_sequence",
  92. smalltalk.method({
  93. selector: "sequence",
  94. category: 'accessing',
  95. fn: function (){
  96. var self=this;
  97. return self["@sequence"];
  98. },
  99. args: [],
  100. source: "sequence\x0a\x09^ sequence",
  101. messageSends: [],
  102. referencedClasses: []
  103. }),
  104. smalltalk.IRASTTranslator);
  105. smalltalk.addMethod(
  106. "_sequence_",
  107. smalltalk.method({
  108. selector: "sequence:",
  109. category: 'accessing',
  110. fn: function (anIRSequence){
  111. var self=this;
  112. self["@sequence"]=anIRSequence;
  113. return self},
  114. args: ["anIRSequence"],
  115. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  116. messageSends: [],
  117. referencedClasses: []
  118. }),
  119. smalltalk.IRASTTranslator);
  120. smalltalk.addMethod(
  121. "_source",
  122. smalltalk.method({
  123. selector: "source",
  124. category: 'accessing',
  125. fn: function (){
  126. var self=this;
  127. return self["@source"];
  128. },
  129. args: [],
  130. source: "source\x0a\x09^ source",
  131. messageSends: [],
  132. referencedClasses: []
  133. }),
  134. smalltalk.IRASTTranslator);
  135. smalltalk.addMethod(
  136. "_source_",
  137. smalltalk.method({
  138. selector: "source:",
  139. category: 'accessing',
  140. fn: function (aString){
  141. var self=this;
  142. self["@source"]=aString;
  143. return self},
  144. args: ["aString"],
  145. source: "source: aString\x0a\x09source := aString",
  146. messageSends: [],
  147. referencedClasses: []
  148. }),
  149. smalltalk.IRASTTranslator);
  150. smalltalk.addMethod(
  151. "_temporallyDependentList_",
  152. smalltalk.method({
  153. selector: "temporallyDependentList:",
  154. category: 'visiting',
  155. fn: function (nodes){
  156. var self=this;
  157. var $1,$2,$4,$3,$5;
  158. var threshold;
  159. var result;
  160. threshold=(0);
  161. smalltalk.send(nodes,"_withIndexDo_",[(function(each,i){
  162. $1=smalltalk.send(each,"_subtreeNeedsAliasing",[]);
  163. if(smalltalk.assert($1)){
  164. threshold=i;
  165. return threshold;
  166. };
  167. })]);
  168. result=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  169. smalltalk.send(nodes,"_withIndexDo_",[(function(each,i){
  170. $2=result;
  171. $4=smalltalk.send(i,"__lt_eq",[threshold]);
  172. if(smalltalk.assert($4)){
  173. $3=smalltalk.send(self,"_alias_",[each]);
  174. } else {
  175. $3=smalltalk.send(self,"_visit_",[each]);
  176. };
  177. return smalltalk.send($2,"_add_",[$3]);
  178. })]);
  179. $5=result;
  180. return $5;
  181. },
  182. args: ["nodes"],
  183. source: "temporallyDependentList: nodes\x0a\x09| threshold result |\x0a threshold := 0.\x0a \x0a nodes withIndexDo: [ :each :i |\x0a each subtreeNeedsAliasing\x0a\x09\x09 ifTrue: [ threshold := i ]].\x0a\x0a\x09result := OrderedCollection new.\x0a\x09nodes withIndexDo: [ :each :i | \x0a\x09\x09result add: (i <= threshold\x0a\x09\x09\x09ifTrue: [ self alias: each ]\x0a\x09\x09\x09ifFalse: [ self visit: each ])].\x0a\x0a ^result\x0a",
  184. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "alias:", "visit:", "<="],
  185. referencedClasses: ["OrderedCollection"]
  186. }),
  187. smalltalk.IRASTTranslator);
  188. smalltalk.addMethod(
  189. "_theClass",
  190. smalltalk.method({
  191. selector: "theClass",
  192. category: 'accessing',
  193. fn: function (){
  194. var self=this;
  195. return self["@theClass"];
  196. },
  197. args: [],
  198. source: "theClass\x0a\x09^ theClass",
  199. messageSends: [],
  200. referencedClasses: []
  201. }),
  202. smalltalk.IRASTTranslator);
  203. smalltalk.addMethod(
  204. "_theClass_",
  205. smalltalk.method({
  206. selector: "theClass:",
  207. category: 'accessing',
  208. fn: function (aClass){
  209. var self=this;
  210. self["@theClass"]=aClass;
  211. return self},
  212. args: ["aClass"],
  213. source: "theClass: aClass\x0a\x09theClass := aClass",
  214. messageSends: [],
  215. referencedClasses: []
  216. }),
  217. smalltalk.IRASTTranslator);
  218. smalltalk.addMethod(
  219. "_visitAssignmentNode_",
  220. smalltalk.method({
  221. selector: "visitAssignmentNode:",
  222. category: 'visiting',
  223. fn: function (aNode){
  224. var self=this;
  225. var $1,$2;
  226. var left;
  227. var right;
  228. var assignment;
  229. right=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
  230. left=smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
  231. $1=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
  232. smalltalk.send($1,"_add_",[left]);
  233. smalltalk.send($1,"_add_",[right]);
  234. $2=smalltalk.send($1,"_yourself",[]);
  235. smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$2]);
  236. return left;
  237. },
  238. args: ["aNode"],
  239. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self sequence add: (IRAssignment new \x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  240. messageSends: ["visit:", "right", "left", "add:", "new", "yourself", "sequence"],
  241. referencedClasses: ["IRAssignment"]
  242. }),
  243. smalltalk.IRASTTranslator);
  244. smalltalk.addMethod(
  245. "_visitBlockNode_",
  246. smalltalk.method({
  247. selector: "visitBlockNode:",
  248. category: 'visiting',
  249. fn: function (aNode){
  250. var self=this;
  251. var $1,$2,$3,$4;
  252. var closure;
  253. $1=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
  254. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_parameters",[])]);
  255. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  256. $2=smalltalk.send($1,"_yourself",[]);
  257. closure=$2;
  258. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  259. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  260. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  261. $4=smalltalk.send($3,"_yourself",[]);
  262. return smalltalk.send(closure,"_add_",[$4]);
  263. })]);
  264. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  265. return smalltalk.send(closure,"_add_",[smalltalk.send(self,"_visit_",[each])]);
  266. })]);
  267. return closure;
  268. },
  269. args: ["aNode"],
  270. source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new \x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  271. messageSends: ["arguments:", "parameters", "new", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "temps", "visit:", "nodes"],
  272. referencedClasses: ["IRClosure", "IRTempDeclaration"]
  273. }),
  274. smalltalk.IRASTTranslator);
  275. smalltalk.addMethod(
  276. "_visitBlockSequenceNode_",
  277. smalltalk.method({
  278. selector: "visitBlockSequenceNode:",
  279. category: 'visiting',
  280. fn: function (aNode){
  281. var self=this;
  282. var $2,$3,$4,$1;
  283. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]),(function(){
  284. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_ifNotEmpty_",[(function(){
  285. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  286. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  287. })]);
  288. $2=smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[]),"_isReturnNode",[]);
  289. if(smalltalk.assert($2)){
  290. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  291. } else {
  292. $3=smalltalk.send((smalltalk.IRBlockReturn || IRBlockReturn),"_new",[]);
  293. smalltalk.send($3,"_add_",[smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])])]);
  294. $4=smalltalk.send($3,"_yourself",[]);
  295. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[$4]);
  296. };
  297. })]);
  298. })]);
  299. return $1;
  300. },
  301. args: ["aNode"],
  302. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [ \x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each | \x0a\x09\x09\x09\x09\x09self sequence add: (self visit: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode \x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visit: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visit: aNode nodes last) ]]]",
  303. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "do:", "add:", "visit:", "sequence", "allButLast", "nodes", "ifFalse:ifTrue:", "last", "yourself", "isReturnNode"],
  304. referencedClasses: ["IRBlockSequence", "IRBlockReturn"]
  305. }),
  306. smalltalk.IRASTTranslator);
  307. smalltalk.addMethod(
  308. "_visitCascadeNode_",
  309. smalltalk.method({
  310. selector: "visitCascadeNode:",
  311. category: 'visiting',
  312. fn: function (aNode){
  313. var self=this;
  314. var $1,$2;
  315. var alias;
  316. $1=smalltalk.send(smalltalk.send(aNode,"_receiver",[]),"_isImmutable",[]);
  317. if(! smalltalk.assert($1)){
  318. alias=smalltalk.send(self,"_alias_",[smalltalk.send(aNode,"_receiver",[])]);
  319. alias;
  320. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  321. return smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_binding_",[smalltalk.send(alias,"_variable",[])])]);
  322. })]);
  323. };
  324. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_allButLast",[]),"_do_",[(function(each){
  325. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  326. })]);
  327. $2=smalltalk.send(self,"_alias_",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_last",[])]);
  328. return $2;
  329. },
  330. args: ["aNode"],
  331. source: "visitCascadeNode: aNode\x0a\x09| alias |\x0a\x0a\x09aNode receiver isImmutable ifFalse: [ \x0a\x09\x09alias := self alias: aNode receiver.\x0a\x09\x09aNode nodes do: [ :each |\x0a\x09\x09\x09each receiver: (VariableNode new binding: alias variable) ]].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self alias: aNode nodes last",
  332. messageSends: ["ifFalse:", "alias:", "receiver", "do:", "receiver:", "binding:", "variable", "new", "nodes", "isImmutable", "add:", "visit:", "sequence", "allButLast", "last"],
  333. referencedClasses: ["VariableNode"]
  334. }),
  335. smalltalk.IRASTTranslator);
  336. smalltalk.addMethod(
  337. "_visitDynamicArrayNode_",
  338. smalltalk.method({
  339. selector: "visitDynamicArrayNode:",
  340. category: 'visiting',
  341. fn: function (aNode){
  342. var self=this;
  343. var $1;
  344. var array;
  345. array=smalltalk.send((smalltalk.IRDynamicArray || IRDynamicArray),"_new",[]);
  346. smalltalk.send(smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send(aNode,"_nodes",[])]),"_do_",[(function(each){
  347. return smalltalk.send(array,"_add_",[each]);
  348. })]);
  349. $1=array;
  350. return $1;
  351. },
  352. args: ["aNode"],
  353. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self temporallyDependentList: aNode nodes) do: [:each | array add: each].\x0a\x09^ array",
  354. messageSends: ["new", "do:", "add:", "temporallyDependentList:", "nodes"],
  355. referencedClasses: ["IRDynamicArray"]
  356. }),
  357. smalltalk.IRASTTranslator);
  358. smalltalk.addMethod(
  359. "_visitDynamicDictionaryNode_",
  360. smalltalk.method({
  361. selector: "visitDynamicDictionaryNode:",
  362. category: 'visiting',
  363. fn: function (aNode){
  364. var self=this;
  365. var $1;
  366. var dictionary;
  367. dictionary=smalltalk.send((smalltalk.IRDynamicDictionary || IRDynamicDictionary),"_new",[]);
  368. smalltalk.send(smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send(aNode,"_nodes",[])]),"_do_",[(function(each){
  369. return smalltalk.send(dictionary,"_add_",[each]);
  370. })]);
  371. $1=dictionary;
  372. return $1;
  373. },
  374. args: ["aNode"],
  375. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a (self temporallyDependentList: aNode nodes) do: [:each | dictionary add: each].\x0a\x09^ dictionary",
  376. messageSends: ["new", "do:", "add:", "temporallyDependentList:", "nodes"],
  377. referencedClasses: ["IRDynamicDictionary"]
  378. }),
  379. smalltalk.IRASTTranslator);
  380. smalltalk.addMethod(
  381. "_visitJSStatementNode_",
  382. smalltalk.method({
  383. selector: "visitJSStatementNode:",
  384. category: 'visiting',
  385. fn: function (aNode){
  386. var self=this;
  387. var $2,$3,$1;
  388. $2=smalltalk.send((smalltalk.IRVerbatim || IRVerbatim),"_new",[]);
  389. smalltalk.send($2,"_source_",[smalltalk.send(aNode,"_source",[])]);
  390. $3=smalltalk.send($2,"_yourself",[]);
  391. $1=$3;
  392. return $1;
  393. },
  394. args: ["aNode"],
  395. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source;\x0a\x09\x09yourself",
  396. messageSends: ["source:", "source", "new", "yourself"],
  397. referencedClasses: ["IRVerbatim"]
  398. }),
  399. smalltalk.IRASTTranslator);
  400. smalltalk.addMethod(
  401. "_visitMethodNode_",
  402. smalltalk.method({
  403. selector: "visitMethodNode:",
  404. category: 'visiting',
  405. fn: function (aNode){
  406. var self=this;
  407. var $1,$2,$3,$4,$5,$6,$7,$8;
  408. $1=smalltalk.send((smalltalk.IRMethod || IRMethod),"_new",[]);
  409. smalltalk.send($1,"_source_",[smalltalk.send(self,"_source",[])]);
  410. smalltalk.send($1,"_arguments_",[smalltalk.send(aNode,"_arguments",[])]);
  411. smalltalk.send($1,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  412. smalltalk.send($1,"_messageSends_",[smalltalk.send(aNode,"_messageSends",[])]);
  413. smalltalk.send($1,"_classReferences_",[smalltalk.send(aNode,"_classReferences",[])]);
  414. smalltalk.send($1,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  415. $2=smalltalk.send($1,"_yourself",[]);
  416. smalltalk.send(self,"_method_",[$2]);
  417. smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_temps",[]),"_do_",[(function(each){
  418. $3=smalltalk.send((smalltalk.IRTempDeclaration || IRTempDeclaration),"_new",[]);
  419. smalltalk.send($3,"_name_",[smalltalk.send(each,"_name",[])]);
  420. $4=smalltalk.send($3,"_yourself",[]);
  421. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[$4]);
  422. })]);
  423. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  424. return smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send(self,"_visit_",[each])]);
  425. })]);
  426. $5=smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_hasLocalReturn",[]);
  427. if(! smalltalk.assert($5)){
  428. $6=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  429. smalltalk.send($6,"_variable_",[smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_scope",[]),"_pseudoVars",[]),"_at_",["self"])]);
  430. $7=smalltalk.send($6,"_yourself",[]);
  431. smalltalk.send(smalltalk.send(smalltalk.send(self,"_method",[]),"_add_",[smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[])]),"_add_",[$7]);
  432. };
  433. $8=smalltalk.send(self,"_method",[]);
  434. return $8;
  435. },
  436. args: ["aNode"],
  437. source: "visitMethodNode: aNode\x0a\x0a\x09self method: (IRMethod new\x0a\x09\x09source: self source;\x0a\x09\x09arguments: aNode arguments;\x0a\x09\x09selector: aNode selector;\x0a\x09\x09messageSends: aNode messageSends;\x0a\x09\x09classReferences: aNode classReferences;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself).\x0a\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09self method add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09aNode nodes do: [ :each | self method add: (self visit: each) ].\x0a\x0a\x09aNode scope hasLocalReturn ifFalse: [\x0a\x09\x09(self method add: IRReturn new) add: (IRVariable new\x0a\x09\x09\x09variable: (aNode scope pseudoVars at: 'self');\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ self method",
  438. messageSends: ["method:", "source:", "source", "new", "arguments:", "arguments", "selector:", "selector", "messageSends:", "messageSends", "classReferences:", "classReferences", "scope:", "scope", "yourself", "do:", "add:", "name:", "name", "method", "temps", "visit:", "nodes", "ifFalse:", "variable:", "at:", "pseudoVars", "hasLocalReturn"],
  439. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRVariable", "IRReturn"]
  440. }),
  441. smalltalk.IRASTTranslator);
  442. smalltalk.addMethod(
  443. "_visitReturnNode_",
  444. smalltalk.method({
  445. selector: "visitReturnNode:",
  446. category: 'visiting',
  447. fn: function (aNode){
  448. var self=this;
  449. var $1;
  450. var return_;
  451. $1=smalltalk.send(aNode,"_nonLocalReturn",[]);
  452. if(smalltalk.assert($1)){
  453. return_=smalltalk.send((smalltalk.IRNonLocalReturn || IRNonLocalReturn),"_new",[]);
  454. } else {
  455. return_=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  456. };
  457. smalltalk.send(return_,"_scope_",[smalltalk.send(aNode,"_scope",[])]);
  458. smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  459. return smalltalk.send(return_,"_add_",[smalltalk.send(self,"_alias_",[each])]);
  460. })]);
  461. return return_;
  462. },
  463. args: ["aNode"],
  464. source: "visitReturnNode: aNode\x0a\x09| return |\x0a\x09return := aNode nonLocalReturn \x0a\x09\x09ifTrue: [ IRNonLocalReturn new ]\x0a\x09\x09ifFalse: [ IRReturn new ].\x0a\x09return scope: aNode scope.\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09return add: (self alias: each) ].\x0a\x09^ return",
  465. messageSends: ["ifTrue:ifFalse:", "new", "nonLocalReturn", "scope:", "scope", "do:", "add:", "alias:", "nodes"],
  466. referencedClasses: ["IRNonLocalReturn", "IRReturn"]
  467. }),
  468. smalltalk.IRASTTranslator);
  469. smalltalk.addMethod(
  470. "_visitSendNode_",
  471. smalltalk.method({
  472. selector: "visitSendNode:",
  473. category: 'visiting',
  474. fn: function (aNode){
  475. var self=this;
  476. var $1,$2;
  477. var send;
  478. var all;
  479. var receiver;
  480. var arguments;
  481. send=smalltalk.send((smalltalk.IRSend || IRSend),"_new",[]);
  482. smalltalk.send(send,"_selector_",[smalltalk.send(aNode,"_selector",[])]);
  483. $1=smalltalk.send(send,"_index_",[smalltalk.send(aNode,"_index",[])]);
  484. $2=smalltalk.send(aNode,"_superSend",[]);
  485. if(smalltalk.assert($2)){
  486. smalltalk.send(send,"_classSend_",[smalltalk.send(smalltalk.send(self,"_theClass",[]),"_superclass",[])]);
  487. };
  488. all=smalltalk.send(self,"_temporallyDependentList_",[smalltalk.send([smalltalk.send(aNode,"_receiver",[])],"__comma",[smalltalk.send(aNode,"_arguments",[])])]);
  489. receiver=smalltalk.send(all,"_first",[]);
  490. arguments=smalltalk.send(all,"_allButFirst",[]);
  491. smalltalk.send(send,"_add_",[receiver]);
  492. smalltalk.send(arguments,"_do_",[(function(each){
  493. return smalltalk.send(send,"_add_",[each]);
  494. })]);
  495. return send;
  496. },
  497. args: ["aNode"],
  498. source: "visitSendNode: aNode\x0a\x09| send all receiver arguments |\x0a\x09send := IRSend new.\x0a\x09send \x0a\x09\x09selector: aNode selector;\x0a\x09\x09index: aNode index.\x0a\x09aNode superSend ifTrue: [ send classSend: self theClass superclass ].\x0a \x0a all := self temporallyDependentList: { aNode receiver }, aNode arguments.\x0a\x09receiver := all first.\x0a\x09arguments := all allButFirst.\x0a\x0a\x09send add: receiver.\x0a\x09arguments do: [ :each | send add: each ].\x0a\x0a\x09^ send\x0a",
  499. messageSends: ["new", "selector:", "selector", "index:", "index", "ifTrue:", "classSend:", "superclass", "theClass", "superSend", "temporallyDependentList:", ",", "arguments", "receiver", "first", "allButFirst", "add:", "do:"],
  500. referencedClasses: ["IRSend"]
  501. }),
  502. smalltalk.IRASTTranslator);
  503. smalltalk.addMethod(
  504. "_visitSequenceNode_",
  505. smalltalk.method({
  506. selector: "visitSequenceNode:",
  507. category: 'visiting',
  508. fn: function (aNode){
  509. var self=this;
  510. var $2,$1;
  511. $1=smalltalk.send(self,"_withSequence_do_",[smalltalk.send((smalltalk.IRSequence || IRSequence),"_new",[]),(function(){
  512. return smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
  513. var instruction;
  514. instruction=smalltalk.send(self,"_visit_",[each]);
  515. instruction;
  516. $2=smalltalk.send(instruction,"_isVariable",[]);
  517. if(! smalltalk.assert($2)){
  518. return smalltalk.send(smalltalk.send(self,"_sequence",[]),"_add_",[instruction]);
  519. };
  520. })]);
  521. })]);
  522. return $1;
  523. },
  524. args: ["aNode"],
  525. source: "visitSequenceNode: aNode\x0a\x09^ self \x0a\x09\x09withSequence: IRSequence new \x09\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes do: [ :each | | instruction |\x0a\x09\x09\x09\x09instruction := self visit: each.\x0a\x09\x09\x09\x09instruction isVariable ifFalse: [\x0a\x09\x09\x09\x09\x09self sequence add: instruction ]]]",
  526. messageSends: ["withSequence:do:", "new", "do:", "visit:", "ifFalse:", "add:", "sequence", "isVariable", "nodes"],
  527. referencedClasses: ["IRSequence"]
  528. }),
  529. smalltalk.IRASTTranslator);
  530. smalltalk.addMethod(
  531. "_visitValueNode_",
  532. smalltalk.method({
  533. selector: "visitValueNode:",
  534. category: 'visiting',
  535. fn: function (aNode){
  536. var self=this;
  537. var $2,$3,$1;
  538. $2=smalltalk.send((smalltalk.IRValue || IRValue),"_new",[]);
  539. smalltalk.send($2,"_value_",[smalltalk.send(aNode,"_value",[])]);
  540. $3=smalltalk.send($2,"_yourself",[]);
  541. $1=$3;
  542. return $1;
  543. },
  544. args: ["aNode"],
  545. source: "visitValueNode: aNode\x0a\x09^ IRValue new \x0a\x09\x09value: aNode value; \x0a\x09\x09yourself",
  546. messageSends: ["value:", "value", "new", "yourself"],
  547. referencedClasses: ["IRValue"]
  548. }),
  549. smalltalk.IRASTTranslator);
  550. smalltalk.addMethod(
  551. "_visitVariableNode_",
  552. smalltalk.method({
  553. selector: "visitVariableNode:",
  554. category: 'visiting',
  555. fn: function (aNode){
  556. var self=this;
  557. var $2,$3,$1;
  558. $2=smalltalk.send((smalltalk.IRVariable || IRVariable),"_new",[]);
  559. smalltalk.send($2,"_variable_",[smalltalk.send(aNode,"_binding",[])]);
  560. $3=smalltalk.send($2,"_yourself",[]);
  561. $1=$3;
  562. return $1;
  563. },
  564. args: ["aNode"],
  565. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new \x0a\x09\x09variable: aNode binding; \x0a\x09\x09yourself",
  566. messageSends: ["variable:", "binding", "new", "yourself"],
  567. referencedClasses: ["IRVariable"]
  568. }),
  569. smalltalk.IRASTTranslator);
  570. smalltalk.addMethod(
  571. "_withSequence_do_",
  572. smalltalk.method({
  573. selector: "withSequence:do:",
  574. category: 'accessing',
  575. fn: function (aSequence,aBlock){
  576. var self=this;
  577. var outerSequence;
  578. outerSequence=smalltalk.send(self,"_sequence",[]);
  579. smalltalk.send(self,"_sequence_",[aSequence]);
  580. smalltalk.send(aBlock,"_value",[]);
  581. smalltalk.send(self,"_sequence_",[outerSequence]);
  582. return aSequence;
  583. },
  584. args: ["aSequence", "aBlock"],
  585. source: "withSequence: aSequence do: aBlock\x0a\x09| outerSequence |\x0a\x09outerSequence := self sequence.\x0a\x09self sequence: aSequence.\x0a\x09aBlock value.\x0a\x09self sequence: outerSequence.\x0a\x09^ aSequence",
  586. messageSends: ["sequence", "sequence:", "value"],
  587. referencedClasses: []
  588. }),
  589. smalltalk.IRASTTranslator);
  590. smalltalk.addClass('IRInstruction', smalltalk.Object, ['parent', 'instructions'], 'Compiler-IR');
  591. smalltalk.IRInstruction.comment="I am the abstract root class of the IR (intermediate representation) instructions class hierarchy.\x0aThe IR graph is used to emit JavaScript code using a JSStream. "
  592. smalltalk.addMethod(
  593. "_accept_",
  594. smalltalk.method({
  595. selector: "accept:",
  596. category: 'visiting',
  597. fn: function (aVisitor){
  598. var self=this;
  599. var $1;
  600. $1=smalltalk.send(aVisitor,"_visitIRInstruction_",[self]);
  601. return $1;
  602. },
  603. args: ["aVisitor"],
  604. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  605. messageSends: ["visitIRInstruction:"],
  606. referencedClasses: []
  607. }),
  608. smalltalk.IRInstruction);
  609. smalltalk.addMethod(
  610. "_add_",
  611. smalltalk.method({
  612. selector: "add:",
  613. category: 'building',
  614. fn: function (anObject){
  615. var self=this;
  616. var $1;
  617. smalltalk.send(anObject,"_parent_",[self]);
  618. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_add_",[anObject]);
  619. return $1;
  620. },
  621. args: ["anObject"],
  622. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  623. messageSends: ["parent:", "add:", "instructions"],
  624. referencedClasses: []
  625. }),
  626. smalltalk.IRInstruction);
  627. smalltalk.addMethod(
  628. "_canBeAssigned",
  629. smalltalk.method({
  630. selector: "canBeAssigned",
  631. category: 'testing',
  632. fn: function (){
  633. var self=this;
  634. return true;
  635. },
  636. args: [],
  637. source: "canBeAssigned\x0a\x09^ true",
  638. messageSends: [],
  639. referencedClasses: []
  640. }),
  641. smalltalk.IRInstruction);
  642. smalltalk.addMethod(
  643. "_instructions",
  644. smalltalk.method({
  645. selector: "instructions",
  646. category: 'accessing',
  647. fn: function (){
  648. var self=this;
  649. var $1;
  650. if(($receiver = self["@instructions"]) == nil || $receiver == undefined){
  651. self["@instructions"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  652. $1=self["@instructions"];
  653. } else {
  654. $1=self["@instructions"];
  655. };
  656. return $1;
  657. },
  658. args: [],
  659. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  660. messageSends: ["ifNil:", "new"],
  661. referencedClasses: ["OrderedCollection"]
  662. }),
  663. smalltalk.IRInstruction);
  664. smalltalk.addMethod(
  665. "_isClosure",
  666. smalltalk.method({
  667. selector: "isClosure",
  668. category: 'testing',
  669. fn: function (){
  670. var self=this;
  671. return false;
  672. },
  673. args: [],
  674. source: "isClosure\x0a\x09^ false",
  675. messageSends: [],
  676. referencedClasses: []
  677. }),
  678. smalltalk.IRInstruction);
  679. smalltalk.addMethod(
  680. "_isInlined",
  681. smalltalk.method({
  682. selector: "isInlined",
  683. category: 'testing',
  684. fn: function (){
  685. var self=this;
  686. return false;
  687. },
  688. args: [],
  689. source: "isInlined\x0a\x09^ false",
  690. messageSends: [],
  691. referencedClasses: []
  692. }),
  693. smalltalk.IRInstruction);
  694. smalltalk.addMethod(
  695. "_isLocalReturn",
  696. smalltalk.method({
  697. selector: "isLocalReturn",
  698. category: 'testing',
  699. fn: function (){
  700. var self=this;
  701. return false;
  702. },
  703. args: [],
  704. source: "isLocalReturn\x0a\x09^ false",
  705. messageSends: [],
  706. referencedClasses: []
  707. }),
  708. smalltalk.IRInstruction);
  709. smalltalk.addMethod(
  710. "_isReturn",
  711. smalltalk.method({
  712. selector: "isReturn",
  713. category: 'testing',
  714. fn: function (){
  715. var self=this;
  716. return false;
  717. },
  718. args: [],
  719. source: "isReturn\x0a\x09^ false",
  720. messageSends: [],
  721. referencedClasses: []
  722. }),
  723. smalltalk.IRInstruction);
  724. smalltalk.addMethod(
  725. "_isSend",
  726. smalltalk.method({
  727. selector: "isSend",
  728. category: 'testing',
  729. fn: function (){
  730. var self=this;
  731. return false;
  732. },
  733. args: [],
  734. source: "isSend\x0a\x09^ false",
  735. messageSends: [],
  736. referencedClasses: []
  737. }),
  738. smalltalk.IRInstruction);
  739. smalltalk.addMethod(
  740. "_isSequence",
  741. smalltalk.method({
  742. selector: "isSequence",
  743. category: 'testing',
  744. fn: function (){
  745. var self=this;
  746. return false;
  747. },
  748. args: [],
  749. source: "isSequence\x0a\x09^ false",
  750. messageSends: [],
  751. referencedClasses: []
  752. }),
  753. smalltalk.IRInstruction);
  754. smalltalk.addMethod(
  755. "_isTempDeclaration",
  756. smalltalk.method({
  757. selector: "isTempDeclaration",
  758. category: 'testing',
  759. fn: function (){
  760. var self=this;
  761. return false;
  762. },
  763. args: [],
  764. source: "isTempDeclaration\x0a\x09^ false",
  765. messageSends: [],
  766. referencedClasses: []
  767. }),
  768. smalltalk.IRInstruction);
  769. smalltalk.addMethod(
  770. "_isVariable",
  771. smalltalk.method({
  772. selector: "isVariable",
  773. category: 'testing',
  774. fn: function (){
  775. var self=this;
  776. return false;
  777. },
  778. args: [],
  779. source: "isVariable\x0a\x09^ false",
  780. messageSends: [],
  781. referencedClasses: []
  782. }),
  783. smalltalk.IRInstruction);
  784. smalltalk.addMethod(
  785. "_parent",
  786. smalltalk.method({
  787. selector: "parent",
  788. category: 'accessing',
  789. fn: function (){
  790. var self=this;
  791. return self["@parent"];
  792. },
  793. args: [],
  794. source: "parent\x0a\x09^ parent",
  795. messageSends: [],
  796. referencedClasses: []
  797. }),
  798. smalltalk.IRInstruction);
  799. smalltalk.addMethod(
  800. "_parent_",
  801. smalltalk.method({
  802. selector: "parent:",
  803. category: 'accessing',
  804. fn: function (anIRInstruction){
  805. var self=this;
  806. self["@parent"]=anIRInstruction;
  807. return self},
  808. args: ["anIRInstruction"],
  809. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  810. messageSends: [],
  811. referencedClasses: []
  812. }),
  813. smalltalk.IRInstruction);
  814. smalltalk.addMethod(
  815. "_remove",
  816. smalltalk.method({
  817. selector: "remove",
  818. category: 'building',
  819. fn: function (){
  820. var self=this;
  821. smalltalk.send(smalltalk.send(self,"_parent",[]),"_remove_",[self]);
  822. return self},
  823. args: [],
  824. source: "remove\x0a\x09self parent remove: self",
  825. messageSends: ["remove:", "parent"],
  826. referencedClasses: []
  827. }),
  828. smalltalk.IRInstruction);
  829. smalltalk.addMethod(
  830. "_remove_",
  831. smalltalk.method({
  832. selector: "remove:",
  833. category: 'building',
  834. fn: function (anIRInstruction){
  835. var self=this;
  836. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_remove_",[anIRInstruction]);
  837. return self},
  838. args: ["anIRInstruction"],
  839. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  840. messageSends: ["remove:", "instructions"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.IRInstruction);
  844. smalltalk.addMethod(
  845. "_replace_with_",
  846. smalltalk.method({
  847. selector: "replace:with:",
  848. category: 'building',
  849. fn: function (anIRInstruction,anotherIRInstruction){
  850. var self=this;
  851. smalltalk.send(anotherIRInstruction,"_parent_",[self]);
  852. smalltalk.send(smalltalk.send(self,"_instructions",[]),"_at_put_",[smalltalk.send(smalltalk.send(self,"_instructions",[]),"_indexOf_",[anIRInstruction]),anotherIRInstruction]);
  853. return self},
  854. args: ["anIRInstruction", "anotherIRInstruction"],
  855. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions \x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  856. messageSends: ["parent:", "at:put:", "indexOf:", "instructions"],
  857. referencedClasses: []
  858. }),
  859. smalltalk.IRInstruction);
  860. smalltalk.addMethod(
  861. "_replaceWith_",
  862. smalltalk.method({
  863. selector: "replaceWith:",
  864. category: 'building',
  865. fn: function (anIRInstruction){
  866. var self=this;
  867. smalltalk.send(smalltalk.send(self,"_parent",[]),"_replace_with_",[self,anIRInstruction]);
  868. return self},
  869. args: ["anIRInstruction"],
  870. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  871. messageSends: ["replace:with:", "parent"],
  872. referencedClasses: []
  873. }),
  874. smalltalk.IRInstruction);
  875. smalltalk.addMethod(
  876. "_on_",
  877. smalltalk.method({
  878. selector: "on:",
  879. category: 'instance creation',
  880. fn: function (aBuilder){
  881. var self=this;
  882. var $2,$3,$1;
  883. $2=smalltalk.send(self,"_new",[]);
  884. smalltalk.send($2,"_builder_",[aBuilder]);
  885. $3=smalltalk.send($2,"_yourself",[]);
  886. $1=$3;
  887. return $1;
  888. },
  889. args: ["aBuilder"],
  890. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  891. messageSends: ["builder:", "new", "yourself"],
  892. referencedClasses: []
  893. }),
  894. smalltalk.IRInstruction.klass);
  895. smalltalk.addClass('IRAssignment', smalltalk.IRInstruction, [], 'Compiler-IR');
  896. smalltalk.addMethod(
  897. "_accept_",
  898. smalltalk.method({
  899. selector: "accept:",
  900. category: 'visiting',
  901. fn: function (aVisitor){
  902. var self=this;
  903. var $1;
  904. $1=smalltalk.send(aVisitor,"_visitIRAssignment_",[self]);
  905. return $1;
  906. },
  907. args: ["aVisitor"],
  908. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  909. messageSends: ["visitIRAssignment:"],
  910. referencedClasses: []
  911. }),
  912. smalltalk.IRAssignment);
  913. smalltalk.addClass('IRDynamicArray', smalltalk.IRInstruction, [], 'Compiler-IR');
  914. smalltalk.addMethod(
  915. "_accept_",
  916. smalltalk.method({
  917. selector: "accept:",
  918. category: 'visiting',
  919. fn: function (aVisitor){
  920. var self=this;
  921. var $1;
  922. $1=smalltalk.send(aVisitor,"_visitIRDynamicArray_",[self]);
  923. return $1;
  924. },
  925. args: ["aVisitor"],
  926. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  927. messageSends: ["visitIRDynamicArray:"],
  928. referencedClasses: []
  929. }),
  930. smalltalk.IRDynamicArray);
  931. smalltalk.addClass('IRDynamicDictionary', smalltalk.IRInstruction, [], 'Compiler-IR');
  932. smalltalk.addMethod(
  933. "_accept_",
  934. smalltalk.method({
  935. selector: "accept:",
  936. category: 'visiting',
  937. fn: function (aVisitor){
  938. var self=this;
  939. var $1;
  940. $1=smalltalk.send(aVisitor,"_visitIRDynamicDictionary_",[self]);
  941. return $1;
  942. },
  943. args: ["aVisitor"],
  944. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  945. messageSends: ["visitIRDynamicDictionary:"],
  946. referencedClasses: []
  947. }),
  948. smalltalk.IRDynamicDictionary);
  949. smalltalk.addClass('IRScopedInstruction', smalltalk.IRInstruction, ['scope'], 'Compiler-IR');
  950. smalltalk.addMethod(
  951. "_scope",
  952. smalltalk.method({
  953. selector: "scope",
  954. category: 'accessing',
  955. fn: function (){
  956. var self=this;
  957. return self["@scope"];
  958. },
  959. args: [],
  960. source: "scope\x0a\x09^ scope",
  961. messageSends: [],
  962. referencedClasses: []
  963. }),
  964. smalltalk.IRScopedInstruction);
  965. smalltalk.addMethod(
  966. "_scope_",
  967. smalltalk.method({
  968. selector: "scope:",
  969. category: 'accessing',
  970. fn: function (aScope){
  971. var self=this;
  972. self["@scope"]=aScope;
  973. return self},
  974. args: ["aScope"],
  975. source: "scope: aScope\x0a\x09scope := aScope",
  976. messageSends: [],
  977. referencedClasses: []
  978. }),
  979. smalltalk.IRScopedInstruction);
  980. smalltalk.addClass('IRClosure', smalltalk.IRScopedInstruction, ['arguments'], 'Compiler-IR');
  981. smalltalk.addMethod(
  982. "_accept_",
  983. smalltalk.method({
  984. selector: "accept:",
  985. category: 'visiting',
  986. fn: function (aVisitor){
  987. var self=this;
  988. var $1;
  989. $1=smalltalk.send(aVisitor,"_visitIRClosure_",[self]);
  990. return $1;
  991. },
  992. args: ["aVisitor"],
  993. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  994. messageSends: ["visitIRClosure:"],
  995. referencedClasses: []
  996. }),
  997. smalltalk.IRClosure);
  998. smalltalk.addMethod(
  999. "_arguments",
  1000. smalltalk.method({
  1001. selector: "arguments",
  1002. category: 'accessing',
  1003. fn: function (){
  1004. var self=this;
  1005. var $1;
  1006. if(($receiver = self["@arguments"]) == nil || $receiver == undefined){
  1007. $1=[];
  1008. } else {
  1009. $1=self["@arguments"];
  1010. };
  1011. return $1;
  1012. },
  1013. args: [],
  1014. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  1015. messageSends: ["ifNil:"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.IRClosure);
  1019. smalltalk.addMethod(
  1020. "_arguments_",
  1021. smalltalk.method({
  1022. selector: "arguments:",
  1023. category: 'accessing',
  1024. fn: function (aCollection){
  1025. var self=this;
  1026. self["@arguments"]=aCollection;
  1027. return self},
  1028. args: ["aCollection"],
  1029. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1030. messageSends: [],
  1031. referencedClasses: []
  1032. }),
  1033. smalltalk.IRClosure);
  1034. smalltalk.addMethod(
  1035. "_isClosure",
  1036. smalltalk.method({
  1037. selector: "isClosure",
  1038. category: 'testing',
  1039. fn: function (){
  1040. var self=this;
  1041. return true;
  1042. },
  1043. args: [],
  1044. source: "isClosure\x0a\x09^ true",
  1045. messageSends: [],
  1046. referencedClasses: []
  1047. }),
  1048. smalltalk.IRClosure);
  1049. smalltalk.addMethod(
  1050. "_scope_",
  1051. smalltalk.method({
  1052. selector: "scope:",
  1053. category: 'accessing',
  1054. fn: function (aScope){
  1055. var self=this;
  1056. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  1057. smalltalk.send(aScope,"_instruction_",[self]);
  1058. return self},
  1059. args: ["aScope"],
  1060. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  1061. messageSends: ["scope:", "instruction:"],
  1062. referencedClasses: []
  1063. }),
  1064. smalltalk.IRClosure);
  1065. smalltalk.addMethod(
  1066. "_sequence",
  1067. smalltalk.method({
  1068. selector: "sequence",
  1069. category: 'accessing',
  1070. fn: function (){
  1071. var self=this;
  1072. var $1;
  1073. $1=smalltalk.send(smalltalk.send(self,"_instructions",[]),"_last",[]);
  1074. return $1;
  1075. },
  1076. args: [],
  1077. source: "sequence\x0a\x09^ self instructions last",
  1078. messageSends: ["last", "instructions"],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.IRClosure);
  1082. smalltalk.addClass('IRMethod', smalltalk.IRScopedInstruction, ['source', 'selector', 'classReferences', 'messageSends', 'arguments', 'internalVariables'], 'Compiler-IR');
  1083. smalltalk.IRMethod.comment="I am a method instruction"
  1084. smalltalk.addMethod(
  1085. "_accept_",
  1086. smalltalk.method({
  1087. selector: "accept:",
  1088. category: 'visiting',
  1089. fn: function (aVisitor){
  1090. var self=this;
  1091. var $1;
  1092. $1=smalltalk.send(aVisitor,"_visitIRMethod_",[self]);
  1093. return $1;
  1094. },
  1095. args: ["aVisitor"],
  1096. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  1097. messageSends: ["visitIRMethod:"],
  1098. referencedClasses: []
  1099. }),
  1100. smalltalk.IRMethod);
  1101. smalltalk.addMethod(
  1102. "_arguments",
  1103. smalltalk.method({
  1104. selector: "arguments",
  1105. category: 'accessing',
  1106. fn: function (){
  1107. var self=this;
  1108. return self["@arguments"];
  1109. },
  1110. args: [],
  1111. source: "arguments\x0a\x09^ arguments",
  1112. messageSends: [],
  1113. referencedClasses: []
  1114. }),
  1115. smalltalk.IRMethod);
  1116. smalltalk.addMethod(
  1117. "_arguments_",
  1118. smalltalk.method({
  1119. selector: "arguments:",
  1120. category: 'accessing',
  1121. fn: function (aCollection){
  1122. var self=this;
  1123. self["@arguments"]=aCollection;
  1124. return self},
  1125. args: ["aCollection"],
  1126. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  1127. messageSends: [],
  1128. referencedClasses: []
  1129. }),
  1130. smalltalk.IRMethod);
  1131. smalltalk.addMethod(
  1132. "_classReferences",
  1133. smalltalk.method({
  1134. selector: "classReferences",
  1135. category: 'accessing',
  1136. fn: function (){
  1137. var self=this;
  1138. return self["@classReferences"];
  1139. },
  1140. args: [],
  1141. source: "classReferences\x0a\x09^ classReferences",
  1142. messageSends: [],
  1143. referencedClasses: []
  1144. }),
  1145. smalltalk.IRMethod);
  1146. smalltalk.addMethod(
  1147. "_classReferences_",
  1148. smalltalk.method({
  1149. selector: "classReferences:",
  1150. category: 'accessing',
  1151. fn: function (aCollection){
  1152. var self=this;
  1153. self["@classReferences"]=aCollection;
  1154. return self},
  1155. args: ["aCollection"],
  1156. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  1157. messageSends: [],
  1158. referencedClasses: []
  1159. }),
  1160. smalltalk.IRMethod);
  1161. smalltalk.addMethod(
  1162. "_internalVariables",
  1163. smalltalk.method({
  1164. selector: "internalVariables",
  1165. category: 'accessing',
  1166. fn: function (){
  1167. var self=this;
  1168. var $1;
  1169. if(($receiver = self["@internalVariables"]) == nil || $receiver == undefined){
  1170. self["@internalVariables"]=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  1171. $1=self["@internalVariables"];
  1172. } else {
  1173. $1=self["@internalVariables"];
  1174. };
  1175. return $1;
  1176. },
  1177. args: [],
  1178. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  1179. messageSends: ["ifNil:", "new"],
  1180. referencedClasses: ["Set"]
  1181. }),
  1182. smalltalk.IRMethod);
  1183. smalltalk.addMethod(
  1184. "_messageSends",
  1185. smalltalk.method({
  1186. selector: "messageSends",
  1187. category: 'accessing',
  1188. fn: function (){
  1189. var self=this;
  1190. return self["@messageSends"];
  1191. },
  1192. args: [],
  1193. source: "messageSends\x0a\x09^ messageSends",
  1194. messageSends: [],
  1195. referencedClasses: []
  1196. }),
  1197. smalltalk.IRMethod);
  1198. smalltalk.addMethod(
  1199. "_messageSends_",
  1200. smalltalk.method({
  1201. selector: "messageSends:",
  1202. category: 'accessing',
  1203. fn: function (aCollection){
  1204. var self=this;
  1205. self["@messageSends"]=aCollection;
  1206. return self},
  1207. args: ["aCollection"],
  1208. source: "messageSends: aCollection\x0a\x09messageSends := aCollection",
  1209. messageSends: [],
  1210. referencedClasses: []
  1211. }),
  1212. smalltalk.IRMethod);
  1213. smalltalk.addMethod(
  1214. "_scope_",
  1215. smalltalk.method({
  1216. selector: "scope:",
  1217. category: 'accessing',
  1218. fn: function (aScope){
  1219. var self=this;
  1220. smalltalk.send(self,"_scope_",[aScope],smalltalk.IRScopedInstruction);
  1221. smalltalk.send(aScope,"_instruction_",[self]);
  1222. return self},
  1223. args: ["aScope"],
  1224. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  1225. messageSends: ["scope:", "instruction:"],
  1226. referencedClasses: []
  1227. }),
  1228. smalltalk.IRMethod);
  1229. smalltalk.addMethod(
  1230. "_selector",
  1231. smalltalk.method({
  1232. selector: "selector",
  1233. category: 'accessing',
  1234. fn: function (){
  1235. var self=this;
  1236. return self["@selector"];
  1237. },
  1238. args: [],
  1239. source: "selector\x0a\x09^ selector",
  1240. messageSends: [],
  1241. referencedClasses: []
  1242. }),
  1243. smalltalk.IRMethod);
  1244. smalltalk.addMethod(
  1245. "_selector_",
  1246. smalltalk.method({
  1247. selector: "selector:",
  1248. category: 'accessing',
  1249. fn: function (aString){
  1250. var self=this;
  1251. self["@selector"]=aString;
  1252. return self},
  1253. args: ["aString"],
  1254. source: "selector: aString\x0a\x09selector := aString",
  1255. messageSends: [],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.IRMethod);
  1259. smalltalk.addMethod(
  1260. "_source",
  1261. smalltalk.method({
  1262. selector: "source",
  1263. category: 'accessing',
  1264. fn: function (){
  1265. var self=this;
  1266. return self["@source"];
  1267. },
  1268. args: [],
  1269. source: "source\x0a\x09^ source",
  1270. messageSends: [],
  1271. referencedClasses: []
  1272. }),
  1273. smalltalk.IRMethod);
  1274. smalltalk.addMethod(
  1275. "_source_",
  1276. smalltalk.method({
  1277. selector: "source:",
  1278. category: 'accessing',
  1279. fn: function (aString){
  1280. var self=this;
  1281. self["@source"]=aString;
  1282. return self},
  1283. args: ["aString"],
  1284. source: "source: aString\x0a\x09source := aString",
  1285. messageSends: [],
  1286. referencedClasses: []
  1287. }),
  1288. smalltalk.IRMethod);
  1289. smalltalk.addClass('IRReturn', smalltalk.IRScopedInstruction, [], 'Compiler-IR');
  1290. smalltalk.IRReturn.comment="I am a local return instruction."
  1291. smalltalk.addMethod(
  1292. "_accept_",
  1293. smalltalk.method({
  1294. selector: "accept:",
  1295. category: 'visiting',
  1296. fn: function (aVisitor){
  1297. var self=this;
  1298. var $1;
  1299. $1=smalltalk.send(aVisitor,"_visitIRReturn_",[self]);
  1300. return $1;
  1301. },
  1302. args: ["aVisitor"],
  1303. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  1304. messageSends: ["visitIRReturn:"],
  1305. referencedClasses: []
  1306. }),
  1307. smalltalk.IRReturn);
  1308. smalltalk.addMethod(
  1309. "_canBeAssigned",
  1310. smalltalk.method({
  1311. selector: "canBeAssigned",
  1312. category: 'testing',
  1313. fn: function (){
  1314. var self=this;
  1315. return false;
  1316. },
  1317. args: [],
  1318. source: "canBeAssigned\x0a\x09^ false",
  1319. messageSends: [],
  1320. referencedClasses: []
  1321. }),
  1322. smalltalk.IRReturn);
  1323. smalltalk.addMethod(
  1324. "_isBlockReturn",
  1325. smalltalk.method({
  1326. selector: "isBlockReturn",
  1327. category: 'testing',
  1328. fn: function (){
  1329. var self=this;
  1330. return false;
  1331. },
  1332. args: [],
  1333. source: "isBlockReturn\x0a\x09^ false",
  1334. messageSends: [],
  1335. referencedClasses: []
  1336. }),
  1337. smalltalk.IRReturn);
  1338. smalltalk.addMethod(
  1339. "_isLocalReturn",
  1340. smalltalk.method({
  1341. selector: "isLocalReturn",
  1342. category: 'testing',
  1343. fn: function (){
  1344. var self=this;
  1345. return true;
  1346. },
  1347. args: [],
  1348. source: "isLocalReturn\x0a\x09^ true",
  1349. messageSends: [],
  1350. referencedClasses: []
  1351. }),
  1352. smalltalk.IRReturn);
  1353. smalltalk.addMethod(
  1354. "_isNonLocalReturn",
  1355. smalltalk.method({
  1356. selector: "isNonLocalReturn",
  1357. category: 'testing',
  1358. fn: function (){
  1359. var self=this;
  1360. var $1;
  1361. $1=smalltalk.send(smalltalk.send(self,"_isLocalReturn",[]),"_not",[]);
  1362. return $1;
  1363. },
  1364. args: [],
  1365. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  1366. messageSends: ["not", "isLocalReturn"],
  1367. referencedClasses: []
  1368. }),
  1369. smalltalk.IRReturn);
  1370. smalltalk.addMethod(
  1371. "_isReturn",
  1372. smalltalk.method({
  1373. selector: "isReturn",
  1374. category: 'testing',
  1375. fn: function (){
  1376. var self=this;
  1377. return true;
  1378. },
  1379. args: [],
  1380. source: "isReturn\x0a\x09^ true",
  1381. messageSends: [],
  1382. referencedClasses: []
  1383. }),
  1384. smalltalk.IRReturn);
  1385. smalltalk.addClass('IRBlockReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  1386. smalltalk.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction."
  1387. smalltalk.addMethod(
  1388. "_accept_",
  1389. smalltalk.method({
  1390. selector: "accept:",
  1391. category: 'visiting',
  1392. fn: function (aVisitor){
  1393. var self=this;
  1394. var $1;
  1395. $1=smalltalk.send(aVisitor,"_visitIRBlockReturn_",[self]);
  1396. return $1;
  1397. },
  1398. args: ["aVisitor"],
  1399. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  1400. messageSends: ["visitIRBlockReturn:"],
  1401. referencedClasses: []
  1402. }),
  1403. smalltalk.IRBlockReturn);
  1404. smalltalk.addMethod(
  1405. "_isBlockReturn",
  1406. smalltalk.method({
  1407. selector: "isBlockReturn",
  1408. category: 'testing',
  1409. fn: function (){
  1410. var self=this;
  1411. return true;
  1412. },
  1413. args: [],
  1414. source: "isBlockReturn\x0a\x09^ true",
  1415. messageSends: [],
  1416. referencedClasses: []
  1417. }),
  1418. smalltalk.IRBlockReturn);
  1419. smalltalk.addClass('IRNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-IR');
  1420. smalltalk.IRNonLocalReturn.comment="I am a non local return instruction.\x0aNon local returns are handled using a try/catch JS statement.\x0a\x0aSee IRNonLocalReturnHandling class"
  1421. smalltalk.addMethod(
  1422. "_accept_",
  1423. smalltalk.method({
  1424. selector: "accept:",
  1425. category: 'visiting',
  1426. fn: function (aVisitor){
  1427. var self=this;
  1428. var $1;
  1429. $1=smalltalk.send(aVisitor,"_visitIRNonLocalReturn_",[self]);
  1430. return $1;
  1431. },
  1432. args: ["aVisitor"],
  1433. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  1434. messageSends: ["visitIRNonLocalReturn:"],
  1435. referencedClasses: []
  1436. }),
  1437. smalltalk.IRNonLocalReturn);
  1438. smalltalk.addMethod(
  1439. "_isLocalReturn",
  1440. smalltalk.method({
  1441. selector: "isLocalReturn",
  1442. category: 'testing',
  1443. fn: function (){
  1444. var self=this;
  1445. return false;
  1446. },
  1447. args: [],
  1448. source: "isLocalReturn\x0a\x09^ false",
  1449. messageSends: [],
  1450. referencedClasses: []
  1451. }),
  1452. smalltalk.IRNonLocalReturn);
  1453. smalltalk.addClass('IRSend', smalltalk.IRInstruction, ['selector', 'classSend', 'index'], 'Compiler-IR');
  1454. smalltalk.IRSend.comment="I am a message send instruction. "
  1455. smalltalk.addMethod(
  1456. "_accept_",
  1457. smalltalk.method({
  1458. selector: "accept:",
  1459. category: 'visiting',
  1460. fn: function (aVisitor){
  1461. var self=this;
  1462. var $1;
  1463. $1=smalltalk.send(aVisitor,"_visitIRSend_",[self]);
  1464. return $1;
  1465. },
  1466. args: ["aVisitor"],
  1467. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  1468. messageSends: ["visitIRSend:"],
  1469. referencedClasses: []
  1470. }),
  1471. smalltalk.IRSend);
  1472. smalltalk.addMethod(
  1473. "_classSend",
  1474. smalltalk.method({
  1475. selector: "classSend",
  1476. category: 'accessing',
  1477. fn: function (){
  1478. var self=this;
  1479. return self["@classSend"];
  1480. },
  1481. args: [],
  1482. source: "classSend\x0a\x09^ classSend",
  1483. messageSends: [],
  1484. referencedClasses: []
  1485. }),
  1486. smalltalk.IRSend);
  1487. smalltalk.addMethod(
  1488. "_classSend_",
  1489. smalltalk.method({
  1490. selector: "classSend:",
  1491. category: 'accessing',
  1492. fn: function (aClass){
  1493. var self=this;
  1494. self["@classSend"]=aClass;
  1495. return self},
  1496. args: ["aClass"],
  1497. source: "classSend: aClass\x0a\x09classSend := aClass",
  1498. messageSends: [],
  1499. referencedClasses: []
  1500. }),
  1501. smalltalk.IRSend);
  1502. smalltalk.addMethod(
  1503. "_index",
  1504. smalltalk.method({
  1505. selector: "index",
  1506. category: 'accessing',
  1507. fn: function (){
  1508. var self=this;
  1509. return self["@index"];
  1510. },
  1511. args: [],
  1512. source: "index\x0a\x09^ index",
  1513. messageSends: [],
  1514. referencedClasses: []
  1515. }),
  1516. smalltalk.IRSend);
  1517. smalltalk.addMethod(
  1518. "_index_",
  1519. smalltalk.method({
  1520. selector: "index:",
  1521. category: 'accessing',
  1522. fn: function (anInteger){
  1523. var self=this;
  1524. self["@index"]=anInteger;
  1525. return self},
  1526. args: ["anInteger"],
  1527. source: "index: anInteger\x0a\x09index := anInteger",
  1528. messageSends: [],
  1529. referencedClasses: []
  1530. }),
  1531. smalltalk.IRSend);
  1532. smalltalk.addMethod(
  1533. "_isSend",
  1534. smalltalk.method({
  1535. selector: "isSend",
  1536. category: 'testing',
  1537. fn: function (){
  1538. var self=this;
  1539. return true;
  1540. },
  1541. args: [],
  1542. source: "isSend\x0a\x09^ true",
  1543. messageSends: [],
  1544. referencedClasses: []
  1545. }),
  1546. smalltalk.IRSend);
  1547. smalltalk.addMethod(
  1548. "_selector",
  1549. smalltalk.method({
  1550. selector: "selector",
  1551. category: 'accessing',
  1552. fn: function (){
  1553. var self=this;
  1554. return self["@selector"];
  1555. },
  1556. args: [],
  1557. source: "selector\x0a\x09^ selector",
  1558. messageSends: [],
  1559. referencedClasses: []
  1560. }),
  1561. smalltalk.IRSend);
  1562. smalltalk.addMethod(
  1563. "_selector_",
  1564. smalltalk.method({
  1565. selector: "selector:",
  1566. category: 'accessing',
  1567. fn: function (aString){
  1568. var self=this;
  1569. self["@selector"]=aString;
  1570. return self},
  1571. args: ["aString"],
  1572. source: "selector: aString\x0a\x09selector := aString",
  1573. messageSends: [],
  1574. referencedClasses: []
  1575. }),
  1576. smalltalk.IRSend);
  1577. smalltalk.addClass('IRSequence', smalltalk.IRInstruction, [], 'Compiler-IR');
  1578. smalltalk.addMethod(
  1579. "_accept_",
  1580. smalltalk.method({
  1581. selector: "accept:",
  1582. category: 'visiting',
  1583. fn: function (aVisitor){
  1584. var self=this;
  1585. var $1;
  1586. $1=smalltalk.send(aVisitor,"_visitIRSequence_",[self]);
  1587. return $1;
  1588. },
  1589. args: ["aVisitor"],
  1590. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  1591. messageSends: ["visitIRSequence:"],
  1592. referencedClasses: []
  1593. }),
  1594. smalltalk.IRSequence);
  1595. smalltalk.addMethod(
  1596. "_isSequence",
  1597. smalltalk.method({
  1598. selector: "isSequence",
  1599. category: 'testing',
  1600. fn: function (){
  1601. var self=this;
  1602. return true;
  1603. },
  1604. args: [],
  1605. source: "isSequence\x0a\x09^ true",
  1606. messageSends: [],
  1607. referencedClasses: []
  1608. }),
  1609. smalltalk.IRSequence);
  1610. smalltalk.addClass('IRBlockSequence', smalltalk.IRSequence, [], 'Compiler-IR');
  1611. smalltalk.addMethod(
  1612. "_accept_",
  1613. smalltalk.method({
  1614. selector: "accept:",
  1615. category: 'visiting',
  1616. fn: function (aVisitor){
  1617. var self=this;
  1618. var $1;
  1619. $1=smalltalk.send(aVisitor,"_visitIRBlockSequence_",[self]);
  1620. return $1;
  1621. },
  1622. args: ["aVisitor"],
  1623. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  1624. messageSends: ["visitIRBlockSequence:"],
  1625. referencedClasses: []
  1626. }),
  1627. smalltalk.IRBlockSequence);
  1628. smalltalk.addClass('IRTempDeclaration', smalltalk.IRInstruction, ['name'], 'Compiler-IR');
  1629. smalltalk.IRTempDeclaration.comment="I am a temporary variable declaration instruction"
  1630. smalltalk.addMethod(
  1631. "_accept_",
  1632. smalltalk.method({
  1633. selector: "accept:",
  1634. category: 'visiting',
  1635. fn: function (aVisitor){
  1636. var self=this;
  1637. var $1;
  1638. $1=smalltalk.send(aVisitor,"_visitIRTempDeclaration_",[self]);
  1639. return $1;
  1640. },
  1641. args: ["aVisitor"],
  1642. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  1643. messageSends: ["visitIRTempDeclaration:"],
  1644. referencedClasses: []
  1645. }),
  1646. smalltalk.IRTempDeclaration);
  1647. smalltalk.addMethod(
  1648. "_isTempDeclaration",
  1649. smalltalk.method({
  1650. selector: "isTempDeclaration",
  1651. category: 'visiting',
  1652. fn: function (){
  1653. var self=this;
  1654. return true;
  1655. },
  1656. args: [],
  1657. source: "isTempDeclaration\x0a\x09^ true",
  1658. messageSends: [],
  1659. referencedClasses: []
  1660. }),
  1661. smalltalk.IRTempDeclaration);
  1662. smalltalk.addMethod(
  1663. "_name",
  1664. smalltalk.method({
  1665. selector: "name",
  1666. category: 'accessing',
  1667. fn: function (){
  1668. var self=this;
  1669. return self["@name"];
  1670. },
  1671. args: [],
  1672. source: "name\x0a\x09^ name",
  1673. messageSends: [],
  1674. referencedClasses: []
  1675. }),
  1676. smalltalk.IRTempDeclaration);
  1677. smalltalk.addMethod(
  1678. "_name_",
  1679. smalltalk.method({
  1680. selector: "name:",
  1681. category: 'accessing',
  1682. fn: function (aString){
  1683. var self=this;
  1684. self["@name"]=aString;
  1685. return self},
  1686. args: ["aString"],
  1687. source: "name: aString\x0a\x09name := aString",
  1688. messageSends: [],
  1689. referencedClasses: []
  1690. }),
  1691. smalltalk.IRTempDeclaration);
  1692. smalltalk.addClass('IRValue', smalltalk.IRInstruction, ['value'], 'Compiler-IR');
  1693. smalltalk.IRValue.comment="I am the simplest possible instruction. I represent a value."
  1694. smalltalk.addMethod(
  1695. "_accept_",
  1696. smalltalk.method({
  1697. selector: "accept:",
  1698. category: 'visiting',
  1699. fn: function (aVisitor){
  1700. var self=this;
  1701. var $1;
  1702. $1=smalltalk.send(aVisitor,"_visitIRValue_",[self]);
  1703. return $1;
  1704. },
  1705. args: ["aVisitor"],
  1706. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  1707. messageSends: ["visitIRValue:"],
  1708. referencedClasses: []
  1709. }),
  1710. smalltalk.IRValue);
  1711. smalltalk.addMethod(
  1712. "_value",
  1713. smalltalk.method({
  1714. selector: "value",
  1715. category: 'accessing',
  1716. fn: function (){
  1717. var self=this;
  1718. return self["@value"];
  1719. },
  1720. args: [],
  1721. source: "value\x0a\x09^value",
  1722. messageSends: [],
  1723. referencedClasses: []
  1724. }),
  1725. smalltalk.IRValue);
  1726. smalltalk.addMethod(
  1727. "_value_",
  1728. smalltalk.method({
  1729. selector: "value:",
  1730. category: 'accessing',
  1731. fn: function (aString){
  1732. var self=this;
  1733. self["@value"]=aString;
  1734. return self},
  1735. args: ["aString"],
  1736. source: "value: aString\x0a\x09value := aString",
  1737. messageSends: [],
  1738. referencedClasses: []
  1739. }),
  1740. smalltalk.IRValue);
  1741. smalltalk.addClass('IRVariable', smalltalk.IRInstruction, ['variable'], 'Compiler-IR');
  1742. smalltalk.IRVariable.comment="I am a variable instruction."
  1743. smalltalk.addMethod(
  1744. "_accept_",
  1745. smalltalk.method({
  1746. selector: "accept:",
  1747. category: 'visiting',
  1748. fn: function (aVisitor){
  1749. var self=this;
  1750. var $1;
  1751. $1=smalltalk.send(aVisitor,"_visitIRVariable_",[self]);
  1752. return $1;
  1753. },
  1754. args: ["aVisitor"],
  1755. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  1756. messageSends: ["visitIRVariable:"],
  1757. referencedClasses: []
  1758. }),
  1759. smalltalk.IRVariable);
  1760. smalltalk.addMethod(
  1761. "_isVariable",
  1762. smalltalk.method({
  1763. selector: "isVariable",
  1764. category: 'testing',
  1765. fn: function (){
  1766. var self=this;
  1767. return true;
  1768. },
  1769. args: [],
  1770. source: "isVariable\x0a\x09^ true",
  1771. messageSends: [],
  1772. referencedClasses: []
  1773. }),
  1774. smalltalk.IRVariable);
  1775. smalltalk.addMethod(
  1776. "_variable",
  1777. smalltalk.method({
  1778. selector: "variable",
  1779. category: 'accessing',
  1780. fn: function (){
  1781. var self=this;
  1782. return self["@variable"];
  1783. },
  1784. args: [],
  1785. source: "variable\x0a\x09^ variable",
  1786. messageSends: [],
  1787. referencedClasses: []
  1788. }),
  1789. smalltalk.IRVariable);
  1790. smalltalk.addMethod(
  1791. "_variable_",
  1792. smalltalk.method({
  1793. selector: "variable:",
  1794. category: 'accessing',
  1795. fn: function (aScopeVariable){
  1796. var self=this;
  1797. self["@variable"]=aScopeVariable;
  1798. return self},
  1799. args: ["aScopeVariable"],
  1800. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  1801. messageSends: [],
  1802. referencedClasses: []
  1803. }),
  1804. smalltalk.IRVariable);
  1805. smalltalk.addClass('IRVerbatim', smalltalk.IRInstruction, ['source'], 'Compiler-IR');
  1806. smalltalk.addMethod(
  1807. "_accept_",
  1808. smalltalk.method({
  1809. selector: "accept:",
  1810. category: 'visiting',
  1811. fn: function (aVisitor){
  1812. var self=this;
  1813. var $1;
  1814. $1=smalltalk.send(aVisitor,"_visitIRVerbatim_",[self]);
  1815. return $1;
  1816. },
  1817. args: ["aVisitor"],
  1818. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  1819. messageSends: ["visitIRVerbatim:"],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.IRVerbatim);
  1823. smalltalk.addMethod(
  1824. "_source",
  1825. smalltalk.method({
  1826. selector: "source",
  1827. category: 'accessing',
  1828. fn: function (){
  1829. var self=this;
  1830. return self["@source"];
  1831. },
  1832. args: [],
  1833. source: "source\x0a\x09^ source",
  1834. messageSends: [],
  1835. referencedClasses: []
  1836. }),
  1837. smalltalk.IRVerbatim);
  1838. smalltalk.addMethod(
  1839. "_source_",
  1840. smalltalk.method({
  1841. selector: "source:",
  1842. category: 'accessing',
  1843. fn: function (aString){
  1844. var self=this;
  1845. self["@source"]=aString;
  1846. return self},
  1847. args: ["aString"],
  1848. source: "source: aString\x0a\x09source := aString",
  1849. messageSends: [],
  1850. referencedClasses: []
  1851. }),
  1852. smalltalk.IRVerbatim);
  1853. smalltalk.addClass('IRVisitor', smalltalk.Object, [], 'Compiler-IR');
  1854. smalltalk.addMethod(
  1855. "_visit_",
  1856. smalltalk.method({
  1857. selector: "visit:",
  1858. category: 'visiting',
  1859. fn: function (anIRInstruction){
  1860. var self=this;
  1861. var $1;
  1862. $1=smalltalk.send(anIRInstruction,"_accept_",[self]);
  1863. return $1;
  1864. },
  1865. args: ["anIRInstruction"],
  1866. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  1867. messageSends: ["accept:"],
  1868. referencedClasses: []
  1869. }),
  1870. smalltalk.IRVisitor);
  1871. smalltalk.addMethod(
  1872. "_visitIRAssignment_",
  1873. smalltalk.method({
  1874. selector: "visitIRAssignment:",
  1875. category: 'visiting',
  1876. fn: function (anIRAssignment){
  1877. var self=this;
  1878. var $1;
  1879. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRAssignment]);
  1880. return $1;
  1881. },
  1882. args: ["anIRAssignment"],
  1883. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  1884. messageSends: ["visitIRInstruction:"],
  1885. referencedClasses: []
  1886. }),
  1887. smalltalk.IRVisitor);
  1888. smalltalk.addMethod(
  1889. "_visitIRBlockReturn_",
  1890. smalltalk.method({
  1891. selector: "visitIRBlockReturn:",
  1892. category: 'visiting',
  1893. fn: function (anIRBlockReturn){
  1894. var self=this;
  1895. var $1;
  1896. $1=smalltalk.send(self,"_visitIRReturn_",[anIRBlockReturn]);
  1897. return $1;
  1898. },
  1899. args: ["anIRBlockReturn"],
  1900. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  1901. messageSends: ["visitIRReturn:"],
  1902. referencedClasses: []
  1903. }),
  1904. smalltalk.IRVisitor);
  1905. smalltalk.addMethod(
  1906. "_visitIRBlockSequence_",
  1907. smalltalk.method({
  1908. selector: "visitIRBlockSequence:",
  1909. category: 'visiting',
  1910. fn: function (anIRBlockSequence){
  1911. var self=this;
  1912. var $1;
  1913. $1=smalltalk.send(self,"_visitIRSequence_",[anIRBlockSequence]);
  1914. return $1;
  1915. },
  1916. args: ["anIRBlockSequence"],
  1917. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  1918. messageSends: ["visitIRSequence:"],
  1919. referencedClasses: []
  1920. }),
  1921. smalltalk.IRVisitor);
  1922. smalltalk.addMethod(
  1923. "_visitIRClosure_",
  1924. smalltalk.method({
  1925. selector: "visitIRClosure:",
  1926. category: 'visiting',
  1927. fn: function (anIRClosure){
  1928. var self=this;
  1929. var $1;
  1930. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRClosure]);
  1931. return $1;
  1932. },
  1933. args: ["anIRClosure"],
  1934. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  1935. messageSends: ["visitIRInstruction:"],
  1936. referencedClasses: []
  1937. }),
  1938. smalltalk.IRVisitor);
  1939. smalltalk.addMethod(
  1940. "_visitIRDynamicArray_",
  1941. smalltalk.method({
  1942. selector: "visitIRDynamicArray:",
  1943. category: 'visiting',
  1944. fn: function (anIRDynamicArray){
  1945. var self=this;
  1946. var $1;
  1947. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicArray]);
  1948. return $1;
  1949. },
  1950. args: ["anIRDynamicArray"],
  1951. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  1952. messageSends: ["visitIRInstruction:"],
  1953. referencedClasses: []
  1954. }),
  1955. smalltalk.IRVisitor);
  1956. smalltalk.addMethod(
  1957. "_visitIRDynamicDictionary_",
  1958. smalltalk.method({
  1959. selector: "visitIRDynamicDictionary:",
  1960. category: 'visiting',
  1961. fn: function (anIRDynamicDictionary){
  1962. var self=this;
  1963. var $1;
  1964. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRDynamicDictionary]);
  1965. return $1;
  1966. },
  1967. args: ["anIRDynamicDictionary"],
  1968. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  1969. messageSends: ["visitIRInstruction:"],
  1970. referencedClasses: []
  1971. }),
  1972. smalltalk.IRVisitor);
  1973. smalltalk.addMethod(
  1974. "_visitIRInlinedClosure_",
  1975. smalltalk.method({
  1976. selector: "visitIRInlinedClosure:",
  1977. category: 'visiting',
  1978. fn: function (anIRInlinedClosure){
  1979. var self=this;
  1980. var $1;
  1981. $1=smalltalk.send(self,"_visitIRClosure_",[anIRInlinedClosure]);
  1982. return $1;
  1983. },
  1984. args: ["anIRInlinedClosure"],
  1985. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  1986. messageSends: ["visitIRClosure:"],
  1987. referencedClasses: []
  1988. }),
  1989. smalltalk.IRVisitor);
  1990. smalltalk.addMethod(
  1991. "_visitIRInlinedSequence_",
  1992. smalltalk.method({
  1993. selector: "visitIRInlinedSequence:",
  1994. category: 'visiting',
  1995. fn: function (anIRInlinedSequence){
  1996. var self=this;
  1997. var $1;
  1998. $1=smalltalk.send(self,"_visitIRSequence_",[anIRInlinedSequence]);
  1999. return $1;
  2000. },
  2001. args: ["anIRInlinedSequence"],
  2002. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  2003. messageSends: ["visitIRSequence:"],
  2004. referencedClasses: []
  2005. }),
  2006. smalltalk.IRVisitor);
  2007. smalltalk.addMethod(
  2008. "_visitIRInstruction_",
  2009. smalltalk.method({
  2010. selector: "visitIRInstruction:",
  2011. category: 'visiting',
  2012. fn: function (anIRInstruction){
  2013. var self=this;
  2014. smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_do_",[(function(each){
  2015. return smalltalk.send(self,"_visit_",[each]);
  2016. })]);
  2017. return anIRInstruction;
  2018. },
  2019. args: ["anIRInstruction"],
  2020. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  2021. messageSends: ["do:", "visit:", "instructions"],
  2022. referencedClasses: []
  2023. }),
  2024. smalltalk.IRVisitor);
  2025. smalltalk.addMethod(
  2026. "_visitIRMethod_",
  2027. smalltalk.method({
  2028. selector: "visitIRMethod:",
  2029. category: 'visiting',
  2030. fn: function (anIRMethod){
  2031. var self=this;
  2032. var $1;
  2033. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRMethod]);
  2034. return $1;
  2035. },
  2036. args: ["anIRMethod"],
  2037. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  2038. messageSends: ["visitIRInstruction:"],
  2039. referencedClasses: []
  2040. }),
  2041. smalltalk.IRVisitor);
  2042. smalltalk.addMethod(
  2043. "_visitIRNonLocalReturn_",
  2044. smalltalk.method({
  2045. selector: "visitIRNonLocalReturn:",
  2046. category: 'visiting',
  2047. fn: function (anIRNonLocalReturn){
  2048. var self=this;
  2049. var $1;
  2050. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturn]);
  2051. return $1;
  2052. },
  2053. args: ["anIRNonLocalReturn"],
  2054. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  2055. messageSends: ["visitIRInstruction:"],
  2056. referencedClasses: []
  2057. }),
  2058. smalltalk.IRVisitor);
  2059. smalltalk.addMethod(
  2060. "_visitIRNonLocalReturnHandling_",
  2061. smalltalk.method({
  2062. selector: "visitIRNonLocalReturnHandling:",
  2063. category: 'visiting',
  2064. fn: function (anIRNonLocalReturnHandling){
  2065. var self=this;
  2066. var $1;
  2067. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRNonLocalReturnHandling]);
  2068. return $1;
  2069. },
  2070. args: ["anIRNonLocalReturnHandling"],
  2071. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  2072. messageSends: ["visitIRInstruction:"],
  2073. referencedClasses: []
  2074. }),
  2075. smalltalk.IRVisitor);
  2076. smalltalk.addMethod(
  2077. "_visitIRReturn_",
  2078. smalltalk.method({
  2079. selector: "visitIRReturn:",
  2080. category: 'visiting',
  2081. fn: function (anIRReturn){
  2082. var self=this;
  2083. var $1;
  2084. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRReturn]);
  2085. return $1;
  2086. },
  2087. args: ["anIRReturn"],
  2088. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  2089. messageSends: ["visitIRInstruction:"],
  2090. referencedClasses: []
  2091. }),
  2092. smalltalk.IRVisitor);
  2093. smalltalk.addMethod(
  2094. "_visitIRSend_",
  2095. smalltalk.method({
  2096. selector: "visitIRSend:",
  2097. category: 'visiting',
  2098. fn: function (anIRSend){
  2099. var self=this;
  2100. var $1;
  2101. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSend]);
  2102. return $1;
  2103. },
  2104. args: ["anIRSend"],
  2105. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  2106. messageSends: ["visitIRInstruction:"],
  2107. referencedClasses: []
  2108. }),
  2109. smalltalk.IRVisitor);
  2110. smalltalk.addMethod(
  2111. "_visitIRSequence_",
  2112. smalltalk.method({
  2113. selector: "visitIRSequence:",
  2114. category: 'visiting',
  2115. fn: function (anIRSequence){
  2116. var self=this;
  2117. var $1;
  2118. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRSequence]);
  2119. return $1;
  2120. },
  2121. args: ["anIRSequence"],
  2122. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  2123. messageSends: ["visitIRInstruction:"],
  2124. referencedClasses: []
  2125. }),
  2126. smalltalk.IRVisitor);
  2127. smalltalk.addMethod(
  2128. "_visitIRTempDeclaration_",
  2129. smalltalk.method({
  2130. selector: "visitIRTempDeclaration:",
  2131. category: 'visiting',
  2132. fn: function (anIRTempDeclaration){
  2133. var self=this;
  2134. var $1;
  2135. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRTempDeclaration]);
  2136. return $1;
  2137. },
  2138. args: ["anIRTempDeclaration"],
  2139. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  2140. messageSends: ["visitIRInstruction:"],
  2141. referencedClasses: []
  2142. }),
  2143. smalltalk.IRVisitor);
  2144. smalltalk.addMethod(
  2145. "_visitIRValue_",
  2146. smalltalk.method({
  2147. selector: "visitIRValue:",
  2148. category: 'visiting',
  2149. fn: function (anIRValue){
  2150. var self=this;
  2151. var $1;
  2152. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRValue]);
  2153. return $1;
  2154. },
  2155. args: ["anIRValue"],
  2156. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  2157. messageSends: ["visitIRInstruction:"],
  2158. referencedClasses: []
  2159. }),
  2160. smalltalk.IRVisitor);
  2161. smalltalk.addMethod(
  2162. "_visitIRVariable_",
  2163. smalltalk.method({
  2164. selector: "visitIRVariable:",
  2165. category: 'visiting',
  2166. fn: function (anIRVariable){
  2167. var self=this;
  2168. var $1;
  2169. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVariable]);
  2170. return $1;
  2171. },
  2172. args: ["anIRVariable"],
  2173. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  2174. messageSends: ["visitIRInstruction:"],
  2175. referencedClasses: []
  2176. }),
  2177. smalltalk.IRVisitor);
  2178. smalltalk.addMethod(
  2179. "_visitIRVerbatim_",
  2180. smalltalk.method({
  2181. selector: "visitIRVerbatim:",
  2182. category: 'visiting',
  2183. fn: function (anIRVerbatim){
  2184. var self=this;
  2185. var $1;
  2186. $1=smalltalk.send(self,"_visitIRInstruction_",[anIRVerbatim]);
  2187. return $1;
  2188. },
  2189. args: ["anIRVerbatim"],
  2190. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  2191. messageSends: ["visitIRInstruction:"],
  2192. referencedClasses: []
  2193. }),
  2194. smalltalk.IRVisitor);
  2195. smalltalk.addClass('IRJSTranslator', smalltalk.IRVisitor, ['stream'], 'Compiler-IR');
  2196. smalltalk.addMethod(
  2197. "_contents",
  2198. smalltalk.method({
  2199. selector: "contents",
  2200. category: 'accessing',
  2201. fn: function (){
  2202. var self=this;
  2203. var $1;
  2204. $1=smalltalk.send(smalltalk.send(self,"_stream",[]),"_contents",[]);
  2205. return $1;
  2206. },
  2207. args: [],
  2208. source: "contents\x0a\x09^ self stream contents",
  2209. messageSends: ["contents", "stream"],
  2210. referencedClasses: []
  2211. }),
  2212. smalltalk.IRJSTranslator);
  2213. smalltalk.addMethod(
  2214. "_initialize",
  2215. smalltalk.method({
  2216. selector: "initialize",
  2217. category: 'initialization',
  2218. fn: function (){
  2219. var self=this;
  2220. smalltalk.send(self,"_initialize",[],smalltalk.IRVisitor);
  2221. self["@stream"]=smalltalk.send((smalltalk.JSStream || JSStream),"_new",[]);
  2222. return self},
  2223. args: [],
  2224. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  2225. messageSends: ["initialize", "new"],
  2226. referencedClasses: ["JSStream"]
  2227. }),
  2228. smalltalk.IRJSTranslator);
  2229. smalltalk.addMethod(
  2230. "_stream",
  2231. smalltalk.method({
  2232. selector: "stream",
  2233. category: 'accessing',
  2234. fn: function (){
  2235. var self=this;
  2236. return self["@stream"];
  2237. },
  2238. args: [],
  2239. source: "stream\x0a\x09^ stream",
  2240. messageSends: [],
  2241. referencedClasses: []
  2242. }),
  2243. smalltalk.IRJSTranslator);
  2244. smalltalk.addMethod(
  2245. "_stream_",
  2246. smalltalk.method({
  2247. selector: "stream:",
  2248. category: 'accessing',
  2249. fn: function (aStream){
  2250. var self=this;
  2251. self["@stream"]=aStream;
  2252. return self},
  2253. args: ["aStream"],
  2254. source: "stream: aStream\x0a\x09stream := aStream",
  2255. messageSends: [],
  2256. referencedClasses: []
  2257. }),
  2258. smalltalk.IRJSTranslator);
  2259. smalltalk.addMethod(
  2260. "_visitIRAssignment_",
  2261. smalltalk.method({
  2262. selector: "visitIRAssignment:",
  2263. category: 'visiting',
  2264. fn: function (anIRAssignment){
  2265. var self=this;
  2266. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_first",[])]);
  2267. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAssignment",[]);
  2268. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  2269. return self},
  2270. args: ["anIRAssignment"],
  2271. source: "visitIRAssignment: anIRAssignment\x0a\x09self visit: anIRAssignment instructions first.\x0a\x09self stream nextPutAssignment.\x0a\x09self visit: anIRAssignment instructions last.",
  2272. messageSends: ["visit:", "first", "instructions", "nextPutAssignment", "stream", "last"],
  2273. referencedClasses: []
  2274. }),
  2275. smalltalk.IRJSTranslator);
  2276. smalltalk.addMethod(
  2277. "_visitIRClosure_",
  2278. smalltalk.method({
  2279. selector: "visitIRClosure:",
  2280. category: 'visiting',
  2281. fn: function (anIRClosure){
  2282. var self=this;
  2283. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutClosureWith_arguments_",[(function(){
  2284. return smalltalk.send(self,"_visitIRClosure_",[anIRClosure],smalltalk.IRVisitor);
  2285. }),smalltalk.send(anIRClosure,"_arguments",[])]);
  2286. return self},
  2287. args: ["anIRClosure"],
  2288. source: "visitIRClosure: anIRClosure\x0a\x09self stream \x0a\x09\x09nextPutClosureWith: [ super visitIRClosure: anIRClosure ] \x0a\x09\x09arguments: anIRClosure arguments",
  2289. messageSends: ["nextPutClosureWith:arguments:", "visitIRClosure:", "arguments", "stream"],
  2290. referencedClasses: []
  2291. }),
  2292. smalltalk.IRJSTranslator);
  2293. smalltalk.addMethod(
  2294. "_visitIRDynamicArray_",
  2295. smalltalk.method({
  2296. selector: "visitIRDynamicArray:",
  2297. category: 'visiting',
  2298. fn: function (anIRDynamicArray){
  2299. var self=this;
  2300. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["["]);
  2301. smalltalk.send(smalltalk.send(anIRDynamicArray,"_instructions",[]),"_do_separatedBy_",[(function(each){
  2302. return smalltalk.send(self,"_visit_",[each]);
  2303. }),(function(){
  2304. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2305. })]);
  2306. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  2307. return self},
  2308. args: ["anIRDynamicArray"],
  2309. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self stream nextPutAll: '['.\x0a\x09anIRDynamicArray instructions\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ']'",
  2310. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  2311. referencedClasses: []
  2312. }),
  2313. smalltalk.IRJSTranslator);
  2314. smalltalk.addMethod(
  2315. "_visitIRDynamicDictionary_",
  2316. smalltalk.method({
  2317. selector: "visitIRDynamicDictionary:",
  2318. category: 'visiting',
  2319. fn: function (anIRDynamicDictionary){
  2320. var self=this;
  2321. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
  2322. smalltalk.send(smalltalk.send(anIRDynamicDictionary,"_instructions",[]),"_do_separatedBy_",[(function(each){
  2323. return smalltalk.send(self,"_visit_",[each]);
  2324. }),(function(){
  2325. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2326. })]);
  2327. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["])"]);
  2328. return self},
  2329. args: ["anIRDynamicDictionary"],
  2330. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.\x0a\x09\x09anIRDynamicDictionary instructions \x0a\x09\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09\x09separatedBy: [self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: '])'",
  2331. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:", "instructions"],
  2332. referencedClasses: []
  2333. }),
  2334. smalltalk.IRJSTranslator);
  2335. smalltalk.addMethod(
  2336. "_visitIRMethod_",
  2337. smalltalk.method({
  2338. selector: "visitIRMethod:",
  2339. category: 'visiting',
  2340. fn: function (anIRMethod){
  2341. var self=this;
  2342. var $1,$2;
  2343. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutMethodDeclaration_with_",[anIRMethod,(function(){
  2344. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutFunctionWith_arguments_",[(function(){
  2345. $1=smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_notEmpty",[]);
  2346. if(smalltalk.assert($1)){
  2347. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVars_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRMethod,"_internalVariables",[]),"_asArray",[]),"_collect_",[(function(each){
  2348. return smalltalk.send(smalltalk.send(each,"_variable",[]),"_alias",[]);
  2349. })])]);
  2350. };
  2351. $2=smalltalk.send(smalltalk.send(anIRMethod,"_scope",[]),"_hasNonLocalReturn",[]);
  2352. if(smalltalk.assert($2)){
  2353. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnHandlingWith_",[(function(){
  2354. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  2355. })]);
  2356. } else {
  2357. return smalltalk.send(self,"_visitIRMethod_",[anIRMethod],smalltalk.IRVisitor);
  2358. };
  2359. }),smalltalk.send(anIRMethod,"_arguments",[])]);
  2360. })]);
  2361. return self},
  2362. args: ["anIRMethod"],
  2363. source: "visitIRMethod: anIRMethod\x0a\x09self stream\x0a\x09\x09nextPutMethodDeclaration: anIRMethod \x0a\x09\x09with: [ self stream \x0a\x09\x09\x09nextPutFunctionWith: [ \x0a\x09\x09\x09\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asArray collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each variable alias ]) ].\x0a\x09\x09\x09\x09anIRMethod scope hasNonLocalReturn \x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09self stream nextPutNonLocalReturnHandlingWith: [\x0a\x09\x09\x09\x09\x09\x09\x09super visitIRMethod: anIRMethod ]]\x0a\x09\x09\x09\x09\x09ifFalse: [ super visitIRMethod: anIRMethod ]]\x0a\x09\x09\x09arguments: anIRMethod arguments ]",
  2364. messageSends: ["nextPutMethodDeclaration:with:", "nextPutFunctionWith:arguments:", "ifTrue:", "nextPutVars:", "collect:", "alias", "variable", "asArray", "internalVariables", "stream", "notEmpty", "ifTrue:ifFalse:", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "hasNonLocalReturn", "scope", "arguments"],
  2365. referencedClasses: []
  2366. }),
  2367. smalltalk.IRJSTranslator);
  2368. smalltalk.addMethod(
  2369. "_visitIRNonLocalReturn_",
  2370. smalltalk.method({
  2371. selector: "visitIRNonLocalReturn:",
  2372. category: 'visiting',
  2373. fn: function (anIRNonLocalReturn){
  2374. var self=this;
  2375. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  2376. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  2377. })]);
  2378. return self},
  2379. args: ["anIRNonLocalReturn"],
  2380. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  2381. messageSends: ["nextPutNonLocalReturnWith:", "visitIRNonLocalReturn:", "stream"],
  2382. referencedClasses: []
  2383. }),
  2384. smalltalk.IRJSTranslator);
  2385. smalltalk.addMethod(
  2386. "_visitIRReturn_",
  2387. smalltalk.method({
  2388. selector: "visitIRReturn:",
  2389. category: 'visiting',
  2390. fn: function (anIRReturn){
  2391. var self=this;
  2392. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturnWith_",[(function(){
  2393. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  2394. })]);
  2395. return self},
  2396. args: ["anIRReturn"],
  2397. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  2398. messageSends: ["nextPutReturnWith:", "visitIRReturn:", "stream"],
  2399. referencedClasses: []
  2400. }),
  2401. smalltalk.IRJSTranslator);
  2402. smalltalk.addMethod(
  2403. "_visitIRSend_",
  2404. smalltalk.method({
  2405. selector: "visitIRSend:",
  2406. category: 'visiting',
  2407. fn: function (anIRSend){
  2408. var self=this;
  2409. var $1;
  2410. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.send("]);
  2411. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_first",[])]);
  2412. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_selector",[]),"_asSelector",[])]),"__comma",["\x22,["])]);
  2413. smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_instructions",[]),"_allButFirst",[]),"_do_separatedBy_",[(function(each){
  2414. return smalltalk.send(self,"_visit_",[each]);
  2415. }),(function(){
  2416. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[","]);
  2417. })]);
  2418. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["]"]);
  2419. $1=smalltalk.send(anIRSend,"_classSend",[]);
  2420. if(($receiver = $1) == nil || $receiver == undefined){
  2421. $1;
  2422. } else {
  2423. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(",","__comma",[smalltalk.send(smalltalk.send(anIRSend,"_classSend",[]),"_asJavascript",[])])]);
  2424. };
  2425. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  2426. return self},
  2427. args: ["anIRSend"],
  2428. source: "visitIRSend: anIRSend\x0a\x09self stream nextPutAll: 'smalltalk.send('.\x0a\x09self visit: anIRSend instructions first.\x0a\x09self stream nextPutAll: ',\x22', anIRSend selector asSelector, '\x22,['.\x0a\x09anIRSend instructions allButFirst\x0a\x09\x09do: [ :each | self visit: each ]\x0a\x09\x09separatedBy: [ self stream nextPutAll: ',' ].\x0a\x09self stream nextPutAll: ']'.\x0a\x09\x22anIRSend index > 1 \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09anIRSend classSend \x0a\x09\x09\x09\x09ifNil: [ self stream nextPutAll: ',undefined' ]\x0a\x09\x09\x09\x09ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].\x0a\x09\x09\x09self stream nextPutAll: ',', anIRSend index asString ]\x0a\x09\x09ifFalse: [\x22\x0a\x09\x09\x09anIRSend classSend ifNotNil: [ \x0a\x09\x09\x09\x09self stream nextPutAll: ',', anIRSend classSend asJavascript ]\x22]\x22.\x0a\x09self stream nextPutAll: ')'",
  2429. messageSends: ["nextPutAll:", "stream", "visit:", "first", "instructions", ",", "asSelector", "selector", "do:separatedBy:", "allButFirst", "ifNotNil:", "asJavascript", "classSend"],
  2430. referencedClasses: []
  2431. }),
  2432. smalltalk.IRJSTranslator);
  2433. smalltalk.addMethod(
  2434. "_visitIRSequence_",
  2435. smalltalk.method({
  2436. selector: "visitIRSequence:",
  2437. category: 'visiting',
  2438. fn: function (anIRSequence){
  2439. var self=this;
  2440. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutSequenceWith_",[(function(){
  2441. return smalltalk.send(smalltalk.send(anIRSequence,"_instructions",[]),"_do_",[(function(each){
  2442. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[smalltalk.send(self,"_visit_",[each])]);
  2443. })]);
  2444. })]);
  2445. return self},
  2446. args: ["anIRSequence"],
  2447. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ]]",
  2448. messageSends: ["nextPutSequenceWith:", "do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  2449. referencedClasses: []
  2450. }),
  2451. smalltalk.IRJSTranslator);
  2452. smalltalk.addMethod(
  2453. "_visitIRTempDeclaration_",
  2454. smalltalk.method({
  2455. selector: "visitIRTempDeclaration:",
  2456. category: 'visiting',
  2457. fn: function (anIRTempDeclaration){
  2458. var self=this;
  2459. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutVar_",[smalltalk.send(smalltalk.send(anIRTempDeclaration,"_name",[]),"_asVariableName",[])]);
  2460. return self},
  2461. args: ["anIRTempDeclaration"],
  2462. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09self stream nextPutVar: anIRTempDeclaration name asVariableName",
  2463. messageSends: ["nextPutVar:", "asVariableName", "name", "stream"],
  2464. referencedClasses: []
  2465. }),
  2466. smalltalk.IRJSTranslator);
  2467. smalltalk.addMethod(
  2468. "_visitIRValue_",
  2469. smalltalk.method({
  2470. selector: "visitIRValue:",
  2471. category: 'visiting',
  2472. fn: function (anIRValue){
  2473. var self=this;
  2474. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRValue,"_value",[]),"_asJavascript",[])]);
  2475. return self},
  2476. args: ["anIRValue"],
  2477. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  2478. messageSends: ["nextPutAll:", "asJavascript", "value", "stream"],
  2479. referencedClasses: []
  2480. }),
  2481. smalltalk.IRJSTranslator);
  2482. smalltalk.addMethod(
  2483. "_visitIRVariable_",
  2484. smalltalk.method({
  2485. selector: "visitIRVariable:",
  2486. category: 'visiting',
  2487. fn: function (anIRVariable){
  2488. var self=this;
  2489. var $1;
  2490. $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_name",[]),"__eq",["thisContext"]);
  2491. if(smalltalk.assert($1)){
  2492. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.getThisContext()"]);
  2493. } else {
  2494. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(smalltalk.send(anIRVariable,"_variable",[]),"_alias",[])]);
  2495. };
  2496. return self},
  2497. args: ["anIRVariable"],
  2498. source: "visitIRVariable: anIRVariable\x0a\x09anIRVariable variable name = 'thisContext'\x0a \x09ifTrue: [ self stream nextPutAll: 'smalltalk.getThisContext()' ]\x0a \x09ifFalse: [ self stream nextPutAll: anIRVariable variable alias ]",
  2499. messageSends: ["ifTrue:ifFalse:", "nextPutAll:", "stream", "alias", "variable", "=", "name"],
  2500. referencedClasses: []
  2501. }),
  2502. smalltalk.IRJSTranslator);
  2503. smalltalk.addMethod(
  2504. "_visitIRVerbatim_",
  2505. smalltalk.method({
  2506. selector: "visitIRVerbatim:",
  2507. category: 'visiting',
  2508. fn: function (anIRVerbatim){
  2509. var self=this;
  2510. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  2511. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[smalltalk.send(anIRVerbatim,"_source",[])]);
  2512. })]);
  2513. return self},
  2514. args: ["anIRVerbatim"],
  2515. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  2516. messageSends: ["nextPutStatementWith:", "nextPutAll:", "source", "stream"],
  2517. referencedClasses: []
  2518. }),
  2519. smalltalk.IRJSTranslator);
  2520. smalltalk.addClass('JSStream', smalltalk.Object, ['stream'], 'Compiler-IR');
  2521. smalltalk.addMethod(
  2522. "_contents",
  2523. smalltalk.method({
  2524. selector: "contents",
  2525. category: 'accessing',
  2526. fn: function (){
  2527. var self=this;
  2528. var $1;
  2529. $1=smalltalk.send(self["@stream"],"_contents",[]);
  2530. return $1;
  2531. },
  2532. args: [],
  2533. source: "contents\x0a\x09^ stream contents",
  2534. messageSends: ["contents"],
  2535. referencedClasses: []
  2536. }),
  2537. smalltalk.JSStream);
  2538. smalltalk.addMethod(
  2539. "_initialize",
  2540. smalltalk.method({
  2541. selector: "initialize",
  2542. category: 'initialization',
  2543. fn: function (){
  2544. var self=this;
  2545. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  2546. self["@stream"]=smalltalk.send("","_writeStream",[]);
  2547. return self},
  2548. args: [],
  2549. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  2550. messageSends: ["initialize", "writeStream"],
  2551. referencedClasses: []
  2552. }),
  2553. smalltalk.JSStream);
  2554. smalltalk.addMethod(
  2555. "_lf",
  2556. smalltalk.method({
  2557. selector: "lf",
  2558. category: 'streaming',
  2559. fn: function (){
  2560. var self=this;
  2561. smalltalk.send(self["@stream"],"_lf",[]);
  2562. return self},
  2563. args: [],
  2564. source: "lf\x0a\x09stream lf",
  2565. messageSends: ["lf"],
  2566. referencedClasses: []
  2567. }),
  2568. smalltalk.JSStream);
  2569. smalltalk.addMethod(
  2570. "_nextPut_",
  2571. smalltalk.method({
  2572. selector: "nextPut:",
  2573. category: 'streaming',
  2574. fn: function (aString){
  2575. var self=this;
  2576. smalltalk.send(self["@stream"],"_nextPut_",[aString]);
  2577. return self},
  2578. args: ["aString"],
  2579. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  2580. messageSends: ["nextPut:"],
  2581. referencedClasses: []
  2582. }),
  2583. smalltalk.JSStream);
  2584. smalltalk.addMethod(
  2585. "_nextPutAll_",
  2586. smalltalk.method({
  2587. selector: "nextPutAll:",
  2588. category: 'streaming',
  2589. fn: function (aString){
  2590. var self=this;
  2591. smalltalk.send(self["@stream"],"_nextPutAll_",[aString]);
  2592. return self},
  2593. args: ["aString"],
  2594. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  2595. messageSends: ["nextPutAll:"],
  2596. referencedClasses: []
  2597. }),
  2598. smalltalk.JSStream);
  2599. smalltalk.addMethod(
  2600. "_nextPutAssignment",
  2601. smalltalk.method({
  2602. selector: "nextPutAssignment",
  2603. category: 'streaming',
  2604. fn: function (){
  2605. var self=this;
  2606. smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
  2607. return self},
  2608. args: [],
  2609. source: "nextPutAssignment\x0a\x09stream nextPutAll: '='",
  2610. messageSends: ["nextPutAll:"],
  2611. referencedClasses: []
  2612. }),
  2613. smalltalk.JSStream);
  2614. smalltalk.addMethod(
  2615. "_nextPutClosureWith_arguments_",
  2616. smalltalk.method({
  2617. selector: "nextPutClosureWith:arguments:",
  2618. category: 'streaming',
  2619. fn: function (aBlock,anArray){
  2620. var self=this;
  2621. var $1;
  2622. smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
  2623. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  2624. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  2625. }),(function(){
  2626. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  2627. })]);
  2628. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2629. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2630. smalltalk.send(aBlock,"_value",[]);
  2631. smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  2632. return self},
  2633. args: ["aBlock", "anArray"],
  2634. source: "nextPutClosureWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: '(function('.\x0a\x09anArray \x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '})'",
  2635. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2636. referencedClasses: []
  2637. }),
  2638. smalltalk.JSStream);
  2639. smalltalk.addMethod(
  2640. "_nextPutFunctionWith_arguments_",
  2641. smalltalk.method({
  2642. selector: "nextPutFunctionWith:arguments:",
  2643. category: 'streaming',
  2644. fn: function (aBlock,anArray){
  2645. var self=this;
  2646. var $1,$2;
  2647. smalltalk.send(self["@stream"],"_nextPutAll_",["fn: function("]);
  2648. smalltalk.send(anArray,"_do_separatedBy_",[(function(each){
  2649. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asVariableName",[])]);
  2650. }),(function(){
  2651. return smalltalk.send(self["@stream"],"_nextPut_",[","]);
  2652. })]);
  2653. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2654. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2655. smalltalk.send(self["@stream"],"_nextPutAll_",["var self=this;"]);
  2656. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2657. smalltalk.send(aBlock,"_value",[]);
  2658. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2659. return self},
  2660. args: ["aBlock", "anArray"],
  2661. source: "nextPutFunctionWith: aBlock arguments: anArray\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09anArray \x0a\x09\x09do: [ :each | stream nextPutAll: each asVariableName ]\x0a\x09\x09separatedBy: [ stream nextPut: ',' ].\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09stream nextPutAll: 'var self=this;'; lf.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '}'",
  2662. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"],
  2663. referencedClasses: []
  2664. }),
  2665. smalltalk.JSStream);
  2666. smalltalk.addMethod(
  2667. "_nextPutIf_with_",
  2668. smalltalk.method({
  2669. selector: "nextPutIf:with:",
  2670. category: 'streaming',
  2671. fn: function (aBlock,anotherBlock){
  2672. var self=this;
  2673. var $1;
  2674. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  2675. smalltalk.send(aBlock,"_value",[]);
  2676. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2677. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2678. smalltalk.send(anotherBlock,"_value",[]);
  2679. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2680. return self},
  2681. args: ["aBlock", "anotherBlock"],
  2682. source: "nextPutIf: aBlock with: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  2683. messageSends: ["nextPutAll:", "value", "lf"],
  2684. referencedClasses: []
  2685. }),
  2686. smalltalk.JSStream);
  2687. smalltalk.addMethod(
  2688. "_nextPutIfElse_with_with_",
  2689. smalltalk.method({
  2690. selector: "nextPutIfElse:with:with:",
  2691. category: 'streaming',
  2692. fn: function (aBlock,ifBlock,elseBlock){
  2693. var self=this;
  2694. var $1,$2;
  2695. smalltalk.send(self["@stream"],"_nextPutAll_",["if("]);
  2696. smalltalk.send(aBlock,"_value",[]);
  2697. smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
  2698. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2699. smalltalk.send(ifBlock,"_value",[]);
  2700. smalltalk.send(self["@stream"],"_nextPutAll_",["} else {"]);
  2701. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2702. smalltalk.send(elseBlock,"_value",[]);
  2703. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2704. return self},
  2705. args: ["aBlock", "ifBlock", "elseBlock"],
  2706. source: "nextPutIfElse: aBlock with: ifBlock with: elseBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09ifBlock value.\x0a\x09stream nextPutAll: '} else {'; lf.\x0a\x09elseBlock value.\x0a\x09stream nextPutAll: '}'",
  2707. messageSends: ["nextPutAll:", "value", "lf"],
  2708. referencedClasses: []
  2709. }),
  2710. smalltalk.JSStream);
  2711. smalltalk.addMethod(
  2712. "_nextPutMethodDeclaration_with_",
  2713. smalltalk.method({
  2714. selector: "nextPutMethodDeclaration:with:",
  2715. category: 'streaming',
  2716. fn: function (aMethod,aBlock){
  2717. var self=this;
  2718. var $1,$2,$3;
  2719. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.method({"]);
  2720. smalltalk.send(self["@stream"],"_lf",[]);
  2721. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: \x22","__comma",[smalltalk.send(aMethod,"_selector",[])]),"__comma",["\x22,"])]);
  2722. smalltalk.send(self["@stream"],"_lf",[]);
  2723. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
  2724. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2725. smalltalk.send(aBlock,"_value",[]);
  2726. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])]),"__comma",["messageSends: "])]);
  2727. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asArray",[]),"_asJavascript",[]),"__comma",[","])]);
  2728. smalltalk.send(self["@stream"],"_lf",[]);
  2729. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_collect_",[(function(each){
  2730. return smalltalk.send(each,"_value",[]);
  2731. })]),"_asArray",[]),"_asJavascript",[])]),"__comma",[","])]);
  2732. smalltalk.send(self["@stream"],"_lf",[]);
  2733. $2=smalltalk.send(self["@stream"],"_nextPutAll_",["referencedClasses: ["]);
  2734. smalltalk.send(smalltalk.send(aMethod,"_classReferences",[]),"_do_separatedBy_",[(function(each){
  2735. return smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(each,"_asJavascript",[])]);
  2736. }),(function(){
  2737. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2738. })]);
  2739. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  2740. $3=smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
  2741. return self},
  2742. args: ["aMethod", "aBlock"],
  2743. source: "nextPutMethodDeclaration: aMethod with: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'smalltalk.method({'; lf;\x0a\x09\x09nextPutAll: 'selector: \x22', aMethod selector, '\x22,'; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf.\x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: aMethod messageSends asArray asJavascript, ','; lf;\x0a \x09nextPutAll: 'args: ', (aMethod arguments collect: [ :each | each value ]) asArray asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09aMethod classReferences \x0a\x09\x09do: [:each | stream nextPutAll: each asJavascript]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream \x0a\x09\x09nextPutAll: ']';\x0a\x09\x09nextPutAll: '})'",
  2744. messageSends: ["nextPutAll:", "lf", ",", "selector", "asJavascript", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"],
  2745. referencedClasses: ["String"]
  2746. }),
  2747. smalltalk.JSStream);
  2748. smalltalk.addMethod(
  2749. "_nextPutNonLocalReturnHandlingWith_",
  2750. smalltalk.method({
  2751. selector: "nextPutNonLocalReturnHandlingWith:",
  2752. category: 'streaming',
  2753. fn: function (aBlock){
  2754. var self=this;
  2755. var $1,$2;
  2756. smalltalk.send(self["@stream"],"_nextPutAll_",["var $early={};"]);
  2757. smalltalk.send(self["@stream"],"_lf",[]);
  2758. smalltalk.send(self["@stream"],"_nextPutAll_",["try {"]);
  2759. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2760. smalltalk.send(aBlock,"_value",[]);
  2761. smalltalk.send(self["@stream"],"_nextPutAll_",["}"]);
  2762. smalltalk.send(self["@stream"],"_lf",[]);
  2763. smalltalk.send(self["@stream"],"_nextPutAll_",["catch(e) {if(e===$early)return e[0]; throw e}"]);
  2764. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2765. return self},
  2766. args: ["aBlock"],
  2767. source: "nextPutNonLocalReturnHandlingWith: aBlock\x0a\x09stream \x0a\x09\x09nextPutAll: 'var $early={};'; lf;\x0a\x09\x09nextPutAll: 'try {'; lf.\x0a\x09aBlock value.\x0a\x09stream \x0a\x09\x09nextPutAll: '}'; lf;\x0a\x09\x09nextPutAll: 'catch(e) {if(e===$early)return e[0]; throw e}'; lf",
  2768. messageSends: ["nextPutAll:", "lf", "value"],
  2769. referencedClasses: []
  2770. }),
  2771. smalltalk.JSStream);
  2772. smalltalk.addMethod(
  2773. "_nextPutNonLocalReturnWith_",
  2774. smalltalk.method({
  2775. selector: "nextPutNonLocalReturnWith:",
  2776. category: 'streaming',
  2777. fn: function (aBlock){
  2778. var self=this;
  2779. smalltalk.send(self["@stream"],"_nextPutAll_",["throw $early=["]);
  2780. smalltalk.send(aBlock,"_value",[]);
  2781. smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
  2782. return self},
  2783. args: ["aBlock"],
  2784. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  2785. messageSends: ["nextPutAll:", "value"],
  2786. referencedClasses: []
  2787. }),
  2788. smalltalk.JSStream);
  2789. smalltalk.addMethod(
  2790. "_nextPutReturn",
  2791. smalltalk.method({
  2792. selector: "nextPutReturn",
  2793. category: 'streaming',
  2794. fn: function (){
  2795. var self=this;
  2796. smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
  2797. return self},
  2798. args: [],
  2799. source: "nextPutReturn\x0a\x09stream nextPutAll: 'return '",
  2800. messageSends: ["nextPutAll:"],
  2801. referencedClasses: []
  2802. }),
  2803. smalltalk.JSStream);
  2804. smalltalk.addMethod(
  2805. "_nextPutReturnWith_",
  2806. smalltalk.method({
  2807. selector: "nextPutReturnWith:",
  2808. category: 'streaming',
  2809. fn: function (aBlock){
  2810. var self=this;
  2811. smalltalk.send(self,"_nextPutReturn",[]);
  2812. smalltalk.send(aBlock,"_value",[]);
  2813. return self},
  2814. args: ["aBlock"],
  2815. source: "nextPutReturnWith: aBlock\x0a\x09self nextPutReturn.\x0a\x09aBlock value",
  2816. messageSends: ["nextPutReturn", "value"],
  2817. referencedClasses: []
  2818. }),
  2819. smalltalk.JSStream);
  2820. smalltalk.addMethod(
  2821. "_nextPutSendTo_selector_arguments_",
  2822. smalltalk.method({
  2823. selector: "nextPutSendTo:selector:arguments:",
  2824. category: 'streaming',
  2825. fn: function (receiver,selector,arguments){
  2826. var self=this;
  2827. smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.send("]);
  2828. smalltalk.send(receiver,"_emitOn_",[self]);
  2829. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(",\x22","__comma",[smalltalk.send(selector,"_asSelector",[])]),"__comma",["\x22,["])]);
  2830. smalltalk.send(arguments,"_do_separatedBy_",[(function(each){
  2831. return smalltalk.send(each,"_emitOn_",[self]);
  2832. }),(function(){
  2833. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2834. })]);
  2835. smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
  2836. return self},
  2837. args: ["receiver", "selector", "arguments"],
  2838. source: "nextPutSendTo: receiver selector: selector arguments: arguments\x0a\x09stream nextPutAll: 'smalltalk.send('.\x0a\x09receiver emitOn: self. \x0a\x09stream nextPutAll: ',\x22', selector asSelector, '\x22,['.\x0a\x09arguments \x0a\x09\x09do: [ :each | each emitOn: self ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: '])'",
  2839. messageSends: ["nextPutAll:", "emitOn:", ",", "asSelector", "do:separatedBy:"],
  2840. referencedClasses: []
  2841. }),
  2842. smalltalk.JSStream);
  2843. smalltalk.addMethod(
  2844. "_nextPutSequenceWith_",
  2845. smalltalk.method({
  2846. selector: "nextPutSequenceWith:",
  2847. category: 'streaming',
  2848. fn: function (aBlock){
  2849. var self=this;
  2850. smalltalk.send(aBlock,"_value",[]);
  2851. return self},
  2852. args: ["aBlock"],
  2853. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream \x0a\x09\x09nextPutAll: 'switch(smalltalk.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream \x0a\x09\x09nextPutAll: '};'; lf\x22",
  2854. messageSends: ["value"],
  2855. referencedClasses: []
  2856. }),
  2857. smalltalk.JSStream);
  2858. smalltalk.addMethod(
  2859. "_nextPutStatement_with_",
  2860. smalltalk.method({
  2861. selector: "nextPutStatement:with:",
  2862. category: 'streaming',
  2863. fn: function (anInteger,aBlock){
  2864. var self=this;
  2865. var $1,$2;
  2866. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("case ","__comma",[smalltalk.send(anInteger,"_asString",[])]),"__comma",[":"])]);
  2867. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2868. smalltalk.send(self,"_nextPutStatementWith_",[aBlock]);
  2869. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("smalltalk.thisContext.pc=","__comma",[smalltalk.send(smalltalk.send(anInteger,"__plus",[(1)]),"_asString",[])]),"__comma",[";"])]);
  2870. $2=smalltalk.send(self["@stream"],"_lf",[]);
  2871. return self},
  2872. args: ["anInteger", "aBlock"],
  2873. source: "nextPutStatement: anInteger with: aBlock\x0a\x09stream nextPutAll: 'case ', anInteger asString, ':'; lf.\x0a\x09self nextPutStatementWith: aBlock.\x0a\x09stream nextPutAll: 'smalltalk.thisContext.pc=', (anInteger + 1) asString, ';'; lf",
  2874. messageSends: ["nextPutAll:", ",", "asString", "lf", "nextPutStatementWith:", "+"],
  2875. referencedClasses: []
  2876. }),
  2877. smalltalk.JSStream);
  2878. smalltalk.addMethod(
  2879. "_nextPutStatementWith_",
  2880. smalltalk.method({
  2881. selector: "nextPutStatementWith:",
  2882. category: 'streaming',
  2883. fn: function (aBlock){
  2884. var self=this;
  2885. var $1;
  2886. smalltalk.send(aBlock,"_value",[]);
  2887. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2888. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2889. return self},
  2890. args: ["aBlock"],
  2891. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  2892. messageSends: ["value", "nextPutAll:", "lf"],
  2893. referencedClasses: []
  2894. }),
  2895. smalltalk.JSStream);
  2896. smalltalk.addMethod(
  2897. "_nextPutVar_",
  2898. smalltalk.method({
  2899. selector: "nextPutVar:",
  2900. category: 'streaming',
  2901. fn: function (aString){
  2902. var self=this;
  2903. var $1;
  2904. smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[aString]),"__comma",[";"])]);
  2905. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2906. return self},
  2907. args: ["aString"],
  2908. source: "nextPutVar: aString\x0a\x09stream nextPutAll: 'var ', aString, ';'; lf",
  2909. messageSends: ["nextPutAll:", ",", "lf"],
  2910. referencedClasses: []
  2911. }),
  2912. smalltalk.JSStream);
  2913. smalltalk.addMethod(
  2914. "_nextPutVars_",
  2915. smalltalk.method({
  2916. selector: "nextPutVars:",
  2917. category: 'streaming',
  2918. fn: function (aCollection){
  2919. var self=this;
  2920. var $1;
  2921. smalltalk.send(self["@stream"],"_nextPutAll_",["var "]);
  2922. smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  2923. return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
  2924. }),(function(){
  2925. return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
  2926. })]);
  2927. smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
  2928. $1=smalltalk.send(self["@stream"],"_lf",[]);
  2929. return self},
  2930. args: ["aCollection"],
  2931. source: "nextPutVars: aCollection\x0a\x09stream nextPutAll: 'var '.\x0a\x09aCollection \x0a\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09separatedBy: [ stream nextPutAll: ',' ].\x0a\x09stream nextPutAll: ';'; lf",
  2932. messageSends: ["nextPutAll:", "do:separatedBy:", "lf"],
  2933. referencedClasses: []
  2934. }),
  2935. smalltalk.JSStream);
  2936. smalltalk.addMethod(
  2937. "_appendToInstruction_",
  2938. smalltalk.method({
  2939. selector: "appendToInstruction:",
  2940. category: '*Compiler-IR',
  2941. fn: function (anIRInstruction){
  2942. var self=this;
  2943. smalltalk.send(anIRInstruction,"_appendBlock_",[self]);
  2944. return self},
  2945. args: ["anIRInstruction"],
  2946. source: "appendToInstruction: anIRInstruction\x0a anIRInstruction appendBlock: self",
  2947. messageSends: ["appendBlock:"],
  2948. referencedClasses: []
  2949. }),
  2950. smalltalk.BlockClosure);
  2951. smalltalk.addMethod(
  2952. "_asVariableName",
  2953. smalltalk.method({
  2954. selector: "asVariableName",
  2955. category: '*Compiler-IR',
  2956. fn: function (){
  2957. var self=this;
  2958. var $2,$1;
  2959. $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[self]);
  2960. if(smalltalk.assert($2)){
  2961. $1=smalltalk.send(self,"__comma",["_"]);
  2962. } else {
  2963. $1=self;
  2964. };
  2965. return $1;
  2966. },
  2967. args: [],
  2968. source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  2969. messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
  2970. referencedClasses: ["Smalltalk"]
  2971. }),
  2972. smalltalk.String);