From e4c2519634054d349af11ced07011e1178b764f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Sun, 23 Jun 2013 12:04:48 +0200 Subject: [PATCH] Do not upcase variable names JS identifiers --- src/compiler-codegen.lisp | 2 +- src/compiler.lisp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/compiler-codegen.lisp b/src/compiler-codegen.lisp index 674ace6..51027fd 100644 --- a/src/compiler-codegen.lisp +++ b/src/compiler-codegen.lisp @@ -78,7 +78,7 @@ (defun valid-js-identifier (string-designator) (let ((string (typecase string-designator - (symbol (string-downcase (symbol-name string-designator))) + (symbol (symbol-name string-designator)) (string string-designator) (t (return-from valid-js-identifier (values nil nil)))))) diff --git a/src/compiler.lisp b/src/compiler.lisp index 7d3f60c..747f4b1 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -60,6 +60,10 @@ (defmacro js!selfcall (&body body) ``(call (function nil (code ,,@body)))) +(defmacro js!selfcall* (&body body) + ``(call (function nil ,,@body))) + + ;;; Like CODE, but prefix each line with four spaces. Two versions ;;; of this function are available, because the Ecmalisp version is ;;; very slow and bootstraping was annoying. @@ -1326,7 +1330,7 @@ "return tmp === undefined? " (ls-compile nil) " : tmp;" ))) (define-raw-builtin oget (object key &rest keys) - `(call js_to_lisp ,(ls-compile `(oget* ,object ,key ,@keys)))) + `(call |js_to_lisp| ,(ls-compile `(oget* ,object ,key ,@keys)))) (define-raw-builtin oset (value object key &rest keys) (ls-compile `(oset* (lisp-to-js ,value) ,object ,key ,@keys))) @@ -1334,12 +1338,12 @@ (define-builtin objectp (x) (js!bool `(=== (typeof ,x) "object"))) -(define-builtin lisp-to-js (x) `(call lisp_to_js ,x)) -(define-builtin js-to-lisp (x) `(call js_to_lisp ,x)) +(define-builtin lisp-to-js (x) `(call |lisp_to_js| ,x)) +(define-builtin js-to-lisp (x) `(call |js_to_lisp| ,x)) (define-builtin in (key object) - (js!bool `(in (call xstring ,key) ,object))) + (js!bool `(in (call |xstring| ,key) ,object))) (define-builtin map-for-in (function object) (js!selfcall -- 1.7.10.4