C# "override" fix for "extend" case
This commit is contained in:
parent
7d76617dc3
commit
7e0b5ccf44
1 changed files with 11 additions and 7 deletions
|
|
@ -2415,15 +2415,19 @@ public:
|
||||||
if (!is_smart_pointer()) {
|
if (!is_smart_pointer()) {
|
||||||
// Smart pointer classes do not mirror the inheritance hierarchy of the underlying pointer type, so no virtual/override/new required.
|
// Smart pointer classes do not mirror the inheritance hierarchy of the underlying pointer type, so no virtual/override/new required.
|
||||||
if (Node *base_ovr = Getattr(n, "override")) {
|
if (Node *base_ovr = Getattr(n, "override")) {
|
||||||
Node* base = parentNode(base_ovr);
|
if (GetFlag(n, "isextendmember"))
|
||||||
bool ovr = false;
|
Printf(function_code, "override ");
|
||||||
for (Node* direct_base = Getattr(parentNode(n), "direct_base"); direct_base; direct_base = Getattr(direct_base, "direct_base")) {
|
else {
|
||||||
if (direct_base == base) { // "override" only applies if the base was not discarded (e.g. in case of multiple inheritance or via "ignore")
|
Node* base = parentNode(base_ovr);
|
||||||
ovr = true;
|
bool ovr = false;
|
||||||
break;
|
for (Node* direct_base = Getattr(parentNode(n), "direct_base"); direct_base; direct_base = Getattr(direct_base, "direct_base")) {
|
||||||
|
if (direct_base == base) { // "override" only applies if the base was not discarded (e.g. in case of multiple inheritance or via "ignore")
|
||||||
|
ovr = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Printf(function_code, ovr ? "override " : "virtual ");
|
||||||
}
|
}
|
||||||
Printf(function_code, ovr ? "override " : "virtual ");
|
|
||||||
}
|
}
|
||||||
else if (checkAttribute(n, "storage", "virtual"))
|
else if (checkAttribute(n, "storage", "virtual"))
|
||||||
Printf(function_code, "virtual ");
|
Printf(function_code, "virtual ");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue