diff options
author | 2016-09-26 11:58:52 -0700 | |
---|---|---|
committer | 2016-09-26 11:58:52 -0700 | |
commit | b12b3c6908c62c908b3680be01e3b5bfd30de310 (patch) | |
tree | b591f6b46363388600fbba3ca21fbf11a5f9aeff /src/sksl/ast/SkSLASTIndexSuffix.h | |
parent | 1d08998e4fb81755978f3d1c11744a6c77ddab2e (diff) |
Turned on SkSL->GLSL compiler
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2288033003
Committed: https://skia.googlesource.com/skia/+/9b0fe3d125f237d9884732a48414fa85fc71b4e3
Review-Url: https://codereview.chromium.org/2288033003
Diffstat (limited to 'src/sksl/ast/SkSLASTIndexSuffix.h')
-rw-r--r-- | src/sksl/ast/SkSLASTIndexSuffix.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sksl/ast/SkSLASTIndexSuffix.h b/src/sksl/ast/SkSLASTIndexSuffix.h index 44d91fa4c4..755029b0a2 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; |