summaryrefslogtreecommitdiffstats
path: root/js/src/frontend/Parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/Parser.h')
-rw-r--r--js/src/frontend/Parser.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
index 88d2dad18..243a77083 100644
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -12,6 +12,7 @@
#include "mozilla/Array.h"
#include "mozilla/Maybe.h"
+#include "jsiter.h"
#include "jspubtd.h"
#include "frontend/BytecodeCompiler.h"
@@ -496,10 +497,6 @@ class ParseContext : public Nestable<ParseContext>
return sc_->isFunctionBox() ? sc_->asFunctionBox()->generatorKind() : NotGenerator;
}
- bool isGenerator() const {
- return generatorKind() != NotGenerator;
- }
-
bool isLegacyGenerator() const {
return generatorKind() == LegacyGenerator;
}
@@ -512,6 +509,10 @@ class ParseContext : public Nestable<ParseContext>
return sc_->isFunctionBox() && sc_->asFunctionBox()->isAsync();
}
+ bool needsDotGeneratorName() const {
+ return isStarGenerator() || isLegacyGenerator() || isAsync();
+ }
+
FunctionAsyncKind asyncKind() const {
return isAsync() ? AsyncFunction : SyncFunction;
}
@@ -818,7 +819,9 @@ class ParserBase : public StrictModeGetter
// whether it's prohibited due to strictness, JS version, or occurrence
// inside a star generator.
bool yieldExpressionsSupported() {
- return (versionNumber() >= JSVERSION_1_7 || pc->isGenerator()) && !pc->isAsync();
+ return (versionNumber() >= JSVERSION_1_7 && !pc->isAsync()) ||
+ pc->isStarGenerator() ||
+ pc->isLegacyGenerator();
}
virtual bool strictMode() { return pc->sc()->strict(); }
@@ -1108,8 +1111,6 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
inline Node newName(PropertyName* name);
inline Node newName(PropertyName* name, TokenPos pos);
- inline Node newYieldExpression(uint32_t begin, Node expr, bool isYieldStar = false);
- inline Node newAwaitExpression(uint32_t begin, Node expr);
inline bool abortIfSyntaxParser();
@@ -1196,6 +1197,7 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
Node forStatement(YieldHandling yieldHandling);
bool forHeadStart(YieldHandling yieldHandling,
+ IteratorKind iterKind,
ParseNodeKind* forHeadKind,
Node* forInitialPart,
mozilla::Maybe<ParseContext::Scope>& forLetImpliedScope,