Commit 728fac03 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: implemented chained function calls param check


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 2b704cfc
...@@ -23,6 +23,7 @@ import org.eclipse.titan.designer.AST.Identifier; ...@@ -23,6 +23,7 @@ import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Identifier.Identifier_type; import org.eclipse.titan.designer.AST.Identifier.Identifier_type;
import org.eclipse.titan.designer.AST.Location; import org.eclipse.titan.designer.AST.Location;
import org.eclipse.titan.designer.AST.NULL_Location; import org.eclipse.titan.designer.AST.NULL_Location;
import org.eclipse.titan.designer.AST.ParameterisedSubReference;
import org.eclipse.titan.designer.AST.Reference; import org.eclipse.titan.designer.AST.Reference;
import org.eclipse.titan.designer.AST.Reference.Ref_Type; import org.eclipse.titan.designer.AST.Reference.Ref_Type;
import org.eclipse.titan.designer.AST.Scope; import org.eclipse.titan.designer.AST.Scope;
...@@ -210,6 +211,14 @@ public final class Class_Type extends Type implements ITypeWithComponents { ...@@ -210,6 +211,14 @@ public final class Class_Type extends Type implements ITypeWithComponents {
return null; return null;
} }
if (assignment instanceof Def_Function) {
final FormalParameterList fpl = ((Def_Function)assignment).getFormalParameterList();
final ISubReference sr = reference.getSubreferences().get(actualSubReference);
if (sr instanceof ParameterisedSubReference) {
((ParameterisedSubReference)sr).checkParameters(timestamp, fpl);
}
}
if (subreferences.size() == actualSubReference + 1) { if (subreferences.size() == actualSubReference + 1) {
return assignment.getType(timestamp); return assignment.getType(timestamp);
} }
......
...@@ -7950,8 +7950,6 @@ pr_Primary returns[Value value] ...@@ -7950,8 +7950,6 @@ pr_Primary returns[Value value]
subReference.setLocation(getLocation( $t.start, $a12.stop)); subReference.setLocation(getLocation( $t.start, $a12.stop));
temporalReference.addSubReference(subReference); temporalReference.addSubReference(subReference);
temporalReference.setLocation(getLocation( $t.start, $a12.stop)); temporalReference.setLocation(getLocation( $t.start, $a12.stop));
$value = new Referenced_Value(temporalReference);
$value.setLocation(getLocation( $t.start, $a12.stop));
} }
( sr = pr_ExtendedFieldReference ( sr = pr_ExtendedFieldReference
{ subReferences = $sr.subReferences; { subReferences = $sr.subReferences;
...@@ -7963,6 +7961,10 @@ pr_Primary returns[Value value] ...@@ -7963,6 +7961,10 @@ pr_Primary returns[Value value]
temporalReference.setLocation(getLocation( $t.start, $sr.stop)); temporalReference.setLocation(getLocation( $t.start, $sr.stop));
} }
)? )?
{
$value = new Referenced_Value(temporalReference);
$value.setLocation(getLocation( $t.start, $sr.stop == null ? $a12.stop : $sr.stop));
}
( p2 = pr_ApplyOpEnd ( p2 = pr_ApplyOpEnd
{ $value = new ApplyExpression( $value, $p2.parsedParameters ); { $value = new ApplyExpression( $value, $p2.parsedParameters );
$value.setLocation(getLocation( $t.start, $p2.stop)); $value.setLocation(getLocation( $t.start, $p2.stop));
...@@ -8179,13 +8181,17 @@ pr_ExtendedFieldReference returns[List<ISubReference> subReferences] ...@@ -8179,13 +8181,17 @@ pr_ExtendedFieldReference returns[List<ISubReference> subReferences]
}: }:
( a = pr_Dot ( a = pr_Dot
( funcid = pr_Identifier ( funcid = pr_Identifier
LPAREN lp = pr_LParen
( par = pr_FunctionActualParList { ( par = pr_FunctionActualParList {
parameters = $par.parsedParameters; parameters = $par.parsedParameters;
parameters.setLocation( getLocation( $par.start, $par.stop ) ); parameters.setLocation( getLocation( $par.start, $par.stop ) );
} )? } )?
RPAREN rp = pr_RParen
{ {
if (parameters == null) {
parameters = new ParsedActualParameters();
parameters.setLocation(getLocation($lp.start, $rp.stop));
}
ParameterisedSubReference funcReference = new ParameterisedSubReference($funcid.identifier, parameters); ParameterisedSubReference funcReference = new ParameterisedSubReference($funcid.identifier, parameters);
funcReference.setLocation( getLocation( $funcid.start, $par.stop ) ); funcReference.setLocation( getLocation( $funcid.start, $par.stop ) );
$subReferences.add(funcReference); $subReferences.add(funcReference);
......
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