Explorar el Código

#721: Create import declarations for imported operations.

Thomas Kutz hace 9 años
padre
commit
b1237e5546

+ 15 - 7
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/transformation/StructureMapping.xtend

@@ -67,22 +67,30 @@ class StructureMapping {
 	}
 	
 	/**
-	 * Import scope has imports which needs to be resolved to get all imported variable definitions
+	 * Import scope has imports which needs to be resolved to get all imported variable and operation definitions
 	 */
 	def dispatch Scope mapScope(ImportScope scope) {
 		val _scope = scope.createScope
 		for (Import imp : scope.imports) {
-			val decls = resolver.getImportedElementsOfType(imp, org.yakindu.base.types.Property)
-			for (Declaration decl : decls) {
-				val importDecl = SGraphFactory.eINSTANCE.createImportDeclaration
-				importDecl.name = decl.name
-				importDecl.declaration = decl
-				_scope.declarations.add(importDecl)
+			val props = resolver.getImportedElementsOfType(imp, org.yakindu.base.types.Property)
+			for (Declaration decl : props) {
+				_scope.declarations.add(decl.createImportDeclaration)
+			}
+			val operations = resolver.getImportedElementsOfType(imp, org.yakindu.base.types.Operation) 
+			for (Declaration decl : operations) {
+				_scope.declarations.add(decl.createImportDeclaration)
 			}
 		}
 		return _scope
 	}
 	
+	protected def createImportDeclaration(Declaration decl) {
+		val importDecl = SGraphFactory.eINSTANCE.createImportDeclaration
+		importDecl.name = decl.name
+		importDecl.declaration = decl
+		importDecl
+	}
+	
 	
 	def dispatch Declaration map(Declaration decl) {
 	}

+ 7 - 4
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -40,9 +40,11 @@ import org.yakindu.base.expressions.expressions.PrimitiveValueExpression
 import org.yakindu.base.expressions.expressions.ShiftExpression
 import org.yakindu.base.expressions.expressions.StringLiteral
 import org.yakindu.base.expressions.expressions.TypeCastExpression
+import org.yakindu.base.types.EnumerationType
 import org.yakindu.base.types.Enumerator
 import org.yakindu.base.types.Operation
 import org.yakindu.base.types.Type
+import org.yakindu.base.types.typesystem.GenericTypeSystem
 import org.yakindu.base.types.typesystem.ITypeSystem
 import org.yakindu.sct.model.stext.stext.ActiveStateReferenceExpression
 import org.yakindu.sct.model.stext.stext.EventRaisingExpression
@@ -52,8 +54,6 @@ import org.yakindu.sct.simulation.core.sruntime.CompositeSlot
 import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable
-import org.yakindu.base.types.typesystem.GenericTypeSystem
-import org.yakindu.base.types.EnumerationType
 
 /**
  * 
@@ -147,7 +147,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 		}
 		scopeVariable.value
 	}
-
+	
 	def dispatch Object execute(EventRaisingExpression eventRaising) {
 		var event = context.resolve(eventRaising.event)
 		if (eventRaising.value != null) {
@@ -299,9 +299,12 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 		}
 
 		var slot = context.resolve(call)
-		if (slot instanceof ExecutionVariable || slot instanceof CompositeSlot) {
+		if (slot instanceof ExecutionVariable) {
 			return slot.getValue
 		}
+		if (slot instanceof CompositeSlot) {
+			return slot
+		}
 		if (slot instanceof ExecutionEvent) {
 			if(call.feature instanceof Operation) {
 				(slot as ExecutionEvent).raised = true