diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index ae9e96e323f1..1eae752e8f1c 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -865,6 +865,10 @@ class FullParseHandlerBase return node->isKind(PNK_NAME); } + bool isArgumentsAnyParentheses(ParseNode* node, JSContext* cx) { + return node->isKind(PNK_NAME) && node->pn_atom == cx->names().arguments; + } + bool isEvalAnyParentheses(ParseNode* node, JSContext* cx) { return node->isKind(PNK_NAME) && node->pn_atom == cx->names().eval; } @@ -875,7 +879,7 @@ class FullParseHandlerBase if (isEvalAnyParentheses(node, cx)) return js_eval_str; - if (node->pn_atom == cx->names().arguments) + if (isArgumentsAnyParentheses(node, cx)) return js_arguments_str; return nullptr; } diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 4587f9f5ee56..c6aef0ea8a79 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -699,6 +699,19 @@ ParserBase::extraWarning(unsigned errorNumber, ...) return result; } +bool +ParserBase::extraWarningAt(uint32_t offset, unsigned errorNumber, ...) +{ + va_list args; + va_start(args, errorNumber); + + bool result = + tokenStream.reportExtraWarningErrorNumberVA(nullptr, offset, errorNumber, args); + + va_end(args); + return result; +} + bool ParserBase::strictModeError(unsigned errorNumber, ...) { @@ -4171,8 +4184,10 @@ Parser::PossibleError::error(ErrorKind kind) { if (kind == ErrorKind::Expression) return exprError_; - MOZ_ASSERT(kind == ErrorKind::Destructuring); - return destructuringError_; + if (kind == ErrorKind::Destructuring) + return destructuringError_; + MOZ_ASSERT(kind == ErrorKind::DestructuringWarning); + return destructuringWarning_; } template