Commit 6a741731 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ fixed issue where over specific runs on did not check if the called...

+ fixed issue where over specific runs on did not check if the called functions run on the same component as the calling function 
parent f4b06002
Loading
Loading
Loading
Loading
+29 −2
Original line number Diff line number Diff line
@@ -984,6 +984,31 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
		return nextLevelCheck
	}

	private def boolean isRunningOnSameComponent(TTCN3Reference parent, TTCN3Reference nextLevel) {
		if (nextLevel instanceof FunctionDef) {
			if (parent instanceof FunctionDef) {
				if (nextLevel.runsOn.component == parent.runsOn.component) {
					return true;
				}
			} else if (parent instanceof AltstepDef) {
				if (nextLevel.runsOn.component == parent.spec.component) {
					return true;
				}
			}
		} else if (nextLevel instanceof AltstepDef) {
			if (parent instanceof FunctionDef) {
				if (nextLevel.spec.component == parent.runsOn.component) {
					return true;
				}
			} else if (parent instanceof AltstepDef) {
				if (nextLevel.spec.component == parent.spec.component) {
					return true;
				}
			}
		}
		return false;
	}

	private def boolean isReferencedInHierarchy(TTCN3Reference parent, ArrayList<TTCN3Reference> consideredAltOrFunc) {
		var ArrayList<TTCN3Reference> nextLevelCheck = parent.nextLevelFunctionsOrAltsteps(consideredAltOrFunc)
		do {
@@ -991,7 +1016,8 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
				if (o instanceof FunctionDef) {
					if (o.runsOn != null) {
						if (o.specifiedComponentResolved(o.runsOn.component)) {
							if (o.runsOn.component.isReferencedComponentSpec(o)) {
							//check if the component is the same as the one from the context!!!
							if (o.isRunningOnSameComponent(parent) && o.runsOn.component.isReferencedComponentSpec(o)) {
								return true
							} else {
								nextLevelCheck = o.nextLevelFunctionsOrAltsteps(consideredAltOrFunc)
@@ -1007,7 +1033,8 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
				} else if (o instanceof AltstepDef) {
					if (o.spec != null) {
						if (o.specifiedComponentResolved(o.spec.component)) {
							if (o.spec.component.isReferencedComponentSpec(o)) {
							//check if the component is the same as the one from the context!!!
							if (o.isRunningOnSameComponent(parent) && o.spec.component.isReferencedComponentSpec(o)) {
								return true
							} else {
								nextLevelCheck = o.nextLevelFunctionsOrAltsteps(consideredAltOrFunc)