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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/sksl/ast/SkSLASTDeclaration.h ('k') | src/sksl/ast/SkSLASTLayout.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SKSL_ASTINDEXSUFFIX 8 #ifndef SKSL_ASTINDEXSUFFIX
9 #define SKSL_ASTINDEXSUFFIX 9 #define SKSL_ASTINDEXSUFFIX
10 10
11 #include "SkSLASTExpression.h" 11 #include "SkSLASTExpression.h"
12 #include "SkSLASTSuffix.h" 12 #include "SkSLASTSuffix.h"
13 13
14 namespace SkSL { 14 namespace SkSL {
15 15
16 /** 16 /**
17 * A bracketed expression, as in '[0]', indicating an array access. 17 * A bracketed expression, as in '[0]', indicating an array access. Empty bracke ts (as occur in
18 * 'float[](5, 6)' are represented with a null fExpression.
18 */ 19 */
19 struct ASTIndexSuffix : public ASTSuffix { 20 struct ASTIndexSuffix : public ASTSuffix {
21 ASTIndexSuffix(Position position)
22 : INHERITED(position, ASTSuffix::kIndex_Kind)
23 , fExpression(nullptr) {}
24
20 ASTIndexSuffix(std::unique_ptr<ASTExpression> expression) 25 ASTIndexSuffix(std::unique_ptr<ASTExpression> expression)
21 : INHERITED(expression->fPosition, ASTSuffix::kIndex_Kind) 26 : INHERITED(expression ? expression->fPosition : Position(), ASTSuffix::kInd ex_Kind)
22 , fExpression(std::move(expression)) {} 27 , fExpression(std::move(expression)) {}
23 28
24 std::string description() const override { 29 std::string description() const override {
25 return "[" + fExpression->description() + "]"; 30 if (fExpression) {
31 return "[" + fExpression->description() + "]";
32 } else {
33 return "[]";
34 }
26 } 35 }
27 36
37 // may be null
28 std::unique_ptr<ASTExpression> fExpression; 38 std::unique_ptr<ASTExpression> fExpression;
29 39
30 typedef ASTSuffix INHERITED; 40 typedef ASTSuffix INHERITED;
31 }; 41 };
32 42
33 } // namespace 43 } // namespace
34 44
35 #endif 45 #endif
OLDNEW
« 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