зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1296814 - Inline Parser::checkAssignmentToCall into its one caller for clarity. r=anba
--HG-- extra : rebase_source : a62c7b4144dae39b74cd7f9259296204b725129e
This commit is contained in:
Родитель
39872acbcd
Коммит
c97fa5e795
|
@ -4027,19 +4027,6 @@ Parser<ParseHandler>::PossibleError::transferErrorsTo(PossibleError* other)
|
||||||
transferErrorTo(ErrorKind::Expression, other);
|
transferErrorTo(ErrorKind::Expression, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ParseHandler>
|
|
||||||
bool
|
|
||||||
Parser<ParseHandler>::checkAssignmentToCall(Node target, unsigned msg)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(handler.isFunctionCall(target));
|
|
||||||
|
|
||||||
// Assignment to function calls is forbidden in ES6. We're still somewhat
|
|
||||||
// concerned about sites using this in dead code, so forbid it only in
|
|
||||||
// strict mode code (or if the werror option has been set), and otherwise
|
|
||||||
// warn.
|
|
||||||
return reportWithNode(ParseStrictError, pc->sc()->strict(), target, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool
|
bool
|
||||||
Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<DeclarationKind> maybeDecl)
|
Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<DeclarationKind> maybeDecl)
|
||||||
|
@ -7867,7 +7854,11 @@ Parser<ParseHandler>::checkAndMarkAsIncOperand(Node target, AssignmentFlavor fla
|
||||||
if (!reportIfArgumentsEvalTarget(target))
|
if (!reportIfArgumentsEvalTarget(target))
|
||||||
return false;
|
return false;
|
||||||
} else if (handler.isFunctionCall(target)) {
|
} else if (handler.isFunctionCall(target)) {
|
||||||
if (!checkAssignmentToCall(target, JSMSG_BAD_INCOP_OPERAND))
|
// Assignment to function calls is forbidden in ES6. We're still
|
||||||
|
// somewhat concerned about sites using this in dead code, so forbid it
|
||||||
|
// only in strict mode code (or if the werror option has been set), and
|
||||||
|
// otherwise warn.
|
||||||
|
if (!reportWithNode(ParseStrictError, pc->sc()->strict(), target, JSMSG_BAD_INCOP_OPERAND))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1428,8 +1428,6 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
|
||||||
bool checkDestructuringObject(Node objectPattern, const mozilla::Maybe<DeclarationKind>& maybeDecl);
|
bool checkDestructuringObject(Node objectPattern, const mozilla::Maybe<DeclarationKind>& maybeDecl);
|
||||||
bool checkDestructuringName(Node expr, mozilla::Maybe<DeclarationKind> maybeDecl);
|
bool checkDestructuringName(Node expr, mozilla::Maybe<DeclarationKind> maybeDecl);
|
||||||
|
|
||||||
bool checkAssignmentToCall(Node node, unsigned errnum);
|
|
||||||
|
|
||||||
Node newNumber(const Token& tok) {
|
Node newNumber(const Token& tok) {
|
||||||
return handler.newNumber(tok.number(), tok.decimalPoint(), tok.pos);
|
return handler.newNumber(tok.number(), tok.decimalPoint(), tok.pos);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче