comparison compiler.js @ 62:f57b2f4048d0

Fix funcall.populateSymbols to use the fixed up name when doing the initial symbol.find. This ensures the parent tree is properly produced
author Mike Pavone <pavone@retrodev.com>
date Sat, 14 Jul 2012 04:19:29 -0700
parents ef3b34c2c0a4
children 25b697c91629
comparison
equal deleted inserted replaced
61:a6addd8c6bd4 62:f57b2f4048d0
304 } else { 304 } else {
305 throw new Error("Unexpected AST type for foreign:"); 305 throw new Error("Unexpected AST type for foreign:");
306 } 306 }
307 } 307 }
308 this.symbols = symbols; 308 this.symbols = symbols;
309 var name = this.name[this.name.length-1] == ':' ? this.name.substr(0, this.name.length-1) : this.name;
310 symbols.find(name)
309 for (var i in this.args) { 311 for (var i in this.args) {
310 this.args[i].populateSymbols(symbols); 312 this.args[i].populateSymbols(symbols);
311 } 313 }
312 if (this.receiver) { 314 if (this.receiver) {
313 this.receiver.populateSymbols(symbols); 315 this.receiver.populateSymbols(symbols);
342 } 344 }
343 this.symbols = symbols; 345 this.symbols = symbols;
344 }; 346 };
345 347
346 assignment.prototype.populateSymbols = function(symbols) { 348 assignment.prototype.populateSymbols = function(symbols) {
349 debugprint('//assignment', this.symbol.name, 'populateSymbols');
347 var existing = symbols.find(this.symbol.name); 350 var existing = symbols.find(this.symbol.name);
348 if (!existing) { 351 if (!existing) {
349 symbols.defineVar(this.symbol.name, this.expression); 352 symbols.defineVar(this.symbol.name, this.expression);
350 } 353 }
351 this.symbol.populateSymbols(symbols); 354 this.symbol.populateSymbols(symbols);
352 this.expression.populateSymbols(symbols); 355 this.expression.populateSymbols(symbols);
353 this.symbols = symbols; 356 this.symbols = symbols;
354 }; 357 };
355 assignment.prototype.populateSymbolsObject = function(symbols) { 358 assignment.prototype.populateSymbolsObject = function(symbols) {
359 debugprint('//messagedef', this.symbol.name, 'populateSymbols');
356 if (this.expression instanceof lambda || (this.expression instanceof funcall & this.expression.name == 'foreign:')) { 360 if (this.expression instanceof lambda || (this.expression instanceof funcall & this.expression.name == 'foreign:')) {
357 symbols.defineMsg(this.symbol.name, this.expression); 361 symbols.defineMsg(this.symbol.name, this.expression);
358 } else { 362 } else {
359 symbols.defineMsg(this.symbol.name, new getter(null)); 363 symbols.defineMsg(this.symbol.name, new getter(null));
360 symbols.defineMsg(this.symbol.name + '!', new setter(null)); 364 symbols.defineMsg(this.symbol.name + '!', new setter(null));