Skip to content

Commit

Permalink
Fix some problems
Browse files Browse the repository at this point in the history
  • Loading branch information
oowekyala committed Feb 3, 2023
1 parent 78eacad commit 1485833
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
19 changes: 11 additions & 8 deletions org.lflang/src/org/lflang/generator/GeneratorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Set;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.diagnostics.Severity;
import org.eclipse.xtext.generator.IGeneratorContext;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.validation.CheckMode;
Expand Down Expand Up @@ -238,20 +240,21 @@ public static void validate(
// and yet it used to only report errors in the files doing the importing.
IResourceValidator validator = ((XtextResource) fileConfig.resource).getResourceServiceProvider()
.getResourceValidator();
HashSet<Resource> bad = new HashSet<>();
HashSet<Resource> visited = new HashSet<>();
Set<Resource> bad = new HashSet<>();
Set<Resource> visited = new HashSet<>();
// The graph must be traversed in topological order so that errors will propagate through arbitrarily many
// levels.
for (Reactor reactor : instantiationGraph.nodesInTopologicalOrder()) {
Resource resource = reactor.eResource();
if (visited.contains(resource)) continue;
visited.add(resource);
if (!visited.add(resource)) {
continue;
}
List<Issue> issues = validator.validate(resource, CheckMode.ALL, context.getCancelIndicator());
if (
bad.contains(resource) || issues.size() > 0
) {
// warnings and such are not reported on included files.
issues.removeIf(it -> it.getSeverity() != Severity.ERROR);
if (bad.contains(resource) || !issues.isEmpty()) {
// Report the error on this resource.
Path path = null;
Path path;
try {
path = FileUtil.toPath(resource);
} catch (IOException e) {
Expand Down
2 changes: 1 addition & 1 deletion test/Cpp/src/target/CliParserGenericArguments.lf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ main reactor CliParserGenericArguments(
long_double_value: {= long_double =} = 4.2,
float_value: float = 10.5,
string_value: string = "This is a testvalue",
custom_class_value: {= CustomClass =} = "Peter"
custom_class_value: {= CustomClass =}("Peter")
) {
reaction(startup) {= std::cout << "Hello World!\n"; =}
}
3 changes: 1 addition & 2 deletions test/Rust/src/MovingAverage.lf
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ reactor Source {
}

reactor MovingAverageImpl {
// fixme inaccessible ({=[0.0 ; 4]=});
state delay_line: f64[4](0.0, 0.0, 0.0, 0.0)
state delay_line: {=[f64 ; 4]=} = {= [ 0.0 ; 4 ] =}
state index: usize = 0
input in_: f64
output out: f64
Expand Down

0 comments on commit 1485833

Please sign in to comment.