Commit 37122e56 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: allowing overriding of private member functions in subclasses (issue #427)


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 22ed536a
......@@ -242,14 +242,17 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
final String name = definition.getIdentifier().getName();
if (definitions.hasDefinition(name)) {
final Definition localDefinition = definitions.getDefinition(name);
if (definition instanceof Def_Function && localDefinition instanceof Def_Function) {
if (! ((Def_Function)definition).getFormalParameterList().isSame(timestamp, ((Def_Function)localDefinition).getFormalParameterList())) {
localDefinition.getIdentifier().getLocation().reportSemanticError(FORMALPARAMSDIFFER);
definition.getIdentifier().getLocation().reportSemanticError(OVERRIDDENFORMALPARAM);
final VisibilityModifier modifier = definition.getVisibilityModifier();
if (modifier == VisibilityModifier.Public || modifier == VisibilityModifier.Protected) {
if (definition instanceof Def_Function && localDefinition instanceof Def_Function) {
if (! ((Def_Function)definition).getFormalParameterList().isSame(timestamp, ((Def_Function)localDefinition).getFormalParameterList())) {
localDefinition.getIdentifier().getLocation().reportSemanticError(FORMALPARAMSDIFFER);
definition.getIdentifier().getLocation().reportSemanticError(OVERRIDDENFORMALPARAM);
}
} else {
localDefinition.getIdentifier().getLocation().reportSemanticError(MessageFormat.format(
LOCALINHERITANCECOLLISION, definition.getIdentifier().getDisplayName(), definition.getMyScope().getFullName()));
}
} else {
localDefinition.getIdentifier().getLocation().reportSemanticError(MessageFormat.format(
LOCALINHERITANCECOLLISION, definition.getIdentifier().getDisplayName(), definition.getMyScope().getFullName()));
}
} else if (extendsGainedDefinitions.containsKey(name)) {
final Definition previousDefinition = extendsGainedDefinitions.get(name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment