diff 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
line wrap: on
line diff
--- a/cbackend.js	Sat Aug 10 14:19:38 2013 -0700
+++ b/cbackend.js	Sat Aug 10 14:50:38 2013 -0700
@@ -982,7 +982,7 @@
 			for (var key in this.symbols.closedover) {
 				print(key, ": ", this.symbols.closedover[key]);
 			}
-			throw new Error('this.symbols.closedover is not empty, but it was when compilation of "' + assignPaths + '" started');
+			throw new Error('this.symbols.closedover is not empty, but it was when compilation of ' + this.name + ' "' + assignPath + '" started');
 		}
 		forwarddec += 'struct ' + this.name + '_env {\n';
 		if (this.symbols.needsParentEnv) {
@@ -1093,11 +1093,13 @@
 };
 assignment.prototype.toCObject = function(cobj) {
 	debugprint('//message definition', this.symbol.name);
+	assignNames.push('#' + this.symbol.name);
 	if (this.expression.toCObject) {
 		var val = this.expression.toCObject(cobj.name);
 	} else {
 		var val = this.expression.toC();
 	}
+	assignNames.pop();
 	if (val === null) {
 		return;
 	}