fix parsing of yield as object key (#1976)

fixes #1974
This commit is contained in:
Alex Lam S.L
2017-05-20 13:11:37 +08:00
committed by GitHub
parent 9a074c2637
commit a2172e1a99
3 changed files with 16 additions and 7 deletions

View File

@@ -2411,7 +2411,8 @@ function parse($TEXT, options) {
unexpected(tmp);
}
case "name":
if (tmp.value === "yield" && S.input.has_directive("use strict") && !is_in_generator()) {
if (tmp.value == "yield" && !is_token(peek(), "punc", ":")
&& S.input.has_directive("use strict") && !is_in_generator()) {
token_error(tmp, "Unexpected yield identifier inside strict mode");
}
case "string":