Commit 6f66176a authored by Daniel Honsel's avatar Daniel Honsel
Browse files

fixed check 'checkNoUnusedFormalParameters' for modified templates

parent f3d17d76
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -989,18 +989,12 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
			return

		var current = template
		val ArrayList<TTCN3Reference> baseParams = newArrayList
		val ArrayList<TTCN3Reference> paramList = newArrayList
		val ArrayList<BaseTemplate> consideredTemplates = newArrayList
		consideredTemplates.add(current)

		do {
			if (current.parList != null) {
				for (p : current.parList.findAllParameters) {
					if (paramList.filter[(it as TTCN3Reference).name == (p as TTCN3Reference).name].size == 0) {
						paramList.add(p)
					}
				}
			}
			if ((current.eContainer as TemplateDef).derived != null) {
				if (consideredTemplates.contains((current.eContainer as TemplateDef).derived.template)) {
					statistics.incrementCountStyle
@@ -1018,13 +1012,22 @@ class CodeStyleValidator extends AbstractDeclarativeValidator {
					current = null
				} else {
					current = (current.eContainer as TemplateDef).derived.template
					if (current != null) {
						consideredTemplates.add(current)
						baseParams.addAll(current.parList.findAllParameters)
					}
				}
				current = (current.eContainer as TemplateDef).derived.template
			} else {
				current = null
			}
		} while (current != null)

		for (p : template.parList.findAllParameters) {
			if (baseParams.filter[(it as TTCN3Reference).name == (p as TTCN3Reference).name].size == 0) {
				paramList.add(p)
			}
		}

		template.checkNoUnusedFormalParameters(paramList)
	}