Changeset 4a9ccc3 for src/ResolvExpr
- Timestamp:
- Jan 24, 2017, 3:56:33 PM (8 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/ResolvExpr/Unify.cc ¶
r0bfaf80 r4a9ccc3 123 123 } 124 124 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-ness138 virtual void visit( TypeofType *typeofType ) { assert( false ); }139 virtual void visit( AttrType *attrType ) { assert( false ); } // xxx - not sure what to do here140 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 152 125 bool tyVarCompatible( const TypeDecl::Data & data, Type *type, const SymTab::Indexer &indexer ) { 153 126 switch ( data.kind ) { … … 158 131 // type must also be complete 159 132 // 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() ); 161 134 case TypeDecl::Ftype: 162 135 return isFtype( type, indexer );
Note: See TracChangeset
for help on using the changeset viewer.