Bug 1585234 - Part 1: Remove unnecessary Variant wrap/match on context. r=Yoric
A half of Parser methods are using single context type, and remaining are using 2 context types. There are no place that uses 3 context types necessarily. Part 1 modifies the code generator to collect context type information, and reflect the information to Parser methods, to use single non-Variant type if possible. Also changed corresponding TokenReader methods to use single non-Variant type. Differential Revision: https://phabricator.services.mozilla.com/D48011
This commit is contained in:
@@ -134,7 +134,7 @@ JS::Result<ParseNode*> BinASTParserPerTokenizer<Tok>::parseAux(
|
||||
MOZ_TRY(tokenizer_->readHeader());
|
||||
|
||||
ParseNode* result(nullptr);
|
||||
const Context topContext((RootContext()));
|
||||
const auto topContext = RootContext();
|
||||
MOZ_TRY_VAR(result, asFinalParser()->parseProgram(topContext));
|
||||
|
||||
mozilla::Maybe<GlobalScope::Data*> bindings =
|
||||
@@ -197,7 +197,7 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::parseLazyFunction(
|
||||
|
||||
// Inject a toplevel context (i.e. no parent) to parse the lazy content.
|
||||
// In the future, we may move this to a more specific context.
|
||||
const Context context((RootContext()));
|
||||
const auto context = Context(RootContext());
|
||||
MOZ_TRY(
|
||||
(asFinalParser()->*parseFunc)(func->nargs(), ¶ms, &tmpBody, context));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user