Просмотр исходного кода

Fixed earlier regression (all non-actionlang tests pass again). Some action lang tests pass.

Joeri Exelmans 5 лет назад
Родитель
Сommit
f149d413b0
2 измененных файлов с 9 добавлено и 9 удалено
  1. 1 1
      src/sccd/action_lang/codegen/rust.py
  2. 8 8
      src/sccd/statechart/codegen/rust.py

+ 1 - 1
src/sccd/action_lang/codegen/rust.py

@@ -321,7 +321,7 @@ class ActionLangRustGenerator(Visitor):
     def visit_SCCDClosureObject(self, type):
     def visit_SCCDClosureObject(self, type):
         # self.w.wno("<closure type> ")
         # self.w.wno("<closure type> ")
 
 
-        self.w.wno("(%s, " % self.scope.type(type.scope, type.scope.parent_offset))
+        self.w.wno("(%s, " % self.scope.type(type.scope, type.scope.size()))
         type.function_type.accept(self)
         type.function_type.accept(self)
         self.w.wno(")")
         self.w.wno(")")
 
 

+ 8 - 8
src/sccd/statechart/codegen/rust.py

@@ -345,7 +345,7 @@ class StatechartRustGenerator(ActionLangRustGenerator):
 
 
                     if len(exit_path) == 1:
                     if len(exit_path) == 1:
                         # Exit s:
                         # Exit s:
-                        self.w.writeln("%s.exit_current(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_var(s)))
+                        self.w.writeln("%s.exit_current(&mut sc.timers, scope, internal, ctrl);" % (ident_var(s)))
                     else:
                     else:
                         # Exit children:
                         # Exit children:
                         if isinstance(s.type, AndState):
                         if isinstance(s.type, AndState):
@@ -353,12 +353,12 @@ class StatechartRustGenerator(ActionLangRustGenerator):
                                 if exit_path[1] is c:
                                 if exit_path[1] is c:
                                     write_exit(exit_path[1:]) # continue recursively
                                     write_exit(exit_path[1:]) # continue recursively
                                 else:
                                 else:
-                                    self.w.writeln("%s.exit_current(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_var(c)))
+                                    self.w.writeln("%s.exit_current(&mut sc.timers, scope, internal, ctrl);" % (ident_var(c)))
                         elif isinstance(s.type, OrState):
                         elif isinstance(s.type, OrState):
                             write_exit(exit_path[1:]) # continue recursively with the next child on the exit path
                             write_exit(exit_path[1:]) # continue recursively with the next child on the exit path
 
 
                         # Exit s:
                         # Exit s:
-                        self.w.writeln("%s::exit_actions(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_type(s)))
+                        self.w.writeln("%s::exit_actions(&mut sc.timers, scope, internal, ctrl);" % (ident_type(s)))
 
 
                     # Store history
                     # Store history
                     if s.deep_history:
                     if s.deep_history:
@@ -382,19 +382,19 @@ class StatechartRustGenerator(ActionLangRustGenerator):
                     if len(enter_path) == 1:
                     if len(enter_path) == 1:
                         # Target state.
                         # Target state.
                         if isinstance(s, HistoryState):
                         if isinstance(s, HistoryState):
-                            self.w.writeln("sc.%s.enter_current(&mut sc.timers, &mut sc.data, internal, ctrl); // Enter actions for history state" %(ident_history_field(s)))
+                            self.w.writeln("sc.%s.enter_current(&mut sc.timers, scope, internal, ctrl); // Enter actions for history state" %(ident_history_field(s)))
                         else:
                         else:
-                            self.w.writeln("%s::enter_default(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_type(s)))
+                            self.w.writeln("%s::enter_default(&mut sc.timers, scope, internal, ctrl);" % (ident_type(s)))
                     else:
                     else:
                         # Enter s:
                         # Enter s:
-                        self.w.writeln("%s::enter_actions(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_type(s)))
+                        self.w.writeln("%s::enter_actions(&mut sc.timers, scope, internal, ctrl);" % (ident_type(s)))
                         # Enter children:
                         # Enter children:
                         if isinstance(s.type, AndState):
                         if isinstance(s.type, AndState):
                             for c in s.children:
                             for c in s.children:
                                 if enter_path[1] is c:
                                 if enter_path[1] is c:
                                     write_enter(enter_path[1:]) # continue recursively
                                     write_enter(enter_path[1:]) # continue recursively
                                 else:
                                 else:
-                                    self.w.writeln("%s::enter_default(&mut sc.timers, &mut sc.data, internal, ctrl);" % (ident_type(c)))
+                                    self.w.writeln("%s::enter_default(&mut sc.timers, scope, internal, ctrl);" % (ident_type(c)))
                         elif isinstance(s.type, OrState):
                         elif isinstance(s.type, OrState):
                             if len(s.children) > 0:
                             if len(s.children) > 0:
                                 write_enter(enter_path[1:]) # continue recursively with the next child on the enter path
                                 write_enter(enter_path[1:]) # continue recursively with the next child on the enter path
@@ -467,7 +467,7 @@ class StatechartRustGenerator(ActionLangRustGenerator):
                         self.w.writeln("if %s {" % " && ".join(condition))
                         self.w.writeln("if %s {" % " && ".join(condition))
                         self.w.indent()
                         self.w.indent()
 
 
-                    self.w.writeln("let parent1 = scope;")
+                    self.w.writeln("let parent1 = &scope;")
 
 
                     if t.guard is not None:
                     if t.guard is not None:
                         self.w.write("if ")
                         self.w.write("if ")