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 ...@@ -144,7 +144,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
public void setMyScope(final Scope scope) { public void setMyScope(final Scope scope) {
setParentScope(scope); setParentScope(scope);
if (location != null) { if (location != null && scope != null) {
scope.addSubScope(location, this); scope.addSubScope(location, this);
} }
...@@ -262,7 +262,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl ...@@ -262,7 +262,7 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
for (final ClassTypeBody body : bodies) { for (final ClassTypeBody body : bodies) {
final Map<String, Definition> subDefinitionMap = body.getDefinitionMap(); final Map<String, Definition> subDefinitionMap = body.getDefinitionMap();
for (final Definition definition : subDefinitionMap.values()) { for (final Definition definition : subDefinitionMap.values()) {
if (definition.isLocal()) { if (getOwnDefinitions().contains(definition)) {
continue; continue;
} }
final String name = definition.getIdentifier().getName(); final String name = definition.getIdentifier().getName();
...@@ -475,15 +475,30 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl ...@@ -475,15 +475,30 @@ public final class ClassTypeBody extends TTCN3Scope implements IReferenceChainEl
} }
@Override @Override
public boolean accept(ASTVisitor v) { /** {@inheritDoc} */
// TODO Auto-generated method stub public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException {
return false; 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 @Override
public void updateSyntax(TTCN3ReparseUpdater reparser, boolean isDamaged) throws ReParseException { public boolean accept(ASTVisitor v) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false;
} }
@Override @Override
......
...@@ -50,6 +50,8 @@ import org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance; ...@@ -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.AST.TTCN3.values.Referenced_Value;
import org.eclipse.titan.designer.compiler.JavaGenData; import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp; 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). * Represents the TTCN3 class type (TTCN-3 extension).
...@@ -111,7 +113,6 @@ public final class Class_Type extends Type implements ITypeWithComponents { ...@@ -111,7 +113,6 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (classBody != null) { if (classBody != null) {
classBody.setFullNameParent(this); classBody.setFullNameParent(this);
classBody.setMyType(this); classBody.setMyType(this);
classBody.setMyScope(myScope);
} }
if (runsOnRef != null) { if (runsOnRef != null) {
runsOnRef.setFullNameParent(this); runsOnRef.setFullNameParent(this);
...@@ -388,6 +389,48 @@ public final class Class_Type extends Type implements ITypeWithComponents { ...@@ -388,6 +389,48 @@ public final class Class_Type extends Type implements ITypeWithComponents {
lastTimeChecked = timestamp; 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 @Override
public String getOutlineIcon() { public String getOutlineIcon() {
return "class.gif"; return "class.gif";
......
...@@ -9261,7 +9261,10 @@ pr_ClassTypeDef returns[Def_Type def_type] ...@@ -9261,7 +9261,10 @@ pr_ClassTypeDef returns[Def_Type def_type]
} }
})? })?
pr_BeginChar 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 pr_EndChar
fd = pr_FinallyDef { fd = pr_FinallyDef {
finallyBlock = $fd.statementBlock; 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