[dart2js] Migrate common/elements.dart to nnbd
Change-Id: I3be0442cd37674a208c55c87437df7159d763e9c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244602 Reviewed-by: Stephen Adams <sra@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2022, 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 '../elements/entities.dart';
|
||||
import '../elements/types.dart';
|
||||
|
||||
/// This is a facade interface for the members of CommonElements that are
|
||||
/// required by 'constants/value.dart'.
|
||||
// TODO(48820): When CommonElements is migrated, remove this facade.
|
||||
abstract class CommonElements {
|
||||
DartType get boolType;
|
||||
DartType get doubleType;
|
||||
DartType get dynamicType;
|
||||
DartType get intType;
|
||||
DartType get nullType;
|
||||
DartType get stringType;
|
||||
|
||||
DartTypes get dartTypes;
|
||||
|
||||
InterfaceType getConstantListTypeFor(InterfaceType sourceType);
|
||||
InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
|
||||
{bool onlyStringKeys = false});
|
||||
InterfaceType getConstantSetTypeFor(InterfaceType sourceType);
|
||||
InterfaceType listType([DartType? elementType]);
|
||||
InterfaceType mapType([DartType? keyType, DartType? valueType]);
|
||||
InterfaceType get symbolImplementationType;
|
||||
InterfaceType get typeLiteralType;
|
||||
|
||||
FieldEntity get symbolField;
|
||||
}
|
||||
@@ -6,8 +6,7 @@
|
||||
/// compiled to JavaScript.
|
||||
library dart2js.constant_system;
|
||||
|
||||
//import '../common/elements.dart' show CommonElements;
|
||||
import 'common_elements_for_constants.dart';
|
||||
import '../common/elements.dart' show CommonElements;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/types.dart';
|
||||
import 'values.dart';
|
||||
|
||||
@@ -5,16 +5,13 @@
|
||||
library dart2js.constants.values;
|
||||
|
||||
import '../common.dart';
|
||||
import '../common/elements.dart' show CommonElements;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/types.dart';
|
||||
import '../deferred_load/output_unit_migrated.dart' show OutputUnit;
|
||||
import '../js/js.dart' as js;
|
||||
import '../util/util.dart';
|
||||
|
||||
import 'common_elements_for_constants.dart';
|
||||
// TODO(48820): When CommonElements is migrated, replace this import with
|
||||
// import '../common/elements.dart' show CommonElements;
|
||||
|
||||
enum ConstantValueKind {
|
||||
FUNCTION,
|
||||
NULL,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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 '../common/elements.dart' show CommonElements;
|
||||
import '../common/names.dart';
|
||||
import '../options.dart';
|
||||
import '../serialization/serialization_interfaces.dart';
|
||||
@@ -1696,22 +1697,10 @@ class _DartTypeToStringVisitor extends DartTypeVisitor<void, void> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The subset of CommonElements methods needed for DartTypes.
|
||||
// TODO(48820): Replace with CommonElements once that is migrated.
|
||||
abstract class CommonElementsForDartTypes {
|
||||
InterfaceType get nullType;
|
||||
InterfaceType get intType;
|
||||
InterfaceType get doubleType;
|
||||
InterfaceType get functionType;
|
||||
InterfaceType get objectType;
|
||||
InterfaceType get jsJavaScriptFunctionType;
|
||||
InterfaceType futureType(DartType elementType);
|
||||
}
|
||||
|
||||
/// Basic interface for the Dart type system.
|
||||
abstract class DartTypes {
|
||||
/// The types defined in 'dart:core'.
|
||||
CommonElementsForDartTypes get commonElements;
|
||||
CommonElements get commonElements;
|
||||
|
||||
bool get useLegacySubtyping;
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import '../native/behavior.dart' show NativeBehavior;
|
||||
import '../serialization/serialization.dart';
|
||||
import '../util/util.dart';
|
||||
|
||||
import 'native_data_interfaces.dart' as interfaces;
|
||||
|
||||
class NativeBasicDataBuilder {
|
||||
bool _closed = false;
|
||||
|
||||
@@ -133,7 +135,7 @@ class NativeBasicDataBuilder {
|
||||
/// Basic information for native classes and js-interop libraries and classes.
|
||||
///
|
||||
/// This information is computed during loading using [NativeBasicDataBuilder].
|
||||
class NativeBasicData {
|
||||
class NativeBasicData implements interfaces.NativeBasicData {
|
||||
/// Tag used for identifying serialized [NativeBasicData] objects in a
|
||||
/// debugging data stream.
|
||||
static const String tag = 'native-basic-data';
|
||||
@@ -261,6 +263,7 @@ class NativeBasicData {
|
||||
/// A class is marked as native either through the `@Native(...)` annotation
|
||||
/// allowed for internal libraries or via the typed JavaScriptInterop
|
||||
/// mechanism allowed for user libraries.
|
||||
@override
|
||||
bool isNativeClass(ClassEntity element) {
|
||||
if (isJsInteropClass(element)) return true;
|
||||
return _nativeClassTagInfo.containsKey(element);
|
||||
@@ -286,6 +289,7 @@ class NativeBasicData {
|
||||
}
|
||||
|
||||
/// Returns `true` if [element] is a JsInterop class.
|
||||
@override
|
||||
bool isJsInteropClass(ClassEntity element) {
|
||||
return _jsInteropClasses.containsKey(element);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) 2022, 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:compiler/src/elements/entities.dart';
|
||||
|
||||
/// This is a facade interface for the members of NativeBasicData that are
|
||||
/// required by other migrated classes.
|
||||
// TODO(48820): When NativeBasicData is migrated, remove this facade.
|
||||
abstract class NativeBasicData {
|
||||
bool isJsInteropClass(ClassEntity element);
|
||||
|
||||
bool isNativeClass(ClassEntity element);
|
||||
}
|
||||
@@ -18,8 +18,9 @@ import '../serialization/serialization.dart';
|
||||
|
||||
import 'element_map.dart';
|
||||
import 'elements.dart' show JGeneratorBody;
|
||||
import 'locals_interfaces.dart' as interfaces;
|
||||
|
||||
class GlobalLocalsMap {
|
||||
class GlobalLocalsMap implements interfaces.GlobalLocalsMap {
|
||||
/// Tag used for identifying serialized [GlobalLocalsMap] objects in a
|
||||
/// debugging data stream.
|
||||
static const String tag = 'global-locals-map';
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2022, 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.
|
||||
|
||||
/// This is a facade interface for the members of GlobalLocalsMap that are
|
||||
/// required by other migrated classes.
|
||||
// TODO(48820): When GlobalLocalsMap is migrated, remove this facade.
|
||||
abstract class GlobalLocalsMap {}
|
||||
Reference in New Issue
Block a user