Changeset 97b47ec for src/Validate


Ignore:
Timestamp:
Jun 23, 2023, 11:24:07 AM (11 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
1fbf481
Parents:
fe0b94f
Message:

The 'sized' trait is now implemented on top of 'T *' declarations and has no special status in the compiler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/LinkReferenceToTypes.cpp

    rfe0b94f r97b47ec  
    264264
    265265ast::TraitDecl const * LinkTypesCore::postvisit( ast::TraitDecl const * decl ) {
    266         auto mut = ast::mutate( decl );
    267         if ( mut->name == "sized" ) {
    268                 // "sized" is a special trait - flick the sized status on for the type variable.
    269                 assertf( mut->params.size() == 1, "Built-in trait 'sized' has incorrect number of parameters: %zd", decl->params.size() );
    270                 ast::TypeDecl * td = mut->params.front().get_and_mutate();
    271                 td->sized = true;
    272         }
    273 
    274266        // There is some overlap with code from decayForallPointers,
    275267        // perhaps reorganization or shared helper functions are called for.
    276268        // Move assertions from type parameters into the body of the trait.
     269        auto mut = ast::mutate( decl );
    277270        for ( ast::ptr<ast::TypeDecl> const & td : decl->params ) {
    278271                auto expanded = expandAssertions( td->assertions );
Note: See TracChangeset for help on using the changeset viewer.