Ignore:
Timestamp:
Jun 20, 2017, 1:19:53 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
579263a
Parents:
c6d2e93
git-author:
Rob Schluntz <rschlunt@…> (06/20/17 13:16:13)
git-committer:
Rob Schluntz <rschlunt@…> (06/20/17 13:19:53)
Message:

major effort on designations, works in many cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.h

    rc6d2e93 re4d829b  
    781781};
    782782
     783struct InitAlternative {
     784public:
     785        Type * type = nullptr;
     786        Designation * designation = nullptr;
     787        InitAlternative( Type * type, Designation * designation );
     788        InitAlternative( const InitAlternative & other );
     789        InitAlternative & operator=( const Initializer & other ) = delete; // at the moment this isn't used, and I don't want to implement it
     790        ~InitAlternative();
     791};
     792
     793class UntypedInitExpr : public Expression {
     794public:
     795        UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts );
     796        UntypedInitExpr( const UntypedInitExpr & other );
     797        ~UntypedInitExpr();
     798
     799        Expression * get_expr() const { return expr; }
     800        UntypedInitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
     801
     802        std::list<InitAlternative> & get_initAlts() { return initAlts; }
     803
     804        virtual UntypedInitExpr * clone() const { return new UntypedInitExpr( * this ); }
     805        virtual void accept( Visitor & v ) { v.visit( this ); }
     806        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     807        virtual void print( std::ostream & os, int indent = 0 ) const;
     808private:
     809        Expression * expr;
     810        std::list<InitAlternative> initAlts;
     811};
     812
     813class InitExpr : public Expression {
     814public:
     815        InitExpr( Expression * expr, Type * type, Designation * designation );
     816        InitExpr( const InitExpr & other );
     817        ~InitExpr();
     818
     819        Expression * get_expr() const { return expr; }
     820        InitExpr * set_expr( Expression * newValue ) { expr = newValue; return this; }
     821
     822        Designation * get_designation() const { return designation; }
     823        InitExpr * set_designation( Designation * newValue ) { designation = newValue; return this; }
     824
     825        virtual InitExpr * clone() const { return new InitExpr( * this ); }
     826        virtual void accept( Visitor & v ) { v.visit( this ); }
     827        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     828        virtual void print( std::ostream & os, int indent = 0 ) const;
     829private:
     830        Expression * expr;
     831        Designation * designation;
     832};
     833
     834
    783835std::ostream & operator<<( std::ostream & out, const Expression * expr );
    784836
Note: See TracChangeset for help on using the changeset viewer.