Compiler-Semantic.js 82 KB

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