Changes in src/AST/Decl.cpp [360b2e13:a300e4a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r360b2e13 ra300e4a 14 14 // 15 15 16 #include <cassert> // for assert, strict_dynamic_cast 17 #include <unordered_map> 18 16 19 #include "Decl.hpp" 17 20 18 #include <cassert> // for assert, strict_dynamic_cast 19 #include <string> 20 #include <unordered_map> 21 22 #include "Fwd.hpp" // for UniqueId 21 #include "Fwd.hpp" // for UniqueId 23 22 #include "Init.hpp" 24 #include "Node.hpp" // for readonly 25 #include "Parser/ParseNode.h" // for DeclarationNode 23 #include "Node.hpp" // for readonly 26 24 27 25 namespace ast { … … 43 41 if ( i != idMap.end() ) return i->second; 44 42 return {}; 45 }46 47 // --- TypeDecl48 49 std::string TypeDecl::typeString() const {50 static const std::string kindNames[] = { "object type", "function type", "tuple type" };51 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1,52 "typeString: kindNames is out of sync." );53 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." );54 return (sized ? "sized " : "") + kindNames[ kind ];55 }56 57 std::string TypeDecl::genTypeString() const {58 static const std::string kindNames[] = { "dtype", "ftype", "ttype" };59 assertf( sizeof(kindNames)/sizeof(kindNames[0]) == DeclarationNode::NoTypeClass-1, "genTypeString: kindNames is out of sync." );60 assertf( kind < sizeof(kindNames)/sizeof(kindNames[0]), "TypeDecl's kind is out of bounds." );61 return kindNames[ kind ];62 43 } 63 44
Note: See TracChangeset
for help on using the changeset viewer.