Simplify addArrayDimensions by removing multi-dimensional array support.
There's no need to pass in an array of multiple dimensions when only one
dimension is supported by the language.
Change-Id: Id170e96e1c0e8f83a79a85e4a737792677044150
Bug: skia:11026
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340659
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index f30145e..69870a5 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -402,7 +402,7 @@
} else {
arraySize = Type::kUnsizedArray;
}
- type = fSymbolTable->addArrayDimensions(type, {arraySize});
+ type = fSymbolTable->addArrayDimension(type, arraySize);
}
}
auto var = std::make_unique<Variable>(varDecl.fOffset, fModifiers->addToPool(modifiers),
@@ -903,7 +903,7 @@
}
if (pd.fIsArray) {
int arraySize = (paramIter++)->getInt();
- type = fSymbolTable->addArrayDimensions(type, {arraySize});
+ type = fSymbolTable->addArrayDimension(type, arraySize);
}
// Only the (builtin) declarations of 'sample' are allowed to have FP parameters
if ((type->nonnullable() == *fContext.fFragmentProcessor_Type && !fIsBuiltinCode) ||
@@ -1164,7 +1164,7 @@
} else {
arraySize = Type::kUnsizedArray;
}
- type = symbols->addArrayDimensions(type, {arraySize});
+ type = symbols->addArrayDimension(type, arraySize);
}
const Variable* var = old->takeOwnershipOfSymbol(
std::make_unique<Variable>(intf.fOffset,
@@ -1319,7 +1319,7 @@
if (isArray) {
auto iter = type.begin();
int arraySize = *iter ? iter->getInt() : Type::kUnsizedArray;
- result = fSymbolTable->addArrayDimensions(result, {arraySize});
+ result = fSymbolTable->addArrayDimension(result, arraySize);
}
return result;
}
@@ -2459,10 +2459,9 @@
const ASTNode& index) {
if (base->kind() == Expression::Kind::kTypeReference) {
if (index.fKind == ASTNode::Kind::kInt) {
- const Type& oldType = base->as<TypeReference>().value();
- SkSTArray<1, int> dimension = {index.getInt()};
- const Type* newType = fSymbolTable->addArrayDimensions(&oldType, dimension);
- return std::make_unique<TypeReference>(fContext, base->fOffset, newType);
+ const Type* type = &base->as<TypeReference>().value();
+ type = fSymbolTable->addArrayDimension(type, index.getInt());
+ return std::make_unique<TypeReference>(fContext, base->fOffset, type);
} else {
fErrors.error(base->fOffset, "array size must be a constant");