aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMiki Tebeka <miki.tebeka@gmail.com>2015-03-01 06:12:42 +0200
committerMiki Tebeka <miki.tebeka@gmail.com>2015-03-01 06:12:42 +0200
commit9fb199e2cb2cf44cd61c2a226193a70f6013aadc (patch)
tree325a2a8e33e3e8d18217d10854152cab82ac8b61 /js
parent49916f9402e30a5277146355be878b32ec30f46d (diff)
parent2cb013877c4ed41d245ce7c5525405c4833c503d (diff)
downloadmal-9fb199e2cb2cf44cd61c2a226193a70f6013aadc.tar.gz
mal-9fb199e2cb2cf44cd61c2a226193a70f6013aadc.zip
Merge branch 'master' of https://github.com/kanaka/mal
Diffstat (limited to 'js')
-rw-r--r--js/Makefile2
-rw-r--r--js/stepA_mal.js (renamed from js/stepA_interop.js)8
-rw-r--r--js/tests/stepA_mal.mal (renamed from js/tests/stepA_interop.mal)0
-rw-r--r--js/types.js4
4 files changed, 11 insertions, 3 deletions
diff --git a/js/Makefile b/js/Makefile
index 09ed5a4..98c4291 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -2,7 +2,7 @@
TESTS = tests/types.js tests/reader.js
SOURCES_BASE = node_readline.js types.js reader.js printer.js
-SOURCES_LISP = env.js core.js stepA_interop.js
+SOURCES_LISP = env.js core.js stepA_mal.js
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
WEB_SOURCES = $(SOURCES:node_readline.js=jq_readline.js)
diff --git a/js/stepA_interop.js b/js/stepA_mal.js
index 456c006..d879cd3 100644
--- a/js/stepA_interop.js
+++ b/js/stepA_mal.js
@@ -5,6 +5,7 @@ if (typeof module !== 'undefined') {
var printer = require('./printer');
var Env = require('./env').Env;
var core = require('./core');
+ var interop = require('./interop');
}
// read
@@ -108,8 +109,11 @@ function _EVAL(ast, env) {
return eval(a1.toString());
case ".":
var el = eval_ast(ast.slice(2), env),
- f = eval(a1.toString());
- return f.apply(f, el);
+ r = interop.resolve_js(a1.toString()),
+ obj = r[0], f = r[1];
+ var res = f.apply(obj, el);
+ console.log("DEBUG3:", res);
+ return interop.js_to_mal(res);
case "try*":
try {
return EVAL(a1, env);
diff --git a/js/tests/stepA_interop.mal b/js/tests/stepA_mal.mal
index f785292..f785292 100644
--- a/js/tests/stepA_interop.mal
+++ b/js/tests/stepA_mal.mal
diff --git a/js/types.js b/js/types.js
index 848a484..e3901b7 100644
--- a/js/types.js
+++ b/js/types.js
@@ -79,6 +79,10 @@ function _clone (obj) {
default:
throw new Error("clone of non-collection: " + _obj_type(obj));
}
+ Object.defineProperty(new_obj, "__meta__", {
+ enumerable: false,
+ writable: true
+ });
return new_obj;
}