Changeset 0b0a285


Ignore:
Timestamp:
Jun 21, 2023, 2:38:44 AM (17 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
c84dd61
Parents:
fec8bd1
Message:

Basic change for enable enumerated array syntax

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rfec8bd1 r0b0a285  
    38483848                // { SemanticError( yylloc, "New array dimension is currently unimplemented." ); $$ = nullptr; }
    38493849        | '[' push array_type_list pop ']'                                      // CFA
    3850                 { SemanticError( yylloc, "Type array dimension is currently unimplemented." ); $$ = nullptr; }
     3850                { $$ = DeclarationNode::newArray( $3, nullptr, false ); }
    38513851        | multi_array_dimension
    38523852        ;
  • src/Validate/GenericParameter.cpp

    rfec8bd1 r0b0a285  
    247247const ast::Expr * TranslateDimensionCore::postvisit(
    248248                const ast::TypeExpr * expr ) {
    249         // Does nothing, except prevents matching ast::Expr (above).
     249        if ( auto instType = dynamic_cast<const ast::EnumInstType *>( expr->type.get() ) ) {
     250                const ast::EnumDecl * baseEnum = instType->base.get();
     251                return ast::ConstantExpr::from_int( expr->location, baseEnum->members.size() );
     252        }
    250253        return expr;
    251254}
Note: See TracChangeset for help on using the changeset viewer.