Commit 090615d5 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: fixed class visitor; minor improvements


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent c6f5fce6
......@@ -10,7 +10,6 @@ package org.eclipse.titan.designer.AST.TTCN3.definitions;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.titan.designer.AST.INamedNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Identifier.Identifier_type;
......@@ -33,6 +32,7 @@ public class Def_Constructor extends Definition implements IParameterisedAssignm
private final StatementBlock statementBlock;
private Map<Identifier,Boolean> uninitializedMembers = new HashMap<>();
private FormalParameterList formalParameterList;
private Assignment_type assignmentType;
public Def_Constructor(FormalParameterList fpl, Reference baseCall, StatementBlock sb) {
super(new Identifier(Identifier_type.ID_TTCN, "create"));
......@@ -71,8 +71,7 @@ public class Def_Constructor extends Definition implements IParameterisedAssignm
@Override
public Assignment_type getAssignmentType() {
// TODO Auto-generated method stub
return null;
return assignmentType;
}
@Override
......@@ -83,14 +82,21 @@ public class Def_Constructor extends Definition implements IParameterisedAssignm
@Override
public void check(CompilationTimeStamp timestamp) {
// TODO Auto-generated method stub
check(timestamp, null);
}
@Override
public void check(CompilationTimeStamp timestamp, IReferenceChain refChain) {
// TODO Auto-generated method stub
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
if (statementBlock != null) {
statementBlock.check(timestamp);
}
formalParameterList.check(timestamp, getAssignmentType());
}
@Override
......
......@@ -63,7 +63,6 @@ import org.eclipse.titan.designer.AST.TTCN3.attributes.TitanVersionAttribute;
import org.eclipse.titan.designer.AST.TTCN3.attributes.VersionRequirementAttribute;
import org.eclipse.titan.designer.AST.TTCN3.attributes.WithAttributesPath;
import org.eclipse.titan.designer.AST.TTCN3.types.Anytype_Type;
import org.eclipse.titan.designer.AST.TTCN3.types.Class_Type;
import org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.core.CompilerVersionInformationCollector;
......
......@@ -162,6 +162,14 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
return true;
}
if (parentClass.getDefinitions() != null) {
for (final Definition def : parentClass.getDefinitions()) {
if (!def.accept(v)) {
return false;
}
}
}
if (v.leave(this) == ASTVisitor.V_ABORT) {
return false;
}
......
......@@ -224,28 +224,38 @@ public final class Class_Type extends Type implements ITypeWithComponents {
}
@Override
/** {@inheritDoc} */
public void setMyScope(final Scope scope) {
super.setMyScope(scope);
if (finallyBlock != null) {
finallyBlock.setMyScope(scope);
}
if (runsOnRef != null) {
runsOnRef.setMyScope(scope);
}
if (mtcRef != null) {
mtcRef.setMyScope(scope);
}
if (systemRef != null) {
systemRef.setMyScope(scope);
}
if (baseTraits != null) {
baseTraits.setMyScope(scope);
}
if (members != null) {
members.setParentScope(scope);
}
}
/** {@inheritDoc} */
public void setMyScope(final Scope scope) {
super.setMyScope(scope);
if (isBuiltIn) {
return;
}
if (baseType != null) {
baseType.setMyScope(scope);
}
if (baseTraits != null) {
baseTraits.setMyScope(scope);
}
if (finallyBlock != null) {
finallyBlock.setMyScope(scope);
}
if (runsOnRef != null) {
runsOnRef.setMyScope(scope);
}
if (mtcRef != null) {
mtcRef.setMyScope(scope);
}
if (systemRef != null) {
systemRef.setMyScope(scope);
}
if (baseTraits != null) {
baseTraits.setMyScope(scope);
}
if (members != null) {
members.setParentScope(scope);
}
}
@Override
/** {@inheritDoc} */
......@@ -993,6 +1003,10 @@ public final class Class_Type extends Type implements ITypeWithComponents {
return constructor;
}
public Class_Type getBaseClass() {
return baseClass;
}
/**
* Gets the return type of default object methods
* @param methodName
......@@ -1339,6 +1353,10 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (! super.memberAccept(v)) {
return false;
}
if (body != null && !body.accept(v)) {
return false;
}
return true;
}
......
......@@ -40,7 +40,6 @@ import org.eclipse.titan.designer.parsers.GlobalParser;
import org.eclipse.titan.designer.parsers.ProjectSourceParser;
import org.eclipse.titan.designer.preferences.PreferenceConstants;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
......
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