Commit d4ffaa6d authored by Daniel Honsel's avatar Daniel Honsel
Browse files

fixed references to component attributes where a function runs on

parent b4857043
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -601,8 +601,9 @@ CallBodyGuard:
CallBodyOps:
	reply=GetReplyStatement | catch=CatchStatement;

// changed port=ArrayIdentifierRef -> port=[PortElement|IDENTIFIER] arryRefs+=ArrayOrBitRef*
SendStatement: 
	array=ArrayIdentifierRef DOT port=PortSendOp;
	port=[PortElement|IDENTIFIER] arryRefs+=ArrayOrBitRef* DOT send=PortSendOp;

PortSendOp:
	SENDOPKEYWORD LPAREN template=InLineTemplate RPAREN to=ToClause?;
@@ -1191,7 +1192,7 @@ SelectCase:
	statement=StatementBlock;

FunctionDef:
	FUNCTIONKEYWORD name=IDENTIFIER LPAREN parameterList=FunctionFormalParList? RPAREN runs=RunsOnSpec?
	FUNCTIONKEYWORD name=IDENTIFIER LPAREN parameterList=FunctionFormalParList? RPAREN runsOn=RunsOnSpec?
	returnType=ReturnType? statement=StatementBlock;

FunctionFormalParList:
+15 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import static org.eclipse.xtext.scoping.Scopes.*

import static extension de.ugoe.cs.swe.common.TTCN3ScopeHelper.*
import de.ugoe.cs.swe.tTCN3.FieldExpressionSpec
import de.ugoe.cs.swe.tTCN3.SendStatement

class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider {

@@ -69,6 +70,9 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider {
				parent.init.scopeInitial(list)
			} else if (parent instanceof FunctionDef) {
				if(parent.parameterList != null) parent.parameterList.scopeFunctionParameterValue(list)
				if (parent.runsOn != null) {
					parent.runsOn.component.componentScopeValueRefs(list, false, true)
				}
			} else if (parent instanceof ModuleControlPart) {
				parent.scopeModuleControlPart(list)
			} else if (parent instanceof ComponentDef) {
@@ -227,4 +231,15 @@ class TTCN3ScopeProvider extends AbstractDeclarativeScopeProvider {
			componentScopePorts(e, list)
		}
	}

	def IScope scope_SendStatement_port(SendStatement stm, EReference ref) {
		val list = newArrayList

		// ports from parent function
		val function = stm.findDesiredParent(typeof(FunctionDef)) as FunctionDef
		if (function.runsOn != null) {
			function.runsOn.component.componentScopePorts(list)
		}
		scopeFor(list)
	}
}