Commit b581774a authored by Lenard Nagy's avatar Lenard Nagy
Browse files

Reference chain is channeled through type and reference check (artf470353)


Signed-off-by: Lenard Nagy's avatarLenard Nagy (elnrnag) <lenard.nagy@ericsson.com>
parent ddb20bb1
......@@ -134,6 +134,11 @@ public abstract class ASN1Assignment extends Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != assPard) {
assPard.check(timestamp);
lastTimeChecked = timestamp;
......
......@@ -18,6 +18,7 @@ import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.Assignments;
import org.eclipse.titan.designer.AST.ILocateableNode;
import org.eclipse.titan.designer.AST.INamedNode;
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.NULL_Location;
......
......@@ -13,6 +13,7 @@ import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.Error_Setting;
import org.eclipse.titan.designer.AST.INamedNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISetting;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Location;
......@@ -428,8 +429,8 @@ public final class InformationFromObj extends Reference {
}
@Override
public Assignment getRefdAssignment(final CompilationTimeStamp timestamp, final boolean checkParameterList) {
return reference.getRefdAssignment(timestamp, true);
public Assignment getRefdAssignment(final CompilationTimeStamp timestamp, final boolean checkParameterList, final IReferenceChain refChain) {
return reference.getRefdAssignment(timestamp, true, refChain);
}
@Override
......
......@@ -73,7 +73,7 @@ public final class ObjectClass_refd extends ObjectClass implements IReferenceCha
protected ObjectClass getRefd(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
if (null != reference && referenceChain.add(this)) {
final Assignment assignment = reference.getRefdAssignment(timestamp, true);
final Assignment assignment = reference.getRefdAssignment(timestamp, true, referenceChain);
if (null == assignment) {
return newObjectClassDefinitionInstance();
}
......
......@@ -82,7 +82,7 @@ public final class ReferencedObject extends ASN1Object implements IReferenceChai
public ASN1Object getRefd(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
if (referenceChain.add(this)) {
final Assignment assignment = reference.getRefdAssignment(timestamp, true);
final Assignment assignment = reference.getRefdAssignment(timestamp, true, referenceChain);
if (null != assignment) {
final ISetting setting = reference.getRefdSetting(timestamp);
if (null != setting && !Setting_type.S_ERROR.equals(setting.getSettingtype())) {
......
......@@ -84,7 +84,7 @@ public final class Referenced_ObjectSet extends ObjectSet implements IObjectSet_
public ObjectSet getRefd(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
if (referenceChain.add(this)) {
final Assignment assignment = reference.getRefdAssignment(timestamp, true);
final Assignment assignment = reference.getRefdAssignment(timestamp, true, referenceChain);
if (null != assignment) {
final ISetting setting = reference.getRefdSetting(timestamp);
if (null != setting && !Setting_type.S_ERROR.equals(setting.getSettingtype())) {
......
......@@ -11,6 +11,7 @@ import java.text.MessageFormat;
import java.util.List;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISubReference;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.ReferenceFinder;
......@@ -93,6 +94,11 @@ public final class ObjectClass_Assignment extends ASN1Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -11,6 +11,7 @@ import java.text.MessageFormat;
import java.util.List;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISubReference;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.ReferenceFinder;
......@@ -102,6 +103,11 @@ public final class ObjectSet_Assignment extends ASN1Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -11,6 +11,7 @@ import java.text.MessageFormat;
import java.util.List;
import org.eclipse.titan.designer.AST.ASTVisitor;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISubReference;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.ReferenceFinder;
......@@ -101,6 +102,11 @@ public final class Object_Assignment extends ASN1Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -164,7 +164,7 @@ public final class Parameterised_Reference extends Defined_Reference {
lastChekTimeStamp = compilationTimeStamp;
final Assignment parass = assignmentReference.getRefdAssignment(compilationTimeStamp, true);
final Assignment parass = assignmentReference.getRefdAssignment(compilationTimeStamp, true, null);
if (null == parass) {
isErroneous = true;
return null;
......
......@@ -92,6 +92,11 @@ public final class Type_Assignment extends ASN1Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -105,7 +105,12 @@ public abstract class Undefined_Assignment extends ASN1Assignment {
}
@Override
public final void check(final CompilationTimeStamp timestamp) {
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -121,6 +121,11 @@ public final class Value_Assignment extends ASN1Assignment {
@Override
public void check(final CompilationTimeStamp timestamp) {
check(timestamp, null);
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
return;
}
......
......@@ -17,6 +17,7 @@ import org.eclipse.titan.designer.AST.Assignment;
import org.eclipse.titan.designer.AST.Assignments;
import org.eclipse.titan.designer.AST.FieldSubReference;
import org.eclipse.titan.designer.AST.INamedNode;
import org.eclipse.titan.designer.AST.IReferenceChain;
import org.eclipse.titan.designer.AST.ISubReference;
import org.eclipse.titan.designer.AST.Identifier;
import org.eclipse.titan.designer.AST.Module;
......@@ -240,7 +241,12 @@ public final class ASN1Module extends Module {
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference) {
Identifier moduleId = reference.getModuleIdentifier();
return getAssBySRef(timestamp, reference, null);
}
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference, IReferenceChain refChain) {
Identifier moduleId = reference.getModuleIdentifier();
final Identifier id = reference.getId();
if (null == id) {
......
......@@ -236,7 +236,9 @@ public abstract class Assignment extends ASTNode implements IOutlineElement, ILo
* @param timestamp the timestamp of the actual semantic check cycle.
* */
public abstract void check(final CompilationTimeStamp timestamp);
public abstract void check(final CompilationTimeStamp timestamp, IReferenceChain refChain);
/** Checks the properties of the assignment,
* that can only be checked after the semantic check was completely run. */
public void postCheck() {
......
......@@ -78,7 +78,12 @@ public abstract class Assignments extends Scope implements IOutlineElement, Iter
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference) {
if (null != reference.getModuleIdentifier() || null == reference.getId()) {
return getAssBySRef(timestamp, reference, null);
}
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference, IReferenceChain refChain) {
if (null != reference.getModuleIdentifier() || null == reference.getId()) {
return getModuleScope().getAssBySRef(timestamp, reference);
}
......
......@@ -17,5 +17,10 @@ import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
public abstract class Governor extends Setting implements IGovernor {
@Override
public abstract void check(final CompilationTimeStamp timestamp);
public void check(final CompilationTimeStamp timestamp) {
}
@Override
public void check(final CompilationTimeStamp timestamp, IReferenceChain refChain) {
}
}
......@@ -20,4 +20,6 @@ public interface IGovernor extends ISetting {
* @param timestamp the time stamp of the actual semantic check cycle.
* */
void check(final CompilationTimeStamp timestamp);
}
void check(final CompilationTimeStamp timestamp, IReferenceChain refChain);
}
\ No newline at end of file
......@@ -26,7 +26,12 @@ public final class NamedBridgeScope extends Scope {
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference) {
return getParentScope().getAssBySRef(timestamp, reference);
return getAssBySRef(timestamp, reference, null);
}
@Override
public Assignment getAssBySRef(final CompilationTimeStamp timestamp, final Reference reference, IReferenceChain refChain) {
return getParentScope().getAssBySRef(timestamp, reference, refChain);
}
@Override
......
......@@ -433,6 +433,11 @@ public class Reference extends ASTNode implements ILocateableNode, IIncrementall
* found.
* */
public Assignment getRefdAssignment(final CompilationTimeStamp timestamp, final boolean checkParameterList) {
return getRefdAssignment(timestamp, checkParameterList, null);
}
public Assignment getRefdAssignment(final CompilationTimeStamp timestamp, final boolean checkParameterList, final IReferenceChain referenceChain) {
if (myScope == null || getId() == null) {
return null;
}
......@@ -440,14 +445,22 @@ public class Reference extends ASTNode implements ILocateableNode, IIncrementall
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp) && !checkParameterList) {
return referredAssignment;
}
final boolean newChain = null == referenceChain;
IReferenceChain tempReferenceChain;
if (newChain) {
tempReferenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
} else {
tempReferenceChain = referenceChain;
}
detectedModuleId = false;
detectModid();
referredAssignment = myScope.getAssBySRef(timestamp, this);
referredAssignment = myScope.getAssBySRef(timestamp, this, referenceChain);
if (referredAssignment != null) {
referredAssignment.check(timestamp);
referredAssignment.check(timestamp, tempReferenceChain);
referredAssignment.setUsed();
if (referredAssignment instanceof Definition) {
......
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