Flip the default value of the Kernel syncAsync flag

In Kernel's TargetFlags, this flag still defaulted to false.  Flip the
default to true and update all client code in the SDK.  The
expectation is that many of the places that now pass false explicitly
really just want the default, but that will be verified separately and
then the flag will be removed.

Change-Id: I2a38eb53f280f21f59bb1d2e88c42516f827fd39
Reviewed-on: https://dart-review.googlesource.com/c/85448
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
This commit is contained in:
Kevin Millikin
2018-12-12 14:23:54 +00:00
committed by commit-bot@chromium.org
parent a745f477dc
commit a8493e1b50
20 changed files with 35 additions and 24 deletions
@@ -64,7 +64,7 @@ ComparisonNode _diagnosticMessageToNode(DiagnosticMessage message) {
CompilerOptions _makeCompilerOptions(Uri packagesFileUri, Uri platformUri,
DiagnosticMessageHandler onDiagnostic) {
var targetFlags = TargetFlags(syncAsync: true);
var targetFlags = TargetFlags();
var target = NoneTarget(targetFlags);
var fileSystem = StandardFileSystem.instance;
+1 -1
View File
@@ -69,7 +69,7 @@ class KernelLoaderTask extends CompilerTask {
String platform = '${targetName}_platform.dill';
initializedCompilerState = fe.initializeCompiler(
initializedCompilerState,
new Dart2jsTarget(targetName, new TargetFlags()),
new Dart2jsTarget(targetName, new TargetFlags(syncAsync: false)),
_options.librariesSpecificationUri,
_options.platformBinaries.resolve(platform),
_options.packageConfig);
+2 -1
View File
@@ -25,7 +25,8 @@ import 'package:kernel/target/targets.dart';
main(List<String> args) async {
ArgResults flags = _argParser.parse(args);
var options = new CompilerOptions()
..target = new Dart2jsTarget("dart2js", new TargetFlags(legacyMode: true))
..target = new Dart2jsTarget(
"dart2js", new TargetFlags(legacyMode: true, syncAsync: false))
..packagesFileUri = Uri.base.resolve('.packages')
..setExitCodeOnProblem = true
..linkedDependencies = [
@@ -290,8 +290,8 @@ class ProcessedOptions {
bool get bytecode => _raw.bytecode;
Target _target;
Target get target => _target ??=
_raw.target ?? new NoneTarget(new TargetFlags(legacyMode: legacyMode));
Target get target => _target ??= _raw.target ??
new NoneTarget(new TargetFlags(legacyMode: legacyMode, syncAsync: false));
/// Get an outline component that summarizes the SDK, if any.
// TODO(sigmund): move, this doesn't feel like an "option".
@@ -388,7 +388,7 @@ Future<Context> createContext(
final List<DiagnosticMessage> errors = <DiagnosticMessage>[];
final CompilerOptions optionBuilder = new CompilerOptions()
..target = new VmTarget(new TargetFlags())
..target = new VmTarget(new TargetFlags(syncAsync: false))
..verbose = true
..fileSystem = fs
..sdkSummary = sdkSummary
@@ -100,8 +100,11 @@ main() {
new KernelTarget(
null,
false,
new DillTarget(null, null,
new NoneTarget(new TargetFlags(legacyMode: true))),
new DillTarget(
null,
null,
new NoneTarget(
new TargetFlags(legacyMode: true, syncAsync: false))),
null)
.loader,
null,
@@ -35,7 +35,7 @@ void diagnosticMessageHandler(DiagnosticMessage message) {
test({bool sdkFromSource}) async {
final CompilerOptions optionBuilder = new CompilerOptions()
..packagesFileUri = Uri.base.resolve(".packages")
..target = new VmTarget(new TargetFlags(legacyMode: true))
..target = new VmTarget(new TargetFlags(legacyMode: true, syncAsync: false))
..legacyMode = true
..onDiagnostic = diagnosticMessageHandler;
+1 -1
View File
@@ -461,7 +461,7 @@ class Compile extends Step<Example, Null, MessageTestSuite> {
new CompilerOptions()
..sdkSummary = computePlatformBinariesLocation(forceBuildDir: true)
.resolve("vm_platform_strong.dill")
..target = new VmTarget(new TargetFlags())
..target = new VmTarget(new TargetFlags(syncAsync: false))
..fileSystem = new HybridFileSystem(suite.fileSystem)
..onDiagnostic = messages.add,
main,
@@ -105,7 +105,7 @@ testEnabledSuperMixins() async {
var missingSuperMethodNames = new Set<String>();
var options = new CompilerOptions()
..onDiagnostic = _makeDiagnosticMessageHandler(missingSuperMethodNames)
..target = new NoneTargetWithSuperMixins(new TargetFlags());
..target = new NoneTargetWithSuperMixins(new TargetFlags(syncAsync: false));
await compileScript(testSource, options: options);
Expect.setEquals(
const <String>['baz', 'foo', 'quux'], missingSuperMethodNames);
+5 -2
View File
@@ -291,8 +291,11 @@ class Outline extends Step<TestDescription, Component, FastaContext> {
CompilerContext.current.disableColors();
Component platform = await context.loadPlatform();
Ticker ticker = new Ticker();
DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
new TestVmTarget(new TargetFlags(legacyMode: legacyMode)));
DillTarget dillTarget = new DillTarget(
ticker,
context.uriTranslator,
new TestVmTarget(
new TargetFlags(legacyMode: legacyMode, syncAsync: false)));
dillTarget.loader.appendLibraries(platform);
// We create a new URI translator to avoid reading platform libraries from
// file system.
@@ -49,8 +49,11 @@ class MockLibraryBuilder extends KernelLibraryBuilder {
new KernelTarget(
null,
false,
new DillTarget(null, null,
new NoneTarget(new TargetFlags(legacyMode: true))),
new DillTarget(
null,
null,
new NoneTarget(new TargetFlags(
legacyMode: true, syncAsync: false))),
null)
.loader,
null,
@@ -356,7 +356,8 @@ CompilerOptions getOptions(bool strong) {
final Uri sdkRoot = computePlatformBinariesLocation(forceBuildDir: true);
CompilerOptions options = new CompilerOptions()
..sdkRoot = sdkRoot
..target = new VmTarget(new TargetFlags(legacyMode: !strong))
..target =
new VmTarget(new TargetFlags(legacyMode: !strong, syncAsync: false))
..librariesSpecificationUri = Uri.base.resolve("sdk/lib/libraries.json")
..onDiagnostic = (DiagnosticMessage message) {
if (message.severity == Severity.error ||
+1 -1
View File
@@ -346,7 +346,7 @@ Future<List<Uri>> computeHostDependencies(Uri hostPlatform) async {
// mode), this is only an approximation, albeit accurate. Once Fasta is
// self-hosting, this isn't an approximation. Regardless, strong mode
// shouldn't affect which files are read.
Target hostTarget = getTarget("vm", new TargetFlags());
Target hostTarget = getTarget("vm", new TargetFlags(syncAsync: false));
return getDependencies(Platform.script,
platform: hostPlatform, target: hostTarget);
}
+1 -1
View File
@@ -71,7 +71,7 @@ DiagnosticMessageHandler onDiagnosticMessageHandler({bool legacyMode: false}) {
// legacyMode flag get merged, and we have a single way of specifying the
// legacy-mode flag to the FE.
Target createTarget({bool isFlutter: false, bool legacyMode: false}) {
var flags = new TargetFlags(legacyMode: legacyMode);
var flags = new TargetFlags(legacyMode: legacyMode, syncAsync: false);
if (isFlutter) {
return legacyMode
? new LegacyFlutterTarget(flags)
+1 -1
View File
@@ -22,7 +22,7 @@ class TargetFlags {
TargetFlags(
{this.legacyMode: false,
this.treeShake: false,
this.syncAsync: false,
this.syncAsync: true,
this.programRoots: const <ProgramRoot>[],
this.kernelRuntime});
}
+1 -1
View File
@@ -87,7 +87,7 @@ abstract class Compiler {
options = new CompilerOptions()
..fileSystem = fileSystem
..target = new VmTarget(new TargetFlags(syncAsync: true))
..target = new VmTarget(new TargetFlags())
..packagesFileUri = packagesUri
..sdkSummary = platformKernelPath
..verbose = verbose
+1 -1
View File
@@ -32,7 +32,7 @@ Future<Component> compileTestCaseToKernelProgram(Uri sourceUri,
{Target target, bool enableSuperMixins: false}) async {
final platformKernel =
computePlatformBinariesLocation().resolve('vm_platform_strong.dill');
target ??= new TestingVmTarget(new TargetFlags())
target ??= new TestingVmTarget(new TargetFlags(syncAsync: false))
..enableSuperMixins = enableSuperMixins;
final options = new CompilerOptions()
..target = target
+1 -1
View File
@@ -29,7 +29,7 @@ main() {
final sdkRoot = computePlatformBinariesLocation();
final options = new CompilerOptions()
..sdkRoot = sdkRoot
..target = new VmTarget(new TargetFlags())
..target = new VmTarget(new TargetFlags(syncAsync: false))
..linkedDependencies = <Uri>[platformKernel]
..onDiagnostic = (DiagnosticMessage message) {
fail("Compilation error: ${message.plainTextFormatted.join('\n')}");
@@ -49,7 +49,7 @@ class PrintSummaries extends RecursiveVisitor<Null> {
}
runTestCase(Uri source) async {
final Target target = new TestingVmTarget(new TargetFlags());
final Target target = new TestingVmTarget(new TargetFlags(syncAsync: false));
final Component component = await compileTestCaseToKernelProgram(source);
final Library library = component.mainMethod.enclosingLibrary;
final CoreTypes coreTypes = new CoreTypes(component);
@@ -18,7 +18,7 @@ import '../../common_test_utils.dart';
final String pkgVmDir = Platform.script.resolve('../../..').toFilePath();
runTestCase(Uri source) async {
final target = new TestingVmTarget(new TargetFlags());
final target = new TestingVmTarget(new TargetFlags(syncAsync: false));
Component component =
await compileTestCaseToKernelProgram(source, target: target);