changeset 224:97c3e33cd3f4

Support macro expansion inside quoted code
author Michael Pavone <pavone@retrodev.com>
date Sun, 29 Dec 2013 14:38:56 -0800
parents 25db1c7c7300
children 262f5ae1bb1b
files interp.js
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/interp.js	Sun Dec 29 14:25:38 2013 -0800
+++ b/interp.js	Sun Dec 29 14:38:56 2013 -0800
@@ -435,11 +435,11 @@
 	}
 	if (name == 'quote') {
 		if (this.receiver) {
-			return this.receiver.quote(env);
+			return this.receiver.quote(env).macroexpand(env);
 		}
 		if (this.args.length) {
 			var cur = env;
-			return this.args[0].quote(env);
+			return this.args[0].quote(env).macroexpand(env);
 		}
 		throw new Error('quote takes an argument');
 	}
@@ -485,6 +485,9 @@
 	if (name[name.length-1] == ":") {
 		name = name.substr(0, name.length-1);
 	}
+	if (name == 'quote') {
+		return this;
+	}
 	var macro = env.findMacro(name);
 	if (this.receiver) {
 		this.receiver = this.receiver.macroexpand(env);