diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-05-10 15:06:17 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-10 19:31:34 +0000 |
commit | 5ac13c23628c6ee8c3f6056f38527706b403e502 (patch) | |
tree | c8a96588eed9009037bd368bb155a0f990cd4cc3 /src/sksl/ir/SkSLIfStatement.h | |
parent | 37c5a96bbdeac2000c8b31d40f4786b31c39f2dd (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/SkSLIfStatement.h')
-rw-r--r-- | src/sksl/ir/SkSLIfStatement.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sksl/ir/SkSLIfStatement.h b/src/sksl/ir/SkSLIfStatement.h index 0377b1253d..b09c10ee95 100644 --- a/src/sksl/ir/SkSLIfStatement.h +++ b/src/sksl/ir/SkSLIfStatement.h @@ -17,21 +17,27 @@ namespace SkSL { * An 'if' statement. */ struct IfStatement : public Statement { - IfStatement(Position position, std::unique_ptr<Expression> test, + IfStatement(Position position, bool isStatic, std::unique_ptr<Expression> test, std::unique_ptr<Statement> ifTrue, std::unique_ptr<Statement> ifFalse) : INHERITED(position, kIf_Kind) + , fIsStatic(isStatic) , fTest(std::move(test)) , fIfTrue(std::move(ifTrue)) , fIfFalse(std::move(ifFalse)) {} String description() const override { - String result = "if (" + fTest->description() + ") " + fIfTrue->description(); + String result; + if (fIsStatic) { + result += "@"; + } + result += "if (" + fTest->description() + ") " + fIfTrue->description(); if (fIfFalse) { result += " else " + fIfFalse->description(); } return result; } + bool fIsStatic; std::unique_ptr<Expression> fTest; std::unique_ptr<Statement> fIfTrue; // may be null |