summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/Parser.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-06 06:54:09 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-06 06:54:09 +0200
commit4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5 (patch)
tree41dbe7bfcc8a13cf72e4bfee337b0fb75dbb2f3b /js/src/frontend/Parser.cpp
parent7d56f431ccc11f3b5e2e6deec331bd9c7a06cf80 (diff)
downloadUXP-4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5.tar
UXP-4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5.tar.gz
UXP-4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5.tar.lz
UXP-4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5.tar.xz
UXP-4c4f8091e620a35d6d20a5b0ccc6c118e9b8e5e5.zip
Remove Parser::reportBadReturn
Report simpler errors that don't use the offset of a node as location.
Diffstat (limited to 'js/src/frontend/Parser.cpp')
-rw-r--r--js/src/frontend/Parser.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index b494cc966..0099ed19d 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -909,21 +909,6 @@ Parser<ParseHandler>::parse()
return pn;
}
-template <typename ParseHandler>
-bool
-Parser<ParseHandler>::reportBadReturn(Node pn, ParseReportKind kind,
- unsigned errnum, unsigned anonerrnum)
-{
- JSAutoByteString name;
- if (JSAtom* atom = pc->functionBox()->function()->explicitName()) {
- if (!AtomToPrintableString(context, atom, &name))
- return false;
- } else {
- errnum = anonerrnum;
- }
- return reportWithNode(kind, pc->sc()->strict(), pn, errnum, name.ptr());
-}
-
/*
* Strict mode forbids introducing new definitions for 'eval', 'arguments', or
* for any strict mode reserved keyword.
@@ -6023,10 +6008,9 @@ Parser<ParseHandler>::returnStatement(YieldHandling yieldHandling)
if (!pn)
return null();
+ /* Disallow "return v;" in legacy generators. */
if (pc->isLegacyGenerator() && exprNode) {
- /* Disallow "return v;" in legacy generators. */
- reportBadReturn(pn, ParseError, JSMSG_BAD_GENERATOR_RETURN,
- JSMSG_BAD_ANON_GENERATOR_RETURN);
+ errorAt(begin, JSMSG_BAD_GENERATOR_RETURN);
return null();
}
@@ -6141,8 +6125,7 @@ Parser<ParseHandler>::yieldExpression(InHandling inHandling)
)
{
/* As in Python (see PEP-255), disallow return v; in generators. */
- reportBadReturn(null(), ParseError, JSMSG_BAD_GENERATOR_RETURN,
- JSMSG_BAD_ANON_GENERATOR_RETURN);
+ errorAt(begin, JSMSG_BAD_GENERATOR_RETURN);
return null();
}