Mercurial > repos > tabletprog
comparison compiler.js @ 156:d6e79885bd3b
Fix compiler bug involving referencing a self method in a method defined before the referenced method
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 10 Aug 2013 14:50:38 -0700 |
parents | d715fb3c39ab |
children | 869399ff7faa |
comparison
equal
deleted
inserted
replaced
155:9de2572a34a7 | 156:d6e79885bd3b |
---|---|
228 type: 'foreign', | 228 type: 'foreign', |
229 def: this.names[name] | 229 def: this.names[name] |
230 }; | 230 }; |
231 } else { | 231 } else { |
232 if (nestedcall) { | 232 if (nestedcall) { |
233 this.closedover[name] = true; | 233 if (!(name in this.closedover)) { |
234 this.passthruenv = false; | 234 debugprint('//' + name + ' is now closed over'); |
235 } | 235 this.closedover[name] = true; |
236 this.passthruenv = false; | |
237 } | |
238 } | |
236 if (name in this.closedover) { | 239 if (name in this.closedover) { |
237 var ret = { | 240 var ret = { |
238 type: 'closedover', | 241 type: 'closedover', |
239 def: this.names[name] | 242 def: this.names[name] |
240 }; | 243 }; |
412 if (this.receiver) { | 415 if (this.receiver) { |
413 this.receiver.populateSymbols(symbols, undefined, isll); | 416 this.receiver.populateSymbols(symbols, undefined, isll); |
414 } | 417 } |
415 } | 418 } |
416 | 419 |
420 funcall.prototype.predefSymbolsObject = function(symbols) { | |
421 }; | |
422 | |
417 funcall.prototype.populateSymbolsObject = function(symbols) { | 423 funcall.prototype.populateSymbolsObject = function(symbols) { |
418 this.populateSymbols(symbols); | 424 this.populateSymbols(symbols); |
419 } | 425 }; |
420 | 426 |
421 object.prototype.populateSymbols = function(symbols) { | 427 object.prototype.populateSymbols = function(symbols) { |
422 var symbols = new osymbols(symbols); | 428 var symbols = new osymbols(symbols); |
429 for (var i in this.messages) { | |
430 this.messages[i].predefSymbolsObject(symbols); | |
431 } | |
423 for (var i in this.messages) { | 432 for (var i in this.messages) { |
424 this.messages[i].populateSymbolsObject(symbols); | 433 this.messages[i].populateSymbolsObject(symbols); |
425 } | 434 } |
426 this.symbols = symbols; | 435 this.symbols = symbols; |
427 } | 436 } |
454 } | 463 } |
455 this.symbol.populateSymbols(symbols); | 464 this.symbol.populateSymbols(symbols); |
456 this.expression.populateSymbols(symbols); | 465 this.expression.populateSymbols(symbols); |
457 this.symbols = symbols; | 466 this.symbols = symbols; |
458 }; | 467 }; |
468 assignment.prototype.predefSymbolsObject = function(symbols) { | |
469 debugprint('//messagedef', this.symbol.name, 'predefSymbolsObject'); | |
470 if (this.expression instanceof lambda || (this.expression instanceof funcall & this.expression.name == 'foreign:')) { | |
471 symbols.defineMsg(this.symbol.name, this.expression); | |
472 } else { | |
473 symbols.defineMsg(this.symbol.name, new getter(null)); | |
474 symbols.defineMsg(this.symbol.name + '!', new setter(null)); | |
475 } | |
476 }; | |
459 assignment.prototype.populateSymbolsObject = function(symbols) { | 477 assignment.prototype.populateSymbolsObject = function(symbols) { |
460 debugprint('//messagedef', this.symbol.name, 'populateSymbols'); | 478 debugprint('//messagedef', this.symbol.name, 'populateSymbols'); |
461 if (this.expression instanceof lambda || (this.expression instanceof funcall & this.expression.name == 'foreign:')) { | |
462 symbols.defineMsg(this.symbol.name, this.expression); | |
463 } else { | |
464 symbols.defineMsg(this.symbol.name, new getter(null)); | |
465 symbols.defineMsg(this.symbol.name + '!', new setter(null)); | |
466 } | |
467 this.symbol.populateSymbols(symbols); | 479 this.symbol.populateSymbols(symbols); |
468 this.expression.populateSymbols(symbols, true); | 480 this.expression.populateSymbols(symbols, true); |
469 this.symbols = symbols; | 481 this.symbols = symbols; |
470 }; | 482 }; |
471 | 483 |