Version 2.15.0-120.0.dev
Merge commit '58c58af3e8b433715d3339b8ead5406ace482d69' into 'dev'
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index 408d757..0fff027 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -266,7 +266,7 @@
var additionalDills = summaryModules.keys.toList();
if (!useIncrementalCompiler) {
- compilerState = await fe.initializeCompiler(
+ compilerState = fe.initializeCompiler(
oldCompilerState,
compileSdk,
sourcePathToUri(getSdkPath()),
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index 47f9e8d..da8d7c6 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -676,8 +676,8 @@
var mainUri = Uri.file('/memory/test.dart');
_fileSystem.entityForUri(mainUri).writeAsStringSync(code);
var oldCompilerState = _compilerState;
- _compilerState = await fe.initializeCompiler(oldCompilerState, false, null,
- sdkUri, packagesUri, null, [], DevCompilerTarget(TargetFlags()),
+ _compilerState = fe.initializeCompiler(oldCompilerState, false, null, sdkUri,
+ packagesUri, null, [], DevCompilerTarget(TargetFlags()),
fileSystem: _fileSystem,
explicitExperimentalFlags: const {},
environmentDefines: const {},
diff --git a/pkg/front_end/lib/src/api_prototype/memory_file_system.dart b/pkg/front_end/lib/src/api_prototype/memory_file_system.dart
index 01aa2e6..b510fc4 100644
--- a/pkg/front_end/lib/src/api_prototype/memory_file_system.dart
+++ b/pkg/front_end/lib/src/api_prototype/memory_file_system.dart
@@ -80,21 +80,23 @@
}
@override
- Future<bool> exists() async {
- return _fileSystem._files[uri] != null ||
- _fileSystem._directories.contains(uri);
+ Future<bool> exists() {
+ return new Future.value(_fileSystem._files[uri] != null ||
+ _fileSystem._directories.contains(uri));
}
@override
Future<bool> existsAsyncIfPossible() => exists();
@override
- Future<List<int>> readAsBytes() async {
+ Future<List<int>> readAsBytes() {
Uint8List? contents = _fileSystem._files[uri];
if (contents == null) {
- throw new FileSystemException(uri, 'File $uri does not exist.');
+ return new Future.error(
+ new FileSystemException(uri, 'File $uri does not exist.'),
+ StackTrace.current);
}
- return contents;
+ return new Future.value(contents);
}
@override
diff --git a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
index ead93b4..e7fd2c5 100644
--- a/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
+++ b/pkg/front_end/lib/src/api_prototype/standard_file_system.dart
@@ -52,15 +52,15 @@
other is _IoFileSystemEntity && other.uri == uri;
@override
- Future<bool> exists() async {
+ Future<bool> exists() {
if (new io.File.fromUri(uri).existsSync()) {
- return true;
+ return new Future.value(true);
}
if (io.FileSystemEntity.isDirectorySync(uri.toFilePath())) {
- return true;
+ return new Future.value(true);
}
// TODO(CFE-team): What about [Link]s?
- return false;
+ return new Future.value(false);
}
@override
@@ -76,12 +76,13 @@
}
@override
- Future<List<int>> readAsBytes() async {
+ Future<List<int>> readAsBytes() {
try {
CompilerContext.recordDependency(uri);
- return new io.File.fromUri(uri).readAsBytesSync();
+ return new Future.value(new io.File.fromUri(uri).readAsBytesSync());
} on io.FileSystemException catch (exception) {
- throw _toFileSystemException(exception);
+ return new Future.error(
+ _toFileSystemException(exception), StackTrace.current);
}
}
@@ -135,13 +136,13 @@
other is DataFileSystemEntity && other.uri == uri;
@override
- Future<bool> exists() async {
- return true;
+ Future<bool> exists() {
+ return new Future.value(true);
}
@override
- Future<List<int>> readAsBytes() async {
- return uri.data!.contentAsBytes();
+ Future<List<int>> readAsBytes() {
+ return new Future.value(uri.data!.contentAsBytes());
}
@override
@@ -151,7 +152,7 @@
Future<List<int>> readAsBytesAsyncIfPossible() => readAsBytes();
@override
- Future<String> readAsString() async {
- return uri.data!.contentAsString();
+ Future<String> readAsString() {
+ return new Future.value(uri.data!.contentAsString());
}
}
diff --git a/pkg/front_end/lib/src/api_unstable/bazel_worker.dart b/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
index 8cf810b..7d167c4 100644
--- a/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
+++ b/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
@@ -72,7 +72,7 @@
Map<String, String> environmentDefines,
{bool trackNeededDillLibraries: false,
bool verbose: false,
- NnbdMode nnbdMode: NnbdMode.Weak}) async {
+ NnbdMode nnbdMode: NnbdMode.Weak}) {
List<Component> outputLoadedAdditionalDills =
new List<Component>.filled(additionalDills.length, dummyComponent);
Map<ExperimentalFlag, bool> experimentalFlags = parseExperimentalFlags(
@@ -98,7 +98,7 @@
nnbdMode: nnbdMode);
}
-Future<InitializedCompilerState> initializeCompiler(
+InitializedCompilerState initializeCompiler(
InitializedCompilerState? oldState,
Uri sdkSummary,
Uri librariesSpecificationUri,
@@ -110,7 +110,7 @@
Map<String, String> environmentDefines, {
bool verbose: false,
NnbdMode nnbdMode: NnbdMode.Weak,
-}) async {
+}) {
// TODO(sigmund): use incremental compiler when it supports our use case.
// Note: it is common for the summary worker to invoke the compiler with the
// same input summary URIs, but with different contents, so we'd need to be
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index d59fef2..23e1784 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -102,7 +102,7 @@
}
}
-Future<InitializedCompilerState> initializeCompiler(
+InitializedCompilerState initializeCompiler(
InitializedCompilerState? oldState,
bool compileSdk,
Uri sdkRoot,
@@ -114,7 +114,7 @@
{FileSystem? fileSystem,
Map<ExperimentalFlag, bool>? explicitExperimentalFlags,
Map<String, String>? environmentDefines,
- required NnbdMode nnbdMode}) async {
+ required NnbdMode nnbdMode}) {
// ignore: unnecessary_null_comparison
assert(nnbdMode != null, "No NnbdMode provided.");
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
@@ -173,7 +173,7 @@
required Map<ExperimentalFlag, bool> explicitExperimentalFlags,
required Map<String, String> environmentDefines,
bool trackNeededDillLibraries: false,
- required NnbdMode nnbdMode}) async {
+ required NnbdMode nnbdMode}) {
return modular.initializeIncrementalCompiler(
oldState,
tags,
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index 14ea957..242c2cb 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -85,12 +85,13 @@
}
@override
- Future<Null> buildOutline(DillLibraryBuilder builder) async {
+ Future<Null> buildOutline(DillLibraryBuilder builder) {
// ignore: unnecessary_null_comparison
if (builder.library == null) {
unhandled("null", "builder.library", 0, builder.fileUri);
}
builder.markAsReadyToBuild();
+ return new Future.value(null);
}
@override
diff --git a/pkg/front_end/lib/src/testing/id_testing_helper.dart b/pkg/front_end/lib/src/testing/id_testing_helper.dart
index dead4a2..2a8c8c8 100644
--- a/pkg/front_end/lib/src/testing/id_testing_helper.dart
+++ b/pkg/front_end/lib/src/testing/id_testing_helper.dart
@@ -77,7 +77,9 @@
void setup() {}
// Called to allow for (awaited) inspection of the compilation result.
- Future<void> inspectComponent(Component component) async {}
+ Future<void> inspectComponent(Component component) {
+ return new Future.value(null);
+ }
/// Function that computes a data mapping for [member].
///
diff --git a/pkg/front_end/test/async_but_no_await_git_test.dart b/pkg/front_end/test/async_but_no_await_git_test.dart
new file mode 100644
index 0000000..d83191f
--- /dev/null
+++ b/pkg/front_end/test/async_but_no_await_git_test.dart
@@ -0,0 +1,138 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:_fe_analyzer_shared/src/messages/severity.dart';
+import 'package:front_end/src/api_prototype/compiler_options.dart' as api;
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/compute_platform_binaries_location.dart'
+ show computePlatformBinariesLocation;
+import 'package:front_end/src/fasta/compiler_context.dart';
+import 'package:front_end/src/fasta/incremental_compiler.dart';
+import 'package:kernel/class_hierarchy.dart';
+import 'package:kernel/core_types.dart';
+import 'package:kernel/kernel.dart';
+import 'package:kernel/reference_from_index.dart';
+import 'package:kernel/target/changed_structure_notifier.dart';
+import 'package:kernel/target/targets.dart';
+import "package:vm/target/vm.dart" show VmTarget;
+
+import 'testing_utils.dart' show getGitFiles;
+import "utils/io_utils.dart";
+
+final Uri repoDir = computeRepoDirUri();
+
+Set<Uri> libUris = {};
+
+Future<void> main(List<String> args) async {
+ api.CompilerOptions compilerOptions = getOptions();
+
+ Uri dotPackagesUri = repoDir.resolve(".packages");
+ if (!new File.fromUri(dotPackagesUri).existsSync()) {
+ throw "Couldn't find .packages";
+ }
+ compilerOptions.packagesFileUri = dotPackagesUri;
+
+ ProcessedOptions options = new ProcessedOptions(options: compilerOptions);
+
+ libUris.add(repoDir.resolve("pkg/front_end/lib/"));
+ libUris.add(repoDir.resolve("pkg/front_end/test/fasta/"));
+ libUris.add(repoDir.resolve("pkg/front_end/tool/"));
+
+ for (Uri uri in libUris) {
+ Set<Uri> gitFiles = await getGitFiles(uri);
+ List<FileSystemEntity> entities =
+ new Directory.fromUri(uri).listSync(recursive: true);
+ for (FileSystemEntity entity in entities) {
+ if (entity is File &&
+ entity.path.endsWith(".dart") &&
+ gitFiles.contains(entity.uri)) {
+ options.inputs.add(entity.uri);
+ }
+ }
+ }
+
+ Stopwatch stopwatch = new Stopwatch()..start();
+
+ IncrementalCompiler compiler =
+ new IncrementalCompiler(new CompilerContext(options));
+ Component component = await compiler.computeDelta();
+
+ component.accept(new AsyncNoAwaitVisitor());
+
+ print("Done in ${stopwatch.elapsedMilliseconds} ms. "
+ "Found $errorCount errors.");
+ if (errorCount > 0) {
+ throw "Found $errorCount errors.";
+ }
+}
+
+class AsyncNoAwaitVisitor extends RecursiveVisitor {
+ bool sawAwait = false;
+
+ @override
+ void visitProcedure(Procedure node) {
+ if (node.function.asyncMarker != AsyncMarker.Async) return;
+ sawAwait = false;
+ defaultMember(node);
+ if (!sawAwait) {
+ Location? location = node.location;
+ if (location?.file.path.contains("/pkg/front_end/") == true) {
+ print("$node (${node.location}) is async "
+ "but doesn't use 'await' anywhere.");
+ errorCount++;
+ }
+ }
+ }
+
+ @override
+ void visitAwaitExpression(AwaitExpression node) {
+ sawAwait = true;
+ }
+}
+
+int errorCount = 0;
+
+api.CompilerOptions getOptions() {
+ // Compile sdk because when this is run from a lint it uses the checked-in sdk
+ // and we might not have a suitable compiled platform.dill file.
+ Uri sdkRoot = computePlatformBinariesLocation(forceBuildDir: true);
+ api.CompilerOptions options = new api.CompilerOptions()
+ ..sdkRoot = sdkRoot
+ ..compileSdk = true
+ ..target = new TestVmTarget(new TargetFlags())
+ ..librariesSpecificationUri = repoDir.resolve("sdk/lib/libraries.json")
+ ..omitPlatform = true
+ ..onDiagnostic = (api.DiagnosticMessage message) {
+ if (message.severity == Severity.error) {
+ print(message.plainTextFormatted.join('\n'));
+ errorCount++;
+ exitCode = 1;
+ }
+ }
+ ..environmentDefines = const {};
+ return options;
+}
+
+class TestVmTarget extends VmTarget with NoTransformationsMixin {
+ TestVmTarget(TargetFlags flags) : super(flags);
+}
+
+mixin NoTransformationsMixin on Target {
+ @override
+ void performModularTransformationsOnLibraries(
+ Component component,
+ CoreTypes coreTypes,
+ ClassHierarchy hierarchy,
+ List<Library> libraries,
+ Map<String, String>? environmentDefines,
+ DiagnosticReporter diagnosticReporter,
+ ReferenceFromIndex? referenceFromIndex,
+ {void Function(String msg)? logger,
+ ChangedStructureNotifier? changedStructureNotifier}) {
+ // We don't want to do the transformations because we need to await
+ // statements.
+ }
+}
diff --git a/pkg/front_end/test/fasta/messages_suite.dart b/pkg/front_end/test/fasta/messages_suite.dart
index 8e884da..b62fceb 100644
--- a/pkg/front_end/test/fasta/messages_suite.dart
+++ b/pkg/front_end/test/fasta/messages_suite.dart
@@ -741,11 +741,11 @@
@override
Future<Result<Example>> run(
- MessageTestDescription description, MessageTestSuite suite) async {
+ MessageTestDescription description, MessageTestSuite suite) {
if (description.problem != null) {
- return fail(null, description.problem);
+ return new Future.value(fail(null, description.problem));
} else {
- return pass(description.example);
+ return new Future.value(pass(description.example));
}
}
}
@@ -836,10 +836,10 @@
}
Future<MessageTestSuite> createContext(
- Chain suite, Map<String, String> environment) async {
+ Chain suite, Map<String, String> environment) {
final bool fastOnly = environment["fastOnly"] == "true";
final bool interactive = environment["interactive"] == "true";
- return new MessageTestSuite(fastOnly, interactive);
+ return new Future.value(new MessageTestSuite(fastOnly, interactive));
}
String relativize(Uri uri) {
diff --git a/pkg/front_end/test/fasta/parser/parser_suite.dart b/pkg/front_end/test/fasta/parser/parser_suite.dart
index 5a920de..2dac9f9 100644
--- a/pkg/front_end/test/fasta/parser/parser_suite.dart
+++ b/pkg/front_end/test/fasta/parser/parser_suite.dart
@@ -12,8 +12,8 @@
import '../../utils/scanner_chain.dart' show Read, Scan, ScannedFile;
Future<ChainContext> createContext(
- Chain suite, Map<String, String> environment) async {
- return new ScannerContext();
+ Chain suite, Map<String, String> environment) {
+ return new Future.value(new ScannerContext());
}
class ScannerContext extends ChainContext {
@@ -32,17 +32,17 @@
String get name => "parse";
@override
- Future<Result<Null>> run(ScannedFile file, ChainContext context) async {
+ Future<Result<Null>> run(ScannedFile file, ChainContext context) {
try {
List<ParserError> errors = parse(file.result.tokens,
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
if (errors.isNotEmpty) {
- return fail(null, errors.join("\n"));
+ return new Future.value(fail(null, errors.join("\n")));
}
} on ParserError catch (e, s) {
- return fail(null, e, s);
+ return new Future.value(fail(null, e, s));
}
- return pass(null);
+ return new Future.value(pass(null));
}
}
diff --git a/pkg/front_end/test/fasta/scanner/scanner_suite.dart b/pkg/front_end/test/fasta/scanner/scanner_suite.dart
index 7b89a9e..f9822e8 100644
--- a/pkg/front_end/test/fasta/scanner/scanner_suite.dart
+++ b/pkg/front_end/test/fasta/scanner/scanner_suite.dart
@@ -9,8 +9,8 @@
import '../../utils/scanner_chain.dart' show Read, Scan;
Future<ChainContext> createContext(
- Chain suite, Map<String, String> environment) async {
- return new ScannerContext();
+ Chain suite, Map<String, String> environment) {
+ return new Future.value(new ScannerContext());
}
class ScannerContext extends ChainContext {
diff --git a/pkg/front_end/test/fasta/sdk_test.dart b/pkg/front_end/test/fasta/sdk_test.dart
index 0ca3cd5..54caf22 100644
--- a/pkg/front_end/test/fasta/sdk_test.dart
+++ b/pkg/front_end/test/fasta/sdk_test.dart
@@ -9,7 +9,7 @@
import 'testing/suite.dart';
Future<FastaContext> createContext(
- Chain suite, Map<String, String> environment) async {
+ Chain suite, Map<String, String> environment) {
environment[ENABLE_FULL_COMPILE] = "";
environment["skipVm"] ??= "true";
environment["onlyCrashes"] ??= "true";
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 607d44c..016d8d1 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -677,14 +677,14 @@
return platformBinaries.resolve(fileName);
}
- Future<Component> loadPlatform(Target target, NnbdMode nnbdMode) async {
+ Component loadPlatform(Target target, NnbdMode nnbdMode) {
Uri uri = _getPlatformUri(target, nnbdMode);
return _platforms.putIfAbsent(uri, () {
return loadComponentFromBytes(new File.fromUri(uri).readAsBytesSync());
});
}
- void clearPlatformCache(Target target, NnbdMode nnbdMode) async {
+ void clearPlatformCache(Target target, NnbdMode nnbdMode) {
Uri uri = _getPlatformUri(target, nnbdMode);
_platforms.remove(uri);
}
@@ -737,7 +737,7 @@
}
static Future<FastaContext> create(
- Chain suite, Map<String, String> environment) async {
+ Chain suite, Map<String, String> environment) {
const Set<String> knownEnvironmentKeys = {
"enableExtensionMethods",
"enableNonNullable",
@@ -785,7 +785,7 @@
if (platformBinaries != null && !platformBinaries.endsWith('/')) {
platformBinaries = '$platformBinaries/';
}
- return new FastaContext(
+ return new Future.value(new FastaContext(
suite.uri,
vm,
platformBinaries == null
@@ -801,7 +801,7 @@
kernelTextSerialization,
environment.containsKey(ENABLE_FULL_COMPILE),
verify,
- soundNullSafety);
+ soundNullSafety));
}
}
@@ -877,7 +877,7 @@
@override
Future<Result<ComponentResult>> run(
- ComponentResult result, FastaContext context) async {
+ ComponentResult result, FastaContext context) {
KernelTarget target = result.sourceTarget;
ConstantsBackend constantsBackend = target.backendTarget.constantsBackend;
TypeEnvironment environment =
@@ -902,7 +902,7 @@
"evaluated: ${stressConstantEvaluatorVisitor.tries}, "
"effectively constant: ${stressConstantEvaluatorVisitor.success}");
}
- return pass(result);
+ return new Future.value(pass(result));
}
}
@@ -1158,8 +1158,8 @@
UriTranslator uriTranslator =
await context.computeUriTranslator(result.description);
- Component platform = await context.loadPlatform(
- backendTarget, compilationSetup.options.nnbdMode);
+ Component platform =
+ context.loadPlatform(backendTarget, compilationSetup.options.nnbdMode);
Result<ComponentResult>? passResult = await performFileInvalidation(
compilationSetup,
platform,
@@ -1878,8 +1878,7 @@
ProcessedOptions options,
List<Uri> entryPoints,
{Component? alsoAppend}) async {
- Component platform =
- await context.loadPlatform(options.target, options.nnbdMode);
+ Component platform = context.loadPlatform(options.target, options.nnbdMode);
Ticker ticker = new Ticker();
UriTranslator uriTranslator =
await context.computeUriTranslator(description);
@@ -2076,14 +2075,14 @@
@override
Future<Result<ComponentResult>> run(
- ComponentResult result, FastaContext context) async {
+ ComponentResult result, FastaContext context) {
List<Iterable<String>> errors = result.compilationSetup.errors;
- return errors.isEmpty
+ return new Future.value(errors.isEmpty
? pass(result)
: fail(
result,
"Unexpected errors:\n"
- "${errors.map((error) => error.join('\n')).join('\n\n')}");
+ "${errors.map((error) => error.join('\n')).join('\n\n')}"));
}
}
@@ -2096,7 +2095,7 @@
@override
Future<Result<ComponentResult>> run(
- ComponentResult result, FastaContext context) async {
+ ComponentResult result, FastaContext context) {
Component component = result.component;
Uri uri =
component.uriToSource.keys.firstWhere((uri) => uri.scheme == "file");
diff --git a/pkg/front_end/test/fasta/textual_outline_suite.dart b/pkg/front_end/test/fasta/textual_outline_suite.dart
index 09f3387..3d2c902 100644
--- a/pkg/front_end/test/fasta/textual_outline_suite.dart
+++ b/pkg/front_end/test/fasta/textual_outline_suite.dart
@@ -47,9 +47,9 @@
},
];
-Future<Context> createContext(
- Chain suite, Map<String, String> environment) async {
- return new Context(environment["updateExpectations"] == "true");
+Future<Context> createContext(Chain suite, Map<String, String> environment) {
+ return new Future.value(
+ new Context(environment["updateExpectations"] == "true"));
}
void main([List<String> arguments = const []]) =>
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index 6430602..4b4f060 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -124,13 +124,13 @@
const Expectation.fail("InitializedFromDillMismatch");
const Expectation NNBDModeMismatch = const Expectation.fail("NNBDModeMismatch");
-Future<Context> createContext(
- Chain suite, Map<String, String> environment) async {
+Future<Context> createContext(Chain suite, Map<String, String> environment) {
// Disable colors to ensure that expectation files are the same across
// platforms and independent of stdin/stderr.
colors.enableColors = false;
- return new Context(environment["updateExpectations"] == "true",
- environment["addDebugBreaks"] == "true");
+ return new Future.value(new Context(
+ environment["updateExpectations"] == "true",
+ environment["addDebugBreaks"] == "true"));
}
class Context extends ChainContext {
diff --git a/pkg/front_end/test/memory_file_system_test.dart b/pkg/front_end/test/memory_file_system_test.dart
index c5a743f..3792f40 100644
--- a/pkg/front_end/test/memory_file_system_test.dart
+++ b/pkg/front_end/test/memory_file_system_test.dart
@@ -54,7 +54,7 @@
void test_createDirectory_exists_asFile() async {
file.writeAsStringSync('');
- expect(() => file.createDirectory(), _throwsFileSystemException);
+ await expectLater(file.createDirectory, _throwsFileSystemException);
}
void test_equals_differentPaths() {
@@ -94,8 +94,8 @@
expect(await file.readAsBytes(), bytes);
}
- void test_readAsBytes_doesNotExist() {
- expect(file.readAsBytes(), _throwsFileSystemException);
+ void test_readAsBytes_doesNotExist() async {
+ await expectLater(file.readAsBytes, _throwsFileSystemException);
}
void test_readAsBytes_exists() async {
@@ -104,13 +104,13 @@
expect(await file.readAsBytes(), utf8.encode(s));
}
- void test_readAsString_badUtf8() {
+ void test_readAsString_badUtf8() async {
file.writeAsBytesSync([0xc0, 0x40]); // Invalid UTF-8
- expect(file.readAsString(), _throwsFileSystemException);
+ await expectLater(file.readAsString, _throwsFileSystemException);
}
- void test_readAsString_doesNotExist() {
- expect(file.readAsString(), _throwsFileSystemException);
+ void test_readAsString_doesNotExist() async {
+ await expectLater(file.readAsString, _throwsFileSystemException);
}
void test_readAsString_exists() async {
@@ -126,7 +126,8 @@
void test_writeAsBytesSync_directory() async {
file.createDirectory();
- expect(() => file.writeAsBytesSync([0]), _throwsFileSystemException);
+ await expectLater(
+ () => file.writeAsBytesSync([0]), _throwsFileSystemException);
}
void test_writeAsBytesSync_modifyAfterRead() async {
@@ -162,7 +163,8 @@
void test_writeAsStringSync_directory() async {
file.createDirectory();
- expect(() => file.writeAsStringSync(''), _throwsFileSystemException);
+ await expectLater(
+ () => file.writeAsStringSync(''), _throwsFileSystemException);
}
void test_writeAsStringSync_overwrite() async {
@@ -221,7 +223,7 @@
Uri.parse('$tempUri/file.txt'));
}
- void test_entityForUri_fileUri_relative() {
+ void test_entityForUri_fileUri_relative() async {
// A weird quirk of the Uri class is that it doesn't seem possible to create
// a `file:` uri with a relative path, no matter how many slashes you use or
// if you populate the fields directly. But just to be certain, try to do
@@ -234,7 +236,7 @@
Uri.parse('file:///file.txt')
]) {
if (!uri.path.startsWith('/')) {
- expect(() => fileSystem.entityForUri(uri),
+ await expectLater(() => fileSystem.entityForUri(uri),
throwsA(const TypeMatcher<Error>()));
}
}
diff --git a/pkg/front_end/test/standard_file_system_test.dart b/pkg/front_end/test/standard_file_system_test.dart
index dce6675..3769878 100644
--- a/pkg/front_end/test/standard_file_system_test.dart
+++ b/pkg/front_end/test/standard_file_system_test.dart
@@ -60,7 +60,7 @@
void test_readAsBytes() async {
await new io.Directory(path).create();
- expect(dir.readAsBytes(), _throwsFileSystemException);
+ await expectLater(dir.readAsBytes, _throwsFileSystemException);
}
void test_uri() {
@@ -108,8 +108,8 @@
expect(await file.readAsBytes(), bytes);
}
- void test_readAsBytes_doesNotExist() {
- expect(file.readAsBytes(), _throwsFileSystemException);
+ void test_readAsBytes_doesNotExist() async {
+ await expectLater(file.readAsBytes, _throwsFileSystemException);
}
void test_readAsBytes_exists() async {
@@ -118,13 +118,13 @@
expect(await file.readAsBytes(), utf8.encode(s));
}
- void test_readAsString_badUtf8() {
+ void test_readAsString_badUtf8() async {
new io.File(path).writeAsBytesSync([0xc0, 0x40]); // Invalid UTF-8
- expect(file.readAsString(), _throwsFileSystemException);
+ await expectLater(file.readAsString, _throwsFileSystemException);
}
- void test_readAsString_doesNotExist() {
- expect(file.readAsString(), _throwsFileSystemException);
+ void test_readAsString_doesNotExist() async {
+ await expectLater(file.readAsString, _throwsFileSystemException);
}
void test_readAsString_exists() async {
@@ -206,8 +206,8 @@
}
}
- void test_entityForUri_nonFileUri() {
- expect(
+ void test_entityForUri_nonFileUri() async {
+ await expectLater(
() => StandardFileSystem.instance
.entityForUri(Uri.parse('package:foo/bar.dart')),
_throwsFileSystemException);
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index a7c055b..a8412e8 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -176,21 +176,21 @@
@override
Future<Result<ComponentResult>> run(
- ComponentResult result, ChainContext context) async {
+ ComponentResult result, ChainContext context) {
Component component = result.component;
ErrorFormatter errorFormatter = new ErrorFormatter();
NaiveTypeChecker checker =
new NaiveTypeChecker(errorFormatter, component, ignoreSdk: true);
checker.checkComponent(component);
if (errorFormatter.numberOfFailures == 0) {
- return pass(result);
+ return new Future.value(pass(result));
} else {
errorFormatter.failures.forEach(print);
print('------- Found ${errorFormatter.numberOfFailures} errors -------');
- return new Result<ComponentResult>(
+ return new Future.value(new Result<ComponentResult>(
null,
context.expectationSet["TypeCheckError"],
- '${errorFormatter.numberOfFailures} type errors');
+ '${errorFormatter.numberOfFailures} type errors'));
}
}
}
@@ -460,13 +460,13 @@
String get name => "read .dill";
@override
- Future<Result<Uri>> run(Uri uri, _) async {
+ Future<Result<Uri>> run(Uri uri, _) {
try {
loadComponentFromBinary(uri.toFilePath());
} catch (e, s) {
- return fail(uri, e, s);
+ return new Future.value(fail(uri, e, s));
}
- return pass(uri);
+ return new Future.value(pass(uri));
}
}
diff --git a/pkg/front_end/test/utils/scanner_chain.dart b/pkg/front_end/test/utils/scanner_chain.dart
index c312851..e133fc1 100644
--- a/pkg/front_end/test/utils/scanner_chain.dart
+++ b/pkg/front_end/test/utils/scanner_chain.dart
@@ -48,7 +48,7 @@
String get name => "scan";
@override
- Future<Result<ScannedFile>> run(ReadFile file, ChainContext context) async {
- return pass(new ScannedFile(file, scan(file.bytes)));
+ Future<Result<ScannedFile>> run(ReadFile file, ChainContext context) {
+ return new Future.value(pass(new ScannedFile(file, scan(file.bytes))));
}
}
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index af225d7..f729ad1 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -156,7 +156,7 @@
}
}
- Future<bool> batchCompileArguments(List<String> arguments) async {
+ Future<bool> batchCompileArguments(List<String> arguments) {
return runProtectedFromAbort<bool>(
() => withGlobalOptions<bool>("compile", arguments, true,
(CompilerContext c, _) => batchCompileImpl(c)),
@@ -448,7 +448,7 @@
}
}
-Future<List<Uri>> computeHostDependencies(Uri hostPlatform) async {
+Future<List<Uri>> computeHostDependencies(Uri hostPlatform) {
// Returns a list of source files that make up the Fasta compiler (the files
// the Dart VM reads to run Fasta). Until Fasta is self-hosting (in strong
// mode), this is only an approximation, albeit accurate. Once Fasta is
diff --git a/pkg/front_end/tool/fasta_perf.dart b/pkg/front_end/tool/fasta_perf.dart
index 6a04071..b9b02a3 100644
--- a/pkg/front_end/tool/fasta_perf.dart
+++ b/pkg/front_end/tool/fasta_perf.dart
@@ -43,7 +43,7 @@
await setup(entryUri);
- Map<Uri, List<int>> files = await scanReachableFiles(entryUri);
+ Map<Uri, List<int>> files = scanReachableFiles(entryUri);
var handlers = {
'scan': () async => scanFiles(files),
// TODO(sigmund): enable when we can run the ast-builder standalone.
@@ -113,7 +113,7 @@
/// Load and scans all files we need to process: files reachable from the
/// entrypoint and all core libraries automatically included by the VM.
-Future<Map<Uri, List<int>>> scanReachableFiles(Uri entryUri) async {
+Map<Uri, List<int>> scanReachableFiles(Uri entryUri) {
var files = <Uri, List<int>>{};
var loadTimer = new Stopwatch()..start();
scanTimer = new Stopwatch();
@@ -134,7 +134,7 @@
Uri.parse('dart:typed_data'),
];
for (var entry in entrypoints) {
- await collectSources(entry, files);
+ collectSources(entry, files);
}
loadTimer.stop();
@@ -151,7 +151,7 @@
}
/// Add to [files] all sources reachable from [start].
-Future<Null> collectSources(Uri start, Map<Uri, List<int>> files) async {
+void collectSources(Uri start, Map<Uri, List<int>> files) {
void helper(Uri uri) {
uri = uriResolver.translate(uri) ?? uri;
// ignore: unnecessary_null_comparison
@@ -221,7 +221,7 @@
{bool compileSdk: true}) async {
// TODO(sigmund): this is here only to compute the input size,
// we should extract the input size from the frontend instead.
- await scanReachableFiles(entryUri);
+ scanReachableFiles(entryUri);
var timer = new Stopwatch()..start();
var options = new CompilerOptions()
diff --git a/pkg/front_end/tool/perf.dart b/pkg/front_end/tool/perf.dart
index bd751cb..7844f2b 100644
--- a/pkg/front_end/tool/perf.dart
+++ b/pkg/front_end/tool/perf.dart
@@ -42,7 +42,7 @@
var bench = args[0];
var entryUri = Uri.base.resolve(args[1]);
- await setup(path.fromUri(entryUri));
+ setup(path.fromUri(entryUri));
Set<Source> files = scanReachableFiles(entryUri);
var handlers = {
@@ -197,7 +197,7 @@
/// Sets up analyzer to be able to load and resolve app, packages, and sdk
/// sources.
-Future setup(String path) async {
+void setup(String path) {
var provider = PhysicalResourceProvider.INSTANCE;
var packages = findPackagesFrom(
diff --git a/pkg/frontend_server/lib/compute_kernel.dart b/pkg/frontend_server/lib/compute_kernel.dart
index b6c5616..a75573e 100644
--- a/pkg/frontend_server/lib/compute_kernel.dart
+++ b/pkg/frontend_server/lib/compute_kernel.dart
@@ -240,7 +240,7 @@
verbose: verbose,
nnbdMode: nnbdMode);
} else {
- state = await fe.initializeCompiler(
+ state = fe.initializeCompiler(
// TODO(sigmund): pass an old state once we can make use of it.
null,
toUri(parsedArgs['dart-sdk-summary']),
diff --git a/pkg/vm/test/modular_kernel_plus_aot_test.dart b/pkg/vm/test/modular_kernel_plus_aot_test.dart
index c853b01..090a08d 100644
--- a/pkg/vm/test/modular_kernel_plus_aot_test.dart
+++ b/pkg/vm/test/modular_kernel_plus_aot_test.dart
@@ -83,7 +83,7 @@
Uri outputFile,
List<Uri> sources,
List<Uri> additionalDills) async {
- final state = await fe.initializeCompiler(
+ final state = fe.initializeCompiler(
null,
sdkSummary,
librariesFile,
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 7e0034b..2306f23 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -3604,9 +3604,16 @@
private:
bool ShouldKill(Isolate* isolate) {
// If a target_ is specified, then only kill the target_.
- // Otherwise, don't kill the service isolate or vm isolate.
+ // Otherwise, don't kill the core system isolates (e.g, service, kernel, or
+ // vm isolates).
return (((target_ != nullptr) && (isolate == target_)) ||
- ((target_ == nullptr) && !IsSystemIsolate(isolate)));
+ ((target_ == nullptr) && !IsCoreSystemIsolate(isolate)));
+ }
+
+ bool IsCoreSystemIsolate(Isolate* isolate) {
+ return KernelIsolate::IsKernelIsolate(isolate) ||
+ ServiceIsolate::IsServiceIsolate(isolate) ||
+ Dart::vm_isolate() == isolate;
}
Isolate* target_;
diff --git a/tools/VERSION b/tools/VERSION
index aebd539..10235e0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 119
+PRERELEASE 120
PRERELEASE_PATCH 0
\ No newline at end of file