Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Unified Diff: src/sksl/ast/SkSLASTIndexSuffix.h

Issue 2288033003: Turned on SkSL->GLSL compiler (Closed)
Patch Set: changed <iostream> to <ostream> Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/ast/SkSLASTDeclaration.h ('k') | src/sksl/ast/SkSLASTLayout.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/sksl/ast/SkSLASTIndexSuffix.h
diff --git a/src/sksl/ast/SkSLASTIndexSuffix.h b/src/sksl/ast/SkSLASTIndexSuffix.h
index 44d91fa4c4c11e4da9270bbab49130ebe9f49092..755029b0a212ffa03d744760627dd7c85907fb88 100644
--- a/src/sksl/ast/SkSLASTIndexSuffix.h
+++ b/src/sksl/ast/SkSLASTIndexSuffix.h
@@ -14,17 +14,27 @@
namespace SkSL {
/**
- * A bracketed expression, as in '[0]', indicating an array access.
+ * A bracketed expression, as in '[0]', indicating an array access. Empty brackets (as occur in
+ * 'float[](5, 6)' are represented with a null fExpression.
*/
struct ASTIndexSuffix : public ASTSuffix {
+ ASTIndexSuffix(Position position)
+ : INHERITED(position, ASTSuffix::kIndex_Kind)
+ , fExpression(nullptr) {}
+
ASTIndexSuffix(std::unique_ptr<ASTExpression> expression)
- : INHERITED(expression->fPosition, ASTSuffix::kIndex_Kind)
+ : INHERITED(expression ? expression->fPosition : Position(), ASTSuffix::kIndex_Kind)
, fExpression(std::move(expression)) {}
std::string description() const override {
- return "[" + fExpression->description() + "]";
+ if (fExpression) {
+ return "[" + fExpression->description() + "]";
+ } else {
+ return "[]";
+ }
}
+ // may be null
std::unique_ptr<ASTExpression> fExpression;
typedef ASTSuffix INHERITED;
« no previous file with comments | « src/sksl/ast/SkSLASTDeclaration.h ('k') | src/sksl/ast/SkSLASTLayout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698