[kernel] Migrate to new constructor decl syntax.
(Part of https://github.com/dart-lang/sdk/issues/63288) This change migrates the kernel package to use the new constructor declaration syntax, described in https://github.com/dart-lang/language/blob/main/accepted/future-releases/primary-constructors/feature-specification.md#abbreviations-of-in-body-constructor-declarations. This change was performed in an automated fashion, by (a) bumping the package's SDK constraint to `3.13.0-0`, (b) enabling the lints `unnecessary_type_name_in_constructor` and `unnecessary_const_in_enum_constructor`, (c) fixing the resulting lint failures using `dart fix`, and then (d) reformatting the affected files. To ease code review, I've reverted unrelated formatting changes. Change-Id: I8d32a0b26450a44dfa2ebd9fe2dff9df6a6a6964 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508426 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
committed by
dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
7a5c71ba05
commit
d7f200b97d
@@ -6,6 +6,8 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- unnecessary_type_name_in_constructor
|
||||
- unnecessary_const_in_enum_constructor
|
||||
- collection_methods_unrelated_type
|
||||
- curly_braces_in_flow_control_structures
|
||||
- prefer_adjacent_string_concatenation
|
||||
|
||||
@@ -161,7 +161,7 @@ class ClassReference {
|
||||
final String name;
|
||||
final Uri libImportUri;
|
||||
|
||||
const ClassReference(this.name, this.libImportUri);
|
||||
const new(this.name, this.libImportUri);
|
||||
|
||||
@override
|
||||
int get hashCode => name.hashCode * 13 + libImportUri.hashCode * 17;
|
||||
|
||||
@@ -38,7 +38,7 @@ void main(args) {
|
||||
}
|
||||
|
||||
class WrappedBinaryBuilder extends BinaryBuilder {
|
||||
WrappedBinaryBuilder(_bytes) : super(_bytes, disableLazyReading: true);
|
||||
new(_bytes) : super(_bytes, disableLazyReading: true);
|
||||
int offsetsSize = 0;
|
||||
int stringTableSize = 0;
|
||||
int linkTableSize = 0;
|
||||
|
||||
@@ -120,7 +120,7 @@ class SortableDataString implements Comparable<SortableDataString> {
|
||||
final double data;
|
||||
final String value;
|
||||
|
||||
SortableDataString(this.data, this.value);
|
||||
new(this.data, this.value);
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
@@ -158,7 +158,7 @@ class WrappedBinaryBuilder extends BinaryBuilder {
|
||||
List<int> statementTypes = List<int>.filled(255, 0);
|
||||
List<int> typeTypes = List<int>.filled(255, 0);
|
||||
|
||||
WrappedBinaryBuilder(_bytes)
|
||||
new(_bytes)
|
||||
: super(
|
||||
_bytes,
|
||||
disableLazyReading: true,
|
||||
|
||||
@@ -20,7 +20,7 @@ class ParseError {
|
||||
final String message;
|
||||
final String path;
|
||||
|
||||
ParseError(
|
||||
new(
|
||||
this.message, {
|
||||
required this.filename,
|
||||
required this.byteIndex,
|
||||
@@ -35,7 +35,7 @@ class InvalidKernelVersionError {
|
||||
final String? filename;
|
||||
final int version;
|
||||
|
||||
InvalidKernelVersionError(this.filename, this.version);
|
||||
new(this.filename, this.version);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -54,7 +54,7 @@ class InvalidKernelVersionError {
|
||||
class InvalidKernelSdkVersionError {
|
||||
final String version;
|
||||
|
||||
InvalidKernelSdkVersionError(this.version);
|
||||
new(this.version);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -66,7 +66,7 @@ class InvalidKernelSdkVersionError {
|
||||
class CompilationModeError {
|
||||
final String message;
|
||||
|
||||
CompilationModeError(this.message);
|
||||
new(this.message);
|
||||
|
||||
@override
|
||||
String toString() => "CompilationModeError[$message]";
|
||||
@@ -86,7 +86,7 @@ class _ComponentIndex {
|
||||
final int libraryCount;
|
||||
final int componentFileSizeInBytes;
|
||||
|
||||
_ComponentIndex({
|
||||
new({
|
||||
required this.binaryOffsetForSourceTable,
|
||||
required this.binaryOffsetForCanonicalNames,
|
||||
required this.binaryOffsetForMetadataPayloads,
|
||||
@@ -107,11 +107,7 @@ class SubComponentView {
|
||||
final int componentStartOffset;
|
||||
final int componentFileSize;
|
||||
|
||||
SubComponentView(
|
||||
this.libraries,
|
||||
this.componentStartOffset,
|
||||
this.componentFileSize,
|
||||
);
|
||||
new(this.libraries, this.componentStartOffset, this.componentFileSize);
|
||||
}
|
||||
|
||||
/// [StringInterner] allows Strings created from the binary to be shared with
|
||||
@@ -184,7 +180,7 @@ class BinaryBuilder {
|
||||
|
||||
/// Note that [disableLazyClassReading] is incompatible
|
||||
/// with checkCanonicalNames on readComponent.
|
||||
BinaryBuilder(
|
||||
new(
|
||||
this._bytes, {
|
||||
this.filename,
|
||||
bool disableLazyReading = false,
|
||||
@@ -4585,7 +4581,7 @@ class BinaryBuilderWithMetadata extends BinaryBuilder implements BinarySource {
|
||||
List<int>? _allKnownMetadataKeys;
|
||||
int? _previousMetadataLookupKey;
|
||||
|
||||
BinaryBuilderWithMetadata(
|
||||
new(
|
||||
Uint8List bytes, {
|
||||
String? filename,
|
||||
bool disableLazyReading = false,
|
||||
@@ -4927,5 +4923,5 @@ class _MetadataSubsection {
|
||||
/// Deserialized mapping from node offsets to metadata offsets.
|
||||
final Map<int, int> mapping;
|
||||
|
||||
_MetadataSubsection(this.repository, this.mapping);
|
||||
new(this.repository, this.mapping);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class BinaryPrinter
|
||||
///
|
||||
/// The BinaryPrinter will use its own buffer, so the [sink] does not need
|
||||
/// one.
|
||||
BinaryPrinter(
|
||||
new(
|
||||
Sink<List<int>> sink, {
|
||||
this.libraryFilter,
|
||||
StringIndexer? stringIndexer,
|
||||
@@ -3608,7 +3608,7 @@ class StringIndexer {
|
||||
// Note that the iteration order is important.
|
||||
final Map<String, int> index = new Map<String, int>();
|
||||
|
||||
StringIndexer() {
|
||||
new() {
|
||||
put('');
|
||||
}
|
||||
|
||||
@@ -3626,7 +3626,7 @@ class UriIndexer {
|
||||
// Note that the iteration order is important.
|
||||
final Map<Uri, int> index = new Map<Uri, int>();
|
||||
|
||||
UriIndexer();
|
||||
new();
|
||||
|
||||
int put(Uri uri) {
|
||||
int? result = index[uri];
|
||||
@@ -3653,7 +3653,7 @@ class BufferedSink {
|
||||
|
||||
int get offset => length + flushedLength;
|
||||
|
||||
BufferedSink(this._sink);
|
||||
new(this._sink);
|
||||
|
||||
void addDouble(double d) {
|
||||
Uint8List doubleBufferUint8 = _doubleBufferUint8 ??= _doubleBuffer.buffer
|
||||
@@ -3758,7 +3758,7 @@ class _MetadataSubsection {
|
||||
/// (nodeOffset) in ascending order.
|
||||
final List<int> metadataMapping = <int>[];
|
||||
|
||||
_MetadataSubsection(this.repository);
|
||||
new(this.repository);
|
||||
}
|
||||
|
||||
/// A [Sink] that directly writes data into a byte builder.
|
||||
|
||||
@@ -166,7 +166,7 @@ class _LoadedData {
|
||||
final Component component;
|
||||
final List<CanonicalName> linkTable;
|
||||
|
||||
_LoadedData(this.data, this.component, this.linkTable);
|
||||
new(this.data, this.component, this.linkTable);
|
||||
}
|
||||
|
||||
/// Calculate the "Adler-32" checksum.
|
||||
|
||||
@@ -93,11 +93,11 @@ class CanonicalName implements Comparable<CanonicalName?> {
|
||||
/// Temporary index used during serialization.
|
||||
int index = -1;
|
||||
|
||||
CanonicalName._(CanonicalName parent, this.name) : _parent = parent {
|
||||
new _(CanonicalName parent, this.name) : _parent = parent {
|
||||
_nonRootTop = parent.isRoot ? this : parent._nonRootTop;
|
||||
}
|
||||
|
||||
CanonicalName.root() : _parent = null, _nonRootTop = null, name = '';
|
||||
new root() : _parent = null, _nonRootTop = null, name = '';
|
||||
|
||||
bool get isRoot => _parent == null;
|
||||
|
||||
@@ -672,14 +672,14 @@ class Reference implements Comparable<Reference> {
|
||||
class CanonicalNameError {
|
||||
final String message;
|
||||
|
||||
CanonicalNameError(this.message);
|
||||
new(this.message);
|
||||
|
||||
@override
|
||||
String toString() => 'CanonicalNameError: $message';
|
||||
}
|
||||
|
||||
class CanonicalNameSdkError extends CanonicalNameError {
|
||||
CanonicalNameSdkError(String message) : super(message);
|
||||
new(String message) : super(message);
|
||||
|
||||
@override
|
||||
String toString() => 'CanonicalNameSdkError: $message';
|
||||
|
||||
@@ -372,7 +372,7 @@ abstract class ClassHierarchyMembers {
|
||||
/// Interface for answering various subclassing queries.
|
||||
abstract class ClassHierarchy
|
||||
implements ClassHierarchyBase, ClassHierarchyMembers {
|
||||
factory ClassHierarchy(
|
||||
factory(
|
||||
Component component,
|
||||
CoreTypes coreTypes, {
|
||||
HandleAmbiguousSupertypes? onAmbiguousSupertypes,
|
||||
@@ -634,7 +634,7 @@ class _ClassInfoSubtype {
|
||||
/// interleaved begin/end interval end points.
|
||||
late final Uint32List subtypeIntervalList;
|
||||
|
||||
_ClassInfoSubtype(this.classInfo);
|
||||
new(this.classInfo);
|
||||
}
|
||||
|
||||
class _ClosedWorldClassHierarchySubtypes implements ClassHierarchySubtypes {
|
||||
@@ -643,7 +643,7 @@ class _ClosedWorldClassHierarchySubtypes implements ClassHierarchySubtypes {
|
||||
final Map<Class, _ClassInfoSubtype> _infoMap = <Class, _ClassInfoSubtype>{};
|
||||
bool invalidated = false;
|
||||
|
||||
_ClosedWorldClassHierarchySubtypes(this.hierarchy)
|
||||
new(this.hierarchy)
|
||||
: _classesByTopDownIndex = new List<Class?>.filled(
|
||||
hierarchy._infoMap.length,
|
||||
null,
|
||||
@@ -814,7 +814,7 @@ class ClosedWorldClassHierarchy
|
||||
|
||||
_ClosedWorldClassHierarchySubtypes? _cachedClassHierarchySubtypes;
|
||||
|
||||
ClosedWorldClassHierarchy._internal(
|
||||
new _internal(
|
||||
this.coreTypes,
|
||||
HandleAmbiguousSupertypes onAmbiguousSupertypes,
|
||||
) {
|
||||
@@ -2067,7 +2067,7 @@ class ForTestingClassInfo {
|
||||
final List<Member>? lazyInterfaceGettersAndCalls;
|
||||
final List<Member>? lazyInterfaceSetters;
|
||||
|
||||
ForTestingClassInfo._(_ClassInfo c)
|
||||
new _(_ClassInfo c)
|
||||
: classNode = c.classNode,
|
||||
lazyDeclaredGettersAndCalls = c.lazyDeclaredGettersAndCalls,
|
||||
lazyDeclaredSetters = c.lazyDeclaredSetters,
|
||||
@@ -2135,7 +2135,7 @@ class _ClassInfo {
|
||||
List<Member>? lazyInterfaceGettersAndCalls;
|
||||
List<Member>? lazyInterfaceSetters;
|
||||
|
||||
_ClassInfo(this.classNode);
|
||||
new(this.classNode);
|
||||
|
||||
bool isSubclassOf(_ClassInfo other) {
|
||||
return _intervalListContains(
|
||||
@@ -2187,7 +2187,7 @@ class _ClassInfo {
|
||||
/// An immutable set of classes.
|
||||
class ClassSet extends IterableBase<Class> {
|
||||
final Set<Class> _classes;
|
||||
ClassSet(this._classes);
|
||||
new(this._classes);
|
||||
|
||||
@override
|
||||
bool contains(Object? class_) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class CloneVisitorNotMembers
|
||||
/// The boolean value of [cloneAnnotations] tells if the annotations on the
|
||||
/// outline elements in the source AST should be cloned to the target AST. The
|
||||
/// annotations in procedure bodies are cloned unconditionally.
|
||||
CloneVisitorNotMembers({
|
||||
new({
|
||||
Map<TypeParameter, DartType>? typeSubstitution,
|
||||
Map<TypeParameter, TypeParameter>? typeParams,
|
||||
Map<StructuralParameter, StructuralParameter>? structuralParameters,
|
||||
@@ -1389,7 +1389,7 @@ class CloneVisitorNotMembers
|
||||
/// It is safe to clone members, but cloning a class or library is not
|
||||
/// supported.
|
||||
class CloneVisitorWithMembers extends CloneVisitorNotMembers {
|
||||
CloneVisitorWithMembers({
|
||||
new({
|
||||
Map<TypeParameter, DartType>? typeSubstitution,
|
||||
Map<TypeParameter, TypeParameter>? typeParams,
|
||||
bool cloneAnnotations = true,
|
||||
@@ -1522,7 +1522,7 @@ class MixinApplicationCloner extends CloneVisitorWithMembers {
|
||||
Map<Name, Member>? _getterMap;
|
||||
Map<Name, Member>? _setterMap;
|
||||
|
||||
MixinApplicationCloner(
|
||||
new(
|
||||
this.mixinApplicationClass, {
|
||||
Map<TypeParameter, DartType>? typeSubstitution,
|
||||
Map<TypeParameter, TypeParameter>? typeParams,
|
||||
@@ -1617,7 +1617,7 @@ class MixinApplicationCloner extends CloneVisitorWithMembers {
|
||||
}
|
||||
|
||||
class CloneProcedureWithoutBody extends CloneVisitorWithMembers {
|
||||
CloneProcedureWithoutBody({
|
||||
new({
|
||||
Map<TypeParameter, DartType>? typeSubstitution,
|
||||
bool cloneAnnotations = true,
|
||||
}) : super(
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'dart:collection';
|
||||
import 'kernel.dart';
|
||||
|
||||
class _ConstVisitor extends RecursiveVisitor {
|
||||
_ConstVisitor(
|
||||
new(
|
||||
this.classLibraryUri,
|
||||
this.className,
|
||||
this.annotationClassLibraryUri,
|
||||
@@ -187,7 +187,7 @@ class ConstFinder {
|
||||
/// Creates a new ConstFinder class.
|
||||
///
|
||||
/// The `kernelFilePath` is the path to a dill (kernel) file to process.
|
||||
ConstFinder({
|
||||
new({
|
||||
required this.kernelFilePath,
|
||||
required String classLibraryUri,
|
||||
required String className,
|
||||
|
||||
@@ -95,8 +95,7 @@ class CoreTypes {
|
||||
final Map<Class, InterfaceType> _bottomInterfaceTypes =
|
||||
new Map<Class, InterfaceType>.identity();
|
||||
|
||||
CoreTypes(Component component)
|
||||
: index = new LibraryIndex.coreLibraries(component);
|
||||
new(Component component) : index = new LibraryIndex.coreLibraries(component);
|
||||
|
||||
late final Library asyncLibrary = index.getLibrary('dart:async');
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ Source:
|
||||
class HighlightingPrinter extends Printer {
|
||||
final Node highlight;
|
||||
|
||||
HighlightingPrinter(this.highlight)
|
||||
new(this.highlight)
|
||||
: super(new StringBuffer(), syntheticNames: globalDebuggingNames);
|
||||
|
||||
@override
|
||||
|
||||
@@ -47,7 +47,7 @@ class ExtensionMemberInfo {
|
||||
/// The [ExtensionMemberDescriptor] for the lowered [member].
|
||||
final ExtensionMemberDescriptor descriptor;
|
||||
|
||||
ExtensionMemberInfo(this.extension, this.member, this.descriptor);
|
||||
new(this.extension, this.member, this.descriptor);
|
||||
}
|
||||
|
||||
/// Information about an extension type member lowered as a top level member.
|
||||
@@ -61,11 +61,7 @@ class ExtensionTypeMemberInfo {
|
||||
/// The [ExtensionMemberDescriptor] for the lowered [member].
|
||||
final ExtensionTypeMemberDescriptor descriptor;
|
||||
|
||||
ExtensionTypeMemberInfo(
|
||||
this.extensionTypeDeclaration,
|
||||
this.member,
|
||||
this.descriptor,
|
||||
);
|
||||
new(this.extensionTypeDeclaration, this.member, this.descriptor);
|
||||
}
|
||||
|
||||
class _LibraryInfo {
|
||||
@@ -75,7 +71,7 @@ class _LibraryInfo {
|
||||
_library,
|
||||
);
|
||||
|
||||
_LibraryInfo(this._library);
|
||||
new(this._library);
|
||||
|
||||
ExtensionMemberInfo getExtensionMemberInfo(Member member) {
|
||||
return _extensionTable[member];
|
||||
@@ -89,7 +85,7 @@ class _LibraryInfo {
|
||||
class _ExtensionTable {
|
||||
final Map<Member, ExtensionMemberInfo> _map = {};
|
||||
|
||||
_ExtensionTable(Library library) {
|
||||
new(Library library) {
|
||||
for (Extension extension in library.extensions) {
|
||||
for (ExtensionMemberDescriptor descriptor
|
||||
in extension.memberDescriptors) {
|
||||
@@ -119,7 +115,7 @@ class _ExtensionTable {
|
||||
class _ExtensionTypeTable {
|
||||
final Map<Member, ExtensionTypeMemberInfo> _map = {};
|
||||
|
||||
_ExtensionTypeTable(Library library) {
|
||||
new(Library library) {
|
||||
for (ExtensionTypeDeclaration extensionTypeDeclaration
|
||||
in library.extensionTypeDeclarations) {
|
||||
for (ExtensionTypeMemberDescriptor descriptor
|
||||
|
||||
@@ -13,7 +13,7 @@ abstract class ImportTable {
|
||||
class ComponentImportTable implements ImportTable {
|
||||
final Map<Library, int> _libraryIndex = <Library, int>{};
|
||||
|
||||
ComponentImportTable(Component component) {
|
||||
new(Component component) {
|
||||
for (int i = 0; i < component.libraries.length; ++i) {
|
||||
_libraryIndex[component.libraries[i]] = i;
|
||||
}
|
||||
@@ -28,11 +28,11 @@ class LibraryImportTable implements ImportTable {
|
||||
final List<Library> _importedLibraries = <Library>[];
|
||||
final Map<Library, int> _libraryIndex = <Library, int>{};
|
||||
|
||||
factory LibraryImportTable(Library lib) {
|
||||
factory(Library lib) {
|
||||
return new _ImportTableBuilder(lib).build();
|
||||
}
|
||||
|
||||
LibraryImportTable.empty();
|
||||
new empty();
|
||||
|
||||
List<Library> get importedLibraries => _importedLibraries;
|
||||
|
||||
@@ -67,7 +67,7 @@ class _ImportTableBuilder extends RecursiveVisitor {
|
||||
return table;
|
||||
}
|
||||
|
||||
_ImportTableBuilder(this.referenceLibrary) {
|
||||
new(this.referenceLibrary) {
|
||||
table.addImport(referenceLibrary, '');
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,11 @@ class LibraryIndex {
|
||||
final Map<String, _ContainerTable> _libraries = <String, _ContainerTable>{};
|
||||
|
||||
/// Indexes the libraries with the URIs given in [libraryUris].
|
||||
LibraryIndex(Component component, Iterable<String> libraryUris)
|
||||
new(Component component, Iterable<String> libraryUris)
|
||||
: this.fromLibraries(component.libraries, libraryUris);
|
||||
|
||||
/// Indexes the libraries with the URIs given in [libraryUris].
|
||||
LibraryIndex.fromLibraries(
|
||||
Iterable<Library> libraries,
|
||||
Iterable<String> libraryUris,
|
||||
) {
|
||||
new fromLibraries(Iterable<Library> libraries, Iterable<String> libraryUris) {
|
||||
Set<String> libraryUriSet = libraryUris.toSet();
|
||||
for (Library library in libraries) {
|
||||
String uri = '${library.importUri}';
|
||||
@@ -41,7 +38,7 @@ class LibraryIndex {
|
||||
}
|
||||
|
||||
/// Indexes `dart:` libraries.
|
||||
LibraryIndex.coreLibraries(Component component) {
|
||||
new coreLibraries(Component component) {
|
||||
for (Library library in component.libraries) {
|
||||
if (library.importUri.isScheme('dart')) {
|
||||
_libraries['${library.importUri}'] = new _ContainerTable(library);
|
||||
@@ -53,7 +50,7 @@ class LibraryIndex {
|
||||
///
|
||||
/// Consider using another constructor to only index the libraries that
|
||||
/// are needed.
|
||||
LibraryIndex.all(Component component) {
|
||||
new all(Component component) {
|
||||
for (Library library in component.libraries) {
|
||||
_libraries['${library.importUri}'] = new _ContainerTable(library);
|
||||
}
|
||||
@@ -180,7 +177,7 @@ class _ContainerTable {
|
||||
|
||||
Map<String, _MemberTable>? _containers;
|
||||
|
||||
_ContainerTable(this.library);
|
||||
new(this.library);
|
||||
|
||||
Map<String, _MemberTable> get containers {
|
||||
if (_containers == null) {
|
||||
@@ -279,18 +276,16 @@ class _MemberTable {
|
||||
|
||||
Library get library => parent.library;
|
||||
|
||||
_MemberTable.fromClass(this.parent, this.class_)
|
||||
new fromClass(this.parent, this.class_)
|
||||
: extensionTypeDeclaration = null,
|
||||
extension_ = null;
|
||||
_MemberTable.fromExtensionTypeDeclaration(
|
||||
this.parent,
|
||||
this.extensionTypeDeclaration,
|
||||
) : class_ = null,
|
||||
new fromExtensionTypeDeclaration(this.parent, this.extensionTypeDeclaration)
|
||||
: class_ = null,
|
||||
extension_ = null;
|
||||
_MemberTable.fromExtension(this.parent, this.extension_)
|
||||
new fromExtension(this.parent, this.extension_)
|
||||
: class_ = null,
|
||||
extensionTypeDeclaration = null;
|
||||
_MemberTable.topLevel(this.parent)
|
||||
new topLevel(this.parent)
|
||||
: class_ = null,
|
||||
extensionTypeDeclaration = null,
|
||||
extension_ = null;
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract class FailureListener {
|
||||
class NaiveTypeChecker extends type_checker.TypeChecker {
|
||||
final FailureListener failures;
|
||||
|
||||
factory NaiveTypeChecker(
|
||||
factory(
|
||||
FailureListener failures,
|
||||
Component component, {
|
||||
bool ignoreSdk = false,
|
||||
@@ -37,7 +37,7 @@ class NaiveTypeChecker extends type_checker.TypeChecker {
|
||||
);
|
||||
}
|
||||
|
||||
NaiveTypeChecker._(
|
||||
new _(
|
||||
this.failures,
|
||||
CoreTypes coreTypes,
|
||||
ClassHierarchy hierarchy,
|
||||
|
||||
@@ -115,7 +115,7 @@ class IndexedLibrary extends IndexedContainerImpl {
|
||||
/// TODO(jensj): Should this class be renamed to make it more immediately
|
||||
/// clear that it also clears canonical names? And should the class be moved
|
||||
/// as it is more tightly bound with the incremental compiler?
|
||||
IndexedLibrary(this.library) {
|
||||
new(this.library) {
|
||||
library.reference.canonicalName = null;
|
||||
for (int i = 0; i < library.typedefs.length; i++) {
|
||||
Typedef typedef = library.typedefs[i];
|
||||
@@ -179,7 +179,7 @@ class IndexedClass extends IndexedContainerImpl {
|
||||
@override
|
||||
final Library library;
|
||||
|
||||
IndexedClass._(this._cls, this.library) {
|
||||
new _(this._cls, this.library) {
|
||||
for (int i = 0; i < _cls.constructors.length; i++) {
|
||||
Constructor constructor = _cls.constructors[i];
|
||||
constructor.reference.canonicalName = null;
|
||||
@@ -210,10 +210,7 @@ class IndexedExtensionTypeDeclaration
|
||||
final IndexedLibrary _indexedLibrary;
|
||||
final ExtensionTypeDeclaration extensionTypeDeclaration;
|
||||
|
||||
IndexedExtensionTypeDeclaration(
|
||||
this._indexedLibrary,
|
||||
this.extensionTypeDeclaration,
|
||||
) {
|
||||
new(this._indexedLibrary, this.extensionTypeDeclaration) {
|
||||
_addProcedures(extensionTypeDeclaration.procedures);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Component extends TreeNode {
|
||||
Reference? _mainMethodName;
|
||||
Reference? get mainMethodName => _mainMethodName;
|
||||
|
||||
Component({
|
||||
new({
|
||||
CanonicalName? nameRoot,
|
||||
List<Library>? libraries,
|
||||
Map<Uri, Source>? uriToSource,
|
||||
@@ -195,7 +195,7 @@ class Location {
|
||||
final int line; // 1-based.
|
||||
final int column; // 1-based.
|
||||
|
||||
Location(this.file, this.line, this.column);
|
||||
new(this.file, this.line, this.column);
|
||||
|
||||
@override
|
||||
String toString() => '$file:$line:$column';
|
||||
@@ -216,9 +216,9 @@ class Source {
|
||||
|
||||
String? cachedText;
|
||||
|
||||
Source(this.lineStarts, this.source, this.importUri, this.fileUri);
|
||||
new(this.lineStarts, this.source, this.importUri, this.fileUri);
|
||||
|
||||
Source.emptySource(this.lineStarts, this.importUri, this.fileUri)
|
||||
new emptySource(this.lineStarts, this.importUri, this.fileUri)
|
||||
: source = _emptySource;
|
||||
|
||||
/// Return the text corresponding to [line] which is a 1-based line
|
||||
|
||||
@@ -80,7 +80,7 @@ abstract class AuxiliaryConstant extends Constant {
|
||||
sealed class PrimitiveConstant<T> extends Constant {
|
||||
final T value;
|
||||
|
||||
PrimitiveConstant(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
int get hashCode => value.hashCode;
|
||||
@@ -96,7 +96,7 @@ sealed class PrimitiveConstant<T> extends Constant {
|
||||
}
|
||||
|
||||
class NullConstant extends PrimitiveConstant<Null> {
|
||||
NullConstant() : super(null);
|
||||
new() : super(null);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -124,7 +124,7 @@ class NullConstant extends PrimitiveConstant<Null> {
|
||||
}
|
||||
|
||||
class BoolConstant extends PrimitiveConstant<bool> {
|
||||
BoolConstant(bool value) : super(value);
|
||||
new(bool value) : super(value);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -154,7 +154,7 @@ class BoolConstant extends PrimitiveConstant<bool> {
|
||||
|
||||
/// An integer constant on a non-JS target.
|
||||
class IntConstant extends PrimitiveConstant<int> {
|
||||
IntConstant(int value) : super(value);
|
||||
new(int value) : super(value);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -184,7 +184,7 @@ class IntConstant extends PrimitiveConstant<int> {
|
||||
|
||||
/// A double constant on a non-JS target or any numeric constant on a JS target.
|
||||
class DoubleConstant extends PrimitiveConstant<double> {
|
||||
DoubleConstant(double value) : super(value);
|
||||
new(double value) : super(value);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -220,7 +220,7 @@ class DoubleConstant extends PrimitiveConstant<double> {
|
||||
}
|
||||
|
||||
class StringConstant extends PrimitiveConstant<String> {
|
||||
StringConstant(String value) : super(value);
|
||||
new(String value) : super(value);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -259,7 +259,7 @@ class SymbolConstant extends Constant {
|
||||
final String name;
|
||||
final Reference? libraryReference;
|
||||
|
||||
SymbolConstant(this.name, this.libraryReference);
|
||||
new(this.name, this.libraryReference);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {}
|
||||
@@ -312,7 +312,7 @@ class MapConstant extends Constant {
|
||||
final DartType valueType;
|
||||
final List<ConstantMapEntry> entries;
|
||||
|
||||
MapConstant(this.keyType, this.valueType, this.entries);
|
||||
new(this.keyType, this.valueType, this.entries);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -381,7 +381,7 @@ class MapConstant extends Constant {
|
||||
class ConstantMapEntry {
|
||||
final Constant key;
|
||||
final Constant value;
|
||||
ConstantMapEntry(this.key, this.value);
|
||||
new(this.key, this.value);
|
||||
|
||||
@override
|
||||
String toString() => 'ConstantMapEntry(${toStringInternal()})';
|
||||
@@ -412,7 +412,7 @@ class ListConstant extends Constant {
|
||||
final DartType typeArgument;
|
||||
final List<Constant> entries;
|
||||
|
||||
ListConstant(this.typeArgument, this.entries);
|
||||
new(this.typeArgument, this.entries);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -476,7 +476,7 @@ class SetConstant extends Constant {
|
||||
final DartType typeArgument;
|
||||
final List<Constant> entries;
|
||||
|
||||
SetConstant(this.typeArgument, this.entries);
|
||||
new(this.typeArgument, this.entries);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -563,7 +563,7 @@ class RecordConstant extends Constant {
|
||||
/// }
|
||||
final RecordType recordType;
|
||||
|
||||
RecordConstant(this.positional, this.named, this.recordType)
|
||||
new(this.positional, this.named, this.recordType)
|
||||
: assert(
|
||||
positional.length == recordType.positional.length &&
|
||||
named.length == recordType.named.length &&
|
||||
@@ -585,7 +585,7 @@ class RecordConstant extends Constant {
|
||||
"${named.keys.join(", ")}",
|
||||
);
|
||||
|
||||
RecordConstant.fromTypeContext(
|
||||
new fromTypeContext(
|
||||
this.positional,
|
||||
this.named,
|
||||
StaticTypeContext staticTypeContext,
|
||||
@@ -677,7 +677,7 @@ class InstanceConstant extends Constant {
|
||||
final List<DartType> typeArguments;
|
||||
final Map<Reference, Constant> fieldValues;
|
||||
|
||||
InstanceConstant(this.classReference, this.typeArguments, this.fieldValues);
|
||||
new(this.classReference, this.typeArguments, this.fieldValues);
|
||||
|
||||
Class get classNode => classReference.asClass;
|
||||
|
||||
@@ -753,7 +753,7 @@ class InstantiationConstant extends Constant {
|
||||
final Constant tearOffConstant;
|
||||
final List<DartType> types;
|
||||
|
||||
InstantiationConstant(this.tearOffConstant, this.types);
|
||||
new(this.tearOffConstant, this.types);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -815,7 +815,7 @@ class StaticTearOffConstant extends Constant implements TearOffConstant {
|
||||
@override
|
||||
final Reference targetReference;
|
||||
|
||||
StaticTearOffConstant(Procedure target)
|
||||
new(Procedure target)
|
||||
: assert(target.isStatic),
|
||||
assert(
|
||||
target.kind == ProcedureKind.Method,
|
||||
@@ -823,7 +823,7 @@ class StaticTearOffConstant extends Constant implements TearOffConstant {
|
||||
),
|
||||
targetReference = target.reference;
|
||||
|
||||
StaticTearOffConstant.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
@override
|
||||
Procedure get target => targetReference.asProcedure;
|
||||
@@ -878,14 +878,14 @@ class ConstructorTearOffConstant extends Constant implements TearOffConstant {
|
||||
@override
|
||||
final Reference targetReference;
|
||||
|
||||
ConstructorTearOffConstant(Member target)
|
||||
new(Member target)
|
||||
: assert(
|
||||
target is Constructor || (target is Procedure && target.isFactory),
|
||||
"Unexpected constructor tear off target: $target",
|
||||
),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
ConstructorTearOffConstant.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
@override
|
||||
Member get target => targetReference.asMember;
|
||||
@@ -941,11 +941,11 @@ class RedirectingFactoryTearOffConstant extends Constant
|
||||
@override
|
||||
final Reference targetReference;
|
||||
|
||||
RedirectingFactoryTearOffConstant(Procedure target)
|
||||
new(Procedure target)
|
||||
: assert(target.isRedirectingFactory),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
RedirectingFactoryTearOffConstant.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
@override
|
||||
Procedure get target => targetReference.asProcedure;
|
||||
@@ -1006,7 +1006,7 @@ class TypedefTearOffConstant extends Constant {
|
||||
@override
|
||||
late final int hashCode = _computeHashCode();
|
||||
|
||||
TypedefTearOffConstant(this.parameters, this.tearOffConstant, this.types);
|
||||
new(this.parameters, this.tearOffConstant, this.types);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -1107,7 +1107,7 @@ class TypedefTearOffConstant extends Constant {
|
||||
class TypeLiteralConstant extends Constant {
|
||||
final DartType type;
|
||||
|
||||
TypeLiteralConstant(this.type);
|
||||
new(this.type);
|
||||
|
||||
@override
|
||||
void visitChildren(Visitor v) {
|
||||
@@ -1153,7 +1153,7 @@ class TypeLiteralConstant extends Constant {
|
||||
class UnevaluatedConstant extends Constant {
|
||||
final Expression expression;
|
||||
|
||||
UnevaluatedConstant(this.expression) {
|
||||
new(this.expression) {
|
||||
expression.parent = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ class Class extends NamedNode implements TypeDeclaration {
|
||||
_proceduresView = null;
|
||||
}
|
||||
|
||||
Class({
|
||||
new({
|
||||
required this.name,
|
||||
bool isAbstract = false,
|
||||
bool isAnonymousMixin = false,
|
||||
@@ -659,7 +659,7 @@ class Extension extends NamedNode
|
||||
node.parent = this;
|
||||
}
|
||||
|
||||
Extension({
|
||||
new({
|
||||
required this.name,
|
||||
List<TypeParameter>? typeParameters,
|
||||
DartType? onType,
|
||||
@@ -789,7 +789,7 @@ class ExtensionMemberDescriptor {
|
||||
/// off, if any.
|
||||
final Reference? tearOffReference;
|
||||
|
||||
ExtensionMemberDescriptor({
|
||||
new({
|
||||
required this.name,
|
||||
required this.kind,
|
||||
bool isStatic = false,
|
||||
@@ -900,7 +900,7 @@ class ExtensionTypeDeclaration extends NamedNode implements TypeDeclaration {
|
||||
node.parent = this;
|
||||
}
|
||||
|
||||
ExtensionTypeDeclaration({
|
||||
new({
|
||||
required this.name,
|
||||
List<TypeParameter>? typeParameters,
|
||||
DartType? declaredRepresentationType,
|
||||
@@ -1104,7 +1104,7 @@ class ExtensionTypeMemberDescriptor {
|
||||
/// declaration member tear off, if any.
|
||||
final Reference? tearOffReference;
|
||||
|
||||
ExtensionTypeMemberDescriptor({
|
||||
new({
|
||||
required this.name,
|
||||
required this.kind,
|
||||
bool isStatic = false,
|
||||
|
||||
@@ -143,7 +143,7 @@ class InvalidExpression extends Expression {
|
||||
/// The expression containing the error.
|
||||
Expression? expression;
|
||||
|
||||
InvalidExpression(this.message, [this.expression]) {
|
||||
new(this.message, [this.expression]) {
|
||||
expression?.parent = this;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ class VariableGet extends Expression {
|
||||
/// Null if not promoted.
|
||||
DartType? promotedType;
|
||||
|
||||
VariableGet(this.variable, [this.promotedType]);
|
||||
new(this.variable, [this.promotedType]);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -274,7 +274,7 @@ class VariableSet extends Expression {
|
||||
|
||||
Expression value;
|
||||
|
||||
VariableSet(this.variable, this.value) {
|
||||
new(this.variable, this.value) {
|
||||
value.parent = this;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ class RecordIndexGet extends Expression {
|
||||
RecordType receiverType;
|
||||
final int index;
|
||||
|
||||
RecordIndexGet(this.receiver, this.receiverType, this.index)
|
||||
new(this.receiver, this.receiverType, this.index)
|
||||
: assert(0 <= index && index < receiverType.positional.length) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ class RecordNameGet extends Expression {
|
||||
RecordType receiverType;
|
||||
final String name;
|
||||
|
||||
RecordNameGet(this.receiver, this.receiverType, this.name)
|
||||
new(this.receiver, this.receiverType, this.name)
|
||||
: assert(
|
||||
receiverType.named
|
||||
.singleWhere((element) => element.name == name)
|
||||
@@ -488,7 +488,7 @@ class DynamicGet extends Expression {
|
||||
Expression receiver;
|
||||
Name name;
|
||||
|
||||
DynamicGet(this.kind, this.receiver, this.name) {
|
||||
new(this.kind, this.receiver, this.name) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ class InstanceGet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
InstanceGet(
|
||||
new(
|
||||
InstanceAccessKind kind,
|
||||
Expression receiver,
|
||||
Name name, {
|
||||
@@ -588,7 +588,7 @@ class InstanceGet extends Expression {
|
||||
resultType: resultType,
|
||||
);
|
||||
|
||||
InstanceGet.byReference(
|
||||
new byReference(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.name, {
|
||||
@@ -657,7 +657,7 @@ class InstanceGet extends Expression {
|
||||
class FunctionTearOff extends Expression {
|
||||
Expression receiver;
|
||||
|
||||
FunctionTearOff(this.receiver) {
|
||||
new(this.receiver) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
|
||||
@@ -730,7 +730,7 @@ class InstanceTearOff extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
InstanceTearOff(
|
||||
new(
|
||||
InstanceAccessKind kind,
|
||||
Expression receiver,
|
||||
Name name, {
|
||||
@@ -746,7 +746,7 @@ class InstanceTearOff extends Expression {
|
||||
resultType: resultType,
|
||||
);
|
||||
|
||||
InstanceTearOff.byReference(
|
||||
new byReference(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.name, {
|
||||
@@ -816,7 +816,7 @@ class DynamicSet extends Expression {
|
||||
Name name;
|
||||
Expression value;
|
||||
|
||||
DynamicSet(this.kind, this.receiver, this.name, this.value) {
|
||||
new(this.kind, this.receiver, this.name, this.value) {
|
||||
receiver.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
@@ -885,7 +885,7 @@ class InstanceSet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
InstanceSet(
|
||||
new(
|
||||
InstanceAccessKind kind,
|
||||
Expression receiver,
|
||||
Name name,
|
||||
@@ -901,7 +901,7 @@ class InstanceSet extends Expression {
|
||||
),
|
||||
);
|
||||
|
||||
InstanceSet.byReference(
|
||||
new byReference(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.name,
|
||||
@@ -1004,21 +1004,14 @@ class AbstractSuperPropertyGet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
AbstractSuperPropertyGet(
|
||||
Expression receiver,
|
||||
Name name,
|
||||
Member interfaceTarget,
|
||||
) : this.byReference(
|
||||
new(Expression receiver, Name name, Member interfaceTarget)
|
||||
: this.byReference(
|
||||
receiver,
|
||||
name,
|
||||
getNonNullableMemberReferenceGetter(interfaceTarget),
|
||||
);
|
||||
|
||||
AbstractSuperPropertyGet.byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.interfaceTargetReference,
|
||||
) {
|
||||
new byReference(this.receiver, this.name, this.interfaceTargetReference) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
|
||||
@@ -1090,18 +1083,14 @@ class SuperPropertyGet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
SuperPropertyGet(Expression receiver, Name name, Member interfaceTarget)
|
||||
new(Expression receiver, Name name, Member interfaceTarget)
|
||||
: this.byReference(
|
||||
receiver,
|
||||
name,
|
||||
getNonNullableMemberReferenceGetter(interfaceTarget),
|
||||
);
|
||||
|
||||
SuperPropertyGet.byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.interfaceTargetReference,
|
||||
) {
|
||||
new byReference(this.receiver, this.name, this.interfaceTargetReference) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
|
||||
@@ -1196,19 +1185,15 @@ class AbstractSuperPropertySet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
AbstractSuperPropertySet(
|
||||
Expression receiver,
|
||||
Name name,
|
||||
Expression value,
|
||||
Member interfaceTarget,
|
||||
) : this.byReference(
|
||||
new(Expression receiver, Name name, Expression value, Member interfaceTarget)
|
||||
: this.byReference(
|
||||
receiver,
|
||||
name,
|
||||
value,
|
||||
getNonNullableMemberReferenceSetter(interfaceTarget),
|
||||
);
|
||||
|
||||
AbstractSuperPropertySet.byReference(
|
||||
new byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.value,
|
||||
@@ -1285,19 +1270,15 @@ class SuperPropertySet extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
SuperPropertySet(
|
||||
Expression receiver,
|
||||
Name name,
|
||||
Expression value,
|
||||
Member interfaceTarget,
|
||||
) : this.byReference(
|
||||
new(Expression receiver, Name name, Expression value, Member interfaceTarget)
|
||||
: this.byReference(
|
||||
receiver,
|
||||
name,
|
||||
value,
|
||||
getNonNullableMemberReferenceSetter(interfaceTarget),
|
||||
);
|
||||
|
||||
SuperPropertySet.byReference(
|
||||
new byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.value,
|
||||
@@ -1367,11 +1348,11 @@ class StaticGet extends Expression {
|
||||
/// A static field, getter, or method (for tear-off).
|
||||
Reference targetReference;
|
||||
|
||||
StaticGet(Member target)
|
||||
new(Member target)
|
||||
: assert(target is Field || (target is Procedure && target.isGetter)),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
StaticGet.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
Member get target => targetReference.asMember;
|
||||
|
||||
@@ -1416,7 +1397,7 @@ class StaticGet extends Expression {
|
||||
class StaticTearOff extends Expression {
|
||||
Reference targetReference;
|
||||
|
||||
StaticTearOff(Procedure target)
|
||||
new(Procedure target)
|
||||
: assert(target.isStatic, "Unexpected static tear off target: $target"),
|
||||
assert(
|
||||
target.kind == ProcedureKind.Method,
|
||||
@@ -1424,7 +1405,7 @@ class StaticTearOff extends Expression {
|
||||
),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
StaticTearOff.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
Procedure get target => targetReference.asProcedure;
|
||||
|
||||
@@ -1473,10 +1454,10 @@ class StaticSet extends Expression {
|
||||
Reference targetReference;
|
||||
Expression value;
|
||||
|
||||
StaticSet(Member target, Expression value)
|
||||
new(Member target, Expression value)
|
||||
: this.byReference(getNonNullableMemberReferenceSetter(target), value);
|
||||
|
||||
StaticSet.byReference(this.targetReference, this.value) {
|
||||
new byReference(this.targetReference, this.value) {
|
||||
value.parent = this;
|
||||
}
|
||||
|
||||
@@ -1535,22 +1516,19 @@ class Arguments extends TreeNode {
|
||||
final List<Expression> positional;
|
||||
List<NamedExpression> named;
|
||||
|
||||
Arguments(
|
||||
this.positional, {
|
||||
List<DartType>? types,
|
||||
List<NamedExpression>? named,
|
||||
}) : this.types = types ?? <DartType>[],
|
||||
this.named = named ?? <NamedExpression>[] {
|
||||
new(this.positional, {List<DartType>? types, List<NamedExpression>? named})
|
||||
: this.types = types ?? <DartType>[],
|
||||
this.named = named ?? <NamedExpression>[] {
|
||||
setParents(this.positional, this);
|
||||
setParents(this.named, this);
|
||||
}
|
||||
|
||||
Arguments.empty()
|
||||
new empty()
|
||||
: types = <DartType>[],
|
||||
positional = <Expression>[],
|
||||
named = <NamedExpression>[];
|
||||
|
||||
factory Arguments.forwarded(FunctionNode function) {
|
||||
factory forwarded(FunctionNode function) {
|
||||
return new Arguments(
|
||||
function.positionalParameters
|
||||
.map<Expression>((p) => new VariableGet(p))
|
||||
@@ -1635,7 +1613,7 @@ class NamedExpression extends TreeNode {
|
||||
String name;
|
||||
Expression value;
|
||||
|
||||
NamedExpression(this.name, this.value) {
|
||||
new(this.name, this.value) {
|
||||
value.parent = this;
|
||||
}
|
||||
|
||||
@@ -1713,7 +1691,7 @@ class DynamicInvocation extends InstanceInvocationExpression {
|
||||
|
||||
int flags = 0;
|
||||
|
||||
DynamicInvocation(this.kind, this.receiver, this.name, this.arguments) {
|
||||
new(this.kind, this.receiver, this.name, this.arguments) {
|
||||
receiver.parent = this;
|
||||
arguments.parent = this;
|
||||
}
|
||||
@@ -1884,7 +1862,7 @@ class InstanceInvocation extends InstanceInvocationExpression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
InstanceInvocation(
|
||||
new(
|
||||
InstanceAccessKind kind,
|
||||
Expression receiver,
|
||||
Name name,
|
||||
@@ -1902,7 +1880,7 @@ class InstanceInvocation extends InstanceInvocationExpression {
|
||||
functionType: functionType,
|
||||
);
|
||||
|
||||
InstanceInvocation.byReference(
|
||||
new byReference(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.name,
|
||||
@@ -2055,7 +2033,7 @@ class InstanceGetterInvocation extends InstanceInvocationExpression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
InstanceGetterInvocation(
|
||||
new(
|
||||
InstanceAccessKind kind,
|
||||
Expression receiver,
|
||||
Name name,
|
||||
@@ -2073,7 +2051,7 @@ class InstanceGetterInvocation extends InstanceInvocationExpression {
|
||||
functionType: functionType,
|
||||
);
|
||||
|
||||
InstanceGetterInvocation.byReference(
|
||||
new byReference(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.name,
|
||||
@@ -2260,12 +2238,7 @@ class FunctionInvocation extends InstanceInvocationExpression {
|
||||
///
|
||||
FunctionType? functionType;
|
||||
|
||||
FunctionInvocation(
|
||||
this.kind,
|
||||
this.receiver,
|
||||
this.arguments, {
|
||||
required this.functionType,
|
||||
}) {
|
||||
new(this.kind, this.receiver, this.arguments, {required this.functionType}) {
|
||||
receiver.parent = this;
|
||||
arguments.parent = this;
|
||||
}
|
||||
@@ -2354,11 +2327,7 @@ class LocalFunctionInvocation extends InvocationExpression {
|
||||
///
|
||||
FunctionType functionType;
|
||||
|
||||
LocalFunctionInvocation(
|
||||
this.variable,
|
||||
this.arguments, {
|
||||
required this.functionType,
|
||||
}) {
|
||||
new(this.variable, this.arguments, {required this.functionType}) {
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
||||
@@ -2420,7 +2389,7 @@ class EqualsNull extends Expression {
|
||||
/// The expression tested for nullness.
|
||||
Expression expression;
|
||||
|
||||
EqualsNull(this.expression) {
|
||||
new(this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -2489,7 +2458,7 @@ class EqualsCall extends Expression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
EqualsCall(
|
||||
new(
|
||||
Expression left,
|
||||
Expression right, {
|
||||
required FunctionType functionType,
|
||||
@@ -2503,7 +2472,7 @@ class EqualsCall extends Expression {
|
||||
),
|
||||
);
|
||||
|
||||
EqualsCall.byReference(
|
||||
new byReference(
|
||||
this.left,
|
||||
this.right, {
|
||||
required this.functionType,
|
||||
@@ -2608,7 +2577,7 @@ class AbstractSuperMethodInvocation extends InvocationExpression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
AbstractSuperMethodInvocation(
|
||||
new(
|
||||
Expression receiver,
|
||||
Name name,
|
||||
Arguments arguments,
|
||||
@@ -2621,7 +2590,7 @@ class AbstractSuperMethodInvocation extends InvocationExpression {
|
||||
getNonNullableMemberReferenceGetter(interfaceTarget),
|
||||
);
|
||||
|
||||
AbstractSuperMethodInvocation.byReference(
|
||||
new byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.arguments,
|
||||
@@ -2712,7 +2681,7 @@ class SuperMethodInvocation extends InvocationExpression {
|
||||
|
||||
Reference interfaceTargetReference;
|
||||
|
||||
SuperMethodInvocation(
|
||||
new(
|
||||
Expression receiver,
|
||||
Name name,
|
||||
Arguments arguments,
|
||||
@@ -2725,7 +2694,7 @@ class SuperMethodInvocation extends InvocationExpression {
|
||||
getNonNullableMemberReferenceGetter(interfaceTarget),
|
||||
);
|
||||
|
||||
SuperMethodInvocation.byReference(
|
||||
new byReference(
|
||||
this.receiver,
|
||||
this.name,
|
||||
this.arguments,
|
||||
@@ -2817,18 +2786,15 @@ class StaticInvocation extends InvocationExpression {
|
||||
@override
|
||||
Name get name => target.name;
|
||||
|
||||
StaticInvocation(
|
||||
Procedure target,
|
||||
Arguments arguments, {
|
||||
bool isConst = false,
|
||||
}) : this.byReference(
|
||||
// An invocation doesn't refer to the setter.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
isConst: isConst,
|
||||
);
|
||||
new(Procedure target, Arguments arguments, {bool isConst = false})
|
||||
: this.byReference(
|
||||
// An invocation doesn't refer to the setter.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
isConst: isConst,
|
||||
);
|
||||
|
||||
StaticInvocation.byReference(
|
||||
new byReference(
|
||||
this.targetReference,
|
||||
this.arguments, {
|
||||
this.isConst = false,
|
||||
@@ -2906,18 +2872,15 @@ class ConstructorInvocation extends InvocationExpression {
|
||||
@override
|
||||
Name get name => target.name;
|
||||
|
||||
ConstructorInvocation(
|
||||
Constructor target,
|
||||
Arguments arguments, {
|
||||
bool isConst = false,
|
||||
}) : this.byReference(
|
||||
// A constructor doesn't refer to the setter.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
isConst: isConst,
|
||||
);
|
||||
new(Constructor target, Arguments arguments, {bool isConst = false})
|
||||
: this.byReference(
|
||||
// A constructor doesn't refer to the setter.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
isConst: isConst,
|
||||
);
|
||||
|
||||
ConstructorInvocation.byReference(
|
||||
new byReference(
|
||||
this.targetReference,
|
||||
this.arguments, {
|
||||
this.isConst = false,
|
||||
@@ -3025,10 +2988,7 @@ class RedirectingFactoryInvocation extends Expression {
|
||||
/// The invocation of the effective target.
|
||||
InvocationExpression expression;
|
||||
|
||||
factory RedirectingFactoryInvocation(
|
||||
Procedure redirectingFactoryTarget,
|
||||
InvocationExpression expression,
|
||||
) {
|
||||
factory(Procedure redirectingFactoryTarget, InvocationExpression expression) {
|
||||
assert(redirectingFactoryTarget.isRedirectingFactory);
|
||||
return new RedirectingFactoryInvocation.byReference(
|
||||
redirectingFactoryTarget.reference,
|
||||
@@ -3036,10 +2996,7 @@ class RedirectingFactoryInvocation extends Expression {
|
||||
);
|
||||
}
|
||||
|
||||
RedirectingFactoryInvocation.byReference(
|
||||
this.redirectingFactoryTargetReference,
|
||||
this.expression,
|
||||
) {
|
||||
new byReference(this.redirectingFactoryTargetReference, this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -3101,7 +3058,7 @@ class Instantiation extends Expression {
|
||||
Expression expression;
|
||||
final List<DartType> typeArguments;
|
||||
|
||||
Instantiation(this.expression, this.typeArguments) {
|
||||
new(this.expression, this.typeArguments) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -3166,7 +3123,7 @@ class Instantiation extends Expression {
|
||||
class Not extends Expression {
|
||||
Expression operand;
|
||||
|
||||
Not(this.operand) {
|
||||
new(this.operand) {
|
||||
operand.parent = this;
|
||||
}
|
||||
|
||||
@@ -3233,7 +3190,7 @@ class LogicalExpression extends Expression {
|
||||
LogicalExpressionOperator operatorEnum; // AND (&&) or OR (||).
|
||||
Expression right;
|
||||
|
||||
LogicalExpression(this.left, this.operatorEnum, this.right) {
|
||||
new(this.left, this.operatorEnum, this.right) {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
@@ -3298,12 +3255,7 @@ class ConditionalExpression extends Expression {
|
||||
/// The static type of the expression.
|
||||
DartType staticType;
|
||||
|
||||
ConditionalExpression(
|
||||
this.condition,
|
||||
this.then,
|
||||
this.otherwise,
|
||||
this.staticType,
|
||||
) {
|
||||
new(this.condition, this.then, this.otherwise, this.staticType) {
|
||||
condition.parent = this;
|
||||
then.parent = this;
|
||||
otherwise.parent = this;
|
||||
@@ -3385,7 +3337,7 @@ class ConditionalExpression extends Expression {
|
||||
class StringConcatenation extends Expression {
|
||||
final List<Expression> expressions;
|
||||
|
||||
StringConcatenation(this.expressions) {
|
||||
new(this.expressions) {
|
||||
setParents(expressions, this);
|
||||
}
|
||||
|
||||
@@ -3451,7 +3403,7 @@ class ListConcatenation extends Expression {
|
||||
DartType typeArgument;
|
||||
final List<Expression> lists;
|
||||
|
||||
ListConcatenation(this.lists, {this.typeArgument = const DynamicType()}) {
|
||||
new(this.lists, {this.typeArgument = const DynamicType()}) {
|
||||
setParents(lists, this);
|
||||
}
|
||||
|
||||
@@ -3521,7 +3473,7 @@ class SetConcatenation extends Expression {
|
||||
DartType typeArgument;
|
||||
final List<Expression> sets;
|
||||
|
||||
SetConcatenation(this.sets, {this.typeArgument = const DynamicType()}) {
|
||||
new(this.sets, {this.typeArgument = const DynamicType()}) {
|
||||
setParents(sets, this);
|
||||
}
|
||||
|
||||
@@ -3592,7 +3544,7 @@ class MapConcatenation extends Expression {
|
||||
DartType valueType;
|
||||
final List<Expression> maps;
|
||||
|
||||
MapConcatenation(
|
||||
new(
|
||||
this.maps, {
|
||||
this.keyType = const DynamicType(),
|
||||
this.valueType = const DynamicType(),
|
||||
@@ -3672,7 +3624,7 @@ class InstanceCreation extends Expression {
|
||||
final List<AssertStatement> asserts;
|
||||
final List<Expression> unusedArguments;
|
||||
|
||||
InstanceCreation(
|
||||
new(
|
||||
this.classReference,
|
||||
this.typeArguments,
|
||||
this.fieldValues,
|
||||
@@ -3805,7 +3757,7 @@ class FileUriExpression extends Expression implements FileUriNode {
|
||||
|
||||
Expression expression;
|
||||
|
||||
FileUriExpression(this.expression, this.fileUri) {
|
||||
new(this.expression, this.fileUri) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -3870,7 +3822,7 @@ class IsExpression extends Expression {
|
||||
Expression operand;
|
||||
DartType type;
|
||||
|
||||
IsExpression(this.operand, this.type) {
|
||||
new(this.operand, this.type) {
|
||||
operand.parent = this;
|
||||
}
|
||||
|
||||
@@ -3931,7 +3883,7 @@ class AsExpression extends Expression {
|
||||
Expression operand;
|
||||
DartType type;
|
||||
|
||||
AsExpression(this.operand, this.type) {
|
||||
new(this.operand, this.type) {
|
||||
operand.parent = this;
|
||||
}
|
||||
|
||||
@@ -4072,7 +4024,7 @@ class AsExpression extends Expression {
|
||||
class NullCheck extends Expression {
|
||||
Expression operand;
|
||||
|
||||
NullCheck(this.operand) {
|
||||
new(this.operand) {
|
||||
operand.parent = this;
|
||||
}
|
||||
|
||||
@@ -4141,7 +4093,7 @@ class StringLiteral extends BasicLiteral {
|
||||
@override
|
||||
String value;
|
||||
|
||||
StringLiteral(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4179,7 +4131,7 @@ class IntLiteral extends BasicLiteral {
|
||||
@override
|
||||
int value;
|
||||
|
||||
IntLiteral(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4211,7 +4163,7 @@ class DoubleLiteral extends BasicLiteral {
|
||||
@override
|
||||
double value;
|
||||
|
||||
DoubleLiteral(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4243,7 +4195,7 @@ class BoolLiteral extends BasicLiteral {
|
||||
@override
|
||||
bool value;
|
||||
|
||||
BoolLiteral(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4303,7 +4255,7 @@ class NullLiteral extends BasicLiteral {
|
||||
class SymbolLiteral extends Expression {
|
||||
String value; // Everything strictly after the '#'.
|
||||
|
||||
SymbolLiteral(this.value);
|
||||
new(this.value);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4344,7 +4296,7 @@ class SymbolLiteral extends Expression {
|
||||
class TypeLiteral extends Expression {
|
||||
DartType type;
|
||||
|
||||
TypeLiteral(this.type);
|
||||
new(this.type);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -4463,7 +4415,7 @@ class Throw extends Expression {
|
||||
Expression expression;
|
||||
int flags = 0;
|
||||
|
||||
Throw(this.expression) {
|
||||
new(this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -4531,7 +4483,7 @@ class ListLiteral extends Expression {
|
||||
DartType typeArgument; // Not null, defaults to DynamicType.
|
||||
final List<Expression> expressions;
|
||||
|
||||
ListLiteral(
|
||||
new(
|
||||
this.expressions, {
|
||||
this.typeArgument = const DynamicType(),
|
||||
this.isConst = false,
|
||||
@@ -4596,7 +4548,7 @@ class SetLiteral extends Expression {
|
||||
DartType typeArgument; // Not null, defaults to DynamicType.
|
||||
final List<Expression> expressions;
|
||||
|
||||
SetLiteral(
|
||||
new(
|
||||
this.expressions, {
|
||||
this.typeArgument = const DynamicType(),
|
||||
this.isConst = false,
|
||||
@@ -4662,7 +4614,7 @@ class MapLiteral extends Expression {
|
||||
DartType valueType; // Not null, defaults to DynamicType.
|
||||
final List<MapLiteralEntry> entries;
|
||||
|
||||
MapLiteral(
|
||||
new(
|
||||
this.entries, {
|
||||
this.keyType = const DynamicType(),
|
||||
this.valueType = const DynamicType(),
|
||||
@@ -4741,7 +4693,7 @@ class MapLiteralEntry extends TreeNode {
|
||||
Expression key;
|
||||
Expression value;
|
||||
|
||||
MapLiteralEntry(this.key, this.value) {
|
||||
new(this.key, this.value) {
|
||||
key.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
@@ -4801,32 +4753,28 @@ class RecordLiteral extends Expression {
|
||||
final List<NamedExpression> named;
|
||||
RecordType recordType;
|
||||
|
||||
RecordLiteral(
|
||||
this.positional,
|
||||
this.named,
|
||||
this.recordType, {
|
||||
this.isConst = false,
|
||||
}) : assert(
|
||||
positional.length == recordType.positional.length &&
|
||||
named.length == recordType.named.length &&
|
||||
recordType.named
|
||||
.map((f) => f.name)
|
||||
.toSet()
|
||||
.containsAll(named.map((f) => f.name)),
|
||||
),
|
||||
assert(
|
||||
() {
|
||||
// Assert that the named fields are sorted.
|
||||
for (int i = 1; i < named.length; i++) {
|
||||
if (named[i].name.compareTo(named[i - 1].name) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}(),
|
||||
"Named fields of a RecordLiterals aren't sorted lexicographically: "
|
||||
"${named.map((f) => f.name).join(", ")}",
|
||||
) {
|
||||
new(this.positional, this.named, this.recordType, {this.isConst = false})
|
||||
: assert(
|
||||
positional.length == recordType.positional.length &&
|
||||
named.length == recordType.named.length &&
|
||||
recordType.named
|
||||
.map((f) => f.name)
|
||||
.toSet()
|
||||
.containsAll(named.map((f) => f.name)),
|
||||
),
|
||||
assert(
|
||||
() {
|
||||
// Assert that the named fields are sorted.
|
||||
for (int i = 1; i < named.length; i++) {
|
||||
if (named[i].name.compareTo(named[i - 1].name) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}(),
|
||||
"Named fields of a RecordLiterals aren't sorted lexicographically: "
|
||||
"${named.map((f) => f.name).join(", ")}",
|
||||
) {
|
||||
setParents(positional, this);
|
||||
setParents(named, this);
|
||||
}
|
||||
@@ -4933,7 +4881,7 @@ class AwaitExpression extends Expression {
|
||||
/// of which the check is needed.
|
||||
DartType? runtimeCheckType;
|
||||
|
||||
AwaitExpression(this.operand) {
|
||||
new(this.operand) {
|
||||
operand.parent = this;
|
||||
}
|
||||
|
||||
@@ -5007,9 +4955,8 @@ extension type const LocalFunctionId(int _value) {
|
||||
class LocalFunctionIdGenerator {
|
||||
LocalFunctionId _counter;
|
||||
|
||||
LocalFunctionIdGenerator() : _counter = LocalFunctionId.first;
|
||||
LocalFunctionIdGenerator.after(LocalFunctionId lastUsedId)
|
||||
: _counter = lastUsedId + 1;
|
||||
new() : _counter = LocalFunctionId.first;
|
||||
new after(LocalFunctionId lastUsedId) : _counter = lastUsedId + 1;
|
||||
|
||||
/// Generate a new id for a local function within a [Member].
|
||||
LocalFunctionId allocateId() => _counter++;
|
||||
@@ -5030,7 +4977,7 @@ class FunctionExpression extends Expression implements LocalFunction {
|
||||
@override
|
||||
LocalFunctionId id = LocalFunctionId.invalid;
|
||||
|
||||
FunctionExpression(this.function) {
|
||||
new(this.function) {
|
||||
function.parent = this;
|
||||
}
|
||||
|
||||
@@ -5081,7 +5028,7 @@ class ConstantExpression extends Expression {
|
||||
Constant constant;
|
||||
DartType type;
|
||||
|
||||
ConstantExpression(this.constant, [this.type = const DynamicType()]);
|
||||
new(this.constant, [this.type = const DynamicType()]);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -5131,7 +5078,7 @@ class FileUriConstantExpression extends ConstantExpression
|
||||
@override
|
||||
Uri fileUri;
|
||||
|
||||
FileUriConstantExpression(
|
||||
new(
|
||||
Constant constant, {
|
||||
DartType type = const DynamicType(),
|
||||
required this.fileUri,
|
||||
@@ -5153,7 +5100,7 @@ class Let extends Expression {
|
||||
Variable variable; // Must have an initializer.
|
||||
Expression body;
|
||||
|
||||
Let(this.variable, this.body) {
|
||||
new(this.variable, this.body) {
|
||||
variable.parent = this;
|
||||
body.parent = this;
|
||||
}
|
||||
@@ -5215,7 +5162,7 @@ class BlockExpression extends Expression implements ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
BlockExpression(this.body, this.value) {
|
||||
new(this.body, this.value) {
|
||||
body.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
@@ -5287,7 +5234,7 @@ class LoadLibrary extends Expression {
|
||||
/// Reference to a deferred import in the enclosing library.
|
||||
LibraryDependency import;
|
||||
|
||||
LoadLibrary(this.import);
|
||||
new(this.import);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -5334,7 +5281,7 @@ class CheckLibraryIsLoaded extends Expression {
|
||||
/// Reference to a deferred import in the enclosing library.
|
||||
LibraryDependency import;
|
||||
|
||||
CheckLibraryIsLoaded(this.import);
|
||||
new(this.import);
|
||||
|
||||
@override
|
||||
DartType getStaticType(StaticTypeContext context) =>
|
||||
@@ -5378,14 +5325,14 @@ class ConstructorTearOff extends Expression {
|
||||
/// The reference to the constructor being torn off.
|
||||
Reference targetReference;
|
||||
|
||||
ConstructorTearOff(Member target)
|
||||
new(Member target)
|
||||
: assert(
|
||||
target is Constructor || (target is Procedure && target.isFactory),
|
||||
"Unexpected constructor tear off target: $target",
|
||||
),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
ConstructorTearOff.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
Member get target => targetReference.asMember;
|
||||
|
||||
@@ -5438,11 +5385,11 @@ class RedirectingFactoryTearOff extends Expression {
|
||||
/// The reference to the redirecting factory constructor being torn off.
|
||||
Reference targetReference;
|
||||
|
||||
RedirectingFactoryTearOff(Procedure target)
|
||||
new(Procedure target)
|
||||
: assert(target.isRedirectingFactory),
|
||||
this.targetReference = getNonNullableMemberReferenceGetter(target);
|
||||
|
||||
RedirectingFactoryTearOff.byReference(this.targetReference);
|
||||
new byReference(this.targetReference);
|
||||
|
||||
Procedure get target => targetReference.asProcedure;
|
||||
|
||||
@@ -5491,11 +5438,7 @@ class TypedefTearOff extends Expression {
|
||||
Expression expression;
|
||||
final List<DartType> typeArguments;
|
||||
|
||||
TypedefTearOff(
|
||||
this.structuralParameters,
|
||||
this.expression,
|
||||
this.typeArguments,
|
||||
) {
|
||||
new(this.structuralParameters, this.expression, this.typeArguments) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ class FunctionNode extends TreeNode implements ScopeProvider, ContextConsumer {
|
||||
_body = body;
|
||||
}
|
||||
|
||||
FunctionNode(
|
||||
new(
|
||||
this._body, {
|
||||
List<TypeParameter>? typeParameters,
|
||||
List<Variable>? positionalParameters,
|
||||
|
||||
@@ -55,7 +55,7 @@ class DirtifyingList<E> extends ListBase<E> {
|
||||
final Class dirtifyClass;
|
||||
final List<E> wrapped;
|
||||
|
||||
DirtifyingList(this.dirtifyClass, this.wrapped);
|
||||
new(this.dirtifyClass, this.wrapped);
|
||||
|
||||
@override
|
||||
int get length {
|
||||
@@ -102,7 +102,7 @@ class _ChildReplacer extends Transformer {
|
||||
final TreeNode child;
|
||||
final TreeNode replacement;
|
||||
|
||||
_ChildReplacer(this.child, this.replacement);
|
||||
new(this.child, this.replacement);
|
||||
|
||||
@override
|
||||
TreeNode defaultTreeNode(TreeNode node) {
|
||||
|
||||
@@ -53,7 +53,7 @@ class InvalidInitializer extends Initializer {
|
||||
final String message;
|
||||
int flags = 0;
|
||||
|
||||
InvalidInitializer(this.message);
|
||||
new(this.message);
|
||||
|
||||
@override
|
||||
bool get isRedirectingInitializer => flags & FlagRedirectingInitializer != 0;
|
||||
@@ -118,10 +118,10 @@ class FieldInitializer extends Initializer {
|
||||
@override
|
||||
bool isSynthetic = false;
|
||||
|
||||
FieldInitializer(Field field, Expression value)
|
||||
new(Field field, Expression value)
|
||||
: this.byReference(field.fieldReference, value);
|
||||
|
||||
FieldInitializer.byReference(this.fieldReference, this.value) {
|
||||
new byReference(this.fieldReference, this.value) {
|
||||
value.parent = this;
|
||||
}
|
||||
|
||||
@@ -184,14 +184,14 @@ class SuperInitializer extends Initializer {
|
||||
@override
|
||||
bool isSynthetic = false;
|
||||
|
||||
SuperInitializer(Constructor target, Arguments arguments)
|
||||
new(Constructor target, Arguments arguments)
|
||||
: this.byReference(
|
||||
// Getter vs setter doesn't matter for constructors.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
);
|
||||
|
||||
SuperInitializer.byReference(this.targetReference, this.arguments) {
|
||||
new byReference(this.targetReference, this.arguments) {
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
||||
@@ -256,14 +256,14 @@ class RedirectingInitializer extends Initializer {
|
||||
Reference targetReference;
|
||||
Arguments arguments;
|
||||
|
||||
RedirectingInitializer(Constructor target, Arguments arguments)
|
||||
new(Constructor target, Arguments arguments)
|
||||
: this.byReference(
|
||||
// Getter vs setter doesn't matter for constructors.
|
||||
getNonNullableMemberReferenceGetter(target),
|
||||
arguments,
|
||||
);
|
||||
|
||||
RedirectingInitializer.byReference(this.targetReference, this.arguments) {
|
||||
new byReference(this.targetReference, this.arguments) {
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ class RedirectingInitializer extends Initializer {
|
||||
class LocalInitializer extends Initializer {
|
||||
Variable variable;
|
||||
|
||||
LocalInitializer(this.variable) {
|
||||
new(this.variable) {
|
||||
variable.parent = this;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ class LocalInitializer extends Initializer {
|
||||
class AssertInitializer extends Initializer {
|
||||
AssertStatement statement;
|
||||
|
||||
AssertInitializer(this.statement) {
|
||||
new(this.statement) {
|
||||
statement.parent = this;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ class Library extends NamedNode
|
||||
List<Procedure> _procedures;
|
||||
List<Field> _fields;
|
||||
|
||||
Library(
|
||||
new(
|
||||
this.importUri, {
|
||||
this.name,
|
||||
List<Expression>? annotations,
|
||||
@@ -419,7 +419,7 @@ class LibraryDependency extends TreeNode implements Annotatable {
|
||||
|
||||
final List<Combinator> combinators;
|
||||
|
||||
LibraryDependency.deferredImport(
|
||||
new deferredImport(
|
||||
Library importedLibrary,
|
||||
String name, {
|
||||
List<Combinator>? combinators,
|
||||
@@ -432,7 +432,7 @@ class LibraryDependency extends TreeNode implements Annotatable {
|
||||
combinators ?? <Combinator>[],
|
||||
);
|
||||
|
||||
LibraryDependency.import(
|
||||
new import(
|
||||
Library importedLibrary, {
|
||||
String? name,
|
||||
List<Combinator>? combinators,
|
||||
@@ -445,7 +445,7 @@ class LibraryDependency extends TreeNode implements Annotatable {
|
||||
combinators ?? <Combinator>[],
|
||||
);
|
||||
|
||||
LibraryDependency.export(
|
||||
new export(
|
||||
Library importedLibrary, {
|
||||
List<Combinator>? combinators,
|
||||
List<Expression>? annotations,
|
||||
@@ -457,7 +457,7 @@ class LibraryDependency extends TreeNode implements Annotatable {
|
||||
combinators ?? <Combinator>[],
|
||||
);
|
||||
|
||||
LibraryDependency.byReference(
|
||||
new byReference(
|
||||
this.flags,
|
||||
this.annotations,
|
||||
this.importedLibraryReference,
|
||||
@@ -539,7 +539,7 @@ class LibraryPart extends TreeNode implements Annotatable {
|
||||
|
||||
final String partUri;
|
||||
|
||||
LibraryPart(this.annotations, this.partUri) {
|
||||
new(this.annotations, this.partUri) {
|
||||
setParents(annotations, this);
|
||||
}
|
||||
|
||||
@@ -586,9 +586,9 @@ class Combinator extends TreeNode {
|
||||
|
||||
final List<String> names;
|
||||
|
||||
Combinator(this.isShow, this.names);
|
||||
Combinator.show(this.names) : isShow = true;
|
||||
Combinator.hide(this.names) : isShow = false;
|
||||
new(this.isShow, this.names);
|
||||
new show(this.names) : isShow = true;
|
||||
new hide(this.names) : isShow = false;
|
||||
|
||||
bool get isHide => !isShow;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ sealed class Member extends NamedNode implements Annotatable, FileUriNode {
|
||||
// TODO(asgerf): It might be worthwhile to put this on classes as well.
|
||||
int transformerFlags = 0;
|
||||
|
||||
Member(this.name, this.fileUri, Reference? reference) : super(reference);
|
||||
new(this.name, this.fileUri, Reference? reference) : super(reference);
|
||||
|
||||
/// The enclosing [TypeDeclaration] if this member a class member or an
|
||||
/// abstract extension type member.
|
||||
@@ -294,7 +294,7 @@ class Field extends Member implements ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
Field.mutable(
|
||||
new mutable(
|
||||
Name name, {
|
||||
this.type = const DynamicType(),
|
||||
this.initializer,
|
||||
@@ -320,7 +320,7 @@ class Field extends Member implements ScopeProvider {
|
||||
this.transformerFlags = transformerFlags;
|
||||
}
|
||||
|
||||
Field.immutable(
|
||||
new immutable(
|
||||
Name name, {
|
||||
this.type = const DynamicType(),
|
||||
this.initializer,
|
||||
@@ -582,7 +582,7 @@ class Constructor extends Member {
|
||||
|
||||
List<Initializer> initializers;
|
||||
|
||||
Constructor(
|
||||
new(
|
||||
this.function, {
|
||||
required Name name,
|
||||
bool isConst = false,
|
||||
@@ -974,7 +974,7 @@ class Procedure extends Member implements GenericFunction {
|
||||
/// being null.
|
||||
FunctionType? signatureType;
|
||||
|
||||
Procedure(
|
||||
new(
|
||||
Name name,
|
||||
ProcedureKind kind,
|
||||
FunctionNode function, {
|
||||
@@ -1011,7 +1011,7 @@ class Procedure extends Member implements GenericFunction {
|
||||
),
|
||||
);
|
||||
|
||||
Procedure._byReferenceRenamed(
|
||||
new _byReferenceRenamed(
|
||||
Name name,
|
||||
this.kind,
|
||||
this.function, {
|
||||
@@ -1371,15 +1371,15 @@ class RedirectingFactoryTarget {
|
||||
/// otherwise.
|
||||
final String? errorMessage;
|
||||
|
||||
RedirectingFactoryTarget(Member target, List<DartType> typeArguments)
|
||||
new(Member target, List<DartType> typeArguments)
|
||||
: this.byReference(target.reference, typeArguments);
|
||||
|
||||
RedirectingFactoryTarget.byReference(
|
||||
new byReference(
|
||||
Reference this.targetReference,
|
||||
List<DartType> this.typeArguments,
|
||||
) : errorMessage = null;
|
||||
|
||||
RedirectingFactoryTarget.error(String this.errorMessage)
|
||||
new error(String this.errorMessage)
|
||||
: targetReference = null,
|
||||
typeArguments = null;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ part of '../../ast.dart';
|
||||
|
||||
/// Any type of node in the IR.
|
||||
abstract class Node {
|
||||
const Node();
|
||||
const new();
|
||||
|
||||
R accept<R>(Visitor<R> v);
|
||||
R accept1<R, A>(Visitor1<R, A> v, A arg);
|
||||
@@ -133,8 +133,7 @@ abstract class TreeNode extends Node {
|
||||
abstract class NamedNode extends TreeNode {
|
||||
final Reference reference;
|
||||
|
||||
NamedNode(Reference? reference)
|
||||
: this.reference = reference ?? new Reference() {
|
||||
new(Reference? reference) : this.reference = reference ?? new Reference() {
|
||||
this.reference.node = this;
|
||||
}
|
||||
|
||||
@@ -180,7 +179,7 @@ class Version extends Object {
|
||||
final int major;
|
||||
final int minor;
|
||||
|
||||
const Version(this.major, this.minor);
|
||||
const new(this.major, this.minor);
|
||||
|
||||
bool operator <(Version other) {
|
||||
if (major < other.major) return true;
|
||||
|
||||
@@ -27,12 +27,12 @@ abstract class Name extends Node {
|
||||
Library? get library;
|
||||
bool get isPrivate;
|
||||
|
||||
Name._internal(this.hashCode, this.text);
|
||||
new _internal(this.hashCode, this.text);
|
||||
|
||||
factory Name(String text, [Library? library]) =>
|
||||
factory(String text, [Library? library]) =>
|
||||
new Name.byReference(text, library?.reference);
|
||||
|
||||
factory Name.byReference(String text, Reference? libraryName) {
|
||||
factory byReference(String text, Reference? libraryName) {
|
||||
/// Use separate subclasses for the public and private case to save memory
|
||||
/// for public names.
|
||||
if (text.startsWith('_')) {
|
||||
@@ -85,7 +85,7 @@ class _PrivateName extends Name {
|
||||
@override
|
||||
bool get isPrivate => true;
|
||||
|
||||
_PrivateName(String text, Reference libraryReference)
|
||||
new(String text, Reference libraryReference)
|
||||
: this.libraryReference = libraryReference,
|
||||
super._internal(_computeHashCode(text, libraryReference), text);
|
||||
|
||||
@@ -117,7 +117,7 @@ class _PublicName extends Name {
|
||||
@override
|
||||
bool get isPrivate => false;
|
||||
|
||||
_PublicName(String text) : super._internal(text.hashCode, text);
|
||||
new(String text) : super._internal(text.hashCode, text);
|
||||
|
||||
@override
|
||||
String toString() => toStringInternal();
|
||||
|
||||
@@ -50,7 +50,7 @@ class ConstantPattern extends Pattern {
|
||||
/// This is set during constant evaluation.
|
||||
Constant? value;
|
||||
|
||||
ConstantPattern(this.expression) {
|
||||
new(this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ class AndPattern extends Pattern {
|
||||
...right.declaredVariables,
|
||||
];
|
||||
|
||||
AndPattern(this.left, this.right) {
|
||||
new(this.left, this.right) {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
@@ -163,11 +163,8 @@ class OrPattern extends Pattern {
|
||||
@override
|
||||
List<Variable> get declaredVariables => orPatternJointVariables;
|
||||
|
||||
OrPattern(
|
||||
this.left,
|
||||
this.right, {
|
||||
required List<Variable> orPatternJointVariables,
|
||||
}) : orPatternJointVariables = orPatternJointVariables {
|
||||
new(this.left, this.right, {required List<Variable> orPatternJointVariables})
|
||||
: orPatternJointVariables = orPatternJointVariables {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
@@ -215,7 +212,7 @@ class CastPattern extends Pattern {
|
||||
Pattern pattern;
|
||||
DartType type;
|
||||
|
||||
CastPattern(this.pattern, this.type) {
|
||||
new(this.pattern, this.type) {
|
||||
pattern.parent = this;
|
||||
}
|
||||
|
||||
@@ -267,7 +264,7 @@ class CastPattern extends Pattern {
|
||||
class NullAssertPattern extends Pattern {
|
||||
Pattern pattern;
|
||||
|
||||
NullAssertPattern(this.pattern) {
|
||||
new(this.pattern) {
|
||||
pattern.parent = this;
|
||||
}
|
||||
|
||||
@@ -316,7 +313,7 @@ class NullAssertPattern extends Pattern {
|
||||
class NullCheckPattern extends Pattern {
|
||||
Pattern pattern;
|
||||
|
||||
NullCheckPattern(this.pattern) {
|
||||
new(this.pattern) {
|
||||
pattern.parent = this;
|
||||
}
|
||||
|
||||
@@ -482,7 +479,7 @@ class ListPattern extends Pattern {
|
||||
for (Pattern pattern in patterns) ...pattern.declaredVariables,
|
||||
];
|
||||
|
||||
ListPattern(this.typeArgument, this.patterns) {
|
||||
new(this.typeArgument, this.patterns) {
|
||||
setParents(patterns, this);
|
||||
}
|
||||
|
||||
@@ -628,7 +625,7 @@ class ObjectPattern extends Pattern {
|
||||
// TODO(johnniwinther): Remove this field. It is no longer used.
|
||||
DartType? lookupType;
|
||||
|
||||
ObjectPattern(this.requiredType, this.fields) {
|
||||
new(this.requiredType, this.fields) {
|
||||
setParents(fields, this);
|
||||
}
|
||||
|
||||
@@ -744,7 +741,7 @@ class RelationalPattern extends Pattern {
|
||||
/// This is set during constant evaluation.
|
||||
Constant? expressionValue;
|
||||
|
||||
RelationalPattern(this.kind, this.expression) {
|
||||
new(this.kind, this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -820,7 +817,7 @@ class RelationalPattern extends Pattern {
|
||||
class WildcardPattern extends Pattern {
|
||||
DartType? type;
|
||||
|
||||
WildcardPattern(this.type);
|
||||
new(this.type);
|
||||
|
||||
@override
|
||||
List<Variable> get declaredVariables => const [];
|
||||
@@ -916,7 +913,7 @@ class AssignedVariablePattern extends Pattern {
|
||||
/// not.
|
||||
bool hasObservableEffect = true;
|
||||
|
||||
AssignedVariablePattern(this.variable);
|
||||
new(this.variable);
|
||||
|
||||
@override
|
||||
R accept<R>(PatternVisitor<R> visitor) =>
|
||||
@@ -1021,7 +1018,7 @@ class MapPattern extends Pattern {
|
||||
if (entry is! MapPatternRestEntry) ...entry.value.declaredVariables,
|
||||
];
|
||||
|
||||
MapPattern(this.keyType, this.valueType, this.entries)
|
||||
new(this.keyType, this.valueType, this.entries)
|
||||
: assert((keyType == null) == (valueType == null)) {
|
||||
setParents(entries, this);
|
||||
}
|
||||
@@ -1184,7 +1181,7 @@ class NamedPattern extends Pattern {
|
||||
@override
|
||||
List<Variable> get declaredVariables => pattern.declaredVariables;
|
||||
|
||||
NamedPattern(this.name, this.pattern) {
|
||||
new(this.name, this.pattern) {
|
||||
pattern.parent = this;
|
||||
}
|
||||
|
||||
@@ -1272,7 +1269,7 @@ class RecordPattern extends Pattern {
|
||||
for (Pattern pattern in patterns) ...pattern.declaredVariables,
|
||||
];
|
||||
|
||||
RecordPattern(this.patterns) {
|
||||
new(this.patterns) {
|
||||
setParents(patterns, this);
|
||||
}
|
||||
|
||||
@@ -1329,7 +1326,7 @@ class VariablePattern extends Pattern {
|
||||
@override
|
||||
List<Variable> get declaredVariables => [variable];
|
||||
|
||||
VariablePattern(this.type, this.variable) {
|
||||
new(this.type, this.variable) {
|
||||
variable.parent = this;
|
||||
}
|
||||
|
||||
@@ -1390,7 +1387,7 @@ class VariablePattern extends Pattern {
|
||||
class RestPattern extends Pattern {
|
||||
Pattern? subPattern;
|
||||
|
||||
RestPattern(this.subPattern) {
|
||||
new(this.subPattern) {
|
||||
subPattern?.parent = this;
|
||||
}
|
||||
|
||||
@@ -1444,7 +1441,7 @@ class InvalidPattern extends Pattern {
|
||||
@override
|
||||
final List<Variable> declaredVariables;
|
||||
|
||||
InvalidPattern(this.invalidExpression, {required this.declaredVariables}) {
|
||||
new(this.invalidExpression, {required this.declaredVariables}) {
|
||||
invalidExpression.parent = this;
|
||||
setParents(declaredVariables, this);
|
||||
}
|
||||
@@ -1507,7 +1504,7 @@ class MapPatternEntry extends TreeNode {
|
||||
/// This is set during constant evaluation.
|
||||
Constant? keyValue;
|
||||
|
||||
MapPatternEntry(this.key, this.value) {
|
||||
new(this.key, this.value) {
|
||||
key.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
@@ -1561,7 +1558,7 @@ class MapPatternEntry extends TreeNode {
|
||||
}
|
||||
|
||||
class MapPatternRestEntry extends TreeNode implements MapPatternEntry {
|
||||
MapPatternRestEntry();
|
||||
new();
|
||||
|
||||
@override
|
||||
Expression get key => throw new UnsupportedError('MapPatternRestEntry.key');
|
||||
@@ -1685,7 +1682,7 @@ class PatternGuard extends TreeNode {
|
||||
Pattern pattern;
|
||||
Expression? guard;
|
||||
|
||||
PatternGuard(this.pattern, [this.guard]) {
|
||||
new(this.pattern, [this.guard]) {
|
||||
pattern.parent = this;
|
||||
guard?.parent = this;
|
||||
}
|
||||
@@ -1757,7 +1754,7 @@ class PatternSwitchCase extends TreeNode implements SwitchCase {
|
||||
// TODO(johnniwinther): Serialize this field.
|
||||
final List<int>? jointVariableFirstUseOffsets;
|
||||
|
||||
PatternSwitchCase(
|
||||
new(
|
||||
this.caseOffsets,
|
||||
this.patternGuards,
|
||||
this.body, {
|
||||
@@ -1862,7 +1859,7 @@ class PatternSwitchStatement extends Statement implements SwitchStatement {
|
||||
// TODO(johnniwinther): Serialize this.
|
||||
bool lastCaseTerminates = false;
|
||||
|
||||
PatternSwitchStatement(this.expression, this.cases) {
|
||||
new(this.expression, this.cases) {
|
||||
expression.parent = this;
|
||||
setParents(cases, this);
|
||||
}
|
||||
@@ -1948,7 +1945,7 @@ class SwitchExpressionCase extends TreeNode {
|
||||
PatternGuard patternGuard;
|
||||
Expression expression;
|
||||
|
||||
SwitchExpressionCase(this.patternGuard, this.expression) {
|
||||
new(this.patternGuard, this.expression) {
|
||||
patternGuard.parent = this;
|
||||
expression.parent = this;
|
||||
}
|
||||
@@ -2009,7 +2006,7 @@ class SwitchExpression extends Expression {
|
||||
/// This is set during inference.
|
||||
DartType? staticType;
|
||||
|
||||
SwitchExpression(this.expression, this.cases) {
|
||||
new(this.expression, this.cases) {
|
||||
expression.parent = this;
|
||||
setParents(cases, this);
|
||||
}
|
||||
@@ -2080,11 +2077,7 @@ class PatternVariableDeclaration extends Statement {
|
||||
/// This is set during inference.
|
||||
DartType? matchedValueType;
|
||||
|
||||
PatternVariableDeclaration(
|
||||
this.pattern,
|
||||
this.initializer, {
|
||||
required this.isFinal,
|
||||
}) {
|
||||
new(this.pattern, this.initializer, {required this.isFinal}) {
|
||||
pattern.parent = this;
|
||||
initializer.parent = this;
|
||||
}
|
||||
@@ -2145,7 +2138,7 @@ class PatternAssignment extends Expression {
|
||||
/// This is set during inference.
|
||||
DartType? matchedValueType;
|
||||
|
||||
PatternAssignment(this.pattern, this.expression) {
|
||||
new(this.pattern, this.expression) {
|
||||
pattern.parent = this;
|
||||
expression.parent = this;
|
||||
}
|
||||
@@ -2214,12 +2207,7 @@ class IfCaseStatement extends Statement {
|
||||
/// This is set during inference.
|
||||
DartType? matchedValueType;
|
||||
|
||||
IfCaseStatement(
|
||||
this.expression,
|
||||
this.patternGuard,
|
||||
this.then, [
|
||||
this.otherwise,
|
||||
]) {
|
||||
new(this.expression, this.patternGuard, this.then, [this.otherwise]) {
|
||||
expression.parent = this;
|
||||
patternGuard.parent = this;
|
||||
then.parent = this;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ExpressionStatement extends Statement {
|
||||
@override
|
||||
int get fileOffset => expression.fileOffset;
|
||||
|
||||
ExpressionStatement(this.expression) {
|
||||
new(this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class Block extends Statement implements ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
Block(this.statements) {
|
||||
new(this.statements) {
|
||||
// Ensure statements is mutable.
|
||||
assert(checkListIsMutable(statements, dummyStatement));
|
||||
setParents(statements, this);
|
||||
@@ -147,7 +147,7 @@ class Block extends Statement implements ScopeProvider {
|
||||
class AssertBlock extends Statement {
|
||||
final List<Statement> statements;
|
||||
|
||||
AssertBlock(this.statements) {
|
||||
new(this.statements) {
|
||||
// Ensure statements is mutable.
|
||||
assert(checkListIsMutable(statements, dummyStatement));
|
||||
setParents(statements, this);
|
||||
@@ -236,7 +236,7 @@ class AssertStatement extends Statement {
|
||||
conditionEndOffset,
|
||||
];
|
||||
|
||||
AssertStatement(
|
||||
new(
|
||||
this.condition, {
|
||||
this.message,
|
||||
required this.conditionStartOffset,
|
||||
@@ -304,7 +304,7 @@ class AssertStatement extends Statement {
|
||||
class LabeledStatement extends Statement {
|
||||
late Statement body;
|
||||
|
||||
LabeledStatement(Statement? body) {
|
||||
new(Statement? body) {
|
||||
if (body != null) {
|
||||
this.body = body..parent = this;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ class LabeledStatement extends Statement {
|
||||
class BreakStatement extends Statement {
|
||||
LabeledStatement target;
|
||||
|
||||
BreakStatement(this.target);
|
||||
new(this.target);
|
||||
|
||||
@override
|
||||
R accept<R>(StatementVisitor<R> v) => v.visitBreakStatement(this);
|
||||
@@ -434,7 +434,7 @@ class WhileStatement extends Statement implements LoopStatement, ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
WhileStatement(this.condition, this.body) {
|
||||
new(this.condition, this.body) {
|
||||
condition.parent = this;
|
||||
body.parent = this;
|
||||
}
|
||||
@@ -488,7 +488,7 @@ class DoStatement extends Statement implements LoopStatement {
|
||||
|
||||
Expression condition;
|
||||
|
||||
DoStatement(this.body, this.condition) {
|
||||
new(this.body, this.condition) {
|
||||
body.parent = this;
|
||||
condition.parent = this;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ class ForStatement extends Statement implements LoopStatement, ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
ForStatement(this.variables, this.condition, this.updates, this.body) {
|
||||
new(this.variables, this.condition, this.updates, this.body) {
|
||||
setParents(variables, this);
|
||||
condition?.parent = this;
|
||||
setParents(updates, this);
|
||||
@@ -650,12 +650,7 @@ class ForInStatement extends Statement implements LoopStatement, ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
ForInStatement(
|
||||
this.variable,
|
||||
this.iterable,
|
||||
this.body, {
|
||||
this.isAsync = false,
|
||||
}) {
|
||||
new(this.variable, this.iterable, this.body, {this.isAsync = false}) {
|
||||
variable.parent = this;
|
||||
iterable.parent = this;
|
||||
body.parent = this;
|
||||
@@ -823,11 +818,7 @@ class SwitchStatement extends Statement {
|
||||
/// This is set during inference.
|
||||
DartType? expressionTypeInternal;
|
||||
|
||||
SwitchStatement(
|
||||
this.expression,
|
||||
this.cases, {
|
||||
this.isExplicitlyExhaustive = false,
|
||||
}) {
|
||||
new(this.expression, this.cases, {this.isExplicitlyExhaustive = false}) {
|
||||
expression.parent = this;
|
||||
setParents(cases, this);
|
||||
}
|
||||
@@ -924,7 +915,7 @@ class SwitchCase extends TreeNode {
|
||||
late Statement body;
|
||||
bool isDefault;
|
||||
|
||||
SwitchCase(
|
||||
new(
|
||||
this.expressions,
|
||||
this.expressionOffsets,
|
||||
Statement? body, {
|
||||
@@ -936,7 +927,7 @@ class SwitchCase extends TreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
SwitchCase.defaultCase(Statement? body)
|
||||
new defaultCase(Statement? body)
|
||||
: isDefault = true,
|
||||
expressions = <Expression>[],
|
||||
expressionOffsets = <int>[] {
|
||||
@@ -1021,7 +1012,7 @@ class SwitchCase extends TreeNode {
|
||||
class ContinueSwitchStatement extends Statement {
|
||||
SwitchCase target;
|
||||
|
||||
ContinueSwitchStatement(this.target);
|
||||
new(this.target);
|
||||
|
||||
@override
|
||||
R accept<R>(StatementVisitor<R> v) => v.visitContinueSwitchStatement(this);
|
||||
@@ -1057,7 +1048,7 @@ class IfStatement extends Statement {
|
||||
Statement then;
|
||||
Statement? otherwise;
|
||||
|
||||
IfStatement(this.condition, this.then, this.otherwise) {
|
||||
new(this.condition, this.then, this.otherwise) {
|
||||
condition.parent = this;
|
||||
then.parent = this;
|
||||
otherwise?.parent = this;
|
||||
@@ -1122,7 +1113,7 @@ class IfStatement extends Statement {
|
||||
class ReturnStatement extends Statement {
|
||||
Expression? expression; // May be null.
|
||||
|
||||
ReturnStatement([this.expression]) {
|
||||
new([this.expression]) {
|
||||
expression?.parent = this;
|
||||
}
|
||||
|
||||
@@ -1175,7 +1166,7 @@ class TryCatch extends Statement {
|
||||
List<Catch> catches;
|
||||
bool isSynthetic;
|
||||
|
||||
TryCatch(this.body, this.catches, {this.isSynthetic = false}) {
|
||||
new(this.body, this.catches, {this.isSynthetic = false}) {
|
||||
body.parent = this;
|
||||
setParents(catches, this);
|
||||
}
|
||||
@@ -1232,7 +1223,7 @@ class Catch extends TreeNode implements ScopeProvider {
|
||||
@override
|
||||
Scope? scope;
|
||||
|
||||
Catch(
|
||||
new(
|
||||
this.exception,
|
||||
this.body, {
|
||||
this.guard = const DynamicType(),
|
||||
@@ -1349,7 +1340,7 @@ class TryFinally extends Statement {
|
||||
Statement body;
|
||||
Statement finalizer;
|
||||
|
||||
TryFinally(this.body, this.finalizer) {
|
||||
new(this.body, this.finalizer) {
|
||||
body.parent = this;
|
||||
finalizer.parent = this;
|
||||
}
|
||||
@@ -1405,7 +1396,7 @@ class YieldStatement extends Statement {
|
||||
Expression expression;
|
||||
int flags = 0;
|
||||
|
||||
YieldStatement(this.expression, {bool isYieldStar = false}) {
|
||||
new(this.expression, {bool isYieldStar = false}) {
|
||||
expression.parent = this;
|
||||
this.isYieldStar = isYieldStar;
|
||||
}
|
||||
@@ -1464,7 +1455,7 @@ class VariableStatement extends Statement {
|
||||
/// The declared variable.
|
||||
VariableDeclaration declaration;
|
||||
|
||||
VariableStatement(this.declaration) {
|
||||
new(this.declaration) {
|
||||
declaration.parent = this;
|
||||
}
|
||||
|
||||
@@ -1517,7 +1508,7 @@ class FunctionDeclaration extends Statement implements LocalFunction {
|
||||
@override
|
||||
LocalFunctionId id = LocalFunctionId.invalid;
|
||||
|
||||
FunctionDeclaration(this.variable, this.function) {
|
||||
new(this.variable, this.function) {
|
||||
variable.parent = this;
|
||||
function.parent = this;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class Typedef extends NamedNode
|
||||
// TODO(johnniwinther): Make this non-nullable.
|
||||
DartType? type;
|
||||
|
||||
Typedef(
|
||||
new(
|
||||
this.name,
|
||||
this.type, {
|
||||
Reference? reference,
|
||||
|
||||
@@ -60,11 +60,8 @@ abstract interface class TypeParameter implements TreeNode, Annotatable {
|
||||
|
||||
static const int legacyCovariantSerializationMarker = 4;
|
||||
|
||||
factory TypeParameter([
|
||||
String? name,
|
||||
DartType? bound,
|
||||
DartType? defaultType,
|
||||
]) = NominalParameter;
|
||||
factory([String? name, DartType? bound, DartType? defaultType]) =
|
||||
NominalParameter;
|
||||
|
||||
abstract int flags;
|
||||
|
||||
@@ -161,7 +158,7 @@ class NominalParameter extends TreeNode implements TypeParameter {
|
||||
@override
|
||||
bool get isLegacyCovariant => _variance == null;
|
||||
|
||||
NominalParameter([this.name, DartType? bound, DartType? defaultType])
|
||||
new([this.name, DartType? bound, DartType? defaultType])
|
||||
: bound = bound ?? TypeParameter.unsetBoundSentinel,
|
||||
defaultType = defaultType ?? TypeParameter.unsetDefaultTypeSentinel;
|
||||
|
||||
@@ -366,7 +363,7 @@ class StructuralParameter extends Node implements SharedTypeParameter {
|
||||
|
||||
static const int legacyCovariantSerializationMarker = 4;
|
||||
|
||||
StructuralParameter([this.name, DartType? bound, DartType? defaultType])
|
||||
new([this.name, DartType? bound, DartType? defaultType])
|
||||
: bound = bound ?? unsetBoundSentinel,
|
||||
defaultType = defaultType ?? unsetDefaultTypeSentinel;
|
||||
|
||||
@@ -442,10 +439,10 @@ class Supertype extends Node {
|
||||
Reference className;
|
||||
final List<DartType> typeArguments;
|
||||
|
||||
Supertype(Class classNode, List<DartType> typeArguments)
|
||||
new(Class classNode, List<DartType> typeArguments)
|
||||
: this.byReference(classNode.reference, typeArguments);
|
||||
|
||||
Supertype.byReference(this.className, this.typeArguments);
|
||||
new byReference(this.className, this.typeArguments);
|
||||
|
||||
Class get classNode => className.asClass;
|
||||
|
||||
@@ -516,7 +513,7 @@ class Supertype extends Node {
|
||||
/// The `==` operator on [DartType]s compare based on type equality, not
|
||||
/// object identity.
|
||||
sealed class DartType extends Node implements SharedType {
|
||||
const DartType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v);
|
||||
@@ -665,7 +662,7 @@ sealed class TypeDeclarationType extends DartType {
|
||||
}
|
||||
|
||||
abstract class AuxiliaryType extends DartType {
|
||||
const AuxiliaryType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) => v.visitAuxiliaryType(this);
|
||||
@@ -682,7 +679,7 @@ abstract class AuxiliaryType extends DartType {
|
||||
/// an update whenever an experimental type (a subclass of [ExperimentalType])
|
||||
/// is added or removed in the CFE.
|
||||
sealed class ExperimentalType extends DartType {
|
||||
const ExperimentalType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) {
|
||||
@@ -703,7 +700,7 @@ class InvalidType extends DartType implements SharedInvalidType {
|
||||
@override
|
||||
final int hashCode = 12345;
|
||||
|
||||
const InvalidType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) => v.visitInvalidType(this);
|
||||
@@ -756,7 +753,7 @@ class DynamicType extends DartType implements SharedDynamicType {
|
||||
@override
|
||||
final int hashCode = 54321;
|
||||
|
||||
const DynamicType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) => v.visitDynamicType(this);
|
||||
@@ -801,7 +798,7 @@ class VoidType extends DartType implements SharedVoidType {
|
||||
@override
|
||||
final int hashCode = 123121;
|
||||
|
||||
const VoidType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) => v.visitVoidType(this);
|
||||
@@ -846,11 +843,11 @@ class NeverType extends DartType {
|
||||
@override
|
||||
final Nullability declaredNullability;
|
||||
|
||||
const NeverType.nullable() : this.internal(Nullability.nullable);
|
||||
const new nullable() : this.internal(Nullability.nullable);
|
||||
|
||||
const NeverType.nonNullable() : this.internal(Nullability.nonNullable);
|
||||
const new nonNullable() : this.internal(Nullability.nonNullable);
|
||||
|
||||
const NeverType.internal(this.declaredNullability)
|
||||
const new internal(this.declaredNullability)
|
||||
: assert(declaredNullability != Nullability.undetermined);
|
||||
|
||||
static NeverType fromNullability(Nullability nullability) {
|
||||
@@ -922,7 +919,7 @@ class NullType extends DartType implements SharedNullType {
|
||||
@override
|
||||
final int hashCode = 415324;
|
||||
|
||||
const NullType();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R accept<R>(DartTypeVisitor<R> v) => v.visitNullType(this);
|
||||
@@ -975,7 +972,7 @@ class InterfaceType extends TypeDeclarationType {
|
||||
|
||||
/// The [typeArguments] list must not be modified after this call. If the
|
||||
/// list is omitted, 'dynamic' type arguments are filled in.
|
||||
InterfaceType(
|
||||
new(
|
||||
Class classNode,
|
||||
Nullability declaredNullability, [
|
||||
List<DartType>? typeArguments,
|
||||
@@ -985,7 +982,7 @@ class InterfaceType extends TypeDeclarationType {
|
||||
typeArguments ?? _defaultTypeArguments(classNode),
|
||||
);
|
||||
|
||||
InterfaceType.byReference(
|
||||
new byReference(
|
||||
this.classReference,
|
||||
this.declaredNullability,
|
||||
this.typeArguments,
|
||||
@@ -1102,7 +1099,7 @@ class FunctionType extends DartType implements SharedFunctionType {
|
||||
@override
|
||||
late final int hashCode = _computeHashCode();
|
||||
|
||||
FunctionType(
|
||||
new(
|
||||
List<DartType> positionalParameters,
|
||||
this.returnType,
|
||||
this.declaredNullability, {
|
||||
@@ -1338,17 +1335,14 @@ class TypedefType extends DartType {
|
||||
final Reference typedefReference;
|
||||
final List<DartType> typeArguments;
|
||||
|
||||
TypedefType(
|
||||
Typedef typedef,
|
||||
Nullability nullability, [
|
||||
List<DartType>? typeArguments,
|
||||
]) : this.byReference(
|
||||
typedef.reference,
|
||||
nullability,
|
||||
typeArguments ?? const <DartType>[],
|
||||
);
|
||||
new(Typedef typedef, Nullability nullability, [List<DartType>? typeArguments])
|
||||
: this.byReference(
|
||||
typedef.reference,
|
||||
nullability,
|
||||
typeArguments ?? const <DartType>[],
|
||||
);
|
||||
|
||||
TypedefType.byReference(
|
||||
new byReference(
|
||||
this.typedefReference,
|
||||
this.declaredNullability,
|
||||
this.typeArguments,
|
||||
@@ -1459,7 +1453,7 @@ class FutureOrType extends DartType {
|
||||
@override
|
||||
final Nullability declaredNullability;
|
||||
|
||||
FutureOrType(this.typeArgument, this.declaredNullability);
|
||||
new(this.typeArgument, this.declaredNullability);
|
||||
|
||||
@override
|
||||
Nullability get nullability {
|
||||
@@ -1539,7 +1533,7 @@ class ExtensionType extends TypeDeclarationType {
|
||||
@override
|
||||
final List<DartType> typeArguments;
|
||||
|
||||
ExtensionType(
|
||||
new(
|
||||
ExtensionTypeDeclaration extensionTypeDeclaration,
|
||||
Nullability declaredNullability, [
|
||||
List<DartType>? typeArguments,
|
||||
@@ -1549,7 +1543,7 @@ class ExtensionType extends TypeDeclarationType {
|
||||
typeArguments ?? _defaultTypeArguments(extensionTypeDeclaration),
|
||||
);
|
||||
|
||||
ExtensionType.byReference(
|
||||
new byReference(
|
||||
this.extensionTypeDeclarationReference,
|
||||
this.declaredNullability,
|
||||
this.typeArguments,
|
||||
@@ -1739,7 +1733,7 @@ class NamedType extends Node
|
||||
@override
|
||||
final bool isRequired;
|
||||
|
||||
const NamedType(this.name, this.type, {this.isRequired = false});
|
||||
const new(this.name, this.type, {this.isRequired = false});
|
||||
|
||||
@override
|
||||
String get nameShared => name;
|
||||
@@ -1804,7 +1798,7 @@ class IntersectionType extends DartType {
|
||||
final TypeParameterType left;
|
||||
final DartType right;
|
||||
|
||||
IntersectionType(this.left, this.right) {
|
||||
new(this.left, this.right) {
|
||||
// TODO(cstefantsova): Also assert that [rhs] is a subtype of [lhs.bound].
|
||||
|
||||
Nullability leftNullability = left.nullability;
|
||||
@@ -2114,14 +2108,14 @@ class TypeParameterType extends DartType implements TypeParameterTypeInterface {
|
||||
@override
|
||||
final TypeParameter parameter;
|
||||
|
||||
TypeParameterType(this.parameter, this.declaredNullability);
|
||||
new(this.parameter, this.declaredNullability);
|
||||
|
||||
/// Creates a type parameter type with default nullability.
|
||||
///
|
||||
/// The nullability is computed as if the programmer omitted the modifier.
|
||||
/// Either `Nullability.nonNullable` or `Nullability.undetermined` will be
|
||||
/// used, depending on the nullability of the bound of [parameter].
|
||||
TypeParameterType.withDefaultNullability(this.parameter)
|
||||
new withDefaultNullability(this.parameter)
|
||||
: declaredNullability = parameter.computeNullabilityFromBound();
|
||||
|
||||
@override
|
||||
@@ -2204,14 +2198,14 @@ class StructuralParameterType extends DartType {
|
||||
|
||||
final StructuralParameter parameter;
|
||||
|
||||
StructuralParameterType(this.parameter, this.declaredNullability);
|
||||
new(this.parameter, this.declaredNullability);
|
||||
|
||||
/// Creates a structural parameter type with default nullability.
|
||||
///
|
||||
/// The nullability is computed as if the programmer omitted the modifier.
|
||||
/// Either [Nullability.nonNullable] or [Nullability.undetermined] will be
|
||||
/// used, depending on the nullability of the bound of [parameter].
|
||||
StructuralParameterType.withDefaultNullability(this.parameter)
|
||||
new withDefaultNullability(this.parameter)
|
||||
: declaredNullability = parameter.computeNullabilityFromBound();
|
||||
|
||||
@override
|
||||
@@ -2307,7 +2301,7 @@ class RecordType extends DartType implements SharedRecordType {
|
||||
@override
|
||||
final Nullability declaredNullability;
|
||||
|
||||
RecordType(this.positional, this.named, this.declaredNullability)
|
||||
new(this.positional, this.named, this.declaredNullability)
|
||||
: /*TODO(johnniwinther): Enabled this assert:
|
||||
assert(named.length == named.map((p) => p.name).toSet().length,
|
||||
"Named field types must have unique names in a RecordType: "
|
||||
@@ -2455,7 +2449,7 @@ class TypeVariable extends VariableBase {
|
||||
@override
|
||||
late VariableContext context;
|
||||
|
||||
TypeVariable({this.cosmeticName, required this.parameter});
|
||||
new({this.cosmeticName, required this.parameter});
|
||||
|
||||
@override
|
||||
void addAnnotation(Expression annotation) {
|
||||
@@ -2518,10 +2512,7 @@ class FunctionTypeParameterType extends ExperimentalType
|
||||
@override
|
||||
Nullability declaredNullability;
|
||||
|
||||
FunctionTypeParameterType({
|
||||
required this.variable,
|
||||
required this.declaredNullability,
|
||||
});
|
||||
new({required this.variable, required this.declaredNullability});
|
||||
|
||||
@override
|
||||
TypeParameter get parameter => variable.parameter;
|
||||
@@ -2593,7 +2584,7 @@ class ClassTypeParameterType extends ExperimentalType
|
||||
@override
|
||||
Nullability declaredNullability;
|
||||
|
||||
ClassTypeParameterType({
|
||||
new({
|
||||
required this.thisVariable,
|
||||
required this.parameter,
|
||||
required this.declaredNullability,
|
||||
|
||||
@@ -121,7 +121,7 @@ sealed class Variable extends VariableBase
|
||||
@override
|
||||
abstract bool isErroneouslyInitialized;
|
||||
|
||||
factory Variable(
|
||||
factory(
|
||||
String? name, {
|
||||
Expression? initializer,
|
||||
DartType type,
|
||||
@@ -140,7 +140,7 @@ sealed class Variable extends VariableBase
|
||||
bool isWildcard,
|
||||
}) = LegacyVariable;
|
||||
|
||||
factory Variable.forValue(
|
||||
factory forValue(
|
||||
Expression? initializer, {
|
||||
bool isFinal,
|
||||
bool isConst,
|
||||
@@ -152,7 +152,7 @@ sealed class Variable extends VariableBase
|
||||
DartType type,
|
||||
}) = LegacyVariable.forValue;
|
||||
|
||||
Variable.empty();
|
||||
new empty();
|
||||
|
||||
@override
|
||||
bool get hasIsFinal;
|
||||
@@ -249,7 +249,7 @@ class LegacyVariable extends TreeNode implements Variable, Annotatable {
|
||||
@override
|
||||
Expression? initializer; // May be null.
|
||||
|
||||
LegacyVariable(
|
||||
new(
|
||||
this._name, {
|
||||
this.initializer,
|
||||
this.type = const DynamicType(),
|
||||
@@ -291,7 +291,7 @@ class LegacyVariable extends TreeNode implements Variable, Annotatable {
|
||||
}
|
||||
|
||||
/// Creates a synthetic variable with the given expression as initializer.
|
||||
LegacyVariable.forValue(
|
||||
new forValue(
|
||||
this.initializer, {
|
||||
bool isFinal = true,
|
||||
bool isConst = false,
|
||||
@@ -724,7 +724,7 @@ class LocalVariable extends Variable {
|
||||
// TODO(johnniwinther): Remove this.
|
||||
Expression? initializer;
|
||||
|
||||
LocalVariable({
|
||||
new({
|
||||
this.cosmeticName,
|
||||
required DartType? type,
|
||||
bool isFinal = false,
|
||||
@@ -1036,7 +1036,7 @@ class LateVariable extends Variable {
|
||||
// TODO(johnniwinther): Rename to [initialValue].
|
||||
Expression? initializer;
|
||||
|
||||
LateVariable({
|
||||
new({
|
||||
this.cosmeticName,
|
||||
required DartType? type,
|
||||
bool isFinal = false,
|
||||
@@ -1351,7 +1351,7 @@ class CatchVariable extends Variable {
|
||||
@override
|
||||
late VariableContext context;
|
||||
|
||||
CatchVariable({
|
||||
new({
|
||||
required String name,
|
||||
required DartType? type,
|
||||
bool isWildcard = false,
|
||||
@@ -1651,7 +1651,7 @@ class CatchVariable extends Variable {
|
||||
sealed class FunctionParameter extends Variable {
|
||||
Expression? defaultValue;
|
||||
|
||||
FunctionParameter({
|
||||
new({
|
||||
required Expression? defaultValue,
|
||||
required bool isCovariantByDeclaration,
|
||||
required bool isRequired,
|
||||
@@ -1861,7 +1861,7 @@ class PositionalParameter extends FunctionParameter {
|
||||
@override
|
||||
late VariableContext context;
|
||||
|
||||
PositionalParameter({
|
||||
new({
|
||||
this.cosmeticName,
|
||||
required this.type,
|
||||
super.defaultValue,
|
||||
@@ -2014,7 +2014,7 @@ class NamedParameter extends FunctionParameter {
|
||||
@override
|
||||
late VariableContext context;
|
||||
|
||||
NamedParameter({
|
||||
new({
|
||||
required this.parameterName,
|
||||
required this.type,
|
||||
super.defaultValue,
|
||||
@@ -2170,7 +2170,7 @@ class ThisVariable extends Variable {
|
||||
@override
|
||||
late VariableContext context;
|
||||
|
||||
ThisVariable({required this.type}) : super.empty();
|
||||
new({required this.type}) : super.empty();
|
||||
|
||||
// TODO(cstefantsova): Consider a throwing implementation instead.
|
||||
@override
|
||||
@@ -2458,7 +2458,7 @@ class SyntheticVariable extends Variable {
|
||||
// TODO(johnniwinther): Remove this.
|
||||
Expression? initializer;
|
||||
|
||||
SyntheticVariable({
|
||||
new({
|
||||
this.cosmeticName,
|
||||
required this.type,
|
||||
this.initializer,
|
||||
@@ -2740,7 +2740,7 @@ class VariableContext {
|
||||
final CaptureKind captureKind;
|
||||
final List<VariableBase> variables;
|
||||
|
||||
VariableContext({required this.captureKind, required this.variables});
|
||||
new({required this.captureKind, required this.variables});
|
||||
|
||||
void addVariable(VariableBase variable) {
|
||||
variable.context = this;
|
||||
@@ -2774,7 +2774,7 @@ class VariableContext {
|
||||
class Scope {
|
||||
final List<VariableContext> contexts;
|
||||
|
||||
Scope({required this.contexts});
|
||||
new({required this.contexts});
|
||||
|
||||
void addContext(VariableContext context) {
|
||||
contexts.add(context);
|
||||
@@ -2828,7 +2828,7 @@ class VariableDeclaration extends TreeNode implements ContextConsumer {
|
||||
@override
|
||||
List<VariableContext>? capturedContexts;
|
||||
|
||||
VariableDeclaration(this.variable) {
|
||||
new(this.variable) {
|
||||
variable.parent = this;
|
||||
variable.variableDeclaration = this;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class TypeVariableGraph extends Graph<int> {
|
||||
// variable with the index `i` in their bounds.
|
||||
late List<List<int>> edges;
|
||||
|
||||
TypeVariableGraph(this.typeParameters, this.bounds) {
|
||||
new(this.typeParameters, this.bounds) {
|
||||
assert(typeParameters.length == bounds.length);
|
||||
|
||||
vertices = new List<int>.filled(
|
||||
@@ -59,7 +59,7 @@ class OccurrenceCollectorVisitor implements DartTypeVisitor<void> {
|
||||
final Set<TypeParameter> typeParameters;
|
||||
Set<TypeParameter> occurred = new Set<TypeParameter>();
|
||||
|
||||
OccurrenceCollectorVisitor(this.typeParameters);
|
||||
new(this.typeParameters);
|
||||
|
||||
void visit(DartType node) => node.accept(this);
|
||||
|
||||
@@ -320,7 +320,7 @@ class TypeArgumentIssue {
|
||||
|
||||
final bool isGenericTypeAsArgumentIssue;
|
||||
|
||||
TypeArgumentIssue(
|
||||
new(
|
||||
this.index,
|
||||
this.argument,
|
||||
this.typeParameter,
|
||||
@@ -590,7 +590,7 @@ class _SuperBoundedTypeInverter extends ReplacementVisitor {
|
||||
final TypeEnvironment typeEnvironment;
|
||||
bool isOutermost = true;
|
||||
|
||||
_SuperBoundedTypeInverter(this.typeEnvironment);
|
||||
new(this.typeEnvironment);
|
||||
|
||||
bool flipTop(Variance variance) {
|
||||
return variance != Variance.contravariant;
|
||||
@@ -777,16 +777,14 @@ enum VarianceCalculationValue {
|
||||
|
||||
final Variance? variance;
|
||||
|
||||
const VarianceCalculationValue(this.variance);
|
||||
new(this.variance);
|
||||
|
||||
factory VarianceCalculationValue.fromVariance(Variance variance) =>
|
||||
switch (variance) {
|
||||
Variance.unrelated => VarianceCalculationValue.calculatedUnrelated,
|
||||
Variance.covariant => VarianceCalculationValue.calculatedCovariant,
|
||||
Variance.contravariant =>
|
||||
VarianceCalculationValue.calculatedContravariant,
|
||||
Variance.invariant => VarianceCalculationValue.calculatedInvariant,
|
||||
};
|
||||
factory fromVariance(Variance variance) => switch (variance) {
|
||||
Variance.unrelated => VarianceCalculationValue.calculatedUnrelated,
|
||||
Variance.covariant => VarianceCalculationValue.calculatedCovariant,
|
||||
Variance.contravariant => VarianceCalculationValue.calculatedContravariant,
|
||||
Variance.invariant => VarianceCalculationValue.calculatedInvariant,
|
||||
};
|
||||
|
||||
bool get isCalculated => variance != null;
|
||||
}
|
||||
@@ -799,7 +797,7 @@ class VarianceCalculator
|
||||
> {
|
||||
final TypeParameter typeParameter;
|
||||
|
||||
VarianceCalculator(this.typeParameter);
|
||||
new(this.typeParameter);
|
||||
|
||||
@override
|
||||
VarianceCalculationValue visitAuxiliaryType(
|
||||
@@ -1107,7 +1105,7 @@ bool hasGenericFunctionTypeAsTypeArgument(DartType type) {
|
||||
|
||||
class _HasGenericFunctionTypeAsTypeArgumentVisitor
|
||||
extends DartTypeVisitor1<bool, bool> {
|
||||
const _HasGenericFunctionTypeAsTypeArgumentVisitor();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool visitAuxiliaryType(AuxiliaryType node, bool isTypeArgument) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import '../ast.dart';
|
||||
/// Replacement visitor to clone a Constant if a subnode is replaced, and
|
||||
/// otherwise returns `null`.
|
||||
class ConstantReplacer implements ConstantVisitor<Constant?> {
|
||||
ConstantReplacer();
|
||||
new();
|
||||
final Map<Constant, Constant?> cache = {};
|
||||
|
||||
/// Like with Constants, `null` is used to signal that the [type] has not
|
||||
|
||||
@@ -15,7 +15,7 @@ class DartTypeEquivalence implements DartTypeVisitor1<bool, DartType> {
|
||||
bool _atTopLevel = true;
|
||||
List<Map<StructuralParameter, StructuralParameter>> _alphaRenamingStack = [];
|
||||
|
||||
DartTypeEquivalence(
|
||||
new(
|
||||
this.coreTypes, {
|
||||
this.equateTopTypes = false,
|
||||
this.ignoreAllNullabilities = false,
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'equivalence.dart';
|
||||
|
||||
/// The node or property currently visited by the [EquivalenceVisitor].
|
||||
abstract class State {
|
||||
const State();
|
||||
const new();
|
||||
|
||||
State? get parent;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class NodeState extends State {
|
||||
final Node a;
|
||||
final Node b;
|
||||
|
||||
NodeState(this.a, this.b, [this.parent]);
|
||||
new(this.a, this.b, [this.parent]);
|
||||
}
|
||||
|
||||
/// State for visiting an AST property in [EquivalenceVisitor]
|
||||
@@ -27,7 +27,7 @@ class PropertyState extends State {
|
||||
final State? parent;
|
||||
final String name;
|
||||
|
||||
PropertyState(this.name, [this.parent]);
|
||||
new(this.name, [this.parent]);
|
||||
}
|
||||
|
||||
/// The state of the equivalence visitor.
|
||||
@@ -38,7 +38,7 @@ class CheckingState {
|
||||
/// If `true`, inequivalences are currently reported.
|
||||
final bool isAsserting;
|
||||
|
||||
CheckingState({
|
||||
new({
|
||||
this.isAsserting = true,
|
||||
UnionFind<Reference>? assumedReferences,
|
||||
State? currentState,
|
||||
@@ -149,10 +149,7 @@ class EquivalenceResult {
|
||||
final bool hasInequivalences;
|
||||
final List<Inequivalence> registeredInequivalences;
|
||||
|
||||
EquivalenceResult({
|
||||
this.hasInequivalences = false,
|
||||
required this.registeredInequivalences,
|
||||
});
|
||||
new({this.hasInequivalences = false, required this.registeredInequivalences});
|
||||
|
||||
bool get isEquivalent =>
|
||||
!hasInequivalences && registeredInequivalences.isEmpty;
|
||||
@@ -173,7 +170,7 @@ class Inequivalence {
|
||||
final State state;
|
||||
final String message;
|
||||
|
||||
Inequivalence(this.state, this.message);
|
||||
new(this.state, this.message);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -251,12 +248,9 @@ class ReferenceName {
|
||||
final String? name;
|
||||
final String? uri;
|
||||
|
||||
ReferenceName.internal(this.kind, this.name, {this.parent, this.uri});
|
||||
new internal(this.kind, this.name, {this.parent, this.uri});
|
||||
|
||||
factory ReferenceName.fromNamedNode(
|
||||
NamedNode node, [
|
||||
ReferenceNameKind? memberKind,
|
||||
]) {
|
||||
factory fromNamedNode(NamedNode node, [ReferenceNameKind? memberKind]) {
|
||||
if (node is Library) {
|
||||
return new ReferenceName.internal(
|
||||
ReferenceNameKind.Library,
|
||||
@@ -340,7 +334,7 @@ class ReferenceName {
|
||||
}
|
||||
}
|
||||
|
||||
factory ReferenceName.fromCanonicalName(CanonicalName canonicalName) {
|
||||
factory fromCanonicalName(CanonicalName canonicalName) {
|
||||
List<CanonicalName> parents = [];
|
||||
CanonicalName? parent = canonicalName;
|
||||
while (parent != null) {
|
||||
|
||||
@@ -23,7 +23,7 @@ DartType? rawExtensionTypeErasure(DartType type) {
|
||||
///
|
||||
/// The visitor returns `null` if the type wasn't changed.
|
||||
class _ExtensionTypeErasure extends ReplacementVisitor {
|
||||
const _ExtensionTypeErasure();
|
||||
const new();
|
||||
|
||||
@override
|
||||
DartType? visitExtensionType(ExtensionType node, Variance variance) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import '../ast.dart';
|
||||
|
||||
class FindTypeVisitor implements DartTypeVisitor<bool> {
|
||||
const FindTypeVisitor();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool visitAuxiliaryType(AuxiliaryType node) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class FutureValueTypeVisitor implements DartTypeVisitor1<DartType, CoreTypes> {
|
||||
final DartTypeVisitor1AuxiliaryFunction<DartType, CoreTypes>?
|
||||
unhandledTypeHandler;
|
||||
|
||||
const FutureValueTypeVisitor({this.unhandledTypeHandler});
|
||||
const new({this.unhandledTypeHandler});
|
||||
|
||||
DartType visit(DartType node, CoreTypes coreTypes) =>
|
||||
node.accept1(this, coreTypes);
|
||||
|
||||
@@ -16,7 +16,7 @@ class HierarchyBasedTypeEnvironment extends TypeEnvironment {
|
||||
@override
|
||||
final ClassHierarchy hierarchy;
|
||||
|
||||
HierarchyBasedTypeEnvironment(CoreTypes coreTypes, this.hierarchy)
|
||||
new(CoreTypes coreTypes, this.hierarchy)
|
||||
: super.fromSubclass(coreTypes, hierarchy);
|
||||
|
||||
@override
|
||||
|
||||
@@ -44,7 +44,7 @@ DartType? nnbdTopMerge(CoreTypes coreTypes, DartType a, DartType b) {
|
||||
class NnbdTopMergeVisitor extends MergeVisitor {
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
NnbdTopMergeVisitor(this.coreTypes);
|
||||
new(this.coreTypes);
|
||||
|
||||
@override
|
||||
Nullability? mergeNullability(Nullability a, Nullability b) {
|
||||
|
||||
@@ -71,7 +71,7 @@ class NodeCreator {
|
||||
List<SwitchCase> _neededSwitchCases = [];
|
||||
|
||||
/// Creates a [NodeCreator] requested to create nodes of the specified kinds.
|
||||
NodeCreator({
|
||||
new({
|
||||
Iterable<ExpressionKind> expressions = ExpressionKind.values,
|
||||
Iterable<StatementKind> statements = StatementKind.values,
|
||||
Iterable<DartTypeKind> dartTypes = DartTypeKind.values,
|
||||
|
||||
@@ -25,7 +25,7 @@ DartType computeNonNull(DartType type) {
|
||||
///
|
||||
/// The visitor returns `null` if `NonNull(T) = T`.
|
||||
class _NonNullVisitor implements DartTypeVisitor<DartType?> {
|
||||
const _NonNullVisitor();
|
||||
const new();
|
||||
|
||||
@override
|
||||
DartType? visitAuxiliaryType(AuxiliaryType node) {
|
||||
|
||||
@@ -40,7 +40,7 @@ Supertype normSupertype(CoreTypes coreTypes, Supertype supertype) {
|
||||
class _Norm extends ReplacementVisitor {
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
_Norm(this.coreTypes);
|
||||
new(this.coreTypes);
|
||||
|
||||
@override
|
||||
DartType? visitInterfaceType(InterfaceType node, Variance variance) {
|
||||
|
||||
@@ -74,7 +74,7 @@ class AstTextStrategy {
|
||||
/// printed. If exceeded, '...' is printed instead.
|
||||
final int? maxConstantDepth;
|
||||
|
||||
const AstTextStrategy({
|
||||
const new({
|
||||
this.includeLibraryNamesInTypes = false,
|
||||
this.includeLibraryNamesInMembers = false,
|
||||
this.includeAuxiliaryProperties = false,
|
||||
@@ -102,7 +102,7 @@ class AstPrinter {
|
||||
late final Map<Variable, String> _variableDeclarationNames = {};
|
||||
late final Map<VariableBase, String> _variableNames = {};
|
||||
|
||||
AstPrinter(this._strategy);
|
||||
new(this._strategy);
|
||||
|
||||
bool get includeAuxiliaryProperties => _strategy.includeAuxiliaryProperties;
|
||||
|
||||
@@ -680,7 +680,7 @@ class AstPrinter {
|
||||
|
||||
class MarkingAstPrinter extends AstPrinter {
|
||||
Set<TreeNode> markThis;
|
||||
MarkingAstPrinter(super.strategy, this.markThis);
|
||||
new(super.strategy, this.markThis);
|
||||
|
||||
@override
|
||||
void writeStatement(Statement node) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import '../type_algebra.dart';
|
||||
/// Helper visitor that clones a type if a nested type is replaced, and
|
||||
/// otherwise returns `null`.
|
||||
class ReplacementVisitor implements DartTypeVisitor1<DartType?, Variance> {
|
||||
const ReplacementVisitor();
|
||||
const new();
|
||||
|
||||
Nullability? visitNullability(DartType node) => null;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ class Strategy extends EquivalenceStrategy {
|
||||
final bool unorderedConstructors;
|
||||
final bool unorderedAnnotations;
|
||||
|
||||
Strategy({
|
||||
new({
|
||||
required this.unorderedLibraries,
|
||||
required this.unorderedLibraryDependencies,
|
||||
required this.unorderedAdditionalExports,
|
||||
|
||||
@@ -29,7 +29,7 @@ class _LibraryCollector extends RecursiveVisitor {
|
||||
final bool collectViaReferencesToo;
|
||||
Set<Library> allSeenLibraries = {};
|
||||
|
||||
_LibraryCollector({required this.collectViaReferencesToo});
|
||||
new({required this.collectViaReferencesToo});
|
||||
|
||||
@override
|
||||
void defaultNode(Node node) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class Types with StandardBounds {
|
||||
@override
|
||||
final ClassHierarchyBase hierarchy;
|
||||
|
||||
Types(this.hierarchy);
|
||||
new(this.hierarchy);
|
||||
|
||||
@override
|
||||
CoreTypes get coreTypes => hierarchy.coreTypes;
|
||||
|
||||
@@ -59,7 +59,7 @@ List<DartType>? rawUnaliasTypes(List<DartType> types) {
|
||||
/// If [legacyEraseAliases] is `true`, the unaliased types will be legacy
|
||||
/// erased. This used when the [TypedefType] was used in a legacy library.
|
||||
class _Unalias extends ReplacementVisitor {
|
||||
const _Unalias();
|
||||
const new();
|
||||
|
||||
@override
|
||||
DartType visitTypedefType(TypedefType node, Variance variance) {
|
||||
|
||||
@@ -12,13 +12,13 @@ class UnionFindNode<T> {
|
||||
final T value;
|
||||
UnionFindNode<T>? parent;
|
||||
|
||||
UnionFindNode(this.value);
|
||||
new(this.value);
|
||||
}
|
||||
|
||||
class UnionFind<T> {
|
||||
final Map<T, UnionFindNode<T>> _nodeMap;
|
||||
|
||||
UnionFind({bool useIdentity = false})
|
||||
new({bool useIdentity = false})
|
||||
: _nodeMap = useIdentity ? new LinkedHashMap.identity() : {};
|
||||
|
||||
UnionFindNode<T> operator [](T value) =>
|
||||
|
||||
@@ -31,7 +31,7 @@ class TargetFlags {
|
||||
/// by their target platform.
|
||||
final bool includeUnsupportedPlatformLibraryStubs;
|
||||
|
||||
const TargetFlags({
|
||||
const new({
|
||||
this.trackCreationLocations = false,
|
||||
this.supportMirrors = true,
|
||||
this.isClosureContextLoweringEnabled = false,
|
||||
@@ -101,7 +101,7 @@ enum NumberSemantics {
|
||||
|
||||
// Backend specific constant evaluation behavior
|
||||
class ConstantsBackend {
|
||||
const ConstantsBackend({this.keepLocals = true});
|
||||
const new({this.keepLocals = true});
|
||||
|
||||
/// Lowering of a list constant to a backend-specific representation.
|
||||
Constant lowerListConstant(ListConstant constant) => constant;
|
||||
@@ -259,7 +259,7 @@ abstract class DartLibrarySupport {
|
||||
/// [DartLibrarySupport] that only relies on the "supported" property of
|
||||
/// the libraries specification.
|
||||
class DefaultDartLibrarySupport implements DartLibrarySupport {
|
||||
const DefaultDartLibrarySupport();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool computeDartLibrarySupport(
|
||||
@@ -274,10 +274,7 @@ class CustomizedDartLibrarySupport implements DartLibrarySupport {
|
||||
final Set<String> supported;
|
||||
final Set<String> unsupported;
|
||||
|
||||
const CustomizedDartLibrarySupport({
|
||||
this.supported = const {},
|
||||
this.unsupported = const {},
|
||||
});
|
||||
const new({this.supported = const {}, this.unsupported = const {}});
|
||||
|
||||
@override
|
||||
bool computeDartLibrarySupport(
|
||||
@@ -640,17 +637,14 @@ class NoneConstantsBackend extends ConstantsBackend {
|
||||
@override
|
||||
final bool supportsUnevaluatedConstants;
|
||||
|
||||
const NoneConstantsBackend({
|
||||
required this.supportsUnevaluatedConstants,
|
||||
super.keepLocals,
|
||||
});
|
||||
const new({required this.supportsUnevaluatedConstants, super.keepLocals});
|
||||
}
|
||||
|
||||
class NoneTarget extends Target {
|
||||
@override
|
||||
final TargetFlags flags;
|
||||
|
||||
NoneTarget(this.flags);
|
||||
new(this.flags);
|
||||
|
||||
@override
|
||||
int get enabledLateLowerings => LateLowering.none;
|
||||
@@ -827,7 +821,7 @@ class TestTargetFlags extends TargetFlags {
|
||||
final Set<String> supportedDartLibraries;
|
||||
final Set<String> unsupportedDartLibraries;
|
||||
|
||||
const TestTargetFlags({
|
||||
const new({
|
||||
bool trackCreationLocations = false,
|
||||
this.forceLateLoweringsForTesting,
|
||||
this.forceLateLoweringSentinelForTesting,
|
||||
@@ -882,7 +876,7 @@ class TestDartLibrarySupport implements DartLibrarySupport {
|
||||
final DartLibrarySupport delegate;
|
||||
final TestTargetFlags flags;
|
||||
|
||||
TestDartLibrarySupport(this.delegate, this.flags);
|
||||
new(this.delegate, this.flags);
|
||||
|
||||
@override
|
||||
bool computeDartLibrarySupport(
|
||||
@@ -904,7 +898,7 @@ class TestDartLibrarySupport implements DartLibrarySupport {
|
||||
class TargetWrapper extends Target {
|
||||
final Target _target;
|
||||
|
||||
TargetWrapper(this._target);
|
||||
new(this._target);
|
||||
|
||||
@override
|
||||
TargetFlags get flags => _target.flags;
|
||||
@@ -1122,7 +1116,7 @@ class TestTargetWrapper extends TargetWrapper with TestTargetMixin {
|
||||
@override
|
||||
final TestTargetFlags flags;
|
||||
|
||||
TestTargetWrapper(Target target, this.flags) : super(target);
|
||||
new(Target target, this.flags) : super(target);
|
||||
}
|
||||
|
||||
/// Extends a Target to transform outlines to meet the requirements
|
||||
|
||||
@@ -58,7 +58,7 @@ class ParsedNamedType extends ParsedType {
|
||||
|
||||
final ParsedNullability parsedNullability;
|
||||
|
||||
ParsedNamedType(this.name, this.arguments, this.parsedNullability);
|
||||
new(this.name, this.arguments, this.parsedNullability);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -82,7 +82,7 @@ class ParsedNamedType extends ParsedType {
|
||||
abstract class ParsedDeclaration extends ParsedType {
|
||||
final String name;
|
||||
|
||||
ParsedDeclaration(this.name);
|
||||
new(this.name);
|
||||
}
|
||||
|
||||
class ParsedClass extends ParsedDeclaration {
|
||||
@@ -92,7 +92,7 @@ class ParsedClass extends ParsedDeclaration {
|
||||
final List<ParsedType> interfaces;
|
||||
final ParsedFunctionType? callableType;
|
||||
|
||||
ParsedClass(
|
||||
new(
|
||||
String name,
|
||||
this.typeVariables,
|
||||
this.supertype,
|
||||
@@ -139,7 +139,7 @@ class ParsedExtension extends ParsedDeclaration {
|
||||
final List<ParsedTypeVariable> typeVariables;
|
||||
final ParsedNamedType onType;
|
||||
|
||||
ParsedExtension(String name, this.typeVariables, this.onType) : super(name);
|
||||
new(String name, this.typeVariables, this.onType) : super(name);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -168,7 +168,7 @@ class ParsedTypedef extends ParsedDeclaration {
|
||||
|
||||
final ParsedType type;
|
||||
|
||||
ParsedTypedef(String name, this.typeVariables, this.type) : super(name);
|
||||
new(String name, this.typeVariables, this.type) : super(name);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -198,7 +198,7 @@ class ParsedExtensionTypeDeclaration extends ParsedDeclaration {
|
||||
|
||||
final List<ParsedType> interfaces;
|
||||
|
||||
ParsedExtensionTypeDeclaration(
|
||||
new(
|
||||
String name,
|
||||
this.typeVariables,
|
||||
this.declaredRepresentationType,
|
||||
@@ -240,7 +240,7 @@ class ParsedFunctionType extends ParsedType {
|
||||
|
||||
final ParsedNullability parsedNullability;
|
||||
|
||||
ParsedFunctionType(
|
||||
new(
|
||||
this.typeVariables,
|
||||
this.returnType,
|
||||
this.arguments,
|
||||
@@ -274,7 +274,7 @@ class ParsedRecordType extends ParsedType {
|
||||
final List<ParsedNamedArgument> named;
|
||||
final ParsedNullability parsedNullability;
|
||||
|
||||
ParsedRecordType(this.positional, this.named, this.parsedNullability);
|
||||
new(this.positional, this.named, this.parsedNullability);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -318,7 +318,7 @@ class ParsedTypeVariable extends ParsedType {
|
||||
|
||||
final ParsedType? bound;
|
||||
|
||||
ParsedTypeVariable(this.name, this.bound);
|
||||
new(this.name, this.bound);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -341,7 +341,7 @@ class ParsedIntersectionType extends ParsedType {
|
||||
|
||||
final ParsedType b;
|
||||
|
||||
ParsedIntersectionType(this.a, this.b);
|
||||
new(this.a, this.b);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -363,7 +363,7 @@ class ParsedArguments {
|
||||
final List<ParsedType> positional;
|
||||
final List<ParsedNamedArgument> named;
|
||||
|
||||
ParsedArguments(this.required, this.positional, this.named)
|
||||
new(this.required, this.positional, this.named)
|
||||
: assert(positional.isEmpty || named.isEmpty);
|
||||
|
||||
@override
|
||||
@@ -398,7 +398,7 @@ class ParsedNamedArgument {
|
||||
final ParsedType type;
|
||||
final String name;
|
||||
|
||||
ParsedNamedArgument(this.isRequired, this.type, this.name);
|
||||
new(this.isRequired, this.type, this.name);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -420,7 +420,7 @@ class Token {
|
||||
|
||||
Token? next;
|
||||
|
||||
Token(this.charOffset, this.text, {this.isIdentifier = false});
|
||||
new(this.charOffset, this.text, {this.isIdentifier = false});
|
||||
|
||||
bool get isEof => text == null;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class Parser {
|
||||
|
||||
String source;
|
||||
|
||||
Parser(this.peek, this.source);
|
||||
new(this.peek, this.source);
|
||||
|
||||
bool get atEof => peek.isEof;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class Env {
|
||||
|
||||
late TypeParserEnvironment _libraryEnvironment;
|
||||
|
||||
Env(String source) {
|
||||
new(String source) {
|
||||
Uri libraryUri = Uri.parse('memory:main.dart');
|
||||
Uri coreUri = Uri.parse("dart:core");
|
||||
TypeParserEnvironment coreEnvironment = new TypeParserEnvironment(
|
||||
@@ -228,7 +228,7 @@ class TypeParserEnvironment {
|
||||
final List</* TypeParameterType | StructuralParameterType */ Object>
|
||||
pendingNullabilities = <TypeParameterType>[];
|
||||
|
||||
TypeParserEnvironment(this.uri, this.fileUri, [this._parent]);
|
||||
new(this.uri, this.fileUri, [this._parent]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -341,7 +341,7 @@ class TypeParserEnvironment {
|
||||
class _KernelFromParsedType implements Visitor<Node, TypeParserEnvironment> {
|
||||
final Map<String, DartType Function()>? additionalTypes; // Can be null.
|
||||
|
||||
const _KernelFromParsedType({this.additionalTypes});
|
||||
const new({this.additionalTypes});
|
||||
|
||||
DartType _parseType(ParsedType type, TypeParserEnvironment environment) {
|
||||
return type.accept<Node, TypeParserEnvironment>(this, environment)
|
||||
@@ -860,12 +860,12 @@ class ParameterEnvironment {
|
||||
final List<TypeParameter> parameters;
|
||||
final TypeParserEnvironment environment;
|
||||
|
||||
const ParameterEnvironment(this.parameters, this.environment);
|
||||
const new(this.parameters, this.environment);
|
||||
}
|
||||
|
||||
class FunctionTypeParameterEnvironment {
|
||||
final List<StructuralParameter> parameters;
|
||||
final TypeParserEnvironment environment;
|
||||
|
||||
const FunctionTypeParameterEnvironment(this.parameters, this.environment);
|
||||
const new(this.parameters, this.environment);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ class NormalNamer<T> extends Namer<T> {
|
||||
@override
|
||||
final String prefix;
|
||||
|
||||
NormalNamer(this.prefix);
|
||||
new(this.prefix);
|
||||
}
|
||||
|
||||
class ConstantNamer extends RecursiveVisitor with Namer<Constant> {
|
||||
@override
|
||||
final String prefix;
|
||||
|
||||
ConstantNamer(this.prefix);
|
||||
new(this.prefix);
|
||||
|
||||
@override
|
||||
String getName(Constant constant) {
|
||||
@@ -266,7 +266,7 @@ class Printer extends VisitorDefault<void> with VisitorVoidMixin {
|
||||
static final int SYMBOL = 2;
|
||||
int state = SPACE;
|
||||
|
||||
Printer(
|
||||
new(
|
||||
this.sink, {
|
||||
NameSystem? syntheticNames,
|
||||
this.showOffsets = false,
|
||||
|
||||
@@ -27,7 +27,7 @@ class TextIterator implements Iterator<Object? /* String? | TextIterator? */> {
|
||||
final String input;
|
||||
int index;
|
||||
|
||||
TextIterator(this.input, this.index);
|
||||
new(this.input, this.index);
|
||||
|
||||
// Consume spaces.
|
||||
void skipWhitespace() {
|
||||
|
||||
@@ -135,8 +135,7 @@ class _WidgetCallSiteTransformer extends Transformer {
|
||||
/// of the library.
|
||||
Library? _currentLibrary;
|
||||
|
||||
_WidgetCallSiteTransformer({required WidgetCreatorTracker tracker})
|
||||
: _tracker = tracker;
|
||||
new({required WidgetCreatorTracker tracker}) : _tracker = tracker;
|
||||
|
||||
/// Builds a call to the const constructor of the _Location
|
||||
/// object specifying the location where a constructor call was made and
|
||||
@@ -905,7 +904,7 @@ class _TrackingClasses {
|
||||
final Class locationClass;
|
||||
final String locationFieldName;
|
||||
|
||||
_TrackingClasses({
|
||||
new({
|
||||
required this.hasCreationLocationClass,
|
||||
required this.locationClass,
|
||||
required this.locationFieldName,
|
||||
|
||||
@@ -166,11 +166,7 @@ class FreshTypeParameters {
|
||||
/// Substitution from the original type parameters to [freshTypeArguments].
|
||||
final Substitution substitution;
|
||||
|
||||
FreshTypeParameters(
|
||||
this.freshTypeParameters,
|
||||
this.freshTypeArguments,
|
||||
this.substitution,
|
||||
);
|
||||
new(this.freshTypeParameters, this.freshTypeArguments, this.substitution);
|
||||
|
||||
DartType substitute(DartType type) => substitution.substituteType(type);
|
||||
}
|
||||
@@ -254,11 +250,7 @@ class FreshStructuralParametersFromTypeParameters {
|
||||
/// Substitution from the original type parameters to [freshTypeArguments].
|
||||
final Substitution substitution;
|
||||
|
||||
FreshStructuralParametersFromTypeParameters(
|
||||
this.freshTypeParameters,
|
||||
this.freshTypeArguments,
|
||||
this.substitution,
|
||||
);
|
||||
new(this.freshTypeParameters, this.freshTypeArguments, this.substitution);
|
||||
|
||||
DartType substitute(DartType type) => substitution.substituteType(type);
|
||||
}
|
||||
@@ -318,11 +310,7 @@ class FreshTypeParametersFromStructuralParameters {
|
||||
/// Substitution from the original type parameters to [freshTypeArguments].
|
||||
final FunctionTypeInstantiator instantiator;
|
||||
|
||||
FreshTypeParametersFromStructuralParameters(
|
||||
this.freshTypeParameters,
|
||||
this.freshTypeArguments,
|
||||
this.instantiator,
|
||||
);
|
||||
new(this.freshTypeParameters, this.freshTypeArguments, this.instantiator);
|
||||
|
||||
DartType substitute(DartType type) => instantiator.substitute(type);
|
||||
}
|
||||
@@ -480,11 +468,7 @@ class FreshStructuralParameters {
|
||||
/// Substitution from the original type parameters to [freshTypeArguments].
|
||||
final FunctionTypeInstantiator instantiator;
|
||||
|
||||
FreshStructuralParameters(
|
||||
this.freshTypeParameters,
|
||||
this.freshTypeArguments,
|
||||
this.instantiator,
|
||||
);
|
||||
new(this.freshTypeParameters, this.freshTypeArguments, this.instantiator);
|
||||
|
||||
DartType substitute(DartType type) => instantiator.substitute(type);
|
||||
|
||||
@@ -511,7 +495,7 @@ class FreshStructuralParameters {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
abstract class Substitution {
|
||||
const Substitution();
|
||||
const new();
|
||||
|
||||
static const Substitution empty = _NullSubstitution.instance;
|
||||
|
||||
@@ -788,7 +772,7 @@ class _AllFreeTypeVariablesVisitor implements DartTypeVisitor<void> {
|
||||
class _NullSubstitution extends Substitution {
|
||||
static const _NullSubstitution instance = const _NullSubstitution();
|
||||
|
||||
const _NullSubstitution();
|
||||
const new();
|
||||
|
||||
@override
|
||||
DartType getSubstitute(TypeParameter parameter, bool upperBound) {
|
||||
@@ -809,7 +793,7 @@ class _MapSubstitution extends Substitution {
|
||||
final Map<TypeParameter, DartType> upper;
|
||||
final Map<TypeParameter, DartType> lower;
|
||||
|
||||
_MapSubstitution(this.upper, this.lower);
|
||||
new(this.upper, this.lower);
|
||||
|
||||
@override
|
||||
DartType? getSubstitute(TypeParameter parameter, bool upperBound) {
|
||||
@@ -824,7 +808,7 @@ class _SingletonSubstitution extends Substitution {
|
||||
final TypeParameter typeParameter;
|
||||
final DartType type;
|
||||
|
||||
_SingletonSubstitution(this.typeParameter, this.type);
|
||||
new(this.typeParameter, this.type);
|
||||
|
||||
@override
|
||||
DartType? getSubstitute(TypeParameter parameter, bool upperBound) {
|
||||
@@ -838,7 +822,7 @@ class _SingletonSubstitution extends Substitution {
|
||||
class _TopSubstitutor extends _TypeSubstitutor {
|
||||
final Substitution substitution;
|
||||
|
||||
_TopSubstitutor(this.substitution, bool contravariant) : super(null) {
|
||||
new(this.substitution, bool contravariant) : super(null) {
|
||||
if (contravariant) {
|
||||
invertVariance();
|
||||
}
|
||||
@@ -858,7 +842,7 @@ class _TopSubstitutor extends _TypeSubstitutor {
|
||||
class _TypeDeclarationBottomSubstitution extends Substitution {
|
||||
final GenericDeclaration declaration;
|
||||
|
||||
_TypeDeclarationBottomSubstitution(this.declaration);
|
||||
new(this.declaration);
|
||||
|
||||
@override
|
||||
DartType? getSubstitute(TypeParameter parameter, bool upperBound) {
|
||||
@@ -872,7 +856,7 @@ class _TypeDeclarationBottomSubstitution extends Substitution {
|
||||
class _CombinedSubstitution extends Substitution {
|
||||
final Substitution first, second;
|
||||
|
||||
_CombinedSubstitution(this.first, this.second);
|
||||
new(this.first, this.second);
|
||||
|
||||
@override
|
||||
DartType? getSubstitute(TypeParameter parameter, bool upperBound) {
|
||||
@@ -887,10 +871,8 @@ class _InnerTypeSubstitutor extends _SubstitutorBase {
|
||||
final Map<StructuralParameter, DartType> substitution =
|
||||
<StructuralParameter, DartType>{};
|
||||
|
||||
_InnerTypeSubstitutor({
|
||||
required _SubstitutorBase? outer,
|
||||
required bool covariantContext,
|
||||
}) : super(outer: outer, covariantContext: covariantContext);
|
||||
new({required _SubstitutorBase? outer, required bool covariantContext})
|
||||
: super(outer: outer, covariantContext: covariantContext);
|
||||
|
||||
@override
|
||||
DartType? lookup(TypeParameter parameter, bool upperBound) {
|
||||
@@ -1204,7 +1186,7 @@ abstract class _SubstitutorBase implements DartTypeVisitor<DartType> {
|
||||
/// check quickly if anything happened in a substitution.
|
||||
int useCounter = 0;
|
||||
|
||||
_SubstitutorBase({required this.outer, required this.covariantContext});
|
||||
new({required this.outer, required this.covariantContext});
|
||||
|
||||
DartType? lookup(TypeParameter parameter, bool upperBound);
|
||||
|
||||
@@ -1269,7 +1251,7 @@ abstract class _SubstitutorBase implements DartTypeVisitor<DartType> {
|
||||
}
|
||||
|
||||
abstract class _TypeSubstitutor extends _SubstitutorBase {
|
||||
_TypeSubstitutor(_SubstitutorBase? outer)
|
||||
new(_SubstitutorBase? outer)
|
||||
: super(
|
||||
outer: outer,
|
||||
covariantContext: outer == null ? true : outer.covariantContext,
|
||||
@@ -1467,19 +1449,15 @@ class FunctionTypeInstantiator implements DartTypeVisitor<DartType?> {
|
||||
Map<StructuralParameter, DartType> substitutionMap;
|
||||
FunctionTypeInstantiator? outer;
|
||||
|
||||
FunctionTypeInstantiator.fromMap(this.substitutionMap, {this.outer});
|
||||
new fromMap(this.substitutionMap, {this.outer});
|
||||
|
||||
FunctionTypeInstantiator.fromIterables(
|
||||
List<StructuralParameter> from,
|
||||
List<DartType> to,
|
||||
) : this.fromMap(
|
||||
new fromIterables(List<StructuralParameter> from, List<DartType> to)
|
||||
: this.fromMap(
|
||||
new Map<StructuralParameter, DartType>.fromIterables(from, to),
|
||||
);
|
||||
|
||||
FunctionTypeInstantiator.fromInstantiation(
|
||||
FunctionType functionType,
|
||||
List<DartType> arguments,
|
||||
) : this.fromIterables(functionType.typeParameters, arguments);
|
||||
new fromInstantiation(FunctionType functionType, List<DartType> arguments)
|
||||
: this.fromIterables(functionType.typeParameters, arguments);
|
||||
|
||||
static FunctionType instantiate(
|
||||
FunctionType functionType,
|
||||
@@ -1775,7 +1753,7 @@ class _OccurrenceVisitor extends FindTypeVisitor {
|
||||
/// implementer of [DartType] is encountered.
|
||||
final DartTypeVisitorAuxiliaryFunction<bool>? unhandledTypeHandler;
|
||||
|
||||
_OccurrenceVisitor(this.variables, {this.unhandledTypeHandler});
|
||||
new(this.variables, {this.unhandledTypeHandler});
|
||||
|
||||
bool visit(DartType type) => type.accept(this);
|
||||
|
||||
@@ -1827,10 +1805,7 @@ class _StructuralParameterOccurrenceVisitor implements FindTypeVisitor {
|
||||
/// implementer of [DartType] is encountered.
|
||||
final DartTypeVisitorAuxiliaryFunction<bool>? unhandledTypeHandler;
|
||||
|
||||
_StructuralParameterOccurrenceVisitor(
|
||||
this.variables, {
|
||||
this.unhandledTypeHandler,
|
||||
});
|
||||
new(this.variables, {this.unhandledTypeHandler});
|
||||
|
||||
bool visit(DartType node) => node.accept(this);
|
||||
|
||||
@@ -1925,7 +1900,7 @@ class _StructuralParameterOccurrenceVisitor implements FindTypeVisitor {
|
||||
class _FreeFunctionTypeVariableVisitor extends FindTypeVisitor {
|
||||
final Set<StructuralParameter> variables = new Set<StructuralParameter>();
|
||||
|
||||
_FreeFunctionTypeVariableVisitor();
|
||||
new();
|
||||
|
||||
bool visit(DartType node) => node.accept(this);
|
||||
|
||||
@@ -1946,7 +1921,7 @@ class _FreeFunctionTypeVariableVisitor extends FindTypeVisitor {
|
||||
class _FreeTypeVariableVisitor extends FindTypeVisitor {
|
||||
final Set<StructuralParameter> boundVariables;
|
||||
|
||||
_FreeTypeVariableVisitor({Set<StructuralParameter>? boundVariables})
|
||||
new({Set<StructuralParameter>? boundVariables})
|
||||
: this.boundVariables = boundVariables ?? <StructuralParameter>{};
|
||||
|
||||
bool visit(DartType type) => type.accept(this);
|
||||
@@ -2006,7 +1981,7 @@ bool isPrimitiveDartType(DartType type) {
|
||||
/// to its purpose. The reason for having a visitor is to make the need for an
|
||||
/// update visible when a new implementer of [DartType] is introduced in Kernel.
|
||||
class _PrimitiveTypeVerifier implements DartTypeVisitor<bool> {
|
||||
const _PrimitiveTypeVerifier();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool visitAuxiliaryType(AuxiliaryType node) {
|
||||
@@ -2095,7 +2070,7 @@ DartType unwrapNullabilityConstructor(DartType type) {
|
||||
/// Implementing the function as a visitor makes the necessity of supporting a
|
||||
/// new implementation of [DartType] visible at compile time.
|
||||
class _NullabilityConstructorUnwrapper implements DartTypeVisitor<DartType> {
|
||||
const _NullabilityConstructorUnwrapper();
|
||||
const new();
|
||||
|
||||
@override
|
||||
DartType visitAuxiliaryType(AuxiliaryType node) {
|
||||
@@ -2192,7 +2167,7 @@ abstract class TypeVariableEliminatorBase extends ReplacementVisitor {
|
||||
final CoreTypes coreTypes;
|
||||
late bool _isLeastClosure;
|
||||
|
||||
TypeVariableEliminatorBase({required this.coreTypes});
|
||||
new({required this.coreTypes});
|
||||
|
||||
bool containsTypeVariablesToEliminate(DartType type);
|
||||
|
||||
@@ -2287,7 +2262,7 @@ class TypeParameterEliminator extends TypeVariableEliminatorBase {
|
||||
final Set<TypeParameter> nominalEliminationTargets;
|
||||
final DartTypeVisitorAuxiliaryFunction<bool>? unhandledTypeHandler;
|
||||
|
||||
TypeParameterEliminator({
|
||||
new({
|
||||
required this.structuralEliminationTargets,
|
||||
required this.nominalEliminationTargets,
|
||||
required CoreTypes coreTypes,
|
||||
@@ -2332,8 +2307,7 @@ class TypeParameterEliminator extends TypeVariableEliminatorBase {
|
||||
class FreeTypeParameterEliminator extends TypeVariableEliminatorBase {
|
||||
Set<StructuralParameter> _boundVariables = <StructuralParameter>{};
|
||||
|
||||
FreeTypeParameterEliminator({required CoreTypes coreTypes})
|
||||
: super(coreTypes: coreTypes);
|
||||
new({required CoreTypes coreTypes}) : super(coreTypes: coreTypes);
|
||||
|
||||
@override
|
||||
DartType? visitFunctionType(FunctionType node, Variance variance) {
|
||||
@@ -2433,7 +2407,7 @@ bool isTypeWithoutNullabilityMarker(DartType type) {
|
||||
}
|
||||
|
||||
class _NullabilityMarkerDetector implements DartTypeVisitor<bool> {
|
||||
const _NullabilityMarkerDetector();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool visitAuxiliaryType(AuxiliaryType node) {
|
||||
|
||||
@@ -24,7 +24,7 @@ abstract class TypeChecker {
|
||||
Library? currentLibrary;
|
||||
InterfaceType? currentThisType;
|
||||
|
||||
TypeChecker(this.coreTypes, this.hierarchy, {this.ignoreSdk = true})
|
||||
new(this.coreTypes, this.hierarchy, {this.ignoreSdk = true})
|
||||
: environment = new TypeEnvironment(coreTypes, hierarchy);
|
||||
|
||||
void checkComponent(Component component) {
|
||||
@@ -149,7 +149,7 @@ class TypeCheckingVisitor
|
||||
DartType? currentYieldType;
|
||||
AsyncMarker currentAsyncMarker = AsyncMarker.Sync;
|
||||
|
||||
TypeCheckingVisitor(this.checker, this.environment, this.hierarchy);
|
||||
new(this.checker, this.environment, this.hierarchy);
|
||||
|
||||
void checkAssignable(TreeNode where, DartType from, DartType to) {
|
||||
checker.checkAssignable(where, from, to);
|
||||
|
||||
@@ -20,10 +20,9 @@ abstract class TypeEnvironment extends Types {
|
||||
@override
|
||||
final CoreTypes coreTypes;
|
||||
|
||||
TypeEnvironment.fromSubclass(this.coreTypes, ClassHierarchyBase base)
|
||||
: super(base);
|
||||
new fromSubclass(this.coreTypes, ClassHierarchyBase base) : super(base);
|
||||
|
||||
factory TypeEnvironment(CoreTypes coreTypes, ClassHierarchy hierarchy) {
|
||||
factory(CoreTypes coreTypes, ClassHierarchy hierarchy) {
|
||||
return new HierarchyBasedTypeEnvironment(coreTypes, hierarchy);
|
||||
}
|
||||
|
||||
@@ -596,14 +595,14 @@ class IsSubtypeOf {
|
||||
|
||||
final DartType? supertype;
|
||||
|
||||
const IsSubtypeOf._internal(bool isSuccess, this.subtype, this.supertype)
|
||||
const new _internal(bool isSuccess, this.subtype, this.supertype)
|
||||
: _isSuccess = isSuccess;
|
||||
|
||||
/// Subtype check succeeds.
|
||||
const IsSubtypeOf.success() : this._internal(true, null, null);
|
||||
const new success() : this._internal(true, null, null);
|
||||
|
||||
/// Subtype check fails.
|
||||
const IsSubtypeOf.failure() : this._internal(false, null, null);
|
||||
const new failure() : this._internal(false, null, null);
|
||||
|
||||
/// Checks if two types are in relation based solely on their nullabilities.
|
||||
///
|
||||
@@ -615,10 +614,7 @@ class IsSubtypeOf {
|
||||
/// is the result of a subtype check on the arguments `int` and `num`, and
|
||||
/// `Rn` is the result of [IsSubtypeOf.basedSolelyOnNullabilities] on the
|
||||
/// types `List<int>?` and `List<num>*`.
|
||||
factory IsSubtypeOf.basedSolelyOnNullabilities(
|
||||
DartType subtype,
|
||||
DartType supertype,
|
||||
) {
|
||||
factory basedSolelyOnNullabilities(DartType subtype, DartType supertype) {
|
||||
if (subtype is InvalidType) {
|
||||
if (supertype is InvalidType) {
|
||||
return const IsSubtypeOf.success();
|
||||
@@ -634,7 +630,7 @@ class IsSubtypeOf {
|
||||
|
||||
/// Checks if two types are in relation based solely on their nullabilities
|
||||
/// and where the caller knows that neither type is a `InvalidType`.
|
||||
factory IsSubtypeOf.basedSolelyOnNullabilitiesNotInvalidType(
|
||||
factory basedSolelyOnNullabilitiesNotInvalidType(
|
||||
DartType subtype,
|
||||
DartType supertype,
|
||||
) {
|
||||
@@ -803,7 +799,7 @@ abstract class StaticTypeContext {
|
||||
|
||||
/// Creates a static type context for computing static types in the body
|
||||
/// of [member].
|
||||
factory StaticTypeContext(
|
||||
factory(
|
||||
Member member,
|
||||
TypeEnvironment typeEnvironment, {
|
||||
StaticTypeCache cache,
|
||||
@@ -811,7 +807,7 @@ abstract class StaticTypeContext {
|
||||
|
||||
/// Creates a static type context for computing static types of annotations
|
||||
/// in [library].
|
||||
factory StaticTypeContext.forAnnotations(
|
||||
factory forAnnotations(
|
||||
Library library,
|
||||
TypeEnvironment typeEnvironment, {
|
||||
StaticTypeCache cache,
|
||||
@@ -855,23 +851,20 @@ class StaticTypeContextImpl implements StaticTypeContext {
|
||||
|
||||
/// Creates a static type context for computing static types in the body
|
||||
/// of [member].
|
||||
StaticTypeContextImpl(
|
||||
Member member,
|
||||
TypeEnvironment typeEnvironment, {
|
||||
StaticTypeCache? cache,
|
||||
}) : this.direct(
|
||||
member.enclosingLibrary,
|
||||
typeEnvironment,
|
||||
thisType: member.enclosingClass?.getThisType(
|
||||
typeEnvironment.coreTypes,
|
||||
member.enclosingLibrary.nonNullable,
|
||||
),
|
||||
cache: cache,
|
||||
);
|
||||
new(Member member, TypeEnvironment typeEnvironment, {StaticTypeCache? cache})
|
||||
: this.direct(
|
||||
member.enclosingLibrary,
|
||||
typeEnvironment,
|
||||
thisType: member.enclosingClass?.getThisType(
|
||||
typeEnvironment.coreTypes,
|
||||
member.enclosingLibrary.nonNullable,
|
||||
),
|
||||
cache: cache,
|
||||
);
|
||||
|
||||
/// Creates a static type context for computing static types in the body of
|
||||
/// a member, provided the enclosing [_library] and [thisType].
|
||||
StaticTypeContextImpl.direct(
|
||||
new direct(
|
||||
this._library,
|
||||
this.typeEnvironment, {
|
||||
this.thisType,
|
||||
@@ -880,7 +873,7 @@ class StaticTypeContextImpl implements StaticTypeContext {
|
||||
|
||||
/// Creates a static type context for computing static types of annotations
|
||||
/// in [library].
|
||||
StaticTypeContextImpl.forAnnotations(
|
||||
new forAnnotations(
|
||||
Library library,
|
||||
TypeEnvironment typeEnvironment, {
|
||||
StaticTypeCache? cache,
|
||||
@@ -937,15 +930,15 @@ abstract class StatefulStaticTypeContext implements StaticTypeContext {
|
||||
|
||||
/// Creates a [StatefulStaticTypeContext] that supports entering multiple
|
||||
/// libraries and/or members successively.
|
||||
factory StatefulStaticTypeContext.stacked(TypeEnvironment typeEnvironment) =
|
||||
factory stacked(TypeEnvironment typeEnvironment) =
|
||||
_StackedStatefulStaticTypeContext;
|
||||
|
||||
/// Creates a [StatefulStaticTypeContext] that only supports entering one
|
||||
/// library and/or member at a time.
|
||||
factory StatefulStaticTypeContext.flat(TypeEnvironment typeEnvironment) =
|
||||
factory flat(TypeEnvironment typeEnvironment) =
|
||||
_FlatStatefulStaticTypeContext;
|
||||
|
||||
StatefulStaticTypeContext._internal(this.typeEnvironment);
|
||||
new _internal(this.typeEnvironment);
|
||||
|
||||
/// Updates the [nonNullable] and [thisType] to match static type context for
|
||||
/// the member [node].
|
||||
@@ -980,8 +973,7 @@ class _FlatStatefulStaticTypeContext extends StatefulStaticTypeContext {
|
||||
Library? _currentLibrary;
|
||||
Member? _currentMember;
|
||||
|
||||
_FlatStatefulStaticTypeContext(TypeEnvironment typeEnvironment)
|
||||
: super._internal(typeEnvironment);
|
||||
new(TypeEnvironment typeEnvironment) : super._internal(typeEnvironment);
|
||||
|
||||
@override
|
||||
Library get enclosingLibrary => _library;
|
||||
@@ -1088,8 +1080,7 @@ class _StackedStatefulStaticTypeContext extends StatefulStaticTypeContext {
|
||||
final List<_StaticTypeContextState> _contextStack =
|
||||
<_StaticTypeContextState>[];
|
||||
|
||||
_StackedStatefulStaticTypeContext(TypeEnvironment typeEnvironment)
|
||||
: super._internal(typeEnvironment);
|
||||
new(TypeEnvironment typeEnvironment) : super._internal(typeEnvironment);
|
||||
|
||||
@override
|
||||
Library get enclosingLibrary => _library;
|
||||
@@ -1192,7 +1183,7 @@ class _StaticTypeContextState {
|
||||
final Library _library;
|
||||
final InterfaceType? _thisType;
|
||||
|
||||
_StaticTypeContextState(this._node, this._library, this._thisType);
|
||||
new(this._node, this._library, this._thisType);
|
||||
}
|
||||
|
||||
/// Describes whether only performing a shape check is sufficient for a
|
||||
|
||||
@@ -22,7 +22,7 @@ class LibraryGraph implements Graph<Library> {
|
||||
final Iterable<Library> libraries;
|
||||
final Library? coreLibrary;
|
||||
|
||||
LibraryGraph(this.libraries, {this.coreLibrary});
|
||||
new(this.libraries, {this.coreLibrary});
|
||||
|
||||
@override
|
||||
Iterable<Library> get vertices => libraries;
|
||||
@@ -116,7 +116,7 @@ class StrongComponentGraph<T> implements Graph<List<T>> {
|
||||
final Map<T, List<T>> _elementToComponentMap = {};
|
||||
final Map<List<T>, Set<List<T>>> _neighborsMap = {};
|
||||
|
||||
StrongComponentGraph(this.subgraph, this.components) {
|
||||
new(this.subgraph, this.components) {
|
||||
for (List<T> component in components) {
|
||||
for (T element in component) {
|
||||
_elementToComponentMap[element] = component;
|
||||
|
||||
@@ -48,7 +48,7 @@ enum VerificationStage {
|
||||
|
||||
/// Interface that defines how the AST is verified.
|
||||
class Verification {
|
||||
const Verification();
|
||||
const new();
|
||||
|
||||
/// Returns `true` if [node] is allowed to have no file offset.
|
||||
bool allowNoFileOffset(VerificationStage stage, TreeNode node) {
|
||||
@@ -79,7 +79,7 @@ void verifyComponent(
|
||||
}
|
||||
|
||||
class VerificationErrorListener {
|
||||
const VerificationErrorListener();
|
||||
const new();
|
||||
|
||||
void reportError(
|
||||
String details, {
|
||||
@@ -100,7 +100,7 @@ class VerificationError {
|
||||
|
||||
final String details;
|
||||
|
||||
VerificationError(this.context, this.node, this.details);
|
||||
new(this.context, this.node, this.details);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -200,7 +200,7 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
|
||||
);
|
||||
}
|
||||
|
||||
VerifyingVisitor(
|
||||
new(
|
||||
this.target,
|
||||
this.stage, {
|
||||
required this.skipPlatform,
|
||||
@@ -2277,7 +2277,7 @@ class VerifyGetStaticType extends RecursiveVisitor {
|
||||
Member? currentMember;
|
||||
final StatefulStaticTypeContext _staticTypeContext;
|
||||
|
||||
VerifyGetStaticType(this.env)
|
||||
new(this.env)
|
||||
: _staticTypeContext = new StatefulStaticTypeContext.stacked(env);
|
||||
|
||||
@override
|
||||
@@ -2359,7 +2359,7 @@ class AllowedTypes implements DartTypeVisitor<bool> {
|
||||
|
||||
final bool inConstant;
|
||||
|
||||
const AllowedTypes({required this.inConstant});
|
||||
const new({required this.inConstant});
|
||||
|
||||
@override
|
||||
bool visitAuxiliaryType(AuxiliaryType node) => false;
|
||||
|
||||
+31
-31
@@ -9,7 +9,7 @@ import 'dart:collection';
|
||||
import 'ast.dart';
|
||||
|
||||
abstract class ExpressionVisitor<R> {
|
||||
const ExpressionVisitor();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryExpression(AuxiliaryExpression node);
|
||||
R visitInvalidExpression(InvalidExpression node);
|
||||
@@ -310,7 +310,7 @@ mixin PatternVisitorDefaultMixin<R> implements PatternVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class StatementVisitor<R> {
|
||||
const StatementVisitor();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryStatement(AuxiliaryStatement node);
|
||||
|
||||
@@ -422,7 +422,7 @@ mixin StatementVisitorDefaultMixin<R> implements StatementVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class VariableVisitor<R> {
|
||||
const VariableVisitor();
|
||||
const new();
|
||||
|
||||
R visitLegacyVariable(LegacyVariable node);
|
||||
R visitPositionalParameter(PositionalParameter node);
|
||||
@@ -458,7 +458,7 @@ mixin VariableVisitorDefaultMixin<R> implements VariableVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class MemberVisitor<R> {
|
||||
const MemberVisitor();
|
||||
const new();
|
||||
|
||||
R visitConstructor(Constructor node);
|
||||
R visitProcedure(Procedure node);
|
||||
@@ -479,7 +479,7 @@ mixin MemberVisitorDefaultMixin<R> implements MemberVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class MemberVisitor1<R, A> {
|
||||
const MemberVisitor1();
|
||||
const new();
|
||||
|
||||
R visitConstructor(Constructor node, A arg);
|
||||
R visitProcedure(Procedure node, A arg);
|
||||
@@ -500,7 +500,7 @@ mixin MemberVisitor1DefaultMixin<R, A> implements MemberVisitor1<R, A> {
|
||||
}
|
||||
|
||||
abstract class InitializerVisitor<R> {
|
||||
const InitializerVisitor();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryInitializer(AuxiliaryInitializer node);
|
||||
R visitInvalidInitializer(InvalidInitializer node);
|
||||
@@ -536,7 +536,7 @@ mixin InitializerVisitorDefaultMixin<R> implements InitializerVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class InitializerVisitor1<R, A> {
|
||||
const InitializerVisitor1();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryInitializer(AuxiliaryInitializer node, A arg);
|
||||
R visitInvalidInitializer(InvalidInitializer node, A arg);
|
||||
@@ -584,7 +584,7 @@ abstract class TreeVisitor<R>
|
||||
VariableVisitor<R>,
|
||||
MemberVisitor<R>,
|
||||
InitializerVisitor<R> {
|
||||
const TreeVisitor();
|
||||
const new();
|
||||
|
||||
// Classes
|
||||
R visitClass(Class node);
|
||||
@@ -686,7 +686,7 @@ abstract class TreeVisitorDefault<R>
|
||||
MemberVisitorDefaultMixin<R>,
|
||||
TreeVisitorDefaultMixin<R>
|
||||
implements TreeVisitor<R> {
|
||||
const TreeVisitorDefault();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R defaultExpression(Expression node) => defaultTreeNode(node);
|
||||
@@ -710,7 +710,7 @@ abstract class TreeVisitor1<R, A>
|
||||
VariableVisitor1<R, A>,
|
||||
MemberVisitor1<R, A>,
|
||||
InitializerVisitor1<R, A> {
|
||||
const TreeVisitor1();
|
||||
const new();
|
||||
|
||||
// Classes
|
||||
R visitClass(Class node, A arg);
|
||||
@@ -820,7 +820,7 @@ abstract class TreeVisitor1Default<R, A>
|
||||
InitializerVisitor1DefaultMixin<R, A>,
|
||||
MemberVisitor1DefaultMixin<R, A>
|
||||
implements TreeVisitor1<R, A> {
|
||||
const TreeVisitor1Default();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R defaultExpression(Expression node, A arg) => defaultTreeNode(node, arg);
|
||||
@@ -840,7 +840,7 @@ typedef DartTypeVisitorAuxiliaryFunction<R> =
|
||||
R Function(AuxiliaryType node, R Function(AuxiliaryType node) recursor);
|
||||
|
||||
abstract class DartTypeVisitor<R> {
|
||||
const DartTypeVisitor();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryType(AuxiliaryType node);
|
||||
R visitInvalidType(InvalidType node);
|
||||
@@ -913,7 +913,7 @@ typedef DartTypeVisitor1AuxiliaryFunction<R, A> =
|
||||
);
|
||||
|
||||
abstract class DartTypeVisitor1<R, A> {
|
||||
const DartTypeVisitor1();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryType(AuxiliaryType node, A arg);
|
||||
R visitInvalidType(InvalidType node, A arg);
|
||||
@@ -989,7 +989,7 @@ mixin DartTypeVisitor1DefaultMixin<R, A> implements DartTypeVisitor1<R, A> {
|
||||
/// Use [ComputeOnceConstantVisitor] or [VisitOnceConstantVisitor] to visit
|
||||
/// a constant node while ensuring each subnode is only visited once.
|
||||
abstract class ConstantVisitor<R> {
|
||||
const ConstantVisitor();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryConstant(AuxiliaryConstant node);
|
||||
R visitNullConstant(NullConstant node);
|
||||
@@ -1066,7 +1066,7 @@ mixin ConstantVisitorDefaultMixin<R> implements ConstantVisitor<R> {
|
||||
}
|
||||
|
||||
abstract class ConstantVisitor1<R, A> {
|
||||
const ConstantVisitor1();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryConstant(AuxiliaryConstant node, A arg);
|
||||
R visitNullConstant(NullConstant node, A arg);
|
||||
@@ -1366,7 +1366,7 @@ abstract class _ConstantCallback<R> {
|
||||
class _ConstantCallbackVisitor<R> implements ConstantVisitor<R> {
|
||||
final _ConstantCallback _callback;
|
||||
|
||||
_ConstantCallbackVisitor(this._callback);
|
||||
new(this._callback);
|
||||
|
||||
@override
|
||||
R visitUnevaluatedConstant(UnevaluatedConstant node) =>
|
||||
@@ -1499,7 +1499,7 @@ abstract class ComputeOnceConstantVisitor<R> implements _ConstantCallback<R> {
|
||||
late final _ConstantCallbackVisitor<R> _visitor;
|
||||
Map<Constant, R> cache = new LinkedHashMap.identity();
|
||||
|
||||
ComputeOnceConstantVisitor() {
|
||||
new() {
|
||||
_visitor = new _ConstantCallbackVisitor<R>(this);
|
||||
}
|
||||
|
||||
@@ -1530,7 +1530,7 @@ abstract class VisitOnceConstantVisitor implements _ConstantCallback<void> {
|
||||
late final _ConstantCallbackVisitor<void> _visitor;
|
||||
Set<Constant> cache = new LinkedHashSet.identity();
|
||||
|
||||
VisitOnceConstantVisitor() {
|
||||
new() {
|
||||
_visitor = new _ConstantCallbackVisitor<void>(this);
|
||||
}
|
||||
|
||||
@@ -1546,7 +1546,7 @@ abstract class VisitOnceConstantVisitor implements _ConstantCallback<void> {
|
||||
}
|
||||
|
||||
abstract class MemberReferenceVisitor<R> {
|
||||
const MemberReferenceVisitor();
|
||||
const new();
|
||||
|
||||
R visitFieldReference(Field node);
|
||||
R visitConstructorReference(Constructor node);
|
||||
@@ -1568,7 +1568,7 @@ mixin MemberReferenceVisitorDefaultMixin<R>
|
||||
}
|
||||
|
||||
abstract class MemberReferenceVisitor1<R, A> {
|
||||
const MemberReferenceVisitor1();
|
||||
const new();
|
||||
|
||||
R visitFieldReference(Field node, A arg);
|
||||
R visitConstructorReference(Constructor node, A arg);
|
||||
@@ -1598,7 +1598,7 @@ abstract class Visitor<R>
|
||||
ConstantVisitor<R>,
|
||||
MemberReferenceVisitor<R>,
|
||||
ConstantReferenceVisitor<R> {
|
||||
const Visitor();
|
||||
const new();
|
||||
|
||||
// TODO(johnniwinther): Move these to [MemberReferenceVisitor].
|
||||
R visitClassReference(Class node);
|
||||
@@ -1636,7 +1636,7 @@ abstract class VisitorDefault<R> extends TreeVisitorDefault<R>
|
||||
ConstantVisitorDefaultMixin<R>,
|
||||
MemberReferenceVisitorDefaultMixin<R>,
|
||||
ConstantReferenceVisitorDefaultMixin<R> {
|
||||
const VisitorDefault();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R defaultTreeNode(TreeNode node) => defaultNode(node);
|
||||
@@ -1654,7 +1654,7 @@ abstract class Visitor1<R, A> extends TreeVisitor1<R, A>
|
||||
ConstantVisitor1<R, A>,
|
||||
MemberReferenceVisitor1<R, A>,
|
||||
ConstantReferenceVisitor1<R, A> {
|
||||
const Visitor1();
|
||||
const new();
|
||||
|
||||
// TODO(johnniwinther): Move these to [MemberReferenceVisitor1].
|
||||
R visitClassReference(Class node, A arg);
|
||||
@@ -1699,7 +1699,7 @@ abstract class Visitor1Default<R, A> extends TreeVisitor1Default<R, A>
|
||||
ConstantVisitor1DefaultMixin<R, A>,
|
||||
MemberReferenceVisitor1DefaultMixin<R, A>,
|
||||
ConstantReferenceVisitor1DefaultMixin<R, A> {
|
||||
const Visitor1Default();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R defaultTreeNode(TreeNode node, A arg) => defaultNode(node, arg);
|
||||
@@ -1849,7 +1849,7 @@ mixin VisitorDefaultValueMixin<R> implements VisitorDefault<R> {
|
||||
|
||||
/// Recursive visitor that doesn't return anything from its visit methods.
|
||||
class RecursiveVisitor extends VisitorDefault<void> with VisitorVoidMixin {
|
||||
const RecursiveVisitor();
|
||||
const new();
|
||||
|
||||
@override
|
||||
void defaultNode(Node node) {
|
||||
@@ -1861,7 +1861,7 @@ class RecursiveVisitor extends VisitorDefault<void> with VisitorVoidMixin {
|
||||
/// visit methods.
|
||||
class RecursiveResultVisitor<R> extends VisitorDefault<R?>
|
||||
with VisitorNullMixin<R> {
|
||||
const RecursiveResultVisitor();
|
||||
const new();
|
||||
|
||||
@override
|
||||
R? defaultNode(Node node) {
|
||||
@@ -1896,7 +1896,7 @@ class RecursiveResultVisitor<R> extends VisitorDefault<R?>
|
||||
/// }
|
||||
///
|
||||
class Transformer extends TreeVisitorDefault<TreeNode> {
|
||||
const Transformer();
|
||||
const new();
|
||||
|
||||
T transform<T extends TreeNode>(T node) {
|
||||
return node.accept<TreeNode>(this) as T;
|
||||
@@ -2003,7 +2003,7 @@ class Transformer extends TreeVisitorDefault<TreeNode> {
|
||||
/// }
|
||||
///
|
||||
class RemovingTransformer extends TreeVisitor1Default<TreeNode, TreeNode?> {
|
||||
const RemovingTransformer();
|
||||
const new();
|
||||
|
||||
/// Visits [node], returning the transformation result.
|
||||
///
|
||||
@@ -2328,7 +2328,7 @@ class RemovingTransformer extends TreeVisitor1Default<TreeNode, TreeNode?> {
|
||||
}
|
||||
|
||||
abstract class ExpressionVisitor1<R, A> {
|
||||
const ExpressionVisitor1();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryExpression(AuxiliaryExpression node, A arg);
|
||||
R visitInvalidExpression(InvalidExpression node, A arg);
|
||||
@@ -2677,7 +2677,7 @@ mixin PatternVisitor1DefaultMixin<R, A> implements PatternVisitor1<R, A> {
|
||||
}
|
||||
|
||||
abstract class StatementVisitor1<R, A> {
|
||||
const StatementVisitor1();
|
||||
const new();
|
||||
|
||||
R visitAuxiliaryStatement(AuxiliaryStatement node, A arg);
|
||||
R visitExpressionStatement(ExpressionStatement node, A arg);
|
||||
@@ -2778,7 +2778,7 @@ mixin StatementVisitor1DefaultMixin<R, A> implements StatementVisitor1<R, A> {
|
||||
}
|
||||
|
||||
abstract class VariableVisitor1<R, A> {
|
||||
const VariableVisitor1();
|
||||
const new();
|
||||
|
||||
R visitLegacyVariable(LegacyVariable node, A arg);
|
||||
R visitPositionalParameter(PositionalParameter node, A arg);
|
||||
|
||||
@@ -6,7 +6,7 @@ name: kernel
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: '^3.12.0-0'
|
||||
sdk: '^3.13.0-0'
|
||||
|
||||
resolution: workspace
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class BenchmarkResult {
|
||||
final double warmupUs;
|
||||
final List<int> runsUs;
|
||||
|
||||
BenchmarkResult(this.name, this.coldRunUs, this.warmupUs, this.runsUs);
|
||||
new(this.name, this.coldRunUs, this.warmupUs, this.runsUs);
|
||||
|
||||
static T add<T extends num>(T x, T y) => x + y as T;
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ class Test {
|
||||
final bool? unorderedConstructors;
|
||||
final bool? unorderedAnnotations;
|
||||
|
||||
Test(
|
||||
new(
|
||||
Node Function(bool) create, {
|
||||
this.inequivalence,
|
||||
this.unorderedLibraries,
|
||||
|
||||
@@ -28,8 +28,7 @@ class BasicClassHierarchy implements ClassHierarchy {
|
||||
final List<Class> classes = <Class>[];
|
||||
final Map<Class, int> classIndex = <Class, int>{};
|
||||
|
||||
BasicClassHierarchy(Component component)
|
||||
: knownLibraries = component.libraries.toSet() {
|
||||
new(Component component) : knownLibraries = component.libraries.toSet() {
|
||||
for (var library in knownLibraries) {
|
||||
for (var classNode in library.classes) {
|
||||
buildSuperTypeSets(classNode);
|
||||
|
||||
@@ -86,7 +86,7 @@ class ClosedWorldClassHierarchyTest {
|
||||
|
||||
ClassHierarchy? _hierarchy;
|
||||
|
||||
ClosedWorldClassHierarchyTest() {
|
||||
new() {
|
||||
coreTypes = new CoreTypes(component);
|
||||
Uri uri = Uri.parse('org-dartlang:///test.dart');
|
||||
library = new Library(uri, fileUri: uri, name: 'test');
|
||||
|
||||
@@ -151,7 +151,7 @@ void testMemberCloning() {
|
||||
}
|
||||
|
||||
class NoFileOffsetEquivalenceStrategy extends EquivalenceStrategy {
|
||||
const NoFileOffsetEquivalenceStrategy();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool checkTreeNode_fileOffset(
|
||||
@@ -165,7 +165,7 @@ class NoFileOffsetEquivalenceStrategy extends EquivalenceStrategy {
|
||||
}
|
||||
|
||||
class MemberEquivalenceStrategy extends EquivalenceStrategy {
|
||||
const MemberEquivalenceStrategy();
|
||||
const new();
|
||||
|
||||
void assumeClonedReferences(
|
||||
EquivalenceVisitor visitor,
|
||||
|
||||
@@ -204,7 +204,7 @@ class Test {
|
||||
final String? inequivalence;
|
||||
final EquivalenceStrategy strategy;
|
||||
|
||||
Test(
|
||||
new(
|
||||
this.a,
|
||||
this.b, {
|
||||
this.inequivalence,
|
||||
@@ -215,7 +215,7 @@ class Test {
|
||||
}
|
||||
|
||||
class IgnoreIntLiteralValue extends EquivalenceStrategy {
|
||||
const IgnoreIntLiteralValue();
|
||||
const new();
|
||||
|
||||
@override
|
||||
bool checkIntLiteral_value(
|
||||
|
||||
@@ -47,7 +47,7 @@ class Test {
|
||||
final String output;
|
||||
final String? typeParameters;
|
||||
|
||||
const Test(this.input, this.output, [this.typeParameters]);
|
||||
const new(this.input, this.output, [this.typeParameters]);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -18,7 +18,7 @@ const String F = 'F';
|
||||
class TestGraph implements Graph<String> {
|
||||
final Map<String, List<String>> graph;
|
||||
|
||||
TestGraph(this.graph);
|
||||
new(this.graph);
|
||||
|
||||
@override
|
||||
Iterable<String> get vertices => graph.keys;
|
||||
|
||||
@@ -438,5 +438,5 @@ class ReferenceNameObject {
|
||||
final ReferenceName referenceName;
|
||||
final Object object;
|
||||
|
||||
ReferenceNameObject(this.referenceName, this.object);
|
||||
new(this.referenceName, this.object);
|
||||
}
|
||||
|
||||
@@ -78,14 +78,11 @@ class TestCase {
|
||||
Map<String, String?>?
|
||||
expectedSubstitution; // Null if unification should fail.
|
||||
|
||||
TestCase.success(
|
||||
this.type1,
|
||||
this.type2,
|
||||
Map<String, String?> expectedSubstitution,
|
||||
) : this.expectedSubstitution = expectedSubstitution,
|
||||
new success(this.type1, this.type2, Map<String, String?> expectedSubstitution)
|
||||
: this.expectedSubstitution = expectedSubstitution,
|
||||
this.quantifiedVariables = expectedSubstitution.keys;
|
||||
|
||||
TestCase.fail(this.type1, this.type2, this.quantifiedVariables);
|
||||
new fail(this.type1, this.type2, this.quantifiedVariables);
|
||||
|
||||
bool get shouldSucceed => expectedSubstitution != null;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class DartTypeParser {
|
||||
final Map<String, /* TypeParameter | StructuralParameter */ Object>
|
||||
localTypeParameters = <String, Object>{};
|
||||
|
||||
DartTypeParser(this.string, this.environment);
|
||||
new(this.string, this.environment);
|
||||
|
||||
/* TreeNode? | StructuralParameter? */
|
||||
Object? lookupType(String name) {
|
||||
@@ -386,7 +386,7 @@ class LazyTypeEnvironment {
|
||||
late final Library dummyLibrary;
|
||||
final Component component = new Component();
|
||||
|
||||
LazyTypeEnvironment() {
|
||||
new() {
|
||||
Uri uri = Uri.parse('file://dummy.dart');
|
||||
dummyLibrary = new Library(uri, fileUri: uri);
|
||||
component.libraries.add(dummyLibrary..parent = component);
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestCase {
|
||||
final Map<String, TypeBound> bounds;
|
||||
final String expected;
|
||||
|
||||
TestCase(this.type, this.bounds, this.expected);
|
||||
new(this.type, this.bounds, this.expected);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
@@ -60,7 +60,7 @@ class TestCase {
|
||||
class TypeBound {
|
||||
final String lower, upper;
|
||||
|
||||
TypeBound(this.lower, this.upper);
|
||||
new(this.lower, this.upper);
|
||||
}
|
||||
|
||||
TypeBound bound(String lower, String upper) => new TypeBound(lower, upper);
|
||||
|
||||
@@ -940,7 +940,7 @@ class TestHarness {
|
||||
return new TypeParameter(name, objectRawType, const DynamicType());
|
||||
}
|
||||
|
||||
TestHarness() {
|
||||
new() {
|
||||
setupComponent();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user