Commit ac753823 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: parser fix for value references


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 89d243ff
......@@ -6552,12 +6552,10 @@ pr_ValueReference returns[Reference reference]
$reference = null;
boolean isThisRef = false;
boolean isSuperRef = false;
boolean isValueRef = false;
}:
( ( ( r = pr_GlobalModuleId { $reference = $r.reference; }
| THIS { isThisRef = true; }
| SUPER { isSuperRef = true; }
| VALUE { isValueRef = true; }
)
pr_Dot
)?
......@@ -6568,9 +6566,6 @@ pr_ValueReference returns[Reference reference]
if (isSuperRef == true) {
$reference = new Reference(null, Reference.Ref_Type.REF_SUPER);
}
if (isValueRef == true) {
$reference = new Reference(null, Reference.Ref_Type.REF_VALUE);
}
if ( $id.identifier != null ) {
if ( $reference == null ) {
$reference = new Reference(null);
......@@ -6584,6 +6579,12 @@ pr_ValueReference returns[Reference reference]
| THIS {
$reference = new Reference(null, Reference.Ref_Type.REF_THIS);
}
| val = pr_ValueKeyword {
$reference = new Reference(null, Reference.Ref_Type.REF_VALUE);
FieldSubReference subReference = new FieldSubReference(new Identifier(Identifier_type.ID_TTCN, "value", getLocation( $val.start, $val.stop)));
$reference.addSubReference(subReference);
$reference.setLocation(getLocation( $val.start, $val.stop ));
}
);
pr_AddressValue returns[Value value]
......@@ -7849,7 +7850,9 @@ pr_Primary returns[Value value]
}
)+
| { if (temporalReference != null) { // OOP: temporary null check until class type is fully implemented
if (temporalReference.getSubreferences().size() == 1 && temporalReference.getModuleIdentifier() == null) {
if (temporalReference.getReferenceType() == Reference.Ref_Type.REF_VALUE) {
$value = new Referenced_Value(temporalReference);
} else if (temporalReference.getSubreferences().size() == 1 && temporalReference.getModuleIdentifier() == null) {
$value = new Undefined_LowerIdentifier_Value(temporalReference.getId());
} else {
$value = new Referenced_Value(temporalReference);
......
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