changeset 240:dc5f487247ee

Don't rename the symbol self in quote blocks
author Mike Pavone <pavone@retrodev.com>
date Sun, 05 Jan 2014 20:53:35 -0800
parents 6aab8a5a2be9
children c50f77de41d1
files interp.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/interp.js	Sun Jan 05 19:28:09 2014 -0800
+++ b/interp.js	Sun Jan 05 20:53:35 2014 -0800
@@ -320,7 +320,7 @@
 };
 
 symbol.prototype.makeHygienic = function(env) {
-	if (this.dirty) {
+	if (this.dirty && this.cleanName() != 'self') {
 		var hygenic = env.findQuoteTrans(this.cleanName());
 		if (hygenic)
 		{
@@ -742,6 +742,8 @@
 				this.expressions[i] = expr.macroexpand(env);
 				if (this.expressions[i].expression instanceof lambda) {
 					env.syms[expr.symbol.cleanName()] = this.expressions[i].expression.eval(env);
+				} else {
+					env.syms[expr.symbol.cleanName()] = null;
 				}
 			}
 		} else {
@@ -773,7 +775,7 @@
 	var env = new environment(parentenv);
 	for (var i = 0; i < this.args.length; i++) {
 		env.syms[this.args[i].cleanName()] = null;
-		if (this.args[i].dirty) {
+		if (this.args[i].dirty && this.args[i].cleanName() != 'self') {
 			var hygienic = '' + quote_prefix + this.args[i].cleanName();
 			env.quotetrans[this.args[i].cleanName()] = hygienic;
 			args.push(new symbol(hygienic, this.args[i].symbols));