source: translator/SynTree/ArrayType.cc @ 42dcae7

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 42dcae7 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: ArrayType.cc,v 1.6 2005/08/29 20:59:25 rcbilson Exp $
5 *
6 */
7
8#include "Type.h"
9#include "Expression.h"
10#include "utility.h"
11
12
13ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
14    : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic )
15{
16    base->set_isLvalue( false );
17}
18
19ArrayType::ArrayType( const ArrayType &other )
20    : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
21        isVarLen( other.isVarLen ), isStatic( other.isStatic )
22{
23}
24
25ArrayType::~ArrayType()
26{
27    delete base;
28    delete dimension;
29}
30
31void 
32ArrayType::print( std::ostream &os, int indent ) const
33{
34    Type::print( os, indent );
35    if( isStatic ) {
36        os << "static ";
37    }
38    if( isVarLen ) {
39        os << "variable length array of ";
40    } else if( dimension ) {
41        os << "array of ";
42        dimension->print( os, indent );
43    } else {
44        os << "open array of ";
45    }
46    if( base ) {
47        base->print( os, indent );
48    }
49}
50
Note: See TracBrowser for help on using the repository browser.