From 32ad15bb8cee21fe61237477e0a2a74d1dc18de6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Mon, 24 Jun 2013 14:20:43 +0200 Subject: [PATCH] Migrate MAP-FOR-IN --- src/compiler.lisp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/compiler.lisp b/src/compiler.lisp index 047f42d..4b0cd8d 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1350,14 +1350,13 @@ (js!bool `(in (call |xstring| ,key) ,object))) (define-builtin map-for-in (function object) - (js!selfcall - "var f = " function ";" - "var g = (typeof f === 'function' ? f : f.fvalue);" - "var o = " object ";" - "for (var key in o){" - `(code "g(" ,(if *multiple-value-p* "values" "pv") ", 1, o[key]);" ) - "}" - " return " (ls-compile nil) ";" )) + (js!selfcall* + `(var (f ,function) + (g (if (=== (typeof f) "function") f (get f "fvalue"))) + (o ,object)) + `(for-in (key o) + (call g ,(if *multiple-value-p* '|values| '|pv|) 1 (get o "key"))) + `(return ,(ls-compile nil)))) (define-compilation %js-vref (var) `(code "js_to_lisp(" ,var ")")) -- 1.7.10.4