Ignore:
Timestamp:
Nov 25, 2016, 6:11:03 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0f35657
Parents:
186fd86
Message:

add support for built-in sized trait which decouples size/alignment information from otype parameters, add test for sized trait

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r186fd86 r2c57025  
    361361        void Pass2::visit( TraitInstType *contextInst ) {
    362362                Parent::visit( contextInst );
     363                if ( contextInst->get_name() == "sized" ) {
     364                        // "sized" is a special trait with no members - just flick the sized status on for the type variable
     365                        if ( contextInst->get_parameters().size() != 1 ) {
     366                                throw SemanticError( "incorrect number of context parameters: ", contextInst );
     367                        }
     368                        TypeExpr * param = safe_dynamic_cast< TypeExpr * > ( contextInst->get_parameters().front() );
     369                        TypeInstType * inst = safe_dynamic_cast< TypeInstType * > ( param->get_type() );
     370                        TypeDecl * decl = inst->get_baseType();
     371                        decl->set_sized( true );
     372                        // since "sized" is special, the next few steps don't apply
     373                        return;
     374                }
    363375                TraitDecl *ctx = indexer->lookupTrait( contextInst->get_name() );
    364376                if ( ! ctx ) {
     
    584596
    585597                typedeclNames[ typeDecl->get_name() ] = typeDecl;
    586                 return typeDecl;
     598                return Mutator::mutate( typeDecl );
    587599        }
    588600
Note: See TracChangeset for help on using the changeset viewer.