Changeset bdd516a for translator/SynTree/Initializer.h
- Timestamp:
- Apr 28, 2015, 4:21:36 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 42e2ad7
- Parents:
- ad17ba6a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SynTree/Initializer.h
rad17ba6a rbdd516a 61 61 }; 62 62 63 // MemberInit represents an initializer for a member of an aggregate object (e.g., struct q { int a; } x = { a : 4 } )64 class MemberInit : public Initializer {65 public:66 MemberInit( Expression *value, std::string member = std::string("") );67 virtual ~MemberInit();68 69 std::string get_member() { return member; }70 void set_member( std::string newValue ) { member = newValue; }71 Expression *get_value() { return value; }72 void set_value( Expression *newValue ) { value = newValue; }73 74 virtual MemberInit *clone() const;75 virtual void accept( Visitor &v ) { v.visit( this ); }76 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }77 virtual void print( std::ostream &os, int indent = 0 );78 private:79 std::string member;80 Expression *value;81 };82 83 // ElementInit represents an initializer of an element of an array (e.g., [10] int x = { [7] : 4 }84 class ElementInit : public Initializer {85 public:86 ElementInit( Expression *value );87 virtual ~ElementInit();88 89 int get_index() { return index; }90 void set_index( int newValue ) { index = newValue; }91 Expression *get_value() { return value; }92 void set_value( Expression *newValue ) { value = newValue; }93 94 virtual ElementInit *clone() const;95 virtual void accept( Visitor &v ) { v.visit( this ); }96 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); }97 virtual void print( std::ostream &os, int indent = 0 );98 private:99 int index;100 Expression *value;101 };102 103 63 // ListInit represents an initializer that is composed recursively of a list of initializers; this is used to initialize 104 64 // an array or aggregate
Note: See TracChangeset
for help on using the changeset viewer.