Changeset 10a1225 for src/AST/Expr.cpp


Ignore:
Timestamp:
May 17, 2019, 12:09:51 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
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
Message:

Many errors and warning fixes.
More visit implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r77bfc80 r10a1225  
    9595        Type * addrType( const Type * type ) {
    9696                if ( const ReferenceType * refType = dynamic_cast< const ReferenceType * >( type ) ) {
    97                         CV::Qualifiers quals = refType->qualifiers;
    9897                        return new ReferenceType{ addrType( refType->base ), refType->qualifiers };
    9998                } else {
     
    118117                                result = res;
    119118                        } else {
    120                                 SemanticError( loc, arg->result,
     119                                SemanticError( loc, arg->result.get(),
    121120                                        "Attempt to take address of non-lvalue expression: " );
    122121                        }
     
    283282// --- ConstructorExpr
    284283
    285 ConstructorExpr::ConstructorExpr( const CodeLocation & loc, const Expr * call ) 
     284ConstructorExpr::ConstructorExpr( const CodeLocation & loc, const Expr * call )
    286285: 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
    288287        // first argument
    289288        assert( callExpr );
     
    310309TupleIndexExpr::TupleIndexExpr( const CodeLocation & loc, const Expr * t, unsigned i )
    311310: 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() );
    313312        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested "
    314313                "index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
     
    319318// --- TupleAssignExpr
    320319
    321 TupleAssignExpr::TupleAssignExpr( 
    322         const CodeLocation & loc, std::vector<ptr<Expr>> && assigns, 
     320TupleAssignExpr::TupleAssignExpr(
     321        const CodeLocation & loc, std::vector<ptr<Expr>> && assigns,
    323322        std::vector<ptr<ObjectDecl>> && tempDecls )
    324323: 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
    326325        // the assignments
    327326        std::list<ptr<Stmt>> stmts;
     
    337336// --- StmtExpr
    338337
    339 StmtExpr::StmtExpr( const CodeLocation & loc, const CompoundStmt * ss ) 
     338StmtExpr::StmtExpr( const CodeLocation & loc, const CompoundStmt * ss )
    340339: Expr( loc ), stmts( ss ), returnDecls(), dtors() { computeResult(); }
    341340
     
    344343        const std::list<ptr<Stmt>> & body = stmts->kids;
    345344        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
    347346                // is currently in an intermediate state where the body will always give a void result type
    348347                result = returnDecls.front()->get_type();
     
    360359unsigned long long UniqueExpr::nextId = 0;
    361360
    362 UniqueExpr::UniqueExpr( const CodeLocation & loc, const Expr * e, unsigned long long i = -1 )
     361UniqueExpr::UniqueExpr( const CodeLocation & loc, const Expr * e, unsigned long long i )
    363362: Expr( loc, e->result ), id( i ) {
    364363        assert( expr );
    365         if ( id == -1 ) {
    366                 assert( nextId != -1 );
     364        if ( id == -1ull ) {
     365                assert( nextId != -1ull );
    367366                id = nextId++;
    368367        }
     368}
     369
    369370}
    370371
Note: See TracChangeset for help on using the changeset viewer.