aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir/SkSLSwitchStatement.h
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-05-10 15:06:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-10 19:31:34 +0000
commit5ac13c23628c6ee8c3f6056f38527706b403e502 (patch)
treec8a96588eed9009037bd368bb155a0f990cd4cc3 /src/sksl/ir/SkSLSwitchStatement.h
parent37c5a96bbdeac2000c8b31d40f4786b31c39f2dd (diff)
sksl support for static ifs & switches
Bug: skia: Change-Id: Ic9e01a3a18efddb19bab26e92bfb473cad294fc1 Reviewed-on: https://skia-review.googlesource.com/16144 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLSwitchStatement.h')
-rw-r--r--src/sksl/ir/SkSLSwitchStatement.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sksl/ir/SkSLSwitchStatement.h b/src/sksl/ir/SkSLSwitchStatement.h
index 88e1e70019..3837554b0d 100644
--- a/src/sksl/ir/SkSLSwitchStatement.h
+++ b/src/sksl/ir/SkSLSwitchStatement.h
@@ -17,14 +17,19 @@ namespace SkSL {
* A 'switch' statement.
*/
struct SwitchStatement : public Statement {
- SwitchStatement(Position position, std::unique_ptr<Expression> value,
+ SwitchStatement(Position position, bool isStatic, std::unique_ptr<Expression> value,
std::vector<std::unique_ptr<SwitchCase>> 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 SwitchStatement : public Statement {
return result;
}
+ bool fIsStatic;
std::unique_ptr<Expression> fValue;
std::vector<std::unique_ptr<SwitchCase>> fCases;