From 6bc11ba49716b832c802c1acd6ebd2ee3fa91690 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Thu, 27 Jun 2013 15:59:14 +0200 Subject: [PATCH] Migrate FUNCALL --- src/compiler.lisp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/compiler.lisp b/src/compiler.lisp index a903fbd..09ca814 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1195,15 +1195,14 @@ (== (get x "stringp") 1)))))) (define-raw-builtin funcall (func &rest args) - (js!selfcall - "var f = " (ls-compile func) ";" - "return (typeof f === 'function'? f: f.fvalue)(" - `(code - ,@(interleave (list* (if *multiple-value-p* "values" "pv") - (integer-to-string (length args)) - (mapcar #'ls-compile args)) - ", ")) - ")")) + (js!selfcall* + `(var (f ,(ls-compile func))) + `(return (call (if (=== (typeof f) "function") + f + (get f "fvalue")) + ,@(list* (if *multiple-value-p* '|values| '|pv|) + (length args) + (mapcar #'ls-compile args)))))) (define-raw-builtin apply (func &rest args) (if (null args) -- 1.7.10.4