mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Closes #1001. Throw cannot be directly used as an expression with parens, but can appear as a statement in an expression.
This commit is contained in:
parent
5fbbfbcbe3
commit
96b22a16eb
2 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
};
|
||||
Base.prototype.compileClosure = function(o) {
|
||||
if (this.jumps()) {
|
||||
if (this.jumps() || this instanceof Throw) {
|
||||
throw SyntaxError('cannot use a pure statement in an expression.');
|
||||
}
|
||||
o.sharedScope = true;
|
||||
|
|
|
@ -48,7 +48,7 @@ exports.Base = class Base
|
|||
# Statements converted into expressions via closure-wrapping share a scope
|
||||
# object with their parent closure, to preserve the expected lexical scope.
|
||||
compileClosure: (o) ->
|
||||
if @jumps()
|
||||
if @jumps() or this instanceof Throw
|
||||
throw SyntaxError 'cannot use a pure statement in an expression.'
|
||||
o.sharedScope = yes
|
||||
Closure.wrap(this).compileNode o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue