Changeset eb8d791 for src


Ignore:
Timestamp:
Apr 12, 2023, 3:10:28 PM (13 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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInitNew.cpp

    r153d3440 reb8d791  
    13121312                // xxx - functions returning ast::ptr seems wrong...
    13131313                auto res = ResolvExpr::findVoidExpression( untypedExpr, { symtab, transUnit().global } );
    1314                 // Fix CodeLocation (at least until resolver is fixed).
    1315                 auto fix = localFillCodeLocations( untypedExpr->location, res.release() );
    1316                 return strict_dynamic_cast<const ast::Expr *>( fix );
     1314                return res.release();
    13171315        }
    13181316
  • 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;
  • src/main.cc

    r153d3440 reb8d791  
    310310
    311311                PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
    312                 // Hoist Type Decls pulls some declarations out of contexts where
    313                 // locations are not tracked. Perhaps they should be, but for now
    314                 // the full fill solves it.
    315                 forceFillCodeLocations( transUnit );
    316312
    317313                PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
     
    343339                PASS( "Implement Actors", Concurrency::implementActors( transUnit ) );
    344340        PASS( "Implement Virtual Destructors", Virtual::implementVirtDtors(transUnit) );
    345        
    346341                PASS( "Implement Mutex", Concurrency::implementMutex( transUnit ) );
    347342                PASS( "Implement Thread Start", Concurrency::implementThreadStarter( transUnit ) );
     
    396391                        return EXIT_SUCCESS;
    397392                } // if
    398 
    399                 forceFillCodeLocations( transUnit );
    400393
    401394                PASS( "Fix Init", InitTweak::fix(transUnit, buildingLibrary()));
Note: See TracChangeset for help on using the changeset viewer.