/* * DECLQ.C * * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the * COPYRIGHT file at the base of the distribution. * * Decl function required by the runtime, isolate so the module can be * included in libruntime. */ #include "defs.h" Declaration * FindDeclByIndex(SemGroup *sg, int i) { Declaration *d; RUNE_FOREACH(d, &sg->sg_DeclList, d_Node) { if (d->d_Index == i) return(d); } return(NULL); } int MatchDeclTypes(Declaration *sd, Declaration *rd) { int r; if (sd->d_Op != rd->d_Op) return(SG_COMPAT_FAIL); switch(sd->d_Op) { case DOP_TYPEDEF: r = MatchType(sd->d_TypedefDecl.ed_Type, rd->d_TypedefDecl.ed_Type); break; case DOP_PROC: r = MatchType(sd->d_ProcDecl.ed_Type, rd->d_ProcDecl.ed_Type); break; case DOP_ARGS_STORAGE: case DOP_STACK_STORAGE: case DOP_GLOBAL_STORAGE: case DOP_GROUP_STORAGE: r = MatchType(sd->d_StorDecl.ed_Type, rd->d_StorDecl.ed_Type); break; case DOP_CLASS: case DOP_IMPORT: default: dassert_decl(rd, 0); r = 0; /* not reached */ break; /* not reached */ } return(r); }