Changeset eb8d791 for src/ResolvExpr


Ignore:
Timestamp:
Apr 12, 2023, 3:10:28 PM (15 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
52f9804
Parents:
153d3440
Message:

CandidateFinder? fills in the CodeLocation? on a generated expression. With that and recent changes, the fills seem to be redundent now, so I removed them.

Location:
src/ResolvExpr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CandidateFinder.cpp

    r153d3440 reb8d791  
    279279        /// Instantiates an argument to match a parameter, returns false if no matching results left
    280280        bool instantiateArgument(
     281                const CodeLocation & location,
    281282                const ast::Type * paramType, const ast::Init * init, const ExplodedArgs_new & args,
    282283                std::vector< ArgPack > & results, std::size_t & genStart, const ast::SymbolTable & symtab,
     
    289290                                // xxx - dropping initializer changes behaviour from previous, but seems correct
    290291                                // ^^^ need to handle the case where a tuple has a default argument
    291                                 if ( ! instantiateArgument(
     292                                if ( ! instantiateArgument( location,
    292293                                        type, nullptr, args, results, genStart, symtab, nTuples ) ) return false;
    293294                                nTuples = 0;
     
    341342                                                        // push empty tuple expression
    342343                                                        newResult.parent = i;
    343                                                         newResult.expr = new ast::TupleExpr{ CodeLocation{}, {} };
     344                                                        newResult.expr = new ast::TupleExpr( location, {} );
    344345                                                        argType = newResult.expr->result;
    345346                                                } else {
     
    614615                /// Builds a list of candidates for a function, storing them in out
    615616                void makeFunctionCandidates(
     617                        const CodeLocation & location,
    616618                        const CandidateRef & func, const ast::FunctionType * funcType,
    617619                        const ExplodedArgs_new & args, CandidateList & out );
     
    732734        /// Builds a list of candidates for a function, storing them in out
    733735        void Finder::makeFunctionCandidates(
     736                const CodeLocation & location,
    734737                const CandidateRef & func, const ast::FunctionType * funcType,
    735738                const ExplodedArgs_new & args, CandidateList & out
     
    768771                                for (size_t i=0; i<nParams; ++i) {
    769772                                        auto obj = funcDecl->params[i].strict_as<ast::ObjectDecl>();
    770                                         if (!instantiateArgument(
     773                                        if (!instantiateArgument( location,
    771774                                                funcType->params[i], obj->init, args, results, genStart, symtab)) return;
    772775                                }
     
    778781                        // matches
    779782                        // no default args for indirect calls
    780                         if ( ! instantiateArgument(
     783                        if ( ! instantiateArgument( location,
    781784                                param, nullptr, args, results, genStart, symtab ) ) return;
    782785                }
     
    10071010                                                newFunc->expr =
    10081011                                                        referenceToRvalueConversion( newFunc->expr, newFunc->cost );
    1009                                                 makeFunctionCandidates( newFunc, function, argExpansions, found );
     1012                                                makeFunctionCandidates( untypedExpr->location,
     1013                                                        newFunc, function, argExpansions, found );
    10101014                                        }
    10111015                                } else if (
     
    10171021                                                        newFunc->expr =
    10181022                                                                referenceToRvalueConversion( newFunc->expr, newFunc->cost );
    1019                                                         makeFunctionCandidates( newFunc, function, argExpansions, found );
     1023                                                        makeFunctionCandidates( untypedExpr->location,
     1024                                                                newFunc, function, argExpansions, found );
    10201025                                                }
    10211026                                        }
     
    10431048                                                        newOp->expr =
    10441049                                                                referenceToRvalueConversion( newOp->expr, newOp->cost );
    1045                                                         makeFunctionCandidates( newOp, function, argExpansions, found );
     1050                                                        makeFunctionCandidates( untypedExpr->location,
     1051                                                                newOp, function, argExpansions, found );
    10461052                                                }
    10471053                                        }
  • src/ResolvExpr/ExplodedArg.hpp

    r153d3440 reb8d791  
    3535        ExplodedArg() : env(), cost( Cost::zero ), exprs() {}
    3636        ExplodedArg( const Candidate & arg, const ast::SymbolTable & symtab );
    37        
     37
    3838        ExplodedArg( ExplodedArg && ) = default;
    3939        ExplodedArg & operator= ( ExplodedArg && ) = default;
Note: See TracChangeset for help on using the changeset viewer.