Changeset 8da7421f for src/SynTree/Expression.h
- Timestamp:
- Oct 20, 2020, 12:35:25 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3aec25f
- Parents:
- 5afb49a (diff), d5631b3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
r5afb49a r8da7421f 163 163 }; 164 164 165 /// VariableExpr represents an expression that simply refers to the value of a named variable. 166 /// Does not take ownership of var. 167 class VariableExpr : public Expression { 168 public: 169 DeclarationWithType * var; 170 171 VariableExpr(); 172 VariableExpr( DeclarationWithType * var ); 173 VariableExpr( const VariableExpr & other ); 174 virtual ~VariableExpr(); 175 176 bool get_lvalue() const final; 177 178 DeclarationWithType * get_var() const { return var; } 179 void set_var( DeclarationWithType * newValue ) { var = newValue; } 180 181 static VariableExpr * functionPointer( FunctionDecl * decl ); 182 183 virtual VariableExpr * clone() const override { return new VariableExpr( * this ); } 184 virtual void accept( Visitor & v ) override { v.visit( this ); } 185 virtual void accept( Visitor & v ) const override { v.visit( this ); } 186 virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 187 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 188 }; 189 165 190 // The following classes are used to represent expression types that cannot be converted into 166 191 // function-call format. … … 329 354 }; 330 355 331 /// VariableExpr represents an expression that simply refers to the value of a named variable.332 /// Does not take ownership of var.333 class VariableExpr : public Expression {334 public:335 DeclarationWithType * var;336 337 VariableExpr();338 VariableExpr( DeclarationWithType * var );339 VariableExpr( const VariableExpr & other );340 virtual ~VariableExpr();341 342 bool get_lvalue() const final;343 344 DeclarationWithType * get_var() const { return var; }345 void set_var( DeclarationWithType * newValue ) { var = newValue; }346 347 static VariableExpr * functionPointer( FunctionDecl * decl );348 349 virtual VariableExpr * clone() const override { return new VariableExpr( * this ); }350 virtual void accept( Visitor & v ) override { v.visit( this ); }351 virtual void accept( Visitor & v ) const override { v.visit( this ); }352 virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); }353 virtual void print( std::ostream & os, Indenter indent = {} ) const override;354 };355 356 356 /// ConstantExpr represents an expression that simply refers to the value of a constant 357 357 class ConstantExpr : public Expression {
Note: See TracChangeset
for help on using the changeset viewer.