[cfe] Enable verification in platform compilation

Closes #32530

Change-Id: I5a44e211a4b203e4879dbc8f6bf4bbec5abf51f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298820
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Johnni Winther 2023-04-27 07:34:39 +00:00 committed by Commit Queue
parent 255d755975
commit 20e0ddf130
5 changed files with 31 additions and 47 deletions

View file

@ -239,7 +239,9 @@ class DevCompilerTarget extends Target {
MapLiteral([
for (var n in arguments.named)
MapLiteralEntry(SymbolLiteral(n.name), n.value)
], keyType: coreTypes.symbolLegacyRawType),
], keyType: coreTypes.symbolLegacyRawType)
else
NullLiteral(),
];
return createInvocation('method', ctorArgs);
}

View file

@ -5,22 +5,33 @@
library fasta.tool.entry_points;
import 'dart:convert' show JsonEncoder, LineSplitter, jsonDecode, utf8;
import 'dart:io' show File, Platform, exitCode, stderr, stdin, stdout;
import 'dart:typed_data' show Uint8List;
import 'package:_fe_analyzer_shared/src/util/relativize.dart'
show isWindows, relativizeUri;
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions;
import 'package:front_end/src/api_prototype/kernel_generator.dart';
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:front_end/src/fasta/fasta_codes.dart'
show LocatedMessage, codeInternalProblemVerificationError;
import 'package:front_end/src/fasta/get_dependencies.dart' show getDependencies;
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
import 'package:front_end/src/fasta/kernel/benchmarker.dart'
show BenchmarkPhases, Benchmarker;
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show BuildResult, KernelTarget;
import 'package:front_end/src/fasta/kernel/utils.dart'
show printComponentText, writeComponentToFile;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
import 'package:front_end/src/kernel_generator_impl.dart'
show generateKernelInternal;
import 'package:kernel/kernel.dart'
show
CanonicalName,
@ -29,43 +40,12 @@ import 'package:kernel/kernel.dart'
RecursiveVisitor,
Source,
loadComponentFromBytes;
import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
import 'package:kernel/src/types.dart' show Types;
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:front_end/src/fasta/get_dependencies.dart' show getDependencies;
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show BuildResult, KernelTarget;
import 'package:front_end/src/fasta/kernel/utils.dart'
show printComponentText, writeComponentToFile;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
import 'package:front_end/src/kernel_generator_impl.dart'
show generateKernelInternal;
import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
import 'package:kernel/verifier.dart';
import 'additional_targets.dart' show installAdditionalTargets;
import 'bench_maker.dart' show BenchMaker;
import 'command_line.dart' show runProtectedFromAbort, withGlobalOptions;
const bool benchmark =
@ -538,9 +518,8 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary!);
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
// TODO(johnniwinther): Enable verification.
//verifyComponent(c.options.target,
// VerificationStage.afterModularTransformations, result.component!);
verifyComponent(c.options.target,
VerificationStage.afterModularTransformations, result.component!);
await writeComponentToFile(result.component!, fullOutput);
c.options.ticker.logMs("Wrote component to ${fullOutput.toFilePath()}");

View file

@ -1035,6 +1035,9 @@ class TargetWrapper extends Target {
Map<String, String> updateEnvironmentDefines(Map<String, String> map) {
return _target.updateEnvironmentDefines(map);
}
@override
Verification get verification => _target.verification;
}
class TestTargetWrapper extends TargetWrapper with TestTargetMixin {

View file

@ -349,11 +349,10 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
@override
void visitLibrary(Library node) {
// Issue(http://dartbug.com/32530)
// 'dart:test' is used in the unit tests and isn't an actual part of the
// platform.
if (skipPlatform &&
node.importUri.isScheme('dart') &&
// 'dart:test' is used in the unit tests and isn't an actual part of the
// platform so we don't skip its verification.
node.importUri.path != 'test') {
return;
}

View file

@ -33,7 +33,8 @@ class Isolate {
{bool paused = false,
bool errorsAreFatal = true,
SendPort? onExit,
SendPort? onError}) =>
SendPort? onError,
String? debugName}) =>
_unsupported();
@patch