anchor.diff:      return _analyzeSync(printMode);
     }
   
  -  void prepareAnalysisContext(JavaFile sourceFile, Source source) {
  +  Source computeLibrarySource() {
  +    JavaFile sourceFile = new JavaFile(sourcePath);
  +    Source source = sdk.fromFileUri(sourceFile.toURI());
  +    if (source != null) {
  +      return source;
  +    }
  +    source = new FileBasedSource.con2(sourceFile.toURI(), sourceFile);
  +    Uri uri = context.sourceFactory.restoreUri(source);
  +    return new FileBasedSource.con2(uri, sourceFile);
  +  }
  +
  +  /**
  +   * Create and return the source factory to be used by the analysis context.
  +   */
  +  SourceFactory createSourceFactory() {
       List<UriResolver> resolvers = [
         new CustomUriResolver(options.customUrlMappings),
  -      new DartUriResolver(sdk),
  -      new FileUriResolver()
  +      new DartUriResolver(sdk)
       ];
  -    // maybe add package resolver
  -    {
  -      JavaFile packageDirectory;
  -      if (options.packageRootPath != null) {
  -        packageDirectory = new JavaFile(options.packageRootPath);
  -        resolvers.add(new PackageUriResolver([packageDirectory]));
  -      } else {
  -        PubPackageMapProvider pubPackageMapProvider =
  -            new PubPackageMapProvider(PhysicalResourceProvider.INSTANCE, sdk);
  -        PackageMapInfo packageMapInfo = pubPackageMapProvider.computePackageMap(
  -            PhysicalResourceProvider.INSTANCE.getResource('.'));
  -        Map<String, List<Folder>> packageMap = packageMapInfo.packageMap;
  -        if (packageMap != null) {
  -          resolvers.add(new PackageMapUriResolver(
  -              PhysicalResourceProvider.INSTANCE, packageMap));
  -        }
  -      }
  -    }
  -    sourceFactory = new SourceFactory(resolvers);
  +    if (options.packageRootPath != null) {
  +      JavaFile packageDirectory = new JavaFile(options.packageRootPath);
  +      resolvers.add(new PackageUriResolver([packageDirectory]));
  +    } else {
  +      PubPackageMapProvider pubPackageMapProvider =
  +          new PubPackageMapProvider(PhysicalResourceProvider.INSTANCE, sdk);
  +      PackageMapInfo packageMapInfo = pubPackageMapProvider.computePackageMap(
  +          PhysicalResourceProvider.INSTANCE.getResource('.'));
  +      Map<String, List<Folder>> packageMap = packageMapInfo.packageMap;
  +      if (packageMap != null) {
  +        resolvers.add(new PackageMapUriResolver(
  +            PhysicalResourceProvider.INSTANCE, packageMap));
  +      }
  +    }
  +    resolvers.add(new FileUriResolver());
  +    return new SourceFactory(resolvers);
  +  }
  +
  +  void prepareAnalysisContext() {
  +    sourceFactory = createSourceFactory();
       context = AnalysisEngine.instance.createAnalysisContext();
       context.sourceFactory = sourceFactory;
       Map<String, String> definedVariables = options.definedVariables;
  
positive.code:     contextOptions.generateSdkErrors = options.showSdkWarnings;
      context.analysisOptions = contextOptions;
  
      // Create and add a ChangeSet
      ChangeSet changeSet = new ChangeSet();
      changeSet.addedSource(source);
      context.applyChanges(changeSet);
    }
  
  
negative.code:     if (sourcePath == null) {
        throw new ArgumentError("sourcePath cannot be null");
      }
      // prepare context
      prepareAnalysisContext();
    }
  
    /// The async version of the analysis
  