| [c468150] | 1 | // | 
|---|
|  | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo | 
|---|
|  | 3 | // | 
|---|
|  | 4 | // The contents of this file are covered under the licence agreement in the | 
|---|
|  | 5 | // file "LICENCE" distributed with Cforall. | 
|---|
|  | 6 | // | 
|---|
|  | 7 | // InitializerNode.h -- | 
|---|
|  | 8 | // | 
|---|
|  | 9 | // Author           : Andrew Beach | 
|---|
|  | 10 | // Created On       : Wed Apr  5 11:31:00 2023 | 
|---|
|  | 11 | // Last Modified By : Andrew Beach | 
|---|
|  | 12 | // Last Modified On : Wed Apr  5 11:48:00 2023 | 
|---|
|  | 13 | // Update Count     : 0 | 
|---|
|  | 14 | // | 
|---|
|  | 15 |  | 
|---|
|  | 16 | #pragma once | 
|---|
|  | 17 |  | 
|---|
|  | 18 | #include "ParseNode.h" | 
|---|
|  | 19 |  | 
|---|
|  | 20 | class InitializerNode : public ParseNode { | 
|---|
|  | 21 | public: | 
|---|
|  | 22 | InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode * des = nullptr ); | 
|---|
|  | 23 | InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr ); | 
|---|
|  | 24 | InitializerNode( bool isDelete ); | 
|---|
|  | 25 | ~InitializerNode(); | 
|---|
|  | 26 | virtual InitializerNode * clone() const { assert( false ); return nullptr; } | 
|---|
|  | 27 |  | 
|---|
|  | 28 | ExpressionNode * get_expression() const { return expr; } | 
|---|
|  | 29 |  | 
|---|
|  | 30 | InitializerNode * set_designators( ExpressionNode * des ) { designator = des; return this; } | 
|---|
|  | 31 | ExpressionNode * get_designators() const { return designator; } | 
|---|
|  | 32 |  | 
|---|
|  | 33 | InitializerNode * set_maybeConstructed( bool value ) { maybeConstructed = value; return this; } | 
|---|
|  | 34 | bool get_maybeConstructed() const { return maybeConstructed; } | 
|---|
|  | 35 |  | 
|---|
|  | 36 | bool get_isDelete() const { return isDelete; } | 
|---|
|  | 37 |  | 
|---|
|  | 38 | InitializerNode * next_init() const { return kids; } | 
|---|
|  | 39 |  | 
|---|
|  | 40 | void print( std::ostream & os, int indent = 0 ) const; | 
|---|
|  | 41 | void printOneLine( std::ostream & ) const; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | virtual ast::Init * build() const; | 
|---|
|  | 44 | private: | 
|---|
|  | 45 | ExpressionNode * expr; | 
|---|
|  | 46 | bool aggregate; | 
|---|
|  | 47 | ExpressionNode * designator;                        // may be list | 
|---|
|  | 48 | InitializerNode * kids; | 
|---|
|  | 49 | bool maybeConstructed; | 
|---|
|  | 50 | bool isDelete; | 
|---|
|  | 51 | }; // InitializerNode | 
|---|