Changeset 9e1d485 for src/AST/Init.hpp


Ignore:
Timestamp:
May 15, 2019, 3:41:08 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
69bafd2
Parents:
264e691
Message:

First draft of ast::Type with subclasses

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Init.hpp

    r264e691 r9e1d485  
    4242};
    4343
     44/// Flag for whether to construct from initialzier
     45enum ConstructFlag { DoConstruct, MaybeConstruct };
     46
    4447/// Object initializer base class
    4548class Init : public ParseNode {
    4649public:
    47         bool maybeConstructed;
     50        ConstructFlag maybeConstructed;
    4851
    49         Init( const CodeLocation& loc, bool mc ) : ParseNode( loc ), maybeConstructed( mc ) {}
     52        Init( const CodeLocation& loc, ConstructFlag mc ) : ParseNode( loc ), maybeConstructed( mc ) {}
    5053
    5154        virtual Init* accept( Visitor& v ) override = 0;
     
    6063        ptr<Expr> value;
    6164
    62         SingleInit( const CodeLocation& loc, Expr* val, bool mc = false )
     65        SingleInit( const CodeLocation& loc, Expr* val, ConstructFlag mc = DoConstruct )
    6366        : Init( loc, mc ), value( val ) {}
    6467
     
    7881
    7982        ListInit( const CodeLocation& loc, std::vector<ptr<Init>>&& is,
    80                 std::vector<ptr<Designation>>&& ds = {}, bool mc = false );
     83                std::vector<ptr<Designation>>&& ds = {}, ConstructFlag mc = DoConstruct );
    8184
    8285        using iterator = std::vector<ptr<Init>>::iterator;
     
    104107
    105108        ConstructorInit( const CodeLocation& loc, Stmt* ctor, Stmt* dtor, Init* init )
    106         : Init( loc, true ), ctor( ctor ), dtor( dtor ), init( init ) {}
     109        : Init( loc, DoConstruct ), ctor( ctor ), dtor( dtor ), init( init ) {}
    107110
    108111        Init* accept( Visitor& v ) override { return v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.