Mercurial > repos > tabletprog
comparison cbackend.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 | 9de2572a34a7 |
children | fc8eecad71e6 |
comparison
equal
deleted
inserted
replaced
155:9de2572a34a7 | 156:d6e79885bd3b |
---|---|
980 if (Object.keys(this.symbols.closedover).length) { | 980 if (Object.keys(this.symbols.closedover).length) { |
981 if (!addedTypeDef) { | 981 if (!addedTypeDef) { |
982 for (var key in this.symbols.closedover) { | 982 for (var key in this.symbols.closedover) { |
983 print(key, ": ", this.symbols.closedover[key]); | 983 print(key, ": ", this.symbols.closedover[key]); |
984 } | 984 } |
985 throw new Error('this.symbols.closedover is not empty, but it was when compilation of "' + assignPaths + '" started'); | 985 throw new Error('this.symbols.closedover is not empty, but it was when compilation of ' + this.name + ' "' + assignPath + '" started'); |
986 } | 986 } |
987 forwarddec += 'struct ' + this.name + '_env {\n'; | 987 forwarddec += 'struct ' + this.name + '_env {\n'; |
988 if (this.symbols.needsParentEnv) { | 988 if (this.symbols.needsParentEnv) { |
989 forwarddec += '\tstruct ' + this.symbols.parentEnvType() + ' * parent;\n'; | 989 forwarddec += '\tstruct ' + this.symbols.parentEnvType() + ' * parent;\n'; |
990 } | 990 } |
1091 } | 1091 } |
1092 return prefix + this.symbol.toC() + ' = ' + val; | 1092 return prefix + this.symbol.toC() + ' = ' + val; |
1093 }; | 1093 }; |
1094 assignment.prototype.toCObject = function(cobj) { | 1094 assignment.prototype.toCObject = function(cobj) { |
1095 debugprint('//message definition', this.symbol.name); | 1095 debugprint('//message definition', this.symbol.name); |
1096 assignNames.push('#' + this.symbol.name); | |
1096 if (this.expression.toCObject) { | 1097 if (this.expression.toCObject) { |
1097 var val = this.expression.toCObject(cobj.name); | 1098 var val = this.expression.toCObject(cobj.name); |
1098 } else { | 1099 } else { |
1099 var val = this.expression.toC(); | 1100 var val = this.expression.toC(); |
1100 } | 1101 } |
1102 assignNames.pop(); | |
1101 if (val === null) { | 1103 if (val === null) { |
1102 return; | 1104 return; |
1103 } | 1105 } |
1104 if (this.expression instanceof lambda) { | 1106 if (this.expression instanceof lambda) { |
1105 var params = ['((object *)self)']; | 1107 var params = ['((object *)self)']; |