From: Olof-Joachim Frahm Date: Tue, 15 Oct 2013 22:47:13 +0000 (+0200) Subject: Streamline OGET*/OSET* when undefined is already handled. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=dae62912bf9623ba68e34c134aaf53ac1771bbfe;p=jscl.git Streamline OGET*/OSET* when undefined is already handled. --- diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index ffa0c7d..87902db 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -1228,10 +1228,10 @@ (var (tmp (property ,(convert object) (call |xstring| ,(convert key))))) ,@(mapcar (lambda (key) `(progn - (if (=== tmp undefined) (return ,(convert nil))) + (if (=== tmp undefined) (return undefined)) (= tmp (property tmp (call |xstring| ,(convert key)))))) keys)) - (return (if (=== tmp undefined) ,(convert nil) tmp)))) + (return tmp))) (define-raw-builtin oset* (value object key &rest keys) (let ((keys (cons key keys))) @@ -1244,12 +1244,8 @@ (if (=== ,(convert object) undefined) (throw "Impossible to set object property.")))) (butlast keys)) - (var (tmp - (= (property obj (call |xstring| ,(convert (car (last keys))))) - ,(convert value)))) - (return (if (=== tmp undefined) - ,(convert nil) - tmp)))))) + (return (= (property obj (call |xstring| ,(convert (car (last keys))))) + ,(convert value))))))) (define-raw-builtin oget (object key &rest keys) `(call |js_to_lisp| ,(convert `(oget* ,object ,key ,@keys))))