getResolvedUnitResult method

Future<ResolvedUnitResult> getResolvedUnitResult(
  1. String path
)
inherited

Return the result of analyzing the file with the given path.

Throw a RequestFailure is the file cannot be analyzed or if the driver associated with the file is not an AnalysisDriver.

Implementation

Future<ResolvedUnitResult> getResolvedUnitResult(String path) async {
  var driver = driverForPath(path);
  if (driver is! AnalysisDriver) {
    // Return an error from the request.
    throw RequestFailure(
        RequestErrorFactory.pluginError('Failed to analyze $path', null));
  }
  var result = await driver.getResult2(path);
  if (result is! ResolvedUnitResult) {
    // Return an error from the request.
    throw RequestFailure(
        RequestErrorFactory.pluginError('Failed to analyze $path', null));
  }
  return result;
}