Commit 67fb6068 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

OOP: class member/method names and formal parameter names of methods can no...


OOP: class member/method names and formal parameter names of methods can no longer reuse names in the 'runs-on'/'system'/'mtc' component of the class (bug 568714)
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
Change-Id: Ia1c77c7e27f574fa3fc8ed6e0b6e09d02bcaa7a5
parent 3e004dcb
......@@ -10268,15 +10268,17 @@ namespace Ttcn {
pars_m[name]->note("Previous definition of `%s' is here", dispname);
} else {
pars_m.add(name, par);
if (parent_scope && parent_scope->get_scope_class() == NULL &&
parent_scope->has_ass_withId(id)) {
par->error("Parameter name `%s' is not unique in the scope "
"hierarchy", dispname);
if (parent_scope && parent_scope->has_ass_withId(id)) {
Reference ref(0, id.clone());
Common::Assignment *ass = parent_scope->get_ass_bySRef(&ref);
if (!ass) FATAL_ERROR("FormalParList::chk()");
ass->note("Symbol `%s' is already defined here in a higher scope "
"unit", dispname);
if (parent_scope->get_scope_class() == NULL ||
!ass->get_my_scope()->is_class_scope()) {
par->error("Parameter name `%s' is not unique in the scope "
"hierarchy", dispname);
ass->note("Symbol `%s' is already defined here in a higher scope "
"unit", dispname);
}
}
}
Error_Context cntxt2(par, "In parameter `%s'", dispname);
......
......@@ -26,6 +26,7 @@
#include "Statement.hh"
#include "Templatestuff.hh"
#include "TtcnTemplate.hh"
#include "../CompType.hh"
#include "../../common/path.h"
#include "../../common/userinfo.h"
#include "../../common/version_internal.h"
......@@ -3440,11 +3441,12 @@ namespace Ttcn {
}
bool name_clash = false;
if (base_class != NULL) {
if (base_class != NULL || runs_on_type != NULL || mtc_type != NULL || system_type != NULL) {
for (size_t i = 0; i < members->get_nof_asss(); ++i) {
Common::Assignment* local_def = members->get_ass_byIndex(i, false);
const Common::Identifier& local_id = local_def->get_id();
if (local_def->get_asstype() != Common::Assignment::A_CONSTRUCTOR &&
if (base_class != NULL &&
local_def->get_asstype() != Common::Assignment::A_CONSTRUCTOR &&
base_class->has_local_ass_withId(local_id)) {
Common::Assignment* base_def = base_class->get_local_ass_byId(local_id);
switch (local_def->get_asstype()) {
......@@ -3489,6 +3491,18 @@ namespace Ttcn {
break;
}
}
if (runs_on_type != NULL && runs_on_type->get_CompBody()->has_local_ass_withId(local_id)) {
local_def->error("%s shadows a definition in runs-on component type `%s'",
local_def->get_description().c_str(), runs_on_type->get_typename().c_str());
}
if (mtc_type != NULL && mtc_type->get_CompBody()->has_local_ass_withId(local_id)) {
local_def->error("%s shadows a definition in mtc component type `%s'",
local_def->get_description().c_str(), mtc_type->get_typename().c_str());
}
if (system_type != NULL && system_type->get_CompBody()->has_local_ass_withId(local_id)) {
local_def->error("%s shadows a definition in system component type `%s'",
local_def->get_description().c_str(), system_type->get_typename().c_str());
}
}
}
......
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