| 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' show InternalAnalysisContext
, TimestampedData; | 11 import 'package:analyzer/src/generated/engine.dart' |
| 12 show InternalAnalysisContext, TimestampedData; |
| 12 import 'package:analyzer/src/context/context.dart' show SdkAnalysisContext; | 13 import 'package:analyzer/src/context/context.dart' show SdkAnalysisContext; |
| 13 import 'package:analyzer/src/generated/java_io.dart'; | 14 import 'package:analyzer/src/generated/java_io.dart'; |
| 14 import 'package:analyzer/src/generated/sdk.dart'; | 15 import 'package:analyzer/src/generated/sdk.dart'; |
| 15 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; | 16 import 'package:analyzer/src/generated/sdk_io.dart' show DirectoryBasedDartSdk; |
| 16 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 17 import 'package:cli_util/cli_util.dart' as cli_util; | 18 import 'package:cli_util/cli_util.dart' as cli_util; |
| 18 | 19 |
| 19 /// Attempts to provide the current Dart SDK directory. | 20 /// Attempts to provide the current Dart SDK directory. |
| 20 /// | 21 /// |
| 21 /// This will return null if the SDK cannot be found | 22 /// This will return null if the SDK cannot be found |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 59 |
| 59 Uri restoreAbsolute(Source source) => | 60 Uri restoreAbsolute(Source source) => |
| 60 throw new UnsupportedError('restoreAbsolute is not supported'); | 61 throw new UnsupportedError('restoreAbsolute is not supported'); |
| 61 } | 62 } |
| 62 | 63 |
| 63 /// Source file for dart: sources which track the sources with dart: URIs. | 64 /// Source file for dart: sources which track the sources with dart: URIs. |
| 64 /// | 65 /// |
| 65 /// This is primarily to support [Resolver.getImportUri] for Dart SDK (dart:) | 66 /// This is primarily to support [Resolver.getImportUri] for Dart SDK (dart:) |
| 66 /// based libraries. | 67 /// based libraries. |
| 67 class DartSourceProxy implements UriAnnotatedSource { | 68 class DartSourceProxy implements UriAnnotatedSource { |
| 68 | |
| 69 /// Absolute URI which this source can be imported from | 69 /// Absolute URI which this source can be imported from |
| 70 final Uri uri; | 70 final Uri uri; |
| 71 | 71 |
| 72 /// Underlying source object. | 72 /// Underlying source object. |
| 73 final Source _proxy; | 73 final Source _proxy; |
| 74 | 74 |
| 75 Source get source => this; | 75 Source get source => this; |
| 76 | 76 |
| 77 DartSourceProxy(this._proxy, this.uri); | 77 DartSourceProxy(this._proxy, this.uri); |
| 78 | 78 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 UriKind get uriKind => UriKind.DART_URI; | 198 UriKind get uriKind => UriKind.DART_URI; |
| 199 | 199 |
| 200 bool get isInSystemLibrary => true; | 200 bool get isInSystemLibrary => true; |
| 201 | 201 |
| 202 Source resolveRelative(Uri relativeUri) => | 202 Source resolveRelative(Uri relativeUri) => |
| 203 throw new UnsupportedError('not expecting relative urls in dart: mocks'); | 203 throw new UnsupportedError('not expecting relative urls in dart: mocks'); |
| 204 | 204 |
| 205 Uri resolveRelativeUri(Uri relativeUri) => | 205 Uri resolveRelativeUri(Uri relativeUri) => |
| 206 throw new UnsupportedError('not expecting relative urls in dart: mocks'); | 206 throw new UnsupportedError('not expecting relative urls in dart: mocks'); |
| 207 |
| 208 bool operator ==(Object other) => identical(this, other); |
| 207 } | 209 } |
| 208 | 210 |
| 209 /// Sample mock SDK sources. | 211 /// Sample mock SDK sources. |
| 210 final Map<String, String> mockSdkSources = { | 212 final Map<String, String> mockSdkSources = { |
| 211 // The list of types below is derived from types that are used internally by | 213 // The list of types below is derived from types that are used internally by |
| 212 // the resolver (see _initializeFrom in analyzer/src/generated/resolver.dart). | 214 // the resolver (see _initializeFrom in analyzer/src/generated/resolver.dart). |
| 213 'dart:core': ''' | 215 'dart:core': ''' |
| 214 library dart.core; | 216 library dart.core; |
| 215 | 217 |
| 216 void print(Object o) {} | 218 void print(Object o) {} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 'dart:async': ''' | 254 'dart:async': ''' |
| 253 class Future<T> { | 255 class Future<T> { |
| 254 Future then(callback) {} | 256 Future then(callback) {} |
| 255 class Stream<T> {} | 257 class Stream<T> {} |
| 256 ''', | 258 ''', |
| 257 'dart:html': ''' | 259 'dart:html': ''' |
| 258 library dart.html; | 260 library dart.html; |
| 259 class HtmlElement {} | 261 class HtmlElement {} |
| 260 ''', | 262 ''', |
| 261 }; | 263 }; |
| OLD | NEW |