Skip to content

Commit

Permalink
Add an overload of bind that accepts a log
Browse files Browse the repository at this point in the history
To support clients that want to retrieve partial bindings results
for compilations with errors.

PiperOrigin-RevId: 572936727
  • Loading branch information
cushon authored and Javac Team committed Oct 12, 2023
1 parent 0a8f212 commit c5222c6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion java/com/google/turbine/binder/Binder.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ public final class Binder {
ClassPath bootclasspath,
Optional<String> moduleVersion) {
TurbineLog log = new TurbineLog();
BindingResult br = bind(log, units, classpath, processorInfo, bootclasspath, moduleVersion);
log.maybeThrow();
return br;
}

/** Binds symbols and types to the given compilation units. */
public static @Nullable BindingResult bind(
TurbineLog log,
ImmutableList<CompUnit> units,
ClassPath classpath,
ProcessorInfo processorInfo,
ClassPath bootclasspath,
Optional<String> moduleVersion) {
BindingResult br;
try {
br =
Expand All @@ -114,7 +127,6 @@ public final class Binder {
.addAll(turbineError.diagnostics())
.build());
}
log.maybeThrow();
return br;
}

Expand Down

0 comments on commit c5222c6

Please sign in to comment.