Commit 0c52f3f6 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: synch with titan core (4) (issue #487)


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 1b375b22
......@@ -9,7 +9,12 @@ package org.eclipse.titan.designer.AST.TTCN3.definitions;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Location;
import org.eclipse.titan.designer.AST.Reference;
import org.eclipse.titan.designer.AST.Type;
import org.eclipse.titan.designer.AST.TTCN3.TemplateRestriction;
import org.eclipse.titan.designer.AST.TTCN3.statements.StatementBlock;
import org.eclipse.titan.designer.AST.TTCN3.types.SignatureExceptions;
import org.eclipse.titan.designer.compiler.JavaGenData;
import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException;
......@@ -22,14 +27,28 @@ import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
*/
public class Def_AbsFunction extends Definition implements IParameterisedAssignment {
private Type returnType;
private Location signatureLocation = null;
protected Def_AbsFunction(Identifier identifier) {
public Def_AbsFunction(final Identifier identifier, final FormalParameterList formalParameters, final Reference runsOnRef,
final Reference mtcReference, final Reference systemReference, final Reference portReference,
final Type returnType, final boolean returnsTemplate, final TemplateRestriction.Restriction_type templateRestriction,
final SignatureExceptions exceptions, final StatementBlock block, final StatementBlock finallyBlock,
final boolean isClassFunction, final boolean isAbstract, final boolean isFinal, final Location classModifierLocation,
final boolean isDeterministic, final boolean isControl, final Location funcModifierLocation) {
super(identifier);
// TODO Auto-generated constructor stub
}
public Location getSignatureLocation() {
return signatureLocation ;
}
public void setSignatureLocation(Location signatureLocation) {
this.signatureLocation = signatureLocation;
}
@Override
public String getOutlineIcon() {
public String getOutlineIcon() {
if (returnType == null) {
return "function.gif";
}
......
......@@ -501,6 +501,25 @@ public final class Class_Type extends Type implements ITypeWithComponents {
if (baseClass != null) {
nameClash = compareMembers(this, baseClass, null, timestamp);
}
if (baseTraits != null) {
for (int i = 0; i < baseTraits.getNofTypes(); i++) {
final Type baseTrait = baseTraits.getType(i);
if (baseTrait != null) {
Class_Type baseTraitClass = baseTrait.getTypeRefdLast(timestamp).getClassTypeBody();
nameClash |= compareMembers(this, baseTraitClass, null, timestamp);
if (baseClass != null) {
nameClash |= compareMembers(baseClass, baseTraitClass, getLocation() , timestamp);
}
for (int j = 0; j < i; j++) {
final Type baseTrait2 = baseTraits.getType(j);
if (baseTrait2 != null) {
final Class_Type baseTraitClass2 = baseTrait2.getTypeRefdLast(timestamp).getClassTypeBody();
nameClash |= compareMembers(baseTraitClass, baseTraitClass2, getLocation(), timestamp);
}
}
}
}
}
if (isAbstract && isFinal) {
modifierLocation.reportSemanticError(ABSTRACTCANNOTBEFINAL);
......
......@@ -9561,7 +9561,7 @@ pr_FinallyDef returns[StatementBlock statementBlock]
}
)?;
pr_ClassFunctionDef returns[Def_Function def_func]
pr_ClassFunctionDef returns[Definition def_func]
@init {
$def_func = null;
FormalParameterList parameters = null;
......@@ -9615,9 +9615,17 @@ pr_ClassFunctionDef returns[Def_Function def_func]
if($id.identifier != null) {
if(parameters == null) { parameters = new FormalParameterList(new ArrayList<FormalParameter>()); }
parameters.setLocation(getLocation( $start1.start, $end.stop));
$def_func = new Def_Function($id.identifier, parameters, runsonHelper.runsonReference, runsonHelper.mtcReference, runsonHelper.systemReference,
portReference, returnType, returnsTemplate, templateRestriction, exceptions, statementBlock, null, true, isAbstract, isFinal, modifierLocation, false, false, null);
$def_func.setSignatureLocation(getLocation(startcol, endcol));
if (isAbstract) {
Def_AbsFunction df1 = new Def_AbsFunction($id.identifier, parameters, runsonHelper.runsonReference, runsonHelper.mtcReference, runsonHelper.systemReference,
portReference, returnType, returnsTemplate, templateRestriction, exceptions, statementBlock, null, true, isAbstract, isFinal, modifierLocation, false, false, null);
df1.setSignatureLocation(getLocation(startcol, endcol));
$def_func = df1;
} else {
Def_Function df2 = new Def_Function($id.identifier, parameters, runsonHelper.runsonReference, runsonHelper.mtcReference, runsonHelper.systemReference,
portReference, returnType, returnsTemplate, templateRestriction, exceptions, statementBlock, null, true, isAbstract, isFinal, modifierLocation, false, false, null);
df2.setSignatureLocation(getLocation(startcol, endcol));
$def_func = df2;
}
$def_func.setLocation(getLocation( $col.start, $sb.stop));
}
};
......
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