Changeset b0d9ff7 for src/SynTree/Expression.h
- Timestamp:
- Sep 1, 2022, 1:27:52 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 12df6fe
- Parents:
- def751f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
rdef751f rb0d9ff7 166 166 class QualifiedNameExpr : public Expression { 167 167 public: 168 Type * type; // Convert to [parent] QualifiedNameExpr 169 std::string name; // Convert from NameExpr 170 171 QualifiedNameExpr( Type * type, std::string name): 172 Expression(), type(type), name(name) { 173 std::cout << "Making QualifiedNameExpr" << std::endl; 174 print( std::cout ); 175 } 176 QualifiedNameExpr( const QualifiedNameExpr & other): Expression(other), type(other.type), name(other.name) { 177 178 } 168 Declaration * type_decl; 169 std::string name; 170 DeclarationWithType * var; 171 172 QualifiedNameExpr( Declaration * decl, std::string name): Expression(), type_decl(decl), name(name) {} 173 QualifiedNameExpr( const QualifiedNameExpr & other): Expression(other), type_decl(other.type_decl), name(other.name), var(other.var) {} 174 DeclarationWithType * get_var() const { return var; } 175 void set_var( DeclarationWithType * newValue ) { var = newValue; } 176 179 177 virtual ~QualifiedNameExpr() { 180 delete type; 178 delete var; 179 delete type_decl; 181 180 } 182 181 … … 184 183 return new QualifiedNameExpr( * this ); 185 184 } 186 virtual void accept( Visitor & v ) override { (void)v; } 187 virtual void accept( Visitor & v ) const override { (void)v; } 188 virtual Expression * acceptMutator( Mutator & m ) override { (void) m;return nullptr; } 185 virtual void accept( Visitor & v ) override { v.visit(this); } 186 virtual void accept( Visitor & v ) const override { v.visit(this); } 187 virtual Expression * acceptMutator( Mutator & m ) override { 188 return m.mutate( this ); 189 } 190 189 191 virtual void print( std::ostream & os, Indenter indent = {} ) const override { 190 type ->print( os, indent );191 std::cout<< name << std::endl;192 type_decl->print( os, indent ); 193 os << name << std::endl; 192 194 } 193 195 };
Note: See TracChangeset
for help on using the changeset viewer.