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

Side by Side Diff: pkg/analyzer/test/src/context/mock_sdk.dart

Issue 2651653006: Make Future.value() constructor in MockSdk consistent with the actual SDK. (Closed)
Patch Set: Created 3 years, 11 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/task/strong/checker_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) 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 analyzer.test.src.context.mock_sdk; 5 library analyzer.test.src.context.mock_sdk;
6 6
7 import 'package:analyzer/file_system/file_system.dart' as resource; 7 import 'package:analyzer/file_system/file_system.dart' as resource;
8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource;
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
(...skipping 25 matching lines...) Expand all
36 ''' 36 '''
37 library dart.async; 37 library dart.async;
38 38
39 import 'dart:math'; 39 import 'dart:math';
40 40
41 part 'stream.dart'; 41 part 'stream.dart';
42 42
43 class Future<T> { 43 class Future<T> {
44 factory Future(computation()) => null; 44 factory Future(computation()) => null;
45 factory Future.delayed(Duration duration, [T computation()]) => null; 45 factory Future.delayed(Duration duration, [T computation()]) => null;
46 factory Future.value([T value]) => null; 46 factory Future.value([value]) => null;
47 47
48 static Future<List/*<T>*/> wait/*<T>*/( 48 static Future<List/*<T>*/> wait/*<T>*/(
49 Iterable<Future/*<T>*/> futures) => null; 49 Iterable<Future/*<T>*/> futures) => null;
50 Future/*<R>*/ then/*<R>*/(onValue(T value)) => null; 50 Future/*<R>*/ then/*<R>*/(onValue(T value)) => null;
51 51
52 Future<T> whenComplete(action()); 52 Future<T> whenComplete(action());
53 } 53 }
54 54
55 class FutureOr<T> {} 55 class FutureOr<T> {}
56 56
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } else { 441 } else {
442 bytes = _computeLinkedBundleBytes(); 442 bytes = _computeLinkedBundleBytes();
443 } 443 }
444 _bundle = new PackageBundle.fromBuffer(bytes); 444 _bundle = new PackageBundle.fromBuffer(bytes);
445 } 445 }
446 return _bundle; 446 return _bundle;
447 } 447 }
448 448
449 @override 449 @override
450 SdkLibrary getSdkLibrary(String dartUri) { 450 SdkLibrary getSdkLibrary(String dartUri) {
451 // getSdkLibrary() is only used to determine whether a library is internal 451 for (SdkLibrary library in _LIBRARIES) {
452 // to the SDK. The mock SDK doesn't have any internals, so it's safe to 452 if (library.shortName == dartUri) {
453 // return null. 453 return library;
454 }
455 }
454 return null; 456 return null;
455 } 457 }
456 458
457 @override 459 @override
458 Source mapDartUri(String dartUri) { 460 Source mapDartUri(String dartUri) {
459 String path = uriMap[dartUri]; 461 String path = uriMap[dartUri];
460 if (path != null) { 462 if (path != null) {
461 resource.File file = provider.getResource(provider.convertPath(path)); 463 resource.File file = provider.getResource(provider.convertPath(path));
462 Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5)); 464 Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5));
463 return file.createSource(uri); 465 return file.createSource(uri);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 @override 511 @override
510 bool get isDart2JsLibrary => throw new UnimplementedError(); 512 bool get isDart2JsLibrary => throw new UnimplementedError();
511 513
512 @override 514 @override
513 bool get isDocumented => throw new UnimplementedError(); 515 bool get isDocumented => throw new UnimplementedError();
514 516
515 @override 517 @override
516 bool get isImplementation => throw new UnimplementedError(); 518 bool get isImplementation => throw new UnimplementedError();
517 519
518 @override 520 @override
519 bool get isInternal => throw new UnimplementedError(); 521 bool get isInternal => shortName.startsWith('dart:_');
520 522
521 @override 523 @override
522 bool get isShared => throw new UnimplementedError(); 524 bool get isShared => throw new UnimplementedError();
523 525
524 @override 526 @override
525 bool get isVmLibrary => throw new UnimplementedError(); 527 bool get isVmLibrary => throw new UnimplementedError();
526 } 528 }
527 529
528 /** 530 /**
529 * An [AnalysisContextImpl] that only contains sources for a Dart SDK. 531 * An [AnalysisContextImpl] that only contains sources for a Dart SDK.
530 */ 532 */
531 class _SdkAnalysisContext extends AnalysisContextImpl { 533 class _SdkAnalysisContext extends AnalysisContextImpl {
532 final DartSdk sdk; 534 final DartSdk sdk;
533 535
534 _SdkAnalysisContext(this.sdk); 536 _SdkAnalysisContext(this.sdk);
535 537
536 @override 538 @override
537 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 539 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
538 if (factory == null) { 540 if (factory == null) {
539 return super.createCacheFromSourceFactory(factory); 541 return super.createCacheFromSourceFactory(factory);
540 } 542 }
541 return new AnalysisCache( 543 return new AnalysisCache(
542 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 544 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
543 } 545 }
544 } 546 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698