# HG changeset patch # User Michael Pavone # Date 1388351230 28800 # Node ID 218b11ec8fa2f86fccf1fd8e65438f6d76966d32 # Parent a1a80af71b054f738b408e84ed0023d18796eae9 Better handling for weird values being inserted into AST due to quoting diff -r a1a80af71b05 -r 218b11ec8fa2 interp.js --- a/interp.js Mon Dec 23 14:44:31 2013 -0800 +++ b/interp.js Sun Dec 29 13:07:10 2013 -0800 @@ -230,7 +230,10 @@ if (val == tpfalse) { return new symbol('false'); } - return val; + if ('makeHygienic' in val) { + return val; + } + return null; } op.prototype.eval = function(env) { @@ -306,6 +309,9 @@ var val = env.find(this.name); if (val !== null) { var newnode = makeASTNode(val); + if (!newnode) { + throw new Error(this.name + ' contains a value ' + val + ' that could not be converted to an AST node'); + } return newnode; } else { this.dirty = true; @@ -836,7 +842,7 @@ if (val) { var node = makeASTNode(val); if (!(node instanceof symbol)) { - throw new Error('Left hand side of assignment expression must be a symbol!'); + throw new Error('Left hand side of assignment expression must be a symbol not a '+ node.constructor.name + ' '+(typeof node) + ', old name was ' + name); } name = node.cleanName(); dirty = node.dirty;