mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-31 11:37:30 +09:00
1336783 - Part 1: Rework on reserved word and remove TokenStream::KeywordIsName.
This commit is contained in:
parent
2d3bf3352c
commit
c1f6b0ff36
15 changed files with 851 additions and 722 deletions
|
|
@ -734,6 +734,9 @@ class UsedNameTracker
|
|||
}
|
||||
};
|
||||
|
||||
template <typename ParseHandler>
|
||||
class AutoAwaitIsKeyword;
|
||||
|
||||
class ParserBase : public StrictModeGetter
|
||||
{
|
||||
private:
|
||||
|
|
@ -783,7 +786,13 @@ class ParserBase : public StrictModeGetter
|
|||
/* Unexpected end of input, i.e. TOK_EOF not at top-level. */
|
||||
bool isUnexpectedEOF_:1;
|
||||
|
||||
bool awaitIsKeyword_:1;
|
||||
|
||||
public:
|
||||
bool awaitIsKeyword() const {
|
||||
return awaitIsKeyword_;
|
||||
}
|
||||
|
||||
ParserBase(ExclusiveContext* cx, LifoAlloc& alloc, const ReadOnlyCompileOptions& options,
|
||||
const char16_t* chars, size_t length, bool foldConstants,
|
||||
UsedNameTracker& usedNames, Parser<SyntaxParseHandler>* syntaxParser,
|
||||
|
|
@ -998,6 +1007,9 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
|
|||
Parser<SyntaxParseHandler>* syntaxParser, LazyScript* lazyOuterFunction);
|
||||
~Parser();
|
||||
|
||||
friend class AutoAwaitIsKeyword<ParseHandler>;
|
||||
void setAwaitIsKeyword(bool isKeyword);
|
||||
|
||||
bool checkOptions();
|
||||
|
||||
// A Parser::Mark is the extension of the LifoAlloc::Mark to the entire
|
||||
|
|
@ -1047,8 +1059,6 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
|
|||
|
||||
void trace(JSTracer* trc);
|
||||
|
||||
bool checkUnescapedName();
|
||||
|
||||
private:
|
||||
Parser* thisForCtor() { return this; }
|
||||
|
||||
|
|
@ -1321,17 +1331,18 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
|
|||
Node classDefinition(YieldHandling yieldHandling, ClassContext classContext,
|
||||
DefaultHandling defaultHandling);
|
||||
|
||||
PropertyName* labelOrIdentifierReference(YieldHandling yieldHandling,
|
||||
bool yieldTokenizedAsName);
|
||||
PropertyName* checkLabelOrIdentifierReference(PropertyName* ident,
|
||||
uint32_t offset,
|
||||
YieldHandling yieldHandling);
|
||||
|
||||
PropertyName* labelOrIdentifierReference(YieldHandling yieldHandling);
|
||||
|
||||
PropertyName* labelIdentifier(YieldHandling yieldHandling) {
|
||||
return labelOrIdentifierReference(yieldHandling, false);
|
||||
return labelOrIdentifierReference(yieldHandling);
|
||||
}
|
||||
|
||||
PropertyName* identifierReference(YieldHandling yieldHandling,
|
||||
bool yieldTokenizedAsName = false)
|
||||
{
|
||||
return labelOrIdentifierReference(yieldHandling, yieldTokenizedAsName);
|
||||
PropertyName* identifierReference(YieldHandling yieldHandling) {
|
||||
return labelOrIdentifierReference(yieldHandling);
|
||||
}
|
||||
|
||||
PropertyName* importedBinding() {
|
||||
|
|
@ -1455,6 +1466,25 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
|
|||
bool asmJS(Node list);
|
||||
};
|
||||
|
||||
template <typename ParseHandler>
|
||||
class MOZ_STACK_CLASS AutoAwaitIsKeyword
|
||||
{
|
||||
private:
|
||||
Parser<ParseHandler>* parser_;
|
||||
bool oldAwaitIsKeyword_;
|
||||
|
||||
public:
|
||||
AutoAwaitIsKeyword(Parser<ParseHandler>* parser, bool awaitIsKeyword) {
|
||||
parser_ = parser;
|
||||
oldAwaitIsKeyword_ = parser_->awaitIsKeyword_;
|
||||
parser_->setAwaitIsKeyword(awaitIsKeyword);
|
||||
}
|
||||
|
||||
~AutoAwaitIsKeyword() {
|
||||
parser_->setAwaitIsKeyword(oldAwaitIsKeyword_);
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue