Commit 55c8a313 authored by Miklos Magyari's avatar Miklos Magyari Committed by Adam Knapp
Browse files

Fixed class scoping (issue #487)

parent 6d9a5139
......@@ -78,7 +78,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
}
public void setMyScope(final Scope scope) {
setParentScope(scope);
setParentScope(parentClass.getMyScope());
// if (location != null && scope != null) {
// scope.addSubScope(location, this);
// }
......
......@@ -199,6 +199,7 @@ public final class Class_Type extends Type implements ITypeWithComponents {
}
body = new ClassTypeBody(this);
body.setFullNameParent(this);
}
/**
......@@ -231,15 +232,13 @@ public final class Class_Type extends Type implements ITypeWithComponents {
return;
}
body.setMyScope(scope);
if (baseType != null) {
baseType.setMyScope(scope);
}
if (baseTraits != null) {
baseTraits.setMyScope(scope);
}
if (finallyBlock != null) {
finallyBlock.setMyScope(scope);
}
if (runsOnRef != null) {
runsOnRef.setMyScope(scope);
}
......@@ -249,11 +248,12 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (systemRef != null) {
systemRef.setMyScope(scope);
}
if (baseTraits != null) {
baseTraits.setMyScope(scope);
}
if (members != null) {
members.setParentScope(scope);
members.setParentScope(body);
}
if (finallyBlock != null) {
finallyBlock.setParentScope(scope);
}
}
......@@ -1123,7 +1123,7 @@ public final class Class_Type extends Type implements ITypeWithComponents {
*
* @return A map of definitions with an indication if the definitions are inherited
*/
private Map<Definition,Boolean> getAllDefintions() {
private Map<Definition,Boolean> getAllDefinitions() {
Map<Definition,Boolean> definitions = new HashMap<>();
if (baseClass != null) {
......@@ -1202,7 +1202,7 @@ public final class Class_Type extends Type implements ITypeWithComponents {
@Override
/** {@inheritDoc} */
public Object[] getOutlineChildren() {
return getDefinitions().toArray();
return getAllDefinitions().keySet().toArray();
}
@Override
......@@ -1316,7 +1316,7 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (dc != null) {
members = dc.getMembers();
}
for (Map.Entry<Definition,Boolean> defs : getAllDefintions().entrySet()) {
for (Map.Entry<Definition,Boolean> defs : getAllDefinitions().entrySet()) {
final Definition def = defs.getKey();
switch (def.getVisibilityModifier()) {
case Private:
......
......@@ -10,6 +10,7 @@ import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.NamedBridgeScope;
import org.eclipse.titan.designer.AST.Scope;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Definition;
import org.eclipse.titan.designer.AST.TTCN3.definitions.Definitions;
import org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock;
import org.eclipse.titan.designer.AST.TTCN3.types.ClassTypeBody;
import org.eclipse.titan.designer.editors.Stylers;
......@@ -106,7 +107,7 @@ public final class OutlineStyledLabelProvider extends DelegatingStyledCellLabelP
}
private boolean isInClassBody(Scope scope) {
while (scope instanceof StatementBlock || scope instanceof NamedBridgeScope) {
while (scope instanceof StatementBlock || scope instanceof NamedBridgeScope || scope instanceof Definitions) {
scope = scope.getParentScope();
}
......
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