mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 1220702 - Part 2: Fix the .method property of certain FunctionDeclaration nodes. r=Waldo.
--HG-- extra : commitid : 4oo17Jwpqp9 extra : rebase_source : f68618834e1e233b3e4084780d1f93ce3b9874a0
This commit is contained in:
parent
8f623568f5
commit
ee1aaa35e1
@ -3233,7 +3233,9 @@ ASTSerializer::property(ParseNode* pn, MutableHandleValue dst)
|
||||
}
|
||||
|
||||
bool isShorthand = pn->isKind(PNK_SHORTHAND);
|
||||
bool isMethod = pn->pn_right->isKind(PNK_FUNCTION) && kind == PROP_INIT;
|
||||
bool isMethod =
|
||||
pn->pn_right->isKind(PNK_FUNCTION) &&
|
||||
pn->pn_right->pn_funbox->function()->kind() == JSFunction::Method;
|
||||
RootedValue key(cx), val(cx);
|
||||
return propertyName(pn->pn_left, &key) &&
|
||||
expression(pn->pn_right, &val) &&
|
||||
|
@ -31,6 +31,15 @@ assertExpr("b = { set [meth](a) { } }", aExpr("=", ident("b"),
|
||||
objExpr([{ key: computedName(ident("meth")), value: funExpr(null, [ident("a")],
|
||||
blockStmt([])), method: false, kind: "set"}])));
|
||||
|
||||
// Bug 1220702 - If it's not written as a method, `.method` should be false.
|
||||
assertExpr("({[x]: function () {}})",
|
||||
objExpr([{
|
||||
key: computedName(ident("x")),
|
||||
value: funExpr(null, [], blockStmt([])),
|
||||
method: false,
|
||||
kind: "init"
|
||||
}]));
|
||||
|
||||
}
|
||||
|
||||
runtest(test);
|
||||
|
Loading…
Reference in New Issue
Block a user