Skip to content

Commit

Permalink
Fixed typo in definition of (js (throw ...)) form; fixed a couple of …
Browse files Browse the repository at this point in the history
…tests.
  • Loading branch information
Dave Gurnell committed May 12, 2010
1 parent e86513e commit 71fbc10
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions javascript/sexp/module-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@
(registry->string))
[(list (cons start end))
(check > start 0)]
[_ (fail "Registry does not contain test1.ss script")]))
)
[_ (fail "Registry does not contain test1.ss script")])))
2 changes: 1 addition & 1 deletion javascript/sexp/module.ss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#'(#%plain-module-begin
require ...
(define script (js stmt ...))
(display (javascript->pretty-string script))
#;(display (javascript->pretty-string script))
(registry-add! script)
(provide script)))]))

Expand Down
2 changes: 1 addition & 1 deletion javascript/syntax-internal.ss
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
#,(expand-identifier #'label)
#,(expand-statement #'stmt))]
[(!label arg ...) (raise-syntax-error #f "bad JS syntax" stx)]
[(throw expr) #`(make-ThrowStatment #f #,(expand-expression #'expr))]
[(throw expr) #`(make-ThrowStatement #f #,(expand-expression #'expr))]
[(throw arg ...) (raise-syntax-error #f "bad JS syntax" stx)]
[(try stmt+clause ...) #`(make-TryStatement #f #,@(expand-try-clauses #'(stmt+clause ...)))]
[(unquote stmt) #`(quote-statement stmt)]
Expand Down
6 changes: 5 additions & 1 deletion javascript/syntax-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

(test-js "stmt: if version 1"
(if x (return y))
"if (x) return y; ")
"if (x) return y;")

(test-js "stmt: if version 2"
(if x (return y) (return z))
Expand All @@ -139,6 +139,10 @@
(js (for-in ((var key val) (!object [a 1] [b 2] [c 3]))
(alert (+ key ": " val))))))

(test-js "stmt: throw"
(throw "x")
"throw \"x\";")

(test-js "stmt: try version 1"
(try (+ 1 2) (+ 2 3) (catch e (+ 3 4)) (finally (+ 4 5)))
"try { 1 + 2; 2 + 3; } catch (e) { 3 + 4; } finally { 4 + 5; }")
Expand Down

0 comments on commit 71fbc10

Please sign in to comment.