From 3a3391372f9f3e70e1e32b0c44e7011b0922c03c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Fri, 5 Jul 2013 04:53:05 +0200 Subject: [PATCH] Migrate VARIABLE-ARITMETIC-CALL --- src/compiler.lisp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/compiler.lisp b/src/compiler.lisp index 9ff6cd7..f9c1cd2 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -981,15 +981,17 @@ (fargs '()) (prelude '())) (dolist (x args) - (cond - ((or (floatp x) (numberp x)) (push x fargs)) - (t (let ((v (make-symbol (code "x" (incf counter))))) - (push v fargs) - (push `(code "var " ,v " = " ,(ls-compile x) ";" - "if (typeof " ,v " !== 'number') throw 'Not a number!';") - prelude))))) - (js!selfcall - `(code ,@(reverse prelude)) + (if (or (floatp x) (numberp x)) + (push x fargs) + (let ((v (make-symbol (concat "x" (integer-to-string (incf counter)))))) + (push v fargs) + (push `(var (,v ,(ls-compile x))) + prelude) + (push `(if (!= (typeof ,v) "number") + (throw "Not a number!")) + prelude)))) + (js!selfcall* + `(progn ,@(reverse prelude)) (funcall function (reverse fargs))))) -- 1.7.10.4