Remove Type::containsPrivateFields
.
`Type::isPrivate` now works properly even on structs and arrays, so we don't need two separate methods anymore. Change-Id: Ic3e16e1315ebb0c8cec575f109af7e472a11ac8c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/455660 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
4008c5a3b0
commit
9efdc041bb
@ -208,10 +208,7 @@ const SkSL::Type& DSLType::skslType() const {
|
||||
bool DSLType::reportIllegalTypes(PositionInfo pos) const {
|
||||
if (!DSLWriter::IsModule()) {
|
||||
const SkSL::Type* type = &this->skslType();
|
||||
while (type->isArray()) {
|
||||
type = &type->componentType();
|
||||
}
|
||||
if (type->containsPrivateFields()) {
|
||||
if (type->isPrivate()) {
|
||||
DSLWriter::ReportError("type '" + String(type->name()) + "' is private", pos);
|
||||
return true;
|
||||
}
|
||||
|
@ -53,6 +53,10 @@ public:
|
||||
return this->componentType().bitWidth();
|
||||
}
|
||||
|
||||
bool isPrivate() const override {
|
||||
return fComponentType.isPrivate();
|
||||
}
|
||||
|
||||
bool allowedInES2() const override {
|
||||
return fComponentType.allowedInES2();
|
||||
}
|
||||
@ -321,6 +325,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isPrivate() const override {
|
||||
return std::any_of(fFields.begin(), fFields.end(), [](const Field& f) {
|
||||
return f.fType->isPrivate();
|
||||
});
|
||||
}
|
||||
|
||||
bool allowedInES2() const override {
|
||||
return std::all_of(fFields.begin(), fFields.end(), [](const Field& f) {
|
||||
return f.fType->allowedInES2();
|
||||
@ -756,21 +766,6 @@ bool Type::isOrContainsArray() const {
|
||||
return this->isArray();
|
||||
}
|
||||
|
||||
|
||||
bool Type::containsPrivateFields() const {
|
||||
if (this->isPrivate()) {
|
||||
return true;
|
||||
}
|
||||
if (this->isStruct()) {
|
||||
for (const auto& f : this->fields()) {
|
||||
if (f.fType->containsPrivateFields()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::isTooDeeplyNested(int limit) const {
|
||||
if (limit < 0) {
|
||||
return true;
|
||||
|
@ -191,7 +191,8 @@ public:
|
||||
return this->displayName();
|
||||
}
|
||||
|
||||
bool isPrivate() const {
|
||||
/** Returns true if this type is either private, or contains a private field (recursively). */
|
||||
virtual bool isPrivate() const {
|
||||
return this->name().starts_with("$");
|
||||
}
|
||||
|
||||
@ -509,12 +510,6 @@ public:
|
||||
|
||||
bool isOrContainsArray() const;
|
||||
|
||||
/**
|
||||
* Returns true if this type is either itself private or is a struct which contains private
|
||||
* fields (recursively).
|
||||
*/
|
||||
bool containsPrivateFields() const;
|
||||
|
||||
/**
|
||||
* Returns true if this type is a struct that is too deeply nested.
|
||||
*/
|
||||
|
@ -20,12 +20,12 @@ error: 20: type 'ushort' is not supported
|
||||
error: 21: type 'ushort2' is not supported
|
||||
error: 22: type 'ushort3' is not supported
|
||||
error: 23: type 'ushort4' is not supported
|
||||
error: 25: type 'uint4' is not supported
|
||||
error: 26: type 'ushort' is not supported
|
||||
error: 27: type 'float2x3' is not supported
|
||||
error: 25: type 'uint4[2]' is not supported
|
||||
error: 26: type 'ushort[2]' is not supported
|
||||
error: 27: type 'float2x3[2]' is not supported
|
||||
error: 29: type 'half4x2' is not supported
|
||||
error: 30: type 'ushort' is not supported
|
||||
error: 31: type 'uint' is not supported
|
||||
error: 31: type 'uint[2]' is not supported
|
||||
error: 33: type 'float2x3' is not supported
|
||||
error: 34: type 'half4x2' is not supported
|
||||
error: 35: type 'uint' is not supported
|
||||
|
Loading…
Reference in New Issue
Block a user