Changeset e172f42 for src/Validate


Ignore:
Timestamp:
Jun 16, 2023, 9:10:46 AM (19 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
5dbb9f3
Parents:
a0bd9a2 (diff), 62d62db (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 'ast-experimental'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/Autogen.cpp

    ra0bd9a2 re172f42  
    321321void FuncGenerator::produceDecl( const ast::FunctionDecl * decl ) {
    322322        assert( nullptr != decl->stmts );
     323        const auto & oldParams = getGenericParams(type);
     324        assert( decl->type_params.size() == oldParams.size());
     325
     326        /*
     327        ast::DeclReplacer::TypeMap typeMap;
     328        for (auto it = oldParams.begin(), jt = decl->type_params.begin(); it != oldParams.end(); ++it, ++jt) {
     329                typeMap.emplace(*it, *jt);
     330        }
     331
     332        const ast::FunctionDecl * mut = strict_dynamic_cast<const ast::FunctionDecl *>(ast::DeclReplacer::replace(decl, typeMap));
     333        assert (mut == decl);
     334        */
    323335
    324336        definitions.push_back( decl );
     
    352364        std::vector<ast::ptr<ast::TypeDecl>> type_params;
    353365        std::vector<ast::ptr<ast::DeclWithType>> assertions;
     366
     367        ast::DeclReplacer::TypeMap typeMap;
    354368        for ( auto & old_param : old_type_params ) {
    355369                ast::TypeDecl * decl = ast::deepCopy( old_param );
     
    358372                oldToNew.emplace( std::make_pair( old_param, decl ) );
    359373                type_params.push_back( decl );
     374                typeMap.emplace(old_param, decl);
     375        }
     376
     377        for (auto & param : params) {
     378                param = ast::DeclReplacer::replace(param, typeMap);
     379        }
     380        for (auto & param : returns) {
     381                param = ast::DeclReplacer::replace(param, typeMap);
    360382        }
    361383        replaceAll( params, oldToNew );
     
    522544        InitTweak::InitExpander_new srcParam( src );
    523545        // Assign to destination.
    524         ast::Expr * dstSelect = new ast::MemberExpr(
     546        ast::MemberExpr * dstSelect = new ast::MemberExpr(
    525547                location,
    526548                field,
     
    574596                }
    575597
    576                 ast::Expr * srcSelect = (srcParam) ? new ast::MemberExpr(
     598                ast::MemberExpr * srcSelect = (srcParam) ? new ast::MemberExpr(
    577599                        location, field, new ast::VariableExpr( location, srcParam )
    578600                ) : nullptr;
Note: See TracChangeset for help on using the changeset viewer.