projects
/
jscl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0fd4307
)
Migrate SYMBOL-FUNCTION and SYMBOL-VALUE
author
David Vázquez
<davazp@gmail.com>
Sun, 23 Jun 2013 19:30:21 +0000
(21:30 +0200)
committer
David Vázquez
<davazp@gmail.com>
Sun, 23 Jun 2013 19:30:21 +0000
(21:30 +0200)
src/compiler.lisp
patch
|
blob
|
history
diff --git
a/src/compiler.lisp
b/src/compiler.lisp
index
92c847f
..
c118761
100644
(file)
--- a/
src/compiler.lisp
+++ b/
src/compiler.lisp
@@
-1138,18
+1138,20
@@
(js!bool `(!== (get ,x "fvalue") undefined)))
(define-builtin symbol-value (x)
(js!bool `(!== (get ,x "fvalue") undefined)))
(define-builtin symbol-value (x)
- (js!selfcall
- "var symbol = " x ";"
- "var value = symbol.value;"
- "if (value === undefined) throw \"Variable `\" + xstring(symbol.name) + \"' is unbound.\";"
- "return value;" ))
+ (js!selfcall*
+ `(var (symbol ,x)
+ (value (get symbol "value")))
+ `(if (=== value undefined)
+ (throw (+ "Variable `" (call |xstring| (get symbol "name")) "' is unbound.")))
+ `(return value)))
(define-builtin symbol-function (x)
(define-builtin symbol-function (x)
- (js!selfcall
- "var symbol = " x ";"
- "var func = symbol.fvalue;"
- "if (func === undefined) throw \"Function `\" + xstring(symbol.name) + \"' is undefined.\";"
- "return func;" ))
+ (js!selfcall*
+ `(var (symbol ,x)
+ (func (get symbol "fvalue")))
+ `(if (=== func undefined)
+ (throw (+ "Function `" (call |xstring| (get symbol "name")) "' is undefined.")))
+ `(return func)))
(define-builtin symbol-plist (x)
`(code "((" ,x ").plist || " ,(ls-compile nil) ")"))
(define-builtin symbol-plist (x)
`(code "((" ,x ").plist || " ,(ls-compile nil) ")"))