Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated for the recent parse-js change in the AST for :for-in

  • Loading branch information...
commit f9237b1e86ee5fa97822463968b8793b6e98d84a 1 parent 0e0ff08
@mishoo authored
Showing with 11 additions and 10 deletions.
  1. +6 −3 src/codegen.lisp
  2. +1 −6 src/mangle.lisp
  3. +4 −1 src/walker.lisp
View
9 src/codegen.lisp
@@ -359,11 +359,14 @@ characters in string S to STREAM."
(add-spaces "for" (stick "(" args ")")
(gencode body))))
- (:for-in (has-var key hash body)
+ (:for-in (var key hash body)
(with-output-to-string (out)
(write-string (add-spaces "for" "(") out)
- (when has-var (write-string "var " out))
- (write-string (add-spaces (stick (make-name key) " in " (gencode hash) ")")
+ (write-string (add-spaces (if var
+ (ppcre:regex-replace ";+$" (gencode var) "")
+ (gencode key))
+ "in"
+ (stick (gencode hash) ")")
(gencode body)) out)))
(:while (cond body)
View
7 src/mangle.lisp
@@ -148,12 +148,7 @@
(:name (name)
(when (string= name "eval")
(setf having-eval (pushnew *current-scope* having-eval)))
- `(:name ,(wrap-name name :reference t)))
- (:for-in (has-var name hash body)
- `(:for-in ,has-var
- ,(wrap-name name :define has-var :reference (not has-var))
- ,(walk hash)
- ,(walk body)))))))
+ `(:name ,(wrap-name name :reference t)))))))
;; propagate "uses-eval" to toplevel scope
(dolist (scope having-eval)
View
5 src/walker.lisp
@@ -34,7 +34,10 @@
(:do (cond body) `(:do ,(,walk cond) ,(,walk body)))
(:dot (expr prop) `(:dot ,(,walk expr) ,prop))
(:for (init cond step body) `(:for ,(,walk init) ,(,walk cond) ,(,walk step) ,(,walk body)))
- (:for-in (has-var key hash body) `(:for-in ,has-var ,key ,(,walk hash) ,(,walk body)))
+ (:for-in (var key hash body) `(:for-in ,(,walk var)
+ ,(,walk key)
+ ,(,walk hash)
+ ,(,walk body)))
(:if (cond then else) `(:if ,(,walk cond) ,(,walk then) ,(,walk else)))
(:label (label body) `(:label ,label ,(,walk body)))
(:name (name) `(:name ,name))
Please sign in to comment.
Something went wrong with that request. Please try again.