Commit 1268f8d7 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: updateSyntax for classes


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent d5f29a7c
......@@ -144,7 +144,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
public void setMyScope(final Scope scope) {
setParentScope(scope);
if (location != null) {
if (location != null && scope != null) {
scope.addSubScope(location, this);
}
......@@ -262,7 +262,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
for (final ClassTypeBody body : bodies) {
final Map<String, Definition> subDefinitionMap = body.getDefinitionMap();
for (final Definition definition : subDefinitionMap.values()) {
if (definition.isLocal()) {
if (getOwnDefinitions().contains(definition)) {
continue;
}
final String name = definition.getIdentifier().getName();
......@@ -475,15 +475,30 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
}
@Override
public boolean accept(ASTVisitor v) {
// TODO Auto-generated method stub
return false;
/** {@inheritDoc} */
public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
if (isDamaged) {
throw new ReParseException();
}
for (final Definition definition : definitions) {
definition.updateSyntax(reparser, false);
reparser.updateLocation(definition.getLocation());
if(!definition.getLocation().equals(definition.getCumulativeDefinitionLocation())) {
reparser.updateLocation(definition.getCumulativeDefinitionLocation());
}
}
if (extendsReferences != null) {
extendsReferences.updateSyntax(reparser, false);
reparser.updateLocation(extendsReferences.getLocation());
}
}
@Override
public void updateSyntax(TTCN3ReparseUpdater reparser, boolean isDamaged) throws ReParseException {
public boolean accept(ASTVisitor v) {
// TODO Auto-generated method stub
return false;
}
@Override
......
......@@ -50,6 +50,8 @@ import org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance;
import org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
/**
* Represents the TTCN3 class type (TTCN-3 extension).
......@@ -111,7 +113,6 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (classBody != null) {
classBody.setFullNameParent(this);
classBody.setMyType(this);
classBody.setMyScope(myScope);
}
if (runsOnRef != null) {
runsOnRef.setFullNameParent(this);
......@@ -388,6 +389,48 @@ public final class Class_Type extends Type implements ITypeWithComponents {
lastTimeChecked = timestamp;
}
@Override
/** {@inheritDoc} */
public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
if (isDamaged) {
lastTimeChecked = null;
boolean handled = false;
if (classBody != null && classBody.getLocation() != null) {
if (reparser.envelopsDamage(classBody.getLocation())) {
classBody.updateSyntax(reparser, true);
reparser.updateLocation(classBody.getLocation());
handled = true;
}
}
if (subType != null) {
subType.updateSyntax(reparser, false);
handled = true;
}
if (handled) {
return;
}
throw new ReParseException();
}
if (classBody != null) {
classBody.updateSyntax(reparser, false);
reparser.updateLocation(classBody.getLocation());
}
if (subType != null) {
subType.updateSyntax(reparser, false);
}
if (withAttributesPath != null) {
withAttributesPath.updateSyntax(reparser, false);
reparser.updateLocation(withAttributesPath.getLocation());
}
}
@Override
public String getOutlineIcon() {
return "class.gif";
......
......@@ -9261,7 +9261,10 @@ pr_ClassTypeDef returns[Def_Type def_type]
}
})?
pr_BeginChar
cml = pr_ClassMemberList[$i.identifier, refs] { body = $cml.body; }
cml = pr_ClassMemberList[$i.identifier, refs] {
body = $cml.body;
body.setLocation(getLocation( $cml.start, $cml.stop ));
}
pr_EndChar
fd = pr_FinallyDef {
finallyBlock = $fd.statementBlock;
......
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