Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    r312029a r07de76b  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 16:41:39 2019
    13 // Update Count     : 18
     12// Last Modified On : Fri Dec 13 16:23:15 2019
     13// Update Count     : 20
    1414//
    1515
     
    2626#include "Node.hpp"            // for readonly
    2727#include "Type.hpp"            // for readonly
    28 #include "Parser/ParseNode.h"  // for DeclarationNode
    2928
    3029namespace ast {
     
    5655
    5756const char * TypeDecl::typeString() const {
    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." );
     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." );
    6260        return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'
    6361}
    6462
    6563const char * TypeDecl::genTypeString() const {
    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." );
     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, "TypeDecl kind is out of bounds." );
    6967        return kindNames[ kind ];
    7068}
Note: See TracChangeset for help on using the changeset viewer.