Added DSL error for opaque types in structs

Change-Id: I3fc35b2d5c5c0d1b533c165496d604fb7ac6e119
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443178
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Ethan Nicholas 2021-08-29 12:42:38 -04:00 committed by SkCQ
parent 79c8899eba
commit 772061e836

View File

@ -220,7 +220,12 @@ DSLType Struct(skstd::string_view name, SkSpan<DSLField> fields, PositionInfo po
std::vector<SkSL::Type::Field> skslFields;
skslFields.reserve(fields.size());
for (const DSLField& field : fields) {
skslFields.emplace_back(field.fModifiers.fModifiers, field.fName, &field.fType.skslType());
const SkSL::Type& type = field.fType.skslType();
if (type.isOpaque()) {
DSLWriter::ReportError(("opaque type '" + type.displayName() +
"' is not permitted in a struct").c_str(), pos);
}
skslFields.emplace_back(field.fModifiers.fModifiers, field.fName, &type);
}
const SkSL::Type* result = DSLWriter::SymbolTable()->add(Type::MakeStructType(pos.offset(),
name,