Treat 'debugger' as a pure-statement keyword, not and identifier.
This commit is contained in:
parent
fa95f743f3
commit
04fd24e068
|
@ -32,6 +32,8 @@
|
|||
return new LiteralNode($1);
|
||||
}), o("CONTINUE", function() {
|
||||
return new LiteralNode($1);
|
||||
}), o("DEBUGGER", function() {
|
||||
return new LiteralNode($1);
|
||||
})
|
||||
],
|
||||
Expression: [o("Value"), o("Call"), o("Code"), o("Operation"), o("Assign"), o("If"), o("Try"), o("While"), o("For"), o("Switch"), o("Extends"), o("Class"), o("Existence"), o("Comment")],
|
||||
|
|
|
@ -600,7 +600,7 @@
|
|||
};
|
||||
return Lexer;
|
||||
})();
|
||||
JS_KEYWORDS = ["if", "else", "true", "false", "new", "return", "try", "catch", "finally", "throw", "break", "continue", "for", "in", "while", "delete", "instanceof", "typeof", "switch", "super", "extends", "class", "this", "null"];
|
||||
JS_KEYWORDS = ["if", "else", "true", "false", "new", "return", "try", "catch", "finally", "throw", "break", "continue", "for", "in", "while", "delete", "instanceof", "typeof", "switch", "super", "extends", "class", "this", "null", "debugger"];
|
||||
COFFEE_ALIASES = ["and", "or", "is", "isnt", "not"];
|
||||
COFFEE_KEYWORDS = COFFEE_ALIASES.concat(["then", "unless", "until", "loop", "yes", "no", "on", "off", "of", "by", "where", "when"]);
|
||||
RESERVED = ["case", "default", "do", "function", "var", "void", "with", "const", "let", "enum", "export", "import", "native", "__hasProp", "__extends", "__slice"];
|
||||
|
|
|
@ -269,7 +269,7 @@
|
|||
return this.isStatement() ? this : LiteralNode.__super__.makeReturn.call(this);
|
||||
};
|
||||
LiteralNode.prototype.isStatement = function() {
|
||||
return this.value === 'break' || this.value === 'continue';
|
||||
return this.value === 'break' || this.value === 'continue' || this.value === 'debugger';
|
||||
};
|
||||
LiteralNode.prototype.isPureStatement = LiteralNode.prototype.isStatement;
|
||||
LiteralNode.prototype.compileNode = function(o) {
|
||||
|
|
358
lib/parser.js
358
lib/parser.js
File diff suppressed because one or more lines are too long
|
@ -78,6 +78,7 @@ grammar =
|
|||
o "Throw"
|
||||
o "BREAK", -> new LiteralNode $1
|
||||
o "CONTINUE", -> new LiteralNode $1
|
||||
o "DEBUGGER", -> new LiteralNode $1
|
||||
]
|
||||
|
||||
# All the different types of expressions in our language. The basic unit of
|
||||
|
|
|
@ -492,7 +492,7 @@ JS_KEYWORDS = [
|
|||
"for", "in", "while",
|
||||
"delete", "instanceof", "typeof",
|
||||
"switch", "super", "extends", "class",
|
||||
"this", "null"
|
||||
"this", "null", "debugger"
|
||||
]
|
||||
|
||||
# CoffeeScript-only keywords, which we're more relaxed about allowing. They can't
|
||||
|
|
|
@ -249,7 +249,7 @@ exports.LiteralNode = class LiteralNode extends BaseNode
|
|||
# Break and continue must be treated as pure statements -- they lose their
|
||||
# meaning when wrapped in a closure.
|
||||
isStatement: ->
|
||||
@value is 'break' or @value is 'continue'
|
||||
@value is 'break' or @value is 'continue' or @value is 'debugger'
|
||||
isPureStatement: LiteralNode::isStatement
|
||||
|
||||
compileNode: (o) ->
|
||||
|
|
Loading…
Reference in New Issue