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

Side by Side Diff: lib/src/analyzer/dart_sdk.dart

Issue 1879373004: Implement modular compilation (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 8 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 | « lib/src/analyzer/context.dart ('k') | lib/src/analyzer/multi_package_resolver.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 /// Common logic needed to provide a Dart SDK to the analyzer's resolver. This 5 /// Common logic needed to provide a Dart SDK to the analyzer's resolver. This
6 /// includes logic to determine where the sdk is located in the filesystem, and 6 /// includes logic to determine where the sdk is located in the filesystem, and
7 /// definitions to provide mock sdks. 7 /// definitions to provide mock sdks.
8 8
9 import 'package:analyzer/src/generated/engine.dart' 9 import 'package:analyzer/src/generated/engine.dart'
10 show AnalysisContext, AnalysisEngine, TimestampedData; 10 show AnalysisContext, AnalysisEngine, TimestampedData;
11 import 'package:analyzer/src/generated/sdk.dart' 11 import 'package:analyzer/src/generated/sdk.dart'
12 show DartSdk, SdkLibrary, SdkLibraryImpl; 12 show DartSdk, SdkLibrary, SdkLibraryImpl;
13 import 'package:analyzer/src/generated/source.dart' 13 import 'package:analyzer/src/generated/source.dart'
14 show DartUriResolver, Source, SourceFactory, UriKind; 14 show DartUriResolver, Source, SourceFactory, UriKind;
15 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl; 15 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
16 import 'package:analyzer/src/context/cache.dart' 16 import 'package:analyzer/src/context/cache.dart'
17 show AnalysisCache, CachePartition; 17 show AnalysisCache, CachePartition;
18 18
19 /// Dart SDK which contains a mock implementation of the SDK libraries. May be 19 /// Dart SDK which contains a mock implementation of the SDK libraries. May be
20 /// used to speed up execution when most of the core libraries is not needed. 20 /// used to speed up execution when most of the core libraries is not needed.
21 //
22 // TODO(jmesserly): replace this with Analyzer's mock SDK, or use summaries
23 // to load the real SDK.
21 class MockDartSdk implements DartSdk { 24 class MockDartSdk implements DartSdk {
22 final Map<Uri, _MockSdkSource> _sources = {}; 25 final Map<Uri, _MockSdkSource> _sources = {};
23 final bool reportMissing; 26 final bool reportMissing;
24 final Map<String, SdkLibrary> _libs = {}; 27 final Map<String, SdkLibrary> _libs = {};
25 final String sdkVersion = '0'; 28 final String sdkVersion = '0';
26 List<String> get uris => _sources.keys.map((uri) => '$uri').toList(); 29 List<String> get uris => _sources.keys.map((uri) => '$uri').toList();
30
27 AnalysisContext context; 31 AnalysisContext context;
28 DartUriResolver _resolver; 32 DartUriResolver _resolver;
29 DartUriResolver get resolver => _resolver; 33 DartUriResolver get resolver => _resolver;
30 34
31 MockDartSdk(Map<String, String> sources, {this.reportMissing}) { 35 MockDartSdk(Map<String, String> sources, {this.reportMissing}) {
32 context = new _SdkAnalysisContext(this); 36 context = new _SdkAnalysisContext(this);
33 sources.forEach((uriString, contents) { 37 sources.forEach((uriString, contents) {
34 var uri = Uri.parse(uriString); 38 var uri = Uri.parse(uriString);
35 _sources[uri] = new _MockSdkSource(uri, contents); 39 _sources[uri] = new _MockSdkSource(uri, contents);
36 _libs[uriString] = new SdkLibraryImpl(uri.path) 40 _libs[uriString] = new SdkLibraryImpl(uri.path)
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 198
195 @override 199 @override
196 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 200 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
197 if (factory == null) { 201 if (factory == null) {
198 return super.createCacheFromSourceFactory(factory); 202 return super.createCacheFromSourceFactory(factory);
199 } 203 }
200 return new AnalysisCache( 204 return new AnalysisCache(
201 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 205 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
202 } 206 }
203 } 207 }
OLDNEW
« no previous file with comments | « lib/src/analyzer/context.dart ('k') | lib/src/analyzer/multi_package_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698