Skip to content

Commit

Permalink
Merge pull request #961 from lf-lang/validator-cleanups
Browse files Browse the repository at this point in the history
Validator cleanups
  • Loading branch information
edwardalee authored Feb 13, 2022
2 parents 73a43c7 + 8a310c5 commit a061ea6
Show file tree
Hide file tree
Showing 2 changed files with 476 additions and 413 deletions.
15 changes: 15 additions & 0 deletions org.lflang/src/org/lflang/ModelInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.lflang.lf.Model;
import org.lflang.lf.Parameter;
import org.lflang.lf.Reactor;
import org.lflang.lf.STP;


/**
Expand Down Expand Up @@ -78,6 +79,12 @@ public class ModelInfo {
* interval.
*/
public Set<Deadline> overflowingDeadlines;

/**
* The set of STP offsets that use a too-large constant to specify their time
* interval.
*/
public Set<STP> overflowingSTP;

/**
* The set of parameters used to specify a deadline while having been
Expand Down Expand Up @@ -145,6 +152,7 @@ private void collectOverflowingNodes() {
this.overflowingAssignments = new HashSet<>();
this.overflowingDeadlines = new HashSet<>();
this.overflowingParameters = new HashSet<>();
this.overflowingSTP = new HashSet<>();

// Visit all deadlines in the model; detect possible overflow.
for (var deadline : filter(toIterable(model.eAllContents()), Deadline.class)) {
Expand All @@ -158,6 +166,13 @@ private void collectOverflowingNodes() {
this.overflowingDeadlines.add(deadline);
}
}
// Visit all STP offsets in the model; detect possible overflow.
for (var stp : filter(toIterable(model.eAllContents()), STP.class)) {
// If the time value overflows, mark this deadline as overflowing.
if (isTooLarge(JavaAstUtils.getLiteralTimeValue(stp.getValue()))) {
this.overflowingSTP.add(stp);
}
}
}

/**
Expand Down
Loading

0 comments on commit a061ea6

Please sign in to comment.