| OLD | NEW |
| 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 /// Note that the Analyzer has two versions of SdkAnalysisContext (and lots of |
| 10 /// other classes) with different signatures: can't mix the two. | 10 /// other classes) with different signatures: can't mix the two. |
| 11 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
| 12 show AnalysisOptions, InternalAnalysisContext, TimestampedData; | 12 show AnalysisOptions, InternalAnalysisContext, TimestampedData; |
| 13 import 'package:analyzer/src/context/context.dart' show SdkAnalysisContext; | 13 import 'package:analyzer/src/context/context.dart' show SdkAnalysisContext; |
| 14 import 'package:analyzer/src/generated/java_io.dart'; | 14 import 'package:analyzer/src/generated/java_io.dart'; |
| 15 import 'package:analyzer/src/generated/sdk.dart'; | 15 import 'package:analyzer/src/generated/sdk.dart'; |
| 16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:analyzer/src/summary/idl.dart'; |
| 18 import 'package:cli_util/cli_util.dart' as cli_util; | 19 import 'package:cli_util/cli_util.dart' as cli_util; |
| 19 | 20 |
| 20 /// Attempts to provide the current Dart SDK directory. | 21 /// Attempts to provide the current Dart SDK directory. |
| 21 /// | 22 /// |
| 22 /// This will return null if the SDK cannot be found | 23 /// This will return null if the SDK cannot be found |
| 23 /// | 24 /// |
| 24 /// Note that this may not be correct when executing outside of `pub`. | 25 /// Note that this may not be correct when executing outside of `pub`. |
| 25 String get dartSdkDirectory { | 26 String get dartSdkDirectory { |
| 26 Directory sdkDir = cli_util.getSdkDir(); | 27 Directory sdkDir = cli_util.getSdkDir(); |
| 27 return sdkDir != null ? sdkDir.path : null; | 28 return sdkDir != null ? sdkDir.path : null; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 _sources[uri] = | 167 _sources[uri] = |
| 167 src = new _MockSdkSource(uri, 'library dart.${uri.path};'); | 168 src = new _MockSdkSource(uri, 'library dart.${uri.path};'); |
| 168 } | 169 } |
| 169 return src; | 170 return src; |
| 170 } | 171 } |
| 171 | 172 |
| 172 @override | 173 @override |
| 173 Source fromFileUri(Uri uri) { | 174 Source fromFileUri(Uri uri) { |
| 174 throw new UnsupportedError('MockDartSdk.fromFileUri'); | 175 throw new UnsupportedError('MockDartSdk.fromFileUri'); |
| 175 } | 176 } |
| 177 |
| 178 @override |
| 179 PackageBundle getLinkedBundle() => null; |
| 176 } | 180 } |
| 177 | 181 |
| 178 class _MockSdkSource implements UriAnnotatedSource { | 182 class _MockSdkSource implements UriAnnotatedSource { |
| 179 /// Absolute URI which this source can be imported from. | 183 /// Absolute URI which this source can be imported from. |
| 180 final Uri uri; | 184 final Uri uri; |
| 181 final String _contents; | 185 final String _contents; |
| 182 | 186 |
| 183 Source get source => this; | 187 Source get source => this; |
| 184 | 188 |
| 185 Source get librarySource => null; | 189 Source get librarySource => null; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 'dart:async': ''' | 264 'dart:async': ''' |
| 261 class Future<T> { | 265 class Future<T> { |
| 262 Future then(callback) {} | 266 Future then(callback) {} |
| 263 class Stream<T> {} | 267 class Stream<T> {} |
| 264 ''', | 268 ''', |
| 265 'dart:html': ''' | 269 'dart:html': ''' |
| 266 library dart.html; | 270 library dart.html; |
| 267 class HtmlElement {} | 271 class HtmlElement {} |
| 268 ''', | 272 ''', |
| 269 }; | 273 }; |
| OLD | NEW |