projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dcfb836
)
Migrate CAR and CDR
author
David Vázquez
<davazp@gmail.com>
Sun, 23 Jun 2013 19:15:10 +0000
(21:15 +0200)
committer
David Vázquez
<davazp@gmail.com>
Sun, 23 Jun 2013 19:15:10 +0000
(21:15 +0200)
src/compiler.lisp
patch
|
blob
|
history
diff --git
a/src/compiler.lisp
b/src/compiler.lisp
index
88fafe2
..
28462ba
100644
(file)
--- a/
src/compiler.lisp
+++ b/
src/compiler.lisp
@@
-1095,18
+1095,18
@@
"return (typeof tmp == 'object' && 'car' in tmp);" )))
(define-builtin car (x)
"return (typeof tmp == 'object' && 'car' in tmp);" )))
(define-builtin car (x)
- (js!selfcall
- "var tmp = " x ";"
- "return tmp === " (ls-compile nil)
- "? " (ls-compile nil)
- ": tmp.car;" ))
+ (js!selfcall*
+ `(var (tmp ,x))
+ `(return (if (=== tmp ,(ls-compile nil))
+ ,(ls-compile nil)
+ (get tmp "car")))))
(define-builtin cdr (x)
(define-builtin cdr (x)
- (js!selfcall
- "var tmp = " x ";"
- "return tmp === " (ls-compile nil) "? "
- (ls-compile nil)
- ": tmp.cdr;" ))
+ (js!selfcall*
+ `(var (tmp ,x))
+ `(return (if (=== tmp ,(ls-compile nil))
+ ,(ls-compile nil)
+ (get tmp "cdr")))))
(define-builtin rplaca (x new)
(type-check (("x" "object" x))
(define-builtin rplaca (x new)
(type-check (("x" "object" x))