Ignore:
Timestamp:
Sep 5, 2024, 3:57:05 PM (13 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
29c8675
Parents:
ad47ec4 (diff), 508cff0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cpp

    rad47ec4 r9bb6c5f  
    15411541
    15421542// The argument flag (is/is not var-args) of a computed property.
    1543 static ast::ArgumentFlag argumentFlag( const TypeData * td ) {
     1543static ast::ArgumentFlag buildArgumentFlag( const TypeData * td ) {
    15441544        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.
     1551static 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}
    15481558
    15491559
     
    15621572        std::vector<ast::ptr<ast::DeclWithType>> params;
    15631573        std::vector<ast::ptr<ast::DeclWithType>> returns;
    1564         buildList( td->function.params, params );
     1574        buildParamList( td->function.params, params );
    15651575        buildForall( td->forall, forall );
    15661576        // Functions do not store their assertions there anymore.
     
    16101620                std::move( attributes ),
    16111621                funcSpec,
    1612                 argumentFlag( td )
     1622                buildArgumentFlag( td )
    16131623        );
    16141624        buildList( td->function.withExprs, decl->withExprs );
     
    16621672        assert( td->kind == TypeData::Function );
    16631673        ast::FunctionType * ft = new ast::FunctionType(
    1664                 argumentFlag( td ),
     1674                buildArgumentFlag( td ),
    16651675                buildQualifiers( td )
    16661676        );
Note: See TracChangeset for help on using the changeset viewer.