Remove the ModifiersPool argument to FunctionDeclaration::Convert.

The modifier pool is in the Context now and doesn't need to be passed
separately.

Change-Id: I92388ebfd4dfd69360455efa1b1e2558c512a950
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404341
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
John Stiles 2021-05-04 17:41:53 -04:00 committed by Skia Commit-Bot
parent 34db2ddc92
commit 0b822795af
4 changed files with 6 additions and 8 deletions

View File

@ -1010,7 +1010,6 @@ void IRGenerator::convertFunction(const ASTNode& f) {
const FunctionDeclaration* decl = FunctionDeclaration::Convert(
fContext,
*fSymbolTable,
this->modifiersPool(),
f.fOffset,
this->modifiersPool().add(declModifiers),
funcData.fName,

View File

@ -66,7 +66,7 @@ void DSLFunction::init(const DSLType& returnType, const char* name,
}
fDecl = SkSL::FunctionDeclaration::Convert(DSLWriter::Context(),
*DSLWriter::SymbolTable(),
*DSLWriter::Context().fModifiersPool, /*offset=*/-1,
/*offset=*/-1,
DSLWriter::Modifiers(SkSL::Modifiers()),
isMain ? name : DSLWriter::Name(name),
std::move(paramVars), fReturnType,

View File

@ -47,7 +47,7 @@ static bool check_return_type(const Context& context, int offset, const Type& re
return true;
}
static bool check_parameters(const Context& context, ModifiersPool& modifiersPool,
static bool check_parameters(const Context& context,
std::vector<std::unique_ptr<Variable>>& parameters, bool isMain,
bool isBuiltin) {
auto typeIsValidForColor = [&](const Type& type) {
@ -83,7 +83,7 @@ static bool check_parameters(const Context& context, ModifiersPool& modifiersPoo
m.fLayout.fBuiltin = SK_INPUT_COLOR_BUILTIN;
}
if (m.fLayout.fBuiltin) {
param->setModifiers(modifiersPool.add(m));
param->setModifiers(context.fModifiersPool->add(m));
}
}
if (isMain && (kind == ProgramKind::kFragment)) {
@ -92,7 +92,7 @@ static bool check_parameters(const Context& context, ModifiersPool& modifiersPoo
// coords parameter. We turn it into sk_FragCoord.
if (type == *context.fTypes.fFloat2) {
m.fLayout.fBuiltin = SK_FRAGCOORD_BUILTIN;
param->setModifiers(modifiersPool.add(m));
param->setModifiers(context.fModifiersPool->add(m));
}
}
}
@ -267,7 +267,7 @@ static bool find_existing_declaration(const Context& context, SymbolTable& symbo
}
const FunctionDeclaration* FunctionDeclaration::Convert(const Context& context,
SymbolTable& symbols, ModifiersPool& modifiersPool, int offset, const Modifiers* modifiers,
SymbolTable& symbols, int offset, const Modifiers* modifiers,
StringFragment name, std::vector<std::unique_ptr<Variable>> parameters,
const Type* returnType, bool isBuiltin) {
bool isMain = (name == "main");
@ -275,7 +275,7 @@ const FunctionDeclaration* FunctionDeclaration::Convert(const Context& context,
const FunctionDeclaration* decl = nullptr;
if (!check_modifiers(context, offset, *modifiers) ||
!check_return_type(context, offset, *returnType, isBuiltin) ||
!check_parameters(context, modifiersPool, parameters, isMain, isBuiltin) ||
!check_parameters(context, parameters, isMain, isBuiltin) ||
(isMain && !check_main_signature(context, offset, *returnType, parameters, isBuiltin)) ||
!find_existing_declaration(context, symbols, offset, name, parameters, returnType,
isBuiltin, &decl)) {

View File

@ -41,7 +41,6 @@ public:
static const FunctionDeclaration* Convert(const Context& context,
SymbolTable& symbols,
ModifiersPool& modifiersPool,
int offset,
const Modifiers* modifiers,
StringFragment name,