Changeset 48fa824 for src


Ignore:
Timestamp:
Nov 17, 2017, 5:33:14 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
5c4d27f
Parents:
9e1eabc
Message:

Add error check for unimplemented expression parameters for generic types [fixes #58]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r9e1eabc r48fa824  
    423423        }
    424424
     425        void checkGenericParameters( ReferenceToType * inst ) {
     426                for ( Expression * param : inst->parameters ) {
     427                        if ( ! dynamic_cast< TypeExpr * >( param ) ) {
     428                                throw SemanticError( "Expression parameters for generic types are currently unsupported: ", inst );
     429                        }
     430                }
     431        }
     432
    425433        void LinkReferenceToTypes::postvisit( StructInstType *structInst ) {
    426434                StructDecl *st = local_indexer->lookupStruct( structInst->get_name() );
     
    434442                        forwardStructs[ structInst->get_name() ].push_back( structInst );
    435443                } // if
     444                checkGenericParameters( structInst );
    436445        }
    437446
     
    446455                        forwardUnions[ unionInst->get_name() ].push_back( unionInst );
    447456                } // if
     457                checkGenericParameters( unionInst );
    448458        }
    449459
Note: See TracChangeset for help on using the changeset viewer.