mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[3.0 alpha][vm] Remove transformation of List default constructor
In preparation for removal of the List default constructor from dart:core. See https://github.com/dart-lang/sdk/issues/49529 TEST=existing Change-Id: I68cd8097ed33c0b0d91a75cd890f53fd1ea1ed09 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273723 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
a7907254ad
commit
783642d594
|
@ -23,7 +23,7 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
|
|||
throw "Expected ${expected}, actual ${actual}";
|
||||
}
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#new#tearOff<T extends core::num>([core::int? length = #C7]) → core::List<self::_#MyList#new#tearOff::T>
|
||||
return core::_List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
return core::List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#filled#tearOff<T extends core::num>(core::int length, self::_#MyList#filled#tearOff::T fill, {core::bool growable = #C2}) → core::List<self::_#MyList#filled#tearOff::T>
|
||||
return core::List::filled<self::_#MyList#filled#tearOff::T>(length, fill, growable: growable);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#empty#tearOff<T extends core::num>({core::bool growable = #C2}) → core::List<self::_#MyList#empty#tearOff::T>
|
||||
|
|
|
@ -23,7 +23,7 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
|
|||
throw "Expected ${expected}, actual ${actual}";
|
||||
}
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#new#tearOff<T extends core::num>([core::int? length = #C7]) → core::List<self::_#MyList#new#tearOff::T>
|
||||
return core::_List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
return core::List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#filled#tearOff<T extends core::num>(core::int length, self::_#MyList#filled#tearOff::T fill, {core::bool growable = #C2}) → core::List<self::_#MyList#filled#tearOff::T>
|
||||
return core::List::filled<self::_#MyList#filled#tearOff::T>(length, fill, growable: growable);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#empty#tearOff<T extends core::num>({core::bool growable = #C2}) → core::List<self::_#MyList#empty#tearOff::T>
|
||||
|
|
|
@ -23,7 +23,7 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
|
|||
throw "Expected ${expected}, actual ${actual}";
|
||||
}
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#new#tearOff<T extends core::num>([core::int? length = #C7]) → core::List<self::_#MyList#new#tearOff::T>
|
||||
return core::_List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
return core::List::•<self::_#MyList#new#tearOff::T>(length);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#filled#tearOff<T extends core::num>(core::int length, self::_#MyList#filled#tearOff::T fill, {core::bool growable = #C2}) → core::List<self::_#MyList#filled#tearOff::T>
|
||||
return core::List::filled<self::_#MyList#filled#tearOff::T>(length, fill, growable: growable);
|
||||
static method /* from org-dartlang-sdk:///sdk/lib/_internal/vm_shared/lib/array_patch.dart */ _#MyList#empty#tearOff<T extends core::num>({core::bool growable = #C2}) → core::List<self::_#MyList#empty#tearOff::T>
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:vm/transformations/specializer/factory_specializer.dart';
|
|||
/// factories of VM-specific classes.
|
||||
///
|
||||
/// new List() => new _GrowableList(0)
|
||||
/// new List(n) => new _List(n)
|
||||
/// new List.empty() => new _List.empty()
|
||||
/// new List.empty(growable: false) => new _List.empty()
|
||||
/// new List.empty(growable: true) => new _GrowableList.empty()
|
||||
|
@ -22,7 +21,6 @@ import 'package:vm/transformations/specializer/factory_specializer.dart';
|
|||
/// new List.generate(n, y, growable: false) => new _List.generate(n, y)
|
||||
///
|
||||
class ListFactorySpecializer extends BaseSpecializer {
|
||||
final Procedure _defaultListFactory;
|
||||
final Procedure _listEmptyFactory;
|
||||
final Procedure _listFilledFactory;
|
||||
final Procedure _listGenerateFactory;
|
||||
|
@ -36,9 +34,7 @@ class ListFactorySpecializer extends BaseSpecializer {
|
|||
final Procedure _fixedListGenerateFactory;
|
||||
|
||||
ListFactorySpecializer(CoreTypes coreTypes)
|
||||
: _defaultListFactory =
|
||||
coreTypes.index.getProcedure('dart:core', 'List', ''),
|
||||
_listEmptyFactory =
|
||||
: _listEmptyFactory =
|
||||
coreTypes.index.getProcedure('dart:core', 'List', 'empty'),
|
||||
_listFilledFactory =
|
||||
coreTypes.index.getProcedure('dart:core', 'List', 'filled'),
|
||||
|
@ -60,7 +56,6 @@ class ListFactorySpecializer extends BaseSpecializer {
|
|||
coreTypes.index.getProcedure('dart:core', '_List', 'filled'),
|
||||
_fixedListGenerateFactory =
|
||||
coreTypes.index.getProcedure('dart:core', '_List', 'generate') {
|
||||
assert(_defaultListFactory.isFactory);
|
||||
assert(_listEmptyFactory.isFactory);
|
||||
assert(_listFilledFactory.isFactory);
|
||||
assert(_listGenerateFactory.isFactory);
|
||||
|
@ -73,25 +68,12 @@ class ListFactorySpecializer extends BaseSpecializer {
|
|||
assert(_fixedListFilledFactory.isFactory);
|
||||
assert(_fixedListGenerateFactory.isFactory);
|
||||
transformers.addAll({
|
||||
_defaultListFactory: transformDefaultFactory,
|
||||
_listEmptyFactory: transformListEmptyFactory,
|
||||
_listFilledFactory: transformListFilledFactory,
|
||||
_listGenerateFactory: transformListGeneratorFactory,
|
||||
});
|
||||
}
|
||||
|
||||
TreeNode transformDefaultFactory(StaticInvocation node) {
|
||||
final args = node.arguments;
|
||||
if (args.positional.isEmpty) {
|
||||
return StaticInvocation(_growableListFactory,
|
||||
Arguments([new IntLiteral(0)], types: args.types))
|
||||
..fileOffset = node.fileOffset;
|
||||
} else {
|
||||
return StaticInvocation(_fixedListFactory, args)
|
||||
..fileOffset = node.fileOffset;
|
||||
}
|
||||
}
|
||||
|
||||
TreeNode transformListEmptyFactory(StaticInvocation node) {
|
||||
final args = node.arguments;
|
||||
assert(args.positional.isEmpty);
|
||||
|
|
Loading…
Reference in a new issue