Remove TargetFlags.strongMode

Change-Id: Ibf8661e5444d16666c54f1d81c626893b000521a
Reviewed-on: https://dart-review.googlesource.com/c/78986
Commit-Queue: Jens Johansen <jensj@google.com>
Auto-Submit: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This commit is contained in:
Peter von der Ahé 2018-10-10 12:11:41 +00:00 committed by commit-bot@chromium.org
parent ee97806084
commit 8c872e0e3a
28 changed files with 34 additions and 34 deletions

View file

@ -68,7 +68,7 @@ ComparisonNode _diagnosticMessageToNode(DiagnosticMessage message) {
CompilerOptions _makeCompilerOptions(Uri packagesFileUri, Uri platformUri,
DiagnosticMessageHandler onDiagnostic) {
var targetFlags = TargetFlags(strongMode: true, syncAsync: true);
var targetFlags = TargetFlags(syncAsync: true);
var target = NoneTarget(targetFlags);
var fileSystem = StandardFileSystem.instance;

View file

@ -19,9 +19,9 @@ class Dart2jsTarget extends Target {
Dart2jsTarget(this.name, this.flags);
bool get strongMode => flags.strongMode;
bool get strongMode => !flags.legacyMode;
bool get enableNoSuchMethodForwarders => flags.strongMode;
bool get enableNoSuchMethodForwarders => !flags.legacyMode;
List<String> get extraRequiredLibraries => _requiredLibraries[name];

View file

@ -59,7 +59,7 @@ class LibraryLoaderTask extends CompilerTask {
String platform = '${targetName}_platform.dill';
initializedCompilerState = fe.initializeCompiler(
initializedCompilerState,
new Dart2jsTarget(targetName, new TargetFlags(strongMode: true)),
new Dart2jsTarget(targetName, new TargetFlags()),
_options.librariesSpecificationUri,
_options.platformBinaries.resolve(platform),
_options.packageConfig);

View file

@ -25,7 +25,7 @@ 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())
..target = new Dart2jsTarget("dart2js", new TargetFlags(legacyMode: true))
..packagesFileUri = Uri.base.resolve('.packages')
..setExitCodeOnProblem = true
..linkedDependencies = [

View file

@ -307,7 +307,7 @@ class ProcessedOptions {
Target _target;
Target get target => _target ??=
_raw.target ?? new NoneTarget(new TargetFlags(strongMode: !legacyMode));
_raw.target ?? new NoneTarget(new TargetFlags(legacyMode: legacyMode));
/// Get an outline component that summarizes the SDK, if any.
// TODO(sigmund): move, this doesn't feel like an "option".

View file

@ -378,7 +378,7 @@ Future<Context> createContext(
final List<CompilationMessage> errors = <CompilationMessage>[];
final CompilerOptions optionBuilder = new CompilerOptions()
..target = new VmTarget(new TargetFlags(strongMode: true))
..target = new VmTarget(new TargetFlags())
..reportMessages = true
..verbose = true
..fileSystem = fs

View file

@ -100,7 +100,8 @@ main() {
new KernelTarget(
null,
false,
new DillTarget(null, null, new NoneTarget(new TargetFlags())),
new DillTarget(null, null,
new NoneTarget(new TargetFlags(legacyMode: true))),
null)
.loader,
null,

View file

@ -40,7 +40,7 @@ void problemHandler(FormattedMessage message, Severity severity,
test({bool sdkFromSource}) async {
final CompilerOptions optionBuilder = new CompilerOptions()
..packagesFileUri = Uri.base.resolve(".packages")
..target = new VmTarget(new TargetFlags(strongMode: false))
..target = new VmTarget(new TargetFlags(legacyMode: true))
..legacyMode = true
..onProblem = problemHandler;

View file

@ -460,7 +460,7 @@ class Compile extends Step<Example, Null, MessageTestSuite> {
new CompilerOptions()
..sdkSummary = computePlatformBinariesLocation()
.resolve("vm_platform_strong.dill")
..target = new VmTarget(new TargetFlags(strongMode: true))
..target = new VmTarget(new TargetFlags())
..fileSystem = new HybridFileSystem(suite.fileSystem)
..onProblem = (FormattedMessage problem, Severity severity,
List<FormattedMessage> context) {

View file

@ -99,7 +99,7 @@ testEnabledSuperMixins() async {
var missingSuperMethodNames = new Set<String>();
var options = new CompilerOptions()
..onProblem = _makeProblemHandler(missingSuperMethodNames)
..target = new NoneTargetWithSuperMixins(new TargetFlags(strongMode: true));
..target = new NoneTargetWithSuperMixins(new TargetFlags());
await compileScript(testSource, options: options);
Expect.setEquals(
const <String>['baz', 'foo', 'quux'], missingSuperMethodNames);

View file

@ -298,7 +298,7 @@ class Outline extends Step<TestDescription, Component, FastaContext> {
Component platform = await context.loadPlatform();
Ticker ticker = new Ticker();
DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator,
new TestVmTarget(new TargetFlags(strongMode: strongMode)));
new TestVmTarget(new TargetFlags(legacyMode: !strongMode)));
dillTarget.loader.appendLibraries(platform);
// We create a new URI translator to avoid reading platform libraries from
// file system.

View file

@ -48,8 +48,8 @@ class MockLibraryBuilder extends KernelLibraryBuilder {
new KernelTarget(
null,
false,
new DillTarget(
null, null, new NoneTarget(new TargetFlags())),
new DillTarget(null, null,
new NoneTarget(new TargetFlags(legacyMode: true))),
null)
.loader,
null,

View file

@ -359,7 +359,7 @@ CompilerOptions getOptions(bool strong) {
final Uri sdkRoot = computePlatformBinariesLocation();
CompilerOptions options = new CompilerOptions()
..sdkRoot = sdkRoot
..target = new VmTarget(new TargetFlags(strongMode: strong))
..target = new VmTarget(new TargetFlags(legacyMode: !strong))
..librariesSpecificationUri = Uri.base.resolve("sdk/lib/libraries.json")
..onProblem = (FormattedMessage problem, Severity severity,
List<FormattedMessage> context) {

View file

@ -272,7 +272,7 @@ ProcessedOptions analyzeCommandLine(
final String targetName = options["--target"] ?? "vm";
final TargetFlags flags =
new TargetFlags(strongMode: !legacyMode, syncAsync: syncAsync);
new TargetFlags(legacyMode: legacyMode, syncAsync: syncAsync);
final Target target = getTarget(targetName, flags);
if (target == null) {

View file

@ -356,7 +356,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(strongMode: true));
Target hostTarget = getTarget("vm", new TargetFlags());
return getDependencies(Platform.script,
platform: hostPlatform, target: hostTarget);
}

View file

@ -71,7 +71,7 @@ onErrorHandler(bool isStrong) {
// strongMode flag get merged, and we have a single way of specifying the
// strong-mode flag to the FE.
Target createTarget({bool isFlutter: false, bool strongMode: true}) {
var flags = new TargetFlags(strongMode: strongMode);
var flags = new TargetFlags(legacyMode: !strongMode);
if (isFlutter) {
return strongMode
? new FlutterTarget(flags)

View file

@ -11,7 +11,7 @@ import '../transformations/treeshaker.dart' show ProgramRoot;
final List<String> targetNames = targets.keys.toList();
class TargetFlags {
final bool strongMode;
final bool legacyMode;
final bool treeShake;
/// Whether `async` functions start synchronously.
@ -20,7 +20,7 @@ class TargetFlags {
final Uri kernelRuntime;
TargetFlags(
{this.strongMode: false,
{this.legacyMode: false,
this.treeShake: false,
this.syncAsync: false,
this.programRoots: const <ProgramRoot>[],
@ -197,7 +197,7 @@ class NoneTarget extends Target {
NoneTarget(this.flags);
bool get strongMode => flags.strongMode;
bool get strongMode => !flags.legacyMode;
String get name => 'none';
List<String> get extraRequiredLibraries => <String>[];
void performModularTransformationsOnLibraries(Component component,

View file

@ -99,7 +99,7 @@ Future<int> compile(List<String> arguments) async {
final CompilerOptions compilerOptions = new CompilerOptions()
..legacyMode = !strongMode
..target = new VmTarget(
new TargetFlags(strongMode: strongMode, syncAsync: syncAsync))
new TargetFlags(legacyMode: !strongMode, syncAsync: syncAsync))
..linkedDependencies = <Uri>[
Uri.base.resolveUri(new Uri.file(platformKernel))
]

View file

@ -91,7 +91,7 @@ abstract class Compiler {
..legacyMode = !strongMode
..fileSystem = fileSystem
..target = new VmTarget(
new TargetFlags(strongMode: strongMode, syncAsync: syncAsync))
new TargetFlags(legacyMode: !strongMode, syncAsync: syncAsync))
..packagesFileUri = packagesUri
..sdkSummary = platformKernelPath
..verbose = verbose

View file

@ -317,7 +317,7 @@ class FrontendCompiler implements CompilerInterface {
installAdditionalTargets();
final TargetFlags targetFlags = new TargetFlags(
strongMode: options['strong'], syncAsync: options['sync-async']);
legacyMode: !options['strong'], syncAsync: options['sync-async']);
compilerOptions.target = getTarget(options['target'], targetFlags);
if (compilerOptions.target == null) {
print('Failed to create front-end target ${options['target']}.');

View file

@ -33,7 +33,7 @@ class VmTarget extends Target {
VmTarget(this.flags);
@override
bool get strongMode => flags.strongMode;
bool get strongMode => !flags.legacyMode;
@override
bool get enableNoSuchMethodForwarders => true;

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(strongMode: true))
target ??= new TestingVmTarget(new TargetFlags())
..enableSuperMixins = enableSuperMixins;
final options = new CompilerOptions()
..target = target

View file

@ -29,7 +29,7 @@ main() {
final sdkRoot = computePlatformBinariesLocation();
final options = new CompilerOptions()
..sdkRoot = sdkRoot
..target = new VmTarget(new TargetFlags(strongMode: true))
..target = new VmTarget(new TargetFlags())
..linkedDependencies = <Uri>[platformKernel]
..onDiagnostic = (DiagnosticMessage message) {
fail("Compilation error: ${message.plainTextFormatted.join('\n')}");

View file

@ -47,7 +47,7 @@ class PrintSummaries extends RecursiveVisitor<Null> {
}
runTestCase(Uri source) async {
final Target target = new TestingVmTarget(new TargetFlags(strongMode: true));
final Target target = new TestingVmTarget(new TargetFlags());
final Component component = await compileTestCaseToKernelProgram(source);
final Library library = component.mainMethod.enclosingLibrary;
final CoreTypes coreTypes = new CoreTypes(component);

View file

@ -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(strongMode: true));
final target = new TestingVmTarget(new TargetFlags());
Component component =
await compileTestCaseToKernelProgram(source, target: target);

View file

@ -28,7 +28,7 @@ main() {
Uri entryPoint = Uri.parse('memory:main.dill');
var options = new CompilerOptions()
..target = new Dart2jsTarget("dart2js", new TargetFlags())
..target = new Dart2jsTarget("dart2js", new TargetFlags(legacyMode: true))
..packagesFileUri = Uri.base.resolve('.packages')
..linkedDependencies = <Uri>[
computePlatformBinariesLocation().resolve("dart2js_platform.dill"),

View file

@ -121,7 +121,7 @@ Future _main(List<String> argv) async {
final Uri platform = outDirUri.resolve('platform.dill.tmp');
final Uri librariesJson = outDirUri.resolve("lib/libraries.json");
final Uri packages = Uri.base.resolveUri(new Uri.file(packagesFile));
TargetFlags flags = new TargetFlags();
TargetFlags flags = new TargetFlags(legacyMode: true);
Target target;
switch (mode) {

View file

@ -133,10 +133,9 @@ Future<bool> computeKernel(List<String> args,
var summaryOnly = parsedArgs['summary-only'] as bool;
var excludeNonSources = parsedArgs['exclude-non-sources'] as bool;
if (summaryOnly) {
target = new SummaryTarget(
sources, excludeNonSources, new TargetFlags(strongMode: true));
target = new SummaryTarget(sources, excludeNonSources, new TargetFlags());
} else {
target = new VmTarget(new TargetFlags(strongMode: true));
target = new VmTarget(new TargetFlags());
}
var state = await fe.initializeCompiler(
// TODO(sigmund): pass an old state once we can make use of it.