2008-06-30 09:44:06 -07:00
|
|
|
function process_type(c)
|
|
|
|
{
|
|
|
|
if ((c.kind == 'class' || c.kind == 'struct') && !c.isIncomplete) {
|
|
|
|
for each (let base in c.bases)
|
2008-08-07 13:12:49 -07:00
|
|
|
if (isFinal(base.type))
|
2010-08-18 18:06:05 -07:00
|
|
|
error("Class '" + c.name + "' derives from final class '" + base.type.name + "'.", c.loc);
|
2008-06-30 09:44:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-28 08:44:33 -07:00
|
|
|
function process_function(decl, body)
|
|
|
|
{
|
|
|
|
if (!decl.memberOf)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let c = decl.memberOf;
|
|
|
|
if ((c.kind == 'class' || c.kind == 'struct') && !c.isIncomplete) {
|
|
|
|
for each (let base in ancestorTypes(c))
|
|
|
|
for each (let member in base.members)
|
|
|
|
if (member.isFunction && isFinal(member) && member.shortName == decl.shortName)
|
|
|
|
error("Function '" + decl.name + "' overrides final ancestor in '" +
|
|
|
|
base.name + "'.", c.loc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ancestorTypes(c)
|
|
|
|
{
|
|
|
|
for each (let base in c.bases) {
|
|
|
|
yield base.type;
|
|
|
|
for (let bb in ancestorTypes(base.type))
|
|
|
|
yield bb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-30 09:44:06 -07:00
|
|
|
function isFinal(c)
|
|
|
|
{
|
|
|
|
return hasAttribute(c, 'NS_final');
|
|
|
|
}
|