Changeset f0ecf9b for src/SynTree/TypeDecl.cc
- Timestamp:
- Nov 1, 2017, 5:40:05 PM (7 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:
- fde89cf6
- Parents:
- b0837e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/TypeDecl.cc
rb0837e4 rf0ecf9b 21 21 #include "Type.h" // for Type, Type::StorageClasses 22 22 23 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Any || kind == Ttype), kind( kind ) {23 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, bool sized, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Ttype || sized ), kind( kind ) { 24 24 } 25 25 … … 32 32 33 33 std::string TypeDecl::typeString() const { 34 static const std::string kindNames[] = { "type", "incomplete type", "function type", "tuple type" }; 35 return (kind != Any && isComplete() ? "sized " : "") + kindNames[ kind ]; 34 static const std::string kindNames[] = { "object type", "function type", "tuple type" }; 35 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "typeString: kindNames is out of sync." ); 36 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); 37 return (isComplete() ? "sized " : "") + kindNames[ kind ]; 36 38 } 37 39 38 40 std::string TypeDecl::genTypeString() const { 39 static const std::string kindNames[] = { "otype", "dtype", "ftype", "ttype" }; 41 static const std::string kindNames[] = { "dtype", "ftype", "ttype" }; 42 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "genTypeString: kindNames is out of sync." ); 43 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); 40 44 return kindNames[ kind ]; 41 45 }
Note: See TracChangeset
for help on using the changeset viewer.