Changeset b8524ca for src/ResolvExpr


Ignore:
Timestamp:
Jun 20, 2019, 6:50:42 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9af00d23
Parents:
234b1cb
Message:

new AST porting

  • mostly InitTweak? autogeneration
  • added some convenience methods
    • nullptr assignment for ast::ptr
    • convenience wrapper ctors for AddressExpr?, CastExpr? that draw location from first arg
Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r234b1cb rb8524ca  
    5757                // cast away reference from expr
    5858                cost.incReference();
    59                 return new ast::CastExpr{ expr->location, expr, expr->result->stripReferences() };
     59                return new ast::CastExpr{ expr, expr->result->stripReferences() };
    6060        }
    6161       
     
    126126                        ast::ptr< ast::Type > newType = paramType;
    127127                        env.apply( newType );
    128                         return new ast::CastExpr{ arg->location, arg, newType };
     128                        return new ast::CastExpr{ arg, newType };
    129129
    130130                        // xxx - *should* be able to resolve this cast, but at the moment pointers are not
     
    793793                       
    794794                        if ( aggrType.as< ast::ReferenceType >() ) {
    795                                 aggrExpr =
    796                                         new ast::CastExpr{ aggrExpr->location, aggrExpr, aggrType->stripReferences() };
     795                                aggrExpr = new ast::CastExpr{ aggrExpr, aggrType->stripReferences() };
    797796                        }
    798797
  • src/ResolvExpr/Resolver.cc

    r234b1cb rb8524ca  
    11091109               
    11101110                // set up and resolve expression cast to void
    1111                 ast::CastExpr * untyped = new ast::CastExpr{ expr->location, expr };
     1111                ast::CastExpr * untyped = new ast::CastExpr{ expr };
    11121112                CandidateRef choice = findUnfinishedKindExpression(
    11131113                        untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() );
     
    11611161                ) {
    11621162                        assert( untyped && type );
    1163                         ast::ptr< ast::Expr > castExpr = new ast::CastExpr{ untyped->location, untyped, type };
     1163                        ast::ptr< ast::Expr > castExpr = new ast::CastExpr{ untyped, type };
    11641164                        ast::ptr< ast::Expr > newExpr = findSingleExpression( castExpr, symtab );
    11651165                        removeExtraneousCast( newExpr, symtab );
Note: See TracChangeset for help on using the changeset viewer.