#include <SkSLIfStatement.h>
An 'if' statement.
Definition at line 27 of file SkSLIfStatement.h.
◆ IfStatement()
Definition at line 31 of file SkSLIfStatement.h.
34 , fTest(std::move(
test))
35 , fIfTrue(std::move(
ifTrue))
36 , fIfFalse(std::move(
ifFalse)) {}
static constexpr Kind kIRNodeKind
std::unique_ptr< Statement > & ifTrue()
std::unique_ptr< Statement > & ifFalse()
◆ Convert()
Definition at line 32 of file SkSLIfStatement.cpp.
36 {
37 test = context.fTypes.fBool->coerceExpression(std::move(
test), context);
39 return nullptr;
40 }
43 return nullptr;
44 }
46 return nullptr;
47 }
49}
static std::unique_ptr< Statement > Make(const Context &context, Position pos, std::unique_ptr< Expression > test, std::unique_ptr< Statement > ifTrue, std::unique_ptr< Statement > ifFalse)
bool DetectVarDeclarationWithoutScope(const Statement &stmt, ErrorReporter *errors=nullptr)
◆ description()
std::string SkSL::IfStatement::description |
( |
| ) |
const |
|
overridevirtual |
◆ ifFalse() [1/2]
std::unique_ptr< Statement > & SkSL::IfStatement::ifFalse |
( |
| ) |
|
|
inline |
◆ ifFalse() [2/2]
const std::unique_ptr< Statement > & SkSL::IfStatement::ifFalse |
( |
| ) |
const |
|
inline |
◆ ifTrue() [1/2]
std::unique_ptr< Statement > & SkSL::IfStatement::ifTrue |
( |
| ) |
|
|
inline |
◆ ifTrue() [2/2]
const std::unique_ptr< Statement > & SkSL::IfStatement::ifTrue |
( |
| ) |
const |
|
inline |
◆ Make()
Definition at line 57 of file SkSLIfStatement.cpp.
61 {
65
66 const bool optimize = context.fConfig->fSettings.fOptimize;
67 bool trueIsEmpty = false;
68 bool falseIsEmpty = false;
69
71
72 trueIsEmpty =
ifTrue->isEmpty();
74 if (trueIsEmpty && falseIsEmpty) {
76 }
77 }
78
80
82 if (testValue->isBoolLiteral()) {
83 if (testValue->as<Literal>().boolValue()) {
85 } else {
87 }
88 }
89 }
90
92
94 if (falseIsEmpty) {
96 }
97 }
98
99 return std::make_unique<IfStatement>(
101}
static SkTileMode optimize(SkTileMode tm, int dimension)
static const Expression * GetConstantValueForVariable(const Expression &value)
static std::unique_ptr< Statement > Make(const Context &context, std::unique_ptr< Expression > expr)
static std::unique_ptr< Statement > replace_empty_with_nop(std::unique_ptr< Statement > stmt, bool isEmpty)
◆ test() [1/2]
std::unique_ptr< Expression > & SkSL::IfStatement::test |
( |
| ) |
|
|
inline |
◆ test() [2/2]
const std::unique_ptr< Expression > & SkSL::IfStatement::test |
( |
| ) |
const |
|
inline |
◆ kIRNodeKind
constexpr Kind SkSL::IfStatement::kIRNodeKind = Kind::kIf |
|
inlinestaticconstexpr |
The documentation for this class was generated from the following files: