Changeset 4a9ccc3 for src/ResolvExpr


Ignore:
Timestamp:
Jan 24, 2017, 3:56:33 PM (8 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:
ad6343e
Parents:
0bfaf80
Message:

propagate sized status through trait instances

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/ResolvExpr/Unify.cc

    r0bfaf80 r4a9ccc3  
    123123        }
    124124
    125         struct CompleteTypeChecker : public Visitor {
    126                 virtual void visit( VoidType *basicType ) { status = false; }
    127                 virtual void visit( BasicType *basicType ) {}
    128                 virtual void visit( PointerType *pointerType ) {}
    129                 virtual void visit( ArrayType *arrayType ) { status = ! arrayType->get_isVarLen(); }
    130                 virtual void visit( FunctionType *functionType ) {}
    131                 virtual void visit( StructInstType *aggregateUseType ) { status = aggregateUseType->get_baseStruct()->has_body(); }
    132                 virtual void visit( UnionInstType *aggregateUseType ) { status = aggregateUseType->get_baseUnion()->has_body(); }
    133                 // xxx - enum inst does not currently contain a pointer to base, this should be fixed.
    134                 virtual void visit( EnumInstType *aggregateUseType ) { /* status = aggregateUseType->get_baseEnum()->hasBody(); */ }
    135                 virtual void visit( TraitInstType *aggregateUseType ) { assert( false ); }
    136                 virtual void visit( TypeInstType *aggregateUseType ) { status = aggregateUseType->get_baseType()->isComplete(); }
    137                 virtual void visit( TupleType *tupleType ) {} // xxx - not sure if this is right, might need to recursively check complete-ness
    138                 virtual void visit( TypeofType *typeofType ) { assert( false ); }
    139                 virtual void visit( AttrType *attrType ) { assert( false ); } // xxx - not sure what to do here
    140                 virtual void visit( VarArgsType *varArgsType ){} // xxx - is this right?
    141                 virtual void visit( ZeroType *zeroType ) {}
    142                 virtual void visit( OneType *oneType ) {}
    143                 bool status = true;
    144         };
    145         bool isComplete( Type * type ) {
    146                 CompleteTypeChecker checker;
    147                 assert( type );
    148                 type->accept( checker );
    149                 return checker.status;
    150         }
    151 
    152125        bool tyVarCompatible( const TypeDecl::Data & data, Type *type, const SymTab::Indexer &indexer ) {
    153126                switch ( data.kind ) {
     
    158131                        // type must also be complete
    159132                        // xxx - should this also check that type is not a tuple type and that it's not a ttype?
    160                         return ! isFtype( type, indexer ) && (! data.isComplete || isComplete( type ));
     133                        return ! isFtype( type, indexer ) && (! data.isComplete || type->isComplete() );
    161134                  case TypeDecl::Ftype:
    162135                        return isFtype( type, indexer );
Note: See TracChangeset for help on using the changeset viewer.