dart-sdk/pkg/front_end/test/compile_with_no_sdk_test.dart
Jens Johansen 1197e15a7e [CFE] Enable avoid_void_async lint
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).

Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 11:58:18 +00:00

33 lines
1.2 KiB
Dart

// Copyright (c) 2020, 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 'package:front_end/src/api_prototype/compiler_options.dart';
import 'package:front_end/src/api_prototype/memory_file_system.dart';
import 'incremental_suite.dart' show TestIncrementalCompiler, getOptions;
Future<void> main() async {
await compile("import 'foo.dart' if (dart.library.bar) 'baz.dart';");
}
Future<void> compile(String data) async {
Uri base = Uri.parse("org-dartlang-test:///");
Uri sdkSummary = base.resolve("nonexisting.dill");
Uri mainFile = base.resolve("main.dart");
MemoryFileSystem fs = new MemoryFileSystem(base);
CompilerOptions options = getOptions();
options.fileSystem = fs;
options.sdkRoot = null;
options.sdkSummary = sdkSummary;
options.librariesSpecificationUri = null;
options.omitPlatform = true;
options.onDiagnostic = (DiagnosticMessage message) {
// ignored
};
fs.entityForUri(mainFile).writeAsStringSync(data);
TestIncrementalCompiler compiler =
new TestIncrementalCompiler(options, mainFile);
await compiler.computeDelta();
}