Changes in src/AST/Decl.cpp [312029a:d76c588]
- File:
-
- 1 edited
-
src/AST/Decl.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r312029a rd76c588 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Dec 11 16:41:39201913 // Update Count : 1 811 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Thu May 9 10:00:00 2019 13 // Update Count : 1 14 14 // 15 15 … … 18 18 #include <cassert> // for assert, strict_dynamic_cast 19 19 #include <iostream> 20 #include <string> 20 21 #include <unordered_map> 21 22 … … 55 56 // --- TypeDecl 56 57 57 const char *TypeDecl::typeString() const {58 static const char * kindNames[] = { "sized object type", "sized function type", "sizedtuple type" };58 std::string TypeDecl::typeString() const { 59 static const std::string kindNames[] = { "object type", "function type", "tuple type" }; 59 60 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, 60 61 "typeString: kindNames is out of sync." ); 61 62 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); 62 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'63 return (sized ? "sized " : "") + kindNames[ kind ]; 63 64 } 64 65 65 const char *TypeDecl::genTypeString() const {66 static const char *kindNames[] = { "dtype", "ftype", "ttype" };66 std::string TypeDecl::genTypeString() const { 67 static const std::string kindNames[] = { "dtype", "ftype", "ttype" }; 67 68 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "genTypeString: kindNames is out of sync." ); 68 69 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); … … 72 73 std::ostream & operator<< ( std::ostream & out, const TypeDecl::Data & data ) { 73 74 return out << data.kind << ", " << data.isComplete; 74 }75 76 // --- AggregateDecl77 78 // These must harmonize with the corresponding AggregateDecl::Aggregate enumerations.79 static const char * aggregateNames[] = { "struct", "union", "enum", "exception", "trait", "generator", "coroutine", "monitor", "thread", "NoAggregateName" };80 81 const char * AggregateDecl::aggrString( AggregateDecl::Aggregate aggr ) {82 return aggregateNames[aggr];83 75 } 84 76
Note:
See TracChangeset
for help on using the changeset viewer.