summaryrefslogtreecommitdiffstats
path: root/gfx/angle/checkout/src/compiler/translator/Declarator.cpp
blob: 7680c054d350a3b9935840d17873596f5d9b3613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Declarator.cpp:
//   Declarator type for parsing structure field declarators.

#include "compiler/translator/Declarator.h"

namespace sh
{

TDeclarator::TDeclarator(const ImmutableString &name, const TSourceLoc &line)
    : mName(name), mArraySizes(nullptr), mLine(line)
{
    ASSERT(mName != "");
}

TDeclarator::TDeclarator(const ImmutableString &name,
                         const TVector<unsigned int> *arraySizes,
                         const TSourceLoc &line)
    : mName(name), mArraySizes(arraySizes), mLine(line)
{
    ASSERT(mArraySizes);
}

bool TDeclarator::isArray() const
{
    return mArraySizes != nullptr && mArraySizes->size() > 0;
}

}  // namespace sh