ir: Repeat procedure analysis until no further changes are made

This commit is contained in:
Thomas Weber committed 2021-02-15 00:39:59 -06:00
1 parent 3874a2625d
commit dc2ee0a495
1 file changed
+6 -2
+6 -2
View File
@@ -1394,6 +1394,7 @@ class IRGenerator {
this.procedures = {};
this.analyzedProcedures = [];
this.analyzeMadeChanges = false;
}
addProcedureDependencies (dependencies) {
@@ -1441,6 +1442,7 @@ class IRGenerator {
// If a procedure used by a script may yield, the script itself may yield.
if (procedureData.yields) {
script.yields = true;
this.analyzeMadeChanges = true;
}
}
}
@@ -1488,8 +1490,10 @@ class IRGenerator {
}
}
// This will recursively analyze procedures as well.
this.analyzeScript(entry);
do {
this.analyzeScript(entry);
this.analyzeMadeChanges = false;
} while (this.analyzeMadeChanges);
const ir = new IntermediateRepresentation();
ir.entry = entry;