From fd65b669013476e4fd4348dd4e415bc44b812966 Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Wed, 13 Feb 2013 22:46:19 +0000 Subject: [PATCH] FUNCALL accepts symbols as function descriptor --- ecmalisp.lisp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 5cbd13e..514e259 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -2231,11 +2231,13 @@ "string1.concat(string2)")) (define-raw-builtin funcall (func &rest args) - (code "(" (ls-compile func) ")(" - (join (cons (if *multiple-value-p* "values" "pv") - (mapcar #'ls-compile args)) - ", ") - ")")) + (js!selfcall + "var f = " (ls-compile func) ";" *newline* + "return (typeof f === 'function'? f: f.fvalue)(" + (join (cons (if *multiple-value-p* "values" "pv") + (mapcar #'ls-compile args)) + ", ") + ")")) (define-raw-builtin apply (func &rest args) (if (null args) -- 1.7.10.4