# HG changeset patch
# User laurent
# Date 1347374019 -7200
# Node ID 050045c32d988d69185b45cefdb42594b2269900
# Parent  3667bb14aeca9c15158301a72c0e9d48d32404c5
Fix bug in PLCGenerator connection types not computed for SFC actions and transitions body

diff -r 3667bb14aeca -r 050045c32d98 PLCGenerator.py
--- a/PLCGenerator.py	Tue Sep 11 16:30:42 2012 +0200
+++ b/PLCGenerator.py	Tue Sep 11 16:33:39 2012 +0200
@@ -637,7 +637,10 @@
                 if isinstance(instance, (plcopen.fbdObjects_inVariable, plcopen.fbdObjects_outVariable, plcopen.fbdObjects_inOutVariable)):
                     expression = instance.getexpression()
                     var_type = self.GetVariableType(expression)
-                    if pou.getpouType() == "function" and expression == pou.getname():
+                    if isinstance(pou, plcopen.transitions_transition) and expression == pou.getname():
+                        var_type = "BOOL"
+                    elif (not isinstance(pou, (plcopen.transitions_transition, plcopen.actions_action)) and
+                          pou.getpouType() == "function" and expression == pou.getname()):
                         returntype_content = pou.interface.getreturnType().getcontent()
                         if returntype_content["name"] == "derived":
                             var_type = returntype_content["value"].getname()
@@ -742,6 +745,15 @@
                     self.ComputeBlockInputTypes(instance, block_infos, body)
                 else:
                     raise PLCGenException, _("No informations found for \"%s\" block")%(instance.gettypeName())
+            if body_type == "SFC":
+                previous_tagname = self.TagName
+                for action in pou.getactionList():
+                    self.TagName = self.ParentGenerator.Controler.ComputePouActionName(self.Name, action.getname())
+                    self.ComputeConnectionTypes(action)
+                for transition in pou.gettransitionList():
+                    self.TagName = self.ParentGenerator.Controler.ComputePouTransitionName(self.Name, transition.getname())
+                    self.ComputeConnectionTypes(transition)
+                self.TagName = previous_tagname
                 
     def ComputeBlockInputTypes(self, instance, block_infos, body):
         undefined = {}