Skip to content

Commit

Permalink
Tweaks and bug fixes to fast JS rendering mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Gurnell committed Aug 5, 2009
1 parent 6c0a80a commit 998abda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions javascript/render-fast.ss
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
(when expr
(display-str " = ")
(display-js expr))]
[(struct FunctionDeclaration (_ id args body)) (display-str "function ")
[(struct FunctionDeclaration (_ id args body)) (display-str "function")
(display-js id)
(display-str "(")
(display-list ", " args)
(display-str ") { ")
(for-each display-js body)
(display-str "} ")]
(display-str "}")]
[(struct VariableDeclaration (_ bindings)) (display-str "var ")
(display-list ", " bindings)
(display-str "; ")]
Expand Down Expand Up @@ -72,7 +72,8 @@
[(struct NewExpression (_ id args)) (display-str "new ")
(display-js id)
(display-str "(")
(display-list ", " args)]
(display-list ", " args)
(display-str ")")]
[(struct PostfixExpression (_ expr op)) (display-js expr)
(display-str op)]
[(struct PrefixExpression (_ op expr)) (display-str op)
Expand All @@ -98,15 +99,15 @@
(display-str " ")
(display-js rhs)
(display-str ")")]
[(struct FunctionExpression (_ id args body)) (display-str "function ")
[(struct FunctionExpression (_ id args body)) (display-str "(function")
(when id
(display-js id)
(display-str " "))
(display-str "(")
(display-list ", " args)
(display-str ") { ")
(for-each display-js body)
(display-str "} ")]
(display-str "})")]
[(struct CallExpression (_ fn args)) (display-js fn)
(display-str "(")
(display-list ", " args)
Expand Down
3 changes: 2 additions & 1 deletion javascript/syntax-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"../test-base.ss"
"syntax-internal.ss")
(prefix-in scheme: scheme/pretty)
srfi/13
"../test-base.ss"
"expander.ss"
"render.ss"
Expand All @@ -23,7 +24,7 @@
(with-syntax ([expanded (expand-javascript #'actual)])
#`(test-case message
(with-check-info (['compiled expanded])
(check-equal? (javascript->string expanded)
(check-equal? (string-trim-both (javascript->string expanded))
expected)))))])))

(define-javascript-syntax (!var-debug [id expr] ...)
Expand Down

0 comments on commit 998abda

Please sign in to comment.