From dae62912bf9623ba68e34c134aaf53ac1771bbfe Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Wed, 16 Oct 2013 00:47:13 +0200 Subject: [PATCH] Streamline OGET*/OSET* when undefined is already handled. --- src/compiler/compiler.lisp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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)))) -- 1.7.10.4