computed properties
This commit is contained in:
15
lib/parse.js
15
lib/parse.js
@@ -1465,6 +1465,15 @@ function parse($TEXT, options) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == "punc" && start.value == "[") {
|
||||
expect(":");
|
||||
a.push(new AST_ObjectComputedKeyVal({
|
||||
key: name,
|
||||
value: expression(false)
|
||||
}));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is("punc", ":")) {
|
||||
// It's one of those object destructurings, the value is its own name
|
||||
@@ -1495,6 +1504,12 @@ function parse($TEXT, options) {
|
||||
var tmp = S.token;
|
||||
next();
|
||||
switch (tmp.type) {
|
||||
case "punc":
|
||||
if (tmp.value === "[") {
|
||||
var ex = expression(false);
|
||||
expect("]");
|
||||
return ex;
|
||||
} else unexpected();
|
||||
case "num":
|
||||
case "string":
|
||||
case "name":
|
||||
|
||||
Reference in New Issue
Block a user