| Index: pkg/front_end/test/src/incremental/mock_sdk.dart
|
| diff --git a/pkg/front_end/test/src/incremental/mock_sdk.dart b/pkg/front_end/test/src/incremental/mock_sdk.dart
|
| index b005e2606c37c7b1676149e5e7c9c04d014257c7..c378242c85f28f4fb041fa5541c45ba39100ad83 100644
|
| --- a/pkg/front_end/test/src/incremental/mock_sdk.dart
|
| +++ b/pkg/front_end/test/src/incremental/mock_sdk.dart
|
| @@ -4,20 +4,45 @@
|
|
|
| import 'package:front_end/memory_file_system.dart';
|
|
|
| -/// Create SDK libraries which are used by Fasta to perform kernel generation.
|
| -/// Return the mapping from the simple names of these library to the URIs
|
| -/// in the given [fileSystem]. The root of the SDK is `file:///sdk`.
|
| -Map<String, Uri> createSdkFiles(MemoryFileSystem fileSystem) {
|
| - Map<String, Uri> dartLibraries = {};
|
| +final _ASYNC = r'''
|
| +library dart.async;
|
|
|
| - void addSdkLibrary(String name, String contents) {
|
| - String path = '$name/$name.dart';
|
| - Uri uri = Uri.parse('file:///sdk/lib/$path');
|
| - fileSystem.entityForUri(uri).writeAsStringSync(contents);
|
| - dartLibraries[name] = uri;
|
| - }
|
| +class Future<T> {
|
| + factory Future(computation()) => null;
|
| + factory Future.delayed(Duration duration, [T computation()]) => null;
|
| + factory Future.microtask(FutureOr<T> computation()) => null;
|
| + factory Future.value([value]) => null;
|
| +
|
| + static Future<List<T>> wait<T>(Iterable<Future<T>> futures) => null;
|
| + Future<R> then<R>(FutureOr<R> onValue(T value)) => null;
|
| +
|
| + Future<T> whenComplete(action());
|
| +}
|
| +
|
| +
|
| +class FutureOr<T> {}
|
| +class Stream<T> {}
|
| +abstract class StreamIterator<T> {}
|
| +
|
| +abstract class Completer<T> {
|
| + factory Completer() => null;
|
| + factory Completer.sync() => null;
|
| + Future<T> get future;
|
| + void complete([FutureOr<T> value]);
|
| + void completeError(Object error, [StackTrace stackTrace]);
|
| + bool get isCompleted;
|
| +}
|
| +
|
| +class _StreamIterator<T> implements StreamIterator<T> {}
|
| +class _AsyncStarStreamController {}
|
| +Object _asyncStackTraceHelper(Function async_op) { }
|
| +Function _asyncThenWrapperHelper(continuation) {}
|
| +Function _asyncErrorWrapperHelper(continuation) {}
|
| +Future _awaitHelper(
|
| + object, Function thenCallback, Function errorCallback, var awaiter) {}
|
| +''';
|
|
|
| - addSdkLibrary('core', r'''
|
| +final _CORE = r'''
|
| library dart.core;
|
| import 'dart:_internal';
|
| import 'dart:async';
|
| @@ -200,45 +225,49 @@ external bool identical(Object a, Object b);
|
| void print(Object o) {}
|
|
|
| abstract class _SyncIterable implements Iterable {}
|
| -''');
|
| -
|
| - addSdkLibrary('async', r'''
|
| -library dart.async;
|
| +''';
|
|
|
| -class Future<T> {
|
| - factory Future(computation()) => null;
|
| - factory Future.delayed(Duration duration, [T computation()]) => null;
|
| - factory Future.microtask(FutureOr<T> computation()) => null;
|
| - factory Future.value([value]) => null;
|
| +/// Create SDK libraries which are used by Fasta to perform kernel generation.
|
| +/// Return the mapping from the simple names of these library to the URIs
|
| +/// in the given [fileSystem]. The root of the SDK is `file:///sdk`.
|
| +Map<String, Uri> createSdkFiles(MemoryFileSystem fileSystem) {
|
| + Map<String, Uri> dartLibraries = {};
|
|
|
| - static Future<List<T>> wait<T>(Iterable<Future<T>> futures) => null;
|
| - Future<R> then<R>(FutureOr<R> onValue(T value)) => null;
|
| + void addSdkLibrary(String name, String contents) {
|
| + String path = '$name/$name.dart';
|
| + Uri uri = Uri.parse('file:///sdk/lib/$path');
|
| + fileSystem.entityForUri(uri).writeAsStringSync(contents);
|
| + dartLibraries[name] = uri;
|
| + }
|
|
|
| - Future<T> whenComplete(action());
|
| + fileSystem.entityForUri(Uri.parse('file:///sdk/')).createDirectory();
|
| +
|
| + fileSystem
|
| + .entityForUri(Uri.parse('file:///sdk/lib/libraries.json'))
|
| + .writeAsStringSync(r'''
|
| +{
|
| + "libraries": {
|
| + "core": "core/core.dart",
|
| + "async": "async/async.dart",
|
| + "collection": "collection/collection.dart",
|
| + "convert": "convert/convert.dart",
|
| + "developer": "developer/developer.dart",
|
| + "io": "io/io.dart",
|
| + "isolate": "isolate/isolate.dart",
|
| + "math": "math/math.dart",
|
| + "mirrors": "mirrors/mirrors.dart",
|
| + "nativewrappers": "nativewrappers/nativewrappers.dart",
|
| + "profiler": "profiler/profiler.dart",
|
| + "typed_data": "typed_data/typed_data.dart",
|
| + "_builtin": "_builtin/_builtin.dart",
|
| + "_internal": "_internal/_internal.dart"
|
| + }
|
| }
|
| +''');
|
|
|
| + addSdkLibrary('core', _CORE);
|
|
|
| -class FutureOr<T> {}
|
| -class Stream<T> {}
|
| -abstract class StreamIterator<T> {}
|
| -
|
| -abstract class Completer<T> {
|
| - factory Completer() => null;
|
| - factory Completer.sync() => null;
|
| - Future<T> get future;
|
| - void complete([FutureOr<T> value]);
|
| - void completeError(Object error, [StackTrace stackTrace]);
|
| - bool get isCompleted;
|
| -}
|
| -
|
| -class _StreamIterator<T> implements StreamIterator<T> {}
|
| -class _AsyncStarStreamController {}
|
| -Object _asyncStackTraceHelper(Function async_op) { }
|
| -Function _asyncThenWrapperHelper(continuation) {}
|
| -Function _asyncErrorWrapperHelper(continuation) {}
|
| -Future _awaitHelper(
|
| - object, Function thenCallback, Function errorCallback, var awaiter) {}
|
| -''');
|
| + addSdkLibrary('async', _ASYNC);
|
|
|
| addSdkLibrary('collection', 'library dart.collection;');
|
| addSdkLibrary('convert', 'library dart.convert;');
|
| @@ -253,7 +282,6 @@ external double sin(num radians);
|
| addSdkLibrary('nativewrappers', 'library dart.nativewrappers;');
|
| addSdkLibrary('profiler', 'library dart.profiler;');
|
| addSdkLibrary('typed_data', 'library dart.typed_data;');
|
| - addSdkLibrary('vmservice_io', 'library dart.vmservice_io;');
|
| addSdkLibrary('_builtin', 'library dart._builtin;');
|
| addSdkLibrary('_internal', '''
|
| library dart._internal;
|
| @@ -263,7 +291,6 @@ class ExternalName {
|
| const ExternalName(this.name);
|
| }
|
| ''');
|
| - addSdkLibrary('_vmservice', 'library dart._vmservice;');
|
|
|
| return dartLibraries;
|
| }
|
|
|