Line data Source code
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 0 : struct ASTType : public ASTPositionNode {
19 : enum Kind {
20 : kIdentifier_Kind,
21 : kStruct_Kind
22 : };
23 :
24 0 : ASTType(Position position, String name, Kind kind, std::vector<int> sizes)
25 0 : : INHERITED(position)
26 0 : , fName(std::move(name))
27 : , fKind(kind)
28 0 : , fSizes(std::move(sizes)) {}
29 :
30 0 : String description() const override {
31 0 : 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
|