[CFE] Remove enableMacros and forceEnableMacros global bools.
R=johnniwinther@google.com Change-Id: Ic3f70209809176feff91e501c1d600df9f95d54f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338680 Auto-Submit: Morgan :) <davidmorgan@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
committed by
Commit Queue
parent
c260bec877
commit
54760c0382
@@ -18,7 +18,6 @@ import 'package:_fe_analyzer_shared/src/util/libraries_specification.dart'
|
||||
LibrariesSpecification,
|
||||
LibrariesSpecificationException,
|
||||
TargetLibrariesSpecification;
|
||||
import 'package:front_end/src/fasta/kernel/macro/macro.dart';
|
||||
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
|
||||
import 'package:kernel/kernel.dart'
|
||||
show
|
||||
@@ -202,15 +201,7 @@ class ProcessedOptions {
|
||||
this.environmentDefines = options?.environmentDefines,
|
||||
// TODO(sigmund, ahe): create ticker even earlier or pass in a stopwatch
|
||||
// collecting time since the start of the VM.
|
||||
this.ticker = new Ticker(isVerbose: options?.verbose ?? false) {
|
||||
if (globalFeatures.macros.isEnabled) {
|
||||
enableMacros = true;
|
||||
forceEnableMacros = true;
|
||||
} else {
|
||||
enableMacros = false;
|
||||
forceEnableMacros = false;
|
||||
}
|
||||
}
|
||||
this.ticker = new Ticker(isVerbose: options?.verbose ?? false);
|
||||
|
||||
FormattedMessage format(
|
||||
LocatedMessage message, Severity severity, List<LocatedMessage>? context,
|
||||
|
||||
@@ -5,18 +5,14 @@
|
||||
library fasta.incremental_compiler;
|
||||
|
||||
import 'dart:async' show Completer;
|
||||
|
||||
import 'dart:convert' show JsonEncoder;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/scanner/abstract_scanner.dart'
|
||||
show ScannerConfiguration;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/macros/executor/multi_executor.dart'
|
||||
as macros;
|
||||
|
||||
import 'package:_fe_analyzer_shared/src/scanner/abstract_scanner.dart'
|
||||
show ScannerConfiguration;
|
||||
import 'package:front_end/src/fasta/kernel/benchmarker.dart'
|
||||
show BenchmarkPhases, Benchmarker;
|
||||
|
||||
import 'package:kernel/binary/ast_from_binary.dart'
|
||||
show
|
||||
BinaryBuilderWithMetadata,
|
||||
@@ -25,10 +21,10 @@ import 'package:kernel/binary/ast_from_binary.dart'
|
||||
InvalidKernelVersionError,
|
||||
SubComponentView,
|
||||
mergeCompilationModeOrThrow;
|
||||
|
||||
import 'package:kernel/canonical_name.dart'
|
||||
show CanonicalNameError, CanonicalNameSdkError;
|
||||
import 'package:kernel/class_hierarchy.dart'
|
||||
show ClassHierarchy, ClosedWorldClassHierarchy;
|
||||
|
||||
import 'package:kernel/kernel.dart'
|
||||
show
|
||||
Class,
|
||||
@@ -52,106 +48,61 @@ import 'package:kernel/kernel.dart'
|
||||
TreeNode,
|
||||
TypeParameter,
|
||||
VariableDeclaration;
|
||||
|
||||
import 'package:kernel/canonical_name.dart'
|
||||
show CanonicalNameError, CanonicalNameSdkError;
|
||||
|
||||
import 'package:kernel/kernel.dart' as kernel show Combinator;
|
||||
|
||||
import 'package:kernel/target/changed_structure_notifier.dart'
|
||||
show ChangedStructureNotifier;
|
||||
|
||||
import 'package:package_config/package_config.dart' show Package, PackageConfig;
|
||||
|
||||
import '../api_prototype/experimental_flags.dart';
|
||||
import '../api_prototype/file_system.dart' show FileSystem, FileSystemEntity;
|
||||
|
||||
import '../api_prototype/incremental_kernel_generator.dart'
|
||||
show
|
||||
IncrementalCompilerResult,
|
||||
IncrementalKernelGenerator,
|
||||
isLegalIdentifier;
|
||||
|
||||
import '../api_prototype/lowering_predicates.dart' show isExtensionThisName;
|
||||
|
||||
import '../api_prototype/memory_file_system.dart' show MemoryFileSystem;
|
||||
|
||||
import '../base/nnbd_mode.dart';
|
||||
|
||||
import '../base/processed_options.dart' show ProcessedOptions;
|
||||
|
||||
import '../kernel_generator_impl.dart' show precompileMacros;
|
||||
|
||||
import 'builder/builder.dart' show Builder;
|
||||
|
||||
import 'builder/declaration_builders.dart'
|
||||
show ClassBuilder, ExtensionBuilder, TypeDeclarationBuilder;
|
||||
|
||||
import 'builder/field_builder.dart' show FieldBuilder;
|
||||
|
||||
import 'builder/library_builder.dart' show LibraryBuilder;
|
||||
|
||||
import 'builder/member_builder.dart' show MemberBuilder;
|
||||
|
||||
import 'builder/name_iterator.dart' show NameIterator;
|
||||
|
||||
import 'builder/type_builder.dart' show NamedTypeBuilder, TypeBuilder;
|
||||
|
||||
import 'builder_graph.dart' show BuilderGraph;
|
||||
|
||||
import 'combinator.dart' show CombinatorBuilder;
|
||||
|
||||
import 'compiler_context.dart' show CompilerContext;
|
||||
|
||||
import 'dill/dill_class_builder.dart' show DillClassBuilder;
|
||||
|
||||
import 'dill/dill_library_builder.dart' show DillLibraryBuilder;
|
||||
|
||||
import 'dill/dill_loader.dart' show DillLoader;
|
||||
import 'dill/dill_target.dart' show DillTarget;
|
||||
|
||||
import 'export.dart' show Export;
|
||||
|
||||
import 'fasta_codes.dart';
|
||||
|
||||
import 'import.dart' show Import;
|
||||
|
||||
import 'incremental_serializer.dart' show IncrementalSerializer;
|
||||
|
||||
import 'kernel/macro/macro.dart' show enableMacros, NeededPrecompilations;
|
||||
|
||||
import 'scope.dart' show Scope, ScopeKind;
|
||||
|
||||
import 'source/source_class_builder.dart' show SourceClassBuilder;
|
||||
|
||||
import 'source/source_extension_builder.dart';
|
||||
import 'util/error_reporter_file_copier.dart' show saveAsGzip;
|
||||
|
||||
import 'util/experiment_environment_getter.dart'
|
||||
show enableIncrementalCompilerBenchmarking, getExperimentEnvironment;
|
||||
|
||||
import 'util/textual_outline.dart' show textualOutline;
|
||||
|
||||
import 'uris.dart' show dartCore;
|
||||
|
||||
import 'hybrid_file_system.dart' show HybridFileSystem;
|
||||
|
||||
import 'import.dart' show Import;
|
||||
import 'incremental_serializer.dart' show IncrementalSerializer;
|
||||
import 'kernel/hierarchy/hierarchy_builder.dart' show ClassHierarchyBuilder;
|
||||
|
||||
import 'kernel/internal_ast.dart' show VariableDeclarationImpl;
|
||||
|
||||
import 'kernel/kernel_target.dart' show BuildResult, KernelTarget;
|
||||
|
||||
import 'kernel/macro/macro.dart' show NeededPrecompilations;
|
||||
import 'library_graph.dart' show LibraryGraph;
|
||||
|
||||
import 'scope.dart' show Scope, ScopeKind;
|
||||
import 'source/source_class_builder.dart' show SourceClassBuilder;
|
||||
import 'source/source_extension_builder.dart';
|
||||
import 'source/source_library_builder.dart'
|
||||
show ImplicitLanguageVersion, SourceLibraryBuilder;
|
||||
|
||||
import 'source/source_loader.dart';
|
||||
|
||||
import 'ticker.dart' show Ticker;
|
||||
|
||||
import 'uri_translator.dart' show UriTranslator;
|
||||
import 'uris.dart' show dartCore;
|
||||
import 'util/error_reporter_file_copier.dart' show saveAsGzip;
|
||||
import 'util/experiment_environment_getter.dart'
|
||||
show enableIncrementalCompilerBenchmarking, getExperimentEnvironment;
|
||||
import 'util/textual_outline.dart' show textualOutline;
|
||||
|
||||
final Uri dartFfiUri = Uri.parse("dart:ffi");
|
||||
|
||||
@@ -378,7 +329,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
||||
NeededPrecompilations? neededPrecompilations =
|
||||
await currentKernelTarget.computeNeededPrecompilations();
|
||||
_benchmarker?.enterPhase(BenchmarkPhases.incremental_precompileMacros);
|
||||
if (enableMacros) {
|
||||
if (context.options.globalFeatures.macros.isEnabled) {
|
||||
Map<Uri, macros.ExecutorFactoryToken>? precompiled =
|
||||
await precompileMacros(neededPrecompilations, c.options);
|
||||
if (precompiled != null) {
|
||||
@@ -1201,7 +1152,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (enableMacros) {
|
||||
if (context.options.globalFeatures.macros.isEnabled) {
|
||||
/// TODO(johnniwinther): Add a [hasMacro] property to [LibraryBuilder].
|
||||
for (LibraryBuilder builder in reusedResult.notReusedLibraries) {
|
||||
// TODO(johnniwinther): Should this include non-local (i.e. injected)
|
||||
|
||||
@@ -335,7 +335,10 @@ class KernelTarget extends TargetImplementation {
|
||||
loader.resolveParts();
|
||||
|
||||
benchmarker?.enterPhase(BenchmarkPhases.outline_computeMacroDeclarations);
|
||||
NeededPrecompilations? result = loader.computeMacroDeclarations();
|
||||
NeededPrecompilations? result =
|
||||
context.options.globalFeatures.macros.isEnabled
|
||||
? loader.computeMacroDeclarations()
|
||||
: null;
|
||||
|
||||
benchmarker
|
||||
?.enterPhase(BenchmarkPhases.unknownComputeNeededPrecompilations);
|
||||
|
||||
@@ -36,14 +36,6 @@ import '../../source/source_procedure_builder.dart';
|
||||
import '../hierarchy/hierarchy_builder.dart';
|
||||
import 'identifiers.dart';
|
||||
|
||||
bool enableMacros = false;
|
||||
|
||||
/// Enables macros whether the Macro class actually exists in the transitive
|
||||
/// deps or not. This allows for easier experimentation.
|
||||
///
|
||||
/// TODO: Remove this once it is no longer necessary.
|
||||
bool forceEnableMacros = false;
|
||||
|
||||
const String augmentationScheme = 'org-dartlang-augmentation';
|
||||
|
||||
final Uri macroLibraryUri =
|
||||
|
||||
@@ -1503,8 +1503,6 @@ severity: $severity
|
||||
///
|
||||
/// If no macros need precompilation, `null` is returned.
|
||||
NeededPrecompilations? computeMacroDeclarations() {
|
||||
if (!enableMacros) return null;
|
||||
|
||||
LibraryBuilder? macroLibraryBuilder = lookupLibraryBuilder(macroLibraryUri);
|
||||
if (macroLibraryBuilder == null) return null;
|
||||
|
||||
@@ -1678,7 +1676,7 @@ severity: $severity
|
||||
Class? get macroClass => _macroClassBuilder?.cls;
|
||||
|
||||
Future<MacroApplications?> computeMacroApplications() async {
|
||||
if ((!enableMacros || _macroClassBuilder == null) && !forceEnableMacros) {
|
||||
if (_macroClassBuilder == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ Future<Map<Uri, ExecutorFactoryToken>?> precompileMacros(
|
||||
NeededPrecompilations? neededPrecompilations,
|
||||
ProcessedOptions options) async {
|
||||
if (neededPrecompilations != null) {
|
||||
if (enableMacros) {
|
||||
if (options.globalFeatures.macros.isEnabled) {
|
||||
// TODO(johnniwinther): Avoid using [rawOptionsForTesting] to compute
|
||||
// the compiler options for the precompilation.
|
||||
if (options.rawOptionsForTesting.macroTarget != null) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import '../../utils/kernel_chain.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
bool generateExpectations = args.contains('-g');
|
||||
enableMacros = true;
|
||||
|
||||
MacroSerializer macroSerializer =
|
||||
new TempDirMacroSerializer('macro_application');
|
||||
|
||||
@@ -22,8 +22,6 @@ import 'package:front_end/src/testing/id_testing_utils.dart';
|
||||
import 'package:kernel/ast.dart' hide Arguments, TypeDeclaration;
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
enableMacros = true;
|
||||
|
||||
Directory dataDir =
|
||||
new Directory.fromUri(Platform.script.resolve('data/tests'));
|
||||
await runTests<Features>(dataDir,
|
||||
|
||||
@@ -14,7 +14,6 @@ import 'package:front_end/src/compute_platform_binaries_location.dart';
|
||||
import 'package:front_end/src/fasta/compiler_context.dart';
|
||||
import 'package:front_end/src/fasta/hybrid_file_system.dart';
|
||||
import 'package:front_end/src/fasta/incremental_compiler.dart';
|
||||
import 'package:front_end/src/fasta/kernel/macro/macro.dart';
|
||||
import 'package:front_end/src/isolate_macro_serializer.dart';
|
||||
import 'package:front_end/src/macro_serializer.dart';
|
||||
import 'package:front_end/src/testing/compiler_common.dart';
|
||||
@@ -82,7 +81,6 @@ Future<void> main(List<String> args) async {
|
||||
|
||||
args = args.toList();
|
||||
bool generateExpectations = args.remove('-g');
|
||||
enableMacros = true;
|
||||
MacroSerializer macroSerializer = new IsolateMacroSerializer();
|
||||
MemoryFileSystem memoryFileSystem = createMemoryFileSystem();
|
||||
CompilerOptions compilerOptions = new CompilerOptions()
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:expect/expect.dart';
|
||||
import 'package:front_end/src/api_prototype/experimental_flags.dart';
|
||||
import 'package:front_end/src/api_prototype/front_end.dart';
|
||||
import 'package:front_end/src/compute_platform_binaries_location.dart';
|
||||
import 'package:front_end/src/fasta/kernel/macro/macro.dart';
|
||||
import 'package:front_end/src/isolate_macro_serializer.dart';
|
||||
import 'package:front_end/src/macro_serializer.dart';
|
||||
import 'package:front_end/src/testing/id_testing_helper.dart';
|
||||
@@ -17,8 +16,6 @@ import 'package:kernel/target/targets.dart';
|
||||
import 'package:vm/target/vm.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
enableMacros = true;
|
||||
|
||||
MacroSerializer macroSerializer = new IsolateMacroSerializer();
|
||||
try {
|
||||
CompilerOptions options = new CompilerOptions();
|
||||
|
||||
Reference in New Issue
Block a user