Changeset 2f42718 for src/SymTab/Autogen.cc
- Timestamp:
- Feb 22, 2019, 10:43:29 AM (5 years ago)
- Branches:
- no_list
- Parents:
- 43e0949
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
r43e0949 r2f42718 410 410 } 411 411 412 assert( ! func->get_functionType()-> get_parameters().empty() );413 ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()-> get_parameters().front() );412 assert( ! func->get_functionType()->parameters.empty() ); 413 ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->parameters.front() ); 414 414 ObjectDecl * srcParam = nullptr; 415 if ( func->get_functionType()-> get_parameters().size() == 2 ) {416 srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()-> get_parameters().back() );415 if ( func->get_functionType()->parameters.size() == 2 ) { 416 srcParam = dynamic_cast<ObjectDecl*>( func->get_functionType()->parameters.back() ); 417 417 } 418 418 … … 429 429 void StructFuncGenerator::makeFieldCtorBody( Iterator member, Iterator end, FunctionDecl * func ) { 430 430 FunctionType * ftype = func->type; 431 std::list<DeclarationWithType*>& params = ftype->parameters;431 auto & params = ftype->parameters; 432 432 assert( params.size() >= 2 ); // should not call this function for default ctor, etc. 433 433 … … 435 435 ObjectDecl * dstParam = dynamic_cast<ObjectDecl*>( params.front() ); 436 436 assert( dstParam ); 437 std::list<DeclarationWithType*>::iteratorparameter = params.begin()+1;437 auto parameter = params.begin()+1; 438 438 for ( ; member != end; ++member ) { 439 439 if ( DeclarationWithType * field = dynamic_cast<DeclarationWithType*>( *member ) ) { … … 656 656 void makeTupleFunctionBody( FunctionDecl * function ) { 657 657 FunctionType * ftype = function->get_functionType(); 658 assertf( ftype-> get_parameters().size() == 1 || ftype->get_parameters().size() == 2, "too many parameters in generated tuple function" );658 assertf( ftype->parameters.size() == 1 || ftype->parameters.size() == 2, "too many parameters in generated tuple function" ); 659 659 660 660 UntypedExpr * untyped = new UntypedExpr( new NameExpr( function->get_name() ) ); 661 661 662 662 /// xxx - &* is used to make this easier for later passes to handle 663 untyped->get_args().push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( ftype-> get_parameters().front() ) ) ) );664 if ( ftype-> get_parameters().size() == 2 ) {665 untyped->get_args().push_back( new VariableExpr( ftype-> get_parameters().back() ) );666 } 667 function-> get_statements()->get_kids().push_back( new ExprStmt( untyped ) );668 function-> get_statements()->get_kids().push_back( new ReturnStmt( UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );663 untyped->get_args().push_back( new AddressExpr( UntypedExpr::createDeref( new VariableExpr( ftype->parameters.front() ) ) ) ); 664 if ( ftype->parameters.size() == 2 ) { 665 untyped->get_args().push_back( new VariableExpr( ftype->parameters.back() ) ); 666 } 667 function->statements->get_kids().push_back( new ExprStmt( untyped ) ); 668 function->statements->get_kids().push_back( new ReturnStmt( UntypedExpr::createDeref( new VariableExpr( ftype->parameters.front() ) ) ) ); 669 669 } 670 670 … … 691 691 TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Dtype, true ); 692 692 TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl ); 693 newDecl-> get_assertions().push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr,693 newDecl->assertions.push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr, 694 694 std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) ); 695 newDecl-> get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,695 newDecl->assertions.push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr, 696 696 std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) ); 697 newDecl-> get_assertions().push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr,697 newDecl->assertions.push_back( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr, 698 698 std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) ); 699 newDecl-> get_assertions().push_back( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr,699 newDecl->assertions.push_back( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr, 700 700 std::vector< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) ) ); 701 701 typeParams.push_back( newDecl );
Note: See TracChangeset
for help on using the changeset viewer.