qclib: add sanity check for mixed usage of nonvirtual and virtual as it's currently unsupported.
This commit is contained in:
parent
3313e322d9
commit
92229e769e
1 changed files with 44 additions and 0 deletions
|
@ -6095,6 +6095,50 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* iterate over every parent-class and see if our method already exists in conflicting nonvirtual type form */
|
||||
if (isvirt)
|
||||
{
|
||||
for(pc = newt; pc && !found; pc = pc->parentclass)
|
||||
{
|
||||
struct QCC_typeparam_s *pp;
|
||||
int numpc;
|
||||
int i;
|
||||
found = false;
|
||||
|
||||
if (pc == newt)
|
||||
continue;
|
||||
|
||||
pp = parms;
|
||||
numpc = numparms;
|
||||
|
||||
/* iterate over all of the virtual methods */
|
||||
for (i = 0; i < numpc; i++)
|
||||
{
|
||||
if (pp[i].type->type == newparm->type)
|
||||
{
|
||||
/* if we found it, abandon this loop - we still have to check the other classes however */
|
||||
if (!strcmp(pp[i].paramname, parmname))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* we didn't find it as a field... so check if it exists as a nonvirtual method */
|
||||
if (found == false)
|
||||
{
|
||||
QC_snprintfz(membername, sizeof(membername), "%s::%s", pc->name, parmname);
|
||||
|
||||
/* if we found it, game over */
|
||||
if (QCC_PR_GetDef(NULL, membername, NULL, false, 0, 0))
|
||||
QCC_PR_ParseError(0, "%s defined as virtual in %s, but nonvirtual in %s\n", parmname, newt->name, pc->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parms[numparms].ofs = basicindex; //ulp, its new
|
||||
numparms++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue