diff options
Diffstat (limited to 'src/sksl/SkSLIRGenerator.h')
-rw-r--r-- | src/sksl/SkSLIRGenerator.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/sksl/SkSLIRGenerator.h b/src/sksl/SkSLIRGenerator.h index 13b20fbbcc..2ffcb0df26 100644 --- a/src/sksl/SkSLIRGenerator.h +++ b/src/sksl/SkSLIRGenerator.h @@ -88,7 +88,16 @@ public: std::unique_ptr<ModifiersDeclaration> convertModifiersDeclaration( const ASTModifiersDeclaration& m); + /** + * If both operands are compile-time constants and can be folded, returns an expression + * representing the folded value. Otherwise, returns null. Note that unlike most other functions + * here, null does not represent a compilation error. + */ + std::unique_ptr<Expression> constantFold(const Expression& left, + Token::Kind op, + const Expression& right) const; Program::Inputs fInputs; + const Context& fContext; private: /** @@ -124,11 +133,6 @@ private: std::unique_ptr<Statement> convertDiscard(const ASTDiscardStatement& d); std::unique_ptr<Statement> convertDo(const ASTDoStatement& d); std::unique_ptr<Expression> convertBinaryExpression(const ASTBinaryExpression& expression); - // Returns null if it cannot fold the expression. Note that unlike most other functions here, a - // null return does not represent a compilation error. - std::unique_ptr<Expression> constantFold(const Expression& left, - Token::Kind op, - const Expression& right); std::unique_ptr<Extension> convertExtension(const ASTExtension& e); std::unique_ptr<Statement> convertExpressionStatement(const ASTExpressionStatement& s); std::unique_ptr<Statement> convertFor(const ASTForStatement& f); @@ -151,10 +155,8 @@ private: std::unique_ptr<Statement> convertWhile(const ASTWhileStatement& w); void checkValid(const Expression& expr); - void markReadFrom(const Variable& var); - void markWrittenTo(const Expression& expr); + void markWrittenTo(const Expression& expr, bool readWrite); - const Context& fContext; const FunctionDeclaration* fCurrentFunction; const Program::Settings* fSettings; std::unordered_map<SkString, CapValue> fCapsMap; |