Changes in src/SynTree/Expression.h [0f79853:df626eb]
- File:
-
- 1 edited
-
src/SynTree/Expression.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.h
r0f79853 rdf626eb 41 41 ParamEntry( UniqueId decl, Type * actualType, Type * formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ), inferParams( new InferredParams ) {} 42 42 ParamEntry( const ParamEntry & other ); 43 ParamEntry( ParamEntry && other );44 43 ~ParamEntry(); 45 44 ParamEntry & operator=( const ParamEntry & other ); 46 ParamEntry & operator=( ParamEntry && other );47 45 48 46 UniqueId decl; … … 76 74 InferredParams & get_inferParams() { return inferParams; } 77 75 78 // move other's inferParams to this79 void spliceInferParams( Expression * other );80 81 76 virtual Expression * clone() const override = 0; 82 77 virtual void accept( Visitor & v ) override = 0; … … 193 188 public: 194 189 Expression * arg; 195 bool isGenerated = true; // whether this cast appeared in the source program 196 197 CastExpr( Expression * arg, bool isGenerated = true ); 198 CastExpr( Expression * arg, Type * toType, bool isGenerated = true ); 199 CastExpr( Expression * arg, void * ) = delete; // prevent accidentally passing pointers for isGenerated in the first constructor 190 191 CastExpr( Expression * arg ); 192 CastExpr( Expression * arg, Type * toType ); 200 193 CastExpr( const CastExpr & other ); 201 194 virtual ~CastExpr(); … … 205 198 206 199 virtual CastExpr * clone() const { return new CastExpr( * this ); } 207 virtual void accept( Visitor & v ) { v.visit( this ); }208 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }209 virtual void print( std::ostream & os, Indenter indent = {} ) const;210 };211 212 /// KeywordCastExpr represents a cast to 'keyword types', e.g. (thread &)t213 class KeywordCastExpr : public Expression {214 public:215 Expression * arg;216 enum Target {217 Coroutine, Thread, Monitor, NUMBER_OF_TARGETS218 } target;219 220 KeywordCastExpr( Expression * arg, Target target );221 KeywordCastExpr( const KeywordCastExpr & other );222 virtual ~KeywordCastExpr();223 224 const std::string & targetString() const;225 226 virtual KeywordCastExpr * clone() const { return new KeywordCastExpr( * this ); }227 200 virtual void accept( Visitor & v ) { v.visit( this ); } 228 201 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } … … 322 295 323 296 Constant * get_constant() { return & constant; } 324 const Constant * get_constant() const { return & constant; }325 297 void set_constant( const Constant & newValue ) { constant = newValue; } 326 327 long long int intValue() const;328 298 329 299 virtual ConstantExpr * clone() const { return new ConstantExpr( * this ); } … … 755 725 StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; } 756 726 757 // call to set the result type of this StmtExpr based on its body758 void computeResult();759 760 727 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; } 761 728 std::list< Expression * > & get_dtors() { return dtors; } … … 849 816 }; 850 817 851 /// expression that contains a deleted identifier - should never make it past the resolver.852 class DeletedExpr : public Expression {853 public:854 Expression * expr;855 BaseSyntaxNode * deleteStmt;856 857 DeletedExpr( Expression * expr, BaseSyntaxNode * deleteStmt );858 DeletedExpr( const DeletedExpr & other );859 ~DeletedExpr();860 861 virtual DeletedExpr * clone() const { return new DeletedExpr( * this ); }862 virtual void accept( Visitor & v ) { v.visit( this ); }863 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }864 virtual void print( std::ostream & os, Indenter indent = {} ) const;865 };866 867 /// expression wrapping the use of a default argument - should never make it past the resolver.868 class DefaultArgExpr : public Expression {869 public:870 Expression * expr;871 872 DefaultArgExpr( Expression * expr );873 DefaultArgExpr( const DefaultArgExpr & other );874 ~DefaultArgExpr();875 876 virtual DefaultArgExpr * clone() const { return new DefaultArgExpr( * this ); }877 virtual void accept( Visitor & v ) { v.visit( this ); }878 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }879 virtual void print( std::ostream & os, Indenter indent = {} ) const;880 };881 882 /// C11 _Generic expression883 class GenericExpr : public Expression {884 public:885 struct Association {886 Type * type = nullptr;887 Expression * expr = nullptr;888 bool isDefault = false;889 890 Association( Type * type, Expression * expr );891 Association( Expression * expr );892 Association( const Association & other );893 Association & operator=( const Association & other ) = delete; // at the moment this isn't used, and I don't want to implement it894 ~Association();895 };896 897 Expression * control;898 std::list<Association> associations;899 900 GenericExpr( Expression * control, const std::list<Association> & assoc );901 GenericExpr( const GenericExpr & other );902 virtual ~GenericExpr();903 904 virtual GenericExpr * clone() const { return new GenericExpr( * this ); }905 virtual void accept( Visitor & v ) { v.visit( this ); }906 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }907 virtual void print( std::ostream & os, Indenter indent = {} ) const;908 };909 910 818 // Local Variables: // 911 819 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.