Compiler-Semantic.js 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708
  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', '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._isVariableGloballyUndefined_(identifier);
  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 isVariableGloballyUndefined: identifier ])\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", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  1749. }),
  1750. $globals.SemanticAnalyzer);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "isVariableGloballyUndefined:",
  1754. protocol: 'testing',
  1755. fn: function (aString){
  1756. var self=this;
  1757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1758. return $core.withContext(function($ctx1) {
  1759. //>>excludeEnd("ctx");
  1760. return eval('typeof ' + aString + ' == "undefined"');
  1761. return self;
  1762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1763. }, function($ctx1) {$ctx1.fill(self,"isVariableGloballyUndefined:",{aString:aString},$globals.SemanticAnalyzer)});
  1764. //>>excludeEnd("ctx");
  1765. },
  1766. //>>excludeStart("ide", pragmas.excludeIdeData);
  1767. args: ["aString"],
  1768. source: "isVariableGloballyUndefined: aString\x0a\x09<return eval('typeof ' + aString + ' == \x22undefined\x22')>",
  1769. referencedClasses: [],
  1770. //>>excludeEnd("ide");
  1771. messageSends: []
  1772. }),
  1773. $globals.SemanticAnalyzer);
  1774. $core.addMethod(
  1775. $core.method({
  1776. selector: "messageSends",
  1777. protocol: 'accessing',
  1778. fn: function (){
  1779. var self=this;
  1780. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. return $core.withContext(function($ctx1) {
  1783. //>>excludeEnd("ctx");
  1784. var $2,$1,$receiver;
  1785. $2=self["@messageSends"];
  1786. if(($receiver = $2) == null || $receiver.isNil){
  1787. self["@messageSends"]=$recv($Dictionary())._new();
  1788. $1=self["@messageSends"];
  1789. } else {
  1790. $1=$2;
  1791. };
  1792. return $1;
  1793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1794. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  1795. //>>excludeEnd("ctx");
  1796. },
  1797. //>>excludeStart("ide", pragmas.excludeIdeData);
  1798. args: [],
  1799. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  1800. referencedClasses: ["Dictionary"],
  1801. //>>excludeEnd("ide");
  1802. messageSends: ["ifNil:", "new"]
  1803. }),
  1804. $globals.SemanticAnalyzer);
  1805. $core.addMethod(
  1806. $core.method({
  1807. selector: "newBlockScope",
  1808. protocol: 'factory',
  1809. fn: function (){
  1810. var self=this;
  1811. function $LexicalScope(){return $globals.LexicalScope||(typeof LexicalScope=="undefined"?nil:LexicalScope)}
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. return $core.withContext(function($ctx1) {
  1814. //>>excludeEnd("ctx");
  1815. var $1;
  1816. $1=self._newScopeOfClass_($LexicalScope());
  1817. return $1;
  1818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1819. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  1820. //>>excludeEnd("ctx");
  1821. },
  1822. //>>excludeStart("ide", pragmas.excludeIdeData);
  1823. args: [],
  1824. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  1825. referencedClasses: ["LexicalScope"],
  1826. //>>excludeEnd("ide");
  1827. messageSends: ["newScopeOfClass:"]
  1828. }),
  1829. $globals.SemanticAnalyzer);
  1830. $core.addMethod(
  1831. $core.method({
  1832. selector: "newMethodScope",
  1833. protocol: 'factory',
  1834. fn: function (){
  1835. var self=this;
  1836. function $MethodLexicalScope(){return $globals.MethodLexicalScope||(typeof MethodLexicalScope=="undefined"?nil:MethodLexicalScope)}
  1837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1838. return $core.withContext(function($ctx1) {
  1839. //>>excludeEnd("ctx");
  1840. var $1;
  1841. $1=self._newScopeOfClass_($MethodLexicalScope());
  1842. return $1;
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  1845. //>>excludeEnd("ctx");
  1846. },
  1847. //>>excludeStart("ide", pragmas.excludeIdeData);
  1848. args: [],
  1849. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  1850. referencedClasses: ["MethodLexicalScope"],
  1851. //>>excludeEnd("ide");
  1852. messageSends: ["newScopeOfClass:"]
  1853. }),
  1854. $globals.SemanticAnalyzer);
  1855. $core.addMethod(
  1856. $core.method({
  1857. selector: "newScopeOfClass:",
  1858. protocol: 'factory',
  1859. fn: function (aLexicalScopeClass){
  1860. var self=this;
  1861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1862. return $core.withContext(function($ctx1) {
  1863. //>>excludeEnd("ctx");
  1864. var $2,$3,$1;
  1865. $2=$recv(aLexicalScopeClass)._new();
  1866. $recv($2)._outerScope_(self["@currentScope"]);
  1867. $3=$recv($2)._yourself();
  1868. $1=$3;
  1869. return $1;
  1870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1871. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  1872. //>>excludeEnd("ctx");
  1873. },
  1874. //>>excludeStart("ide", pragmas.excludeIdeData);
  1875. args: ["aLexicalScopeClass"],
  1876. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  1877. referencedClasses: [],
  1878. //>>excludeEnd("ide");
  1879. messageSends: ["outerScope:", "new", "yourself"]
  1880. }),
  1881. $globals.SemanticAnalyzer);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "nextBlockIndex",
  1885. protocol: 'private',
  1886. fn: function (){
  1887. var self=this;
  1888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1889. return $core.withContext(function($ctx1) {
  1890. //>>excludeEnd("ctx");
  1891. var $1,$2,$receiver;
  1892. $1=self["@blockIndex"];
  1893. if(($receiver = $1) == null || $receiver.isNil){
  1894. self["@blockIndex"]=(0);
  1895. self["@blockIndex"];
  1896. } else {
  1897. $1;
  1898. };
  1899. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  1900. $2=self["@blockIndex"];
  1901. return $2;
  1902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1903. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  1904. //>>excludeEnd("ctx");
  1905. },
  1906. //>>excludeStart("ide", pragmas.excludeIdeData);
  1907. args: [],
  1908. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  1909. referencedClasses: [],
  1910. //>>excludeEnd("ide");
  1911. messageSends: ["ifNil:", "+"]
  1912. }),
  1913. $globals.SemanticAnalyzer);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "popScope",
  1917. protocol: 'scope',
  1918. fn: function (){
  1919. var self=this;
  1920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1921. return $core.withContext(function($ctx1) {
  1922. //>>excludeEnd("ctx");
  1923. var $1,$receiver;
  1924. $1=self["@currentScope"];
  1925. if(($receiver = $1) == null || $receiver.isNil){
  1926. $1;
  1927. } else {
  1928. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  1929. self["@currentScope"];
  1930. };
  1931. return self;
  1932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1933. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  1934. //>>excludeEnd("ctx");
  1935. },
  1936. //>>excludeStart("ide", pragmas.excludeIdeData);
  1937. args: [],
  1938. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  1939. referencedClasses: [],
  1940. //>>excludeEnd("ide");
  1941. messageSends: ["ifNotNil:", "outerScope"]
  1942. }),
  1943. $globals.SemanticAnalyzer);
  1944. $core.addMethod(
  1945. $core.method({
  1946. selector: "pushScope:",
  1947. protocol: 'scope',
  1948. fn: function (aScope){
  1949. var self=this;
  1950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1951. return $core.withContext(function($ctx1) {
  1952. //>>excludeEnd("ctx");
  1953. $recv(aScope)._outerScope_(self["@currentScope"]);
  1954. self["@currentScope"]=aScope;
  1955. return self;
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  1958. //>>excludeEnd("ctx");
  1959. },
  1960. //>>excludeStart("ide", pragmas.excludeIdeData);
  1961. args: ["aScope"],
  1962. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  1963. referencedClasses: [],
  1964. //>>excludeEnd("ide");
  1965. messageSends: ["outerScope:"]
  1966. }),
  1967. $globals.SemanticAnalyzer);
  1968. $core.addMethod(
  1969. $core.method({
  1970. selector: "superSends",
  1971. protocol: 'accessing',
  1972. fn: function (){
  1973. var self=this;
  1974. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. return $core.withContext(function($ctx1) {
  1977. //>>excludeEnd("ctx");
  1978. var $2,$1,$receiver;
  1979. $2=self["@superSends"];
  1980. if(($receiver = $2) == null || $receiver.isNil){
  1981. self["@superSends"]=$recv($Dictionary())._new();
  1982. $1=self["@superSends"];
  1983. } else {
  1984. $1=$2;
  1985. };
  1986. return $1;
  1987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1988. }, function($ctx1) {$ctx1.fill(self,"superSends",{},$globals.SemanticAnalyzer)});
  1989. //>>excludeEnd("ctx");
  1990. },
  1991. //>>excludeStart("ide", pragmas.excludeIdeData);
  1992. args: [],
  1993. source: "superSends\x0a\x09^ superSends ifNil: [ superSends := Dictionary new ]",
  1994. referencedClasses: ["Dictionary"],
  1995. //>>excludeEnd("ide");
  1996. messageSends: ["ifNil:", "new"]
  1997. }),
  1998. $globals.SemanticAnalyzer);
  1999. $core.addMethod(
  2000. $core.method({
  2001. selector: "theClass",
  2002. protocol: 'accessing',
  2003. fn: function (){
  2004. var self=this;
  2005. var $1;
  2006. $1=self["@theClass"];
  2007. return $1;
  2008. },
  2009. //>>excludeStart("ide", pragmas.excludeIdeData);
  2010. args: [],
  2011. source: "theClass\x0a\x09^ theClass",
  2012. referencedClasses: [],
  2013. //>>excludeEnd("ide");
  2014. messageSends: []
  2015. }),
  2016. $globals.SemanticAnalyzer);
  2017. $core.addMethod(
  2018. $core.method({
  2019. selector: "theClass:",
  2020. protocol: 'accessing',
  2021. fn: function (aClass){
  2022. var self=this;
  2023. self["@theClass"]=aClass;
  2024. return self;
  2025. },
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["aClass"],
  2028. source: "theClass: aClass\x0a\x09theClass := aClass",
  2029. referencedClasses: [],
  2030. //>>excludeEnd("ide");
  2031. messageSends: []
  2032. }),
  2033. $globals.SemanticAnalyzer);
  2034. $core.addMethod(
  2035. $core.method({
  2036. selector: "validateVariableScope:",
  2037. protocol: 'scope',
  2038. fn: function (aString){
  2039. var self=this;
  2040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2041. return $core.withContext(function($ctx1) {
  2042. //>>excludeEnd("ctx");
  2043. var $1,$receiver;
  2044. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  2045. if(($receiver = $1) == null || $receiver.isNil){
  2046. $1;
  2047. } else {
  2048. self._errorShadowingVariable_(aString);
  2049. };
  2050. return self;
  2051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2052. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  2053. //>>excludeEnd("ctx");
  2054. },
  2055. //>>excludeStart("ide", pragmas.excludeIdeData);
  2056. args: ["aString"],
  2057. 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 ]",
  2058. referencedClasses: [],
  2059. //>>excludeEnd("ide");
  2060. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  2061. }),
  2062. $globals.SemanticAnalyzer);
  2063. $core.addMethod(
  2064. $core.method({
  2065. selector: "visitAssignmentNode:",
  2066. protocol: 'visiting',
  2067. fn: function (aNode){
  2068. var self=this;
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. return $core.withContext(function($ctx1) {
  2071. //>>excludeEnd("ctx");
  2072. (
  2073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2074. $ctx1.supercall = true,
  2075. //>>excludeEnd("ctx");
  2076. $globals.SemanticAnalyzer.superclass.fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. $ctx1.supercall = false;
  2079. //>>excludeEnd("ctx");;
  2080. $recv($recv(aNode)._left())._beAssigned();
  2081. return self;
  2082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2083. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2084. //>>excludeEnd("ctx");
  2085. },
  2086. //>>excludeStart("ide", pragmas.excludeIdeData);
  2087. args: ["aNode"],
  2088. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  2089. referencedClasses: [],
  2090. //>>excludeEnd("ide");
  2091. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  2092. }),
  2093. $globals.SemanticAnalyzer);
  2094. $core.addMethod(
  2095. $core.method({
  2096. selector: "visitBlockNode:",
  2097. protocol: 'visiting',
  2098. fn: function (aNode){
  2099. var self=this;
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. return $core.withContext(function($ctx1) {
  2102. //>>excludeEnd("ctx");
  2103. self._pushScope_(self._newBlockScope());
  2104. $recv(aNode)._scope_(self["@currentScope"]);
  2105. $recv(self["@currentScope"])._node_(aNode);
  2106. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  2107. $recv($recv(aNode)._parameters())._do_((function(each){
  2108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2109. return $core.withContext(function($ctx2) {
  2110. //>>excludeEnd("ctx");
  2111. self._validateVariableScope_(each);
  2112. return $recv(self["@currentScope"])._addArg_(each);
  2113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2115. //>>excludeEnd("ctx");
  2116. }));
  2117. (
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. $ctx1.supercall = true,
  2120. //>>excludeEnd("ctx");
  2121. $globals.SemanticAnalyzer.superclass.fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. $ctx1.supercall = false;
  2124. //>>excludeEnd("ctx");;
  2125. self._popScope();
  2126. return self;
  2127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2128. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2129. //>>excludeEnd("ctx");
  2130. },
  2131. //>>excludeStart("ide", pragmas.excludeIdeData);
  2132. args: ["aNode"],
  2133. 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",
  2134. referencedClasses: [],
  2135. //>>excludeEnd("ide");
  2136. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  2137. }),
  2138. $globals.SemanticAnalyzer);
  2139. $core.addMethod(
  2140. $core.method({
  2141. selector: "visitCascadeNode:",
  2142. protocol: 'visiting',
  2143. fn: function (aNode){
  2144. var self=this;
  2145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2146. return $core.withContext(function($ctx1) {
  2147. //>>excludeEnd("ctx");
  2148. var $3,$2,$1;
  2149. (
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. $ctx1.supercall = true,
  2152. //>>excludeEnd("ctx");
  2153. $globals.SemanticAnalyzer.superclass.fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  2154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2155. $ctx1.supercall = false;
  2156. //>>excludeEnd("ctx");;
  2157. $3=$recv(aNode)._nodes();
  2158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2159. $ctx1.sendIdx["nodes"]=1;
  2160. //>>excludeEnd("ctx");
  2161. $2=$recv($3)._first();
  2162. $1=$recv($2)._superSend();
  2163. if($core.assert($1)){
  2164. $recv($recv(aNode)._nodes())._do_((function(each){
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. return $core.withContext(function($ctx2) {
  2167. //>>excludeEnd("ctx");
  2168. return $recv(each)._superSend_(true);
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2171. //>>excludeEnd("ctx");
  2172. }));
  2173. };
  2174. return self;
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2177. //>>excludeEnd("ctx");
  2178. },
  2179. //>>excludeStart("ide", pragmas.excludeIdeData);
  2180. args: ["aNode"],
  2181. source: "visitCascadeNode: aNode\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ] ]",
  2182. referencedClasses: [],
  2183. //>>excludeEnd("ide");
  2184. messageSends: ["visitCascadeNode:", "ifTrue:", "superSend", "first", "nodes", "do:", "superSend:"]
  2185. }),
  2186. $globals.SemanticAnalyzer);
  2187. $core.addMethod(
  2188. $core.method({
  2189. selector: "visitMethodNode:",
  2190. protocol: 'visiting',
  2191. fn: function (aNode){
  2192. var self=this;
  2193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2194. return $core.withContext(function($ctx1) {
  2195. //>>excludeEnd("ctx");
  2196. var $1;
  2197. self._pushScope_(self._newMethodScope());
  2198. $recv(aNode)._scope_(self["@currentScope"]);
  2199. $recv(self["@currentScope"])._node_(aNode);
  2200. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  2201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2202. return $core.withContext(function($ctx2) {
  2203. //>>excludeEnd("ctx");
  2204. return $recv(self["@currentScope"])._addIVar_(each);
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2207. //>>excludeEnd("ctx");
  2208. }));
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. $ctx1.sendIdx["do:"]=1;
  2211. //>>excludeEnd("ctx");
  2212. $recv($recv(aNode)._arguments())._do_((function(each){
  2213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2214. return $core.withContext(function($ctx2) {
  2215. //>>excludeEnd("ctx");
  2216. self._validateVariableScope_(each);
  2217. return $recv(self["@currentScope"])._addArg_(each);
  2218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2220. //>>excludeEnd("ctx");
  2221. }));
  2222. (
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. $ctx1.supercall = true,
  2225. //>>excludeEnd("ctx");
  2226. $globals.SemanticAnalyzer.superclass.fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. $ctx1.supercall = false;
  2229. //>>excludeEnd("ctx");;
  2230. $recv(aNode)._classReferences_(self._classReferences());
  2231. $recv(aNode)._sendIndexes_(self._messageSends());
  2232. $1=$recv(aNode)._superSends_($recv(self._superSends())._keys());
  2233. self._popScope();
  2234. return self;
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2237. //>>excludeEnd("ctx");
  2238. },
  2239. //>>excludeStart("ide", pragmas.excludeIdeData);
  2240. args: ["aNode"],
  2241. 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",
  2242. referencedClasses: [],
  2243. //>>excludeEnd("ide");
  2244. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "superSends:", "keys", "superSends", "popScope"]
  2245. }),
  2246. $globals.SemanticAnalyzer);
  2247. $core.addMethod(
  2248. $core.method({
  2249. selector: "visitReturnNode:",
  2250. protocol: 'visiting',
  2251. fn: function (aNode){
  2252. var self=this;
  2253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2254. return $core.withContext(function($ctx1) {
  2255. //>>excludeEnd("ctx");
  2256. var $1;
  2257. $recv(aNode)._scope_(self["@currentScope"]);
  2258. $1=$recv(self["@currentScope"])._isMethodScope();
  2259. if($core.assert($1)){
  2260. $recv(self["@currentScope"])._localReturn_(true);
  2261. } else {
  2262. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  2263. };
  2264. (
  2265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2266. $ctx1.supercall = true,
  2267. //>>excludeEnd("ctx");
  2268. $globals.SemanticAnalyzer.superclass.fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. $ctx1.supercall = false;
  2271. //>>excludeEnd("ctx");;
  2272. return self;
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2275. //>>excludeEnd("ctx");
  2276. },
  2277. //>>excludeStart("ide", pragmas.excludeIdeData);
  2278. args: ["aNode"],
  2279. 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",
  2280. referencedClasses: [],
  2281. //>>excludeEnd("ide");
  2282. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  2283. }),
  2284. $globals.SemanticAnalyzer);
  2285. $core.addMethod(
  2286. $core.method({
  2287. selector: "visitSendNode:",
  2288. protocol: 'visiting',
  2289. fn: function (aNode){
  2290. var self=this;
  2291. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  2292. function $IRSendInliner(){return $globals.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  2293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2294. return $core.withContext(function($ctx1) {
  2295. //>>excludeEnd("ctx");
  2296. var $3,$2,$1,$4,$5,$6,$8,$9,$7,$11,$12,$10,$13,$14,$15,$17,$18,$16,$receiver;
  2297. $3=$recv(aNode)._receiver();
  2298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2299. $ctx1.sendIdx["receiver"]=1;
  2300. //>>excludeEnd("ctx");
  2301. $2=$recv($3)._value();
  2302. $1=$recv($2).__eq("super");
  2303. if($core.assert($1)){
  2304. $recv(aNode)._superSend_(true);
  2305. $4=$recv(aNode)._receiver();
  2306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2307. $ctx1.sendIdx["receiver"]=2;
  2308. //>>excludeEnd("ctx");
  2309. $recv($4)._value_("self");
  2310. $5=self._superSends();
  2311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2312. $ctx1.sendIdx["superSends"]=1;
  2313. //>>excludeEnd("ctx");
  2314. $6=$recv(aNode)._selector();
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. $ctx1.sendIdx["selector"]=1;
  2317. //>>excludeEnd("ctx");
  2318. $recv($5)._at_ifAbsentPut_($6,(function(){
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. return $core.withContext(function($ctx2) {
  2321. //>>excludeEnd("ctx");
  2322. return $recv($Set())._new();
  2323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2324. $ctx2.sendIdx["new"]=1;
  2325. //>>excludeEnd("ctx");
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2328. //>>excludeEnd("ctx");
  2329. }));
  2330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2331. $ctx1.sendIdx["at:ifAbsentPut:"]=1;
  2332. //>>excludeEnd("ctx");
  2333. $8=self._superSends();
  2334. $9=$recv(aNode)._selector();
  2335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2336. $ctx1.sendIdx["selector"]=2;
  2337. //>>excludeEnd("ctx");
  2338. $7=$recv($8)._at_($9);
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. $ctx1.sendIdx["at:"]=1;
  2341. //>>excludeEnd("ctx");
  2342. $recv($7)._add_(aNode);
  2343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2344. $ctx1.sendIdx["add:"]=1;
  2345. //>>excludeEnd("ctx");
  2346. } else {
  2347. $11=$recv($IRSendInliner())._inlinedSelectors();
  2348. $12=$recv(aNode)._selector();
  2349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2350. $ctx1.sendIdx["selector"]=3;
  2351. //>>excludeEnd("ctx");
  2352. $10=$recv($11)._includes_($12);
  2353. if($core.assert($10)){
  2354. $recv(aNode)._shouldBeInlined_(true);
  2355. $13=$recv(aNode)._receiver();
  2356. if(($receiver = $13) == null || $receiver.isNil){
  2357. $13;
  2358. } else {
  2359. var receiver;
  2360. receiver=$receiver;
  2361. $recv(receiver)._shouldBeAliased_(true);
  2362. };
  2363. };
  2364. };
  2365. $14=self._messageSends();
  2366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2367. $ctx1.sendIdx["messageSends"]=1;
  2368. //>>excludeEnd("ctx");
  2369. $15=$recv(aNode)._selector();
  2370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2371. $ctx1.sendIdx["selector"]=4;
  2372. //>>excludeEnd("ctx");
  2373. $recv($14)._at_ifAbsentPut_($15,(function(){
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. return $core.withContext(function($ctx2) {
  2376. //>>excludeEnd("ctx");
  2377. return $recv($Set())._new();
  2378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  2380. //>>excludeEnd("ctx");
  2381. }));
  2382. $17=self._messageSends();
  2383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2384. $ctx1.sendIdx["messageSends"]=2;
  2385. //>>excludeEnd("ctx");
  2386. $18=$recv(aNode)._selector();
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. $ctx1.sendIdx["selector"]=5;
  2389. //>>excludeEnd("ctx");
  2390. $16=$recv($17)._at_($18);
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. $ctx1.sendIdx["at:"]=2;
  2393. //>>excludeEnd("ctx");
  2394. $recv($16)._add_(aNode);
  2395. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  2396. (
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. $ctx1.supercall = true,
  2399. //>>excludeEnd("ctx");
  2400. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  2401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2402. $ctx1.supercall = false;
  2403. //>>excludeEnd("ctx");;
  2404. return self;
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2407. //>>excludeEnd("ctx");
  2408. },
  2409. //>>excludeStart("ide", pragmas.excludeIdeData);
  2410. args: ["aNode"],
  2411. 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",
  2412. referencedClasses: ["Set", "IRSendInliner"],
  2413. //>>excludeEnd("ide");
  2414. messageSends: ["ifTrue:ifFalse:", "=", "value", "receiver", "superSend:", "value:", "at:ifAbsentPut:", "superSends", "selector", "new", "add:", "at:", "ifTrue:", "includes:", "inlinedSelectors", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "messageSends", "index:", "size", "visitSendNode:"]
  2415. }),
  2416. $globals.SemanticAnalyzer);
  2417. $core.addMethod(
  2418. $core.method({
  2419. selector: "visitSequenceNode:",
  2420. protocol: 'visiting',
  2421. fn: function (aNode){
  2422. var self=this;
  2423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2424. return $core.withContext(function($ctx1) {
  2425. //>>excludeEnd("ctx");
  2426. $recv($recv(aNode)._temps())._do_((function(each){
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. return $core.withContext(function($ctx2) {
  2429. //>>excludeEnd("ctx");
  2430. self._validateVariableScope_(each);
  2431. return $recv(self["@currentScope"])._addTemp_(each);
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2434. //>>excludeEnd("ctx");
  2435. }));
  2436. (
  2437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2438. $ctx1.supercall = true,
  2439. //>>excludeEnd("ctx");
  2440. $globals.SemanticAnalyzer.superclass.fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  2441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2442. $ctx1.supercall = false;
  2443. //>>excludeEnd("ctx");;
  2444. return self;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  2447. //>>excludeEnd("ctx");
  2448. },
  2449. //>>excludeStart("ide", pragmas.excludeIdeData);
  2450. args: ["aNode"],
  2451. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  2452. referencedClasses: [],
  2453. //>>excludeEnd("ide");
  2454. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  2455. }),
  2456. $globals.SemanticAnalyzer);
  2457. $core.addMethod(
  2458. $core.method({
  2459. selector: "visitVariableNode:",
  2460. protocol: 'visiting',
  2461. fn: function (aNode){
  2462. var self=this;
  2463. var binding;
  2464. function $ClassRefVar(){return $globals.ClassRefVar||(typeof ClassRefVar=="undefined"?nil:ClassRefVar)}
  2465. function $UnknownVar(){return $globals.UnknownVar||(typeof UnknownVar=="undefined"?nil:UnknownVar)}
  2466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2467. return $core.withContext(function($ctx1) {
  2468. //>>excludeEnd("ctx");
  2469. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$10,$11,$receiver;
  2470. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  2471. $1=binding;
  2472. if(($receiver = $1) == null || $receiver.isNil){
  2473. $3=$recv(aNode)._value();
  2474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2475. $ctx1.sendIdx["value"]=1;
  2476. //>>excludeEnd("ctx");
  2477. $2=$recv($3)._isCapitalized();
  2478. if($core.assert($2)){
  2479. $4=$recv($ClassRefVar())._new();
  2480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2481. $ctx1.sendIdx["new"]=1;
  2482. //>>excludeEnd("ctx");
  2483. $5=$4;
  2484. $6=$recv(aNode)._value();
  2485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2486. $ctx1.sendIdx["value"]=2;
  2487. //>>excludeEnd("ctx");
  2488. $recv($5)._name_($6);
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. $ctx1.sendIdx["name:"]=1;
  2491. //>>excludeEnd("ctx");
  2492. $7=$recv($4)._yourself();
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. $ctx1.sendIdx["yourself"]=1;
  2495. //>>excludeEnd("ctx");
  2496. binding=$7;
  2497. binding;
  2498. $8=self._classReferences();
  2499. $9=$recv(aNode)._value();
  2500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2501. $ctx1.sendIdx["value"]=3;
  2502. //>>excludeEnd("ctx");
  2503. $recv($8)._add_($9);
  2504. } else {
  2505. self._errorUnknownVariable_(aNode);
  2506. $10=$recv($UnknownVar())._new();
  2507. $recv($10)._name_($recv(aNode)._value());
  2508. $11=$recv($10)._yourself();
  2509. binding=$11;
  2510. binding;
  2511. };
  2512. } else {
  2513. $1;
  2514. };
  2515. $recv(aNode)._binding_(binding);
  2516. return self;
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  2519. //>>excludeEnd("ctx");
  2520. },
  2521. //>>excludeStart("ide", pragmas.excludeIdeData);
  2522. args: ["aNode"],
  2523. 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.",
  2524. referencedClasses: ["ClassRefVar", "UnknownVar"],
  2525. //>>excludeEnd("ide");
  2526. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  2527. }),
  2528. $globals.SemanticAnalyzer);
  2529. $core.addMethod(
  2530. $core.method({
  2531. selector: "on:",
  2532. protocol: 'instance creation',
  2533. fn: function (aClass){
  2534. var self=this;
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. return $core.withContext(function($ctx1) {
  2537. //>>excludeEnd("ctx");
  2538. var $2,$3,$1;
  2539. $2=self._new();
  2540. $recv($2)._theClass_(aClass);
  2541. $3=$recv($2)._yourself();
  2542. $1=$3;
  2543. return $1;
  2544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2545. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  2546. //>>excludeEnd("ctx");
  2547. },
  2548. //>>excludeStart("ide", pragmas.excludeIdeData);
  2549. args: ["aClass"],
  2550. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  2551. referencedClasses: [],
  2552. //>>excludeEnd("ide");
  2553. messageSends: ["theClass:", "new", "yourself"]
  2554. }),
  2555. $globals.SemanticAnalyzer.klass);
  2556. });