Ignore:
Timestamp:
Jul 31, 2023, 11:25:51 AM (10 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
f496046
Parents:
e0332dd
Message:

Added invariant to check that referenced declarations are in scope. This one took a while, I don't remember why forall pointer decay is involved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/Autogen.cpp

    re0332dd r14c0f7b  
    532532                )
    533533        );
    534         return genImplicitCall(
     534        auto stmt = genImplicitCall(
    535535                srcParam, dstSelect, location, func->name,
    536536                field, direction
    537537        );
     538        // This could return the above directly, except the generated code is
     539        // built using the structure's members and that means all the scoped
     540        // names (the forall parameters) are incorrect. This corrects them.
     541        if ( stmt && !decl->params.empty() ) {
     542                ast::DeclReplacer::TypeMap oldToNew;
     543                for ( auto pair : group_iterate( decl->params, func->type_params ) ) {
     544                        oldToNew.emplace( std::get<0>(pair), std::get<1>(pair) );
     545                }
     546                auto node = ast::DeclReplacer::replace( stmt, oldToNew );
     547                stmt = strict_dynamic_cast<const ast::Stmt *>( node );
     548        }
     549        return stmt;
    538550}
    539551
Note: See TracChangeset for help on using the changeset viewer.