Changes in src/AST/Decl.cpp [07de76b:312029a]
- File:
-
- 1 edited
-
src/AST/Decl.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r07de76b r312029a 10 10 // Created On : Thu May 9 10:00:00 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 16:23:15201913 // Update Count : 2012 // Last Modified On : Wed Dec 11 16:41:39 2019 13 // Update Count : 18 14 14 // 15 15 … … 26 26 #include "Node.hpp" // for readonly 27 27 #include "Type.hpp" // for readonly 28 #include "Parser/ParseNode.h" // for DeclarationNode 28 29 29 30 namespace ast { … … 55 56 56 57 const char * TypeDecl::typeString() const { 57 static const char * kindNames[] = { "sized data type", "sized object type", "sized function type", "sized tuple type" }; 58 static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 59 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); 58 static const char * kindNames[] = { "sized object type", "sized function type", "sized tuple type" }; 59 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, 60 "typeString: kindNames is out of sync." ); 61 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); 60 62 return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0' 61 63 } 62 64 63 65 const char * TypeDecl::genTypeString() const { 64 static const char * kindNames[] = { "dtype", " otype", "ftype", "ttype" };65 static_assert( sizeof(kindNames)/sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "genTypeString: kindNames is out of sync." );66 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDeclkind is out of bounds." );66 static const char * kindNames[] = { "dtype", "ftype", "ttype" }; 67 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "genTypeString: kindNames is out of sync." ); 68 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." ); 67 69 return kindNames[ kind ]; 68 70 }
Note:
See TracChangeset
for help on using the changeset viewer.