Changes in / [d63746f:a22d148]
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cpp
rd63746f ra22d148 366 366 367 367 /// Passes extra layout arguments for sized polymorphic type parameters. 368 ast::vector<ast::Expr>::iteratorpassTypeVars(368 void passTypeVars( 369 369 ast::ApplicationExpr * expr, 370 ast::vector<ast::Expr> & extraArgs, 370 371 ast::FunctionType const * funcType ); 371 372 /// Wraps a function application with a new temporary for the … … 387 388 /// parameter list. arg should point into expr's argument list. 388 389 void boxParams( 389 ast::ApplicationExpr const* expr,390 ast:: vector<ast::Expr>::iterator arg,390 ast::ApplicationExpr * expr, 391 ast::Type const * polyRetType, 391 392 ast::FunctionType const * function, 392 393 const TypeVarMap & typeVars ); … … 395 396 void addInferredParams( 396 397 ast::ApplicationExpr * expr, 397 ast::vector<ast::Expr> ::iterator arg,398 ast::vector<ast::Expr> & extraArgs, 398 399 ast::FunctionType const * functionType, 399 400 const TypeVarMap & typeVars ); … … 636 637 ast::Expr const * ret = expr; 637 638 638 // TODO: This entire section should probably be refactored to do less639 // pushing to the front/middle of a vector.640 ptrdiff_t initArgCount = mutExpr->args.size();641 642 639 TypeVarMap exprTypeVars; 643 640 makeTypeVarMap( function, exprTypeVars ); … … 662 659 } 663 660 664 assert( typeSubs ); 665 ast::vector<ast::Expr>::iterator argIt = 666 passTypeVars( mutExpr, function ); 667 addInferredParams( mutExpr, argIt, function, exprTypeVars ); 668 669 argIt = mutExpr->args.begin(); 670 std::advance( argIt, ( mutExpr->args.size() - initArgCount ) ); 671 672 boxParams( mutExpr, argIt, function, exprTypeVars ); 661 ast::vector<ast::Expr> prependArgs; 662 passTypeVars( mutExpr, prependArgs, function ); 663 addInferredParams( mutExpr, prependArgs, function, exprTypeVars ); 664 665 boxParams( mutExpr, dynRetType, function, exprTypeVars ); 666 spliceBegin( mutExpr->args, prependArgs ); 673 667 passAdapters( mutExpr, function, exprTypeVars ); 674 668 … … 766 760 } 767 761 768 ast::vector<ast::Expr>::iteratorCallAdapter::passTypeVars(762 void CallAdapter::passTypeVars( 769 763 ast::ApplicationExpr * expr, 764 ast::vector<ast::Expr> & extraArgs, 770 765 ast::FunctionType const * function ) { 771 766 assert( typeSubs ); 772 ast::vector<ast::Expr>::iterator arg = expr->args.begin();773 767 // Pass size/align for type variables. 774 768 for ( ast::ptr<ast::TypeInstType> const & typeVar : function->forall ) { … … 780 774 toString( typeSubs ).c_str(), typeVar->typeString().c_str() ); 781 775 } 782 arg = expr->args.insert( arg,776 extraArgs.emplace_back( 783 777 new ast::SizeofExpr( expr->location, ast::deepCopy( concrete ) ) ); 784 arg++; 785 arg = expr->args.insert( arg, 778 extraArgs.emplace_back( 786 779 new ast::AlignofExpr( expr->location, ast::deepCopy( concrete ) ) ); 787 arg++; 788 } 789 return arg; 780 } 790 781 } 791 782 … … 913 904 914 905 void CallAdapter::boxParams( 915 ast::ApplicationExpr const* expr,916 ast:: vector<ast::Expr>::iterator arg,906 ast::ApplicationExpr * expr, 907 ast::Type const * polyRetType, 917 908 ast::FunctionType const * function, 918 909 const TypeVarMap & typeVars ) { 910 // Start at the beginning, but the return argument may have been added. 911 auto arg = expr->args.begin(); 912 if ( polyRetType ) ++arg; 913 919 914 for ( auto param : function->params ) { 920 915 assertf( arg != expr->args.end(), … … 928 923 void CallAdapter::addInferredParams( 929 924 ast::ApplicationExpr * expr, 930 ast::vector<ast::Expr> ::iterator arg,925 ast::vector<ast::Expr> & extraArgs, 931 926 ast::FunctionType const * functionType, 932 927 TypeVarMap const & typeVars ) { 933 ast::vector<ast::Expr>::iterator cur = arg;934 928 for ( auto assertion : functionType->assertions ) { 935 929 auto inferParam = expr->inferred.inferParams().find( … … 940 934 ast::ptr<ast::Expr> newExpr = ast::deepCopy( inferParam->second.expr ); 941 935 boxParam( newExpr, assertion->result, typeVars ); 942 cur = expr->args.insert( cur, newExpr.release() ); 943 ++cur; 936 extraArgs.emplace_back( newExpr.release() ); 944 937 } 945 938 } -
src/main.cc
rd63746f ra22d148 181 181 182 182 static void _Signal(struct sigaction & act, int sig, int flags ) { 183 sigemptyset( &act.sa_mask ); 183 184 act.sa_flags = flags; 184 185
Note: See TracChangeset
for help on using the changeset viewer.