2008-06-30 16:44:06 +00:00
|
|
|
function process_type(c)
|
|
|
|
{
|
|
|
|
if ((c.kind == 'class' || c.kind == 'struct') && !c.isIncomplete) {
|
|
|
|
for each (let base in c.bases)
|
2008-08-07 20:12:49 +00:00
|
|
|
if (isFinal(base.type))
|
2010-08-19 01:06:05 +00:00
|
|
|
error("Class '" + c.name + "' derives from final class '" + base.type.name + "'.", c.loc);
|
2008-06-30 16:44:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-28 15:44:33 +00: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 16:44:06 +00:00
|
|
|
function isFinal(c)
|
|
|
|
{
|
|
|
|
return hasAttribute(c, 'NS_final');
|
|
|
|
}
|