}));
continue;
}
- if (!is("punc", ":") && start.type == "name") switch (key) {
+ if (is("punc", ":")) {
+ next();
+ a.push(new AST_ObjectKeyVal({
+ start: start,
+ key: key,
+ value: maybe_assign(),
+ end: prev(),
+ }));
+ continue;
+ }
+ if (is("punc", ",") || is("punc", "}")) {
+ a.push(new AST_ObjectKeyVal({
+ start: start,
+ key: key,
+ value: _make_symbol(AST_SymbolRef, start),
+ end: prev(),
+ }));
+ continue;
+ }
+ if (start.type == "name") switch (key) {
+ case "async":
+ key = as_property_key();
+ var func_start = S.token;
+ var func = function_(AST_AsyncFunction);
+ func.start = func_start;
+ func.end = prev();
+ a.push(new AST_ObjectKeyVal({
+ start: start,
+ key: key,
+ value: func,
+ end: prev(),
+ }));
+ continue;
case "get":
a.push(new AST_ObjectGetter({
start: start,
end: prev(),
}));
continue;
- default:
- a.push(new AST_ObjectKeyVal({
- start: start,
- key: key,
- value: _make_symbol(AST_SymbolRef, start),
- end: prev(),
- }));
- continue;
}
- expect(":");
- a.push(new AST_ObjectKeyVal({
- start: start,
- key: key,
- value: maybe_assign(),
- end: prev(),
- }));
+ unexpected();
}
next();
return new AST_Object({ properties: a });
function createObjectFunction(recurmax, stmtDepth, canThrow) {
var nameLenBefore = VAR_NAMES.length;
var save_async = async;
- async = SUPPORT.async && rng(50) == 0;
var s;
createBlockVariables(recurmax, stmtDepth, canThrow, function(defns) {
switch (rng(SUPPORT.computed_key ? 3 : 2)) {
case 0:
+ var name = createObjectKey(recurmax, stmtDepth, canThrow);
+ async = false;
s = [
- "get " + createObjectKey(recurmax, stmtDepth, canThrow) + "(){",
+ "get " + name + "(){",
strictMode(),
defns(),
_createStatements(2, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),
do {
prop2 = getDotKey();
} while (prop1 == prop2);
+ async = false;
s = [
"set " + prop1 + "(" + createVarName(MANDATORY) + "){",
strictMode(),
];
break;
default:
+ var name = createObjectKey(recurmax, stmtDepth, canThrow);
+ async = SUPPORT.async && rng(50) == 0;
s = [
- createObjectKey(recurmax, stmtDepth, canThrow) + "(" + createParams(save_async, NO_DUPLICATE) + "){",
+ (async ? "async " : "") + name + "(" + createParams(save_async, NO_DUPLICATE) + "){",
strictMode(),
defns(),
_createStatements(3, recurmax, canThrow, CANNOT_BREAK, CANNOT_CONTINUE, CAN_RETURN, stmtDepth),