X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler.lisp;h=b00366a779c11e052ae0f46a2b77d8e5e810e034;hb=b2791b343ae73280de6a618b0b49aa4f7e7b9b9d;hp=3a743990de18370c3954c8383d40ce6598d68f59;hpb=b77b6a4908af064451bf5292c0a3a5aa65581dfe;p=jscl.git diff --git a/src/compiler.lisp b/src/compiler.lisp index 3a74399..b00366a 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1178,17 +1178,17 @@ (define-builtin char-code (x) (type-check (("x" "string" x)) - "x.charCodeAt(0)")) + "char_to_codepoint(x)")) (define-builtin code-char (x) (type-check (("x" "number" x)) - "String.fromCharCode(x)")) + "char_from_codepoint(x)")) (define-builtin characterp (x) (js!bool (js!selfcall "var x = " x ";" *newline* - "return (typeof(" x ") == \"string\") && x.length == 1;"))) + "return (typeof(" x ") == \"string\") && (x.length == 1 || x.length == 2);"))) (define-builtin char-to-string (x) (js!selfcall @@ -1197,10 +1197,10 @@ "return r")) (define-builtin char-upcase (x) - (code x ".toUpperCase()")) + (code "safe_char_upcase(" x ")")) (define-builtin char-downcase (x) - (code x ".toLowerCase()")) + (code "safe_char_downcase(" x ")")) (define-builtin stringp (x) (js!bool