1 | // |
---|---|
2 | // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. |
3 | // Use of this source code is governed by a BSD-style license that can be |
4 | // found in the LICENSE file. |
5 | // |
6 | // Declarator.cpp: |
7 | // Declarator type for parsing structure field declarators. |
8 | |
9 | #include "compiler/translator/Declarator.h" |
10 | |
11 | namespace sh |
12 | { |
13 | |
14 | TDeclarator::TDeclarator(const ImmutableString &name, const TSourceLoc &line) |
15 | : mName(name), mArraySizes(nullptr), mLine(line) |
16 | { |
17 | ASSERT(mName != ""); |
18 | } |
19 | |
20 | TDeclarator::TDeclarator(const ImmutableString &name, |
21 | const TVector<unsigned int> *arraySizes, |
22 | const TSourceLoc &line) |
23 | : mName(name), mArraySizes(arraySizes), mLine(line) |
24 | { |
25 | ASSERT(mArraySizes); |
26 | } |
27 | |
28 | bool TDeclarator::isArray() const |
29 | { |
30 | return mArraySizes != nullptr && mArraySizes->size() > 0; |
31 | } |
32 | |
33 | } // namespace sh |
34 |