Allow 'name' as object literal shorthand property (#1617)

fixes #1613
This commit is contained in:
Alex Zaworski
2017-03-17 10:29:13 -07:00
committed by Alex Lam S.L
parent 2fd86d3cb0
commit d26b7522d9
2 changed files with 11 additions and 4 deletions

View File

@@ -1998,7 +1998,6 @@ function parse($TEXT, options) {
// allow trailing comma // allow trailing comma
break; break;
start = S.token; start = S.token;
var type = start.type;
var name = as_property_name(); var name = as_property_name();
var value; var value;
@@ -2009,9 +2008,6 @@ function parse($TEXT, options) {
a.push(concise); a.push(concise);
continue; continue;
} }
if (!(start.type !== name)) {
unexpected(S.token);
}
value = new AST_SymbolRef({ value = new AST_SymbolRef({
start: prev(), start: prev(),

View File

@@ -320,3 +320,14 @@ expansion: {
} }
} }
} }
issue_1613: {
mangle = { toplevel: true };
input: {
const name = 1;
const foo = {
name
};
}
expect_exact: "const n=1;const c={name:n};"
}