Compiler-Semantic.js 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754
  1. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-Core"], function($boot){
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Compiler-Semantic');
  4. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "addArg:",
  13. protocol: 'adding',
  14. fn: function (aString){
  15. var self=this;
  16. function $ArgVar(){return $globals.ArgVar||(typeof ArgVar=="undefined"?nil:ArgVar)}
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. var $1;
  21. $1=self._args();
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. $ctx1.sendIdx["args"]=1;
  24. //>>excludeEnd("ctx");
  25. $recv($1)._at_put_(aString,$recv($ArgVar())._on_(aString));
  26. $recv($recv(self._args())._at_(aString))._scope_(self);
  27. return self;
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  30. //>>excludeEnd("ctx");
  31. },
  32. //>>excludeStart("ide", pragmas.excludeIdeData);
  33. args: ["aString"],
  34. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  35. referencedClasses: ["ArgVar"],
  36. //>>excludeEnd("ide");
  37. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  38. }),
  39. $globals.LexicalScope);
  40. $core.addMethod(
  41. $core.method({
  42. selector: "addTemp:",
  43. protocol: 'adding',
  44. fn: function (aString){
  45. var self=this;
  46. function $TempVar(){return $globals.TempVar||(typeof TempVar=="undefined"?nil:TempVar)}
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. return $core.withContext(function($ctx1) {
  49. //>>excludeEnd("ctx");
  50. var $1;
  51. $1=self._temps();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. $ctx1.sendIdx["temps"]=1;
  54. //>>excludeEnd("ctx");
  55. $recv($1)._at_put_(aString,$recv($TempVar())._on_(aString));
  56. $recv($recv(self._temps())._at_(aString))._scope_(self);
  57. return self;
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  60. //>>excludeEnd("ctx");
  61. },
  62. //>>excludeStart("ide", pragmas.excludeIdeData);
  63. args: ["aString"],
  64. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  65. referencedClasses: ["TempVar"],
  66. //>>excludeEnd("ide");
  67. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  68. }),
  69. $globals.LexicalScope);
  70. $core.addMethod(
  71. $core.method({
  72. selector: "alias",
  73. protocol: 'accessing',
  74. fn: function (){
  75. var self=this;
  76. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  77. return $core.withContext(function($ctx1) {
  78. //>>excludeEnd("ctx");
  79. var $1;
  80. $1="$ctx".__comma($recv(self._scopeLevel())._asString());
  81. return $1;
  82. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  83. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  84. //>>excludeEnd("ctx");
  85. },
  86. //>>excludeStart("ide", pragmas.excludeIdeData);
  87. args: [],
  88. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  89. referencedClasses: [],
  90. //>>excludeEnd("ide");
  91. messageSends: [",", "asString", "scopeLevel"]
  92. }),
  93. $globals.LexicalScope);
  94. $core.addMethod(
  95. $core.method({
  96. selector: "allVariableNames",
  97. protocol: 'accessing',
  98. fn: function (){
  99. var self=this;
  100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  101. return $core.withContext(function($ctx1) {
  102. //>>excludeEnd("ctx");
  103. var $2,$1;
  104. $2=$recv(self._args())._keys();
  105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  106. $ctx1.sendIdx["keys"]=1;
  107. //>>excludeEnd("ctx");
  108. $1=$recv($2).__comma($recv(self._temps())._keys());
  109. return $1;
  110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  111. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  112. //>>excludeEnd("ctx");
  113. },
  114. //>>excludeStart("ide", pragmas.excludeIdeData);
  115. args: [],
  116. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  117. referencedClasses: [],
  118. //>>excludeEnd("ide");
  119. messageSends: [",", "keys", "args", "temps"]
  120. }),
  121. $globals.LexicalScope);
  122. $core.addMethod(
  123. $core.method({
  124. selector: "args",
  125. protocol: 'accessing',
  126. fn: function (){
  127. var self=this;
  128. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. return $core.withContext(function($ctx1) {
  131. //>>excludeEnd("ctx");
  132. var $2,$1,$receiver;
  133. $2=self["@args"];
  134. if(($receiver = $2) == null || $receiver.isNil){
  135. self["@args"]=$recv($Dictionary())._new();
  136. $1=self["@args"];
  137. } else {
  138. $1=$2;
  139. };
  140. return $1;
  141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  142. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  143. //>>excludeEnd("ctx");
  144. },
  145. //>>excludeStart("ide", pragmas.excludeIdeData);
  146. args: [],
  147. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  148. referencedClasses: ["Dictionary"],
  149. //>>excludeEnd("ide");
  150. messageSends: ["ifNil:", "new"]
  151. }),
  152. $globals.LexicalScope);
  153. $core.addMethod(
  154. $core.method({
  155. selector: "bindingFor:",
  156. protocol: 'accessing',
  157. fn: function (aStringOrNode){
  158. var self=this;
  159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  160. return $core.withContext(function($ctx1) {
  161. //>>excludeEnd("ctx");
  162. var $2,$3,$4,$5,$1;
  163. $2=self._pseudoVars();
  164. $3=$recv(aStringOrNode)._value();
  165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  166. $ctx1.sendIdx["value"]=1;
  167. //>>excludeEnd("ctx");
  168. $1=$recv($2)._at_ifAbsent_($3,(function(){
  169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  170. return $core.withContext(function($ctx2) {
  171. //>>excludeEnd("ctx");
  172. $4=self._args();
  173. $5=$recv(aStringOrNode)._value();
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. $ctx2.sendIdx["value"]=2;
  176. //>>excludeEnd("ctx");
  177. return $recv($4)._at_ifAbsent_($5,(function(){
  178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  179. return $core.withContext(function($ctx3) {
  180. //>>excludeEnd("ctx");
  181. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  182. return nil;
  183. }));
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  186. //>>excludeEnd("ctx");
  187. }));
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. $ctx2.sendIdx["at:ifAbsent:"]=2;
  190. //>>excludeEnd("ctx");
  191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  193. //>>excludeEnd("ctx");
  194. }));
  195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  196. $ctx1.sendIdx["at:ifAbsent:"]=1;
  197. //>>excludeEnd("ctx");
  198. return $1;
  199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  200. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  201. //>>excludeEnd("ctx");
  202. },
  203. //>>excludeStart("ide", pragmas.excludeIdeData);
  204. args: ["aStringOrNode"],
  205. source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [\x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
  206. referencedClasses: [],
  207. //>>excludeEnd("ide");
  208. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  209. }),
  210. $globals.LexicalScope);
  211. $core.addMethod(
  212. $core.method({
  213. selector: "blockIndex",
  214. protocol: 'accessing',
  215. fn: function (){
  216. var self=this;
  217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  218. return $core.withContext(function($ctx1) {
  219. //>>excludeEnd("ctx");
  220. var $2,$1,$receiver;
  221. $2=self["@blockIndex"];
  222. if(($receiver = $2) == null || $receiver.isNil){
  223. $1=(0);
  224. } else {
  225. $1=$2;
  226. };
  227. return $1;
  228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  229. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  230. //>>excludeEnd("ctx");
  231. },
  232. //>>excludeStart("ide", pragmas.excludeIdeData);
  233. args: [],
  234. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  235. referencedClasses: [],
  236. //>>excludeEnd("ide");
  237. messageSends: ["ifNil:"]
  238. }),
  239. $globals.LexicalScope);
  240. $core.addMethod(
  241. $core.method({
  242. selector: "blockIndex:",
  243. protocol: 'accessing',
  244. fn: function (anInteger){
  245. var self=this;
  246. self["@blockIndex"]=anInteger;
  247. return self;
  248. },
  249. //>>excludeStart("ide", pragmas.excludeIdeData);
  250. args: ["anInteger"],
  251. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  252. referencedClasses: [],
  253. //>>excludeEnd("ide");
  254. messageSends: []
  255. }),
  256. $globals.LexicalScope);
  257. $core.addMethod(
  258. $core.method({
  259. selector: "canInlineNonLocalReturns",
  260. protocol: 'testing',
  261. fn: function (){
  262. var self=this;
  263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  264. return $core.withContext(function($ctx1) {
  265. //>>excludeEnd("ctx");
  266. var $1;
  267. $1=$recv(self._isInlined())._and_((function(){
  268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  269. return $core.withContext(function($ctx2) {
  270. //>>excludeEnd("ctx");
  271. return $recv(self._outerScope())._canInlineNonLocalReturns();
  272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  274. //>>excludeEnd("ctx");
  275. }));
  276. return $1;
  277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  278. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  279. //>>excludeEnd("ctx");
  280. },
  281. //>>excludeStart("ide", pragmas.excludeIdeData);
  282. args: [],
  283. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  284. referencedClasses: [],
  285. //>>excludeEnd("ide");
  286. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  287. }),
  288. $globals.LexicalScope);
  289. $core.addMethod(
  290. $core.method({
  291. selector: "instruction",
  292. protocol: 'accessing',
  293. fn: function (){
  294. var self=this;
  295. var $1;
  296. $1=self["@instruction"];
  297. return $1;
  298. },
  299. //>>excludeStart("ide", pragmas.excludeIdeData);
  300. args: [],
  301. source: "instruction\x0a\x09^ instruction",
  302. referencedClasses: [],
  303. //>>excludeEnd("ide");
  304. messageSends: []
  305. }),
  306. $globals.LexicalScope);
  307. $core.addMethod(
  308. $core.method({
  309. selector: "instruction:",
  310. protocol: 'accessing',
  311. fn: function (anIRInstruction){
  312. var self=this;
  313. self["@instruction"]=anIRInstruction;
  314. return self;
  315. },
  316. //>>excludeStart("ide", pragmas.excludeIdeData);
  317. args: ["anIRInstruction"],
  318. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  319. referencedClasses: [],
  320. //>>excludeEnd("ide");
  321. messageSends: []
  322. }),
  323. $globals.LexicalScope);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "isBlockScope",
  327. protocol: 'testing',
  328. fn: function (){
  329. var self=this;
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. return $core.withContext(function($ctx1) {
  332. //>>excludeEnd("ctx");
  333. var $1;
  334. $1=$recv(self._isMethodScope())._not();
  335. return $1;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  338. //>>excludeEnd("ctx");
  339. },
  340. //>>excludeStart("ide", pragmas.excludeIdeData);
  341. args: [],
  342. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  343. referencedClasses: [],
  344. //>>excludeEnd("ide");
  345. messageSends: ["not", "isMethodScope"]
  346. }),
  347. $globals.LexicalScope);
  348. $core.addMethod(
  349. $core.method({
  350. selector: "isInlined",
  351. protocol: 'testing',
  352. fn: function (){
  353. var self=this;
  354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  355. return $core.withContext(function($ctx1) {
  356. //>>excludeEnd("ctx");
  357. var $3,$2,$1;
  358. $3=self._instruction();
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. $ctx1.sendIdx["instruction"]=1;
  361. //>>excludeEnd("ctx");
  362. $2=$recv($3)._notNil();
  363. $1=$recv($2)._and_((function(){
  364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  365. return $core.withContext(function($ctx2) {
  366. //>>excludeEnd("ctx");
  367. return $recv(self._instruction())._isInlined();
  368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  370. //>>excludeEnd("ctx");
  371. }));
  372. return $1;
  373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  374. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  375. //>>excludeEnd("ctx");
  376. },
  377. //>>excludeStart("ide", pragmas.excludeIdeData);
  378. args: [],
  379. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  380. referencedClasses: [],
  381. //>>excludeEnd("ide");
  382. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  383. }),
  384. $globals.LexicalScope);
  385. $core.addMethod(
  386. $core.method({
  387. selector: "isMethodScope",
  388. protocol: 'testing',
  389. fn: function (){
  390. var self=this;
  391. return false;
  392. },
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. args: [],
  395. source: "isMethodScope\x0a\x09^ false",
  396. referencedClasses: [],
  397. //>>excludeEnd("ide");
  398. messageSends: []
  399. }),
  400. $globals.LexicalScope);
  401. $core.addMethod(
  402. $core.method({
  403. selector: "lookupVariable:",
  404. protocol: 'accessing',
  405. fn: function (aNode){
  406. var self=this;
  407. var lookup;
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. return $core.withContext(function($ctx1) {
  410. //>>excludeEnd("ctx");
  411. var $1,$2,$3,$receiver;
  412. lookup=self._bindingFor_(aNode);
  413. $1=lookup;
  414. if(($receiver = $1) == null || $receiver.isNil){
  415. $2=self._outerScope();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. $ctx1.sendIdx["outerScope"]=1;
  418. //>>excludeEnd("ctx");
  419. if(($receiver = $2) == null || $receiver.isNil){
  420. lookup=$2;
  421. } else {
  422. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  423. };
  424. lookup;
  425. } else {
  426. $1;
  427. };
  428. $3=lookup;
  429. return $3;
  430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  431. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  432. //>>excludeEnd("ctx");
  433. },
  434. //>>excludeStart("ide", pragmas.excludeIdeData);
  435. args: ["aNode"],
  436. source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [\x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
  437. referencedClasses: [],
  438. //>>excludeEnd("ide");
  439. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  440. }),
  441. $globals.LexicalScope);
  442. $core.addMethod(
  443. $core.method({
  444. selector: "methodScope",
  445. protocol: 'accessing',
  446. fn: function (){
  447. var self=this;
  448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  449. return $core.withContext(function($ctx1) {
  450. //>>excludeEnd("ctx");
  451. var $2,$1,$receiver;
  452. $2=self._outerScope();
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. $ctx1.sendIdx["outerScope"]=1;
  455. //>>excludeEnd("ctx");
  456. if(($receiver = $2) == null || $receiver.isNil){
  457. $1=$2;
  458. } else {
  459. $1=$recv(self._outerScope())._methodScope();
  460. };
  461. return $1;
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  464. //>>excludeEnd("ctx");
  465. },
  466. //>>excludeStart("ide", pragmas.excludeIdeData);
  467. args: [],
  468. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  469. referencedClasses: [],
  470. //>>excludeEnd("ide");
  471. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  472. }),
  473. $globals.LexicalScope);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "node",
  477. protocol: 'accessing',
  478. fn: function (){
  479. var self=this;
  480. var $1;
  481. $1=self["@node"];
  482. return $1;
  483. },
  484. //>>excludeStart("ide", pragmas.excludeIdeData);
  485. args: [],
  486. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  487. referencedClasses: [],
  488. //>>excludeEnd("ide");
  489. messageSends: []
  490. }),
  491. $globals.LexicalScope);
  492. $core.addMethod(
  493. $core.method({
  494. selector: "node:",
  495. protocol: 'accessing',
  496. fn: function (aNode){
  497. var self=this;
  498. self["@node"]=aNode;
  499. return self;
  500. },
  501. //>>excludeStart("ide", pragmas.excludeIdeData);
  502. args: ["aNode"],
  503. source: "node: aNode\x0a\x09node := aNode",
  504. referencedClasses: [],
  505. //>>excludeEnd("ide");
  506. messageSends: []
  507. }),
  508. $globals.LexicalScope);
  509. $core.addMethod(
  510. $core.method({
  511. selector: "outerScope",
  512. protocol: 'accessing',
  513. fn: function (){
  514. var self=this;
  515. var $1;
  516. $1=self["@outerScope"];
  517. return $1;
  518. },
  519. //>>excludeStart("ide", pragmas.excludeIdeData);
  520. args: [],
  521. source: "outerScope\x0a\x09^ outerScope",
  522. referencedClasses: [],
  523. //>>excludeEnd("ide");
  524. messageSends: []
  525. }),
  526. $globals.LexicalScope);
  527. $core.addMethod(
  528. $core.method({
  529. selector: "outerScope:",
  530. protocol: 'accessing',
  531. fn: function (aLexicalScope){
  532. var self=this;
  533. self["@outerScope"]=aLexicalScope;
  534. return self;
  535. },
  536. //>>excludeStart("ide", pragmas.excludeIdeData);
  537. args: ["aLexicalScope"],
  538. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  539. referencedClasses: [],
  540. //>>excludeEnd("ide");
  541. messageSends: []
  542. }),
  543. $globals.LexicalScope);
  544. $core.addMethod(
  545. $core.method({
  546. selector: "pseudoVars",
  547. protocol: 'accessing',
  548. fn: function (){
  549. var self=this;
  550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  551. return $core.withContext(function($ctx1) {
  552. //>>excludeEnd("ctx");
  553. var $1;
  554. $1=$recv(self._methodScope())._pseudoVars();
  555. return $1;
  556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  557. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  558. //>>excludeEnd("ctx");
  559. },
  560. //>>excludeStart("ide", pragmas.excludeIdeData);
  561. args: [],
  562. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  563. referencedClasses: [],
  564. //>>excludeEnd("ide");
  565. messageSends: ["pseudoVars", "methodScope"]
  566. }),
  567. $globals.LexicalScope);
  568. $core.addMethod(
  569. $core.method({
  570. selector: "scopeLevel",
  571. protocol: 'accessing',
  572. fn: function (){
  573. var self=this;
  574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  575. return $core.withContext(function($ctx1) {
  576. //>>excludeEnd("ctx");
  577. var $1,$2,$4,$3,$5,$receiver;
  578. $1=self._outerScope();
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. $ctx1.sendIdx["outerScope"]=1;
  581. //>>excludeEnd("ctx");
  582. if(($receiver = $1) == null || $receiver.isNil){
  583. return (1);
  584. } else {
  585. $1;
  586. };
  587. $2=self._isInlined();
  588. if($core.assert($2)){
  589. $4=self._outerScope();
  590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  591. $ctx1.sendIdx["outerScope"]=2;
  592. //>>excludeEnd("ctx");
  593. $3=$recv($4)._scopeLevel();
  594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  595. $ctx1.sendIdx["scopeLevel"]=1;
  596. //>>excludeEnd("ctx");
  597. return $3;
  598. };
  599. $5=$recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  600. return $5;
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  608. referencedClasses: [],
  609. //>>excludeEnd("ide");
  610. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  611. }),
  612. $globals.LexicalScope);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "temps",
  616. protocol: 'accessing',
  617. fn: function (){
  618. var self=this;
  619. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  621. return $core.withContext(function($ctx1) {
  622. //>>excludeEnd("ctx");
  623. var $2,$1,$receiver;
  624. $2=self["@temps"];
  625. if(($receiver = $2) == null || $receiver.isNil){
  626. self["@temps"]=$recv($Dictionary())._new();
  627. $1=self["@temps"];
  628. } else {
  629. $1=$2;
  630. };
  631. return $1;
  632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  633. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  634. //>>excludeEnd("ctx");
  635. },
  636. //>>excludeStart("ide", pragmas.excludeIdeData);
  637. args: [],
  638. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  639. referencedClasses: ["Dictionary"],
  640. //>>excludeEnd("ide");
  641. messageSends: ["ifNil:", "new"]
  642. }),
  643. $globals.LexicalScope);
  644. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  645. //>>excludeStart("ide", pragmas.excludeIdeData);
  646. $globals.MethodLexicalScope.comment="I represent a method scope.";
  647. //>>excludeEnd("ide");
  648. $core.addMethod(
  649. $core.method({
  650. selector: "addIVar:",
  651. protocol: 'adding',
  652. fn: function (aString){
  653. var self=this;
  654. function $InstanceVar(){return $globals.InstanceVar||(typeof InstanceVar=="undefined"?nil:InstanceVar)}
  655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  656. return $core.withContext(function($ctx1) {
  657. //>>excludeEnd("ctx");
  658. var $1;
  659. $1=self._iVars();
  660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  661. $ctx1.sendIdx["iVars"]=1;
  662. //>>excludeEnd("ctx");
  663. $recv($1)._at_put_(aString,$recv($InstanceVar())._on_(aString));
  664. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  665. return self;
  666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  667. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  668. //>>excludeEnd("ctx");
  669. },
  670. //>>excludeStart("ide", pragmas.excludeIdeData);
  671. args: ["aString"],
  672. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  673. referencedClasses: ["InstanceVar"],
  674. //>>excludeEnd("ide");
  675. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  676. }),
  677. $globals.MethodLexicalScope);
  678. $core.addMethod(
  679. $core.method({
  680. selector: "addNonLocalReturn:",
  681. protocol: 'adding',
  682. fn: function (aScope){
  683. var self=this;
  684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  685. return $core.withContext(function($ctx1) {
  686. //>>excludeEnd("ctx");
  687. $recv(self._nonLocalReturns())._add_(aScope);
  688. return self;
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  691. //>>excludeEnd("ctx");
  692. },
  693. //>>excludeStart("ide", pragmas.excludeIdeData);
  694. args: ["aScope"],
  695. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  696. referencedClasses: [],
  697. //>>excludeEnd("ide");
  698. messageSends: ["add:", "nonLocalReturns"]
  699. }),
  700. $globals.MethodLexicalScope);
  701. $core.addMethod(
  702. $core.method({
  703. selector: "allVariableNames",
  704. protocol: 'accessing',
  705. fn: function (){
  706. var self=this;
  707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  708. return $core.withContext(function($ctx1) {
  709. //>>excludeEnd("ctx");
  710. var $2,$1;
  711. $2=(
  712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  713. $ctx1.supercall = true,
  714. //>>excludeEnd("ctx");
  715. $globals.MethodLexicalScope.superclass.fn.prototype._allVariableNames.apply($recv(self), []));
  716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  717. $ctx1.supercall = false;
  718. //>>excludeEnd("ctx");;
  719. $1=$recv($2).__comma($recv(self._iVars())._keys());
  720. return $1;
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  723. //>>excludeEnd("ctx");
  724. },
  725. //>>excludeStart("ide", pragmas.excludeIdeData);
  726. args: [],
  727. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  728. referencedClasses: [],
  729. //>>excludeEnd("ide");
  730. messageSends: [",", "allVariableNames", "keys", "iVars"]
  731. }),
  732. $globals.MethodLexicalScope);
  733. $core.addMethod(
  734. $core.method({
  735. selector: "bindingFor:",
  736. protocol: 'accessing',
  737. fn: function (aNode){
  738. var self=this;
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. return $core.withContext(function($ctx1) {
  741. //>>excludeEnd("ctx");
  742. var $2,$1,$receiver;
  743. $2=(
  744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  745. $ctx1.supercall = true,
  746. //>>excludeEnd("ctx");
  747. $globals.MethodLexicalScope.superclass.fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  749. $ctx1.supercall = false;
  750. //>>excludeEnd("ctx");;
  751. if(($receiver = $2) == null || $receiver.isNil){
  752. $1=$recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  753. return nil;
  754. }));
  755. } else {
  756. $1=$2;
  757. };
  758. return $1;
  759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  760. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  761. //>>excludeEnd("ctx");
  762. },
  763. //>>excludeStart("ide", pragmas.excludeIdeData);
  764. args: ["aNode"],
  765. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  766. referencedClasses: [],
  767. //>>excludeEnd("ide");
  768. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  769. }),
  770. $globals.MethodLexicalScope);
  771. $core.addMethod(
  772. $core.method({
  773. selector: "canInlineNonLocalReturns",
  774. protocol: 'testing',
  775. fn: function (){
  776. var self=this;
  777. return true;
  778. },
  779. //>>excludeStart("ide", pragmas.excludeIdeData);
  780. args: [],
  781. source: "canInlineNonLocalReturns\x0a\x09^ true",
  782. referencedClasses: [],
  783. //>>excludeEnd("ide");
  784. messageSends: []
  785. }),
  786. $globals.MethodLexicalScope);
  787. $core.addMethod(
  788. $core.method({
  789. selector: "hasLocalReturn",
  790. protocol: 'testing',
  791. fn: function (){
  792. var self=this;
  793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  794. return $core.withContext(function($ctx1) {
  795. //>>excludeEnd("ctx");
  796. var $1;
  797. $1=self._localReturn();
  798. return $1;
  799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  800. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  801. //>>excludeEnd("ctx");
  802. },
  803. //>>excludeStart("ide", pragmas.excludeIdeData);
  804. args: [],
  805. source: "hasLocalReturn\x0a\x09^ self localReturn",
  806. referencedClasses: [],
  807. //>>excludeEnd("ide");
  808. messageSends: ["localReturn"]
  809. }),
  810. $globals.MethodLexicalScope);
  811. $core.addMethod(
  812. $core.method({
  813. selector: "hasNonLocalReturn",
  814. protocol: 'testing',
  815. fn: function (){
  816. var self=this;
  817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  818. return $core.withContext(function($ctx1) {
  819. //>>excludeEnd("ctx");
  820. var $1;
  821. $1=$recv(self._nonLocalReturns())._notEmpty();
  822. return $1;
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  825. //>>excludeEnd("ctx");
  826. },
  827. //>>excludeStart("ide", pragmas.excludeIdeData);
  828. args: [],
  829. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  830. referencedClasses: [],
  831. //>>excludeEnd("ide");
  832. messageSends: ["notEmpty", "nonLocalReturns"]
  833. }),
  834. $globals.MethodLexicalScope);
  835. $core.addMethod(
  836. $core.method({
  837. selector: "iVars",
  838. protocol: 'accessing',
  839. fn: function (){
  840. var self=this;
  841. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  843. return $core.withContext(function($ctx1) {
  844. //>>excludeEnd("ctx");
  845. var $2,$1,$receiver;
  846. $2=self["@iVars"];
  847. if(($receiver = $2) == null || $receiver.isNil){
  848. self["@iVars"]=$recv($Dictionary())._new();
  849. $1=self["@iVars"];
  850. } else {
  851. $1=$2;
  852. };
  853. return $1;
  854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  855. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  856. //>>excludeEnd("ctx");
  857. },
  858. //>>excludeStart("ide", pragmas.excludeIdeData);
  859. args: [],
  860. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  861. referencedClasses: ["Dictionary"],
  862. //>>excludeEnd("ide");
  863. messageSends: ["ifNil:", "new"]
  864. }),
  865. $globals.MethodLexicalScope);
  866. $core.addMethod(
  867. $core.method({
  868. selector: "isMethodScope",
  869. protocol: 'testing',
  870. fn: function (){
  871. var self=this;
  872. return true;
  873. },
  874. //>>excludeStart("ide", pragmas.excludeIdeData);
  875. args: [],
  876. source: "isMethodScope\x0a\x09^ true",
  877. referencedClasses: [],
  878. //>>excludeEnd("ide");
  879. messageSends: []
  880. }),
  881. $globals.MethodLexicalScope);
  882. $core.addMethod(
  883. $core.method({
  884. selector: "localReturn",
  885. protocol: 'accessing',
  886. fn: function (){
  887. var self=this;
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. return $core.withContext(function($ctx1) {
  890. //>>excludeEnd("ctx");
  891. var $2,$1,$receiver;
  892. $2=self["@localReturn"];
  893. if(($receiver = $2) == null || $receiver.isNil){
  894. $1=false;
  895. } else {
  896. $1=$2;
  897. };
  898. return $1;
  899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  900. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  901. //>>excludeEnd("ctx");
  902. },
  903. //>>excludeStart("ide", pragmas.excludeIdeData);
  904. args: [],
  905. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  906. referencedClasses: [],
  907. //>>excludeEnd("ide");
  908. messageSends: ["ifNil:"]
  909. }),
  910. $globals.MethodLexicalScope);
  911. $core.addMethod(
  912. $core.method({
  913. selector: "localReturn:",
  914. protocol: 'accessing',
  915. fn: function (aBoolean){
  916. var self=this;
  917. self["@localReturn"]=aBoolean;
  918. return self;
  919. },
  920. //>>excludeStart("ide", pragmas.excludeIdeData);
  921. args: ["aBoolean"],
  922. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  923. referencedClasses: [],
  924. //>>excludeEnd("ide");
  925. messageSends: []
  926. }),
  927. $globals.MethodLexicalScope);
  928. $core.addMethod(
  929. $core.method({
  930. selector: "methodScope",
  931. protocol: 'accessing',
  932. fn: function (){
  933. var self=this;
  934. return self;
  935. },
  936. //>>excludeStart("ide", pragmas.excludeIdeData);
  937. args: [],
  938. source: "methodScope\x0a\x09^ self",
  939. referencedClasses: [],
  940. //>>excludeEnd("ide");
  941. messageSends: []
  942. }),
  943. $globals.MethodLexicalScope);
  944. $core.addMethod(
  945. $core.method({
  946. selector: "nonLocalReturns",
  947. protocol: 'accessing',
  948. fn: function (){
  949. var self=this;
  950. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  952. return $core.withContext(function($ctx1) {
  953. //>>excludeEnd("ctx");
  954. var $2,$1,$receiver;
  955. $2=self["@nonLocalReturns"];
  956. if(($receiver = $2) == null || $receiver.isNil){
  957. self["@nonLocalReturns"]=$recv($OrderedCollection())._new();
  958. $1=self["@nonLocalReturns"];
  959. } else {
  960. $1=$2;
  961. };
  962. return $1;
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  965. //>>excludeEnd("ctx");
  966. },
  967. //>>excludeStart("ide", pragmas.excludeIdeData);
  968. args: [],
  969. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  970. referencedClasses: ["OrderedCollection"],
  971. //>>excludeEnd("ide");
  972. messageSends: ["ifNil:", "new"]
  973. }),
  974. $globals.MethodLexicalScope);
  975. $core.addMethod(
  976. $core.method({
  977. selector: "pseudoVars",
  978. protocol: 'accessing',
  979. fn: function (){
  980. var self=this;
  981. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  982. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  983. function $PseudoVar(){return $globals.PseudoVar||(typeof PseudoVar=="undefined"?nil:PseudoVar)}
  984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  985. return $core.withContext(function($ctx1) {
  986. //>>excludeEnd("ctx");
  987. var $1,$2,$3,$4,$receiver;
  988. $1=self["@pseudoVars"];
  989. if(($receiver = $1) == null || $receiver.isNil){
  990. self["@pseudoVars"]=$recv($Dictionary())._new();
  991. self["@pseudoVars"];
  992. $recv($recv($Smalltalk())._pseudoVariableNames())._do_((function(each){
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. return $core.withContext(function($ctx2) {
  995. //>>excludeEnd("ctx");
  996. $2=$recv($PseudoVar())._on_(each);
  997. $recv($2)._scope_(self._methodScope());
  998. $3=$recv($2)._yourself();
  999. return $recv(self["@pseudoVars"])._at_put_(each,$3);
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1002. //>>excludeEnd("ctx");
  1003. }));
  1004. } else {
  1005. $1;
  1006. };
  1007. $4=self["@pseudoVars"];
  1008. return $4;
  1009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1010. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  1011. //>>excludeEnd("ctx");
  1012. },
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: [],
  1015. source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
  1016. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  1017. //>>excludeEnd("ide");
  1018. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  1019. }),
  1020. $globals.MethodLexicalScope);
  1021. $core.addMethod(
  1022. $core.method({
  1023. selector: "removeNonLocalReturn:",
  1024. protocol: 'adding',
  1025. fn: function (aScope){
  1026. var self=this;
  1027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1028. return $core.withContext(function($ctx1) {
  1029. //>>excludeEnd("ctx");
  1030. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  1031. }));
  1032. return self;
  1033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1034. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  1035. //>>excludeEnd("ctx");
  1036. },
  1037. //>>excludeStart("ide", pragmas.excludeIdeData);
  1038. args: ["aScope"],
  1039. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  1040. referencedClasses: [],
  1041. //>>excludeEnd("ide");
  1042. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  1043. }),
  1044. $globals.MethodLexicalScope);
  1045. $core.addMethod(
  1046. $core.method({
  1047. selector: "unknownVariables",
  1048. protocol: 'accessing',
  1049. fn: function (){
  1050. var self=this;
  1051. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1053. return $core.withContext(function($ctx1) {
  1054. //>>excludeEnd("ctx");
  1055. var $2,$1,$receiver;
  1056. $2=self["@unknownVariables"];
  1057. if(($receiver = $2) == null || $receiver.isNil){
  1058. self["@unknownVariables"]=$recv($OrderedCollection())._new();
  1059. $1=self["@unknownVariables"];
  1060. } else {
  1061. $1=$2;
  1062. };
  1063. return $1;
  1064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1065. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  1066. //>>excludeEnd("ctx");
  1067. },
  1068. //>>excludeStart("ide", pragmas.excludeIdeData);
  1069. args: [],
  1070. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  1071. referencedClasses: ["OrderedCollection"],
  1072. //>>excludeEnd("ide");
  1073. messageSends: ["ifNil:", "new"]
  1074. }),
  1075. $globals.MethodLexicalScope);
  1076. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  1077. //>>excludeStart("ide", pragmas.excludeIdeData);
  1078. $globals.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name.\x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars.";
  1079. //>>excludeEnd("ide");
  1080. $core.addMethod(
  1081. $core.method({
  1082. selector: "alias",
  1083. protocol: 'accessing',
  1084. fn: function (){
  1085. var self=this;
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. return $core.withContext(function($ctx1) {
  1088. //>>excludeEnd("ctx");
  1089. var $1;
  1090. $1=$recv(self._name())._asVariableName();
  1091. return $1;
  1092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1093. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  1094. //>>excludeEnd("ctx");
  1095. },
  1096. //>>excludeStart("ide", pragmas.excludeIdeData);
  1097. args: [],
  1098. source: "alias\x0a\x09^ self name asVariableName",
  1099. referencedClasses: [],
  1100. //>>excludeEnd("ide");
  1101. messageSends: ["asVariableName", "name"]
  1102. }),
  1103. $globals.ScopeVar);
  1104. $core.addMethod(
  1105. $core.method({
  1106. selector: "isArgVar",
  1107. protocol: 'testing',
  1108. fn: function (){
  1109. var self=this;
  1110. return false;
  1111. },
  1112. //>>excludeStart("ide", pragmas.excludeIdeData);
  1113. args: [],
  1114. source: "isArgVar\x0a\x09^ false",
  1115. referencedClasses: [],
  1116. //>>excludeEnd("ide");
  1117. messageSends: []
  1118. }),
  1119. $globals.ScopeVar);
  1120. $core.addMethod(
  1121. $core.method({
  1122. selector: "isClassRefVar",
  1123. protocol: 'testing',
  1124. fn: function (){
  1125. var self=this;
  1126. return false;
  1127. },
  1128. //>>excludeStart("ide", pragmas.excludeIdeData);
  1129. args: [],
  1130. source: "isClassRefVar\x0a\x09^ false",
  1131. referencedClasses: [],
  1132. //>>excludeEnd("ide");
  1133. messageSends: []
  1134. }),
  1135. $globals.ScopeVar);
  1136. $core.addMethod(
  1137. $core.method({
  1138. selector: "isImmutable",
  1139. protocol: 'testing',
  1140. fn: function (){
  1141. var self=this;
  1142. return false;
  1143. },
  1144. //>>excludeStart("ide", pragmas.excludeIdeData);
  1145. args: [],
  1146. source: "isImmutable\x0a\x09^ false",
  1147. referencedClasses: [],
  1148. //>>excludeEnd("ide");
  1149. messageSends: []
  1150. }),
  1151. $globals.ScopeVar);
  1152. $core.addMethod(
  1153. $core.method({
  1154. selector: "isInstanceVar",
  1155. protocol: 'testing',
  1156. fn: function (){
  1157. var self=this;
  1158. return false;
  1159. },
  1160. //>>excludeStart("ide", pragmas.excludeIdeData);
  1161. args: [],
  1162. source: "isInstanceVar\x0a\x09^ false",
  1163. referencedClasses: [],
  1164. //>>excludeEnd("ide");
  1165. messageSends: []
  1166. }),
  1167. $globals.ScopeVar);
  1168. $core.addMethod(
  1169. $core.method({
  1170. selector: "isPseudoVar",
  1171. protocol: 'testing',
  1172. fn: function (){
  1173. var self=this;
  1174. return false;
  1175. },
  1176. //>>excludeStart("ide", pragmas.excludeIdeData);
  1177. args: [],
  1178. source: "isPseudoVar\x0a\x09^ false",
  1179. referencedClasses: [],
  1180. //>>excludeEnd("ide");
  1181. messageSends: []
  1182. }),
  1183. $globals.ScopeVar);
  1184. $core.addMethod(
  1185. $core.method({
  1186. selector: "isTempVar",
  1187. protocol: 'testing',
  1188. fn: function (){
  1189. var self=this;
  1190. return false;
  1191. },
  1192. //>>excludeStart("ide", pragmas.excludeIdeData);
  1193. args: [],
  1194. source: "isTempVar\x0a\x09^ false",
  1195. referencedClasses: [],
  1196. //>>excludeEnd("ide");
  1197. messageSends: []
  1198. }),
  1199. $globals.ScopeVar);
  1200. $core.addMethod(
  1201. $core.method({
  1202. selector: "isUnknownVar",
  1203. protocol: 'testing',
  1204. fn: function (){
  1205. var self=this;
  1206. return false;
  1207. },
  1208. //>>excludeStart("ide", pragmas.excludeIdeData);
  1209. args: [],
  1210. source: "isUnknownVar\x0a\x09^ false",
  1211. referencedClasses: [],
  1212. //>>excludeEnd("ide");
  1213. messageSends: []
  1214. }),
  1215. $globals.ScopeVar);
  1216. $core.addMethod(
  1217. $core.method({
  1218. selector: "name",
  1219. protocol: 'accessing',
  1220. fn: function (){
  1221. var self=this;
  1222. var $1;
  1223. $1=self["@name"];
  1224. return $1;
  1225. },
  1226. //>>excludeStart("ide", pragmas.excludeIdeData);
  1227. args: [],
  1228. source: "name\x0a\x09^ name",
  1229. referencedClasses: [],
  1230. //>>excludeEnd("ide");
  1231. messageSends: []
  1232. }),
  1233. $globals.ScopeVar);
  1234. $core.addMethod(
  1235. $core.method({
  1236. selector: "name:",
  1237. protocol: 'accessing',
  1238. fn: function (aString){
  1239. var self=this;
  1240. self["@name"]=aString;
  1241. return self;
  1242. },
  1243. //>>excludeStart("ide", pragmas.excludeIdeData);
  1244. args: ["aString"],
  1245. source: "name: aString\x0a\x09name := aString",
  1246. referencedClasses: [],
  1247. //>>excludeEnd("ide");
  1248. messageSends: []
  1249. }),
  1250. $globals.ScopeVar);
  1251. $core.addMethod(
  1252. $core.method({
  1253. selector: "scope",
  1254. protocol: 'accessing',
  1255. fn: function (){
  1256. var self=this;
  1257. var $1;
  1258. $1=self["@scope"];
  1259. return $1;
  1260. },
  1261. //>>excludeStart("ide", pragmas.excludeIdeData);
  1262. args: [],
  1263. source: "scope\x0a\x09^ scope",
  1264. referencedClasses: [],
  1265. //>>excludeEnd("ide");
  1266. messageSends: []
  1267. }),
  1268. $globals.ScopeVar);
  1269. $core.addMethod(
  1270. $core.method({
  1271. selector: "scope:",
  1272. protocol: 'accessing',
  1273. fn: function (aScope){
  1274. var self=this;
  1275. self["@scope"]=aScope;
  1276. return self;
  1277. },
  1278. //>>excludeStart("ide", pragmas.excludeIdeData);
  1279. args: ["aScope"],
  1280. source: "scope: aScope\x0a\x09scope := aScope",
  1281. referencedClasses: [],
  1282. //>>excludeEnd("ide");
  1283. messageSends: []
  1284. }),
  1285. $globals.ScopeVar);
  1286. $core.addMethod(
  1287. $core.method({
  1288. selector: "validateAssignment",
  1289. protocol: 'testing',
  1290. fn: function (){
  1291. var self=this;
  1292. function $InvalidAssignmentError(){return $globals.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. return $core.withContext(function($ctx1) {
  1295. //>>excludeEnd("ctx");
  1296. var $1,$2,$3;
  1297. $1=$recv(self._isArgVar())._or_((function(){
  1298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1299. return $core.withContext(function($ctx2) {
  1300. //>>excludeEnd("ctx");
  1301. return self._isPseudoVar();
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1304. //>>excludeEnd("ctx");
  1305. }));
  1306. if($core.assert($1)){
  1307. $2=$recv($InvalidAssignmentError())._new();
  1308. $recv($2)._variableName_(self._name());
  1309. $3=$recv($2)._signal();
  1310. $3;
  1311. };
  1312. return self;
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  1315. //>>excludeEnd("ctx");
  1316. },
  1317. //>>excludeStart("ide", pragmas.excludeIdeData);
  1318. args: [],
  1319. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  1320. referencedClasses: ["InvalidAssignmentError"],
  1321. //>>excludeEnd("ide");
  1322. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  1323. }),
  1324. $globals.ScopeVar);
  1325. $core.addMethod(
  1326. $core.method({
  1327. selector: "on:",
  1328. protocol: 'instance creation',
  1329. fn: function (aString){
  1330. var self=this;
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. return $core.withContext(function($ctx1) {
  1333. //>>excludeEnd("ctx");
  1334. var $2,$3,$1;
  1335. $2=self._new();
  1336. $recv($2)._name_(aString);
  1337. $3=$recv($2)._yourself();
  1338. $1=$3;
  1339. return $1;
  1340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1341. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  1342. //>>excludeEnd("ctx");
  1343. },
  1344. //>>excludeStart("ide", pragmas.excludeIdeData);
  1345. args: ["aString"],
  1346. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  1347. referencedClasses: [],
  1348. //>>excludeEnd("ide");
  1349. messageSends: ["name:", "new", "yourself"]
  1350. }),
  1351. $globals.ScopeVar.klass);
  1352. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  1353. //>>excludeStart("ide", pragmas.excludeIdeData);
  1354. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  1355. //>>excludeEnd("ide");
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "node",
  1359. protocol: 'accessing',
  1360. fn: function (){
  1361. var self=this;
  1362. var $1;
  1363. $1=self["@node"];
  1364. return $1;
  1365. },
  1366. //>>excludeStart("ide", pragmas.excludeIdeData);
  1367. args: [],
  1368. source: "node\x0a\x09^ node",
  1369. referencedClasses: [],
  1370. //>>excludeEnd("ide");
  1371. messageSends: []
  1372. }),
  1373. $globals.AliasVar);
  1374. $core.addMethod(
  1375. $core.method({
  1376. selector: "node:",
  1377. protocol: 'accessing',
  1378. fn: function (aNode){
  1379. var self=this;
  1380. self["@node"]=aNode;
  1381. return self;
  1382. },
  1383. //>>excludeStart("ide", pragmas.excludeIdeData);
  1384. args: ["aNode"],
  1385. source: "node: aNode\x0a\x09node := aNode",
  1386. referencedClasses: [],
  1387. //>>excludeEnd("ide");
  1388. messageSends: []
  1389. }),
  1390. $globals.AliasVar);
  1391. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1392. //>>excludeStart("ide", pragmas.excludeIdeData);
  1393. $globals.ArgVar.comment="I am an argument of a method or block.";
  1394. //>>excludeEnd("ide");
  1395. $core.addMethod(
  1396. $core.method({
  1397. selector: "isArgVar",
  1398. protocol: 'testing',
  1399. fn: function (){
  1400. var self=this;
  1401. return true;
  1402. },
  1403. //>>excludeStart("ide", pragmas.excludeIdeData);
  1404. args: [],
  1405. source: "isArgVar\x0a\x09^ true",
  1406. referencedClasses: [],
  1407. //>>excludeEnd("ide");
  1408. messageSends: []
  1409. }),
  1410. $globals.ArgVar);
  1411. $core.addMethod(
  1412. $core.method({
  1413. selector: "isImmutable",
  1414. protocol: 'testing',
  1415. fn: function (){
  1416. var self=this;
  1417. return true;
  1418. },
  1419. //>>excludeStart("ide", pragmas.excludeIdeData);
  1420. args: [],
  1421. source: "isImmutable\x0a\x09^ true",
  1422. referencedClasses: [],
  1423. //>>excludeEnd("ide");
  1424. messageSends: []
  1425. }),
  1426. $globals.ArgVar);
  1427. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1428. //>>excludeStart("ide", pragmas.excludeIdeData);
  1429. $globals.ClassRefVar.comment="I am an class reference variable";
  1430. //>>excludeEnd("ide");
  1431. $core.addMethod(
  1432. $core.method({
  1433. selector: "alias",
  1434. protocol: 'accessing',
  1435. fn: function (){
  1436. var self=this;
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx1) {
  1439. //>>excludeEnd("ctx");
  1440. var $1;
  1441. $1=$recv("$".__comma(self._name())).__comma("()");
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. $ctx1.sendIdx[","]=1;
  1444. //>>excludeEnd("ctx");
  1445. return $1;
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  1448. //>>excludeEnd("ctx");
  1449. },
  1450. //>>excludeStart("ide", pragmas.excludeIdeData);
  1451. args: [],
  1452. source: "alias\x0a\x09\x22Fixes issue #190.\x0a\x09A function is created in the method definition, answering the class or nil.\x0a\x09See JSStream >> #nextPutClassRefFunction:\x22\x0a\x09\x0a\x09^ '$', self name, '()'",
  1453. referencedClasses: [],
  1454. //>>excludeEnd("ide");
  1455. messageSends: [",", "name"]
  1456. }),
  1457. $globals.ClassRefVar);
  1458. $core.addMethod(
  1459. $core.method({
  1460. selector: "isClassRefVar",
  1461. protocol: 'testing',
  1462. fn: function (){
  1463. var self=this;
  1464. return true;
  1465. },
  1466. //>>excludeStart("ide", pragmas.excludeIdeData);
  1467. args: [],
  1468. source: "isClassRefVar\x0a\x09^ true",
  1469. referencedClasses: [],
  1470. //>>excludeEnd("ide");
  1471. messageSends: []
  1472. }),
  1473. $globals.ClassRefVar);
  1474. $core.addMethod(
  1475. $core.method({
  1476. selector: "isImmutable",
  1477. protocol: 'testing',
  1478. fn: function (){
  1479. var self=this;
  1480. return true;
  1481. },
  1482. //>>excludeStart("ide", pragmas.excludeIdeData);
  1483. args: [],
  1484. source: "isImmutable\x0a\x09^ true",
  1485. referencedClasses: [],
  1486. //>>excludeEnd("ide");
  1487. messageSends: []
  1488. }),
  1489. $globals.ClassRefVar);
  1490. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1491. //>>excludeStart("ide", pragmas.excludeIdeData);
  1492. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  1493. //>>excludeEnd("ide");
  1494. $core.addMethod(
  1495. $core.method({
  1496. selector: "alias",
  1497. protocol: 'testing',
  1498. fn: function (){
  1499. var self=this;
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. return $core.withContext(function($ctx1) {
  1502. //>>excludeEnd("ctx");
  1503. var $1;
  1504. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. $ctx1.sendIdx[","]=1;
  1507. //>>excludeEnd("ctx");
  1508. return $1;
  1509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1510. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  1511. //>>excludeEnd("ctx");
  1512. },
  1513. //>>excludeStart("ide", pragmas.excludeIdeData);
  1514. args: [],
  1515. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  1516. referencedClasses: [],
  1517. //>>excludeEnd("ide");
  1518. messageSends: [",", "name"]
  1519. }),
  1520. $globals.InstanceVar);
  1521. $core.addMethod(
  1522. $core.method({
  1523. selector: "isInstanceVar",
  1524. protocol: 'testing',
  1525. fn: function (){
  1526. var self=this;
  1527. return true;
  1528. },
  1529. //>>excludeStart("ide", pragmas.excludeIdeData);
  1530. args: [],
  1531. source: "isInstanceVar\x0a\x09^ true",
  1532. referencedClasses: [],
  1533. //>>excludeEnd("ide");
  1534. messageSends: []
  1535. }),
  1536. $globals.InstanceVar);
  1537. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1538. //>>excludeStart("ide", pragmas.excludeIdeData);
  1539. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  1540. //>>excludeEnd("ide");
  1541. $core.addMethod(
  1542. $core.method({
  1543. selector: "alias",
  1544. protocol: 'accessing',
  1545. fn: function (){
  1546. var self=this;
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. return $core.withContext(function($ctx1) {
  1549. //>>excludeEnd("ctx");
  1550. var $1;
  1551. $1=self._name();
  1552. return $1;
  1553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1554. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  1555. //>>excludeEnd("ctx");
  1556. },
  1557. //>>excludeStart("ide", pragmas.excludeIdeData);
  1558. args: [],
  1559. source: "alias\x0a\x09^ self name",
  1560. referencedClasses: [],
  1561. //>>excludeEnd("ide");
  1562. messageSends: ["name"]
  1563. }),
  1564. $globals.PseudoVar);
  1565. $core.addMethod(
  1566. $core.method({
  1567. selector: "isImmutable",
  1568. protocol: 'testing',
  1569. fn: function (){
  1570. var self=this;
  1571. return true;
  1572. },
  1573. //>>excludeStart("ide", pragmas.excludeIdeData);
  1574. args: [],
  1575. source: "isImmutable\x0a\x09^ true",
  1576. referencedClasses: [],
  1577. //>>excludeEnd("ide");
  1578. messageSends: []
  1579. }),
  1580. $globals.PseudoVar);
  1581. $core.addMethod(
  1582. $core.method({
  1583. selector: "isPseudoVar",
  1584. protocol: 'testing',
  1585. fn: function (){
  1586. var self=this;
  1587. return true;
  1588. },
  1589. //>>excludeStart("ide", pragmas.excludeIdeData);
  1590. args: [],
  1591. source: "isPseudoVar\x0a\x09^ true",
  1592. referencedClasses: [],
  1593. //>>excludeEnd("ide");
  1594. messageSends: []
  1595. }),
  1596. $globals.PseudoVar);
  1597. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  1600. //>>excludeEnd("ide");
  1601. $core.addMethod(
  1602. $core.method({
  1603. selector: "isTempVar",
  1604. protocol: 'testing',
  1605. fn: function (){
  1606. var self=this;
  1607. return true;
  1608. },
  1609. //>>excludeStart("ide", pragmas.excludeIdeData);
  1610. args: [],
  1611. source: "isTempVar\x0a\x09^ true",
  1612. referencedClasses: [],
  1613. //>>excludeEnd("ide");
  1614. messageSends: []
  1615. }),
  1616. $globals.TempVar);
  1617. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  1618. //>>excludeStart("ide", pragmas.excludeIdeData);
  1619. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  1620. //>>excludeEnd("ide");
  1621. $core.addMethod(
  1622. $core.method({
  1623. selector: "isUnknownVar",
  1624. protocol: 'testing',
  1625. fn: function (){
  1626. var self=this;
  1627. return true;
  1628. },
  1629. //>>excludeStart("ide", pragmas.excludeIdeData);
  1630. args: [],
  1631. source: "isUnknownVar\x0a\x09^ true",
  1632. referencedClasses: [],
  1633. //>>excludeEnd("ide");
  1634. messageSends: []
  1635. }),
  1636. $globals.UnknownVar);
  1637. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends', 'superSends'], 'Compiler-Semantic');
  1638. //>>excludeStart("ide", pragmas.excludeIdeData);
  1639. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  1640. //>>excludeEnd("ide");
  1641. $core.addMethod(
  1642. $core.method({
  1643. selector: "classReferences",
  1644. protocol: 'accessing',
  1645. fn: function (){
  1646. var self=this;
  1647. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. return $core.withContext(function($ctx1) {
  1650. //>>excludeEnd("ctx");
  1651. var $2,$1,$receiver;
  1652. $2=self["@classReferences"];
  1653. if(($receiver = $2) == null || $receiver.isNil){
  1654. self["@classReferences"]=$recv($Set())._new();
  1655. $1=self["@classReferences"];
  1656. } else {
  1657. $1=$2;
  1658. };
  1659. return $1;
  1660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1661. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  1662. //>>excludeEnd("ctx");
  1663. },
  1664. //>>excludeStart("ide", pragmas.excludeIdeData);
  1665. args: [],
  1666. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  1667. referencedClasses: ["Set"],
  1668. //>>excludeEnd("ide");
  1669. messageSends: ["ifNil:", "new"]
  1670. }),
  1671. $globals.SemanticAnalyzer);
  1672. $core.addMethod(
  1673. $core.method({
  1674. selector: "errorShadowingVariable:",
  1675. protocol: 'error handling',
  1676. fn: function (aString){
  1677. var self=this;
  1678. function $ShadowingVariableError(){return $globals.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
  1679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1680. return $core.withContext(function($ctx1) {
  1681. //>>excludeEnd("ctx");
  1682. var $1,$2;
  1683. $1=$recv($ShadowingVariableError())._new();
  1684. $recv($1)._variableName_(aString);
  1685. $2=$recv($1)._signal();
  1686. return self;
  1687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1688. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  1689. //>>excludeEnd("ctx");
  1690. },
  1691. //>>excludeStart("ide", pragmas.excludeIdeData);
  1692. args: ["aString"],
  1693. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  1694. referencedClasses: ["ShadowingVariableError"],
  1695. //>>excludeEnd("ide");
  1696. messageSends: ["variableName:", "new", "signal"]
  1697. }),
  1698. $globals.SemanticAnalyzer);
  1699. $core.addMethod(
  1700. $core.method({
  1701. selector: "errorUnknownVariable:",
  1702. protocol: 'error handling',
  1703. fn: function (aNode){
  1704. var self=this;
  1705. var identifier;
  1706. function $Smalltalk(){return $globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1707. function $UnknownVariableError(){return $globals.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
  1708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1709. return $core.withContext(function($ctx1) {
  1710. //>>excludeEnd("ctx");
  1711. var $1,$2,$3,$4,$5;
  1712. identifier=$recv(aNode)._value();
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. $ctx1.sendIdx["value"]=1;
  1715. //>>excludeEnd("ctx");
  1716. $1=$recv($recv($recv($recv($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. return $core.withContext(function($ctx2) {
  1719. //>>excludeEnd("ctx");
  1720. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  1721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1723. //>>excludeEnd("ctx");
  1724. }));
  1725. if($core.assert($1)){
  1726. $2=$recv($UnknownVariableError())._new();
  1727. $3=$2;
  1728. $4=$recv(aNode)._value();
  1729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1730. $ctx1.sendIdx["value"]=2;
  1731. //>>excludeEnd("ctx");
  1732. $recv($3)._variableName_($4);
  1733. $5=$recv($2)._signal();
  1734. $5;
  1735. } else {
  1736. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  1737. };
  1738. return self;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  1741. //>>excludeEnd("ctx");
  1742. },
  1743. //>>excludeStart("ide", pragmas.excludeIdeData);
  1744. args: ["aNode"],
  1745. source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`, `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableUndefined: identifier inPackage: self thePackage ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
  1746. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  1747. //>>excludeEnd("ide");
  1748. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  1749. }),
  1750. $globals.SemanticAnalyzer);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "isVariableUndefined:inPackage:",
  1754. protocol: 'testing',
  1755. fn: function (aString,aPackage){
  1756. var self=this;
  1757. function $Compiler(){return $globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1759. return $core.withContext(function($ctx1) {
  1760. //>>excludeEnd("ctx");
  1761. var $2,$3,$1;
  1762. $2=$recv($Compiler())._new();
  1763. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  1764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1765. $ctx1.sendIdx[","]=1;
  1766. //>>excludeEnd("ctx");
  1767. $1=$recv($2)._eval_forPackage_($3,aPackage);
  1768. return $1;
  1769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1770. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  1771. //>>excludeEnd("ctx");
  1772. },
  1773. //>>excludeStart("ide", pragmas.excludeIdeData);
  1774. args: ["aString", "aPackage"],
  1775. source: "isVariableUndefined: aString inPackage: aPackage\x0a\x09^ Compiler new\x0a\x09\x09eval: 'typeof ', aString, ' == \x22undefined\x22'\x0a\x09\x09forPackage: aPackage",
  1776. referencedClasses: ["Compiler"],
  1777. //>>excludeEnd("ide");
  1778. messageSends: ["eval:forPackage:", "new", ","]
  1779. }),
  1780. $globals.SemanticAnalyzer);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "messageSends",
  1784. protocol: 'accessing',
  1785. fn: function (){
  1786. var self=this;
  1787. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1789. return $core.withContext(function($ctx1) {
  1790. //>>excludeEnd("ctx");
  1791. var $2,$1,$receiver;
  1792. $2=self["@messageSends"];
  1793. if(($receiver = $2) == null || $receiver.isNil){
  1794. self["@messageSends"]=$recv($Dictionary())._new();
  1795. $1=self["@messageSends"];
  1796. } else {
  1797. $1=$2;
  1798. };
  1799. return $1;
  1800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1801. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  1802. //>>excludeEnd("ctx");
  1803. },
  1804. //>>excludeStart("ide", pragmas.excludeIdeData);
  1805. args: [],
  1806. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  1807. referencedClasses: ["Dictionary"],
  1808. //>>excludeEnd("ide");
  1809. messageSends: ["ifNil:", "new"]
  1810. }),
  1811. $globals.SemanticAnalyzer);
  1812. $core.addMethod(
  1813. $core.method({
  1814. selector: "newBlockScope",
  1815. protocol: 'factory',
  1816. fn: function (){
  1817. var self=this;
  1818. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  1819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1820. return $core.withContext(function($ctx1) {
  1821. //>>excludeEnd("ctx");
  1822. var $1;
  1823. $1=self._newScopeOfClass_($LexicalScope());
  1824. return $1;
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  1827. //>>excludeEnd("ctx");
  1828. },
  1829. //>>excludeStart("ide", pragmas.excludeIdeData);
  1830. args: [],
  1831. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  1832. referencedClasses: ["LexicalScope"],
  1833. //>>excludeEnd("ide");
  1834. messageSends: ["newScopeOfClass:"]
  1835. }),
  1836. $globals.SemanticAnalyzer);
  1837. $core.addMethod(
  1838. $core.method({
  1839. selector: "newMethodScope",
  1840. protocol: 'factory',
  1841. fn: function (){
  1842. var self=this;
  1843. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1845. return $core.withContext(function($ctx1) {
  1846. //>>excludeEnd("ctx");
  1847. var $1;
  1848. $1=self._newScopeOfClass_($MethodLexicalScope());
  1849. return $1;
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  1852. //>>excludeEnd("ctx");
  1853. },
  1854. //>>excludeStart("ide", pragmas.excludeIdeData);
  1855. args: [],
  1856. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  1857. referencedClasses: ["MethodLexicalScope"],
  1858. //>>excludeEnd("ide");
  1859. messageSends: ["newScopeOfClass:"]
  1860. }),
  1861. $globals.SemanticAnalyzer);
  1862. $core.addMethod(
  1863. $core.method({
  1864. selector: "newScopeOfClass:",
  1865. protocol: 'factory',
  1866. fn: function (aLexicalScopeClass){
  1867. var self=this;
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. return $core.withContext(function($ctx1) {
  1870. //>>excludeEnd("ctx");
  1871. var $2,$3,$1;
  1872. $2=$recv(aLexicalScopeClass)._new();
  1873. $recv($2)._outerScope_(self["@currentScope"]);
  1874. $3=$recv($2)._yourself();
  1875. $1=$3;
  1876. return $1;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  1879. //>>excludeEnd("ctx");
  1880. },
  1881. //>>excludeStart("ide", pragmas.excludeIdeData);
  1882. args: ["aLexicalScopeClass"],
  1883. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  1884. referencedClasses: [],
  1885. //>>excludeEnd("ide");
  1886. messageSends: ["outerScope:", "new", "yourself"]
  1887. }),
  1888. $globals.SemanticAnalyzer);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "nextBlockIndex",
  1892. protocol: 'private',
  1893. fn: function (){
  1894. var self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. var $1,$2,$receiver;
  1899. $1=self["@blockIndex"];
  1900. if(($receiver = $1) == null || $receiver.isNil){
  1901. self["@blockIndex"]=(0);
  1902. self["@blockIndex"];
  1903. } else {
  1904. $1;
  1905. };
  1906. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  1907. $2=self["@blockIndex"];
  1908. return $2;
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  1911. //>>excludeEnd("ctx");
  1912. },
  1913. //>>excludeStart("ide", pragmas.excludeIdeData);
  1914. args: [],
  1915. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  1916. referencedClasses: [],
  1917. //>>excludeEnd("ide");
  1918. messageSends: ["ifNil:", "+"]
  1919. }),
  1920. $globals.SemanticAnalyzer);
  1921. $core.addMethod(
  1922. $core.method({
  1923. selector: "popScope",
  1924. protocol: 'scope',
  1925. fn: function (){
  1926. var self=this;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. return $core.withContext(function($ctx1) {
  1929. //>>excludeEnd("ctx");
  1930. var $1,$receiver;
  1931. $1=self["@currentScope"];
  1932. if(($receiver = $1) == null || $receiver.isNil){
  1933. $1;
  1934. } else {
  1935. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  1936. self["@currentScope"];
  1937. };
  1938. return self;
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  1941. //>>excludeEnd("ctx");
  1942. },
  1943. //>>excludeStart("ide", pragmas.excludeIdeData);
  1944. args: [],
  1945. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  1946. referencedClasses: [],
  1947. //>>excludeEnd("ide");
  1948. messageSends: ["ifNotNil:", "outerScope"]
  1949. }),
  1950. $globals.SemanticAnalyzer);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "pushScope:",
  1954. protocol: 'scope',
  1955. fn: function (aScope){
  1956. var self=this;
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. return $core.withContext(function($ctx1) {
  1959. //>>excludeEnd("ctx");
  1960. $recv(aScope)._outerScope_(self["@currentScope"]);
  1961. self["@currentScope"]=aScope;
  1962. return self;
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  1965. //>>excludeEnd("ctx");
  1966. },
  1967. //>>excludeStart("ide", pragmas.excludeIdeData);
  1968. args: ["aScope"],
  1969. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  1970. referencedClasses: [],
  1971. //>>excludeEnd("ide");
  1972. messageSends: ["outerScope:"]
  1973. }),
  1974. $globals.SemanticAnalyzer);
  1975. $core.addMethod(
  1976. $core.method({
  1977. selector: "superSends",
  1978. protocol: 'accessing',
  1979. fn: function (){
  1980. var self=this;
  1981. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1983. return $core.withContext(function($ctx1) {
  1984. //>>excludeEnd("ctx");
  1985. var $2,$1,$receiver;
  1986. $2=self["@superSends"];
  1987. if(($receiver = $2) == null || $receiver.isNil){
  1988. self["@superSends"]=$recv($Dictionary())._new();
  1989. $1=self["@superSends"];
  1990. } else {
  1991. $1=$2;
  1992. };
  1993. return $1;
  1994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1995. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  1996. //>>excludeEnd("ctx");
  1997. },
  1998. //>>excludeStart("ide", pragmas.excludeIdeData);
  1999. args: [],
  2000. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  2001. referencedClasses: ["Dictionary"],
  2002. //>>excludeEnd("ide");
  2003. messageSends: ["ifNil:", "new"]
  2004. }),
  2005. $globals.SemanticAnalyzer);
  2006. $core.addMethod(
  2007. $core.method({
  2008. selector: "theClass",
  2009. protocol: 'accessing',
  2010. fn: function (){
  2011. var self=this;
  2012. var $1;
  2013. $1=self["@theClass"];
  2014. return $1;
  2015. },
  2016. //>>excludeStart("ide", pragmas.excludeIdeData);
  2017. args: [],
  2018. source: "theClass\x0a\x09^ theClass",
  2019. referencedClasses: [],
  2020. //>>excludeEnd("ide");
  2021. messageSends: []
  2022. }),
  2023. $globals.SemanticAnalyzer);
  2024. $core.addMethod(
  2025. $core.method({
  2026. selector: "theClass:",
  2027. protocol: 'accessing',
  2028. fn: function (aClass){
  2029. var self=this;
  2030. self["@theClass"]=aClass;
  2031. return self;
  2032. },
  2033. //>>excludeStart("ide", pragmas.excludeIdeData);
  2034. args: ["aClass"],
  2035. source: "theClass: aClass\x0a\x09theClass := aClass",
  2036. referencedClasses: [],
  2037. //>>excludeEnd("ide");
  2038. messageSends: []
  2039. }),
  2040. $globals.SemanticAnalyzer);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "thePackage",
  2044. protocol: 'accessing',
  2045. fn: function (){
  2046. var self=this;
  2047. var $1;
  2048. $1=self["@thePackage"];
  2049. return $1;
  2050. },
  2051. //>>excludeStart("ide", pragmas.excludeIdeData);
  2052. args: [],
  2053. source: "thePackage\x0a\x09^ thePackage",
  2054. referencedClasses: [],
  2055. //>>excludeEnd("ide");
  2056. messageSends: []
  2057. }),
  2058. $globals.SemanticAnalyzer);
  2059. $core.addMethod(
  2060. $core.method({
  2061. selector: "thePackage:",
  2062. protocol: 'accessing',
  2063. fn: function (aPackage){
  2064. var self=this;
  2065. self["@thePackage"]=aPackage;
  2066. return self;
  2067. },
  2068. //>>excludeStart("ide", pragmas.excludeIdeData);
  2069. args: ["aPackage"],
  2070. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  2071. referencedClasses: [],
  2072. //>>excludeEnd("ide");
  2073. messageSends: []
  2074. }),
  2075. $globals.SemanticAnalyzer);
  2076. $core.addMethod(
  2077. $core.method({
  2078. selector: "validateVariableScope:",
  2079. protocol: 'scope',
  2080. fn: function (aString){
  2081. var self=this;
  2082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2083. return $core.withContext(function($ctx1) {
  2084. //>>excludeEnd("ctx");
  2085. var $1,$receiver;
  2086. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  2087. if(($receiver = $1) == null || $receiver.isNil){
  2088. $1;
  2089. } else {
  2090. self._errorShadowingVariable_(aString);
  2091. };
  2092. return self;
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  2095. //>>excludeEnd("ctx");
  2096. },
  2097. //>>excludeStart("ide", pragmas.excludeIdeData);
  2098. args: ["aString"],
  2099. source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
  2100. referencedClasses: [],
  2101. //>>excludeEnd("ide");
  2102. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  2103. }),
  2104. $globals.SemanticAnalyzer);
  2105. $core.addMethod(
  2106. $core.method({
  2107. selector: "visitAssignmentNode:",
  2108. protocol: 'visiting',
  2109. fn: function (aNode){
  2110. var self=this;
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. return $core.withContext(function($ctx1) {
  2113. //>>excludeEnd("ctx");
  2114. (
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. $ctx1.supercall = true,
  2117. //>>excludeEnd("ctx");
  2118. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  2119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2120. $ctx1.supercall = false;
  2121. //>>excludeEnd("ctx");;
  2122. $recv($recv(aNode)._left())._beAssigned();
  2123. return self;
  2124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2125. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2126. //>>excludeEnd("ctx");
  2127. },
  2128. //>>excludeStart("ide", pragmas.excludeIdeData);
  2129. args: ["aNode"],
  2130. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  2131. referencedClasses: [],
  2132. //>>excludeEnd("ide");
  2133. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  2134. }),
  2135. $globals.SemanticAnalyzer);
  2136. $core.addMethod(
  2137. $core.method({
  2138. selector: "visitBlockNode:",
  2139. protocol: 'visiting',
  2140. fn: function (aNode){
  2141. var self=this;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx1) {
  2144. //>>excludeEnd("ctx");
  2145. self._pushScope_(self._newBlockScope());
  2146. $recv(aNode)._scope_(self["@currentScope"]);
  2147. $recv(self["@currentScope"])._node_(aNode);
  2148. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  2149. $recv($recv(aNode)._parameters())._do_((function(each){
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. return $core.withContext(function($ctx2) {
  2152. //>>excludeEnd("ctx");
  2153. self._validateVariableScope_(each);
  2154. return $recv(self["@currentScope"])._addArg_(each);
  2155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2157. //>>excludeEnd("ctx");
  2158. }));
  2159. (
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. $ctx1.supercall = true,
  2162. //>>excludeEnd("ctx");
  2163. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. $ctx1.supercall = false;
  2166. //>>excludeEnd("ctx");;
  2167. self._popScope();
  2168. return self;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2171. //>>excludeEnd("ctx");
  2172. },
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: ["aNode"],
  2175. source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09currentScope blockIndex: self nextBlockIndex.\x0a\x0a\x09aNode parameters do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  2179. }),
  2180. $globals.SemanticAnalyzer);
  2181. $core.addMethod(
  2182. $core.method({
  2183. selector: "visitCascadeNode:",
  2184. protocol: 'visiting',
  2185. fn: function (aNode){
  2186. var self=this;
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. return $core.withContext(function($ctx1) {
  2189. //>>excludeEnd("ctx");
  2190. var $3,$2,$1;
  2191. (
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. $ctx1.supercall = true,
  2194. //>>excludeEnd("ctx");
  2195. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  2196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2197. $ctx1.supercall = false;
  2198. //>>excludeEnd("ctx");;
  2199. $3=$recv(aNode)._nodes();
  2200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2201. $ctx1.sendIdx["nodes"]=1;
  2202. //>>excludeEnd("ctx");
  2203. $2=$recv($3)._first();
  2204. $1=$recv($2)._superSend();
  2205. if($core.assert($1)){
  2206. $recv($recv(aNode)._nodes())._do_((function(each){
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. return $core.withContext(function($ctx2) {
  2209. //>>excludeEnd("ctx");
  2210. return $recv(each)._superSend_(true);
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2213. //>>excludeEnd("ctx");
  2214. }));
  2215. };
  2216. return self;
  2217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2218. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2219. //>>excludeEnd("ctx");
  2220. },
  2221. //>>excludeStart("ide", pragmas.excludeIdeData);
  2222. args: ["aNode"],
  2223. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  2224. referencedClasses: [],
  2225. //>>excludeEnd("ide");
  2226. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  2227. }),
  2228. $globals.SemanticAnalyzer);
  2229. $core.addMethod(
  2230. $core.method({
  2231. selector: "visitMethodNode:",
  2232. protocol: 'visiting',
  2233. fn: function (aNode){
  2234. var self=this;
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. return $core.withContext(function($ctx1) {
  2237. //>>excludeEnd("ctx");
  2238. var $1;
  2239. self._pushScope_(self._newMethodScope());
  2240. $recv(aNode)._scope_(self["@currentScope"]);
  2241. $recv(self["@currentScope"])._node_(aNode);
  2242. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  2243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2244. return $core.withContext(function($ctx2) {
  2245. //>>excludeEnd("ctx");
  2246. return $recv(self["@currentScope"])._addIVar_(each);
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2249. //>>excludeEnd("ctx");
  2250. }));
  2251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2252. $ctx1.sendIdx["do:"]=1;
  2253. //>>excludeEnd("ctx");
  2254. $recv($recv(aNode)._arguments())._do_((function(each){
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. return $core.withContext(function($ctx2) {
  2257. //>>excludeEnd("ctx");
  2258. self._validateVariableScope_(each);
  2259. return $recv(self["@currentScope"])._addArg_(each);
  2260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2261. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2262. //>>excludeEnd("ctx");
  2263. }));
  2264. (
  2265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2266. $ctx1.supercall = true,
  2267. //>>excludeEnd("ctx");
  2268. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. $ctx1.supercall = false;
  2271. //>>excludeEnd("ctx");;
  2272. $recv(aNode)._classReferences_(self._classReferences());
  2273. $recv(aNode)._sendIndexes_(self._messageSends());
  2274. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  2275. self._popScope();
  2276. return self;
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2279. //>>excludeEnd("ctx");
  2280. },
  2281. //>>excludeStart("ide", pragmas.excludeIdeData);
  2282. args: ["aNode"],
  2283. source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [ :each |\x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode\x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09sendIndexes: self messageSends;\x0a\x09\x09superSends: self superSends keys.\x0a\x09self popScope",
  2284. referencedClasses: [],
  2285. //>>excludeEnd("ide");
  2286. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  2287. }),
  2288. $globals.SemanticAnalyzer);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "visitReturnNode:",
  2292. protocol: 'visiting',
  2293. fn: function (aNode){
  2294. var self=this;
  2295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2296. return $core.withContext(function($ctx1) {
  2297. //>>excludeEnd("ctx");
  2298. var $1;
  2299. $recv(aNode)._scope_(self["@currentScope"]);
  2300. $1=$recv(self["@currentScope"])._isMethodScope();
  2301. if($core.assert($1)){
  2302. $recv(self["@currentScope"])._localReturn_(true);
  2303. } else {
  2304. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  2305. };
  2306. (
  2307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2308. $ctx1.supercall = true,
  2309. //>>excludeEnd("ctx");
  2310. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  2311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2312. $ctx1.supercall = false;
  2313. //>>excludeEnd("ctx");;
  2314. return self;
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2317. //>>excludeEnd("ctx");
  2318. },
  2319. //>>excludeStart("ide", pragmas.excludeIdeData);
  2320. args: ["aNode"],
  2321. source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
  2322. referencedClasses: [],
  2323. //>>excludeEnd("ide");
  2324. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  2325. }),
  2326. $globals.SemanticAnalyzer);
  2327. $core.addMethod(
  2328. $core.method({
  2329. selector: "visitSendNode:",
  2330. protocol: 'visiting',
  2331. fn: function (aNode){
  2332. var self=this;
  2333. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  2334. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  2335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2336. return $core.withContext(function($ctx1) {
  2337. //>>excludeEnd("ctx");
  2338. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  2339. $3=$recv(aNode)._receiver();
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. $ctx1.sendIdx["receiver"]=1;
  2342. //>>excludeEnd("ctx");
  2343. $2=$recv($3)._value();
  2344. $1=$recv($2).__eq("super");
  2345. if($core.assert($1)){
  2346. $recv(aNode)._superSend_(true);
  2347. $4=$recv(aNode)._receiver();
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. $ctx1.sendIdx["receiver"]=2;
  2350. //>>excludeEnd("ctx");
  2351. $recv($4)._value_("self");
  2352. $5=self._superSends();
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. $ctx1.sendIdx["superSends"]=1;
  2355. //>>excludeEnd("ctx");
  2356. $6=$recv(aNode)._selector();
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. $ctx1.sendIdx["selector"]=1;
  2359. //>>excludeEnd("ctx");
  2360. $recv($5)._at_ifAbsentPut_($6,(function(){
  2361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2362. return $core.withContext(function($ctx2) {
  2363. //>>excludeEnd("ctx");
  2364. return $recv($Set())._new();
  2365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2366. $ctx2.sendIdx["new"]=1;
  2367. //>>excludeEnd("ctx");
  2368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2370. //>>excludeEnd("ctx");
  2371. }));
  2372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2373. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  2374. //>>excludeEnd("ctx");
  2375. $8=self._superSends();
  2376. $9=$recv(aNode)._selector();
  2377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2378. $ctx1.sendIdx["selector"]=2;
  2379. //>>excludeEnd("ctx");
  2380. $7=$recv($8)._at_($9);
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. $ctx1.sendIdx["at:"]=1;
  2383. //>>excludeEnd("ctx");
  2384. $recv($7)._add_(aNode);
  2385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2386. $ctx1.sendIdx["add:"]=1;
  2387. //>>excludeEnd("ctx");
  2388. } else {
  2389. $11=$recv($IRSendInliner())._inlinedSelectors();
  2390. $12=$recv(aNode)._selector();
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. $ctx1.sendIdx["selector"]=3;
  2393. //>>excludeEnd("ctx");
  2394. $10=$recv($11)._includes_($12);
  2395. if($core.assert($10)){
  2396. $recv(aNode)._shouldBeInlined_(true);
  2397. $13=$recv(aNode)._receiver();
  2398. if(($receiver = $13) == null || $receiver.isNil){
  2399. $13;
  2400. } else {
  2401. var receiver;
  2402. receiver=$receiver;
  2403. $recv(receiver)._shouldBeAliased_(true);
  2404. };
  2405. };
  2406. };
  2407. $14=self._messageSends();
  2408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2409. $ctx1.sendIdx["messageSends"]=1;
  2410. //>>excludeEnd("ctx");
  2411. $15=$recv(aNode)._selector();
  2412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2413. $ctx1.sendIdx["selector"]=4;
  2414. //>>excludeEnd("ctx");
  2415. $recv($14)._at_ifAbsentPut_($15,(function(){
  2416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2417. return $core.withContext(function($ctx2) {
  2418. //>>excludeEnd("ctx");
  2419. return $recv($Set())._new();
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  2422. //>>excludeEnd("ctx");
  2423. }));
  2424. $17=self._messageSends();
  2425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2426. $ctx1.sendIdx["messageSends"]=2;
  2427. //>>excludeEnd("ctx");
  2428. $18=$recv(aNode)._selector();
  2429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2430. $ctx1.sendIdx["selector"]=5;
  2431. //>>excludeEnd("ctx");
  2432. $16=$recv($17)._at_($18);
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. $ctx1.sendIdx["at:"]=2;
  2435. //>>excludeEnd("ctx");
  2436. $recv($16)._add_(aNode);
  2437. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  2438. (
  2439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2440. $ctx1.supercall = true,
  2441. //>>excludeEnd("ctx");
  2442. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. $ctx1.supercall = false;
  2445. //>>excludeEnd("ctx");;
  2446. return self;
  2447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2448. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2449. //>>excludeEnd("ctx");
  2450. },
  2451. //>>excludeStart("ide", pragmas.excludeIdeData);
  2452. args: ["aNode"],
  2453. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self'.\x0a\x09\x09\x09self superSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09\x09\x09(self superSends at: aNode selector) add: aNode ]\x0a\x09\x09\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  2454. referencedClasses: ["Set", "IRSendInliner"],
  2455. //>>excludeEnd("ide");
  2456. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  2457. }),
  2458. $globals.SemanticAnalyzer);
  2459. $core.addMethod(
  2460. $core.method({
  2461. selector: "visitSequenceNode:",
  2462. protocol: 'visiting',
  2463. fn: function (aNode){
  2464. var self=this;
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. return $core.withContext(function($ctx1) {
  2467. //>>excludeEnd("ctx");
  2468. $recv($recv(aNode)._temps())._do_((function(each){
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. return $core.withContext(function($ctx2) {
  2471. //>>excludeEnd("ctx");
  2472. self._validateVariableScope_(each);
  2473. return $recv(self["@currentScope"])._addTemp_(each);
  2474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2476. //>>excludeEnd("ctx");
  2477. }));
  2478. (
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. $ctx1.supercall = true,
  2481. //>>excludeEnd("ctx");
  2482. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  2483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2484. $ctx1.supercall = false;
  2485. //>>excludeEnd("ctx");;
  2486. return self;
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2489. //>>excludeEnd("ctx");
  2490. },
  2491. //>>excludeStart("ide", pragmas.excludeIdeData);
  2492. args: ["aNode"],
  2493. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  2494. referencedClasses: [],
  2495. //>>excludeEnd("ide");
  2496. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  2497. }),
  2498. $globals.SemanticAnalyzer);
  2499. $core.addMethod(
  2500. $core.method({
  2501. selector: "visitVariableNode:",
  2502. protocol: 'visiting',
  2503. fn: function (aNode){
  2504. var self=this;
  2505. var binding;
  2506. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  2507. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  2508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2509. return $core.withContext(function($ctx1) {
  2510. //>>excludeEnd("ctx");
  2511. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  2512. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  2513. $1=binding;
  2514. if(($receiver = $1) == null || $receiver.isNil){
  2515. $3=$recv(aNode)._value();
  2516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2517. $ctx1.sendIdx["value"]=1;
  2518. //>>excludeEnd("ctx");
  2519. $2=$recv($3)._isCapitalized();
  2520. if($core.assert($2)){
  2521. $4=$recv($ClassRefVar())._new();
  2522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2523. $ctx1.sendIdx["new"]=1;
  2524. //>>excludeEnd("ctx");
  2525. $5=$4;
  2526. $6=$recv(aNode)._value();
  2527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2528. $ctx1.sendIdx["value"]=2;
  2529. //>>excludeEnd("ctx");
  2530. $recv($5)._name_($6);
  2531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2532. $ctx1.sendIdx["name:"]=1;
  2533. //>>excludeEnd("ctx");
  2534. $7=$recv($4)._yourself();
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. $ctx1.sendIdx["yourself"]=1;
  2537. //>>excludeEnd("ctx");
  2538. binding=$7;
  2539. binding;
  2540. $8=self._classReferences();
  2541. $9=$recv(aNode)._value();
  2542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2543. $ctx1.sendIdx["value"]=3;
  2544. //>>excludeEnd("ctx");
  2545. $recv($8)._add_($9);
  2546. } else {
  2547. self._errorUnknownVariable_(aNode);
  2548. $10=$recv($UnknownVar())._new();
  2549. $recv($10)._name_($recv(aNode)._value());
  2550. $11=$recv($10)._yourself();
  2551. binding=$11;
  2552. binding;
  2553. };
  2554. } else {
  2555. $1;
  2556. };
  2557. $recv(aNode)._binding_(binding);
  2558. return self;
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  2561. //>>excludeEnd("ctx");
  2562. },
  2563. //>>excludeStart("ide", pragmas.excludeIdeData);
  2564. args: ["aNode"],
  2565. source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error.\x22\x0a\x0a\x09| binding |\x0a\x09binding := currentScope lookupVariable: aNode.\x0a\x09\x0a\x09binding ifNil: [\x0a\x09\x09aNode value isCapitalized\x0a\x09\x09\x09ifTrue: [ \x22Capital letter variables might be globals.\x22\x0a\x09\x09\x09\x09binding := ClassRefVar new name: aNode value; yourself.\x0a\x09\x09\x09\x09self classReferences add: aNode value]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09\x09\x09binding := UnknownVar new name: aNode value; yourself ] ].\x0a\x09\x09\x0a\x09aNode binding: binding.",
  2566. referencedClasses: ["ClassRefVar", "UnknownVar"],
  2567. //>>excludeEnd("ide");
  2568. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  2569. }),
  2570. $globals.SemanticAnalyzer);
  2571. $core.addMethod(
  2572. $core.method({
  2573. selector: "on:",
  2574. protocol: 'instance creation',
  2575. fn: function (aClass){
  2576. var self=this;
  2577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2578. return $core.withContext(function($ctx1) {
  2579. //>>excludeEnd("ctx");
  2580. var $2,$3,$1;
  2581. $2=self._new();
  2582. $recv($2)._theClass_(aClass);
  2583. $3=$recv($2)._yourself();
  2584. $1=$3;
  2585. return $1;
  2586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2587. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  2588. //>>excludeEnd("ctx");
  2589. },
  2590. //>>excludeStart("ide", pragmas.excludeIdeData);
  2591. args: ["aClass"],
  2592. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  2593. referencedClasses: [],
  2594. //>>excludeEnd("ide");
  2595. messageSends: ["theClass:", "new", "yourself"]
  2596. }),
  2597. $globals.SemanticAnalyzer.klass);
  2598. });