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

Side by Side Diff: src/sksl/ast/SkSLASTInterfaceBlock.h

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: cleanups Created 4 years, 6 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SKSL_ASTINTERFACEBLOCK
9 #define SKSL_ASTINTERFACEBLOCK
10
11 #include "SkSLASTVarDeclaration.h"
12
13 namespace SkSL {
14
15 /**
16 * An interface block, as in:
17 *
18 * out gl_PerVertex {
19 * layout(builtin=0) vec4 gl_Position;
20 * layout(builtin=1) float gl_PointSize;
21 * };
22 */
dogben 2016/06/20 16:23:18 nit: mention that fValueName can be empty.
23 struct ASTInterfaceBlock : public ASTDeclaration {
24 ASTInterfaceBlock(Position position,
25 ASTModifiers modifiers,
dogben 2016/06/20 16:23:18 nit: seems inconsistent that this is not std::uniq
ethannicholas 2016/06/20 17:45:49 Statements and expressions are both recursive stru
26 std::string interfaceName,
27 std::string valueName,
28 std::vector<std::unique_ptr<ASTVarDeclaration>> declaratio ns)
29 : INHERITED(position, kInterfaceBlock_Kind)
30 , fModifiers(modifiers)
31 , fInterfaceName(interfaceName)
32 , fValueName(valueName)
33 , fDeclarations(std::move(declarations)) {}
34
35 std::string description() const override {
36 std::string result = fModifiers.description() + fInterfaceName + " {\n";
37 for (size_t i = 0; i < fDeclarations.size(); i++) {
38 result += fDeclarations[i]->description() + "\n";
39 }
40 result += "}";
41 if (fValueName.length()) {
42 result += " " + fValueName;
43 }
44 return result + ";";
45 }
46
47 const ASTModifiers fModifiers;
48 const std::string fInterfaceName;
49 const std::string fValueName;
50 const std::vector<std::unique_ptr<ASTVarDeclaration>> fDeclarations;
51
52 typedef ASTDeclaration INHERITED;
53 };
54
55 } // namespace
56
57 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698