diff options
Diffstat (limited to 'src/sksl/ir/SkSLExpression.h')
-rw-r--r-- | src/sksl/ir/SkSLExpression.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sksl/ir/SkSLExpression.h b/src/sksl/ir/SkSLExpression.h index 5db9ddf96f..07dad1d7df 100644 --- a/src/sksl/ir/SkSLExpression.h +++ b/src/sksl/ir/SkSLExpression.h @@ -48,11 +48,24 @@ struct Expression : public IRNode { , fKind(kind) , fType(std::move(type)) {} + /** + * Returns true if this expression is constant. compareConstant must be implemented for all + * constants! + */ virtual bool isConstant() const { return false; } /** + * Compares this constant expression against another constant expression of the same type. It is + * an error to call this on non-constant expressions, or if the types of the expressions do not + * match. + */ + virtual bool compareConstant(const Context& context, const Expression& other) const { + ABORT("cannot call compareConstant on this type"); + } + + /** * Returns true if evaluating the expression potentially has side effects. Expressions may never * return false if they actually have side effects, but it is legal (though suboptimal) to * return true if there are not actually any side effects. |