From: David Vázquez Date: Mon, 24 Jun 2013 12:20:43 +0000 (+0200) Subject: Migrate MAP-FOR-IN X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=32ad15bb8cee21fe61237477e0a2a74d1dc18de6;p=jscl.git Migrate MAP-FOR-IN --- 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 ")"))