comparison cbackend.js @ 69:ba032565c7a5

Fix handling of variable style access to self and parent object messages defined with lambdas. Improve test case for this bug to include parent object access as well as self object access.
author Mike Pavone <pavone@retrodev.com>
date Sat, 14 Jul 2012 19:24:04 -0700
parents 3a169ebb3224
children ab6f24d6945d
comparison
equal deleted inserted replaced
68:3a169ebb3224 69:ba032565c7a5
94 var info = this.symbols.find(name); 94 var info = this.symbols.find(name);
95 if (!info) { 95 if (!info) {
96 throw new Error('symbol ' + name + ' not found'); 96 throw new Error('symbol ' + name + ' not found');
97 } 97 }
98 if (info.type == 'toplevel') { 98 if (info.type == 'toplevel') {
99
100 return toplevel.moduleVar(name); 99 return toplevel.moduleVar(name);
100 } else if (info.type == 'self' && info.def instanceof lambda) {
101 return 'mcall(' + getMethodId(name) + '/* ' + name + ' */, 1, ' + (new symbol('self', this.symbols)).toC() + ')';
102 } else if (info.type == 'parent' && info.def instanceof lambda) {
103 var obj = (new symbol('self', this.symbols)).toC() + '->header.';
104 for (var i = 0; i < info.depth; ++i) {
105 obj += (i ? '->' : '') + 'parent';
106 }
107 return 'mcall(' + getMethodId(name) + '/* ' + name + ' */, 1, ' + obj + ')';
101 } 108 }
102 return getSymbolPrefix(info, this.symbols) + escapeCName(name); 109 return getSymbolPrefix(info, this.symbols) + escapeCName(name);
103 } 110 }
104 111
105 var declaredInts = {}; 112 var declaredInts = {};