Changes in src/SynTree/Expression.h [d5631b3:312029a]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
rd5631b3 r312029a 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 190 165 // The following classes are used to represent expression types that cannot be converted into 191 166 // function-call format. … … 231 206 public: 232 207 Expression * arg; 233 234 // Inidicates cast is introduced by the CFA type system. 235 // true for casts that the resolver introduces to force a return type 236 // false for casts from user code 237 // false for casts from desugaring advanced CFA features into simpler CFA 238 // example 239 // int * p; // declaration 240 // (float *) p; // use, with subject cast 241 // subject cast isGenerated means we are considering an interpretation with a type mismatch 242 // subject cast not isGenerated means someone in charge wants it that way 243 bool isGenerated = true; 208 bool isGenerated = true; // cast generated implicitly by code generation or explicit in program 244 209 245 210 CastExpr( Expression * arg, bool isGenerated = true ); … … 273 238 274 239 KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target ); 275 KeywordCastExpr( Expression * arg, AggregateDecl::Aggregate target, const Concrete & concrete_target );276 240 KeywordCastExpr( const KeywordCastExpr & other ); 277 241 virtual ~KeywordCastExpr(); … … 348 312 349 313 virtual MemberExpr * clone() const override { return new MemberExpr( * this ); } 314 virtual void accept( Visitor & v ) override { v.visit( this ); } 315 virtual void accept( Visitor & v ) const override { v.visit( this ); } 316 virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 317 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 318 }; 319 320 /// VariableExpr represents an expression that simply refers to the value of a named variable. 321 /// Does not take ownership of var. 322 class VariableExpr : public Expression { 323 public: 324 DeclarationWithType * var; 325 326 VariableExpr(); 327 VariableExpr( DeclarationWithType * var ); 328 VariableExpr( const VariableExpr & other ); 329 virtual ~VariableExpr(); 330 331 bool get_lvalue() const final; 332 333 DeclarationWithType * get_var() const { return var; } 334 void set_var( DeclarationWithType * newValue ) { var = newValue; } 335 336 static VariableExpr * functionPointer( FunctionDecl * decl ); 337 338 virtual VariableExpr * clone() const override { return new VariableExpr( * this ); } 350 339 virtual void accept( Visitor & v ) override { v.visit( this ); } 351 340 virtual void accept( Visitor & v ) const override { v.visit( this ); }
Note:
See TracChangeset
for help on using the changeset viewer.