Ignore:
Timestamp:
Nov 24, 2023, 10:14:27 AM (7 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
f48dfcd
Parents:
53dac82
Message:

Box pass Eraser now removes the polymorphic arguments now that the functions are no longer actually polymorphic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/BoxNew.cpp

    r53dac82 r3c4003b9  
    1616#include "Box.h"
    1717
     18#include "AST/Chain.hpp"               // for chain_mutate
    1819#include "AST/Decl.hpp"                // for Decl, FunctionDecl, ...
    1920#include "AST/Expr.hpp"                // for AlignofExpr, ConstantExpr, ...
     
    14351436        ast::FunctionType * type = new ast::FunctionType(
    14361437                mutDecl->type->isVarArgs, mutDecl->type->qualifiers );
    1437         for ( auto type_param : mutDecl->type_params ) {
    1438                 type->forall.emplace_back( new ast::TypeInstType( type_param ) );
    1439         }
    14401438        for ( auto param : mutDecl->params ) {
    14411439                type->params.emplace_back( param->get_type() );
     
    21902188        ast::ObjectDecl const * previsit( ast::ObjectDecl const * decl );
    21912189        ast::FunctionDecl const * previsit( ast::FunctionDecl const * decl );
     2190        ast::FunctionDecl const * postvisit( ast::FunctionDecl const * decl );
    21922191        ast::TypedefDecl const * previsit( ast::TypedefDecl const * decl );
    21932192        ast::StructDecl const * previsit( ast::StructDecl const * decl );
     
    22102209}
    22112210
     2211ast::FunctionDecl const * Eraser::postvisit( ast::FunctionDecl const * decl ) {
     2212        if ( decl->type_params.empty() ) return decl;
     2213        auto mutDecl = mutate( decl );
     2214        mutDecl->type_params.clear();
     2215        ast::chain_mutate( mutDecl->type )->forall.clear();
     2216        return mutDecl;
     2217}
     2218
    22122219ast::TypedefDecl const * Eraser::previsit( ast::TypedefDecl const * decl ) {
    22132220        guardTypeVarMap( decl->base );
Note: See TracChangeset for help on using the changeset viewer.