aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ast/SkSLASTSwitchStatement.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/ast/SkSLASTSwitchStatement.h')
-rw-r--r--src/sksl/ast/SkSLASTSwitchStatement.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sksl/ast/SkSLASTSwitchStatement.h b/src/sksl/ast/SkSLASTSwitchStatement.h
index 4a963ebc7a..ecd0a6755d 100644
--- a/src/sksl/ast/SkSLASTSwitchStatement.h
+++ b/src/sksl/ast/SkSLASTSwitchStatement.h
@@ -17,14 +17,19 @@ namespace SkSL {
* A 'switch' statement.
*/
struct ASTSwitchStatement : public ASTStatement {
- ASTSwitchStatement(Position position, std::unique_ptr<ASTExpression> value,
+ ASTSwitchStatement(Position position, bool isStatic, std::unique_ptr<ASTExpression> value,
std::vector<std::unique_ptr<ASTSwitchCase>> cases)
: INHERITED(position, kSwitch_Kind)
+ , fIsStatic(isStatic)
, fValue(std::move(value))
, fCases(std::move(cases)) {}
String description() const override {
- String result = String::printf("switch (%s) {\n", + fValue->description().c_str());
+ String result;
+ if (fIsStatic) {
+ result += "@";
+ }
+ result += String::printf("switch (%s) {\n", fValue->description().c_str());
for (const auto& c : fCases) {
result += c->description();
}
@@ -32,6 +37,7 @@ struct ASTSwitchStatement : public ASTStatement {
return result;
}
+ bool fIsStatic;
const std::unique_ptr<ASTExpression> fValue;
const std::vector<std::unique_ptr<ASTSwitchCase>> fCases;