comparison interp.js @ 312:8511aac1ce82

Fix module references in macros
author Michael Pavone <pavone@retrodev.com>
date Fri, 05 Sep 2014 09:56:22 -0700
parents f6dfb85e80e5
children d4df33596e7d
comparison
equal deleted inserted replaced
311:dfd204c82849 312:8511aac1ce82
121 var parsed = parseFile(this.names[name]); 121 var parsed = parseFile(this.names[name]);
122 var ret = parsed.macroexpand(this).eval(this); 122 var ret = parsed.macroexpand(this).eval(this);
123 if (typeof ret == 'function') { 123 if (typeof ret == 'function') {
124 ret = ret(); 124 ret = ret();
125 } 125 }
126 ret.ismodule = true;
126 this.modules[name] = ret; 127 this.modules[name] = ret;
127 return ret; 128 return ret;
128 } 129 }
129 return null; 130 return null;
130 }, 131 },
307 308
308 symbol.prototype.quote = function(env) { 309 symbol.prototype.quote = function(env) {
309 if (this.cleanName() != 'self') { 310 if (this.cleanName() != 'self') {
310 var val = env.find(this.name); 311 var val = env.find(this.name);
311 if (val !== null) { 312 if (val !== null) {
312 var newnode = makeASTNode(val); 313 if (val.ismodule) {
313 if (!newnode) { 314 return this;
314 throw new Error(this.name + ' contains a value ' + val + ' that could not be converted to an AST node'); 315 } else {
315 } 316 var newnode = makeASTNode(val);
316 return newnode; 317 if (!newnode) {
318 throw new Error(this.name + ' contains a value ' + val + ' that could not be converted to an AST node');
319 }
320 return newnode;
321 }
317 } else { 322 } else {
318 this.dirty = true; 323 this.dirty = true;
319 return this; 324 return this;
320 } 325 }
321 } else { 326 } else {