diff options
Diffstat (limited to 'src/sksl/ir')
-rw-r--r-- | src/sksl/ir/SkSLBlock.h | 2 | ||||
-rw-r--r-- | src/sksl/ir/SkSLIfStatement.h | 10 | ||||
-rw-r--r-- | src/sksl/ir/SkSLSwitchStatement.h | 10 |
3 files changed, 17 insertions, 5 deletions
diff --git a/src/sksl/ir/SkSLBlock.h b/src/sksl/ir/SkSLBlock.h index 11976660b7..bcd4bb1b59 100644 --- a/src/sksl/ir/SkSLBlock.h +++ b/src/sksl/ir/SkSLBlock.h @@ -18,7 +18,7 @@ namespace SkSL { */ struct Block : public Statement { Block(Position position, std::vector<std::unique_ptr<Statement>> statements, - const std::shared_ptr<SymbolTable> symbols) + const std::shared_ptr<SymbolTable> symbols = nullptr) : INHERITED(position, kBlock_Kind) , fSymbols(std::move(symbols)) , fStatements(std::move(statements)) {} 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 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; |