Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Decl.cpp

    r07de76b r312029a  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 13 16:23:15 2019
    13 // Update Count     : 20
     12// Last Modified On : Wed Dec 11 16:41:39 2019
     13// Update Count     : 18
    1414//
    1515
     
    2626#include "Node.hpp"            // for readonly
    2727#include "Type.hpp"            // for readonly
     28#include "Parser/ParseNode.h"  // for DeclarationNode
    2829
    2930namespace ast {
     
    5556
    5657const 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." );
    6062        return sized ? kindNames[ kind ] : &kindNames[ kind ][ sizeof("sized") ]; // sizeof includes '\0'
    6163}
    6264
    6365const 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, "TypeDecl kind 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." );
    6769        return kindNames[ kind ];
    6870}
Note: See TracChangeset for help on using the changeset viewer.