comparison compiler.js @ 59:0fd06e077afe

Fix object parent
author Mike Pavone <pavone@retrodev.com>
date Sat, 14 Jul 2012 01:39:43 -0700
parents 08ae75d90dc2
children ef3b34c2c0a4
comparison
equal deleted inserted replaced
58:7b454d100dc8 59:0fd06e077afe
65 { 65 {
66 this.parent = parent; 66 this.parent = parent;
67 this.names = {}; 67 this.names = {};
68 this.needsenv = false; 68 this.needsenv = false;
69 this.typename = null; 69 this.typename = null;
70 this.needsparent = false;
70 } 71 }
71 osymbols.prototype.find = function(name, nestedcall) { 72 osymbols.prototype.find = function(name, nestedcall) {
72 debugprint('//osymbols.find', name + ', exists?:', name in this.names, ', nested?:', nestedcall); 73 debugprint('//osymbols.find', name + ', exists?:', name in this.names, ', nested?:', nestedcall);
73 if (name in this.names) { 74 if (name in this.names) {
74 if (this.names[name] instanceof funcall && this.names[name].name == 'foreign:') { 75 if (this.names[name] instanceof funcall && this.names[name].name == 'foreign:') {
86 var ret = this.parent.find(name, nestedcall); 87 var ret = this.parent.find(name, nestedcall);
87 if (ret) { 88 if (ret) {
88 if(ret.type == 'self') { 89 if(ret.type == 'self') {
89 ret.type = 'parent'; 90 ret.type = 'parent';
90 ret.depth = 1; 91 ret.depth = 1;
92 this.needsparent = true;
91 } else if(ret.type == 'parent') { 93 } else if(ret.type == 'parent') {
94 this.needsparent = true;
92 ret.depth++; 95 ret.depth++;
93 } else if(ret.type == 'closedover' || ret.type == 'upvar') { 96 } else if(ret.type == 'closedover' || ret.type == 'upvar') {
94 this.needsenv = true; 97 this.needsenv = true;
95 } 98 }
96 } 99 }