• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_ASTTYPE
9 #define SKSL_ASTTYPE
10 
11 #include "SkSLASTPositionNode.h"
12 
13 namespace SkSL {
14 
15 /**
16  * A type, such as 'int' or 'struct foo'.
17  */
18 struct ASTType : public ASTPositionNode {
19     enum Kind {
20         kIdentifier_Kind,
21         kStruct_Kind
22     };
23 
ASTTypeASTType24     ASTType(Position position, String name, Kind kind, std::vector<int> sizes)
25     : INHERITED(position)
26     , fName(std::move(name))
27     , fKind(kind)
28     , fSizes(std::move(sizes)) {}
29 
descriptionASTType30     String description() const override {
31         return fName;
32     }
33 
34     const String fName;
35 
36     const Kind fKind;
37 
38     // array sizes, -1 meaning unspecified
39     const std::vector<int> fSizes;
40 
41     typedef ASTPositionNode INHERITED;
42 };
43 
44 } // namespace
45 
46 #endif
47