Migrate STRINGP
[jscl.git] / src / compiler.lisp
index f58fe1a..d8e9b6d 100644 (file)
 
 (define-builtin stringp (x)
   (js!bool
-   (js!selfcall
-     "var x = " x ";"
-     "return typeof(x) == 'object' && 'length' in x && x.stringp == 1;")))
+   (js!selfcall*
+     `(var (x ,x))
+     `(return (and (and (===(typeof x) "object")
+                        (in "length" x))
+                   (== (get x "stringp") 1))))))
 
 (define-raw-builtin funcall (func &rest args)
   (js!selfcall