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

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

Issue 2331833002: Switch to FolderBasedDartSdk. (Closed)
Patch Set: Created 4 years, 3 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 | lib/src/resolvers.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 code_transformers.src.dart_sdk; 5 library code_transformers.src.dart_sdk;
6 6
7 import 'dart:io' show Directory; 7 import 'dart:io' show Directory;
8 8
9 /// Note that the Analyzer has two versions of SdkAnalysisContext (and lots of 9 import 'package:analyzer/file_system/file_system.dart';
10 /// other classes) with different signatures: can't mix the two. 10 import 'package:analyzer/src/context/context.dart';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/dart/sdk/sdk.dart';
12 show AnalysisOptions, InternalAnalysisContext, TimestampedData; 12 import 'package:analyzer/src/generated/engine.dart';
13 import 'package:analyzer/src/context/context.dart' show SdkAnalysisContext;
14 import 'package:analyzer/src/generated/java_io.dart';
15 import 'package:analyzer/src/generated/sdk.dart'; 13 import 'package:analyzer/src/generated/sdk.dart';
16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk;
17 import 'package:analyzer/src/generated/source.dart'; 14 import 'package:analyzer/src/generated/source.dart';
18 import 'package:analyzer/src/summary/idl.dart'; 15 import 'package:analyzer/src/summary/idl.dart';
19 import 'package:cli_util/cli_util.dart' as cli_util; 16 import 'package:cli_util/cli_util.dart' as cli_util;
20 17
21 /// Attempts to provide the current Dart SDK directory. 18 /// Attempts to provide the current Dart SDK directory.
22 /// 19 ///
23 /// This will return null if the SDK cannot be found 20 /// This will return null if the SDK cannot be found
24 /// 21 ///
25 /// Note that this may not be correct when executing outside of `pub`. 22 /// Note that this may not be correct when executing outside of `pub`.
26 String get dartSdkDirectory { 23 String get dartSdkDirectory {
27 Directory sdkDir = cli_util.getSdkDir(); 24 Directory sdkDir = cli_util.getSdkDir();
28 return sdkDir != null ? sdkDir.path : null; 25 return sdkDir != null ? sdkDir.path : null;
29 } 26 }
30 27
31 /// Sources that are annotated with a source uri, so it is easy to resolve how 28 /// Sources that are annotated with a source uri, so it is easy to resolve how
32 /// to support `Resolver.getImportUri`. 29 /// to support `Resolver.getImportUri`.
33 abstract class UriAnnotatedSource extends Source { 30 abstract class UriAnnotatedSource extends Source {
34 Uri get uri; 31 Uri get uri;
35 } 32 }
36 33
37 /// Dart SDK which wraps all Dart sources as [UriAnnotatedSource] to ensure they 34 /// Dart SDK which wraps all Dart sources as [UriAnnotatedSource] to ensure they
38 /// are tracked with Uris. 35 /// are tracked with Uris.
39 class DirectoryBasedDartSdkProxy extends DirectoryBasedDartSdk { 36 class FolderBasedDartSdkProxy extends FolderBasedDartSdk {
40 DirectoryBasedDartSdkProxy(String sdkDirectory) 37 FolderBasedDartSdkProxy(
41 : super(new JavaFile(sdkDirectory)); 38 ResourceProvider resourceProvider, String sdkDirectory)
39 : super(resourceProvider, resourceProvider.getFolder(sdkDirectory));
42 40
43 Source mapDartUri(String dartUri) => 41 Source mapDartUri(String dartUri) =>
44 DartSourceProxy.wrap(super.mapDartUri(dartUri), Uri.parse(dartUri)); 42 DartSourceProxy.wrap(super.mapDartUri(dartUri), Uri.parse(dartUri));
45 } 43 }
46 44
47 /// Dart SDK resolver which wraps all Dart sources to ensure they are tracked 45 /// Dart SDK resolver which wraps all Dart sources to ensure they are tracked
48 /// with URIs. 46 /// with URIs.
49 class DartUriResolverProxy implements DartUriResolver { 47 class DartUriResolverProxy implements DartUriResolver {
50 final DartUriResolver _proxy; 48 final DartUriResolver _proxy;
51 DartUriResolverProxy(DartSdk sdk) : _proxy = new DartUriResolver(sdk); 49 DartUriResolverProxy(DartSdk sdk) : _proxy = new DartUriResolver(sdk);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 'dart:async': ''' 262 'dart:async': '''
265 class Future<T> { 263 class Future<T> {
266 Future then(callback) {} 264 Future then(callback) {}
267 class Stream<T> {} 265 class Stream<T> {}
268 ''', 266 ''',
269 'dart:html': ''' 267 'dart:html': '''
270 library dart.html; 268 library dart.html;
271 class HtmlElement {} 269 class HtmlElement {}
272 ''', 270 ''',
273 }; 271 };
OLDNEW
« no previous file with comments | « no previous file | lib/src/resolvers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698