Browse Source

JS runtime: Fix LCA computation copy from 9a7e3ea6583197b079a7af54489dc8d00854d2de

Arkadiusz Ryś 4 years ago
parent
commit
2b28519eee
1 changed files with 9 additions and 13 deletions
  1. 9 13
      src/javascript_sccd_runtime/statecharts_core.js

+ 9 - 13
src/javascript_sccd_runtime/statecharts_core.js

@@ -968,19 +968,15 @@ Transition.prototype.setTrigger = function(trigger) {
 Transition.prototype.optimize = function() {
     // the least-common ancestor can be computed statically
     var target = this.targets[0];
-    if (target.ancestors.indexOf(this.source) >= 0) {
-        this.lca = this.source
-    } else {
-        this.lca = this.source.my_parent;
-        if (this.source.my_parent != target.my_parent) { // external
-            for (let a of this.source.ancestors) {
-                if (target.ancestors.indexOf(a) >= 0) {
-                    this.lca = a;
-                    break;
-                }
-            }
-        }
-    }
+		this.lca = this.source.my_parent;
+		if (this.source.my_parent != target.my_parent) { // external
+				for (let a of this.source.ancestors) {
+						if (target.ancestors.indexOf(a) >= 0) {
+								this.lca = a;
+								break;
+						}
+				}
+		}
 }
 
 // RuntimeClassBase