Changeset db19e1d for src/Parser
- Timestamp:
- Sep 3, 2024, 12:08:09 PM (8 days ago)
- Branches:
- master
- Children:
- 737bf73
- Parents:
- cdbb909
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cpp
rcdbb909 rdb19e1d 1541 1541 1542 1542 // The argument flag (is/is not var-args) of a computed property. 1543 static ast::ArgumentFlag argumentFlag( const TypeData * td ) {1543 static ast::ArgumentFlag buildArgumentFlag( const TypeData * td ) { 1544 1544 assert( td->kind == TypeData::Function ); 1545 bool isVaArgs = !td->function.params || td->function.params->hasEllipsis; 1546 return (isVaArgs) ? ast::VariableArgs : ast::FixedArgs; 1547 } // argumentFlag 1545 bool isVarArgs = !td->function.params || td->function.params->hasEllipsis; 1546 return (isVarArgs) ? ast::VariableArgs : ast::FixedArgs; 1547 } 1548 1549 1550 // Wrapper to convert the void parameter into the empty explicit list. 1551 static void buildParamList( DeclarationNode * decl, 1552 std::vector<ast::ptr<ast::DeclWithType>> & params ) { 1553 buildList( decl, params ); 1554 if ( 1 == params.size() && params[0]->get_type()->isVoid() ) { 1555 params.pop_back(); 1556 } 1557 } 1548 1558 1549 1559 … … 1562 1572 std::vector<ast::ptr<ast::DeclWithType>> params; 1563 1573 std::vector<ast::ptr<ast::DeclWithType>> returns; 1564 build List( td->function.params, params );1574 buildParamList( td->function.params, params ); 1565 1575 buildForall( td->forall, forall ); 1566 1576 // Functions do not store their assertions there anymore. … … 1610 1620 std::move( attributes ), 1611 1621 funcSpec, 1612 argumentFlag( td )1622 buildArgumentFlag( td ) 1613 1623 ); 1614 1624 buildList( td->function.withExprs, decl->withExprs ); … … 1662 1672 assert( td->kind == TypeData::Function ); 1663 1673 ast::FunctionType * ft = new ast::FunctionType( 1664 argumentFlag( td ),1674 buildArgumentFlag( td ), 1665 1675 buildQualifiers( td ) 1666 1676 ); -
src/Parser/parser.yy
rcdbb909 rdb19e1d 2889 2889 parameter_list_ellipsis_opt: 2890 2890 // empty 2891 { $$ = nullptr; }2891 { $$ = DeclarationNode::newFromTypeData( build_basic_type( TypeData::Void ) ); } 2892 2892 | ELLIPSIS 2893 2893 { $$ = nullptr; }
Note: See TracChangeset
for help on using the changeset viewer.