Bug 1296814 - Inline Parser::checkAssignmentToCall into its one caller for clarity. r=anba

--HG--
extra : rebase_source : a62c7b4144dae39b74cd7f9259296204b725129e
This commit is contained in:
Jeff Walden 2016-11-14 12:53:38 -08:00
Родитель 39872acbcd
Коммит c97fa5e795
2 изменённых файлов: 5 добавлений и 16 удалений

Просмотреть файл

@ -4027,19 +4027,6 @@ Parser<ParseHandler>::PossibleError::transferErrorsTo(PossibleError* 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 <>
bool
Parser<FullParseHandler>::checkDestructuringName(ParseNode* expr, Maybe<DeclarationKind> maybeDecl)
@ -7867,7 +7854,11 @@ Parser<ParseHandler>::checkAndMarkAsIncOperand(Node target, AssignmentFlavor fla
if (!reportIfArgumentsEvalTarget(target))
return false;
} 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 true;

Просмотреть файл

@ -1428,8 +1428,6 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
bool checkDestructuringObject(Node objectPattern, const mozilla::Maybe<DeclarationKind>& maybeDecl);
bool checkDestructuringName(Node expr, mozilla::Maybe<DeclarationKind> maybeDecl);
bool checkAssignmentToCall(Node node, unsigned errnum);
Node newNumber(const Token& tok) {
return handler.newNumber(tok.number(), tok.decimalPoint(), tok.pos);
}