From 5ac13c23628c6ee8c3f6056f38527706b403e502 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Wed, 10 May 2017 15:06:17 -0400 Subject: sksl support for static ifs & switches Bug: skia: Change-Id: Ic9e01a3a18efddb19bab26e92bfb473cad294fc1 Reviewed-on: https://skia-review.googlesource.com/16144 Commit-Queue: Ethan Nicholas Reviewed-by: Ben Wagner --- src/sksl/ir/SkSLSwitchStatement.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/sksl/ir/SkSLSwitchStatement.h') 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 value, + SwitchStatement(Position position, bool isStatic, std::unique_ptr value, std::vector> 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 fValue; std::vector> fCases; -- cgit v1.2.3