Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator cleanups #961

Merged
merged 4 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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