Changeset 10a1225 for src/AST/Expr.cpp
- Timestamp:
- May 17, 2019, 12:09:51 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 896737b
- Parents:
- 77bfc80
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r77bfc80 r10a1225 95 95 Type * addrType( const Type * type ) { 96 96 if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * >( type ) ) { 97 CV::Qualifiers quals = refType->qualifiers;98 97 return new ReferenceType{ addrType( refType->base ), refType->qualifiers }; 99 98 } else { … … 118 117 result = res; 119 118 } else { 120 SemanticError( loc, arg->result ,119 SemanticError( loc, arg->result.get(), 121 120 "Attempt to take address of non-lvalue expression: " ); 122 121 } … … 283 282 // --- ConstructorExpr 284 283 285 ConstructorExpr::ConstructorExpr( const CodeLocation & loc, const Expr * call ) 284 ConstructorExpr::ConstructorExpr( const CodeLocation & loc, const Expr * call ) 286 285 : Expr( loc ), callExpr( call ) { 287 // allow resolver to type a constructor used as an expression if it has the same type as its 286 // allow resolver to type a constructor used as an expression if it has the same type as its 288 287 // first argument 289 288 assert( callExpr ); … … 310 309 TupleIndexExpr::TupleIndexExpr( const CodeLocation & loc, const Expr * t, unsigned i ) 311 310 : Expr( loc ), tuple( t ), index( i ) { 312 const TupleType * type = strict_dynamic_cast< const TupleType * >( tuple->result );311 const TupleType * type = strict_dynamic_cast< const TupleType * >( tuple->result.get() ); 313 312 assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested " 314 313 "index %d in expr %s", type->size(), index, toString( tuple ).c_str() ); … … 319 318 // --- TupleAssignExpr 320 319 321 TupleAssignExpr::TupleAssignExpr( 322 const CodeLocation & loc, std::vector<ptr<Expr>> && assigns, 320 TupleAssignExpr::TupleAssignExpr( 321 const CodeLocation & loc, std::vector<ptr<Expr>> && assigns, 323 322 std::vector<ptr<ObjectDecl>> && tempDecls ) 324 323 : Expr( loc, Tuples::makeTupleType( assigns ) ), stmtExpr() { 325 // convert internally into a StmtExpr which contains the declarations and produces the tuple of 324 // convert internally into a StmtExpr which contains the declarations and produces the tuple of 326 325 // the assignments 327 326 std::list<ptr<Stmt>> stmts; … … 337 336 // --- StmtExpr 338 337 339 StmtExpr::StmtExpr( const CodeLocation & loc, const CompoundStmt * ss ) 338 StmtExpr::StmtExpr( const CodeLocation & loc, const CompoundStmt * ss ) 340 339 : Expr( loc ), stmts( ss ), returnDecls(), dtors() { computeResult(); } 341 340 … … 344 343 const std::list<ptr<Stmt>> & body = stmts->kids; 345 344 if ( ! returnDecls.empty() ) { 346 // prioritize return decl for result type, since if a return decl exists, then the StmtExpr 345 // prioritize return decl for result type, since if a return decl exists, then the StmtExpr 347 346 // is currently in an intermediate state where the body will always give a void result type 348 347 result = returnDecls.front()->get_type(); … … 360 359 unsigned long long UniqueExpr::nextId = 0; 361 360 362 UniqueExpr::UniqueExpr( const CodeLocation & loc, const Expr * e, unsigned long long i = -1)361 UniqueExpr::UniqueExpr( const CodeLocation & loc, const Expr * e, unsigned long long i ) 363 362 : Expr( loc, e->result ), id( i ) { 364 363 assert( expr ); 365 if ( id == -1 ) {366 assert( nextId != -1 );364 if ( id == -1ull ) { 365 assert( nextId != -1ull ); 367 366 id = nextId++; 368 367 } 368 } 369 369 370 } 370 371
Note: See TracChangeset
for help on using the changeset viewer.