Files
sdk/pkg/vm/lib/target/flutter.dart
T
Alexander Markov 801bbb551b [flutter] Mark dart:mirrors library as unsupported in Flutter
Flutter doesn't support dart:mirrors (in all modes).
With this change CFE will be able to correctly select conditional
imports 'if (dart.library.mirrors)' and evaluate
const bool.fromEnvironment('dart.library.mirrors') in Flutter.

Issue: https://github.com/dart-lang/sdk/issues/49266
Change-Id: Ibde848d4a99ac818b736fe0d957cf23d920aa249
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249021
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-06-17 21:53:49 +00:00

72 lines
2.3 KiB
Dart

// Copyright (c) 2016, 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:kernel/ast.dart' show Component, Library;
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/target/changed_structure_notifier.dart';
import 'package:kernel/target/targets.dart';
import 'package:kernel/transformations/track_widget_constructor_locations.dart';
import 'package:vm/target/vm.dart' show VmTarget;
class FlutterTarget extends VmTarget {
FlutterTarget(TargetFlags flags) : super(flags);
late final WidgetCreatorTracker _widgetTracker = WidgetCreatorTracker();
@override
String get name => 'flutter';
@override
bool get enableSuperMixins => true;
// This is the order that bootstrap libraries are loaded according to
// `runtime/vm/object_store.h`.
@override
List<String> get extraRequiredLibraries => const <String>[
'dart:async',
'dart:collection',
'dart:convert',
'dart:developer',
'dart:ffi',
'dart:_internal',
'dart:isolate',
'dart:math',
// The library dart:mirrors may be ignored by the VM, e.g. when built in
// PRODUCT mode.
'dart:mirrors',
'dart:typed_data',
'dart:nativewrappers',
'dart:io',
// Required for flutter.
'dart:ui',
'dart:vmservice_io',
];
@override
List<String> get extraRequiredLibrariesPlatform => const <String>[];
@override
DartLibrarySupport get dartLibrarySupport =>
const CustomizedDartLibrarySupport(unsupported: {'mirrors'});
@override
void performPreConstantEvaluationTransformations(
Component component,
CoreTypes coreTypes,
List<Library> libraries,
DiagnosticReporter diagnosticReporter,
{void Function(String msg)? logger,
ChangedStructureNotifier? changedStructureNotifier}) {
super.performPreConstantEvaluationTransformations(
component, coreTypes, libraries, diagnosticReporter,
logger: logger, changedStructureNotifier: changedStructureNotifier);
if (flags.trackWidgetCreation) {
_widgetTracker.transform(component, libraries, changedStructureNotifier);
}
}
}