Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 2256623005: We need a CompilationUnit with element.library set. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Use RESOLVED_UNIT_RESULTS. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.context.context; 5 library analyzer.src.context.context;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 entry.setState(TOKEN_STREAM, CacheState.FLUSHED); 1864 entry.setState(TOKEN_STREAM, CacheState.FLUSHED);
1865 entry.setState(PARSED_UNIT, CacheState.FLUSHED); 1865 entry.setState(PARSED_UNIT, CacheState.FLUSHED);
1866 SourceKind sourceKind = getKindOf(source); 1866 SourceKind sourceKind = getKindOf(source);
1867 List<Source> partSources = getResult(source, INCLUDED_PARTS); 1867 List<Source> partSources = getResult(source, INCLUDED_PARTS);
1868 if (sourceKind == SourceKind.LIBRARY && partSources.isEmpty) { 1868 if (sourceKind == SourceKind.LIBRARY && partSources.isEmpty) {
1869 Source librarySource = source; 1869 Source librarySource = source;
1870 // Try to find an old unit which has element model. 1870 // Try to find an old unit which has element model.
1871 CacheEntry unitEntry = 1871 CacheEntry unitEntry =
1872 getCacheEntry(new LibrarySpecificUnit(librarySource, source)); 1872 getCacheEntry(new LibrarySpecificUnit(librarySource, source));
1873 CompilationUnit oldUnit = RESOLVED_UNIT_RESULTS 1873 CompilationUnit oldUnit = RESOLVED_UNIT_RESULTS
1874 .skipWhile((result) => result != RESOLVED_UNIT2)
1874 .map(unitEntry.getValue) 1875 .map(unitEntry.getValue)
1875 .firstWhere((unit) => unit != null, orElse: () => null); 1876 .firstWhere((unit) => unit != null, orElse: () => null);
1876 // If we have the old unit, we can try to update it. 1877 // If we have the old unit, we can try to update it.
1877 if (oldUnit != null) { 1878 if (oldUnit != null) {
1878 CompilationUnit newUnit = parseCompilationUnit(source); 1879 CompilationUnit newUnit = parseCompilationUnit(source);
1879 IncrementalCompilationUnitElementBuilder builder = 1880 IncrementalCompilationUnitElementBuilder builder =
1880 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); 1881 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit);
1881 builder.build(); 1882 builder.build();
1882 CompilationUnitElementDelta unitDelta = builder.unitDelta; 1883 CompilationUnitElementDelta unitDelta = builder.unitDelta;
1883 if (!unitDelta.hasDirectiveChange) { 1884 if (!unitDelta.hasDirectiveChange) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 } 2296 }
2296 DartSdk sdk = factory.dartSdk; 2297 DartSdk sdk = factory.dartSdk;
2297 if (sdk == null) { 2298 if (sdk == null) {
2298 throw new IllegalArgumentException( 2299 throw new IllegalArgumentException(
2299 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2300 "The source factory for an SDK analysis context must have a DartUriRes olver");
2300 } 2301 }
2301 return new AnalysisCache( 2302 return new AnalysisCache(
2302 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 2303 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
2303 } 2304 }
2304 } 2305 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698